summary refs log tree commit diff stats
path: root/src/common/make-te.py
diff options
context:
space:
mode:
authorPatrick Griffis <tingping@tingping.se>2016-12-13 16:12:03 -0500
committerPatrick Griffis <tingping@tingping.se>2017-06-13 23:54:51 -0400
commit628100c19f5d82747170acdf2917cba8c119ccbf (patch)
tree351a7e9714a1a58390ba349808df5703cef25c3e /src/common/make-te.py
parent2edf50d4ddc61ce6f73bf02263c9bdd09632c66b (diff)
build: Replace Autotools with Meson
Quick rundown of benefits:

- Much faster:
  - Autotools (with autogen): 22 seconds
  - Meson: 7 seconds
  - Meson (with ccache): 2 seconds

- Simpler:
  - ~1000 lines smaller
  - Single simple language

- Potentially better Windows (Visual Studio) support

What is not done:

- Complete Windows support
- OSX support (easy)

Closes #2013
Closes #1937
Closes #1803
Diffstat (limited to 'src/common/make-te.py')
-rwxr-xr-xsrc/common/make-te.py55
1 files changed, 55 insertions, 0 deletions
diff --git a/src/common/make-te.py b/src/common/make-te.py
new file mode 100755
index 00000000..a1da5643
--- /dev/null
+++ b/src/common/make-te.py
@@ -0,0 +1,55 @@
+#!/usr/bin/env python3
+
+import sys
+
+inf = open(sys.argv[1])
+eventf = open(sys.argv[2], 'w')
+enumsf = open(sys.argv[3], 'w')
+
+enumsf.write(\
+'''
+/* this file is auto generated, edit textevents.in instead! */
+
+enum
+{
+''')
+
+eventf.write(\
+'''
+/* this file is auto generated, edit textevents.in instead! */
+
+const struct text_event te[] = {
+''')
+
+try:
+	while True:
+		name = inf.readline().strip()
+		event_enum = inf.readline().strip()
+		event_help = inf.readline().strip()
+		event_str = inf.readline().strip()
+		args = inf.readline().strip()
+		translate = True
+
+		if args[0] == 'n':
+			args = int(args[1]) | 128
+			translate = False
+		else:
+			args = int(args)
+
+		if translate:
+			event_str = 'N_("%s")' %event_str
+		else:
+			event_str = '"%s"' %event_str
+
+		enumsf.write('\t%s,\n' %event_enum)
+		eventf.write('\n{"%s", %s, %u,\n%s},\n' %(
+			name, event_help, args, event_str,
+		))
+
+		inf.readline() # whitespace
+except IndexError:
+    pass
+
+enumsf.write('\tNUM_XP\n};\n')
+eventf.write('};\n')
+