diff options
Diffstat (limited to 'src/gen.c')
-rw-r--r-- | src/gen.c | 47 |
1 files changed, 28 insertions, 19 deletions
@@ -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); + } |