summaryrefslogtreecommitdiff
path: root/devtools
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2013-10-06 08:50:39 -0400
committerEric S. Raymond <esr@thyrsus.com>2013-10-06 08:50:39 -0400
commita8537e5c3598fb092b7f816be3945921673162d6 (patch)
tree2dedd79ad2bec675c8b63bb30b07a69eba7b85c9 /devtools
parentb1f2606203d8a13888246f7046b1cfcb6b5e02b5 (diff)
downloadgpsd-a8537e5c3598fb092b7f816be3945921673162d6.tar.gz
Correct some code generation.
Diffstat (limited to 'devtools')
-rwxr-xr-xdevtools/tablegen.py14
1 files changed, 7 insertions, 7 deletions
diff --git a/devtools/tablegen.py b/devtools/tablegen.py
index f96edf88..61119e70 100755
--- a/devtools/tablegen.py
+++ b/devtools/tablegen.py
@@ -105,7 +105,7 @@ def make_driver_code(wfp):
continue
offset = offsets[i].split('-')[0]
if arrayname:
- target = "%s.%s[i].%s" % (structname, arrayname, name)
+ target = "%s.%s[i].%s" % (structnme, arrayname, name)
offset = "a + " + offset
else:
target = "%s.%s" % (structname, name)
@@ -186,24 +186,24 @@ def make_structure(wfp):
inwards -= step
print >>wfp, tabify(baseindent + inwards) + "} %s[%s];" % (arrayname, arraydim)
if "->" in structname:
- structname = structname.split("->")[1]
- if "." in structname:
+ typename = structname.split("->")[1]
+ if "." in typename:
structname = structname.split(".")[1]
- print >>wfp, tabify(baseindent) + "} %s;" % structname
+ print >>wfp, tabify(baseindent) + "} %s;" % typename
def make_json_dumper(wfp):
# Write the skeleton of a JSON dump corresponding to the table.
# Also, if there are subtables, some initializers
if subtables:
for (name, lines) in subtables:
- wfp.write(" const char %s_vocabulary[] = {\n" % name)
+ wfp.write(" const char *%s_vocabulary[] = {\n" % name)
for line in lines:
value = line[1]
if value.endswith(" (default)"):
value = value[:-10]
wfp.write(' "%s",\n' % value)
- wfp.write(" }\n")
- wfp.write('#define %s_DISPLAY(n) (((n) < (unsigned int)NITEMS(%s_vocabulary)) ? %s_vocabulary[n] : "INVALID %s")\n' % (name.upper(), name, name, name.upper()))
+ wfp.write(" };\n")
+ wfp.write('#define DISPLAY_%s(n) (((n) < (unsigned int)NITEMS(%s_vocabulary)) ? %s_vocabulary[n] : "INVALID %s")\n' % (name.upper(), name, name, name.upper()))
wfp.write("\n")
record = after is None
# Elements of each tuple type except 'a':