4 * $DragonFly: src/lib/libsys/genhooks/defs.h,v 1.2 2005/12/05 16:48:22 dillon Exp $
21 #define TOK_OBRACE '{'
22 #define TOK_CBRACE '}'
23 #define TOK_OPAREN '('
24 #define TOK_CPAREN ')'
25 #define TOK_EOF 0x00000100
26 #define TOK_UNKNOWN 0x00000101
27 #define TOK_INTEGER 0x00000102
28 #define TOK_BASE 0x00000103
29 #define TOK_SYMBOL 0x04000000
31 #define TOK_ADD (TOK_SYMBOL|0x00000001)
32 #define TOK_FUNCTION (TOK_SYMBOL|0x00000002)
33 #define TOK_IMPLEMENTATION (TOK_SYMBOL|0x00000003)
34 #define TOK_DIRECT (TOK_SYMBOL|0x00000004)
35 #define TOK_SIMULATED (TOK_SYMBOL|0x00000005)
37 typedef struct lex_token
{
38 struct lex_info
*info
;
46 typedef struct lex_info
{
51 int cache_line
; /* cached line number for index */
52 int cache_index
; /* index to base of cached line */
53 int cache_len
; /* size of cached line, including newline */
56 typedef struct sys_type
{
61 typedef struct sys_info
{
62 struct sys_type
*func_ret
;
63 struct sys_type
**func_args
;
64 int nargs
; /* 0 if takes void */
65 int sysno
; /* syscall number */
68 extern struct sys_info
**sys_array
;
70 extern char *sys_sectname
;
72 void *zalloc(int bytes
);
74 void lex_open(const char *path
, lex_token
*tok
);
75 void lex_close(lex_token
*tok
);
76 int lex_gettoken(lex_token
*tok
);
77 int lex_skip_token(lex_token
*tok
, int type
);
78 void lex_error(lex_token
*tok
, const char *ctl
, ...);
79 const char *lex_string_quick(lex_token
*tok
);
80 char *lex_string(lex_token
*tok
);
82 void parse_file(const char *path
);
84 void output_user(FILE *fo
);
85 void output_lib(FILE *fo
);
86 void output_standalone(FILE *fo
, const char *list_prefix
);