summaryrefslogtreecommitdiff
path: root/data/make-table.c
blob: 9afca7d8f32d7c1e70cc3f65c68ef8811df2e614 (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
#include <glib.h>

int main(int argc, char **argv) {
	GError *error = NULL;
	gchar *data;
	if (!g_file_get_contents("codetables.utf8", &data, NULL, &error)) {
		g_printerr("Failed to open %s: %s\n", error->message);
		return 1;
	}

	gint i;
	guint count = 0;

	for (i = 0; i < 0x20; i++) {
		g_print("\t%u,\t/* %u */\n", 0, count);
		count++;
	}

	gchar * c = data;
	while (*c) {
		if (*c != '\n') {
			gunichar u = g_utf8_get_char(c);
			g_print("\t%u,\t/* %u */\n", u, count);
			count++;
		}
		c = g_utf8_next_char(c);
	}

	g_printerr("Total elements = %d\n", count);

	return 0;
}