1 #ifndef _EVTR_INTERNAL_H_ 2 #define _EVTR_INTERNAL_H_ 3 4 #include <sys/queue.h> 5 #include "evtr.h" 6 7 extern unsigned evtr_debug; 8 9 #define DEFINE_DEBUG_FLAG(nam, chr) \ 10 nam = 1 << (chr - 'a') 11 12 enum debug_flags { 13 DEFINE_DEBUG_FLAG(IO, 'i'), 14 DEFINE_DEBUG_FLAG(DS, 't'), /* data structures */ 15 DEFINE_DEBUG_FLAG(LEX, 'l'), 16 DEFINE_DEBUG_FLAG(PARSE, 'p'), 17 DEFINE_DEBUG_FLAG(MISC, 'm'), 18 }; 19 20 #define printd(subsys, ...) \ 21 do { \ 22 if (evtr_debug & (subsys)) { \ 23 fprintf(stderr, "%s:", #subsys); \ 24 fprintf(stderr, __VA_ARGS__); \ 25 } \ 26 } while (0) 27 28 #define printw(...) \ 29 do { \ 30 fprintf(stderr, "Warning: "); \ 31 fprintf(stderr, __VA_ARGS__); \ 32 } while(0) 33 34 35 TAILQ_HEAD(evtr_value_list, evtr_variable_value); 36 typedef struct evtr_value_list *evtr_value_list_t; 37 38 struct symtab *symtab_new(void); 39 struct evtr_variable * symtab_find(const struct symtab *, const char *); 40 int symtab_insert(struct symtab *, const char *, struct evtr_variable *); 41 void symtab_destroy(struct symtab *); 42 43 44 int parse_string(evtr_event_t, struct symtab *, const char *, char *, size_t); 45 int parse_var(const char *, struct symtab *, struct evtr_variable **, 46 char *, size_t); 47 48 struct hashtab; 49 struct hashentry; 50 struct hashtab * hash_new(void); 51 int hash_find(const struct hashtab *, uintptr_t, uintptr_t *); 52 struct hashentry * hash_insert(struct hashtab *, uintptr_t, uintptr_t); 53 54 void evtr_variable_value_list_destroy(evtr_value_list_t); 55 56 57 #endif /* _EVTR_INTERNAL_H_ */ 58