ifte -> if
parent
c6d9341f13
commit
f586f5913a
|
|
@ -153,7 +153,7 @@ SYMBOL: message
|
||||||
head-short
|
head-short
|
||||||
head-short head-string <string-reader> [
|
head-short head-string <string-reader> [
|
||||||
{
|
{
|
||||||
{ [ dup 1 = ] [ drop name get write head-short HEX: 20 bitand [ " is away." ] [ " is online." ] ifte writeln ] }
|
{ [ dup 1 = ] [ drop name get write head-short HEX: 20 bitand [ " is away." ] [ " is online." ] if writeln ] }
|
||||||
{ [ dup 2 = ] [ drop ] }
|
{ [ dup 2 = ] [ drop ] }
|
||||||
{ [ dup 3 = ] [ drop name get write " went online at " write head-short unparse writeln ] }
|
{ [ dup 3 = ] [ drop name get write " went online at " write head-short unparse writeln ] }
|
||||||
{ [ dup 4 = ] [ drop name get write head-short " has been idle for " writeln ] }
|
{ [ dup 4 = ] [ drop name get write head-short " has been idle for " writeln ] }
|
||||||
|
|
@ -367,11 +367,11 @@ SYMBOL: message
|
||||||
execute opcode get swap hash dup [
|
execute opcode get swap hash dup [
|
||||||
execute ] [
|
execute ] [
|
||||||
unhandled-opcode drop
|
unhandled-opcode drop
|
||||||
] ifte
|
] if
|
||||||
] [
|
] [
|
||||||
unhandled-family-opcode
|
unhandled-family-opcode
|
||||||
drop
|
drop
|
||||||
] ifte
|
] if
|
||||||
unscoped-stream get empty? [ incomplete-opcode ] unless
|
unscoped-stream get empty? [ incomplete-opcode ] unless
|
||||||
] with-unscoped-stream ;
|
] with-unscoped-stream ;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -40,28 +40,20 @@ SYMBOL: unscoped-stack
|
||||||
unscoped-stack get dup length 1 > [
|
unscoped-stack get dup length 1 > [
|
||||||
[ pop ] keep nip peek unscoped-stream set ] [
|
[ pop ] keep nip peek unscoped-stream set ] [
|
||||||
pop drop
|
pop drop
|
||||||
] ifte ;
|
] if ;
|
||||||
|
|
||||||
: with-unscoped-stream ( stream quot -- )
|
: with-unscoped-stream ( stream quot -- )
|
||||||
save-current-scope catch set-previous-scope
|
save-current-scope catch set-previous-scope
|
||||||
[ dup [ unscoped-stream get stream-close ] when rethrow ] when ;
|
[ dup [ unscoped-stream get stream-close ] when rethrow ] when ;
|
||||||
|
|
||||||
! dup [ unscoped-stream get stream-close
|
|
||||||
! ] [
|
|
||||||
! unscoped-stream get contents dup empty? [
|
|
||||||
! drop
|
|
||||||
! ] [ "Remainder of stream: " writeln hexdump
|
|
||||||
! ] ifte
|
|
||||||
! ] ifte
|
|
||||||
|
|
||||||
: close-unscoped-stream ( -- )
|
: close-unscoped-stream ( -- )
|
||||||
unscoped-stream get stream-close ;
|
unscoped-stream get stream-close ;
|
||||||
|
|
||||||
: >endian ( obj n -- str )
|
: >endian ( obj n -- str )
|
||||||
big-endian get [ >be ] [ >le ] ifte ;
|
big-endian get [ >be ] [ >le ] if ;
|
||||||
|
|
||||||
: endian> ( obj n -- str )
|
: endian> ( obj n -- str )
|
||||||
big-endian get [ be> ] [ le> ] ifte ;
|
big-endian get [ be> ] [ le> ] if ;
|
||||||
|
|
||||||
: >byte ( byte -- str )
|
: >byte ( byte -- str )
|
||||||
unit >string ;
|
unit >string ;
|
||||||
|
|
@ -122,9 +114,9 @@ SYMBOL: unscoped-stack
|
||||||
[ ! partial line
|
[ ! partial line
|
||||||
[ 2dup swap nth (print-hex-digit) " " write ] repeat
|
[ 2dup swap nth (print-hex-digit) " " write ] repeat
|
||||||
dup length 16 swap - [ " " write ] repeat
|
dup length 16 swap - [ " " write ] repeat
|
||||||
] ifte
|
] if
|
||||||
dup length
|
dup length
|
||||||
[ 2dup swap nth dup printable? [ write1 ] [ "." write drop ] ifte ] repeat
|
[ 2dup swap nth dup printable? [ write1 ] [ "." write drop ] if ] repeat
|
||||||
terpri drop ;
|
terpri drop ;
|
||||||
|
|
||||||
: (num-full-lines) ( bytes -- )
|
: (num-full-lines) ( bytes -- )
|
||||||
|
|
@ -138,7 +130,7 @@ SYMBOL: unscoped-stack
|
||||||
|
|
||||||
: (print-bytes) ( bytes -- )
|
: (print-bytes) ( bytes -- )
|
||||||
dup (num-full-lines) [ over (get-slice) (print-hex-line) ] repeat
|
dup (num-full-lines) [ over (get-slice) (print-hex-line) ] repeat
|
||||||
dup (num-full-lines) over (get-last-slice) dup empty? [ 3drop ] [ (print-hex-line) 2drop ] ifte ;
|
dup (num-full-lines) over (get-last-slice) dup empty? [ 3drop ] [ (print-hex-line) 2drop ] if ;
|
||||||
|
|
||||||
: (print-length) ( len -- )
|
: (print-length) ( len -- )
|
||||||
[
|
[
|
||||||
|
|
|
||||||
|
|
@ -81,7 +81,7 @@ SYMBOL: K
|
||||||
[ nth-int-be w get push ] 2keep
|
[ nth-int-be w get push ] 2keep
|
||||||
] [
|
] [
|
||||||
dup sha1-W w get push
|
dup sha1-W w get push
|
||||||
] ifte
|
] if
|
||||||
] repeat ;
|
] repeat ;
|
||||||
|
|
||||||
: init-letters ( -- )
|
: init-letters ( -- )
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue