From 29d463d52c2f1bc3fc95cda361aaa786a43f6525 Mon Sep 17 00:00:00 2001 From: Yevgen Muntyan <17531749+muntyan@users.noreply.github.com> Date: Mon, 3 Apr 2006 02:48:27 -0500 Subject: [PATCH] Python version of xml2h, for windows --- moo/mooutils/xml2h.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 moo/mooutils/xml2h.py diff --git a/moo/mooutils/xml2h.py b/moo/mooutils/xml2h.py new file mode 100644 index 00000000..4a195495 --- /dev/null +++ b/moo/mooutils/xml2h.py @@ -0,0 +1,19 @@ +import sys + +if not sys.argv[2:]: + print 'usage: "%s "' % (sys.argv[0],) + sys.exit(1) + +VARNAME = sys.argv[1] +INPUT = sys.argv[2] + +file = open(INPUT, "r") + +sys.stdout.write('static const char %s[] = \"\"\n' % (VARNAME,)) + +for line in file: + line = line[:-1] + line = '"' + line.replace('"', '\\"') + '"\n' + sys.stdout.write(line) + +sys.stdout.write(';\n')