4 extern unsigned int hexval(unsigned int c
);
11 struct statement_list
;
13 struct token
*skip_to(struct token
*, int);
14 struct token
*expect(struct token
*, int, const char *);
15 extern void warn(struct token
*, const char *, ...);
16 extern void error(struct token
*, const char *, ...);
18 #define __DECLARE_ALLOCATOR(type, x) \
19 extern type *__alloc_##x(int); \
20 extern void show_##x##_alloc(void); \
21 extern void clear_##x##_alloc(void);
22 #define DECLARE_ALLOCATOR(x) __DECLARE_ALLOCATOR(struct x, x)
24 DECLARE_ALLOCATOR(ident
);
25 DECLARE_ALLOCATOR(token
);
26 DECLARE_ALLOCATOR(symbol
);
27 DECLARE_ALLOCATOR(expression
);
28 DECLARE_ALLOCATOR(statement
);
29 DECLARE_ALLOCATOR(string
);
30 __DECLARE_ALLOCATOR(void, bytes
);
32 #define LIST_NODE_NR (29)
36 struct ptr_list
*prev
;
37 struct ptr_list
*next
;
38 void *list
[LIST_NODE_NR
];
41 void iterate(struct ptr_list
*,void (*callback
)(void *));
42 extern void add_ptr_list(struct ptr_list
**, void *);
44 static inline void add_symbol(struct symbol_list
**list
, struct symbol
*sym
)
46 add_ptr_list((struct ptr_list
**)list
, sym
);
49 static inline void add_statement(struct statement_list
**list
, struct statement
*stmt
)
51 add_ptr_list((struct ptr_list
**)list
, stmt
);
54 static inline void symbol_iterate(struct symbol_list
*list
, void (*callback
)(struct symbol
*))
56 iterate((struct ptr_list
*)list
, (void (*)(void *))callback
);
59 static inline void statement_iterate(struct statement_list
*list
, void (*callback
)(struct statement
*))
61 iterate((struct ptr_list
*)list
, (void (*)(void *))callback
);