2 * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>
3 * Released under the terms of the GNU GPL v2.0.
14 #include "lxrgmr/gmr/parser.tab.h"
16 #define START_STRSIZE 16
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);
39 int g_cpreproc_flag
= 0;
40 int g_cmnt_state
= EN_CMNT_NONE
;
43 char cmnt_buff
[1024]={0};
47 /** set content flag automatically. **/
48 #define RETURN(token) g_content_before_cmnt=1; return token;
57 static void new_string(void)
59 text
= xmalloc(START_STRSIZE
);
60 text_asize
= START_STRSIZE
;
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
);
79 static void alloc_string(const char *str
, int size
)
82 text = xmalloc(size + 1);
83 memcpy(text, str, size);
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
);
95 * the better one is invoke new_string() and append_string()
100 const char *zconf_curname(void);
102 #include "config.lexdecl.c"