The nipd branch slowed bootstrap by a minute, this patch does not.
sorry about changing the fjsc line endings...
: add-library ( name path abi -- )
3dup add-library? [
[ 2drop remove-library ]
- [ [ nip ] dip make-library ]
+ [ nipd make-library ]
[ 2drop libraries get set-at ] 3tri
] [ 3drop ] if ;
read1 CHAR: \s assert=
read-sp checked-number
read-sp month-abbreviations index 1 + check-timestamp
- read-sp checked-number -rot swap
+ read-sp checked-number spin
read-hh:mm:ss
" " read-until drop parse-rfc822-gmt-offset <timestamp> ;
read1 CHAR: \s assert=
"-" read-token checked-number
"-" read-token month-abbreviations index 1 + check-timestamp
- read-sp checked-number -rot swap
+ read-sp checked-number spin
read-hh:mm:ss
" " read-until drop parse-rfc822-gmt-offset <timestamp> ;
: F ( x y z -- out ) bitxor bitxor ; inline
: G ( x y z -- out ) pick bitnot swap [ bitand ] 2bi@ bitor ; inline
: H ( x y z -- out ) [ bitnot bitor ] [ bitxor ] bi* ; inline
-: I ( x y z -- out ) swap over bitnot [ bitand ] 2bi@ bitor ; inline
+: I ( x y z -- out ) tuck bitnot [ bitand ] 2bi@ bitor ; inline
: J ( x y z -- out ) bitnot bitor bitxor ; inline
CONSTANT: T11 0x00000000
ERROR: checksums-differ algorithm seq incremental-checksum one-go-checksum ;
: compare-checksum-calculations ( algorithm seq -- ? )
2dup [ incremental-checksum ] [ one-go-checksum ] 2bi 2dup = [
- 2drop 2drop t
+ 4drop t
] [
checksums-differ
] if ;
M: struct-class boa>object
swap pad-struct-slots
[ <struct> ] [ struct-slots ] bi
- [ [ (writer-quot) call( value struct -- ) ] with 2each ] curry keep ;
+ [ [ (writer-quot) call( value struct -- ) ] with 2each ] keepd ;
M: struct-class initial-value* <struct> t ; inline
[
[ initial>> ]
[ (writer-quot) ] bi
- over [ swapd [ call( value struct -- ) ] curry keep ] [ 2drop ] if
+ over [ swapd [ call( value struct -- ) ] keepd ] [ 2drop ] if
] each
] [ drop f ] if ;
} cleave ;
: change-insn-gc-roots ( gc-map-insn quot: ( x -- x ) -- )
- [ gc-map>> ] dip [ swap gc-roots>> swap map! drop ]
+ [ gc-map>> ] dip [ [ gc-roots>> ] dip map! drop ]
[ '[ [ _ bi@ ] assoc-map ] change-derived-roots drop ] 2bi ; inline
: spill-required? ( live-interval root-leaders n -- ? )
: my-new-key4 ( a i j -- i/j )
2over
slot
- swap over
+ tuck
! a i el j el
[
! a i el j
} apply-passes ;
: create-locs ( loc-class seq -- locs )
- [ swap new swap >>n ] with map <reversed> ;
+ [ [ new ] dip >>n ] with map <reversed> ;
: stack-locs ( loc-class n -- locs )
<iota> create-locs ;
: rewrite-gather-vector-4 ( insn -- insn/f )
dup { [ src1>> ] [ src2>> ] [ src3>> ] [ src4>> ] } cleave [ vreg>insn ] 4 napply
{
- { [ 4 ndup [ literal-insn? ] 4 napply and and and ] [ fold-gather-vector-4 ] }
- [ 5 ndrop f ]
+ { [ 4dup [ literal-insn? ] 4 napply and and and ] [ fold-gather-vector-4 ] }
+ [ 5drop f ]
} cond ;
M: ##gather-vector-4 rewrite rewrite-gather-vector-4 ;
: multi_ffi_test_18 ( w x y z w' x' y' z' -- int int )
[ int "f-stdcall" "ffi_test_18" { int int int int } f alien-invoke ]
- 4 ndip
+ 4dip
int "f-stdcall" "ffi_test_18" { int int int int } f alien-invoke
gc ;
] [ 2drop ] if ; inline recursive
: run-test ( alien -- seq )
- 100 33 <array> swap over
+ 100 33 <array> tuck
[
pick swapd
bug1021_test_1
- -rot swap 2 fixnum+fast
+ spin 2 fixnum+fast
set-slot
] curry curry 0 each-to100 ;
: inline-unless-intrinsic ( word -- )
dup '[
- _ swap over "intrinsic" word-prop
+ _ tuck "intrinsic" word-prop
"always-inline-simd-intrinsics" get not swap and
! word node intrinsic
[ try-intrinsic [ drop f ] [ def>> ] if ]
[ snappy_uncompressed_length check-snappy ] keep
size_t deref
n>outs
- [ snappy_uncompress check-snappy ] 2keep drop >byte-array ;
+ [ snappy_uncompress check-snappy ] keepd >byte-array ;
[ <byte-vector> dup underlying>> ] keep ulong <ref>
] keep [
dup length compression.zlib.ffi:compress zlib-error
- ] 2keep drop ulong deref >>length B{ } like ;
+ ] keepd ulong deref >>length B{ } like ;
: (uncompress) ( length byte-array -- byte-array )
[
: zlib-inflate-init ( -- z_stream_s )
- z_stream <struct> ZLIB_VERSION over byte-length [
- inflateInit_ zlib-error
- ] 3keep 2drop ;
+ z_stream <struct>
+ dup ZLIB_VERSION over byte-length inflateInit_ zlib-error ;
! window can be 0, 15, 32, 47 (others?)
: zlib-inflate-init2 ( window -- z_stream_s )
- [ z_stream <struct> ] dip ZLIB_VERSION pick byte-length [
- inflateInit2_ zlib-error
- ] 4keep 3drop ;
+ [ z_stream <struct> dup ] dip
+ ZLIB_VERSION pick byte-length inflateInit2_ zlib-error ;
: zlib-inflate-end ( z_stream -- )
inflateEnd zlib-error ;
inflate zlib-error ;
: zlib-inflate-get-header ( z_stream -- gz_header )
- gz_header <struct> [
- inflateGetHeader zlib-error
- ] keep ;
+ gz_header <struct> [ inflateGetHeader zlib-error ] keep ;
: CLRLDI. ( ra rs n -- ) 0 swap RLDICL. ;
: CLRRDI ( ra rs n -- ) 0 swap 63 swap - RLDICR ;
: CLRRDI. ( ra rs n -- ) 0 swap 63 swap - RLDICR. ;
-: CLRLSLDI ( ra rs b n -- ) swap over - RLDIC ;
-: CLRLSLDI. ( ra rs b n -- ) swap over - RLDIC. ;
+: CLRLSLDI ( ra rs b n -- ) tuck - RLDIC ;
+: CLRLSLDI. ( ra rs b n -- ) tuck - RLDIC. ;
! E.7.2 Operations on Words
: EXTLWI ( ra rs n b -- ) swap 0 1 - RLWINM ;
: 1-operand ( operand reg,rex.w,opcode -- )
! The 'reg' is not really a register, but a value for the
! 'reg' field of the mod-r/m byte.
- first3 [ [ over ] dip prefix-1 ] dip opcode, swap addressing ;
+ first3 [ overd prefix-1 ] dip opcode, swap addressing ;
: immediate-operand-size-bit ( dst imm reg,rex.w,opcode -- imm dst reg,rex.w,opcode )
over integer? [ first3 0b1 opcode-or 3array ] when ;
{ c:int [ 32 %alien-signed-getter ] }
{ c:uint [ 32 [ 2drop ] %alien-integer-getter ] }
} case
- ] [ [ drop ] 2dip %copy ] ?if ;
+ ] [ nipd %copy ] ?if ;
M: x86 %load-memory ( dst base displacement scale offset rep c-type -- )
(%memory) (%load-memory) ;
DEFER: quoted-field,
: maybe-escaped-quote ( delimeter stream quoted? -- delimiter stream sep/f )
- 2over stream-read1 swap over =
+ 2over stream-read1 tuck =
[ nip ] [
{
{ CHAR: \" [ [ CHAR: \" , ] when quoted-field, ] }
: continue-field ( delimiter stream field-seps seq -- sep/f field )
swap rot stream-read-until [ "\"" glue ] dip
- swap ?trim [ drop ] 2dip ; inline
+ swap ?trim nipd ; inline
: field ( delimiter stream field-seps quote-seps -- sep/f field )
pick stream-read-until dup CHAR: \" = [
drop [ drop quoted-field ] [ continue-field ] if-empty
- ] [ [ 3drop ] 2dip swap ?trim ] if ;
+ ] [ 3nipd swap ?trim ] if ;
: (stream-read-row) ( delimiter stream field-end quoted-field -- sep/f fields )
[ [ dup '[ dup _ = ] ] keep ] 3dip
PRIVATE>
: stream-read-row ( stream -- row )
- delimiter get swap over field-delimiters
+ delimiter get tuck field-delimiters
(stream-read-row) nip ; inline
: read-row ( -- row )
: pq-get-string ( handle row column -- obj )
3dup PQgetvalue utf8 alien>string
- dup empty? [ [ pq-get-is-null f ] dip ? ] [ [ 3drop ] dip ] if ;
+ dup empty? [ [ pq-get-is-null f ] dip ? ] [ 3nip ] if ;
: pq-get-number ( handle row column -- obj )
pq-get-string dup [ string>number ] when ;
: pq-get-blob ( handle row column -- obj/f )
[ PQgetvalue ] 3keep 3dup PQgetlength
dup 0 > [
- [ 3drop ] dip
+ 3nip
[
memory>byte-array >string
{ uint }
[ 10^ * round-to-even >integer number>string ]
[ 1 + CHAR: 0 pad-head ]
[ cut* ] tri [ "." glue ] unless-empty
- ] curry keep neg? [ CHAR: - prefix ] when ;
+ ] keepd neg? [ CHAR: - prefix ] when ;
: format-scientific-mantissa ( x log10x digits -- string rounded-up? )
[ swap - 10^ * round-to-even >integer number>string ] keep
[ abs dup integer-log10 ] dip
[ format-scientific-mantissa ]
[ drop nip format-scientific-exponent ] 3bi append
- ] curry keep neg? [ CHAR: - prefix ] when ;
+ ] keepd neg? [ CHAR: - prefix ] when ;
: format-float-fast ( x digits string -- string )
[ "" -1 ] 2dip "C" format-float ;
: in-quot-slices ( n i state -- head tail )
in-quot>>
[ <slice> ]
- [ [ drop ] 2dip swap 1 + tail-slice ] 3bi ; inline
+ [ nipd swap 1 + tail-slice ] 3bi ; inline
: push-head-slice ( head state -- )
quot>> [ push-all ] [ \ _ swap push ] bi ; inline
rot {
[ nip in-quot-slices ] ! head tail i elt state
[ [ 2drop swap ] dip push-head-slice ]
- [ [ drop ] 2dip push-subquot ]
+ [ nipd push-subquot ]
[ [ 1 + ] [ drop ] [ ] tri* dredge-fry ]
} 3cleave ; inline recursive
[ [ "/" ?tail drop "/" ] dip present 3append ] when* ;
: a-url ( href rest query value-name -- url )
- dup [ [ 3drop ] dip value ] [
+ dup [ 3nip value ] [
drop
<url>
swap parse-query-attr >>query
<alien> DEV_BROADCAST_HDR memory>struct ;
: handle-wm-devicechange ( hWnd uMsg wParam lParam -- )
- [ 2drop ] 2dip swap {
+ 2nipd swap {
{ [ dup DBT_DEVICEARRIVAL = ] [ drop <DEV_BROADCAST_HDR> device-arrived ] }
{ [ dup DBT_DEVICEREMOVECOMPLETE = ] [ drop <DEV_BROADCAST_HDR> device-removed ] }
[ 2drop ]
get-dpy dup XDefaultRootWindow
{ int int int int int int int }
[ XQueryPointer drop ] with-out-parameters
- [ 4 ndrop ] 3dip ;
+ [ 4drop ] 3dip ;
M: gtk-game-input-backend read-mouse
query-pointer
dpy get dup XDefaultRootWindow
{ int int int int int int int }
[ XQueryPointer drop ] with-out-parameters
- [ 4 ndrop ] 3dip ;
+ [ 4drop ] 3dip ;
SYMBOL: mouse-reset?
<PRIVATE
: map-like ( seq n quot -- seq )
- 2keep drop '[ _ like ] map ; inline
+ keepd '[ _ like ] map ; inline
PRIVATE>
: data-push ( entry data -- n )
[ length [ >>index ] keep ]
- [ [ set-nth ] 2keep drop ] bi ; inline
+ [ [ set-nth ] keepd ] bi ; inline
GENERIC: heap-compare ( entry1 entry2 heap -- ? )
] map ;
: contains-funky-elements? ( element -- ? )
+B
{
$shuffle
$complex-shuffle
: recover-fail ( try fail -- )
[ drop call ] [
- [ nip ] dip dup fail?
+ nipd dup fail?
[ drop call ] [ nip throw ] if
] recover ; inline
: make-event ( fd events -- event )
epoll-event <struct>
swap >>events
- swap over data>> fd<< ;
+ tuck data>> fd<< ;
:: do-epoll-ctl ( fd mx what events -- )
mx fd>> what fd fd events make-event epoll_ctl io-error ;
pick c-ptr? [
memcpy
] [
- -rot swap
+ spin
[ swap alien-unsigned-1 ]
[ set-nth-unsafe ] bi-curry*
[ bi ] 2curry each-integer
! Decoding
-: char> ( stream encoding quot -- ch )
- nip swap 4 swap stream-read dup length {
+: char> ( stream quot -- ch )
+ swap [ 4 ] dip stream-read dup length {
{ 0 [ 2drop f ] }
{ 4 [ swap call ] }
[ 3drop replacement-char ]
} case ; inline
-M: utf32be decode-char
- [ be> ] char> ;
+M: utf32be decode-char drop [ be> ] char> ;
-M: utf32le decode-char
- [ le> ] char> ;
+M: utf32le decode-char drop [ le> ] char> ;
! Encoding
-: >char ( char stream encoding quot -- )
- nip 4 swap curry dip stream-write ; inline
+: >char ( char stream quot -- )
+ 4 swap curry dip stream-write ; inline
-M: utf32be encode-char
- [ >be ] >char ;
+M: utf32be encode-char drop [ >be ] >char ;
-M: utf32le encode-char
- [ >le ] >char ;
+M: utf32le encode-char drop [ >le ] >char ;
! UTF-32
CONSTANT: bom-be B{ 0 0 0xfe 0xff }
: bom>le/be ( bom -- le/be )
- dup bom-le sequence= [ drop utf32le ] [
+ dup bom-le sequence= [
+ drop utf32le
+ ] [
bom-be sequence= [ utf32be ] [ missing-bom ] if
] if ;
FindStreamInfoStandard
WIN32_FIND_STREAM_DATA <struct>
0
- [ FindFirstStream ] 2keep drop
+ [ FindFirstStream ] keepd
over -1 <alien> = [
2drop throw-win32-error
] [
: read-until-loop ( seps port accum -- sep/f )
2over read-until-step over [
[ append! ] dip dup [
- [ 3drop ] dip
+ 3nip
] [
drop read-until-loop
] if
] [
- [ 4drop ] dip
+ 4nip
] if ; inline recursive
PRIVATE>
M: input-port stream-read-until
2dup read-until-step dup [
- [ 2drop ] 2dip
+ 2nipd
] [
over [
drop
BV{ } like [ read-until-loop ] keep B{ } like swap
] [
- [ 2drop ] 2dip
+ 2nipd
] if
] if ;
] [ nip (ssl-error) ] if-zero ;
: check-ssl-error ( ssl ret exra-cases/f -- event/f )
- [ swap over SSL_get_error ] dip
+ [ tuck SSL_get_error ] dip
{
{ SSL_ERROR_NONE [ drop f ] }
{ SSL_ERROR_WANT_READ [ drop +input+ ] }
! Client sockets - TCP and Unix domain
M: object (get-local-address)
[ handle-fd ] dip empty-sockaddr/size int <ref>
- [ getsockname io-error ] 2keep drop ;
+ [ getsockname io-error ] keepd ;
M: object (get-remote-address)
[ handle-fd ] dip empty-sockaddr/size int <ref>
- [ getpeername io-error ] 2keep drop ;
+ [ getpeername io-error ] keepd ;
: init-client-socket ( fd -- )
SOL_SOCKET SO_OOBINLINE set-socket-option ;
: do-accept ( server addrspec -- fd sockaddr )
[ handle>> handle-fd ] [ empty-sockaddr/size int <ref> ] bi*
- [ unix.ffi:accept ] 2keep drop ; inline
+ [ unix.ffi:accept ] keepd ; inline
M: object (accept)
2dup do-accept over 0 >= [
recvfrom sockaddr ; inline
: (receive-loop) ( n buf datagram -- count sockaddr )
- 3dup do-receive over 0 > [ [ 3drop ] 2dip ] [
+ 3dup do-receive over 0 > [ 3nipd ] [
2drop [ +input+ wait-for-port ] [ (receive-loop) ] bi
] if ; inline recursive
M: object (get-local-address) ( socket addrspec -- sockaddr )
[ handle>> ] dip empty-sockaddr/size int <ref>
- [ getsockname socket-error ] 2keep drop ;
+ [ getsockname socket-error ] keepd ;
M: object (get-remote-address) ( socket addrspec -- sockaddr )
[ handle>> ] dip empty-sockaddr/size int <ref>
- [ getpeername socket-error ] 2keep drop ;
+ [ getpeername socket-error ] keepd ;
: bind-socket ( win32-socket sockaddr len -- )
[ handle>> ] 2dip bind socket-error ;
M: macosx strerror ( errno -- str )
[
- 1024 [ malloc &free ] keep [ strerror_r ] 2keep drop nip
+ 1024 [ malloc &free ] keep [ strerror_r ] keepd nip
alien>native-string
] with-destructors ;
M: windows strerror ( errno -- str )
[
[ 1024 [ malloc &free ] keep ] dip
- [ strerror_s drop ] 3keep 2drop
+ [ strerror_s drop ] keepdd
utf8 alien>string
] with-destructors ;
'[ _ [ _ log-error @ ] recover ] ;
: add-error-logging ( word level -- )
- [ [ input-logging-quot ] 2keep drop error-logging-quot ]
+ [ [ input-logging-quot ] keepd error-logging-quot ]
(define-logging) ;
SYNTAX: LOG:
[ drop pick [ combination ] [ 3drop f ] if ] 3bi ; inline
: reduce-combinations ( ... seq k identity quot: ( ... prev elt -- ... next ) -- ... result )
- [ -rot ] dip each-combination ; inline
+ -rotd each-combination ; inline
: all-subsets ( seq -- subsets )
dup length [0,b] [ all-combinations ] with map concat ;
dup -52 shift 0x7ff bitand 0x3ff -
! check for floats without fractional part (>= 2^52)
dup 52 < [
- [ drop ] 2dip
+ nipd
dup 0 < [
! the float is between -1.0 and 1.0,
! the result could be +/-0.0, but we will
0 swap nth-row [ zero? not ] skip ;
: clear-scale ( col# pivot-row i-row -- n )
- [ over ] dip nth dup zero? [
+ overd nth dup zero? [
3drop 0
] [
[ nth dup zero? ] dip swap [
: math-method* ( word left right -- quot )
3dup math-op
- [ [ 3drop ] dip 1quotation ] [ drop math-method ] if ;
+ [ 3nip 1quotation ] [ drop math-method ] if ;
: math-both-known? ( word left right -- ? )
3dup math-op
<PRIVATE
: r-sum-diffs ( x-mean y-mean x-seq y-seq -- (r) )
! finds sigma((xi-mean(x))(yi-mean(y))
- 0 [ [ [ pick ] dip swap - ] bi@ * + ] 2reduce 2nip ;
+ 0 [ [ reach - ] bi@ * + ] 2reduce 2nip ;
: (r) ( x-mean y-mean x-seq y-seq x-std y-std -- r )
* recip [ [ r-sum-diffs ] keep length 1 - / ] dip * ;
: pearson-r ( xy-pairs -- r ) r-stats (r) ;
: least-squares ( xy-pairs -- alpha beta )
- r-stats [ 2dup ] 4 ndip
+ r-stats [ 2dup ] 4dip
! stack is x-mean y-mean x-mean y-mean x-seq y-seq x-std y-std
[ (r) ] 2keep ! stack is mean(x) mean(y) r sx sy
swap / * ! stack is mean(x) mean(y) beta
: (simd-vunpack-tail) ( a rep -- c )
[ byte>rep-array ] [ widen-vector-rep [ rep-length ] [ '[ _ >rep-array ] ] bi ] bi
[ tail-slice ] dip call( a' -- c' ) underlying>> ;
-: (simd-with) ( n rep -- v )
+: (simd-with) ( n rep -- v )
[ rep-length swap '[ _ ] ] [ <rep-array> ] bi replicate-as
underlying>> ;
: (simd-gather-2) ( m n rep -- v ) <rep-array> [ 2 set-firstn-unsafe ] keep underlying>> ;
: (simd-gather-4) ( m n o p rep -- v ) <rep-array> [ 4 set-firstn-unsafe ] keep underlying>> ;
: (simd-select) ( a n rep -- x ) swapd byte>rep-array nth-unsafe ;
-: alien-vector ( c-ptr n rep -- value )
+: alien-vector ( c-ptr n rep -- value )
[ swap <displaced-alien> ] dip rep-size memory>byte-array ;
-: set-alien-vector ( value c-ptr n rep -- )
+: set-alien-vector ( value c-ptr n rep -- )
[ swap <displaced-alien> swap ] dip rep-size memcpy ;
"compiler.cfg.intrinsics.simd" require
: (gl-program) ( shaders quot: ( gl-program -- ) -- program )
glCreateProgram
[
- rot dupd attach-shaders swap call
+ dup roll attach-shaders swap call
] [ glLinkProgram ] [ ] tri gl-error ; inline
: <gl-program> ( shaders -- program )
: tex-sub-image ( image -- )
[ GL_TEXTURE_2D 0 0 0 ] dip
[ dim>> first2 ]
- [ image-format [ drop ] 2dip ]
+ [ image-format nipd ]
[ bitmap>> ] tri
glTexSubImage2D ;
: merge-errors ( -- )
error-stack get dup length 1 > [
- dup pop over pop swap (merge-errors) swap push
+ [ pop ] [ pop swap (merge-errors) ] [ ] tri push
] [
drop
] if ;
[ [ setup-growth ] 2keep ] 2dip
[ dup eval-rule ] dip swap
dup pick stop-growth? [
- 5 ndrop
+ 5drop
] [
over update-m
(grow-lr)
swap [
drop f
] [
- unclip-slice rot dupd call [
+ unclip-slice dup roll call [
<parse-result>
] [
2drop f
: node-change-nth ( i node quot -- node' )
[ clone ] dip [
- [ clone ] dip [ change-nth ] 2keep drop
+ [ clone ] dip [ change-nth ] keepd
] curry change-children ; inline
: (new-nth) ( val i node -- node' )
:: next-match ( i string regexp quot: ( i string regexp -- j ) reverse? -- start end ? )
f f f
i string reverse? search-range
- [ [ 3drop ] dip string regexp quot reverse? (next-match) dup ] find 2drop ; inline
+ [ 3nip string regexp quot reverse? (next-match) dup ] find 2drop ; inline
: do-next-match ( i string regexp -- start end ? )
dup next-match>>
] [ 2drop f ] if ;
: re-contains? ( string regexp -- ? )
- prepare-match-iterator do-next-match [ 2drop ] dip >boolean ;
+ prepare-match-iterator do-next-match 2nip >boolean ;
: re-split ( string regexp -- seq )
[ <slice-unsafe> ] (re-split) ;
[ 4 nappend print ] 4 0 mnmap ;
: nproduce-as-test ( n -- a b )
[ dup zero? not ]
- [ [ 2 - ] [ ] [ 1 - ] tri ] { } B{ } 2 nproduce-as
- [ drop ] 2dip ;
+ [ [ 2 - ] [ ] [ 1 - ] tri ] { } B{ } 2 nproduce-as nipd ;
: nproduce-test ( n -- a b )
[ dup zero? not ]
- [ [ 2 - ] [ ] [ 1 - ] tri ] 2 nproduce
- [ drop ] 2dip ;
+ [ [ 2 - ] [ ] [ 1 - ] tri ] 2 nproduce nipd ;
{ "A1a!
B2b@
[ { } swap dupn ] keep nproduce-as ; inline
MACRO: nmap-reduce ( map-quot reduce-quot n -- quot )
- -rot dupd compose [ over ] dip over '[
+ -rot dupd compose overd over '[
[ [ first ] _ napply @ 1 ] _ nkeep
_ _ (neach) (each-integer)
] ;
[ <merged> ] keep first like ;
: 2merge ( seq1 seq2 -- seq )
- [ <2merged> ] 2keep drop like ;
+ [ <2merged> ] keepd like ;
: 3merge ( seq1 seq2 seq3 -- seq )
- [ <3merged> ] 3keep 2drop like ;
+ [ <3merged> ] keepdd like ;
M: merged length
seqs>> [ [ length ] [ min ] map-reduce ] [ length ] bi * ; inline
: <safe-slice> ( from to seq -- slice/f )
3dup {
[ 2drop 0 < ]
- [ [ drop ] 2dip length > ]
+ [ nipd length > ]
[ drop > ]
} 3|| [ 3drop f ] [ <slice-unsafe> ] if ; inline
(unrolled-collect) unrolled-each-integer ; inline
: unrolled-map-integers ( n quot: ( n -- value ) exemplar -- newseq )
- [ over ] dip [ [ unrolled-collect ] keep ] new-like ; inline
+ overd [ [ unrolled-collect ] keep ] new-like ; inline
ERROR: unrolled-bounds-error
seq unroll-length ;
pick unrolled-map-as-unsafe ; inline
: unrolled-2map-unsafe ( xseq yseq len quot: ( x y -- newx ) -- newseq )
- 4 npick unrolled-2map-as-unsafe ; inline
+ reach unrolled-2map-as-unsafe ; inline
PRIVATE>
pick unrolled-map-as ; inline
: unrolled-2map ( xseq yseq len quot: ( x y -- newx ) -- newseq )
- 4 npick unrolled-2map-as ; inline
+ reach unrolled-2map-as ; inline
: unrolled-map-index ( seq len quot: ( x i -- newx ) -- newseq )
[ dup length <iota> ] 2dip unrolled-2map ; inline
[ drop 0 ] [ length ] bi clamp ; inline
: in-bounds ( a b sequence -- a' b' sequence )
- [ nip in-bound ] [ [ nip ] dip in-bound ] [ 2nip ] 3tri ;
+ [ nip in-bound ] [ nipd in-bound ] [ 2nip ] 3tri ;
:: rolling-map ( ... seq n quot: ( ... slice -- ... elt ) -- ... newseq )
seq length [
+++ /dev/null
-USING: help.markup help.syntax ;
-IN: shuffle
-
-HELP: spin $complex-shuffle ;
-HELP: roll $complex-shuffle ;
-HELP: -roll $complex-shuffle ;
-HELP: tuck $complex-shuffle ;
{ 1 2 3 4 } [ 3 4 1 2 2swap ] unit-test
{ 4 2 3 } [ 1 2 3 4 shuffle( a b c d -- d b c ) ] unit-test
-
-{ 2 3 4 1 } [ 1 2 3 4 roll ] unit-test
-{ 1 2 3 4 } [ 2 3 4 1 -roll ] unit-test
SYNTAX: shuffle(
")" parse-effect suffix! \ shuffle-effect suffix! ;
-: tuck ( x y -- y x y ) swap over ; inline deprecated
-
: spin ( x y z -- z y x ) swap rot ; inline deprecated
-: roll ( x y z t -- y z t x ) [ rot ] dip swap ; inline deprecated
-
-: -roll ( x y z t -- t x y z ) swap [ -rot ] dip ; inline deprecated
-
: 2swap ( x y z t -- z t x y ) 2 2 mnswap ; inline
} cond ;
{
- { drop ( x -- ) }
- { 2drop ( x y -- ) }
- { 3drop ( x y z -- ) }
- { 4drop ( w x y z -- ) }
- { dup ( x -- x x ) }
- { 2dup ( x y -- x y x y ) }
- { 3dup ( x y z -- x y z x y z ) }
- { 4dup ( w x y z -- w x y z w x y z ) }
- { rot ( x y z -- y z x ) }
- { -rot ( x y z -- z x y ) }
- { dupd ( x y -- x x y ) }
- { swapd ( x y z -- y x z ) }
- { nip ( x y -- y ) }
- { 2nip ( x y z -- z ) }
- { over ( x y -- x y x ) }
- { pick ( x y z -- x y z x ) }
- { swap ( x y -- y x ) }
+ { drop ( x -- ) }
+ { 2drop ( x y -- ) }
+ { 3drop ( x y z -- ) }
+ { 4drop ( w x y z -- ) }
+ { dup ( x -- x x ) }
+ { 2dup ( x y -- x y x y ) }
+ { 3dup ( x y z -- x y z x y z ) }
+ { 4dup ( w x y z -- w x y z w x y z ) }
+ { rot ( x y z -- y z x ) }
+ { -rot ( x y z -- z x y ) }
+ { roll ( w x y z -- x y z w ) }
+ { -roll ( w x y z -- z w x y ) }
+ { reach ( w x y z -- w x y z w ) }
+ { dupd ( x y -- x x y ) }
+ { swapd ( x y z -- y x z ) }
+ { nip ( x y -- y ) }
+ { 2nip ( x y z -- z ) }
+ { 3nip ( w x y z -- z ) }
+ { 4nip ( v w x y z -- z ) }
+ { nipd ( x y z -- y z ) }
+ { 2nipd ( w x y z -- y z ) }
+ { 3nipd ( v w x y z -- y z ) }
+ { over ( x y -- x y x ) }
+ { overd ( x y z -- x y x z ) }
+ { pick ( x y z -- x y z x ) }
+ { pickd ( w x y z -- w x y w z ) }
+ { swap ( x y -- y x ) }
+ { tuck ( x y -- y x y ) }
} [ "shuffle" set-word-prop ] assoc-each
: check-declaration ( declaration -- declaration )
! ensure that polymorphic checking works on recursive combinators
: (recursive-reduce) ( identity i seq quot: ( prev elt -- next ) n -- result )
- [ pick ] dip swap over < [
+ pickd tuck < [
[ [ [ nth-unsafe ] dip call ] 3keep [ 1 + ] 2dip ] dip
(recursive-reduce)
] [ 4drop ] if ; inline recursive
: copy-library ( dir library -- )
dup find-library-file
- [ swap over file-name append-path copy-file ]
+ [ tuck file-name append-path copy-file ]
[ can't-deploy-library-file ] ?if ;
: copy-libraries ( manifest name dir -- )
: handle-wm-buttonup ( hWnd uMsg wParam lParam -- )
mouse-captured get [ release-capture ] when
pick message>button drop dup nc-buttons get member? [
- nc-buttons get remove! drop 4drop
+ nc-buttons get remove! 5drop
] [
drop prepare-mouse send-button-up
] if ;
: try-noncombining ( state char -- state )
[ drop ] [ [ char>> ] dip combine-chars ] 2bi
- [ >>char to f >>last-class compose-iter ] when* ; inline
+ [ >>char to f >>last-class compose-iter ] when* ; inline recursive
: compose-iter ( state -- state )
dup current [
>>
MACRO: <DIDATAFORMAT> ( dwFlags dwDataSize struct rgodf-array -- alien )
- [ DIDATAFORMAT heap-size DIOBJECTDATAFORMAT heap-size ] 4 ndip
+ [ DIDATAFORMAT heap-size DIOBJECTDATAFORMAT heap-size ] 4dip
[ nip length ] [ make-DIOBJECTDATAFORMAT-array-quot ] 2bi
'[ _ _ _ _ _ @ DIDATAFORMAT <struct-boa> ] ;
: get-fixed-info ( -- FIXED_INFO )
FIXED_INFO <struct> dup byte-length ulong <ref>
- [ GetNetworkParams n>win32-error-check ] 2keep drop ;
+ [ GetNetworkParams n>win32-error-check ] keepd ;
: dns-server-ips ( -- sequence )
get-fixed-info DnsServerList>> [
-<HTML>\r
-<TITLE>Canonical XML</TITLE>\r
-<BODY>\r
-<H1>Canonical XML</H1>\r
-<P>\r
-This document defines a subset of XML called canonical XML.\r
-The intended use of canonical XML is in testing XML processors,\r
-as a representation of the result of parsing an XML document.\r
-<P>\r
-Every well-formed XML document has a unique structurally equivalent\r
-canonical XML document. Two structurally equivalent XML\r
-documents have a byte-for-byte identical canonical XML document.\r
-Canonicalizing an XML document requires only information that an XML\r
-processor is required to make available to an application.\r
-<P>\r
-A canonical XML document conforms to the following grammar:\r
-<PRE>\r
-CanonXML ::= Pi* element Pi*\r
-element ::= Stag (Datachar | Pi | element)* Etag\r
-Stag ::= '<' Name Atts '>'\r
-Etag ::= '</' Name '>'\r
-Pi ::= '<?' Name ' ' (((Char - S) Char*)? - (Char* '?>' Char*)) '?>'\r
-Atts ::= (' ' Name '=' '"' Datachar* '"')*\r
-Datachar ::= '&amp;' | '&lt;' | '&gt;' | '&quot;'\r
- | '&#9;'| '&#10;'| '&#13;'\r
- | (Char - ('&' | '<' | '>' | '"' | #x9 | #xA | #xD))\r
-Name ::= (see XML spec)\r
-Char ::= (see XML spec)\r
-S ::= (see XML spec)\r
-</PRE>\r
-<P>\r
-Attributes are in lexicographical order (in Unicode bit order).\r
-<P>\r
-A canonical XML document is encoded in UTF-8.\r
-<P>\r
-Ignorable white space is considered significant and is treated equivalently\r
-to data.\r
-<P>\r
-<ADDRESS>\r
-<A HREF="mailto:jjc@jclark.com">James Clark</A>\r
-</ADDRESS>\r
-\r
-</BODY>\r
+<HTML>
+<TITLE>Canonical XML</TITLE>
+<BODY>
+<H1>Canonical XML</H1>
+<P>
+This document defines a subset of XML called canonical XML.
+The intended use of canonical XML is in testing XML processors,
+as a representation of the result of parsing an XML document.
+<P>
+Every well-formed XML document has a unique structurally equivalent
+canonical XML document. Two structurally equivalent XML
+documents have a byte-for-byte identical canonical XML document.
+Canonicalizing an XML document requires only information that an XML
+processor is required to make available to an application.
+<P>
+A canonical XML document conforms to the following grammar:
+<PRE>
+CanonXML ::= Pi* element Pi*
+element ::= Stag (Datachar | Pi | element)* Etag
+Stag ::= '<' Name Atts '>'
+Etag ::= '</' Name '>'
+Pi ::= '<?' Name ' ' (((Char - S) Char*)? - (Char* '?>' Char*)) '?>'
+Atts ::= (' ' Name '=' '"' Datachar* '"')*
+Datachar ::= '&amp;' | '&lt;' | '&gt;' | '&quot;'
+ | '&#9;'| '&#10;'| '&#13;'
+ | (Char - ('&' | '<' | '>' | '"' | #x9 | #xA | #xD))
+Name ::= (see XML spec)
+Char ::= (see XML spec)
+S ::= (see XML spec)
+</PRE>
+<P>
+Attributes are in lexicographical order (in Unicode bit order).
+<P>
+A canonical XML document is encoded in UTF-8.
+<P>
+Ignorable white space is considered significant and is treated equivalently
+to data.
+<P>
+<ADDRESS>
+<A HREF="mailto:jjc@jclark.com">James Clark</A>
+</ADDRESS>
+
+</BODY>
</HTML>
\ No newline at end of file
-<HTML>\r
-<TITLE>XML Test Cases</TITLE>\r
-<BODY>\r
-<H1>XML Test Cases version 1998-11-18</H1>\r
-<P>\r
-Copyright (C) 1998 James Clark. All rights reserved. Permission is\r
-granted to copy and modify this collection in any way for internal use\r
-within a company or organization. Permission is granted to\r
-redistribute the file <code>xmltest.zip</code> containing this\r
-collection to third parties provided that no modifications of any kind\r
-are made to this file. Note that permission to distribute the\r
-collection in any other form is not granted.\r
-<P>\r
-The collection is structured into three directories:\r
-<DL>\r
-<DT><CODE>not-wf</CODE>\r
-<DD>this contains cases that are not well-formed XML documents\r
-<DT><CODE>valid</CODE>\r
-<DD>this contains cases that are valid XML documents\r
-<DT><CODE>invalid</CODE>\r
-<DD>this contains cases that are well-formed XML documents\r
-but are not valid XML documents\r
-</DL>\r
-<P>\r
-The <CODE>not-wf</CODE> and <CODE>valid</CODE> directories each have\r
-three subdirectories:\r
-<DL>\r
-<DT>\r
-<CODE>sa</CODE>\r
-<DD>\r
-this contains cases that are standalone (as defined in XML) and do not\r
-have references to external general entities\r
-<DT>\r
-<CODE>ext-sa</CODE>\r
-<DD>\r
-this contains case that are standalone and have references to external\r
-general entities\r
-<DT>\r
-<CODE>not-sa</CODE>\r
-<DD>\r
-this contains cases that are not standalone\r
-</DL>\r
-<P>\r
-In each directory, files with a <CODE>.xml</CODE> extension are the\r
-XML document test cases, and files with a <CODE>.ent</CODE> extension\r
-are external entities referenced by the test cases.\r
-<P>\r
-Within the <CODE>valid</CODE> directory, each of these three\r
-subdirectories has an <CODE>out</CODE> subdirectory which contains an\r
-equivalent <A HREF="canonxml.html">canonical XML</A> document for each\r
-of the cases.\r
-<P>\r
-<P>\r
-Bug reports and contributions of new test cases are welcome.\r
-<P>\r
-<ADDRESS>\r
-<A HREF="mailto:jjc@jclark.com">James Clark</A>\r
-</ADDRESS>\r
-</BODY>\r
-</HTML>\r
+<HTML>
+<TITLE>XML Test Cases</TITLE>
+<BODY>
+<H1>XML Test Cases version 1998-11-18</H1>
+<P>
+Copyright (C) 1998 James Clark. All rights reserved. Permission is
+granted to copy and modify this collection in any way for internal use
+within a company or organization. Permission is granted to
+redistribute the file <code>xmltest.zip</code> containing this
+collection to third parties provided that no modifications of any kind
+are made to this file. Note that permission to distribute the
+collection in any other form is not granted.
+<P>
+The collection is structured into three directories:
+<DL>
+<DT><CODE>not-wf</CODE>
+<DD>this contains cases that are not well-formed XML documents
+<DT><CODE>valid</CODE>
+<DD>this contains cases that are valid XML documents
+<DT><CODE>invalid</CODE>
+<DD>this contains cases that are well-formed XML documents
+but are not valid XML documents
+</DL>
+<P>
+The <CODE>not-wf</CODE> and <CODE>valid</CODE> directories each have
+three subdirectories:
+<DL>
+<DT>
+<CODE>sa</CODE>
+<DD>
+this contains cases that are standalone (as defined in XML) and do not
+have references to external general entities
+<DT>
+<CODE>ext-sa</CODE>
+<DD>
+this contains case that are standalone and have references to external
+general entities
+<DT>
+<CODE>not-sa</CODE>
+<DD>
+this contains cases that are not standalone
+</DL>
+<P>
+In each directory, files with a <CODE>.xml</CODE> extension are the
+XML document test cases, and files with a <CODE>.ent</CODE> extension
+are external entities referenced by the test cases.
+<P>
+Within the <CODE>valid</CODE> directory, each of these three
+subdirectories has an <CODE>out</CODE> subdirectory which contains an
+equivalent <A HREF="canonxml.html">canonical XML</A> document for each
+of the cases.
+<P>
+<P>
+Bug reports and contributions of new test cases are welcome.
+<P>
+<ADDRESS>
+<A HREF="mailto:jjc@jclark.com">James Clark</A>
+</ADDRESS>
+</BODY>
+</HTML>
[ blank? not ] skip-until ;
: next-matching ( pos ch str -- pos' )
- [ over ] dip nth eq? [ 1 + ] [ drop 0 ] if ; inline
+ overd nth eq? [ 1 + ] [ drop 0 ] if ; inline
: string-matcher ( str -- quot: ( pos char -- pos ? ) )
dup length 1 - '[ _ next-matching dup _ > ] ; inline
[ file-name ] dip
modes
[ nip [ 2dup ] dip suitable-mode? ] assoc-find
- 2drop [ 2drop ] dip ;
+ 2drop 2nip ;
: find-mode ( file-name first-line -- mode )
?find-mode "text" or ; inline
drop [ length ] keep over [
1 + (byte-array) [
[
- [ [ string-nth-fast ] 2keep drop ]
+ [ [ string-nth-fast ] keepd ]
[ set-nth-unsafe ] bi*
] 2curry each-integer
] keep
3drop f
] [
3dup nth-unsafe at*
- [ [ 3drop ] dip ] [ drop [ 1 - ] dip (assoc-stack) ] if
+ [ 3nip ] [ drop [ 1 - ] dip (assoc-stack) ] if
] if ; inline recursive
: search-alist ( key alist -- pair/f i/f )
over [ set-at ] with-assoc assoc-each ;
: assoc-union-as ( assoc1 assoc2 exemplar -- union )
- [ [ [ assoc-size ] bi@ + ] dip new-assoc ] 3keep drop
+ [ [ [ assoc-size ] bi@ + ] dip new-assoc ] 2keepd
[ assoc-union! ] bi@ ;
: assoc-union ( assoc1 assoc2 -- union )
swap slots>tuple ;
: check-slot-exists ( class initials slot-spec/f index/f name -- class initials slot-spec index )
- over [ drop ] [ nip nip nip bad-slot-name ] if ;
+ over [ drop ] [ 3nip bad-slot-name ] if ;
: slot-named-checked ( class initials name slots -- class initials slot-spec )
over [ slot-named* ] dip check-slot-exists drop ;
pick [
[ [ swap nth dup ] dip instance? ] dip swap
[ drop ] [ nip ] if
- ] [ [ 3drop ] dip ] if ;
+ ] [ 3nip ] if ;
: apply-slot-permutation ( old-values triples -- new-values )
[ first3 update-slot ] with map ;
f f effect boa ; inline
: <variable-effect> ( in-var in out-var out -- effect )
- swap [ rot ] dip [ ?terminated ] 2dip effect boa ;
+ swap rotd [ ?terminated ] 2dip effect boa ;
: effect-height ( effect -- n )
[ out>> length ] [ in>> length ] bi - ; inline
{ [ effect-closer? ] [ stack-effect-omits-dashes ] }
{ [ row-variable? ] [ parse-effect-var t ] }
[
- [ drop ] 2dip standalone-type?
+ nipd standalone-type?
[ parse-standalone-type ] [ parse-effect-value ] if , t
]
} cond ;
M: object check-combination-effect 2drop ;
: define-generic ( word combination effect -- )
- [ [ check-combination-effect ] keep swap set-stack-effect ]
+ [ [ check-combination-effect ] keep set-stack-effect ]
[
drop
2dup [ "combination" word-prop ] dip = [ 2drop ] [
[ set-nth-unsafe ] [ [ 1 fixnum+fast ] dip length<< ] 2bi ; inline
: push-all-unsafe ( from to src dst -- )
- [ over - swap ] 2dip [ pick ] dip [ length integer>fixnum ] keep
+ [ over - swap ] 2dip pickd [ length integer>fixnum ] keep
[ [ fixnum+fast ] dip length<< ] 2keep <copy> (copy) drop ; inline
PRIVATE>
[ pick or [ probe ] dip (new-key@) ]
if
] [
- [ [ pick ] dip = ] 2dip rot
+ [ pickd = ] 2dip rot
[ nip [ drop ] 3dip f ]
[ [ probe ] dip (new-key@) ]
if
M: hash-set members
[ array>> 0 swap ] [ cardinality f <array> ] bi [
- [ [ over ] dip set-nth-unsafe 1 + ] curry each-member
+ [ overd set-nth-unsafe 1 + ] curry each-member
] keep nip ;
M: hash-set clone
[ pick or [ probe ] dip (new-key@) ]
if
] [
- [ [ pick ] dip = ] 2dip rot
+ [ pickd = ] 2dip rot
[ nip [ drop ] 3dip f ]
[ [ probe ] dip (new-key@) ]
if
: collect-pairs ( hash quot: ( key value -- elt ) -- seq )
[ [ array>> 0 swap ] [ assoc-size f <array> ] bi ] dip swap [
- [ [ over ] dip set-nth-unsafe 1 + ] curry compose each-pair
+ [ overd set-nth-unsafe 1 + ] curry compose each-pair
] keep nip ; inline
PRIVATE>
{ string } declare ! aux>> must be f
[ length ] keep over (byte-array) [
[
- [ [ string-nth-fast ] 2keep drop ]
+ [ [ string-nth-fast ] keepd ]
[ set-nth-unsafe ] bi*
] 2curry each-integer
] keep ; inline
{ byte-array } declare
[ length ] keep over 0 <string> [
[
- [ [ nth-unsafe ] 2keep drop ]
+ [ [ nth-unsafe ] keepd ]
[
pick 127 <=
[ set-string-nth-fast ]
: (store-read) ( buf stream encoding n c i -- buf stream encoding n )
[ rot [ set-nth-unsafe ] keep ] 2curry 3dip ; inline
-: (finish-read) ( buf stream encoding n i -- i )
- 2nip 2nip ; inline
-
: (read-next) ( stream encoding n i -- stream encoding n i c )
[ 2dup decode-char ] 2dip rot ; inline
: (read-rest) ( buf stream encoding n i -- count )
- 2dup = [ (finish-read) ] [
+ 2dup = [ 4nip ] [
(read-next) [
swap [ (store-read) ] [ 1 + ] bi (read-rest)
- ] [ (finish-read) ] if*
+ ] [ 4nip ] if*
] if ; inline recursive
M: decoder stream-read-unsafe
dup CHAR: \n = [
2drop stream-read-until
] [
- [ 2drop ] 2dip
+ 2nipd
] if
] [
first-unsafe CHAR: \n = [ [ rest ] dip ] when
- [ 2drop ] 2dip
+ 2nipd
] if-empty
] [
>decoder< decode-until
drop char>utf16le ;
: ascii-char>utf16-byte-array ( off n byte-array string -- )
- [ over ] dip string-nth-fast -rot
+ overd string-nth-fast -rot
[ 2 fixnum*fast rot fixnum+fast ] dip
set-nth-unsafe ; inline
: ascii-string>utf16-byte-array ( off string -- byte-array )
[ length >fixnum [ <iota> ] [ 2 fixnum*fast <byte-array> ] bi ] keep
- [ [ ascii-char>utf16-byte-array ] 2curry with each ] 2keep drop ; inline
+ [ [ ascii-char>utf16-byte-array ] 2curry with each ] keepd ; inline
: ascii-string>utf16le ( string stream -- )
[ 0 swap ascii-string>utf16-byte-array ] dip stream-write ; inline
stream-exemplar new-sequence ; inline
: resize-if-necessary ( wanted-n got-n seq -- seq' )
- 2over = [ [ 2drop ] dip ] [ resize nip ] if ; inline
+ 2over = [ 2nip ] [ resize nip ] if ; inline
: (read-into-new) ( n stream quot -- seq/f )
[ dup ] 2dip
- [ 2dup (new-sequence-for-stream) swap ] dip curry keep
+ [ 2dup (new-sequence-for-stream) swap ] dip keepd
over 0 = [ 3drop f ] [ resize-if-necessary ] if ; inline
: (read-into) ( buf stream quot -- buf-slice/f )
: (each-stream-block-slice) ( ... stream quot: ( ... block-slice -- ... ) block-size -- ... )
[ [ drop ] prepose swap ] dip
- [ swap (new-sequence-for-stream) ] curry keep
+ [ swap (new-sequence-for-stream) ] keepd
[ stream-read-partial-into ] 2curry each-morsel drop ; inline
: each-stream-block-slice ( ... stream quot: ( ... block-slice -- ... ) -- ... )
: (stream-contents-by-length) ( stream len -- seq )
dup rot
[ (new-sequence-for-stream) ]
- [ [ stream-read-unsafe ] curry keep resize ] bi ; inline
+ [ [ stream-read-unsafe ] keepd resize ] bi ; inline
: (stream-contents-by-block) ( stream -- seq )
[ [ ] collector [ each-stream-block ] dip { } like ]
<PRIVATE
: read-loop ( buf stream n i -- count )
- 2dup = [ nip nip nip ] [
+ 2dup = [ 3nip ] [
pick stream-read1 [
over [ pick set-nth-unsafe ] 2curry 3dip
1 + read-loop
- ] [ nip nip nip ] if*
+ ] [ 3nip ] if*
] if ; inline recursive
: finalize-read-until ( seq sep/f -- seq/f sep/f )
512 <byte-vector> swap <encoder> ; inline
: with-byte-writer ( encoding quot -- byte-array )
- [ <byte-writer> ] dip [ with-output-stream* ] 2keep drop
+ [ <byte-writer> ] dip [ with-output-stream* ] keepd
dup encoder? [ stream>> ] when >byte-array ; inline
TUPLE: byte-reader { underlying byte-array read-only } { i array-capacity } ;
: read-until-loop ( handle seps accum -- accum ch )
pick fgetc dup [
pick dupd member-eq?
- [ [ 2drop ] 2dip ] [ suffix! read-until-loop ] if
+ [ 2nipd ] [ suffix! read-until-loop ] if
] [
- [ 2drop ] 2dip
+ 2nipd
] if ; inline recursive
M: c-reader stream-read-until
[ integer>fixnum ]
[ dup slice? [ [ seq>> ] [ from>> ] bi ] [ 0 ] if ]
[
- swap over stream-element-type +byte+ eq?
+ tuck stream-element-type +byte+ eq?
[ check-byte-array sequence-copy-unsafe ]
[ check-string sequence-copy-unsafe ] if
] tri* ; inline
HELP: pick $shuffle ;
HELP: swap $shuffle ;
+HELP: roll $complex-shuffle ;
+HELP: -roll $complex-shuffle ;
+HELP: tuck $complex-shuffle ;
HELP: rot $complex-shuffle ;
HELP: -rot $complex-shuffle ;
HELP: dupd $complex-shuffle ;
! Regression
: (loop) ( a b c d -- )
- [ pick ] dip swap [ pick ] dip swap
+ pickd swap pickd swap
< [ [ 1 + ] 3dip (loop) ] [ 4drop ] if ; inline recursive
: loop ( obj -- )
{ 1 2 3 1 2 3 } [ 1 2 3 3dup ] unit-test
{ 1 2 3 4 1 2 3 4 } [ 1 2 3 4 4dup ] unit-test
+
+{ 2 3 4 1 } [ 1 2 3 4 roll ] unit-test
+{ 1 2 3 4 } [ 2 3 4 1 -roll ] unit-test
: 4dip ( w x y z quot -- w x y z ) swap [ 3dip ] dip ; inline
+! Misfits
+: tuck ( x y -- y x y ) dup -rot ; inline
+
+: spin ( x y z -- z y x ) -rot swap ; inline
+
+: rotd ( w x y z -- x y w z ) [ rot ] dip ; inline
+
+: -rotd ( w x y z -- w z x y ) [ -rot ] dip ; inline
+
+: roll ( w x y z -- x y z w ) rotd swap ; inline
+
+: -roll ( w x y z -- z w x y ) swap -rotd ; inline
+
+: nipd ( x y z -- y z ) [ nip ] dip ; inline
+
+: overd ( x y z -- x y x z ) [ over ] dip ; inline
+
+: pickd ( w x y z -- w x y w z ) [ pick ] dip ; inline
+
+: 2nipd ( w x y z -- y z ) [ 2drop ] 2dip ; inline
+
+: 3nipd ( v w x y z -- y z ) [ 3drop ] 2dip ; inline
+
+: 3nip ( w x y z -- z ) 2nip nip ; inline
+
+: 4nip ( v w x y z -- z ) 2nip 2nip ; inline
+
+: 5nip ( u v w x y z -- z ) 3nip 2nip ; inline
+
+: 5drop ( v w x y z -- ) 4drop drop ; inline
+
+: reach ( w x y z -- w x y z w ) [ pick ] dip swap ; inline
+
! Keepers
: keep ( ..a x quot: ( ..a x -- ..b ) -- ..b x )
over [ call ] dip ; inline
: 4keep ( ..a w x y z quot: ( ..a w x y z -- ..b ) -- ..b w x y z )
[ 4dup ] dip 4dip ; inline
+: keepd ( ..a x y quot: ( ..a x y -- ..b x ) -- ..b x )
+ 2keep drop ; inline
+
+: keepdd ( ..a x y z quot: ( ..a x y z -- ..b x ) -- ..b x )
+ 3keep 2drop ; inline
+
+: 2keepd ( ..a x y z quot: ( ..a x y z -- ..b x y ) -- ..b x y )
+ 3keep drop ; inline
+
! Cleavers
: bi ( x p q -- )
[ keep ] dip call ; inline
: align ( m w -- n )
1 - [ + ] keep bitnot bitand ; inline
-<PRIVATE
-
-: iterate-prep ( n quot -- i n quot ) [ 0 ] 2dip ; inline
-
-: if-iterate? ( i n true false -- ) [ 2over < ] 2dip if ; inline
-
-: iterate-step ( i n quot -- i n quot )
- ! Apply quot to i, keep i and quot, hide n.
- [ nip call ] 3keep ; inline
-
-: iterate-rot ( ? i n quot -- i n quot ? )
- [ rot ] dip swap ; inline
-
-: iterate-next ( i n quot -- i' n quot ) [ 1 + ] 2dip ; inline
-
-PRIVATE>
-
: (each-integer) ( ... i n quot: ( ... i -- ... ) -- ... )
- [ iterate-step iterate-next (each-integer) ]
- [ 3drop ] if-iterate? ; inline recursive
+ 2over < [
+ [ nip call ] 3keep
+ [ 1 + ] 2dip (each-integer)
+ ] [
+ 3drop
+ ] if ; inline recursive
: (find-integer) ( ... i n quot: ( ... i -- ... ? ) -- ... i/f )
- [
- iterate-step iterate-rot
- [ 2drop ] [ iterate-next (find-integer) ] if
- ] [ 3drop f ] if-iterate? ; inline recursive
+ 2over < [
+ [ nip call ] 3keep roll
+ [ 2drop ]
+ [ [ 1 + ] 2dip (find-integer) ] if
+ ] [
+ 3drop f
+ ] if ; inline recursive
: (all-integers?) ( ... i n quot: ( ... i -- ... ? ) -- ... ? )
- [
- iterate-step iterate-rot
- [ iterate-next (all-integers?) ] [ 3drop f ] if
- ] [ 3drop t ] if-iterate? ; inline recursive
+ 2over < [
+ [ nip call ] 3keep roll
+ [ [ 1 + ] 2dip (all-integers?) ]
+ [ 3drop f ] if
+ ] [
+ 3drop t
+ ] if ; inline recursive
: each-integer ( ... n quot: ( ... i -- ... ) -- ... )
- iterate-prep (each-integer) ; inline
+ [ 0 ] 2dip (each-integer) ; inline
: times ( ... n quot: ( ... -- ... ) -- ... )
[ drop ] prepose each-integer ; inline
: find-integer ( ... n quot: ( ... i -- ... ? ) -- ... i/f )
- iterate-prep (find-integer) ; inline
+ [ 0 ] 2dip (find-integer) ; inline
: all-integers? ( ... n quot: ( ... i -- ... ? ) -- ... ? )
- iterate-prep (all-integers?) ; inline
+ [ 0 ] 2dip (all-integers?) ; inline
: find-last-integer ( ... n quot: ( ... i -- ... ? ) -- ... i/f )
over 0 < [
{ [ dup "bB" member-eq? ] [ 2drop 2 ->radix require-next-digit ] }
{ [ dup "oO" member-eq? ] [ 2drop 8 ->radix require-next-digit ] }
{ [ dup "xX" member-eq? ] [ 2drop 16 ->radix require-next-digit ] }
- [ [ drop ] 2dip swap call ]
+ [ nipd swap call ]
} cond
] 2curry next-digit ; inline
M: sequence set-nth-unsafe set-nth ; inline
: change-nth-unsafe ( i seq quot -- )
- [ [ nth-unsafe ] dip call ] 3keep drop set-nth-unsafe ; inline
+ [ [ nth-unsafe ] dip call ] 2keepd set-nth-unsafe ; inline
PRIVATE>
: glue ( seq1 seq2 seq3 -- newseq ) swap 3append ; inline
: change-nth ( ..a i seq quot: ( ..a elt -- ..b newelt ) -- ..b )
- [ [ nth ] dip call ] 3keep drop set-nth-unsafe ; inline
+ [ [ nth ] dip call ] 2keepd set-nth-unsafe ; inline
: min-length ( seq1 seq2 -- n ) [ length ] bi@ min ; inline
if ; inline
: (accumulate) ( seq identity quot -- identity seq quot )
- swapd [ curry keep ] curry ; inline
+ swapd [ keepd ] curry ; inline
: (accumulate*) ( seq identity quot -- identity seq quot )
swapd [ dup ] compose ; inline
swapd each ; inline
: map-integers ( ... len quot: ( ... i -- ... elt ) exemplar -- ... newseq )
- [ over ] dip [ [ collect ] keep ] new-like ; inline
+ overd [ [ collect ] keep ] new-like ; inline
: map-as ( ... seq quot: ( ... elt -- ... newelt ) exemplar -- ... newseq )
[ (each) ] dip map-integers ; inline
[ (2each) ] dip -rot (each-integer) ; inline
: 2reduce ( ... seq1 seq2 identity quot: ( ... prev elt1 elt2 -- ... next ) -- ... result )
- [ -rot ] dip 2each ; inline
+ -rotd 2each ; inline
: 2map-as ( ... seq1 seq2 quot: ( ... elt1 elt2 -- ... newelt ) exemplar -- ... newseq )
[ (2each) ] dip map-integers ; inline
[ (3each) ] dip map-integers ; inline
: 3map ( ... seq1 seq2 seq3 quot: ( ... elt1 elt2 elt3 -- ... newelt ) -- ... newseq )
- [ pick ] dip swap 3map-as ; inline
+ pickd swap 3map-as ; inline
: find-from ( ... n seq quot: ( ... elt -- ... ? ) -- ... i elt )
[ (find-integer) ] (find-from) ; inline
2over = [
4drop
] [
- [ [ pick [ dup dup ] dip + swap ] dip move-unsafe 1 - ] keep
+ [ [ [ ] [ nip + ] [ 2nip ] 3tri ] dip move-unsafe 1 - ] keep
move-forward
] if ;
pick 0 = [
3drop
] [
- pick over length + over
+ [ ] [ nip length + ] [ 2nip ] 3tri
[ pick 0 > [ [ length ] keep ] dip (open-slice) ] 2dip
set-length
] if ;
[ keep swap ] curry [ [ first ] dip call ] 2keep
[ curry 2dip pick over ] curry
] [
- [ [ 2drop ] [ [ 2drop ] 2dip ] if ] compose
+ [ [ 2drop ] [ 2nipd ] if ] compose
] bi* compose 1 each-from drop ; inline
PRIVATE>
{ [ pinned-alien bootstrap-word over class<= ] [ <bad-alien> t ] }
{ [ quotation bootstrap-word over class<= ] [ [ ] t ] }
[ dup initial-value* ]
- } cond [ drop ] 2dip ;
+ } cond nipd ;
GENERIC: make-slot ( desc -- slot-spec )
M: string equal?
over string? [
- 2dup [ hashcode ] bi@ eq?
+ ! faster during bootstrap than ``[ hashcode ] bi@``
+ over hashcode over hashcode eq?
[ sequence= ] [ 2drop f ] if
] [
2drop f
[ changed-effects get add-to-unit ]
[ dup primitive? [ drop ] [ changed-definition ] if ] bi ;
-: set-stack-effect ( effect word -- )
- 2dup "declared-effect" word-prop = [ 2drop ] [
- [ nip changed-effect ]
- [ nip subwords [ changed-effect ] each ]
- [ swap "declared-effect" set-word-prop ]
+: set-stack-effect ( word effect -- )
+ 2dup [ "declared-effect" word-prop ] dip =
+ [ 2drop ] [
+ [ drop changed-effect ]
+ [ drop subwords [ changed-effect ] each ]
+ [ "declared-effect" set-word-prop ]
2tri
] if ;
: define-declared ( word def effect -- )
- [ nip swap set-stack-effect ] [ drop define ] 3bi ;
+ [ nip set-stack-effect ] [ drop define ] 3bi ;
: make-deprecated ( word -- )
t "deprecated" set-word-prop ;
] tri ;
: <word> ( name vocab -- word )
- 2dup [ hashcode ] bi@ hash-combine >fixnum (word) dup new-word ;
+ over hashcode over hashcode hash-combine >fixnum (word) dup new-word ;
: <uninterned-word> ( name -- word )
f \ <uninterned-word> counter >fixnum (word)
: ((fortran-invoke)) ( return library function parameters -- quot )
{
[ 2nip [<fortran-result>] ]
- [ nip nip nip [fortran-args>c-args] ]
+ [ 3nip [fortran-args>c-args] ]
[ [fortran-invoke] ]
[ 2nip [fortran-results>] ]
} 4 ncleave 4 nappend ;
] if ;
: kv-with ( obj assoc quot -- assoc curried )
- swapd [ [ -rot ] dip call ] 2curry ; inline
+ swapd [ -rotd call ] 2curry ; inline
<PRIVATE
PRIVATE>
: sequence>assoc! ( assoc seq map-quot: ( x -- ..y ) insert-quot: ( ..y assoc -- ) -- assoc )
- 4 nrot (sequence>assoc) ; inline
+ roll (sequence>assoc) ; inline
: assoc>object ( assoc map-quot insert-quot exemplar -- object )
clone [ swap curry compose assoc-each ] keep ; inline
: assoc>object! ( assoc seq map-quot: ( x -- ..y ) insert-quot: ( ..y assoc -- ) -- object )
- 4 nrot assoc>object ; inline
+ roll assoc>object ; inline
: sequence>assoc ( seq map-quot insert-quot exemplar -- assoc )
clone (sequence>assoc) ; inline
: relevant-indices ( object bloom-filter -- n quot: ( elt -- n ) )
[ double-hashcodes ] [ #hashes-and-length ] bi*
- [ -rot ] dip '[ _ _ combine-hashcodes _ mod ] ; inline
+ -rotd '[ _ _ combine-hashcodes _ mod ] ; inline
PRIVATE>
dup output>> [
dup state>> [
over output-size>> [ <byte-array> ] keep
- [ crypto_generichash_final check0 ] 2keep drop
+ [ crypto_generichash_final check0 ] keepd
] [ B{ } clone ] if*
[ >>output ] keep
] unless* nip ;
: 4tri ( w x y z p q r -- )
[ [ 4keep ] dip 4keep ] dip call ; inline
-: keepd ( ..a x y quot: ( ..a x y -- ..b ) -- ..b x )
- 2keep drop ; inline
-
: plox ( ... x/f quot: ( ... x -- ... ) -- ... )
dupd when ; inline
! try the quot, keep the original arg if quot is true
: ?1arg ( obj quot: ( obj -- ? ) -- obj/f )
- [ ?1res ] 2keep drop '[ _ ] [ f ] if ; inline
+ [ ?1res ] keepd '[ _ ] [ f ] if ; inline
: ?2arg ( obj1 obj2 quot: ( obj1 obj2 -- ? ) -- obj1/f obj2/f )
- [ ?2res ] 3keep drop '[ _ _ ] [ f f ] if ; inline
+ [ ?2res ] 2keepd '[ _ _ ] [ f f ] if ; inline
<<
: alist>quot* ( default assoc -- quot )
: rewrite-gather-vector-4 ( insn -- insn/f )
dup { [ src1>> ] [ src2>> ] [ src3>> ] [ src4>> ] } cleave [ vreg>insn ] 4 napply
{
- { [ 4 ndup [ literal-insn? ] 4 napply and and and ] [ fold-gather-vector-4 ] }
- [ 5 ndrop f ]
+ { [ 4dup [ literal-insn? ] 4 napply and and and ] [ fold-gather-vector-4 ] }
+ [ 5drop f ]
} cond ;
M: ##gather-vector-4 rewrite rewrite-gather-vector-4 ;
224 [
32 [
over 32 * over + 0x2400 + ! cpu h w addr
- [ pick ] dip swap ram>> nth [
+ reach ram>> nth [
[
" 0 0 0" write
] [
: first-diag ( c0 c1 c2 c3 -- a0 a1 a2 a3 )
{ [ gb3 ] [ gb2 ] [ gb1 ] [ gb0 ] } spread ;
-: (4rot) ( c0 c1 c2 c3 -- c1 c2 c3 c0 ) 4 nrot ; inline
-: second-diag ( c0 c1 c2 c3 -- a0 a1 a2 a3 ) (4rot) first-diag ;
-: third-diag ( c0 c1 c2 c3 -- a0 a1 a2 a3 ) (4rot) second-diag ;
-: fourth-diag ( c0 c1 c2 c3 -- a0 a1 a2 a3 ) (4rot) third-diag ;
+: second-diag ( c0 c1 c2 c3 -- a0 a1 a2 a3 ) roll first-diag ;
+: third-diag ( c0 c1 c2 c3 -- a0 a1 a2 a3 ) roll second-diag ;
+: fourth-diag ( c0 c1 c2 c3 -- a0 a1 a2 a3 ) roll third-diag ;
! given 4 columns, output the first reverse diagonal, i.e.
! C[0,0] C[3,1] C[2,2] C[1,3]
-:: (-rev) ( c0 c1 c2 c3 -- c0 c3 c2 c1 ) c0 c3 c2 c1 ; inline
-: -first-diag ( c0 c1 c2 c3 -- a0 a1 a2 a3 ) (-rev) first-diag ;
-: -second-diag ( c0 c1 c2 c3 -- a0 a1 a2 a3 ) (-rev) (4rot) first-diag ;
-: -third-diag ( c0 c1 c2 c3 -- a0 a1 a2 a3 ) (-rev) (4rot) second-diag ;
-: -fourth-diag ( c0 c1 c2 c3 -- a0 a1 a2 a3 ) (-rev) (4rot) third-diag ;
+: -first-diag ( c0 c1 c2 c3 -- a0 a1 a2 a3 ) spin first-diag ;
+: -second-diag ( c0 c1 c2 c3 -- a0 a1 a2 a3 ) spin roll first-diag ;
+: -third-diag ( c0 c1 c2 c3 -- a0 a1 a2 a3 ) spin roll second-diag ;
+: -fourth-diag ( c0 c1 c2 c3 -- a0 a1 a2 a3 ) spin roll third-diag ;
:: set-first4-unsafe ( seq a0 a1 a2 a3 -- )
a0 0 seq set-nth-unsafe
: cuda-device-properties ( n -- properties )
[ CUdevprop <struct> ] dip
- [ cuDeviceGetProperties cuda-error ] 2keep drop ;
+ [ cuDeviceGetProperties cuda-error ] keepd ;
: cuda-devices ( -- assoc )
enumerate-cuda-devices [ dup cuda-device-properties ] { } map>assoc ;
!
: -with- ( invariant begin end quot -- begin end quot' )
- [ rot ] dip '[ [ _ ] dip @ ] ; inline
+ rotd '[ [ _ ] dip @ ] ; inline
: -2with- ( invariant invariant begin end quot -- begin end quot' )
-with- -with- ; inline
[ face-ccw ] keep [ vertex-pos ] bi@ v- ;
: normal ( v0 v1 v2 -- v )
- [ drop v- ] [ [ drop ] 2dip v- ] 3bi cross ;
+ [ drop v- ] [ nipd v- ] 3bi cross ;
ERROR: all-points-colinear ;
<texture-2d>
]
[
- 0 swap [ allocate-texture-image ] 3keep 2drop
+ 0 swap [ allocate-texture-image ] keepdd
] bi ;
SYMBOL: fluid
[ "float_array" x/ xt string>numbers [ * ] with map ]
[ nip "technique_common" x/ "accessor" x/ "stride" x@ string>number ] 2bi
group
- [ swap over length 2 > [ >y-up-axis! ] [ drop ] if ] with map ;
+ [ tuck length 2 > [ >y-up-axis! ] [ drop ] if ] with map ;
: source>pair ( source-tag -- pair )
[ "id" x@ ]
: gml-scalar-op ( a b scalar-quot mixed-quot vector-quot -- c )
{
- { [ 4 npick float? ] [ 2drop call ] }
- { [ 4 npick integer? ] [ 2drop call ] }
- { [ 4 npick vec2d? ] [ drop nip [ scalar>vec2d ] 2dip call ] }
- { [ 4 npick vec3d? ] [ drop nip [ scalar>vec3d ] 2dip call ] }
+ { [ reach float? ] [ 2drop call ] }
+ { [ reach integer? ] [ 2drop call ] }
+ { [ reach vec2d? ] [ drop nip [ scalar>vec2d ] 2dip call ] }
+ { [ reach vec3d? ] [ drop nip [ scalar>vec3d ] 2dip call ] }
} cond ; inline
: gml-math-op ( a b scalar-quot mixed-quot vector-quot -- c )
{ [ 5 npick integer? ] [ gml-scalar-op ] }
{ [ 5 npick vec2d? ] [
{
- { [ 4 npick vec2d? ] [ 2nip call ] }
- { [ 4 npick float? ] [ drop nip [ scalar>vec2d ] dip call ] }
- { [ 4 npick integer? ] [ drop nip [ scalar>vec2d ] dip call ] }
+ { [ reach vec2d? ] [ 2nip call ] }
+ { [ reach float? ] [ drop nip [ scalar>vec2d ] dip call ] }
+ { [ reach integer? ] [ drop nip [ scalar>vec2d ] dip call ] }
} cond
] }
{ [ 5 npick vec3d? ] [
{
- { [ 4 npick vec3d? ] [ 2nip call ] }
- { [ 4 npick float? ] [ drop nip [ scalar>vec3d ] dip call ] }
- { [ 4 npick integer? ] [ drop nip [ scalar>vec3d ] dip call ] }
+ { [ reach vec3d? ] [ 2nip call ] }
+ { [ reach float? ] [ drop nip [ scalar>vec3d ] dip call ] }
+ { [ reach integer? ] [ drop nip [ scalar>vec3d ] dip call ] }
} cond
] }
} cond ; inline
: bind-output-attachments ( program-instance framebuffer attachments -- )
dup first sequence?
- [ bind-named-output-attachments ] [ [ drop ] 2dip bind-unnamed-output-attachments ] if ;
+ [ bind-named-output-attachments ] [ nipd bind-unnamed-output-attachments ] if ;
GENERIC: bind-transform-feedback-output ( output -- )
IN: html.parser.utils
: trim1 ( seq ch -- newseq )
- [ [ ?head-slice drop ] [ ?tail-slice drop ] bi ] 2keep drop like ;
+ [ [ ?head-slice drop ] [ ?tail-slice drop ] bi ] keepd like ;
: single-quote ( str -- newstr ) "'" dup surround ;
! Date, month, year.
"-" read-token checked-number
"-" read-token month-abbreviations index 1 +
- read-sp checked-number -rot swap
+ read-sp checked-number spin
! Hour, minute second and gmt offset.
read-hms " " expect readln parse-rfc822-gmt-offset <timestamp>
] with-string-reader ;
to-directory safe-file-name
] [
"info" append-path [ make-user-directory ] keep
- to-directory ".trashinfo" append [ over ] dip utf8 [
+ to-directory ".trashinfo" append overd utf8 [
"[Trash Info]" write nl
"Path=" write write nl
"DeletionDate=" write
[ irc-message ] dip define-tuple-class ;
: define-irc-parameter-slots ( class params -- )
- { ":" } split1 [ over ] dip
+ { ":" } split1 overd
[ ?define-irc-parameters ] [ ?define-irc-trailing ] 2bi* ;
PRIVATE>
f f 0 default-speed player boa ;
: turn-player ( player x-radians y-radians -- )
- [ over ] dip left-pivot up-pivot ;
+ overd left-pivot up-pivot ;
: roll-player ( player z-radians -- )
forward-pivot ;
[ magic>> ] dip [ >byte-array ] bi@ check-magic ;
: make-string ( string-table i -- str )
- 0 rot swapd [ index-from ] 2keep swapd subseq
+ 0 spin [ index-from ] 2keep swapd subseq
native-string-encoding decode ;
: string-offset ( header-new -- n )
{ over [ dup swap ] }
{ swapd [ [ swap ] dip ] }
{ 2nip [ nip nip ] }
+ { 3nip [ 2nip nip ] }
+ { 4nip [ 3nip nip ] }
{ 2drop [ drop drop ] }
{ 3drop [ drop drop drop ] }
{ pop* [ pop drop ] }
[
{
[ length 4 <= ]
- [ first { drop 2drop 3drop nip 2nip } member? ]
+ [ first { drop 2drop 3drop nip 2nip 3nip 4nip } member? ]
[ rest-slice [ boolean? ] all? ]
} 1&&
]
while drop swap and ; inline
: reduce-permutation-bits ( ... bit-count bits identity quot: ( ... prev elt -- ... next ) -- ... result )
- [ -rot ] dip each-permutation-bits ; inline
+ -rotd each-permutation-bits ; inline
MACRO: duals>nweave ( n -- quot )
dup dup dup
'[
- [ [ epsilon-part>> ] _ napply ]
- _ nkeep
- [ ordinary-part>> ] _ napply
- _ nweave
+ [ [ epsilon-part>> ] _ napply ] _ nkeep
+ [ ordinary-part>> ] _ napply _ nweave
] ;
MACRO: chain-rule ( word -- e )
tri
'[ [ @ _ @ ] sum-outputs ] ;
-: set-dual-help ( word dword -- )
- [ swap
- [ stack-effect [ in>> ] [ out>> ] bi append
+: set-dual-help ( dword word -- )
+ [
+ [
+ stack-effect [ in>> ] [ out>> ] bi append
[ dual ] { } map>assoc { $values } prepend
- ]
- [ [ { $description } % "Version of " ,
- { $link } swap suffix ,
- " extended to work on dual numbers." , ]
- { } make
- ]
- bi* 2array
- ] keep set-word-help ;
+ ] [
+ [
+ { $description } % "Version of " ,
+ { $link } swap suffix ,
+ " extended to work on dual numbers." ,
+ ] { } make
+ ] bi* 2array
+ ] keepd set-word-help ;
PRIVATE>
'[ _ @ @ <dual> ] ;
: define-dual ( word -- )
- dup name>> "d" prepend "math.dual" create-word
- [ [ stack-effect ] dip set-stack-effect ]
+ [ name>> "d" prepend "math.dual" create-word ] keep
+ [ stack-effect set-stack-effect ]
[ set-dual-help ]
- [ swap '[ _ dual-op ] define ]
+ [ '[ _ dual-op ] define ]
2tri ;
! Specialize math functions to operate on dual numbers.
[ all-words [ "derivative" word-prop ] filter
- [ define-dual ] each ] with-compilation-unit
+[ define-dual ] each ] with-compilation-unit
: weighted-cosine-similarity ( w a b -- n )
[ weighted-v. ]
- [ [ over ] dip [ weighted-norm ] 2bi@ * ] 3bi / ;
+ [ overd [ weighted-norm ] 2bi@ * ] 3bi / ;
binary <byte-reader> <peek-stream> [
f [
peek1 [ read-event-header ] [ f f ] if dup
- ] [ read-event ] produce 2nip nip
+ ] [ read-event ] produce 3nip
] with-input-stream ;
: <midi-header> ( bytes -- header )
<texture-2d>
]
[
- 0 swap [ allocate-texture-image ] 3keep 2drop
+ 0 swap [ allocate-texture-image ] keepdd
] bi ;
: <model-buffers> ( models -- buffers )
[
{
{ "primitive-mode" [ 3drop triangles-mode ] }
- { "uniforms" [ nip nip ] }
- { "vertex-array" [ drop drop ] }
+ { "uniforms" [ 2nip ] }
+ { "vertex-array" [ 2drop ] }
{ "indexes" [ drop nip ] }
} 3<render-set> render
] 3each ;
: write-field? ( tuple key value -- ? )
pick mdb-persistent? [
- { [ [ 2drop ] dip not ]
+ { [ 2nip not ]
[ drop transient-slot? ] } 3|| not ] [ 3drop t ] if ; inline
TUPLE: cond-value value quot ;
[ "multi-method-generic" word-prop ] bi prefix ;
: define-generic ( word effect -- )
- over set-stack-effect
+ [ set-stack-effect ] keepd
dup "multi-methods" word-prop [ drop ] [
[ H{ } clone "multi-methods" set-word-prop ]
[ update-generic ]
DEFER: fake
\ fake H{ } clone "multi-methods" set-word-prop
-<< ( -- ) \ fake set-stack-effect >>
+<< \ fake ( -- ) set-stack-effect >>
[
[ "fake-{ }" ] [ { } \ fake method-word-name ] unit-test
! XXX doesn't work when v is nan or |v| >= 2^31
: floor-vector ( v -- v' )
[ float-4 int-4 vconvert int-4 float-4 vconvert ]
- [ [ v> -1.0 float-4-with vand ] curry keep v+ ] bi ; inline
+ [ [ v> -1.0 float-4-with vand ] keepd v+ ] bi ; inline
: unit-cubed ( floats -- ints )
float-4 int-4 vconvert 255 int-4-with vbitand ; inline
: create-buffer-from-wav ( filename -- buffer )
gen-buffer dup rot load-wav-file
- [ alBufferData ] 4 nkeep alutUnloadWAV ;
+ [ alBufferData ] 4keep alutUnloadWAV ;
: check-error ( -- )
alGetError dup ALUT_ERROR_NO_ERROR = [
M: macosx load-wav-file ( path -- format data size frequency )
0 int <ref> f void* <ref> 0 int <ref> 0 int <ref>
- [ alutLoadWAVFile ] 4 nkeep
+ [ alutLoadWAVFile ] 4keep
[ [ [ int deref ] dip void* deref ] dip int deref ] dip int deref ;
f void* <ref>
0 int <ref>
0 int <ref>
- [ 0 char <ref> alutLoadWAVFile ] 4 nkeep
+ [ 0 char <ref> alutLoadWAVFile ] 4keep
{ [ int deref ] [ void* deref ] [ int deref ] [ int deref ] } spread ;
dup f = [ cl-error ] [ drop ] if ; inline
: info-data-size ( handle name info-quot -- size_t )
- [ 0 f 0 size_t <ref> ] dip [ call cl-success ] 2keep drop size_t deref ; inline
+ [ 0 f 0 size_t <ref> ] dip
+ [ call cl-success ] keepd size_t deref ; inline
: info-data-bytes ( handle name info-quot size -- bytes )
- swap [ dup <byte-array> f ] dip [ call cl-success ] 3keep 2drop ; inline
+ swap [ dup <byte-array> f ] dip [ call cl-success ] keepdd ; inline
: info ( handle name info-quot lift-quot -- value )
[ 3dup info-data-size info-data-bytes ] dip call ; inline
: 2info-data-size ( handle1 handle2 name info-quot -- size_t )
- [ 0 f 0 size_t <ref> ] dip [ call cl-success ] 2keep drop size_t deref ; inline
+ [ 0 f 0 size_t <ref> ] dip
+ [ call cl-success ] keepd size_t deref ; inline
: 2info-data-bytes ( handle1 handle2 name info-quot size -- bytes )
- swap [ dup <byte-array> f ] dip [ call cl-success ] 3keep 2drop ; inline
+ swap [ dup <byte-array> f ] dip [ call cl-success ] keepdd ; inline
: 2info ( handle1 handle2 name info_quot lift_quot -- value )
[ 4dup 2info-data-size 2info-data-bytes ] dip call ; inline
: <cl-buffer> ( buffer-access-mode size initial-data -- buffer )
[ (current-cl-context) ] 3dip
- swap over [
+ tuck [
[ handle>> ]
[ buffer-access-constant ]
[ [ CL_MEM_COPY_HOST_PTR ] [ CL_MEM_ALLOC_HOST_PTR ] if ] tri* bitor
[ near-plane ] [ far-plane ] [ fov-ratio ] tri [
nip swap FOV / v*n
first2 [ -+ ] bi@
- ] 3keep drop ;
+ ] 2keepd ;
M: demo-world resize-world
GL_PROJECTION glMatrixMode
over first2 glVertex2d
dup first pick second glVertex2d
dup first2 glVertex2d
- swap first swap second glVertex2d
+ [ first ] [ second ] bi* glVertex2d
] do-state ;
demo-world H{
dup pair-generic-definition define ;
: define-pair-generic ( word effect -- )
- [ swap set-stack-effect ]
+ [ set-stack-effect ]
[ drop H{ } clone "pair-generic-methods" set-word-prop ]
[ drop make-pair-generic ] 2tri ;
0 { c-string } [ pcre_study ] with-out-parameters drop ;
: exec ( pcre extra subject ofs opts -- count match-data )
- [ dup length ] 2dip 30 int <c-array> 30 [ pcre_exec ] 2keep drop ;
+ [ dup length ] 2dip 30 int <c-array> 30 [ pcre_exec ] keepd;
TUPLE: matcher pcre extra subject ofs exec-opts ;
[
[ dup 0 > pick avail-lines 0 > and ] [
over avail-width over min [ - ] keep [
- [ over ] dip [ draw-line ] [ inc-x ] 2bi
+ overd [ draw-line ] [ inc-x ] 2bi
] unless-zero dup 0 > [ over line-break ] when
] while
] change-width nip dup width>> 0 > [ drop f ] unless ;
! -------------------
: fib-upto* ( n -- seq )
- 0 1 [ pick over >= ] [ [ nip ] 2keep + dup ] produce [ 3drop ] dip
+ 0 1 [ pick over >= ] [ [ nip ] 2keep + dup ] produce 3nip
but-last-slice { 0 1 } prepend ;
: euler002a ( -- answer )
] { } make natural-sort ;
: (ptriplet) ( target p q triplet -- target p q )
- sum [ pick ] dip = [ next-pq 2dup abc (ptriplet) ] unless ;
+ sum pickd = [ next-pq 2dup abc (ptriplet) ] unless ;
: ptriplet ( target -- triplet )
3 1 { 3 4 5 } (ptriplet) abc nip ;
! Callbacks
: quot>py-callback ( quot: ( args kw -- ret ) -- alien )
'[
- [ nip ] dip
+ nipd
[ [ py> ] [ { } ] if* ] bi@ @ >py
] PyCallback ; inline
TUPLE: bull ;
: <bull> ( -- bull ) bull new ;
-: inc-bulls ( score -- score ) dup bulls>> 1 + >>bulls ;
-: inc-cows ( score -- score ) dup cows>> 1 + >>cows ;
+: inc-bulls ( score -- score ) [ 1 + ] change-bulls ;
+: inc-cows ( score -- score ) [ 1 + ] change-cows ;
: random-nums ( -- seq ) 9 [1,b] 4 sample ;
: sum-score ( n g -- score ? )
'[ _ cow-or-bull ] map sift add-to-score dup check-win ;
-: print-sum ( score -- str )
- dup bulls>> number>string "Bulls: " swap append swap cows>> number>string
- " Cows: " swap 3append "\n" append ;
+: score-to-answer ( score -- str )
+ [ bulls>> number>string "Bulls: " prepend ]
+ [ cows>> number>string " Cows: " prepend ] bi "\n" glue ;
-: (validate-readln) ( str -- ? ) dup length 4 = not swap [ letter? ] all? or ;
+: (validate-readln) ( str -- ? )
+ [ length 4 = not ]
+ [ [ letter? ] all? ] bi or ;
: validate-readln ( -- str )
readln dup (validate-readln)
- [ "Invalid input.\nPlease enter a valid 4 digit number: "
- write flush drop validate-readln ]
- when ;
+ [
+ "Invalid input.\nPlease enter a valid 4 digit number: "
+ write flush drop validate-readln
+ ] when ;
-: win ( -- ) "\nYou've won! Good job. You're so smart." print flush ;
+: win ( -- ) "You've won! Good job. You're so smart." print flush ;
: main-loop ( x -- )
"Enter a 4 digit number: " write flush validate-readln num>hash swap
- [ sum-score swap print-sum print flush ] keep swap not
+ [ sum-score swap score-to-answer print flush ] keep swap not
[ main-loop ] [ drop win ] if ;
: bulls-and-cows-main ( -- ) new-number drop narr>nhash main-loop ;
: lincomb ( a b x -- w )
3dup [ last ] tri@
[ - ] curry bi@
- [ drop ] 2dip
+ nipd
neg 2dup + [ / ] curry bi@
[ [ v*n ] curry ] bi@ bi* v+ ;
: filter-all-subseqs-range ( ... seq range quot: ( ... subseq -- ... ) -- seq )
[
'[ <clumps> _ filter ] with map concat
- ] 3keep 2drop map-like ; inline
+ ] keepdd map-like ; inline
: filter-all-subseqs ( ... seq quot: ( ... subseq -- ... ) -- seq )
[ dup length [1,b] ] dip filter-all-subseqs-range ; inline
[ change-nth ] 2curry each ; inline
: push-if-index ( ..a elt i quot: ( ..a elt i -- ..b ? ) accum -- ..b )
- [ 2keep drop ] dip rot [ push ] [ 2drop ] if ; inline
+ [ keepd ] dip rot [ push ] [ 2drop ] if ; inline
: push-if* ( ..a elt quot: ( ..a elt -- ..b obj/f ) accum -- ..b )
[ call ] dip [ push ] [ drop ] if* ; inline
] if ; inline
: map-filter-as ( ... seq map-quot: ( ... elt -- ... newelt ) filter-quot: ( ... newelt -- ... ? ) exemplar -- ... subseq )
- [ pick ] dip swap length over
+ reach length over
[ (selector-as) [ compose each ] dip ] 2curry dip like ; inline
: map-filter ( ... seq map-quot: ( ... elt -- ... newelt ) filter-quot: ( ... newelt -- ... ? ) -- ... subseq )
PRIVATE>
: filter-map-as ( ... seq filter-quot: ( ... elt -- ... ? ) map-quot: ( ... elt -- ... newelt ) exemplar -- ... newseq )
- [ pick ] dip swap length over
+ reach length over
[ (filter-mapper-for) [ each ] dip ] 2curry dip like ; inline
: filter-map ( ... seq filter-quot: ( ... elt -- ... ? ) map-quot: ( ... elt -- ... newelt ) -- ... newseq )
} case ;
: cut-when ( ... seq quot: ( ... elt -- ... ? ) -- ... before after )
- [ find drop ] 2keep drop swap
+ [ find drop ] keepd swap
[ cut ] [ f over like ] if* ; inline
: nth* ( n seq -- elt )
'[ swap _ dip swap ] assoc-map ; inline
: take-while ( ... seq quot: ( ... elt -- ... ? ) -- head-slice )
- [ '[ @ not ] find drop ] 2keep drop swap
+ [ '[ @ not ] find drop ] keepd swap
[ dup length ] unless* head-slice ; inline
: drop-while ( ... seq quot: ( ... elt -- ... ? ) -- tail-slice )
- [ '[ @ not ] find drop ] 2keep drop swap
+ [ '[ @ not ] find drop ] keepd swap
[ dup length ] unless* tail-slice ; inline
:: interleaved-as ( seq glue exemplar -- newseq )
suffix swap prefix >>commands
over second >>stdin
over 5 swap nth >>stdout
- swap 6 swap nth >>background ;
+ 6 rot nth >>background ;
: ast>single-quoted-expr ( ast -- obj )
second >string single-quoted-expr boa ;
M: federal withholding* ( salary w4 tax-table entity -- x )
drop
- [ federal-tax ] 3keep drop
+ [ federal-tax ] 2keepd
[ fica-tax ] 2keep
medicare-tax + + ;
! TODO: move implementation specific stuff into tetris-board
: (draw-row) ( x y row -- )
- [ over ] dip nth dup
+ overd nth dup
[ gl-color 2array draw-block ] [ 3drop ] if ;
: draw-row ( y row -- )
dup DBITERINIT drop 0 int <ref>
[ 2dup DBITERNEXT dup ] [
[ memory>object ] [ tcfree ] bi
- [ pick ] dip swap push
+ reach push
] while 3drop ;
M: TYPE >alist
M: f avl-delete ( key f -- f f f ) nip f f ;
: (avl-delete) ( key node -- node shorter? deleted? )
- swap over node-link avl-delete [
+ tuck node-link avl-delete [
[ over set-node-link ] dip [ balance-delete ] [ f ] if
] dip ;
: (prune-extremity) ( parent node -- new-extremity )
dup node-link [
- [ nip ] dip (prune-extremity)
+ nipd (prune-extremity)
] [
[ delete-node swap set-node-link ] keep
] if* ;
: calc-point-y ( slope y point -- xy ) over [ calc-x ] dip 2array ;
: xyy>chunk ( x y1 y2 -- chunk )
- [ over ] dip 2array [ 2array ] dip 2array ;
+ overd 2array [ 2array ] dip 2array ;
:: 2-point-chunk ( left right ymin ymax -- chunk )
left last :> left-point
-<HTML>\r
-<HEAD>\r
- <TITLE>mass:werk termlib faq</TITLE>\r
-\r
-<STYLE TYPE="text/css">\r
-body,p,a,td {\r
- font-family: courier,fixed,swiss,sans-serif;\r
- font-size: 12px;\r
- color: #cccccc;\r
-}\r
-.lh13 {\r
- line-height: 13px;\r
-}\r
-.lh15 {\r
- line-height: 15px;\r
-}\r
-pre {\r
- font-family: courier,fixed,swiss,sans-serif;\r
- color: #ccffaa;\r
- font-size: 12px;\r
- line-height: 15px;\r
-}\r
-.prop {\r
- font-family: courier,fixed,swiss,sans-serif;\r
- color: #bbee99;\r
- font-size: 12px;\r
- line-height: 15px;\r
-}\r
-h1 {\r
- font-family: courier,fixed,swiss,sans-serif;\r
- font-size: 16px;\r
- color: #cccccc;\r
-}\r
-b.quest {\r
- font-family: courier,fixed,swiss,sans-serif;\r
- font-size: 14px;\r
- font-weight: bold;\r
- color: #bbee99;\r
-}\r
-a,a:link,a:visited {\r
- text-decoration: none;\r
- color: #77dd11;\r
-}\r
-a:hover {\r
- text-decoration: underline;\r
- color: #77dd11;\r
-}\r
-a:active {\r
- text-decoration: underline;\r
- color: #dddddd;\r
-}\r
-\r
-@media print {\r
- body { background-color: #ffffff; }\r
- body,p,a,td {\r
- font-family: courier,fixed,swiss,sans-serif;\r
- font-size: 12px;\r
- color: #000000;\r
- }\r
- .lh13 {\r
- line-height: 13px;\r
- }\r
- .lh15 {\r
- line-height: 15px;\r
- }\r
- pre,.prop {\r
- font-family: courier,fixed,swiss,sans-serif;\r
- font-size: 12px;\r
- color: #000000;\r
- line-height: 15px;\r
- }\r
- h1 {\r
- font-family: courier,fixed,swiss,sans-serif;\r
- font-size: 16px;\r
- color: #000000;\r
- }\r
- b.quest {\r
- font-family: courier,fixed,swiss,sans-serif;\r
- font-size: 14px;\r
- font-weight: bold;\r
- color: #000000;\r
- }\r
- a,a:link,a:visited {\r
- text-decoration: none;\r
- color: #000000;\r
- }\r
- a:hover {\r
- text-decoration: underline;\r
- color: #000000;\r
- }\r
- a:active {\r
- text-decoration: underline;\r
- color: #000000;\r
- }\r
-}\r
-</STYLE>\r
-</HEAD>\r
-\r
-\r
-<BODY BGCOLOR="#222222" LINK="#77dd11" TEXT="#cccccc" ALINK="#dddddd" VLINK="#77dd11"\r
-TOPMARGIN="0" BOTTOMMARGIN="0" LEFTMARGIN="0" RIGHTMARGIN="0" MARGINHEIGHT="0" MARGINWIDTH="0"><A NAME="top"></A>\r
-\r
-<TABLE BORDER="0" CELLSPACING="20" CELLPADDING="0" ALIGN="center">\r
-<TR>\r
- <TD NOWRAP><A HREF="index.html">termlib.js home</A></TD>\r
- <TD>|</TD>\r
- <TD NOWRAP><A HREF="multiterm_test.html">multiple terminal test</A></TD>\r
- <TD>|</TD>\r
- <TD NOWRAP><A HREF="parser_sample.html">sample parser</A></TD>\r
- <TD>|</TD>\r
- <TD NOWRAP>faq</TD>\r
- <TD>|</TD>\r
- <TD NOWRAP><A HREF="readme.txt" TITLE="readme.txt (text/plain)">documentation</A></TD>\r
-</TR>\r
-</TABLE>\r
-\r
-<TABLE BORDER="0" CELLSPACING="20" CELLPADDING="0" WIDTH="700" ALIGN="center">\r
- <TR><TD>\r
- <H1>frequently asked questions</H1>\r
- </TD></TR>\r
- <TR><TD CLASS="lh13">\r
- <BR>\r
- <UL>\r
- <LI CLASS="lh15"><A HREF="#chrome">Can I add chrome to the terminal? (e.g. a window header, a close box)</A></LI>\r
- <LI CLASS="lh15"><A HREF="#embed">How can I embed a terminal relative to my HTML layout?</A></LI>\r
- <LI CLASS="lh15"><A HREF="#syntax">I pasted your sample code and just got an error. - ???</A></LI>\r
- <LI CLASS="lh15"><A HREF="#keyboard">I can't get any input, but I don't get any erros too.</A></LI>\r
- <LI CLASS="lh15"><A HREF="#keylock">How can I temporary disable the keyboard handlers?</A></LI>\r
- <LI CLASS="lh15"><A HREF="#linesranges">How can I set the cusor to the start / the end of the command line?</A></LI>\r
- <LI CLASS="lh15"><A HREF="#historyunique">How can I limit the command history to unique entries only?</A></LI>\r
- <LI CLASS="lh15"><A HREF="#rebuild">How can I change my color theme on the fly?</A></LI>\r
- <LI CLASS="lh15"><A HREF="#connect">How can I connect to a server?</A></LI>\r
- </UL>\r
- </TD></TR>\r
- <TR><TD CLASS="lh13"><A NAME="chrome"></A>\r
- <BR>\r
-<B CLASS="quest">Can I add chrome to the terminal? (e.g. a window header, a close box)</B><BR><BR>\r
-\r
-Not by the means of the Terminal object's interface (since there are way too many things that you may possibly want to add).<BR>\r
-The Terminal object allows you to specify the background color, the frame color, the frame's width and the font class used. If you want to add more chrome, you must align this in a separate division element.<BR><BR>\r
-\r
-To calculate the dimensions of the terminal use this formula:<BR><BR>\r
-\r
-width: 2 * frameWidth + conf.cols * <width of > + 2 * 2px padding (left and right)<BR>\r
-height: 2 * frameWidth + conf.rows * conf.rowHeight + 2 * 2px padding (top and bottom).<BR><BR>\r
-\r
-Or you could get the empirical values for width and height by calling a terminal's `<SPAN CLASS="prop">getDimensions()</SPAN>' method, once the terminal is open. (see documentation in "readme.txt").<BR><BR>\r
-\r
-Finnally, you could obviously embed the terminal's division element in your custom chrome layout (see below). [This will not be compatible to Netscape 4.]<BR><BR>\r
-\r
-p.e.:<PRE>\r
- <div id="myTerminal1" style="position:absolute; top:100px; left:100px;">\r
- <table class="termChrome">\r
- <tbody>\r
- <tr>\r
- <td class="termTitle">terminal 1</td>\r
- </tr>\r
- <tr>\r
- <td class="termBody"><div id="termDiv1" style="position:relative"></div></td>\r
- </tr>\r
- </tbody>\r
- </table>\r
- </div>\r
-\r
- // get a terminal for this\r
-\r
- var term1 = new Terminal(\r
- {\r
- x: 0,\r
- y: 0,\r
- id: 1,\r
- termDiv: "termDiv1",\r
- handler: myTermHandler\r
- }\r
- );\r
- term1.open();\r
- \r
- // and this is how to move the chrome and the embedded terminal\r
-\r
- TermGlobals.setElementXY( "myTerminal1", 200, 80 );\r
-</PRE>\r
-To keep track of the instance for any widgets use the terminal's `id' property. (You must set this in the configuration object to a unique value for this purpose.)<BR><BR>\r
-\r
-For a demonstration see the <A HREF="chrome_sample.html">Chrome Sample Page</A>.\r
- </TD></TR>\r
- <TR><TD CLASS="lh13"><A NAME="embed"></A>\r
- <BR>\r
-<B CLASS="quest">How can I embed a terminal relative to my HTML layout?</B><BR><BR>\r
-\r
-Define your devision element with attribute "position" set to "relative" and place this inside your layout. Call "new Terminal()" with config-values { x: 0, y: 0 } to leave it at its relative origin.\r
- </TD></TR>\r
- <TR><TD CLASS="lh13"><A NAME="syntax"></A>\r
- <BR>\r
-<B CLASS="quest">I pasted your sample code and just got an error. - ???</B><BR><BR>\r
-\r
-The short examples are kept arbitrarily simple to show the syntax.<BR>\r
-Make sure that your divison element(s) is/are rendered by the browser before `Terminal.open()' is called.<BR><BR>\r
-\r
-Does not work:\r
-<PRE> <head>\r
- <script>\r
- var term = new Terminal();\r
- term.open();\r
- </script>\r
- </head>\r
-</PRE>\r
-Does work:\r
-<PRE> <head>\r
- <script>\r
- var term;\r
- \r
- function termOpen() {\r
- // to be called from outside after compile time\r
- term = new Terminal();\r
- term.open();\r
- }\r
- </script>\r
- </head>\r
-</PRE>\r
-c.f. "readme.txt"<BR>\r
-(Opening a terminal by clicking a link implies also that the page has currently focus.)<BR><BR>\r
-With v.1.01 and higher this doesn't cause an error any more.<BR>`Terminal.prototype.open()' now returns a value for success.\r
- </TD></TR>\r
- <TR><TD CLASS="lh13"><A NAME="keyboard"></A>\r
- <BR>\r
-<B CLASS="quest">I can't get any input, but I don't get any erros too.</B><BR><BR>\r
-\r
-The Terminal object's functionality relies on the browsers ability to generate and handle keyboard events.<BR>\r
-Sadly some browsers lack a full implementation of the event model. (e.g. Konquerer [khtml] and early versions of Apple Safari, which is a descendant of khtml.)\r
- </TD></TR>\r
- <TR><TD CLASS="lh13"><A NAME="keylock"></A>\r
- <BR>\r
-<B CLASS="quest">How can I temporary disable the keyboard handlers?</B><BR>\r
-<SPAN CLASS="prop">(The terminal is blocking my HTML form fields, etc.)</SPAN><BR><BR>\r
-\r
-With version 1.03 there's a global property `<SPAN CLASS="prop">TermGlobals.keylock</SPAN>'. Set this to `true' to disable the keyboard handlers without altering any other state. Reset it to `false' to continue with your terminal session(s).\r
- </TD></TR>\r
- <TR><TD CLASS="lh13"><A NAME="linesranges"></A>\r
- <BR>\r
-<B CLASS="quest">How can I set the cusor to the start / the end of the command line?</B><BR><BR>\r
-\r
-In case you need to implement a shortcut (like ^A of some UN*X-shells) to jump to the beginning or the end of the current input line, there are two private instance methods you could utilize:<BR><BR>\r
-`<SPAN CLASS="prop">_getLineEnd(<row>, <col>)</SPAN>' returns an array [<row>, <col>] with the position of the last character in the logical input line with ASCII value >= 32 (0x20).<BR><BR>\r
-`<SPAN CLASS="prop">_getLineStart(<row>, <col>)</SPAN>' returns an array [<row>, <col>] with the position of the first character in the logical input line with ASCII value >= 32 (0x20).<BR><BR>\r
-Both take a row and a column of a cursor position as arguments.<BR><BR>\r
-\r
-p.e.:\r
-<PRE>\r
- // jump to the start of the input line\r
-\r
- myCtrlHandler() {\r
- // catch ^A and jump to start of the line\r
- if (this.inputChar == 1) {\r
- var firstChar = this._getLineStart(this.r, this.c);\r
- this.cursorSet(firstChar[0], firstChar[1]);\r
- }\r
- }</PRE>\r
-(Keep in mind that this is not exactly a good example, since some browser actually don't issue a keyboard event for \r
-"^A". And other browsers, which do catch such codes, are not very reliable in that.)\r
- </TD></TR>\r
- <TR><TD CLASS="lh13"><A NAME="historyunique"></A>\r
- <BR>\r
-<B CLASS="quest">How can I limit the command history to unique entries only?</B><BR>\r
- <SPAN CLASS="prop">(My application effords commands to be commonly repeated.)</SPAN><BR><BR>\r
-\r
-With version 1.05 there is a new configuration and control flag `<SPAN CLASS="prop">historyUnique</SPAN>'. All you need is setting this to `true' in your terminal's configuration object.\r
- </TD></TR>\r
- <TR><TD CLASS="lh13"><A NAME="rebuild"></A>\r
- <BR>\r
-<B CLASS="quest">How can I change my color theme on the fly?</B><BR><BR>\r
-\r
-With version 1.07 there is a new method `<SPAN CLASS="prop">Terminal.rebuild()</SPAN>'.<BR>\r
-This method updates the GUI to current config settings while preserving all other state.<BR><BR>\r
-p.e.:\r
-<PRE>\r
- // change color settings on the fly\r
- // here: set bgColor to white and font style to class "termWhite"\r
- // method rebuild() updates the GUI without side effects\r
- // assume var term holds a referene to a Terminal object already active\r
-\r
- term.conf.bgColor = '#ffffff';\r
- term.conf.fontClass = 'termWhite';\r
- term.rebuild();</PRE>\r
- </TD></TR>\r
- <TR><TD CLASS="lh13"><A NAME="connect"></A>\r
- <BR>\r
-<B CLASS="quest">How can I connect to a server?</B><BR><BR>\r
-\r
-The Terminal object only provides an interface to handle console input and output.<BR>\r
-External connections have to be handled outside the Terminal object. You could use the XMLHttpRequest-Object (and use a communication model like AJAX or JSON) or connect via a frame or iframe element to a foreign host.<BR><BR>\r
-Handling connections is considered to be out of the realm of the "termlib.js" library.<BR>\r
-The code you need is in fact quite simple:\r
-<PRE>\r
- function connectToHost(url) {\r
- if (window.XMLHttpRequest) {\r
- request = new XMLHttpRequest();\r
- }\r
- else if (window.ActiveXObject) {\r
- request = new ActiveXObject('Microsoft.XMLHTTP');\r
- }\r
- if (request) {\r
- request.onreadystatechange = requestChangeHandler;\r
- request.open('GET', url);\r
- request.send('');\r
- }\r
- else {\r
- // XMLHttpRequest not implemented\r
- }\r
- }\r
- \r
- function requestChangeHandler() {\r
- if (request.readyState == 4) {\r
- // readyState 4: complete; now test for server's response status\r
- if (request.status == 200) {\r
- // response in request.responseText or request.responseXML if XML-code\r
- // if it's JS-code we could get this by eval(request.responseText)\r
- // by this we could import whole functions to be used via the terminal\r
- }\r
- else {\r
- // connection error\r
- // status code and message in request.status and request.statusText\r
- }\r
- }\r
- }\r
-</PRE>\r
-You should use this only together with a timer (window.setTimeout()) to handle connection timeouts.<BR>\r
-Additionally you would need some syntax to authenticate and tell the server what you want.<BR>\r
-For this purpose you could use the following methods of the XMLHttpRequest object:<BR><BR>\r
-\r
- <TABLE BORDER="0" CELLSPACING="0" CELLPADDING="3">\r
- <TR VALIGN="top"><TD NOWRAP CLASS="prop">setRequestHeader("<I>headerLabel</I>", "<I>value</I>")</TD><TD>set a HTTP header to be sent to the server</TD></TR>\r
- <TR VALIGN="top"><TD NOWRAP CLASS="prop">getResponseHeader("<I>headerLabel</I>")</TD><TD>get a HTTP header sent from the server</TD></TR>\r
- <TR VALIGN="top"><TD NOWRAP CLASS="prop">open(<I>method</I>, "<I>url</I>" [, <I>asyncFlag</I> [,<BR> "<I>userid</I>" [, "<I>password</I>"]]])</TD><TD>assign the destination properties to the request.<BR>be aware that userid and password are not encrypted!</TD></TR>\r
- <TR VALIGN="top"><TD NOWRAP CLASS="prop">send(<I>content</I>)</TD><TD>transmit a message body (post-string or DOM object)</TD></TR>\r
- <TR VALIGN="top"><TD NOWRAP CLASS="prop">abort()</TD><TD>use this to stop a pending connection</TD></TR>\r
- </TABLE>\r
-\r
- </TD></TR>\r
- <TR><TD CLASS="lh13">\r
- <BR>\r
- Norbert Landsteiner - August 2005<BR>\r
- <A HREF="http://www.masswerk.at/" TARGET="_blank">http://www.masswerk.at</A>\r
- </TD></TR>\r
- <TR><TD CLASS="lh13">\r
- <BR>\r
- <A HREF="#top">> top of page</A>\r
- </TD></TR>\r
- <TR><TD CLASS="lh13">\r
- \r
- </TD></TR>\r
-</TABLE>\r
-\r
-<DIV ID="termDiv" STYLE="position:absolute; top:20px; left:100px;"></DIV>\r
-\r
-</BODY>\r
+<HTML>
+<HEAD>
+ <TITLE>mass:werk termlib faq</TITLE>
+
+<STYLE TYPE="text/css">
+body,p,a,td {
+ font-family: courier,fixed,swiss,sans-serif;
+ font-size: 12px;
+ color: #cccccc;
+}
+.lh13 {
+ line-height: 13px;
+}
+.lh15 {
+ line-height: 15px;
+}
+pre {
+ font-family: courier,fixed,swiss,sans-serif;
+ color: #ccffaa;
+ font-size: 12px;
+ line-height: 15px;
+}
+.prop {
+ font-family: courier,fixed,swiss,sans-serif;
+ color: #bbee99;
+ font-size: 12px;
+ line-height: 15px;
+}
+h1 {
+ font-family: courier,fixed,swiss,sans-serif;
+ font-size: 16px;
+ color: #cccccc;
+}
+b.quest {
+ font-family: courier,fixed,swiss,sans-serif;
+ font-size: 14px;
+ font-weight: bold;
+ color: #bbee99;
+}
+a,a:link,a:visited {
+ text-decoration: none;
+ color: #77dd11;
+}
+a:hover {
+ text-decoration: underline;
+ color: #77dd11;
+}
+a:active {
+ text-decoration: underline;
+ color: #dddddd;
+}
+
+@media print {
+ body { background-color: #ffffff; }
+ body,p,a,td {
+ font-family: courier,fixed,swiss,sans-serif;
+ font-size: 12px;
+ color: #000000;
+ }
+ .lh13 {
+ line-height: 13px;
+ }
+ .lh15 {
+ line-height: 15px;
+ }
+ pre,.prop {
+ font-family: courier,fixed,swiss,sans-serif;
+ font-size: 12px;
+ color: #000000;
+ line-height: 15px;
+ }
+ h1 {
+ font-family: courier,fixed,swiss,sans-serif;
+ font-size: 16px;
+ color: #000000;
+ }
+ b.quest {
+ font-family: courier,fixed,swiss,sans-serif;
+ font-size: 14px;
+ font-weight: bold;
+ color: #000000;
+ }
+ a,a:link,a:visited {
+ text-decoration: none;
+ color: #000000;
+ }
+ a:hover {
+ text-decoration: underline;
+ color: #000000;
+ }
+ a:active {
+ text-decoration: underline;
+ color: #000000;
+ }
+}
+</STYLE>
+</HEAD>
+
+
+<BODY BGCOLOR="#222222" LINK="#77dd11" TEXT="#cccccc" ALINK="#dddddd" VLINK="#77dd11"
+TOPMARGIN="0" BOTTOMMARGIN="0" LEFTMARGIN="0" RIGHTMARGIN="0" MARGINHEIGHT="0" MARGINWIDTH="0"><A NAME="top"></A>
+
+<TABLE BORDER="0" CELLSPACING="20" CELLPADDING="0" ALIGN="center">
+<TR>
+ <TD NOWRAP><A HREF="index.html">termlib.js home</A></TD>
+ <TD>|</TD>
+ <TD NOWRAP><A HREF="multiterm_test.html">multiple terminal test</A></TD>
+ <TD>|</TD>
+ <TD NOWRAP><A HREF="parser_sample.html">sample parser</A></TD>
+ <TD>|</TD>
+ <TD NOWRAP>faq</TD>
+ <TD>|</TD>
+ <TD NOWRAP><A HREF="readme.txt" TITLE="readme.txt (text/plain)">documentation</A></TD>
+</TR>
+</TABLE>
+
+<TABLE BORDER="0" CELLSPACING="20" CELLPADDING="0" WIDTH="700" ALIGN="center">
+ <TR><TD>
+ <H1>frequently asked questions</H1>
+ </TD></TR>
+ <TR><TD CLASS="lh13">
+ <BR>
+ <UL>
+ <LI CLASS="lh15"><A HREF="#chrome">Can I add chrome to the terminal? (e.g. a window header, a close box)</A></LI>
+ <LI CLASS="lh15"><A HREF="#embed">How can I embed a terminal relative to my HTML layout?</A></LI>
+ <LI CLASS="lh15"><A HREF="#syntax">I pasted your sample code and just got an error. - ???</A></LI>
+ <LI CLASS="lh15"><A HREF="#keyboard">I can't get any input, but I don't get any erros too.</A></LI>
+ <LI CLASS="lh15"><A HREF="#keylock">How can I temporary disable the keyboard handlers?</A></LI>
+ <LI CLASS="lh15"><A HREF="#linesranges">How can I set the cusor to the start / the end of the command line?</A></LI>
+ <LI CLASS="lh15"><A HREF="#historyunique">How can I limit the command history to unique entries only?</A></LI>
+ <LI CLASS="lh15"><A HREF="#rebuild">How can I change my color theme on the fly?</A></LI>
+ <LI CLASS="lh15"><A HREF="#connect">How can I connect to a server?</A></LI>
+ </UL>
+ </TD></TR>
+ <TR><TD CLASS="lh13"><A NAME="chrome"></A>
+ <BR>
+<B CLASS="quest">Can I add chrome to the terminal? (e.g. a window header, a close box)</B><BR><BR>
+
+Not by the means of the Terminal object's interface (since there are way too many things that you may possibly want to add).<BR>
+The Terminal object allows you to specify the background color, the frame color, the frame's width and the font class used. If you want to add more chrome, you must align this in a separate division element.<BR><BR>
+
+To calculate the dimensions of the terminal use this formula:<BR><BR>
+
+width: 2 * frameWidth + conf.cols * <width of > + 2 * 2px padding (left and right)<BR>
+height: 2 * frameWidth + conf.rows * conf.rowHeight + 2 * 2px padding (top and bottom).<BR><BR>
+
+Or you could get the empirical values for width and height by calling a terminal's `<SPAN CLASS="prop">getDimensions()</SPAN>' method, once the terminal is open. (see documentation in "readme.txt").<BR><BR>
+
+Finnally, you could obviously embed the terminal's division element in your custom chrome layout (see below). [This will not be compatible to Netscape 4.]<BR><BR>
+
+p.e.:<PRE>
+ <div id="myTerminal1" style="position:absolute; top:100px; left:100px;">
+ <table class="termChrome">
+ <tbody>
+ <tr>
+ <td class="termTitle">terminal 1</td>
+ </tr>
+ <tr>
+ <td class="termBody"><div id="termDiv1" style="position:relative"></div></td>
+ </tr>
+ </tbody>
+ </table>
+ </div>
+
+ // get a terminal for this
+
+ var term1 = new Terminal(
+ {
+ x: 0,
+ y: 0,
+ id: 1,
+ termDiv: "termDiv1",
+ handler: myTermHandler
+ }
+ );
+ term1.open();
+
+ // and this is how to move the chrome and the embedded terminal
+
+ TermGlobals.setElementXY( "myTerminal1", 200, 80 );
+</PRE>
+To keep track of the instance for any widgets use the terminal's `id' property. (You must set this in the configuration object to a unique value for this purpose.)<BR><BR>
+
+For a demonstration see the <A HREF="chrome_sample.html">Chrome Sample Page</A>.
+ </TD></TR>
+ <TR><TD CLASS="lh13"><A NAME="embed"></A>
+ <BR>
+<B CLASS="quest">How can I embed a terminal relative to my HTML layout?</B><BR><BR>
+
+Define your devision element with attribute "position" set to "relative" and place this inside your layout. Call "new Terminal()" with config-values { x: 0, y: 0 } to leave it at its relative origin.
+ </TD></TR>
+ <TR><TD CLASS="lh13"><A NAME="syntax"></A>
+ <BR>
+<B CLASS="quest">I pasted your sample code and just got an error. - ???</B><BR><BR>
+
+The short examples are kept arbitrarily simple to show the syntax.<BR>
+Make sure that your divison element(s) is/are rendered by the browser before `Terminal.open()' is called.<BR><BR>
+
+Does not work:
+<PRE> <head>
+ <script>
+ var term = new Terminal();
+ term.open();
+ </script>
+ </head>
+</PRE>
+Does work:
+<PRE> <head>
+ <script>
+ var term;
+
+ function termOpen() {
+ // to be called from outside after compile time
+ term = new Terminal();
+ term.open();
+ }
+ </script>
+ </head>
+</PRE>
+c.f. "readme.txt"<BR>
+(Opening a terminal by clicking a link implies also that the page has currently focus.)<BR><BR>
+With v.1.01 and higher this doesn't cause an error any more.<BR>`Terminal.prototype.open()' now returns a value for success.
+ </TD></TR>
+ <TR><TD CLASS="lh13"><A NAME="keyboard"></A>
+ <BR>
+<B CLASS="quest">I can't get any input, but I don't get any erros too.</B><BR><BR>
+
+The Terminal object's functionality relies on the browsers ability to generate and handle keyboard events.<BR>
+Sadly some browsers lack a full implementation of the event model. (e.g. Konquerer [khtml] and early versions of Apple Safari, which is a descendant of khtml.)
+ </TD></TR>
+ <TR><TD CLASS="lh13"><A NAME="keylock"></A>
+ <BR>
+<B CLASS="quest">How can I temporary disable the keyboard handlers?</B><BR>
+<SPAN CLASS="prop">(The terminal is blocking my HTML form fields, etc.)</SPAN><BR><BR>
+
+With version 1.03 there's a global property `<SPAN CLASS="prop">TermGlobals.keylock</SPAN>'. Set this to `true' to disable the keyboard handlers without altering any other state. Reset it to `false' to continue with your terminal session(s).
+ </TD></TR>
+ <TR><TD CLASS="lh13"><A NAME="linesranges"></A>
+ <BR>
+<B CLASS="quest">How can I set the cusor to the start / the end of the command line?</B><BR><BR>
+
+In case you need to implement a shortcut (like ^A of some UN*X-shells) to jump to the beginning or the end of the current input line, there are two private instance methods you could utilize:<BR><BR>
+`<SPAN CLASS="prop">_getLineEnd(<row>, <col>)</SPAN>' returns an array [<row>, <col>] with the position of the last character in the logical input line with ASCII value >= 32 (0x20).<BR><BR>
+`<SPAN CLASS="prop">_getLineStart(<row>, <col>)</SPAN>' returns an array [<row>, <col>] with the position of the first character in the logical input line with ASCII value >= 32 (0x20).<BR><BR>
+Both take a row and a column of a cursor position as arguments.<BR><BR>
+
+p.e.:
+<PRE>
+ // jump to the start of the input line
+
+ myCtrlHandler() {
+ // catch ^A and jump to start of the line
+ if (this.inputChar == 1) {
+ var firstChar = this._getLineStart(this.r, this.c);
+ this.cursorSet(firstChar[0], firstChar[1]);
+ }
+ }</PRE>
+(Keep in mind that this is not exactly a good example, since some browser actually don't issue a keyboard event for
+"^A". And other browsers, which do catch such codes, are not very reliable in that.)
+ </TD></TR>
+ <TR><TD CLASS="lh13"><A NAME="historyunique"></A>
+ <BR>
+<B CLASS="quest">How can I limit the command history to unique entries only?</B><BR>
+ <SPAN CLASS="prop">(My application effords commands to be commonly repeated.)</SPAN><BR><BR>
+
+With version 1.05 there is a new configuration and control flag `<SPAN CLASS="prop">historyUnique</SPAN>'. All you need is setting this to `true' in your terminal's configuration object.
+ </TD></TR>
+ <TR><TD CLASS="lh13"><A NAME="rebuild"></A>
+ <BR>
+<B CLASS="quest">How can I change my color theme on the fly?</B><BR><BR>
+
+With version 1.07 there is a new method `<SPAN CLASS="prop">Terminal.rebuild()</SPAN>'.<BR>
+This method updates the GUI to current config settings while preserving all other state.<BR><BR>
+p.e.:
+<PRE>
+ // change color settings on the fly
+ // here: set bgColor to white and font style to class "termWhite"
+ // method rebuild() updates the GUI without side effects
+ // assume var term holds a referene to a Terminal object already active
+
+ term.conf.bgColor = '#ffffff';
+ term.conf.fontClass = 'termWhite';
+ term.rebuild();</PRE>
+ </TD></TR>
+ <TR><TD CLASS="lh13"><A NAME="connect"></A>
+ <BR>
+<B CLASS="quest">How can I connect to a server?</B><BR><BR>
+
+The Terminal object only provides an interface to handle console input and output.<BR>
+External connections have to be handled outside the Terminal object. You could use the XMLHttpRequest-Object (and use a communication model like AJAX or JSON) or connect via a frame or iframe element to a foreign host.<BR><BR>
+Handling connections is considered to be out of the realm of the "termlib.js" library.<BR>
+The code you need is in fact quite simple:
+<PRE>
+ function connectToHost(url) {
+ if (window.XMLHttpRequest) {
+ request = new XMLHttpRequest();
+ }
+ else if (window.ActiveXObject) {
+ request = new ActiveXObject('Microsoft.XMLHTTP');
+ }
+ if (request) {
+ request.onreadystatechange = requestChangeHandler;
+ request.open('GET', url);
+ request.send('');
+ }
+ else {
+ // XMLHttpRequest not implemented
+ }
+ }
+
+ function requestChangeHandler() {
+ if (request.readyState == 4) {
+ // readyState 4: complete; now test for server's response status
+ if (request.status == 200) {
+ // response in request.responseText or request.responseXML if XML-code
+ // if it's JS-code we could get this by eval(request.responseText)
+ // by this we could import whole functions to be used via the terminal
+ }
+ else {
+ // connection error
+ // status code and message in request.status and request.statusText
+ }
+ }
+ }
+</PRE>
+You should use this only together with a timer (window.setTimeout()) to handle connection timeouts.<BR>
+Additionally you would need some syntax to authenticate and tell the server what you want.<BR>
+For this purpose you could use the following methods of the XMLHttpRequest object:<BR><BR>
+
+ <TABLE BORDER="0" CELLSPACING="0" CELLPADDING="3">
+ <TR VALIGN="top"><TD NOWRAP CLASS="prop">setRequestHeader("<I>headerLabel</I>", "<I>value</I>")</TD><TD>set a HTTP header to be sent to the server</TD></TR>
+ <TR VALIGN="top"><TD NOWRAP CLASS="prop">getResponseHeader("<I>headerLabel</I>")</TD><TD>get a HTTP header sent from the server</TD></TR>
+ <TR VALIGN="top"><TD NOWRAP CLASS="prop">open(<I>method</I>, "<I>url</I>" [, <I>asyncFlag</I> [,<BR> "<I>userid</I>" [, "<I>password</I>"]]])</TD><TD>assign the destination properties to the request.<BR>be aware that userid and password are not encrypted!</TD></TR>
+ <TR VALIGN="top"><TD NOWRAP CLASS="prop">send(<I>content</I>)</TD><TD>transmit a message body (post-string or DOM object)</TD></TR>
+ <TR VALIGN="top"><TD NOWRAP CLASS="prop">abort()</TD><TD>use this to stop a pending connection</TD></TR>
+ </TABLE>
+
+ </TD></TR>
+ <TR><TD CLASS="lh13">
+ <BR>
+ Norbert Landsteiner - August 2005<BR>
+ <A HREF="http://www.masswerk.at/" TARGET="_blank">http://www.masswerk.at</A>
+ </TD></TR>
+ <TR><TD CLASS="lh13">
+ <BR>
+ <A HREF="#top">> top of page</A>
+ </TD></TR>
+ <TR><TD CLASS="lh13">
+
+ </TD></TR>
+</TABLE>
+
+<DIV ID="termDiv" STYLE="position:absolute; top:20px; left:100px;"></DIV>
+
+</BODY>
</HTML>
\ No newline at end of file
-<HTML>\r
-<HEAD>\r
- <TITLE>mass:werk termlib</TITLE>\r
-\r
-<STYLE TYPE="text/css">\r
-body,p,a,td {\r
- font-family: courier,fixed,swiss,sans-serif;\r
- font-size: 12px;\r
- color: #cccccc;\r
-}\r
-.lh13 {\r
- line-height: 13px;\r
-}\r
-.lh15 {\r
- line-height: 15px;\r
-}\r
-pre {\r
- font-family: courier,fixed,swiss,sans-serif;\r
- font-size: 12px;\r
- color: #ccffaa;\r
- line-height: 15px;\r
-}\r
-.prop {\r
- font-family: courier,fixed,swiss,sans-serif;\r
- color: #bbee99;\r
- font-size: 12px;\r
- line-height: 15px;\r
-}\r
-h1 {\r
- font-family: courier,fixed,swiss,sans-serif;\r
- font-size: 16px;\r
- color: #cccccc;\r
-}\r
-a,a:link,a:visited {\r
- text-decoration: none;\r
- color: #77dd11;\r
-}\r
-a:hover {\r
- text-decoration: underline;\r
- color: #77dd11;\r
-}\r
-a:active {\r
- text-decoration: underline;\r
- color: #dddddd;\r
-}\r
-\r
-@media print {\r
- body { background-color: #ffffff; }\r
- body,p,a,td {\r
- font-family: courier,fixed,swiss,sans-serif;\r
- font-size: 12px;\r
- color: #000000;\r
- }\r
- .lh13 {\r
- line-height: 13px;\r
- }\r
- .lh15 {\r
- line-height: 15px;\r
- }\r
- pre,.prop {\r
- font-family: courier,fixed,swiss,sans-serif;\r
- font-size: 12px;\r
- color: #000000;\r
- line-height: 15px;\r
- }\r
- h1 {\r
- font-family: courier,fixed,swiss,sans-serif;\r
- font-size: 16px;\r
- color: #000000;\r
- }\r
- a,a:link,a:visited {\r
- text-decoration: none;\r
- color: #000000;\r
- }\r
- a:hover {\r
- text-decoration: underline;\r
- color: #000000;\r
- }\r
- a:active {\r
- text-decoration: underline;\r
- color: #000000;\r
- }\r
-}\r
-</STYLE>\r
-</HEAD>\r
-\r
-\r
-<BODY BGCOLOR="#222222" LINK="#77dd11" TEXT="#cccccc" ALINK="#dddddd" VLINK="#77dd11"\r
-TOPMARGIN="0" BOTTOMMARGIN="0" LEFTMARGIN="0" RIGHTMARGIN="0" MARGINHEIGHT="0" MARGINWIDTH="0"><A NAME="top"></A>\r
-\r
-<TABLE BORDER="0" CELLSPACING="20" CELLPADDING="0" ALIGN="center">\r
-<TR>\r
- <TD NOWRAP>termlib.js home</TD>\r
- <TD>|</TD>\r
- <TD NOWRAP><A HREF="multiterm_test.html">multiple terminal test</A></TD>\r
- <TD>|</TD>\r
- <TD NOWRAP><A HREF="parser_sample.html">sample parser</A></TD>\r
- <TD>|</TD>\r
- <TD NOWRAP><A HREF="faq.html">faq</A></TD>\r
- <TD>|</TD>\r
- <TD NOWRAP><A HREF="readme.txt" TITLE="readme.txt (text/plain)">documentation</A></TD>\r
-</TR>\r
-</TABLE>\r
-\r
-<TABLE BORDER="0" CELLSPACING="20" CELLPADDING="0" WIDTH="700" ALIGN="center">\r
- <TR><TD>\r
- <H1>mass:werk termlib.js</H1>\r
- </TD></TR>\r
- <TR><TD CLASS="lh13">\r
- The JavaScript library "termlib.js" provides a `Terminal' object, which\r
- facillitates a simple and object oriented approach to generate and control a\r
- terminal-like interface for web services.<BR><BR>\r
- \r
- "termlib.js" features direct keyboard input and powerful output methods\r
- for multiple and simultanious instances of the `Terminal' object.<BR><BR>\r
- \r
- The library was written with the aim of simple usage and a maximum of compatibility\r
- with minimal foot print in the global namespace.<BR><BR><BR>\r
- \r
- \r
- A short example:<BR>\r
- <PRE>\r
- var term = new Terminal( {handler: termHandler} );\r
- term.open();\r
-\r
- function termHandler() {\r
- this.newLine();\r
- var line = this.lineBuffer;\r
- if (line != "") {\r
- this.write("You typed: "+line);\r
- }\r
- this.prompt();\r
- }\r
- </PRE>\r
- </TD></TR>\r
- <TR><TD CLASS="lh13">\r
- <B>License</B><BR><BR>\r
-\r
- This JavaScript-library is <U>free for private and academic use</U>.\r
- Please include a readable copyright statement and a backlink to <http://www.masswerk.at> in the\r
- web page. The library should always be accompanied by the "readme.txt" and the sample HTML-documents.<BR><BR>\r
-\r
- The term "private use" includes any personal or non-commercial use, which is not related\r
- to commercial activites, but excludes intranet, extranet and/or public net applications\r
- that are related to any kind of commercial or profit oriented activity.<BR><BR>\r
-\r
- For commercial use see <<A HREF="http://www.masswerk.at/" TARGET="_blank">http://www.masswerk.at</A>> for contact information.\r
- </TD></TR>\r
- <TR><TD CLASS="lh13">\r
- <B>Distribution</B><BR><BR>\r
-\r
- This JavaScript-library may be distributed freely as long it is distributed together with the "readme.txt" and the sample HTML-documents and this document.<BR><BR>\r
-\r
- Any changes to the library should be commented and be documented in the readme-file.<BR>\r
- Any changes must be reflected in the `Terminal.version' string as "Version.Subversion (compatibility)".\r
- </TD></TR>\r
- <TR><TD CLASS="lh13">\r
- <B>Disclaimer</B><BR><BR>\r
-\r
- This software is distributed AS IS and in the hope that it will be useful, but WITHOUT ANY\r
- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\r
- PURPOSE. The entire risk as to the quality and performance of the product is borne by the\r
- user. No use of the product is authorized hereunder except under this disclaimer.\r
- </TD></TR>\r
- <TR><TD CLASS="lh13">\r
- <B>History</B><BR><BR>\r
-\r
- This library evolved from the terminal script "TermApp" ((c) N. Landsteiner 2003) and is in its\r
- current form a down scaled spinn-off of the "JS/UIX" project. (JS/UIX is not a free software by now.)\r
- c.f.: <<A HREF="http://www.masswerk.at/jsuix/" TARGET="_blank">http://www.masswerk.at/jsuix</A>><BR><BR>\r
-\r
- For version history: see the <A HREF="readme.txt">readme.txt</A>.\r
- </TD></TR>\r
- <TR><TD CLASS="lh13">\r
- <BR>\r
- <B>Download</B><BR><BR>\r
- Be sure to have read the license information and the disclamer and that you are willing to respect copyrights.<BR><BR>\r
-\r
- <SPAN CLASS="prop">Download:</SPAN> <A HREF="termlib.zip">termlib.zip</A> (~ 40 KB, incl. docs)<BR><BR>\r
- Current version is "1.07 (original)".<BR>\r
- The files are now provided with line breaks in format <CRLF>.<BR>\r
- \r
- </TD></TR>\r
- <TR><TD CLASS="lh13">\r
- <B>Author</B><BR><BR>\r
- © Norbert Landsteiner 2003-2005<BR>\r
- mass:werk – media environments<BR>\r
- <A HREF="http://www.masswerk.at/" TARGET="_blank">http://www.masswerk.at</A>\r
- </TD></TR>\r
- <TR><TD CLASS="lh13">\r
- <BR>\r
- Author's note:<BR>\r
- Please do not contact me on questions of simple usage. There is an extensive documentation (readme.txt) including plenty of sample code that should provide all information you need.\r
- </TD></TR>\r
- <TR><TD CLASS="lh13">\r
- <BR>\r
- <A HREF="#top">> top of page</A>\r
- </TD></TR>\r
- <TR><TD CLASS="lh13">\r
- \r
- </TD></TR>\r
-</TABLE>\r
-\r
-<DIV ID="termDiv" STYLE="position:absolute; top:20px; left:100px;"></DIV>\r
-\r
-</BODY>\r
+<HTML>
+<HEAD>
+ <TITLE>mass:werk termlib</TITLE>
+
+<STYLE TYPE="text/css">
+body,p,a,td {
+ font-family: courier,fixed,swiss,sans-serif;
+ font-size: 12px;
+ color: #cccccc;
+}
+.lh13 {
+ line-height: 13px;
+}
+.lh15 {
+ line-height: 15px;
+}
+pre {
+ font-family: courier,fixed,swiss,sans-serif;
+ font-size: 12px;
+ color: #ccffaa;
+ line-height: 15px;
+}
+.prop {
+ font-family: courier,fixed,swiss,sans-serif;
+ color: #bbee99;
+ font-size: 12px;
+ line-height: 15px;
+}
+h1 {
+ font-family: courier,fixed,swiss,sans-serif;
+ font-size: 16px;
+ color: #cccccc;
+}
+a,a:link,a:visited {
+ text-decoration: none;
+ color: #77dd11;
+}
+a:hover {
+ text-decoration: underline;
+ color: #77dd11;
+}
+a:active {
+ text-decoration: underline;
+ color: #dddddd;
+}
+
+@media print {
+ body { background-color: #ffffff; }
+ body,p,a,td {
+ font-family: courier,fixed,swiss,sans-serif;
+ font-size: 12px;
+ color: #000000;
+ }
+ .lh13 {
+ line-height: 13px;
+ }
+ .lh15 {
+ line-height: 15px;
+ }
+ pre,.prop {
+ font-family: courier,fixed,swiss,sans-serif;
+ font-size: 12px;
+ color: #000000;
+ line-height: 15px;
+ }
+ h1 {
+ font-family: courier,fixed,swiss,sans-serif;
+ font-size: 16px;
+ color: #000000;
+ }
+ a,a:link,a:visited {
+ text-decoration: none;
+ color: #000000;
+ }
+ a:hover {
+ text-decoration: underline;
+ color: #000000;
+ }
+ a:active {
+ text-decoration: underline;
+ color: #000000;
+ }
+}
+</STYLE>
+</HEAD>
+
+
+<BODY BGCOLOR="#222222" LINK="#77dd11" TEXT="#cccccc" ALINK="#dddddd" VLINK="#77dd11"
+TOPMARGIN="0" BOTTOMMARGIN="0" LEFTMARGIN="0" RIGHTMARGIN="0" MARGINHEIGHT="0" MARGINWIDTH="0"><A NAME="top"></A>
+
+<TABLE BORDER="0" CELLSPACING="20" CELLPADDING="0" ALIGN="center">
+<TR>
+ <TD NOWRAP>termlib.js home</TD>
+ <TD>|</TD>
+ <TD NOWRAP><A HREF="multiterm_test.html">multiple terminal test</A></TD>
+ <TD>|</TD>
+ <TD NOWRAP><A HREF="parser_sample.html">sample parser</A></TD>
+ <TD>|</TD>
+ <TD NOWRAP><A HREF="faq.html">faq</A></TD>
+ <TD>|</TD>
+ <TD NOWRAP><A HREF="readme.txt" TITLE="readme.txt (text/plain)">documentation</A></TD>
+</TR>
+</TABLE>
+
+<TABLE BORDER="0" CELLSPACING="20" CELLPADDING="0" WIDTH="700" ALIGN="center">
+ <TR><TD>
+ <H1>mass:werk termlib.js</H1>
+ </TD></TR>
+ <TR><TD CLASS="lh13">
+ The JavaScript library "termlib.js" provides a `Terminal' object, which
+ facillitates a simple and object oriented approach to generate and control a
+ terminal-like interface for web services.<BR><BR>
+
+ "termlib.js" features direct keyboard input and powerful output methods
+ for multiple and simultanious instances of the `Terminal' object.<BR><BR>
+
+ The library was written with the aim of simple usage and a maximum of compatibility
+ with minimal foot print in the global namespace.<BR><BR><BR>
+
+
+ A short example:<BR>
+ <PRE>
+ var term = new Terminal( {handler: termHandler} );
+ term.open();
+
+ function termHandler() {
+ this.newLine();
+ var line = this.lineBuffer;
+ if (line != "") {
+ this.write("You typed: "+line);
+ }
+ this.prompt();
+ }
+ </PRE>
+ </TD></TR>
+ <TR><TD CLASS="lh13">
+ <B>License</B><BR><BR>
+
+ This JavaScript-library is <U>free for private and academic use</U>.
+ Please include a readable copyright statement and a backlink to <http://www.masswerk.at> in the
+ web page. The library should always be accompanied by the "readme.txt" and the sample HTML-documents.<BR><BR>
+
+ The term "private use" includes any personal or non-commercial use, which is not related
+ to commercial activites, but excludes intranet, extranet and/or public net applications
+ that are related to any kind of commercial or profit oriented activity.<BR><BR>
+
+ For commercial use see <<A HREF="http://www.masswerk.at/" TARGET="_blank">http://www.masswerk.at</A>> for contact information.
+ </TD></TR>
+ <TR><TD CLASS="lh13">
+ <B>Distribution</B><BR><BR>
+
+ This JavaScript-library may be distributed freely as long it is distributed together with the "readme.txt" and the sample HTML-documents and this document.<BR><BR>
+
+ Any changes to the library should be commented and be documented in the readme-file.<BR>
+ Any changes must be reflected in the `Terminal.version' string as "Version.Subversion (compatibility)".
+ </TD></TR>
+ <TR><TD CLASS="lh13">
+ <B>Disclaimer</B><BR><BR>
+
+ This software is distributed AS IS and in the hope that it will be useful, but WITHOUT ANY
+ WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE. The entire risk as to the quality and performance of the product is borne by the
+ user. No use of the product is authorized hereunder except under this disclaimer.
+ </TD></TR>
+ <TR><TD CLASS="lh13">
+ <B>History</B><BR><BR>
+
+ This library evolved from the terminal script "TermApp" ((c) N. Landsteiner 2003) and is in its
+ current form a down scaled spinn-off of the "JS/UIX" project. (JS/UIX is not a free software by now.)
+ c.f.: <<A HREF="http://www.masswerk.at/jsuix/" TARGET="_blank">http://www.masswerk.at/jsuix</A>><BR><BR>
+
+ For version history: see the <A HREF="readme.txt">readme.txt</A>.
+ </TD></TR>
+ <TR><TD CLASS="lh13">
+ <BR>
+ <B>Download</B><BR><BR>
+ Be sure to have read the license information and the disclamer and that you are willing to respect copyrights.<BR><BR>
+
+ <SPAN CLASS="prop">Download:</SPAN> <A HREF="termlib.zip">termlib.zip</A> (~ 40 KB, incl. docs)<BR><BR>
+ Current version is "1.07 (original)".<BR>
+ The files are now provided with line breaks in format <CRLF>.<BR>
+
+ </TD></TR>
+ <TR><TD CLASS="lh13">
+ <B>Author</B><BR><BR>
+ © Norbert Landsteiner 2003-2005<BR>
+ mass:werk – media environments<BR>
+ <A HREF="http://www.masswerk.at/" TARGET="_blank">http://www.masswerk.at</A>
+ </TD></TR>
+ <TR><TD CLASS="lh13">
+ <BR>
+ Author's note:<BR>
+ Please do not contact me on questions of simple usage. There is an extensive documentation (readme.txt) including plenty of sample code that should provide all information you need.
+ </TD></TR>
+ <TR><TD CLASS="lh13">
+ <BR>
+ <A HREF="#top">> top of page</A>
+ </TD></TR>
+ <TR><TD CLASS="lh13">
+
+ </TD></TR>
+</TABLE>
+
+<DIV ID="termDiv" STYLE="position:absolute; top:20px; left:100px;"></DIV>
+
+</BODY>
</HTML>
\ No newline at end of file
-<HTML>\r
-<HEAD>\r
- <TITLE>termlib Multiple Terminal Test</TITLE>\r
- <SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript" SRC="termlib.js"></SCRIPT>\r
-\r
-<SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">\r
-<!--\r
-\r
-/*\r
- multiple terminal test for termlib.js\r
-\r
- (c) Norbert Landsteiner 2003-2005\r
- mass:werk - media environments\r
- <http://www.masswerk.at>\r
-\r
-*/\r
-\r
-var term=new Array();\r
-\r
-var helpPage=[\r
- '%CS%+r Terminal Help %-r%n',\r
- ' This is just a tiny test for multiple terminals.',\r
- ' use one of the following commands:',\r
- ' clear .... clear the terminal',\r
- ' exit ..... close the terminal (or <ESC>)',\r
- ' id ....... show terminal\'s id',\r
- ' switch ... switch to other terminal',\r
- ' help ..... show this help page',\r
- ' other input will be echoed to the terminal.',\r
- ' '\r
-];\r
-\r
-function termOpen(n) {\r
- if (!term[n]) {\r
- var y=(n==1)? 70: 280;\r
- term[n]=new Terminal(\r
- {\r
- x: 220,\r
- y: y,\r
- rows: 12,\r
- greeting: '%+r +++ Terminal #'+n+' ready. +++ %-r%nType "help" for help.%n',\r
- id: n,\r
- termDiv: 'termDiv'+n,\r
- crsrBlinkMode: true,\r
- handler: termHandler,\r
- exitHandler: termExitHandler\r
- }\r
- );\r
- if (term[n]) term[n].open();\r
- }\r
- else if (term[n].closed) {\r
- term[n].open();\r
- }\r
- else {\r
- term[n].focus();\r
- }\r
-}\r
-\r
-function termHandler() {\r
- // called on <CR> or <ENTER>\r
- this.newLine();\r
- var cmd=this.lineBuffer;\r
- if (cmd!='') {\r
- if (cmd=='switch') {\r
- var other=(this.id==1)? 2:1;\r
- termOpen(other);\r
- }\r
- else if (cmd=='clear') {\r
- this.clear();\r
- }\r
- else if (cmd=='exit') {\r
- this.close();\r
- }\r
- else if (cmd=='help') {\r
- this.write(helpPage);\r
- }\r
- else if (cmd=='id') {\r
- this.write('terminal id: '+this.id);\r
- }\r
- else {\r
- this.type('You typed: '+cmd);\r
- this.newLine();\r
- }\r
- }\r
- this.prompt();\r
-}\r
-\r
-function termExitHandler() {\r
- // optional handler called on exit\r
- // activate other terminal if open\r
- var other=(this.id==1)? 2:1;\r
- if ((term[other]) && (term[other].closed==false)) term[other].focus();\r
-}\r
-\r
-//-->\r
-</SCRIPT>\r
-\r
-<STYLE TYPE="text/css">\r
-body,p,a,td {\r
- font-family: courier,fixed,swiss,sans-serif;\r
- font-size: 12px;\r
- color: #cccccc;\r
-}\r
-.lh15 {\r
- line-height: 15px;\r
-}\r
-.term {\r
- font-family: courier,fixed,swiss,sans-serif;\r
- font-size: 12px;\r
- color: #33d011;\r
- background: none;\r
-}\r
-.termReverse {\r
- color: #111111;\r
- background: #33d011;\r
-}\r
-a,a:link,a:visited {\r
- text-decoration: none;\r
- color: #77dd11;\r
-}\r
-a:hover {\r
- text-decoration: underline;\r
- color: #77dd11;\r
-}\r
-a:active {\r
- text-decoration: underline;\r
- color: #dddddd;\r
-}\r
-\r
-a.termopen,a.termopen:link,a.termopen:visited {\r
- text-decoration: none;\r
- color: #77dd11;\r
- background: none;\r
-}\r
-a.termopen:hover {\r
- text-decoration: none;\r
- color: #222222;\r
- background: #77dd11;\r
-}\r
-a.termopen:active {\r
- text-decoration: none;\r
- color: #222222;\r
- background: #dddddd;\r
-}\r
-\r
-</STYLE>\r
-</HEAD>\r
-\r
-\r
-<BODY BGCOLOR="#222222" LINK="#77dd11" TEXT="#cccccc" ALINK="#dddddd" VLINK="#77dd11"\r
-TOPMARGIN="0" BOTTOMMARGIN="0" LEFTMARGIN="0" RIGHTMARGIN="0" MARGINHEIGHT="0" MARGINWIDTH="0">\r
-\r
-<TABLE BORDER="0" CELLSPACING="20" CELLPADDING="0" ALIGN="center">\r
-<TR>\r
- <TD NOWRAP><A HREF="index.html">termlib.js home</A></TD>\r
- <TD>|</TD>\r
- <TD NOWRAP>multiple terminal test</TD>\r
- <TD>|</TD>\r
- <TD NOWRAP><A HREF="parser_sample.html">sample parser</A></TD>\r
- <TD>|</TD>\r
- <TD NOWRAP><A HREF="faq.html">faq</A></TD>\r
- <TD>|</TD>\r
- <TD NOWRAP><A HREF="readme.txt" TITLE="readme.txt (text/plain)">documentation</A></TD>\r
-</TR>\r
-</TABLE>\r
-\r
-<TABLE BORDER="0" CELLSPACING="20" CELLPADDING="0">\r
- <TR><TD NOWRAP>\r
- Multiple Terminal Test<BR> \r
- </TD></TR>\r
- <TR><TD NOWRAP>\r
- <A HREF="javascript:termOpen(1)" onfocus="if(this.blur)this.blur();" onmouseover="window.status='terminal 1'; return true" onmouseout="window.status=''; return true" CLASS="termopen">> open terminal 1 </A>\r
- </TD></TR>\r
- <TR><TD NOWRAP>\r
- <A HREF="javascript:termOpen(2)" onfocus="if(this.blur)this.blur();" onmouseover="window.status='terminal 2'; return true" onmouseout="window.status=''; return true" CLASS="termopen">> open terminal 2 </A>\r
- </TD></TR>\r
- <TR><TD NOWRAP CLASS="lh15">\r
- <BR>\r
- (c) mass:werk,<BR>N. Landsteiner 2003-2005<BR>\r
- <A HREF="http://www.masswerk.at/" TARGET="_blank">http://www.masswerk.at</A>\r
- </TD></TR>\r
-</TABLE>\r
-\r
-<DIV ID="termDiv1" STYLE="position:absolute; top:20px; left:100px;"></DIV>\r
-<DIV ID="termDiv2" STYLE="position:absolute; top:20px; left:100px;"></DIV>\r
-\r
-</BODY>\r
+<HTML>
+<HEAD>
+ <TITLE>termlib Multiple Terminal Test</TITLE>
+ <SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript" SRC="termlib.js"></SCRIPT>
+
+<SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
+<!--
+
+/*
+ multiple terminal test for termlib.js
+
+ (c) Norbert Landsteiner 2003-2005
+ mass:werk - media environments
+ <http://www.masswerk.at>
+
+*/
+
+var term=new Array();
+
+var helpPage=[
+ '%CS%+r Terminal Help %-r%n',
+ ' This is just a tiny test for multiple terminals.',
+ ' use one of the following commands:',
+ ' clear .... clear the terminal',
+ ' exit ..... close the terminal (or <ESC>)',
+ ' id ....... show terminal\'s id',
+ ' switch ... switch to other terminal',
+ ' help ..... show this help page',
+ ' other input will be echoed to the terminal.',
+ ' '
+];
+
+function termOpen(n) {
+ if (!term[n]) {
+ var y=(n==1)? 70: 280;
+ term[n]=new Terminal(
+ {
+ x: 220,
+ y: y,
+ rows: 12,
+ greeting: '%+r +++ Terminal #'+n+' ready. +++ %-r%nType "help" for help.%n',
+ id: n,
+ termDiv: 'termDiv'+n,
+ crsrBlinkMode: true,
+ handler: termHandler,
+ exitHandler: termExitHandler
+ }
+ );
+ if (term[n]) term[n].open();
+ }
+ else if (term[n].closed) {
+ term[n].open();
+ }
+ else {
+ term[n].focus();
+ }
+}
+
+function termHandler() {
+ // called on <CR> or <ENTER>
+ this.newLine();
+ var cmd=this.lineBuffer;
+ if (cmd!='') {
+ if (cmd=='switch') {
+ var other=(this.id==1)? 2:1;
+ termOpen(other);
+ }
+ else if (cmd=='clear') {
+ this.clear();
+ }
+ else if (cmd=='exit') {
+ this.close();
+ }
+ else if (cmd=='help') {
+ this.write(helpPage);
+ }
+ else if (cmd=='id') {
+ this.write('terminal id: '+this.id);
+ }
+ else {
+ this.type('You typed: '+cmd);
+ this.newLine();
+ }
+ }
+ this.prompt();
+}
+
+function termExitHandler() {
+ // optional handler called on exit
+ // activate other terminal if open
+ var other=(this.id==1)? 2:1;
+ if ((term[other]) && (term[other].closed==false)) term[other].focus();
+}
+
+//-->
+</SCRIPT>
+
+<STYLE TYPE="text/css">
+body,p,a,td {
+ font-family: courier,fixed,swiss,sans-serif;
+ font-size: 12px;
+ color: #cccccc;
+}
+.lh15 {
+ line-height: 15px;
+}
+.term {
+ font-family: courier,fixed,swiss,sans-serif;
+ font-size: 12px;
+ color: #33d011;
+ background: none;
+}
+.termReverse {
+ color: #111111;
+ background: #33d011;
+}
+a,a:link,a:visited {
+ text-decoration: none;
+ color: #77dd11;
+}
+a:hover {
+ text-decoration: underline;
+ color: #77dd11;
+}
+a:active {
+ text-decoration: underline;
+ color: #dddddd;
+}
+
+a.termopen,a.termopen:link,a.termopen:visited {
+ text-decoration: none;
+ color: #77dd11;
+ background: none;
+}
+a.termopen:hover {
+ text-decoration: none;
+ color: #222222;
+ background: #77dd11;
+}
+a.termopen:active {
+ text-decoration: none;
+ color: #222222;
+ background: #dddddd;
+}
+
+</STYLE>
+</HEAD>
+
+
+<BODY BGCOLOR="#222222" LINK="#77dd11" TEXT="#cccccc" ALINK="#dddddd" VLINK="#77dd11"
+TOPMARGIN="0" BOTTOMMARGIN="0" LEFTMARGIN="0" RIGHTMARGIN="0" MARGINHEIGHT="0" MARGINWIDTH="0">
+
+<TABLE BORDER="0" CELLSPACING="20" CELLPADDING="0" ALIGN="center">
+<TR>
+ <TD NOWRAP><A HREF="index.html">termlib.js home</A></TD>
+ <TD>|</TD>
+ <TD NOWRAP>multiple terminal test</TD>
+ <TD>|</TD>
+ <TD NOWRAP><A HREF="parser_sample.html">sample parser</A></TD>
+ <TD>|</TD>
+ <TD NOWRAP><A HREF="faq.html">faq</A></TD>
+ <TD>|</TD>
+ <TD NOWRAP><A HREF="readme.txt" TITLE="readme.txt (text/plain)">documentation</A></TD>
+</TR>
+</TABLE>
+
+<TABLE BORDER="0" CELLSPACING="20" CELLPADDING="0">
+ <TR><TD NOWRAP>
+ Multiple Terminal Test<BR>
+ </TD></TR>
+ <TR><TD NOWRAP>
+ <A HREF="javascript:termOpen(1)" onfocus="if(this.blur)this.blur();" onmouseover="window.status='terminal 1'; return true" onmouseout="window.status=''; return true" CLASS="termopen">> open terminal 1 </A>
+ </TD></TR>
+ <TR><TD NOWRAP>
+ <A HREF="javascript:termOpen(2)" onfocus="if(this.blur)this.blur();" onmouseover="window.status='terminal 2'; return true" onmouseout="window.status=''; return true" CLASS="termopen">> open terminal 2 </A>
+ </TD></TR>
+ <TR><TD NOWRAP CLASS="lh15">
+ <BR>
+ (c) mass:werk,<BR>N. Landsteiner 2003-2005<BR>
+ <A HREF="http://www.masswerk.at/" TARGET="_blank">http://www.masswerk.at</A>
+ </TD></TR>
+</TABLE>
+
+<DIV ID="termDiv1" STYLE="position:absolute; top:20px; left:100px;"></DIV>
+<DIV ID="termDiv2" STYLE="position:absolute; top:20px; left:100px;"></DIV>
+
+</BODY>
</HTML>
\ No newline at end of file
-<HTML>\r
-<HEAD>\r
- <TITLE>termlib Sample Parser</TITLE>\r
- <SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript" SRC="termlib.js"></SCRIPT>\r
- <SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript" SRC="termlib_parser.js"></SCRIPT>\r
-\r
-<SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">\r
-<!--\r
-\r
-/*\r
- test sample for termlib.js and termlib_parser.js\r
-\r
- (c) Norbert Landsteiner 2005\r
- mass:werk - media environments\r
- <http://www.masswerk.at>\r
-\r
-*/\r
-\r
-var term;\r
-\r
-var helpPage=[\r
- '%CS%+r Terminal Help %-r%n',\r
- ' This is just a sample to demonstrate command line parsing.',\r
- ' ',\r
- ' Use one of the following commands:',\r
- ' clear [-a] .......... clear the terminal',\r
- ' option "a" also removes the status line',\r
- ' number -n<value> .... return value of option "n" (test for options)',\r
- ' repeat -n<value> .... repeats the first argument n times (another test)',\r
- ' login <username> .... sample login (test for raw mode)',\r
- ' exit ................ close the terminal (same as <ESC>)',\r
- ' help ................ show this help page',\r
- ' ',\r
- ' other input will be echoed to the terminal as a list of parsed arguments',\r
- ' in the format <argument index> <quoting level> "<parsed value>".',\r
- ' '\r
-];\r
-\r
-function termOpen() {\r
- if (!term) {\r
- term=new Terminal(\r
- {\r
- x: 220,\r
- y: 70,\r
- termDiv: 'termDiv',\r
- ps: '[guest]$',\r
- initHandler: termInitHandler,\r
- handler: commandHandler\r
- }\r
- );\r
- if (term) term.open();\r
- }\r
- else if (term.closed) {\r
- term.open();\r
- }\r
- else {\r
- term.focus();\r
- }\r
-}\r
-\r
-function termInitHandler() {\r
- // output a start up screen\r
- this.write(\r
- [\r
- TermGlobals.center('####################################################', 80),\r
- TermGlobals.center('# #', 80),\r
- TermGlobals.center('# termlib.js - Sample Parser #', 80),\r
- TermGlobals.center('# Input is echoed as a list of parsed arguments. #', 80),\r
- TermGlobals.center('# #', 80),\r
- TermGlobals.center('# Type "help" for commands. #', 80),\r
- TermGlobals.center('# #', 80),\r
- TermGlobals.center('# (c) N. Landsteiner 2005; www.masswerk.at #', 80),\r
- TermGlobals.center('# #', 80),\r
- TermGlobals.center('####################################################', 80),\r
- '%n'\r
- ]\r
- );\r
- // set a double status line\r
- this.statusLine('', 8,2); // just a line of strike\r
- this.statusLine(' +++ This is just a test sample for command parsing. Type "help" for help. +++');\r
- this.maxLines -= 2;\r
- // and leave with prompt\r
- this.prompt();\r
-}\r
-\r
-function commandHandler() {\r
- this.newLine();\r
- // check for raw mode first (should not be parsed)\r
- if (this.rawMode) {\r
- if (this.env.getPassword) {\r
- // sample password handler (lineBuffer == stored username ?)\r
- if (this.lineBuffer == this.env.username) {\r
- this.user = this.env.username;\r
- this.ps = '['+this.user+']>';\r
- }\r
- else {\r
- this.type('Sorry.');\r
- }\r
- this.env.username = '';\r
- this.env.getPassword = false;\r
- }\r
- // leave in normal mode\r
- this.rawMode = false;\r
- this.prompt();\r
- return;\r
- }\r
- // normal command parsing\r
- // just call the termlib_parser with a reference of the calling Terminal instance\r
- // parsed arguments will be imported in this.argv,\r
- // quoting levels per argument in this.argQL (quoting character or empty)\r
- // cursor for arguments is this.argc (used by parserGetopt)\r
- // => see 'termlib_parse.js' for configuration and details\r
- parseLine(this);\r
- if (this.argv.length == 0) {\r
- // no commmand line input\r
- }\r
- else if (this.argQL[0]) {\r
- // first argument quoted -> error\r
- this.write("Syntax error: first argument quoted.");\r
- }\r
- else {\r
- var cmd = this.argv[this.argc++];\r
- /*\r
- process commands now\r
- 1st argument: this.argv[this.argc]\r
- */\r
- if (cmd == 'help') {\r
- this.write(helpPage);\r
- }\r
- else if (cmd == 'clear') {\r
- // get options\r
- var opts = parserGetopt(this, 'aA');\r
- if (opts.a) {\r
- // discard status line on opt "a" or "A"\r
- this.maxLines = this.conf.rows;\r
- }\r
- this.clear();\r
- }\r
- else if (cmd == 'number') {\r
- // test for value options\r
- var opts = parserGetopt(this, 'n');\r
- if (opts.illegals.length) this.type('illegal option. usage: number -n<value>')\r
- else if ((opts.n) && (opts.n.value != -1)) this.type('option value: '+opts.n.value)\r
- else this.type('usage: number -n<value>');\r
- }\r
- else if (cmd == 'repeat') {\r
- // another test for value options\r
- var opts = parserGetopt(this, 'n');\r
- if (opts.illegals.length) this.type('illegal option. usage: repeat -n<value> <string>')\r
- else if ((opts.n) && (opts.n.value != -1)) {\r
- // first normal argument is again this.argv[this.argc]\r
- var s = this.argv[this.argc];\r
- if (typeof s != 'undefined') {\r
- // repeat this string n times\r
- var a = [];\r
- for (var i=0; i<opts.n.value; i++) a[a.length] = s;\r
- this.type(a.join(' '));\r
- }\r
- }\r
- else this.type('usage: repeat -n<value> <string>');\r
- }\r
- else if (cmd == 'login') {\r
- // sample login (test for raw mode)\r
- if ((this.argc == this.argv.length) || (this.argv[this.argc] == '')) {\r
- this.type('usage: login <username>');\r
- }\r
- else {\r
- this.env.getPassword = true;\r
- this.env.username = this.argv[this.argc];\r
- this.write('%+iSample login: repeat username as password.%-i%n');\r
- this.type('password: ');\r
- // exit in raw mode (blind input)\r
- this.rawMode = true;\r
- this.lock = false;\r
- return;\r
- }\r
- }\r
- else if (cmd == 'exit') {\r
- this.close();\r
- return;\r
- }\r
- else {\r
- // for test purpose just output argv as list\r
- // assemble a string of style-escaped lines and output it in more-mode\r
- s=' INDEX QL ARGUMENT%n';\r
- for (var i=0; i<this.argv.length; i++) {\r
- s += TermGlobals.stringReplace('%', '%%',\r
- TermGlobals.fillLeft(i, 6) +\r
- TermGlobals.fillLeft((this.argQL[i])? this.argQL[i]:'-', 4) +\r
- ' "' + this.argv[i] + '"'\r
- ) + '%n';\r
- }\r
- this.write(s, 1);\r
- return;\r
- }\r
- }\r
- this.prompt();\r
-}\r
-\r
-\r
-//-->\r
-</SCRIPT>\r
-\r
-<STYLE TYPE="text/css">\r
-body,p,a,td {\r
- font-family: courier,fixed,swiss,sans-serif;\r
- font-size: 12px;\r
- color: #cccccc;\r
-}\r
-.lh15 {\r
- line-height: 15px;\r
-}\r
-.term {\r
- font-family: courier,fixed,swiss,sans-serif;\r
- font-size: 12px;\r
- color: #33d011;\r
- background: none;\r
-}\r
-.termReverse {\r
- color: #111111;\r
- background: #33d011;\r
-}\r
-a,a:link,a:visited {\r
- text-decoration: none;\r
- color: #77dd11;\r
-}\r
-a:hover {\r
- text-decoration: underline;\r
- color: #77dd11;\r
-}\r
-a:active {\r
- text-decoration: underline;\r
- color: #dddddd;\r
-}\r
-\r
-a.termopen,a.termopen:link,a.termopen:visited {\r
- text-decoration: none;\r
- color: #77dd11;\r
- background: none;\r
-}\r
-a.termopen:hover {\r
- text-decoration: none;\r
- color: #222222;\r
- background: #77dd11;\r
-}\r
-a.termopen:active {\r
- text-decoration: none;\r
- color: #222222;\r
- background: #dddddd;\r
-}\r
-\r
-</STYLE>\r
-</HEAD>\r
-\r
-\r
-<BODY BGCOLOR="#222222" LINK="#77dd11" TEXT="#cccccc" ALINK="#dddddd" VLINK="#77dd11"\r
-TOPMARGIN="0" BOTTOMMARGIN="0" LEFTMARGIN="0" RIGHTMARGIN="0" MARGINHEIGHT="0" MARGINWIDTH="0">\r
-\r
-<TABLE BORDER="0" CELLSPACING="20" CELLPADDING="0" ALIGN="center">\r
-<TR>\r
- <TD NOWRAP><A HREF="index.html">termlib.js home</A></TD>\r
- <TD>|</TD>\r
- <TD NOWRAP><A HREF="multiterm_test.html">multiple terminal test</A></TD>\r
- <TD>|</TD>\r
- <TD NOWRAP>sample parser</TD>\r
- <TD>|</TD>\r
- <TD NOWRAP><A HREF="faq.html">faq</A></TD>\r
- <TD>|</TD>\r
- <TD NOWRAP><A HREF="readme.txt" TITLE="readme.txt (text/plain)">documentation</A></TD>\r
-</TR>\r
-</TABLE>\r
-\r
-<TABLE BORDER="0" CELLSPACING="20" CELLPADDING="0">\r
- <TR><TD NOWRAP>\r
- Sample Parser Test<BR> \r
- </TD></TR>\r
- <TR><TD NOWRAP>\r
- <A HREF="javascript:termOpen()" onfocus="if(this.blur)this.blur();" onmouseover="window.status='terminal 1'; return true" onmouseout="window.status=''; return true" CLASS="termopen">> open terminal </A>\r
- </TD></TR>\r
- <TR><TD NOWRAP>\r
- \r
- </TD></TR>\r
- <TR><TD NOWRAP CLASS="lh15">\r
- <BR>\r
- (c) mass:werk,<BR>N. Landsteiner 2003-2005<BR>\r
- <A HREF="http://www.masswerk.at/" TARGET="_blank">http://www.masswerk.at</A>\r
- </TD></TR>\r
-</TABLE>\r
-\r
-<DIV ID="termDiv" STYLE="position:absolute;"></DIV>\r
-\r
-</BODY>\r
+<HTML>
+<HEAD>
+ <TITLE>termlib Sample Parser</TITLE>
+ <SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript" SRC="termlib.js"></SCRIPT>
+ <SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript" SRC="termlib_parser.js"></SCRIPT>
+
+<SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
+<!--
+
+/*
+ test sample for termlib.js and termlib_parser.js
+
+ (c) Norbert Landsteiner 2005
+ mass:werk - media environments
+ <http://www.masswerk.at>
+
+*/
+
+var term;
+
+var helpPage=[
+ '%CS%+r Terminal Help %-r%n',
+ ' This is just a sample to demonstrate command line parsing.',
+ ' ',
+ ' Use one of the following commands:',
+ ' clear [-a] .......... clear the terminal',
+ ' option "a" also removes the status line',
+ ' number -n<value> .... return value of option "n" (test for options)',
+ ' repeat -n<value> .... repeats the first argument n times (another test)',
+ ' login <username> .... sample login (test for raw mode)',
+ ' exit ................ close the terminal (same as <ESC>)',
+ ' help ................ show this help page',
+ ' ',
+ ' other input will be echoed to the terminal as a list of parsed arguments',
+ ' in the format <argument index> <quoting level> "<parsed value>".',
+ ' '
+];
+
+function termOpen() {
+ if (!term) {
+ term=new Terminal(
+ {
+ x: 220,
+ y: 70,
+ termDiv: 'termDiv',
+ ps: '[guest]$',
+ initHandler: termInitHandler,
+ handler: commandHandler
+ }
+ );
+ if (term) term.open();
+ }
+ else if (term.closed) {
+ term.open();
+ }
+ else {
+ term.focus();
+ }
+}
+
+function termInitHandler() {
+ // output a start up screen
+ this.write(
+ [
+ TermGlobals.center('####################################################', 80),
+ TermGlobals.center('# #', 80),
+ TermGlobals.center('# termlib.js - Sample Parser #', 80),
+ TermGlobals.center('# Input is echoed as a list of parsed arguments. #', 80),
+ TermGlobals.center('# #', 80),
+ TermGlobals.center('# Type "help" for commands. #', 80),
+ TermGlobals.center('# #', 80),
+ TermGlobals.center('# (c) N. Landsteiner 2005; www.masswerk.at #', 80),
+ TermGlobals.center('# #', 80),
+ TermGlobals.center('####################################################', 80),
+ '%n'
+ ]
+ );
+ // set a double status line
+ this.statusLine('', 8,2); // just a line of strike
+ this.statusLine(' +++ This is just a test sample for command parsing. Type "help" for help. +++');
+ this.maxLines -= 2;
+ // and leave with prompt
+ this.prompt();
+}
+
+function commandHandler() {
+ this.newLine();
+ // check for raw mode first (should not be parsed)
+ if (this.rawMode) {
+ if (this.env.getPassword) {
+ // sample password handler (lineBuffer == stored username ?)
+ if (this.lineBuffer == this.env.username) {
+ this.user = this.env.username;
+ this.ps = '['+this.user+']>';
+ }
+ else {
+ this.type('Sorry.');
+ }
+ this.env.username = '';
+ this.env.getPassword = false;
+ }
+ // leave in normal mode
+ this.rawMode = false;
+ this.prompt();
+ return;
+ }
+ // normal command parsing
+ // just call the termlib_parser with a reference of the calling Terminal instance
+ // parsed arguments will be imported in this.argv,
+ // quoting levels per argument in this.argQL (quoting character or empty)
+ // cursor for arguments is this.argc (used by parserGetopt)
+ // => see 'termlib_parse.js' for configuration and details
+ parseLine(this);
+ if (this.argv.length == 0) {
+ // no commmand line input
+ }
+ else if (this.argQL[0]) {
+ // first argument quoted -> error
+ this.write("Syntax error: first argument quoted.");
+ }
+ else {
+ var cmd = this.argv[this.argc++];
+ /*
+ process commands now
+ 1st argument: this.argv[this.argc]
+ */
+ if (cmd == 'help') {
+ this.write(helpPage);
+ }
+ else if (cmd == 'clear') {
+ // get options
+ var opts = parserGetopt(this, 'aA');
+ if (opts.a) {
+ // discard status line on opt "a" or "A"
+ this.maxLines = this.conf.rows;
+ }
+ this.clear();
+ }
+ else if (cmd == 'number') {
+ // test for value options
+ var opts = parserGetopt(this, 'n');
+ if (opts.illegals.length) this.type('illegal option. usage: number -n<value>')
+ else if ((opts.n) && (opts.n.value != -1)) this.type('option value: '+opts.n.value)
+ else this.type('usage: number -n<value>');
+ }
+ else if (cmd == 'repeat') {
+ // another test for value options
+ var opts = parserGetopt(this, 'n');
+ if (opts.illegals.length) this.type('illegal option. usage: repeat -n<value> <string>')
+ else if ((opts.n) && (opts.n.value != -1)) {
+ // first normal argument is again this.argv[this.argc]
+ var s = this.argv[this.argc];
+ if (typeof s != 'undefined') {
+ // repeat this string n times
+ var a = [];
+ for (var i=0; i<opts.n.value; i++) a[a.length] = s;
+ this.type(a.join(' '));
+ }
+ }
+ else this.type('usage: repeat -n<value> <string>');
+ }
+ else if (cmd == 'login') {
+ // sample login (test for raw mode)
+ if ((this.argc == this.argv.length) || (this.argv[this.argc] == '')) {
+ this.type('usage: login <username>');
+ }
+ else {
+ this.env.getPassword = true;
+ this.env.username = this.argv[this.argc];
+ this.write('%+iSample login: repeat username as password.%-i%n');
+ this.type('password: ');
+ // exit in raw mode (blind input)
+ this.rawMode = true;
+ this.lock = false;
+ return;
+ }
+ }
+ else if (cmd == 'exit') {
+ this.close();
+ return;
+ }
+ else {
+ // for test purpose just output argv as list
+ // assemble a string of style-escaped lines and output it in more-mode
+ s=' INDEX QL ARGUMENT%n';
+ for (var i=0; i<this.argv.length; i++) {
+ s += TermGlobals.stringReplace('%', '%%',
+ TermGlobals.fillLeft(i, 6) +
+ TermGlobals.fillLeft((this.argQL[i])? this.argQL[i]:'-', 4) +
+ ' "' + this.argv[i] + '"'
+ ) + '%n';
+ }
+ this.write(s, 1);
+ return;
+ }
+ }
+ this.prompt();
+}
+
+
+//-->
+</SCRIPT>
+
+<STYLE TYPE="text/css">
+body,p,a,td {
+ font-family: courier,fixed,swiss,sans-serif;
+ font-size: 12px;
+ color: #cccccc;
+}
+.lh15 {
+ line-height: 15px;
+}
+.term {
+ font-family: courier,fixed,swiss,sans-serif;
+ font-size: 12px;
+ color: #33d011;
+ background: none;
+}
+.termReverse {
+ color: #111111;
+ background: #33d011;
+}
+a,a:link,a:visited {
+ text-decoration: none;
+ color: #77dd11;
+}
+a:hover {
+ text-decoration: underline;
+ color: #77dd11;
+}
+a:active {
+ text-decoration: underline;
+ color: #dddddd;
+}
+
+a.termopen,a.termopen:link,a.termopen:visited {
+ text-decoration: none;
+ color: #77dd11;
+ background: none;
+}
+a.termopen:hover {
+ text-decoration: none;
+ color: #222222;
+ background: #77dd11;
+}
+a.termopen:active {
+ text-decoration: none;
+ color: #222222;
+ background: #dddddd;
+}
+
+</STYLE>
+</HEAD>
+
+
+<BODY BGCOLOR="#222222" LINK="#77dd11" TEXT="#cccccc" ALINK="#dddddd" VLINK="#77dd11"
+TOPMARGIN="0" BOTTOMMARGIN="0" LEFTMARGIN="0" RIGHTMARGIN="0" MARGINHEIGHT="0" MARGINWIDTH="0">
+
+<TABLE BORDER="0" CELLSPACING="20" CELLPADDING="0" ALIGN="center">
+<TR>
+ <TD NOWRAP><A HREF="index.html">termlib.js home</A></TD>
+ <TD>|</TD>
+ <TD NOWRAP><A HREF="multiterm_test.html">multiple terminal test</A></TD>
+ <TD>|</TD>
+ <TD NOWRAP>sample parser</TD>
+ <TD>|</TD>
+ <TD NOWRAP><A HREF="faq.html">faq</A></TD>
+ <TD>|</TD>
+ <TD NOWRAP><A HREF="readme.txt" TITLE="readme.txt (text/plain)">documentation</A></TD>
+</TR>
+</TABLE>
+
+<TABLE BORDER="0" CELLSPACING="20" CELLPADDING="0">
+ <TR><TD NOWRAP>
+ Sample Parser Test<BR>
+ </TD></TR>
+ <TR><TD NOWRAP>
+ <A HREF="javascript:termOpen()" onfocus="if(this.blur)this.blur();" onmouseover="window.status='terminal 1'; return true" onmouseout="window.status=''; return true" CLASS="termopen">> open terminal </A>
+ </TD></TR>
+ <TR><TD NOWRAP>
+
+ </TD></TR>
+ <TR><TD NOWRAP CLASS="lh15">
+ <BR>
+ (c) mass:werk,<BR>N. Landsteiner 2003-2005<BR>
+ <A HREF="http://www.masswerk.at/" TARGET="_blank">http://www.masswerk.at</A>
+ </TD></TR>
+</TABLE>
+
+<DIV ID="termDiv" STYLE="position:absolute;"></DIV>
+
+</BODY>
</HTML>
\ No newline at end of file
! Random workload from 1 to 100msecs
100 random 1 +
dup [ + ] dip
- [ pick ] dip "%d" sprintf >byte-array 0 zmq-send
+ pickd "%d" sprintf >byte-array 0 zmq-send
] times
"Total expected cost: %d msec\n" printf
syn match factorExecute /\<execute(\s\+\(\S*\s\+\)*--\(\s\+\S*\)*\s\+)\>/ contained contains=factorStackEffect
syn keyword factorCallNextMethod call-next-method
-syn keyword factorKeyword (clone) -rot 2bi 2bi* 2bi@ 2curry 2dip 2drop 2dup 2keep 2nip 2over 2tri 2tri* 2tri@ 2with 3bi 3curry 3dip 3drop 3dup 3keep 3tri 4dip 4drop 4dup 4keep <wrapper> = >boolean ? ?if and assert assert= assert? bi bi* bi-curry bi-curry* bi-curry@ bi@ boa boolean boolean? both? build call callstack callstack>array callstack? clear clone compose composed composed? curried curried? curry die dip do drop dup dupd either? eq? equal? execute get-callstack get-datastack get-retainstack hashcode hashcode* identity-hashcode identity-tuple identity-tuple? if if* keep loop most new nip not null object or over pick prepose rot same? swap swapd throw tri tri* tri-curry tri-curry* tri-curry@ tri@ tuple tuple? unless unless* until when when* while with wrapper wrapper? xor
+syn keyword factorKeyword (clone) -roll -rot -rotd 2bi 2bi* 2bi@ 2curry 2dip 2drop 2dup 2keep 2keepd 2nip 2nipd 2over 2tri 2tri* 2tri@ 2with 3bi 3curry 3dip 3drop 3dup 3keep 3nip 3nipd 3tri 4dip 4drop 4dup 4keep 4nip 5drop 5nip <wrapper> = >boolean ? ?if and assert assert= assert? bi bi* bi-curry bi-curry* bi-curry@ bi@ boa boolean boolean? both? build call callstack callstack>array callstack? clear clone compose composed composed? curried curried? curry die dip do drop dup dupd either? eq? equal? execute get-callstack get-datastack get-retainstack hashcode hashcode* identity-hashcode identity-tuple identity-tuple? if if* keep keepd keepdd loop most new nip nipd not null object or over overd pick pickd prepose reach roll rot rotd same? spin swap swapd throw tri tri* tri-curry tri-curry* tri-curry@ tri@ tuck tuple tuple? unless unless* until when when* while with wrapper wrapper? xor
syn keyword factorKeyword 2cache <enumerated> >alist ?at ?of assoc assoc-all? assoc-any? assoc-clone-like assoc-combine assoc-diff assoc-diff! assoc-differ assoc-each assoc-empty? assoc-filter assoc-filter! assoc-filter-as assoc-find assoc-hashcode assoc-intersect assoc-like assoc-map assoc-map-as assoc-partition assoc-refine assoc-reject assoc-reject! assoc-reject-as assoc-size assoc-stack assoc-subset? assoc-union assoc-union! assoc-union-as assoc= assoc>map assoc? at at* at+ cache change-at clear-assoc collect-by delete-at delete-at* enumerated enumerated? extract-keys harvest-keys harvest-values inc-at key? keys map>alist map>assoc maybe-set-at new-assoc of push-at rename-at set-at sift-keys sift-values substitute unzip value-at value-at* value? values zip zip-as zip-index zip-index-as
syn keyword factorKeyword 2cleave 2cleave>quot 3cleave 3cleave>quot 4cleave 4cleave>quot alist>quot call-effect case case-find case>quot cleave cleave>quot cond cond>quot deep-spread>quot execute-effect linear-case-quot no-case no-case? no-cond no-cond? recursive-hashcode shallow-spread>quot spread to-fixed-point wrong-values wrong-values?
syn keyword factorKeyword (all-integers?) (each-integer) (find-integer) * + - / /f /i /mod 2/ 2^ < <= <fp-nan> > >= >bignum >fixnum >float >fraction >integer >rect ?1+ abs align all-integers? bignum bignum? bit? bitand bitnot bitor bits>double bits>float bitxor complex complex? denominator double>bits each-integer even? find-integer find-last-integer fixnum fixnum? float float>bits float? fp-bitwise= fp-infinity? fp-nan-payload fp-nan? fp-qnan? fp-sign fp-snan? fp-special? gcd if-zero imaginary-part integer integer>fixnum integer>fixnum-strict integer? log2 log2-expects-positive log2-expects-positive? mod neg neg? next-float next-power-of-2 number number= number? numerator odd? power-of-2? prev-float ratio ratio? rational rational? real real-part real? recip rect> rem sgn shift simple-gcd sq times u< u<= u> u>= unless-zero unordered? when-zero zero?