From d6e477be43e8e0ad917aa75f312f05558d2433b4 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Mon, 17 Jun 2019 13:42:30 +0930 Subject: [PATCH] tools/extract-formats.py: rewrite, change output. Editing the previous mess was horrific. I gave up and rewrote using a generator. Changes to output: 1. subtypes and tlvs now handled. 2. The output format now has explicit prefixes, so readers don't have to rely on number of fields to interpret data. 3. Each field is split into type and count; count is empty if there's no '*x'. 4. TLV stream typenames are repeated; TLV record type names are not necessarily unique. 5. The unused offset field is removed. 6. No arguments taken: everything is always printed, and you can grep if you only want some. [ Fixup by ] Signed-off-by: Rusty Russell --- .travis.yml | 2 +- tools/extract-formats.py | 259 ++++++++++++++++++++++++++++----------- 2 files changed, 187 insertions(+), 74 deletions(-) diff --git a/.travis.yml b/.travis.yml index c1a88c5..c48abcd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,5 +9,5 @@ python: - "3.5" - "3.6" script: - - (set -e; for i in 0?-*.md; do echo "Extracting $i"; python3 tools/extract-formats.py --message-types --message-fields $i; done) + - (set -e; for i in 0?-*.md; do echo "Extracting $i"; python3 tools/extract-formats.py $i; done) - tools/spellcheck.sh --check [0-9][0-9]-*.md diff --git a/tools/extract-formats.py b/tools/extract-formats.py index 2667f20..1b6a754 100755 --- a/tools/extract-formats.py +++ b/tools/extract-formats.py @@ -3,94 +3,207 @@ # Released by Rusty Russell under CC0: # https://creativecommons.org/publicdomain/zero/1.0/ +# Outputs: +# +# Standard message types: +# msgtype,,[,