diff options
author | Eric S. Raymond <esr@thyrsus.com> | 2009-09-06 13:23:05 +0000 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2009-09-06 13:23:05 +0000 |
commit | f139ce9ddf5d7d238828c106a91aaf7892e460b2 (patch) | |
tree | b2b2bb2c8056bff5eeed4680f235b3b958e67aa6 /devtools/aivdmtable | |
parent | 2d64384a3880db2a8d7cc598ef2088cccd96d5ab (diff) | |
download | gpsd-f139ce9ddf5d7d238828c106a91aaf7892e460b2.tar.gz |
Register some developer convenience scripts (not stuff to be shipped).
Diffstat (limited to 'devtools/aivdmtable')
-rwxr-xr-x | devtools/aivdmtable | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/devtools/aivdmtable b/devtools/aivdmtable new file mode 100755 index 00000000..b1a1e550 --- /dev/null +++ b/devtools/aivdmtable @@ -0,0 +1,31 @@ +#!/usr/bin/env python +# +# Generate an asciidoc table of the six-bit encoding used in AIVDM packets. + +sixbits = ( + "000000", "000001", "000010", "000011", "000100", + "000101", "000110", "000111", "001000", "001001", + "001010", "001011", "001100", "001101", "001110", + "001111", "010000", "010001", "010010", "010011", + "010100", "010101", "010110", "010111", "011000", + "011001", "011010", "011011", "011100", "011101", + "011110", "011111", "100000", "100001", "100010", + "100011", "100100", "100101", "100110", "100111", + "101000", "101001", "101010", "101011", "101100", + "101101", "101110", "101111", "110000", "110001", + "110010", "110011", "110100", "110101", "110110", + "110111", "111000", "111001", "111010", "111011", + "111100", "111101", "111110", "111111", + ) + +def asciiarmor(): + print("`--------`-------`---------`-------") + print(" Char ASCII Decimal Bits") + for ch in range(ord('0'), ord('W')+1) + range(ord('`'), ord('w')+1): + n = ch - 48 + if n >= 40: n -= 8 + print '"%s" %3d %3d %s' % (chr(ch), ch, n, sixbits[n]) + print("---------------------------------------") + +if __name__ == "__main__": + asciiarmor() |