diff options
author | Eric S. Raymond <esr@thyrsus.com> | 2011-05-31 09:00:43 -0400 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2011-05-31 09:00:43 -0400 |
commit | 3f06e57e83a1fd9c20351ef773b0ef8951f828f7 (patch) | |
tree | 16a3e51d40c40d8216599ca2cbcbf680c03f0138 /jsongen.py.in | |
parent | 57273f9c51a1e03227e27d5c5b30835ab412ac4b (diff) | |
download | gpsd-3f06e57e83a1fd9c20351ef773b0ef8951f828f7.tar.gz |
In AIS, full support for VTS-Generated/Synthetic targets.
All regression tests pass. Code splints clean.
Diffstat (limited to 'jsongen.py.in')
-rw-r--r-- | jsongen.py.in | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/jsongen.py.in b/jsongen.py.in index 0e2603bb..9de41965 100644 --- a/jsongen.py.in +++ b/jsongen.py.in @@ -318,8 +318,8 @@ ais_specs = ( ('idtype', 'uinteger', 'DAC1FID17_IDTYPE_OTHER'), ("id.mmsi", 'uinteger', '0'), ("id.imo", 'uinteger', '0'), - #("id.callsign",'string', None), - #("id.other", 'string', None), + ("id.callsign",'string', 'DAC1FID17_ID_LENGTH'), + ("id.other", 'string', 'DAC1FID17_ID_LENGTH'), ('lat', 'integer', 'AIS_LAT3_NOT_AVAILABLE'), ('lon', 'integer', 'AIS_LON3_NOT_AVAILABLE'), ('course', 'uinteger', 'DAC1FID17_COURSE_NOT_AVAILABLE'), @@ -740,10 +740,13 @@ def generate(spec): for (subattr, subitype, default) in elements: report += '\t{"%s",%st_%s,%sSTRUCTOBJECT(struct %s, %s),\n' % \ (subattr, " "*(14-len(subattr)), subitype, " "*(8-len(subitype)), innerstruct, subattr) - if subitype == "string": - report += leader + ".len = sizeof(%s.%s)},\n" % (structname,subattr) - else: + if subitype != "string": report += leader + ".dflt.%s = %s},\n" % (subitype, default) + elif default: + report += leader + ".len = %s},\n" % (default,) + else: + print >>sys.stderr, "explicit length specification required" + raise SystemExit, 1 report += " };\n" # Generate the main structure definition describing this parse. # It may have object subarrays. |