diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2011-12-22 17:43:51 -0800 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2011-12-22 17:43:51 -0800 |
commit | cd7f176ebd9de3e731d4f02223c796b6738dd217 (patch) | |
tree | 5eeb3b7d2e1d051dcbdf2018ecb4ff457a53b420 | |
parent | ba37a43bf36c5f4e787fceb18cb0f4223e98f261 (diff) | |
download | txr-cd7f176ebd9de3e731d4f02223c796b6738dd217.tar.gz txr-cd7f176ebd9de3e731d4f02223c796b6738dd217.tar.bz2 txr-cd7f176ebd9de3e731d4f02223c796b6738dd217.zip |
* stream.c (vformat): Left-adjusted field is now specified
using < rather than '-'. The +, space and leading 0 are
specified on the precision, not the width.
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | stream.c | 20 |
2 files changed, 15 insertions, 11 deletions
@@ -1,5 +1,11 @@ 2011-12-22 Kaz Kylheku <kaz@kylheku.com> + * stream.c (vformat): Left-adjusted field is now specified + using < rather than '-'. The +, space and leading 0 are + specified on the precision, not the width. + +2011-12-22 Kaz Kylheku <kaz@kylheku.com> + * rand.c (random): Fix for 64 bit fixnums: stick two random numbers together. Otherwise for fixnum moduli, we get only a 32 bit number no matter what the modulus is. @@ -882,21 +882,13 @@ val vformat(val stream, val fmtstr, va_list vl) put_char(stream, chr('~')); state = vf_init; continue; - case '-': + case '<': left = 1; continue; - case '+': case ' ': - sign = ch; - continue; case ',': state = vf_precision; continue; - case '0': - saved_state = state; - state = vf_digits; - zeropad = 1; - continue; - case '1': case '2': case '3': case '4': case '5': + case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': saved_state = state; state = vf_digits; @@ -915,12 +907,18 @@ val vformat(val stream, val fmtstr, va_list vl) break; case vf_precision: switch (ch) { - case '0': case '1': case '2': case '3': case '4': case '5': + case '0': + zeropad = 1; + /* fallthrough */ + case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': saved_state = state; state = vf_digits; digits = ch - '0'; continue; + case '+': case ' ': + sign = ch; + continue; case '*': obj = va_arg(vl, val); width = c_num(obj); |