aboutsummaryrefslogtreecommitdiffstats
path: root/src/gen.c
blob: fdad6e8589c27f0e41805bba8a2893017c9d7f4c (plain)
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
#include "gen.h"

#include "version.h"

#include <time.h>

#include "gen-consts.h"

void gen(FILE *f, struct parse_result_s pr, struct analyse_result_s ar)
{
	time_t t;
	struct tm *ti;

	time(&t);
	ti = localtime(&t);

	fprintf(f, "/* generated by %s on %04d-%02d-%02d */\n", 
			VERSION, ti->tm_year + 1900, ti->tm_mon + 1, ti->tm_mday);

	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);

}