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

#include "version.h"

#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"
;

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, header);
}