From c329fc916e6cd4f7415db7b7931a204c6ad3c5b34e2c8f8bfe18dd5c3e4ce2d6 Mon Sep 17 00:00:00 2001 From: brent saner Date: Sun, 7 Jul 2024 23:44:13 -0400 Subject: [PATCH] updating hooks fix hex gen from relative invocation path --- .githooks/pre-commit/02-hexgen | 16 ++++++++++++++++ README.adoc | 2 +- README.html | 8 ++++---- docs/data/parse.py | 6 ++++-- 4 files changed, 25 insertions(+), 7 deletions(-) create mode 100755 .githooks/pre-commit/02-hexgen diff --git a/.githooks/pre-commit/02-hexgen b/.githooks/pre-commit/02-hexgen new file mode 100755 index 0000000..bdaceda --- /dev/null +++ b/.githooks/pre-commit/02-hexgen @@ -0,0 +1,16 @@ +#!/bin/bash + +subdir='docs/data' +datdir="${PWD}/${subdir}" + +${datdir}/parse.py + +for t in 'simple' 'multi'; +do + for r in 'request' 'response'; + do + git add ${subdir}/${r}.${t}.hex + done +done + +echo "Regenerated hex representations" diff --git a/README.adoc b/README.adoc index 01eefea..ed38895 100644 --- a/README.adoc +++ b/README.adoc @@ -107,8 +107,8 @@ Each *message* is generally composed of: * The <>footnote:responly[Response messages only.] * A <>footnote:optclient[Optional for Request.]footnote:reqsrv[Required for Response.] -* A <> * A <> +* A <> * A <> <> * A <> <> * A <> diff --git a/README.html b/README.html index 1cd858b..433c959 100644 --- a/README.html +++ b/README.html @@ -632,7 +632,7 @@ pre.rouge .gs {
Brent Saner

-Last rendered 2024-07-07 23:35:34 -0400 +Last rendered 2024-07-07 23:58:11 -0400
Table of Contents
@@ -1344,10 +1344,10 @@ In the event of the embedded text in this document differing from the online ver

A Checksum[2][3]

  • -

    A Protocol Version

    +

    A MSGSTART Header Prefix

  • -

    A MSGSTART Header Prefix

    +

    A Protocol Version

  • A Record Group Count Allocator

    @@ -2375,7 +2375,7 @@ d0ba719f // Checksum Value (3501879711)
  • diff --git a/docs/data/parse.py b/docs/data/parse.py index 73448e1..1894a3d 100755 --- a/docs/data/parse.py +++ b/docs/data/parse.py @@ -6,6 +6,7 @@ ################################################################################################################################ import binascii +import pathlib import re import zlib @@ -14,6 +15,7 @@ suffixes = ('simple', 'multi') linecharlimit = 80 linestrp = re.compile(r'^\s*(?P[A-Fa-f0-9N]+)?(?:\s*//.*)?$') +thisdir = pathlib.Path(__file__).absolute().parent def parse(text): @@ -44,10 +46,10 @@ for p in prefixes: for s in suffixes: fnamebase = '{0}.{1}'.format(p, s) fname = '{0}.txt'.format(fnamebase) - with open(fname, 'r') as fh: + with open(thisdir.joinpath(fname), 'r') as fh: raw = fh.read().strip() hexstr, bytelen = parse(raw) - with open('{0}.hex'.format(fnamebase), 'w') as fh: + with open(thisdir.joinpath('{0}.hex'.format(fnamebase)), 'w') as fh: fh.write(hexstr) fh.write('\n') b = binascii.unhexlify(hexstr.replace('\n', '').strip().encode('utf-8'))