updating hooks
fix hex gen from relative invocation path
This commit is contained in:
parent
82220d5107
commit
c329fc916e
16
.githooks/pre-commit/02-hexgen
Executable file
16
.githooks/pre-commit/02-hexgen
Executable file
@ -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"
|
@ -107,8 +107,8 @@ Each *message* is generally composed of:
|
||||
|
||||
* The <<msg_respstatus>>footnote:responly[Response messages only.]
|
||||
* A <<cksum, Checksum>>footnote:optclient[Optional for Request.]footnote:reqsrv[Required for Response.]
|
||||
* A <<proto_ver>>
|
||||
* A <<hdrs_msgstart>>
|
||||
* A <<proto_ver>>
|
||||
* A <<msg_grp>> <<alloc_cnt>>
|
||||
* A <<msg_grp>> <<alloc_size>>
|
||||
* A <<hdrs_bodystart>>
|
||||
|
@ -632,7 +632,7 @@ pre.rouge .gs {
|
||||
<div class="details">
|
||||
<span id="author" class="author">Brent Saner</span><br>
|
||||
<span id="email" class="email"><a href="mailto:bts@square-r00t.net">bts@square-r00t.net</a></span><br>
|
||||
<span id="revdate">Last rendered 2024-07-07 23:35:34 -0400</span>
|
||||
<span id="revdate">Last rendered 2024-07-07 23:58:11 -0400</span>
|
||||
</div>
|
||||
<div id="toc" class="toc2">
|
||||
<div id="toctitle">Table of Contents</div>
|
||||
@ -1344,10 +1344,10 @@ In the event of the embedded text in this document differing from the online ver
|
||||
<p>A <a href="#cksum">Checksum</a><sup class="footnote" id="_footnote_optclient">[<a id="_footnoteref_2" class="footnote" href="#_footnotedef_2" title="View footnote.">2</a>]</sup><sup class="footnote" id="_footnote_reqsrv">[<a id="_footnoteref_3" class="footnote" href="#_footnotedef_3" title="View footnote.">3</a>]</sup></p>
|
||||
</li>
|
||||
<li>
|
||||
<p>A <a href="#proto_ver">Protocol Version</a></p>
|
||||
<p>A <a href="#hdrs_msgstart"><code>MSGSTART</code> Header Prefix</a></p>
|
||||
</li>
|
||||
<li>
|
||||
<p>A <a href="#hdrs_msgstart"><code>MSGSTART</code> Header Prefix</a></p>
|
||||
<p>A <a href="#proto_ver">Protocol Version</a></p>
|
||||
</li>
|
||||
<li>
|
||||
<p>A <a href="#msg_grp">Record Group</a> <a href="#alloc_cnt">Count Allocator</a></p>
|
||||
@ -2375,7 +2375,7 @@ d0ba719f // Checksum Value (3501879711)
|
||||
</div>
|
||||
<div id="footer">
|
||||
<div id="footer-text">
|
||||
Last updated 2024-07-07 23:31:43 -0400
|
||||
Last updated 2024-07-07 23:38:45 -0400
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
|
@ -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<hex>[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'))
|
||||
|
Loading…
Reference in New Issue
Block a user