define token list for script
[build-config.git] / src / config / lxrgmr / lxr / lexer.lexdecl.c
blob0a5b09ca88abe896e6c64cb9137aa2a37d76a68d
1 /*
2 * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>
3 * Released under the terms of the GNU GPL v2.0.
4 */
6 #include <limits.h>
7 #include <stdio.h>
8 #include <stdlib.h>
9 #include <string.h>
10 #include <unistd.h>
12 #include "lkglob.h"
14 #include "lxrgmr/gmr/parser.tab.h"
16 #define START_STRSIZE 16
18 static char *text;
19 static int text_size, text_asize;
23 static int last_ts, first_ts;
25 static void zconf_endhelp(void);
26 static void zconf_endfile(void);
32 enum EN_CMNT_STATE {
33 EN_CMNT_NONE = 0,
34 EN_CMNT_BEGIN,
35 EN_CMNT,
36 EN_CMNT_EXTEND,
39 int g_cpreproc_flag = 0;
40 int g_cmnt_state = EN_CMNT_NONE;
42 int cmnt_idx=0;
43 char cmnt_buff[1024]={0};
45 int retval = 0;
47 /** set content flag automatically. **/
48 #define RETURN(token) g_content_before_cmnt=1; return token;
55 #if 0
57 static void new_string(void)
59 text = xmalloc(START_STRSIZE);
60 text_asize = START_STRSIZE;
61 text_size = 0;
62 *text = 0;
65 static void append_string(const char *str, int size)
67 int new_size = text_size + size + 1;
68 if (new_size > text_asize) {
69 new_size += START_STRSIZE - 1;
70 new_size &= -START_STRSIZE;
71 text = xrealloc(text, new_size);
72 text_asize = new_size;
74 memcpy(text + text_size, str, size);
75 text_size += size;
76 text[text_size] = 0;
79 static void alloc_string(const char *str, int size)
82 text = xmalloc(size + 1);
83 memcpy(text, str, size);
84 text[size] = 0;
87 * the string allocated does not store string
88 * after append_string() invoked. because text_size is zero,
90 text = xmalloc(size + 1);
91 memcpy(text, str, size);
92 text[size] = 0;
93 text_size = size;
95 * the better one is invoke new_string() and append_string()
98 #endif
100 const char *zconf_curname(void);
102 #include "config.lexdecl.c"