]> git.sur5r.net Git - openldap/blob - build/unproto/token.h
Check LOCK_ID() return
[openldap] / build / unproto / token.h
1 /* @(#) token.h 1.4 92/01/15 21:53:17 */
2
3 struct token {
4     int     tokno;                      /* token value, see below */
5     char   *path;                       /* file name */
6     int     line;                       /* line number at token start */
7     int     end_line;                   /* line number at token end */
8     struct vstring *vstr;               /* token contents */
9     struct token *next;
10     struct token *head;
11     struct token *tail;
12 };
13
14 /* Special token values */
15
16 #define TOK_LIST        256             /* () delimited list */
17 #define TOK_WORD        257             /* keyword or identifier */
18 #define TOK_NUMBER      258             /* one or more digits */
19 #define TOK_WSPACE      259             /* comment, white space, not newline */
20 #define TOK_OTHER       260             /* other token */
21 #define TOK_CONTROL     261             /* flow control keyword */
22 #define TOK_COMPOSITE   262             /* struct or union keyword */
23 #define TOK_DATE        263             /* date: Mmm dd yyyy */
24 #define TOK_TIME        264             /* time: hh:mm:ss */
25 #define TOK_VOID        265             /* void keyword */
26
27 /* Input/output functions and macros */
28
29 extern struct token *tok_get();         /* read next single token */
30 extern void tok_show();                 /* display (composite) token */
31 extern struct token *tok_class();       /* classify tokens */
32 extern void tok_unget();                /* stuff token back into input */
33 extern void put_nl();                   /* print newline character */
34 extern void tok_show_ch();              /* emit single-character token */
35
36 #define tok_flush(t)    (tok_show(t), tok_free(t))
37
38 #ifdef DEBUG
39 #define put_ch(c)       (putchar(last_ch = c),fflush(stdout))
40 #define put_str(s)      (fputs(s,stdout),last_ch = 0,fflush(stdout))
41 #else
42 #define put_ch(c)       putchar(last_ch = c)
43 #define put_str(s)      (fputs(s,stdout),last_ch = 0)
44 #endif
45
46 /* Memory management */
47
48 struct token *tok_alloc();              /* allocate token storage */
49 extern void tok_free();                 /* re-cycle storage */
50
51 /* Context */
52
53 extern char *in_path;                   /* current input path name */
54 extern int in_line;                     /* current input line number */
55 extern int last_ch;                     /* type of last output */