3 # Copyright (C) 2006 Intel Corporation
5 # This program is free software; you can redistribute it and/or modify it
6 # under the terms of the GNU Lesser General Public License as published by
7 # the Free Software Foundation.
9 # This program is distributed in the hope that it will be useful, but
10 # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
11 # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 # You should have received a copy of the GNU Lesser General Public License
15 # along with this program; if not, see <http://www.gnu.org/licenses/>.
17 # Author: Ross Burton <ross@openedhand.com>
21 if sys.version_info[0] >= 3:
22 stdin = sys.stdin.buffer
23 stdout = sys.stdout.buffer
32 stdout.write(b"static const gchar " + var + b"_table[] = {\n")
34 stdout.write(b" \"" + s + b"\\0\"\n")
37 stdout.write(b"static const guint " + var + b"_index[] = {\n")
40 stdout.write(b" " + str(index).encode() + b",\n")
42 stdout.write(b"};\n\n")
44 (S_VAR, S_STRING) = range(0, 2)
47 stdout.write(b"/* This file is generated by gen-western-table.py. DO NOT EDIT */\n")
49 for l in stdin.readlines():
59 elif state == S_STRING: