00001 #include "stmt/statement.h" 00002 #include "timerange.h" 00003 00004 typedef struct _HashTable HashTable; 00005 00010 typedef struct { 00011 Node node; 00012 int isnil; 00013 } TKey; 00014 00015 #define key2int(k) ((unsigned int)(unsigned long)((k)->node.literal) ) 00016 #define equalkey(k1,k2) ( !node_compare(&(k1)->node, &(k2)->node) ) 00017 #define isnilkey(k) ((k)->isnil) 00018 #define setnilkey(k) (k)->isnil = 1 00019 #define setkey(k,n) (k)->isnil = 0; (k)->node = (n) 00020 00025 typedef struct safe_table safe_table; 00026 00027 typedef union { 00028 safe_table* up; 00029 TimeRange* tr; 00030 } TValue; 00031 00032 #define isnilvalue(v) ( (v)->up == NULL ) 00033 #define setnilvalue(v) ((v)->up = NULL) 00034 00035 HashTable* hash_new(int hashsize); 00036 void hash_free(HashTable *t); 00037 TValue* hash_set(HashTable *t, const TKey *key); 00038 const TValue* hash_get(HashTable *t, const TKey *key); 00039 int hash_next(HashTable *t, TKey **key, TValue **value);