diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2024-05-03 06:59:32 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2024-05-03 06:59:32 -0700 |
commit | 071225dcce0ac4ad8cc00e3208bd3848ee066eab (patch) | |
tree | 96f336826d1927dc870d54ef9eb146a51a975d78 /lib.c | |
parent | 262cf47d2c701bf71143f312427b1f4fa140deb9 (diff) | |
download | txr-071225dcce0ac4ad8cc00e3208bd3848ee066eab.tar.gz txr-071225dcce0ac4ad8cc00e3208bd3848ee066eab.tar.bz2 txr-071225dcce0ac4ad8cc00e3208bd3848ee066eab.zip |
buf: pprint produces hex, not raw bytes.
The pprint semantics of buffers is that the
raw bytes are dumped into the stream. This is poor.
It was hastily designed based on analogy with
strings, which pprint by just sending their contents
to the stream; but for strings this is justified
because they represent text.
We also fix the semantics of buffer values being
rendered by quasiliteral notation. Currently, the
are treated as sequences, and so they explode into
individual decimal integers.
* buf.c (buf_pprint): Print the bytes as pairs of
lower-case hex digits, with no line breaks.
In 294 compatibility or lower, put out bytes as before.
* eval.c (fmt_cat): When not in 294 compatibility
mode, treat a buffer object via tostringp, which
will render it to hexadecimal via buf_pprintf.
In compatibility mode, treat it as before, which is
as a sequence: the individual values of the buffer
are converted to text, thus decimal values in the
range 0 to 255, catenated using the given separator.
* tests/012/readprint.tl: New tests.
* txr.1: Documented. Also expanding on what pretty printing
means in TXR.
Diffstat (limited to 'lib.c')
0 files changed, 0 insertions, 0 deletions