ncc: string literals are arrays
[neatcc/cc.git] / tok.h
blobea546cbfd3d06ee54c1004955f3eb5598e562727
1 #define BUFSIZE (1 << 18)
2 #define NAMELEN (1 << 7)
3 #define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
5 #define TOK2(a) ((a)[0] << 16 | (a)[1] << 8)
6 #define TOK3(a) ((a)[0] << 16 | (a)[1] << 8 | (a)[2])
8 enum tok {
9 TOK_EOF,
10 TOK_NAME = 256,
11 TOK_NUM,
12 TOK_VOID,
13 TOK_STATIC,
14 TOK_EXTERN,
15 TOK_RETURN,
16 TOK_UNSIGNED,
17 TOK_SIGNED,
18 TOK_SHORT,
19 TOK_LONG,
20 TOK_INT,
21 TOK_CHAR,
22 TOK_STRUCT,
23 TOK_UNION,
24 TOK_ENUM,
25 TOK_TYPEDEF,
26 TOK_IF,
27 TOK_ELSE,
28 TOK_FOR,
29 TOK_WHILE,
30 TOK_DO,
31 TOK_SWITCH,
32 TOK_CASE,
33 TOK_SIZEOF,
34 TOK_STR,
35 TOK_BREAK,
36 TOK_CONTINUE,
37 TOK_DEFAULT,
38 TOK_GOTO,
41 void tok_init(char *path);
42 int tok_see(void);
43 int tok_get(void);
44 char *tok_id(void);
45 int tok_num(long *n);
46 int tok_str(char *out);
47 long tok_addr(void);
48 void tok_jump(long addr);
50 int cpp_init(char *path);
51 void cpp_addpath(char *s);
52 void cpp_define(char *name, char *def);
53 char *cpp_loc(long addr);
54 int cpp_read(char *s);
56 void die(char *msg, ...);
57 void err(char *fmt, ...);