ifte -> if
parent
c6d9341f13
commit
f586f5913a
|
@ -153,7 +153,7 @@ SYMBOL: message
|
|||
head-short
|
||||
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 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 ] }
|
||||
|
@ -367,11 +367,11 @@ SYMBOL: message
|
|||
execute opcode get swap hash dup [
|
||||
execute ] [
|
||||
unhandled-opcode drop
|
||||
] ifte
|
||||
] if
|
||||
] [
|
||||
unhandled-family-opcode
|
||||
drop
|
||||
] ifte
|
||||
] if
|
||||
unscoped-stream get empty? [ incomplete-opcode ] unless
|
||||
] with-unscoped-stream ;
|
||||
|
||||
|
|
|
@ -40,28 +40,20 @@ SYMBOL: unscoped-stack
|
|||
unscoped-stack get dup length 1 > [
|
||||
[ pop ] keep nip peek unscoped-stream set ] [
|
||||
pop drop
|
||||
] ifte ;
|
||||
] if ;
|
||||
|
||||
: with-unscoped-stream ( stream quot -- )
|
||||
save-current-scope catch set-previous-scope
|
||||
[ 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 ( -- )
|
||||
unscoped-stream get stream-close ;
|
||||
|
||||
: >endian ( obj n -- str )
|
||||
big-endian get [ >be ] [ >le ] ifte ;
|
||||
big-endian get [ >be ] [ >le ] if ;
|
||||
|
||||
: endian> ( obj n -- str )
|
||||
big-endian get [ be> ] [ le> ] ifte ;
|
||||
big-endian get [ be> ] [ le> ] if ;
|
||||
|
||||
: >byte ( byte -- str )
|
||||
unit >string ;
|
||||
|
@ -122,9 +114,9 @@ SYMBOL: unscoped-stack
|
|||
[ ! partial line
|
||||
[ 2dup swap nth (print-hex-digit) " " write ] repeat
|
||||
dup length 16 swap - [ " " write ] repeat
|
||||
] ifte
|
||||
] if
|
||||
dup length
|
||||
[ 2dup swap nth dup printable? [ write1 ] [ "." write drop ] ifte ] repeat
|
||||
[ 2dup swap nth dup printable? [ write1 ] [ "." write drop ] if ] repeat
|
||||
terpri drop ;
|
||||
|
||||
: (num-full-lines) ( bytes -- )
|
||||
|
@ -138,7 +130,7 @@ SYMBOL: unscoped-stack
|
|||
|
||||
: (print-bytes) ( bytes -- )
|
||||
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 -- )
|
||||
[
|
||||
|
|
|
@ -81,7 +81,7 @@ SYMBOL: K
|
|||
[ nth-int-be w get push ] 2keep
|
||||
] [
|
||||
dup sha1-W w get push
|
||||
] ifte
|
||||
] if
|
||||
] repeat ;
|
||||
|
||||
: init-letters ( -- )
|
||||
|
|
Loading…
Reference in New Issue