aboutsummaryrefslogtreecommitdiffstats
path: root/src/gen.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/gen.c')
-rw-r--r--src/gen.c47
1 files changed, 28 insertions, 19 deletions
diff --git a/src/gen.c b/src/gen.c
index 98e067b..fdad6e8 100644
--- a/src/gen.c
+++ b/src/gen.c
@@ -4,24 +4,7 @@
#include <time.h>
-static const char header[] =
-"#ifndef CONFCONF_PRIV_H\n"
-"#define CONFCONF_PRIV_H\n"
-"\n"
-"#include <stdbool.h>\n"
-"#include <stdio.h>\n"
-"#include <ctype.h>\n"
-"\n"
-"struct confconf_priv_fstate {\n"
-" void *f;\n"
-" int (*gcp)(void *);\n"
-" size_t line;\n"
-" size_t col;\n"
-" size_t byte;\n"
-"};\n"
-"\n"
-"#endif\n"
-;
+#include "gen-consts.h"
void gen(FILE *f, struct parse_result_s pr, struct analyse_result_s ar)
{
@@ -34,5 +17,31 @@ void gen(FILE *f, struct parse_result_s pr, struct analyse_result_s ar)
fprintf(f, "/* generated by %s on %04d-%02d-%02d */\n",
VERSION, ti->tm_year + 1900, ti->tm_mon + 1, ti->tm_mday);
- fprintf(f, header);
+ fprintf(f, sheader);
+
+ if (ar.uses_bool)
+ fprintf(f, sbool);
+ if (ar.uses_string)
+ fprintf(f, sstring);
+ if (ar.uses_id)
+ fprintf(f, sid);
+ if (ar.uses_int)
+ fprintf(f, sint);
+ if (ar.uses_intl)
+ fprintf(f, sintl);
+ if (ar.uses_intll)
+ fprintf(f, sintll);
+ if (ar.uses_uint)
+ fprintf(f, suint);
+ if (ar.uses_uintl)
+ fprintf(f, suintl);
+ if (ar.uses_uintll)
+ fprintf(f, suintll);
+ if (ar.uses_float)
+ fprintf(f, sfloat);
+ if (ar.uses_double)
+ fprintf(f, sdouble);
+ if (ar.uses_doublel)
+ fprintf(f, sdoublel);
+
}