diff options
author | Eric S. Raymond <esr@thyrsus.com> | 2013-10-01 06:11:00 -0400 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2013-10-01 06:11:00 -0400 |
commit | b16d117a0a86a64944f012d844bdabd6e696c74e (patch) | |
tree | f03ef3d3dbc245795e7d9a9bed26de16b805bc1a /devtools/tablegen.py | |
parent | 639848f1857ae17e9c6bc058d6a9cc880ee4406c (diff) | |
download | gpsd-b16d117a0a86a64944f012d844bdabd6e696c74e.tar.gz |
tablegen.py conditionally includes -t.
Diffstat (limited to 'devtools/tablegen.py')
-rwxr-xr-x | devtools/tablegen.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/devtools/tablegen.py b/devtools/tablegen.py index 87be6ae8..8af319ab 100755 --- a/devtools/tablegen.py +++ b/devtools/tablegen.py @@ -10,7 +10,7 @@ # # * -t: A corrected version of the table. It will redo all the offsets to be # in conformance with the bit widths. (The other options rely only on the -# bit widths). Id the old and new tables are different, an error message +# bit widths). If the old and new tables are different, an error message # describing the corrections will be emitted to standard error. # # * -s: A structure definition capturing the message info, with member @@ -28,9 +28,8 @@ # generate the specification structure for a JSON parse that reads JSON # into an instance of the message structure. # -# * -a: Generate all of -s, -d, -c, and -r, , not to stdout but to +# * -a: Generate all of -s, -d, -c, and -r, and -t, not to stdout but to # files named with the argument as a distinguishing part of the stem. -# Note that this does not generate a corrected table as in -t. # # This generates almost all the code required to support a new message type. # It's not quite "Look, ma, no handhacking!" You'll need to add default @@ -493,6 +492,7 @@ if __name__ == '__main__': # Compute offsets for an AIVDM message breakdown, given the bit widths. offsets = [] base = 0 + corrections = False for w in widths: if w is None: offsets.append(`base`) @@ -504,6 +504,7 @@ if __name__ == '__main__': offsets.append("%d-%d" % (base, base + w - 1)) base += w if filter(lambda p: p[0] != p[1], zip(ranges, offsets)): + corrections = True print "Offset corrections:" for (old, new) in zip(ranges, offsets): if old != new: @@ -514,6 +515,8 @@ if __name__ == '__main__': # Here's where we generate useful output. if all: + if corrections: + correct_table(open(structname + ".txt", "w")) make_driver_code(open(structname + ".c", "w")) make_structure(open(structname + ".h", "w")) make_json_dumper(open(structname + "_json.c", "w")) |