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 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

Diff markup

Differences between /externals/g4tools/include/tools/glutess/dict (Version 11.3.0) and /externals/g4tools/include/tools/glutess/dict (Version 6.0.p1)


  1 // see license file for original license.         
  2                                                   
  3 #ifndef tools_glutess_dict_list                   
  4 #define tools_glutess_dict_list                   
  5                                                   
  6 /* Use #define's so that another heap implemen    
  7                                                   
  8 #define DictKey   DictListKey                     
  9 #define Dict    DictList                          
 10 #define DictNode  DictListNode                    
 11                                                   
 12 #define dictNewDict(frame,leq)    __gl_dictLis    
 13 #define dictDeleteDict(dict)    __gl_dictListD    
 14                                                   
 15 #define dictSearch(dict,key)    __gl_dictListS    
 16 #define dictInsert(dict,key)    __gl_dictListI    
 17 #define dictInsertBefore(dict,node,key) __gl_d    
 18 #define dictDelete(dict,node)   __gl_dictListD    
 19                                                   
 20 #define dictKey(n)      __gl_dictListKey(n)       
 21 #define dictSucc(n)     __gl_dictListSucc(n)      
 22 #define dictPred(n)     __gl_dictListPred(n)      
 23 #define dictMin(d)      __gl_dictListMin(d)       
 24 #define dictMax(d)      __gl_dictListMax(d)       
 25                                                   
 26 typedef void *DictKey;                            
 27 typedef struct Dict Dict;                         
 28 typedef struct DictNode DictNode;                 
 29                                                   
 30 #define __gl_dictListKey(n) ((n)->key)            
 31 #define __gl_dictListSucc(n)  ((n)->next)         
 32 #define __gl_dictListPred(n)  ((n)->prev)         
 33 #define __gl_dictListMin(d) ((d)->head.next)      
 34 #define __gl_dictListMax(d) ((d)->head.prev)      
 35 #define __gl_dictListInsert(d,k) (dictInsertBe    
 36                                                   
 37 /*** Private data structures ***/                 
 38                                                   
 39 struct DictNode {                                 
 40   DictKey key;                                    
 41   DictNode  *next;                                
 42   DictNode  *prev;                                
 43 };                                                
 44                                                   
 45 struct Dict {                                     
 46   DictNode  head;                                 
 47   void    *frame;                                 
 48   int   (*leq)(void *frame, DictKey key1, Dict    
 49 };                                                
 50                                                   
 51 //////////////////////////////////////////////    
 52 /// inlined C code : /////////////////////////    
 53 //////////////////////////////////////////////    
 54 #include <cstddef>                                
 55 #include "memalloc"                               
 56                                                   
 57 inline Dict *dictNewDict( void *frame,int (*le    
 58   Dict *dict = (Dict *) memAlloc( sizeof( Dict    
 59   DictNode *head;                                 
 60                                                   
 61   if (dict == NULL) return NULL;                  
 62                                                   
 63   head = &dict->head;                             
 64                                                   
 65   head->key = NULL;                               
 66   head->next = head;                              
 67   head->prev = head;                              
 68                                                   
 69   dict->frame = frame;                            
 70   dict->leq = leq;                                
 71                                                   
 72   return dict;                                    
 73 }                                                 
 74                                                   
 75 inline void dictDeleteDict( Dict *dict ) {        
 76   DictNode *node, *next;                          
 77                                                   
 78   for( node = dict->head.next; node != &dict->    
 79     next = node->next;                            
 80     memFree( node );                              
 81   }                                               
 82   memFree( dict );                                
 83 }                                                 
 84                                                   
 85 /* Search returns the node with the smallest k    
 86  * to the given key.  If there is no such key,    
 87  * key is NULL.  Similarly, Succ(Max(d)) has a    
 88  */                                               
 89                                                   
 90 inline DictNode *dictInsertBefore( Dict *dict,    
 91   DictNode *newNode;                              
 92                                                   
 93   do {                                            
 94     node = node->prev;                            
 95   } while( node->key != NULL && ! (*dict->leq)    
 96                                                   
 97   newNode = (DictNode *) memAlloc( sizeof( Dic    
 98   if (newNode == NULL) return NULL;               
 99                                                   
100   newNode->key = key;                             
101   newNode->next = node->next;                     
102   node->next->prev = newNode;                     
103   newNode->prev = node;                           
104   node->next = newNode;                           
105                                                   
106   return newNode;                                 
107 }                                                 
108                                                   
109 inline void dictDelete( Dict * /*dict*/, DictN    
110 {                                                 
111   node->next->prev = node->prev;                  
112   node->prev->next = node->next;                  
113   memFree( node );                                
114 }                                                 
115                                                   
116 inline DictNode *dictSearch( Dict *dict, DictK    
117 {                                                 
118   DictNode *node = &dict->head;                   
119                                                   
120   do {                                            
121     node = node->next;                            
122   } while( node->key != NULL && ! (*dict->leq)    
123                                                   
124   return node;                                    
125 }                                                 
126                                                   
127 #endif