Differences From Artifact [6da23be8654f0bd5]:
File casket.rx part of check-in [aeba3cb867] - fix to work with latest image by crc on 2011-01-05 21:30:39. [annotate] [view]
To Artifact [30d593d59ee72b37]:
File casket.rx part of check-in [87847d60e2] - use when combinator by crc on 2011-01-25 23:43:52. [annotate] [view]
@@ -18,21 +18,22 @@
"Content-type: " getToken ^strings'append "\n\n" ^strings'append
keepString .data ` puts ; immediate
( ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ )
{{
+ : withBase ( n$q-$ ) [ swap ] dip @base [ do ] dip !base ;
: char ( $-$ )
- @+ 'n over = [ drop cr 0 ] ifTrue
- '' over = [ drop '" putc 0 ] ifTrue
- '[ over = [ 27 putc putc 0 ] ifTrue
- 0; putc ;
+ @+ [ 'n = ] [ drop cr ] when
+ [ '' = ] [ drop '" putc ] when
+ [ '[ = ] [ 27 putc putc ] when
+ putc ;
: obj ( $-$ )
- @+ 'd over = [ drop swap @base [ decimal putn ] dip !base 0 ] ifTrue
- 'o over = [ drop swap @base [ octal putn ] dip !base 0 ] ifTrue
- 'x over = [ drop swap @base [ hex putn ] dip !base 0 ] ifTrue
- 'c over = [ drop swap putc 0 ] ifTrue
- 's over = [ drop &puts dip 0 ] ifTrue
- 'u over = [ drop casket:url puts 0 ] ifTrue
- 0; putc ;
+ @+ [ 'd = ] [ drop [ decimal putn ] withBase ] when
+ [ 'o = ] [ drop [ octal putn ] withBase ] when
+ [ 'x = ] [ drop [ hex putn ] withBase ] when
+ [ 'c = ] [ drop swap putc ] when
+ [ 's = ] [ drop &puts dip ] when
+ [ 'u = ] [ drop casket:url puts ] when
+ putc ;
: complex ( $-n )
repeat
@+ 0;
dup '\ = [ drop char 0 ] ifTrue