From a8537e5c3598fb092b7f816be3945921673162d6 Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Sun, 6 Oct 2013 08:50:39 -0400 Subject: Correct some code generation. --- devtools/tablegen.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'devtools/tablegen.py') 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': -- cgit v1.2.1