diff options
author | katherine <shmibs@airen-no-jikken.icu> | 2019-05-23 12:42:51 -0700 |
---|---|---|
committer | katherine <shmibs@airen-no-jikken.icu> | 2019-05-23 12:42:51 -0700 |
commit | 6804fd50fa107605d652c063c2ae0844b812d4df (patch) | |
tree | ffddde83e2342d40aa10378b50019aa3dcd15dbb /src/gen.c | |
parent | 101d5ad1f3e864f3b6442b6063151ffb47178099 (diff) | |
download | confconf-6804fd50fa107605d652c063c2ae0844b812d4df.tar.gz |
add basetype funcs to gen
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); + } |