[openfirmware] r1148 - forth/lib
svn at openfirmware.info
svn at openfirmware.info
Sat Apr 18 21:09:05 CEST 2009
Author: wmb
Date: 2009-04-18 21:09:05 +0200 (Sat, 18 Apr 2009)
New Revision: 1148
Modified:
forth/lib/printf.fth
Log:
sprintf was hanging on a "\\" escape.
Modified: forth/lib/printf.fth
===================================================================
--- forth/lib/printf.fth 2009-04-16 20:51:50 UTC (rev 1147)
+++ forth/lib/printf.fth 2009-04-18 19:09:05 UTC (rev 1148)
@@ -22,7 +22,7 @@
then
;
-: handle% ( ... tail$ -- ... tail$' ) \ Handle % escapes
+: replace% ( ... tail$ -- ... tail$' ) \ Handle % escapes
1/string ( ... tail$ char )
case
[char] d of push-decimal rot <# u#s u#> +spbuf pop-base endof
@@ -34,7 +34,7 @@
endcase
;
-: handle\ ( ... tail$ -- ... tail$' ) \ Handle backslash escapes
+: replace\ ( ... tail$ -- ... tail$' ) \ Handle backslash escapes
1/string ( ... tail$ char )
case
[char] n of newline +spchar then
@@ -44,7 +44,7 @@
[char] l of linefeed +spchar then
[char] b of control h +spchar then
[char] ! of bell +spchar then
- ( default ) +spchar
+ ( default ) dup +spchar
endcase
;
@@ -54,7 +54,7 @@
begin dup while ( ... adr len )
" %\" lex if ( ... tail$ head$ delim )
-rot +spbuf ( ... tail$ delim )
- [char] % = if handle% else handle\ then ( ... tail$ )
+ [char] % = if replace% else replace\ then ( ... tail$ )
else ( ... tail$ )
+spbuf 0 0 ( ... 0 0 )
then ( ... tail$ )
More information about the openfirmware
mailing list