4 * Basic helper routine descriptions for 'sparse'.
6 * Copyright (C) 2003 Linus Torvalds, all rights reserved.
9 extern unsigned int hexval(unsigned int c
);
16 struct statement_list
;
18 struct token
*skip_to(struct token
*, int);
19 struct token
*expect(struct token
*, int, const char *);
20 extern void warn(struct token
*, const char *, ...);
21 extern void error(struct token
*, const char *, ...);
23 #define __DECLARE_ALLOCATOR(type, x) \
24 extern type *__alloc_##x(int); \
25 extern void show_##x##_alloc(void); \
26 extern void clear_##x##_alloc(void);
27 #define DECLARE_ALLOCATOR(x) __DECLARE_ALLOCATOR(struct x, x)
29 DECLARE_ALLOCATOR(ident
);
30 DECLARE_ALLOCATOR(token
);
31 DECLARE_ALLOCATOR(symbol
);
32 DECLARE_ALLOCATOR(expression
);
33 DECLARE_ALLOCATOR(statement
);
34 DECLARE_ALLOCATOR(string
);
35 __DECLARE_ALLOCATOR(void, bytes
);
37 #define LIST_NODE_NR (29)
41 struct ptr_list
*prev
;
42 struct ptr_list
*next
;
43 void *list
[LIST_NODE_NR
];
46 #define ITERATE_FIRST 1
47 #define ITERATE_LAST 2
48 void iterate(struct ptr_list
*,void (*callback
)(void *, void *, int), void*);
49 extern void add_ptr_list(struct ptr_list
**, void *);
51 static inline void add_symbol(struct symbol_list
**list
, struct symbol
*sym
)
53 add_ptr_list((struct ptr_list
**)list
, sym
);
56 static inline void add_statement(struct statement_list
**list
, struct statement
*stmt
)
58 add_ptr_list((struct ptr_list
**)list
, stmt
);
61 static inline void symbol_iterate(struct symbol_list
*list
, void (*callback
)(struct symbol
*, void *, int), void *data
)
63 iterate((struct ptr_list
*)list
, (void (*)(void *, void *, int))callback
, data
);
66 static inline void statement_iterate(struct statement_list
*list
, void (*callback
)(struct statement
*, void *, int), void *data
)
68 iterate((struct ptr_list
*)list
, (void (*)(void *, void *, int))callback
, data
);