1 #ifndef _EVTR_INTERNAL_H_
2 #define _EVTR_INTERNAL_H_
7 extern unsigned evtr_debug
;
9 #define DEFINE_DEBUG_FLAG(nam, chr) \
10 nam = 1 << (chr - 'a')
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'),
20 #define printd(subsys, ...) \
22 if (evtr_debug & (subsys)) { \
23 fprintf(stderr, "%s:", #subsys); \
24 fprintf(stderr, __VA_ARGS__); \
30 fprintf(stderr, "Warning: "); \
31 fprintf(stderr, __VA_ARGS__); \
35 struct ktrfmt_parse_ctx
{
36 struct symtab
*symtab
;
37 struct evtr_variable
*var
;
38 struct evtr_variable_value
*val
;
45 TAILQ_HEAD(evtr_value_list
, evtr_variable_value
);
46 typedef struct evtr_value_list
*evtr_value_list_t
;
48 struct symtab
*symtab_new(void);
49 struct evtr_variable
* symtab_find(const struct symtab
*, const char *);
50 int symtab_insert(struct symtab
*, const char *, struct evtr_variable
*);
51 void symtab_destroy(struct symtab
*);
54 int parse_string(evtr_event_t
, struct symtab
*, const char *, char *, size_t);
55 int parse_var(const char *, struct symtab
*, struct evtr_variable
**,
60 struct hashtab
* hash_new(void);
61 int hash_find(const struct hashtab
*, uintptr_t, uintptr_t *);
62 struct hashentry
* hash_insert(struct hashtab
*, uintptr_t, uintptr_t);
64 void evtr_variable_value_list_destroy(evtr_value_list_t
);
67 #endif /* _EVTR_INTERNAL_H_ */