forked from mailru/confetti
-
Notifications
You must be signed in to change notification settings - Fork 0
/
p_dump.c
52 lines (44 loc) · 1.16 KB
/
p_dump.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#include <stdio.h>
#include <prscfl.h>
static char* parserSource[] = {
"#include <stdio.h>\n\n"
"typedef struct prscfg_yy_extra_type {\n"
" char *strbuf;\n"
" int length;\n"
" int total;\n"
" int lineno;\n"
" int commentCounter;\n"
" int ostate;\n"
"} prscfg_yy_extra_type;\n"
"typedef void *prscfg_yyscan_t;\n"
"static prscfg_yyscan_t prscfgScannerInit(FILE *fh, prscfg_yy_extra_type *yyext);\n"
"static prscfg_yyscan_t prscfgScannerInitBuffer(char *buffer, prscfg_yy_extra_type *yyext);\n"
"static void prscfgScannerFinish(prscfg_yyscan_t scanner);\n"
"static void prscfgScannerStartValue(prscfg_yyscan_t scanner);\n"
"static void prscfgScannerEndValue(prscfg_yyscan_t scanner);\n"
"static int prscfgGetLineNo(prscfg_yyscan_t yyscanner);\n\n",
#include "parse_source.c"
NULL
};
static char* headerSource[] = {
#include "header_source.c"
NULL
};
void
pDump(FILE *fh, ParamDef *def) {
char **source = parserSource;
if (def->paramType == builtinType)
fputs(def->paramValue.stringval, fh);
while(*source) {
fputs(*source, fh);
source++;
}
}
void
HDump(FILE *fh) {
char **source = headerSource;
while(*source) {
fputs(*source, fh);
source++;
}
}