Use the new timestamp API.
[gliv.git] / tools / help2c.awk
blobff479e95417541070bc78d8b9054b451c5e26194
1 BEGIN {
2 print "/* Generated by help2c.awk */"
3 print "#include \"gliv.h\""
4 print "#include \"help_text.h\""
5 print "#include \"messages.h\""
6 print ""
7 print "/* Forward declaration. */"
8 print "static gchar **get_sized_array(void);"
9 print ""
10 print "gchar **get_help_lines(void)"
11 print "{"
12 print " gchar **array, **ptr;"
13 print ""
14 print " ptr = array = get_sized_array();"
15 print ""
17 help_lines = 0
20 $0 == "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" {
21 if (started) {
22 # The end.
23 print " *--ptr = NULL;"
24 print ""
25 print " return array;"
26 print "}"
27 print ""
28 print "static gchar **get_sized_array(void)"
29 print "{"
30 printf " return g_new(gchar *, %d);\n", help_lines
31 print "}"
32 exit
35 # The beginning.
36 started = 1
37 getline
40 /.*: .*/ { # A keyboard accelerator line.
41 if (started) {
42 printf " *ptr++ = _(\"%s\");\n", $0
43 print " *ptr++ = \"\\n\";"
44 print ""
45 help_lines += 2
49 $0 == "" {
50 if (started) {
51 # End of keyboard accelerators.
52 misc = 1
53 RS = "\n\n"
54 print " *ptr++ = \"\\n\";"
55 print ""
56 help_lines++
57 getline
62 if (misc) {
63 gsub(/(\n| )/, " ")
64 printf " *ptr++ = _(\"%s\");\n", $0
65 print " *ptr++ = \"\\n\\n\";"
66 help_lines += 2
67 print ""