| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
| |
* pic.tl (add-neg-parens): New system function.
(expand-neg-parens): New macro.
(expand-pic): New numeric pattern with parentheses.
Also suport escaping of parentheses.
(pic): Recognize parenthesized numeric pattern here also.
* tests/018/format.tl: New tests.
|
|
|
|
| |
* tests/018/format.tl: New test cases.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* pic.tl (expand-pic-num): If the overflowing field specifies
a decimal point other than in the rightmost position, then
stick one into the fill pattern. The motivation for this is
that it harmonizes with the digit separators. The new digit
separator insertion logic will treat the # characters like
digits, and requires the embedded decimal in order to work
properly. Allowing digit separation to work in the fill
pattern will make for better looking output in column
displays. That's the same reason why we insert digit
separators among leading zeros.
* tests/018/format.tl: Overflow test cases updated in
light of this requirement change.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
For instance, this bad output is produced:
(pic "+0####.## <<<<<" 123 1) -> "+00123.00 +1 "
The second argument should not have any leading + sign.
* stream.c (formatv): For each new conversion specifier introduced by ~,
reset the sign variable to zero also. That's the semantic change here,
occluded by the fact that I'm rearranging the declaration of the
variables, adding comments, and condensing the assignments while also
getting them into the same order as the declarations, in order that this
sort of bug does not creep in in the future, should another such
variable be added.
* tests/018/format.tl: Adding correct version of above test case.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
There are a number of issues, such as left adjustment not
working and such. This needs a better treatment from the
requirements level, through to a set of test cases.
* stream.c (max, min): Macros macros added, in their usual
form.
(vformat_num): Implement new rules which suppress the zero and
space characters used in place of a sign if they overflow the
field width.
(formatv): Clamp integer precision field to width - 1 for
integers, for consistency with floating-point handling.
For floating-point values under ~a and ~s, do not force
the second stage precision to width - 1; only clamp it
if it is greater.
* format.tl: Numerous new tests.
* txr.1: Significant redocumenting of this area. The handling
of numbers is described as a two stage process, clarifying the
changing role of "precision" in the two stages.
|
|
|
|
|
|
|
|
|
|
|
| |
* stream.c (formatv): The - precision option character
produces a "sign" that is a zero. If this is used with leading
zeros, it will avoid generating a space. The requirements can
use improvement here, but one step at a time.
* tests/018/format.tl: Some tests.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
|
|
| |
* share/txr/stdlib/pic.tl (pic): Refactor string compilation
code into local function which has access to the overall
argument list. Recognize the quasiliteral case and translate
by compiling all the string parts, then forming a recombined
quasiliteral where the compiled parts are substituted.
* tests/018/format.tl: test case for this.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
| |
* share/txr/stdlib/pic.tl (expand-pic-num, expand-pic, pic):
Allow ### to be followed by a single !. This is not counted
toward the field width.
* tests/018/format.tl: Cover with some tests.
* txr.1: Doc updated.
|
|
|
|
|
|
|
|
| |
* tests/018/format.tl: Add tests which combine overflow
flagging with +/-. The space generated by - contributes to
overflow.
* txr.1: Clarify overflow issue in documentation.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* share/txr/stdlib/pic.tl (expand-pic-num): Bug: when a field
overflows, the (rest ...) call truncates the leftmost digit.
A failing test case is (pic "#.#" 12) which produces "2.0"
instead of "12.0". Firstly, we only need that logic at all in
the zero padding case. When the number is positive, we stick
in the + request, so we are sure to get a + character. The
rest call then predictably chops off the + rather than a
digit.
(pic-join-opt): Fix two bugs here in the string-string combine
case: using s2 instead of s1, and not splicing in rest.
(expand-pic, pic): Implement tightening for escape sequences.
If ~ is not followed by anything, or not followed by the
documented characters for escaping, it is erroneous.
* format.tl: Battery of new tests.
|
|
* buf.c (buf_hex): New function.
* buf.h (buf_hex): Declared.
* stream.c (formatv): Support printing of buffers in hex
via temporary buffer containing hex characters, similarly
to how bignums are handled.
* tests/018/format.tl: New file, providing some coverage over
new and affected code.
|