]> gitweb.factorcode.org Git - factor.git/commitdiff
core: Add the shuffler words but without primitives.
authorDoug Coleman <doug.coleman@gmail.com>
Wed, 20 Jun 2018 00:15:05 +0000 (19:15 -0500)
committerDoug Coleman <doug.coleman@gmail.com>
Wed, 20 Jun 2018 03:52:58 +0000 (22:52 -0500)
The nipd branch slowed bootstrap by a minute, this patch does not.

sorry about changing the fjsc line endings...

153 files changed:
basis/alien/libraries/libraries.factor
basis/calendar/parser/parser.factor
basis/checksums/ripemd/ripemd.factor
basis/checksums/sha/sha-tests.factor
basis/classes/struct/struct.factor
basis/compiler/cfg/linear-scan/assignment/assignment.factor
basis/compiler/cfg/stacks/local/local-tests.factor
basis/compiler/cfg/stacks/stacks.factor
basis/compiler/cfg/value-numbering/simd/simd.factor
basis/compiler/tests/alien.factor
basis/compiler/tree/propagation/simd/simd.factor
basis/compression/snappy/snappy.factor
basis/compression/zlib/zlib.factor
basis/cpu/ppc/assembler/assembler.factor
basis/cpu/x86/assembler/assembler.factor
basis/cpu/x86/x86.factor
basis/csv/csv.factor
basis/db/postgresql/lib/lib.factor
basis/formatting/formatting.factor
basis/fry/fry.factor
basis/furnace/chloe-tags/chloe-tags.factor
basis/game/input/dinput/dinput.factor
basis/game/input/gtk/gtk.factor
basis/game/input/x11/x11.factor
basis/grouping/grouping.factor
basis/heaps/heaps.factor
basis/help/lint/checks/checks.factor
basis/inverse/inverse.factor
basis/io/backend/unix/multiplexers/epoll/epoll.factor
basis/io/buffers/buffers.factor
basis/io/encodings/utf32/utf32.factor
basis/io/files/windows/windows.factor
basis/io/ports/ports.factor
basis/io/sockets/secure/openssl/openssl.factor
basis/io/sockets/unix/unix.factor
basis/io/sockets/windows/windows.factor
basis/libc/macosx/macosx.factor
basis/libc/windows/windows.factor
basis/logging/logging.factor
basis/math/combinatorics/combinatorics.factor
basis/math/functions/functions.factor
basis/math/matrices/elimination/elimination.factor
basis/math/partial-dispatch/partial-dispatch.factor
basis/math/statistics/statistics.factor
basis/math/vectors/simd/intrinsics/intrinsics.factor
basis/opengl/shaders/shaders.factor
basis/opengl/textures/textures.factor
basis/peg/peg.factor
basis/persistent/vectors/vectors.factor
basis/regexp/regexp.factor
basis/sequences/generalizations/generalizations-tests.factor
basis/sequences/generalizations/generalizations.factor
basis/sequences/merged/merged.factor
basis/sequences/parser/parser.factor
basis/sequences/unrolled/unrolled.factor
basis/sequences/windowed/windowed.factor
basis/shuffle/shuffle-docs.factor [deleted file]
basis/shuffle/shuffle-tests.factor
basis/shuffle/shuffle.factor
basis/stack-checker/known-words/known-words.factor
basis/stack-checker/stack-checker-tests.factor
basis/tools/deploy/backend/backend.factor
basis/ui/backend/windows/windows.factor
basis/unicode/normalize/normalize.factor
basis/windows/directx/dinput/constants/constants.factor
basis/windows/iphlpapi/iphlpapi.factor
basis/xml/tests/xmltest/canonxml.html
basis/xml/tests/xmltest/readme.html
basis/xml/tokenize/tokenize.factor
basis/xmode/catalog/catalog.factor
core/alien/strings/strings.factor
core/assocs/assocs.factor
core/classes/tuple/parser/parser.factor
core/classes/tuple/tuple.factor
core/effects/effects.factor
core/effects/parser/parser.factor
core/generic/generic.factor
core/growable/growable.factor
core/hash-sets/hash-sets.factor
core/hashtables/hashtables.factor
core/io/encodings/encodings.factor
core/io/encodings/utf16/utf16.factor
core/io/io.factor
core/io/streams/byte-array/byte-array.factor
core/io/streams/c/c.factor
core/io/streams/sequence/sequence.factor
core/kernel/kernel-docs.factor
core/kernel/kernel-tests.factor
core/kernel/kernel.factor
core/math/math.factor
core/math/parser/parser.factor
core/sequences/sequences.factor
core/slots/slots.factor
core/strings/strings.factor
core/words/words.factor
extra/alien/fortran/fortran.factor
extra/assocs/extras/extras.factor
extra/bloom-filters/bloom-filters.factor
extra/checksums/sodium/sodium.factor
extra/combinators/extras/extras.factor
extra/compiler/cfg/gvn/simd/simd.factor
extra/cpu/8080/test/test.factor
extra/crypto/aes/utils/utils.factor
extra/cuda/devices/devices.factor
extra/cursors/cursors.factor
extra/euler/b-rep/b-rep.factor
extra/fluids/fluids.factor
extra/game/models/collada/collada.factor
extra/gml/coremath/coremath.factor
extra/gpu/render/render.factor
extra/html/parser/utils/utils.factor
extra/imap/imap.factor
extra/io/files/trash/unix/unix.factor
extra/irc/messages/base/base.factor
extra/jamshred/player/player.factor
extra/ldcache/ldcache.factor
extra/lint/lint.factor
extra/math/combinatorics/bits/bits.factor
extra/math/dual/dual.factor
extra/math/similarity/similarity.factor
extra/midi/midi.factor
extra/model-viewer/model-viewer.factor
extra/mongodb/tuple/persistent/persistent.factor
extra/multi-methods/multi-methods.factor
extra/multi-methods/tests/definitions.factor
extra/noise/noise.factor
extra/openal/alut/alut.factor
extra/openal/alut/macosx/macosx.factor
extra/openal/alut/other/other.factor
extra/opencl/opencl.factor
extra/opengl/demo-support/demo-support.factor
extra/pair-methods/pair-methods.factor
extra/pcre/pcre.factor
extra/pdf/layout/layout.factor
extra/project-euler/002/002.factor
extra/project-euler/009/009.factor
extra/python/python.factor
extra/rosetta-code/bulls-and-cows/bulls-and-cows.factor
extra/rosetta-code/raycasting/raycasting.factor
extra/sequences/extras/extras.factor
extra/shell/parser/parser.factor
extra/taxes/usa/federal/federal.factor
extra/tetris/gl/gl.factor
extra/tokyo/assoc-functor/assoc-functor.factor
extra/trees/avl/avl.factor
extra/trees/trees.factor
extra/ui/gadgets/charts/lines/lines.factor
extra/webapps/fjsc/www/termlib/faq.html
extra/webapps/fjsc/www/termlib/index.html
extra/webapps/fjsc/www/termlib/multiterm_test.html
extra/webapps/fjsc/www/termlib/parser_sample.html
extra/zeromq/examples/taskvent.factor
misc/vim/syntax/factor.vim

index 2365e0ee426100ceafdd439ba1d149a2380acab8..a176e106e4107e80ef2539b930b6088371df6aac 100755 (executable)
@@ -65,7 +65,7 @@ M: library dispose dll>> [ dispose ] when* ;
 : 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 ;
 
index b61ec74fb0b6d1524515fcb3a1825d25f2f010a3..648115a1fbda76901707900f7d0dc59f6cdb6070 100644 (file)
@@ -104,7 +104,7 @@ CONSTANT: rfc822-named-zones H{
     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> ;
 
@@ -120,7 +120,7 @@ CONSTANT: rfc822-named-zones H{
     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> ;
 
index b5f05b57ccf57a0d317c662da18251b2d0efc94c..dde039c792b74ebdacb4f2c116207fed0871d2f4 100644 (file)
@@ -39,7 +39,7 @@ M: ripemd-160 initialize-checksum-state drop <ripemd-160-state> ;
 : 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
index ef211821d6ae671cb6ca9e6bc6ad86e62afc6e1d..8ef558bb0b9169c6366622c66849cb1cd5c4e899 100644 (file)
@@ -84,7 +84,7 @@ CONSTANT: bytes-b B{ 1 2 3 4 5 6 7 8 }
 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 ;
index e09b3ddfed8a9ae5dc0c9f014b6859a23e94e2ed..5a39fb607ea01bad120e1895177dbbcb47a6bc6b 100644 (file)
@@ -135,7 +135,7 @@ PRIVATE>
 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
 
@@ -262,7 +262,7 @@ M: struct binary-zero? binary-object uchar <c-direct-array> [ 0 = ] all? ; inlin
         [
             [ 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 ;
 
index 345d11b567522b079caa6a1d5af884c7eca2473e..b5ffb4d0eee653bccfa38985fff6c08437457fe7 100644 (file)
@@ -102,7 +102,7 @@ RENAMING: assign [ vreg>reg ] [ vreg>reg ] [ vreg>reg ]
     } 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 -- ? )
index 6f5ac9c81eed1b5fefa1e5ff514b482a0c2cc2b7..83135d186dcde7bb8ad2401d06ad27fc93facc39 100644 (file)
@@ -146,7 +146,7 @@ IN: compiler.cfg.stacks.local.tests
 : my-new-key4 ( a i j -- i/j )
     2over
     slot
-    swap over
+    tuck
     ! a i el j el
     [
         ! a i el j
index 9b6e3aef994c119685dc794ee437d5e61eb5ee27..3dcf5bd5254884bf27063ba06b25e35c66698b9c 100644 (file)
@@ -21,7 +21,7 @@ IN: compiler.cfg.stacks
     } 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 ;
index 1c0e8ac88ce9cbd57c6cf78241d211ffd39f368c..adff45b5e550bc10908fd361e028eadd10b4d184 100644 (file)
@@ -85,8 +85,8 @@ M: ##gather-int-vector-2 rewrite rewrite-gather-vector-2 ;
 : 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 ;
index 08fdcf87611768b12b78d38eea45708c4b3bbccd..3e4f1490776889ff8bfb0fb791766f2aa2ce5fa8 100755 (executable)
@@ -151,7 +151,7 @@ unit-test
 
 : 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 ;
 
@@ -917,11 +917,11 @@ FUNCTION: void* bug1021_test_1 ( void* s, int x )
     ] [ 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 ;
 
index dc4b852017d8c707c658841108b02da9733cec5e..5e0ab5a94f1d0ff19b327012f5a2251a02521caf 100644 (file)
@@ -124,7 +124,7 @@ vector>vector-intrinsics [ { byte-array } "default-output-classes" set-word-prop
 
 : 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 ]
index 590c9d4b713725f535c2e4878020f95044cf29cd..5437897f3259eb666becbdb35f1325e27c6b9180 100644 (file)
@@ -29,4 +29,4 @@ PRIVATE>
     [ 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 ;
index f258097a5c697204c5e292ebe9dfb5eb455c62b9..1fb31cc54b519da9e7736b1d5a231ed52506270c 100644 (file)
@@ -37,7 +37,7 @@ ERROR: zlib-failed n string ;
         [ <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 )
     [
@@ -53,15 +53,13 @@ ERROR: zlib-failed n string ;
 
 
 : 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 ;
@@ -73,6 +71,4 @@ ERROR: zlib-failed n string ;
     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 ;
index 36f737154aa05c60866a1ffce7c248d979d99f31..9d37f1cdd6525feeb5bd691628bc7715dca5b311 100644 (file)
@@ -1949,8 +1949,8 @@ tri* 134 1 63 x-insn ;
 : 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 ;
index 2d5b77fd73909e566c0fc7eb407985376d2eddc2..1670db2f59f0d9e0e487cb7d7cca8b2b42b29b47 100644 (file)
@@ -147,7 +147,7 @@ M: register displacement, drop ;
 : 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 ;
index 6a6e5dca3fce3284ddb8c5dc2843e481d7874b91..e823ad72b5ca96eea2d2017d716eee63e62f79d2 100644 (file)
@@ -409,7 +409,7 @@ M: x86 %convert-integer ( dst src c-type -- )
             { 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) ;
index fb34233c64b6fe74a1631bde6b120365ff789c84..bf42a0a6eb24c1316eac2c9daeb330d7eb9b9c37 100644 (file)
@@ -17,7 +17,7 @@ MEMO: field-delimiters ( delimiter -- field-seps quote-seps )
 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, ] }
@@ -42,12 +42,12 @@ DEFER: 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
@@ -61,7 +61,7 @@ DEFER: quoted-field,
 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 )
index d4ad6dd18a8a653aa360c4fef1991736b8558a0b..5a51dc0e12fb1165c5ca47c3cd96c162146181ca 100644 (file)
@@ -118,7 +118,7 @@ M: postgresql-result-null summary ( obj -- str )
 
 : 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 ;
@@ -135,7 +135,7 @@ M: postgresql-malloc-destructor dispose ( obj -- )
 : pq-get-blob ( handle row column -- obj/f )
     [ PQgetvalue ] 3keep 3dup PQgetlength
     dup 0 > [
-        [ 3drop ] dip
+        3nip
         [
             memory>byte-array >string
             { uint }
index f4e0a4a1eee4c1f2c2a9a319290ec1cd6b505c67..5b9b722f89fb9412071758e46adfa6a784fd0103 100644 (file)
@@ -37,7 +37,7 @@ ERROR: unknown-format-directive value ;
         [ 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
@@ -55,7 +55,7 @@ ERROR: unknown-format-directive value ;
         [ 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 ;
index cca4aef3b5fe266c81d6461e67221589606b3082..27292e70122042585fe881e921a31dd835a8aac9 100644 (file)
@@ -110,7 +110,7 @@ TUPLE: dredge-fry-state
 : 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
@@ -122,7 +122,7 @@ TUPLE: dredge-fry-state
     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
 
index fc7f826bc4e9c24fe9c69a0d2443deb7260a54ab..94f507c733a1b858e73467e720d58a7ac77f5dc2 100644 (file)
@@ -32,7 +32,7 @@ IN: furnace.chloe-tags
     [ [ "/" ?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
index f2aaff1656269dee171572e9a4e78df137b3dc61..78b8ac5444e615e201a15aac00ff5173d396b93c 100755 (executable)
@@ -176,7 +176,7 @@ SYMBOLS: +dinput+ +keyboard-device+ +keyboard-state+
     <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 ]
index 607c7d6ffce6761da42d3a7c2568d1700941fbda..8801610dddd9ecde5622016559f19f2d0e530479 100644 (file)
@@ -98,7 +98,7 @@ M: gtk-game-input-backend read-keyboard
     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
index 612b0047bf5c12be422f759a20d76efaac564903..eb1273ed80605bab8e3abf1c10b33f02e3a7d948 100644 (file)
@@ -90,7 +90,7 @@ M: x11-game-input-backend read-keyboard
     dpy get dup XDefaultRootWindow
     { int int int int int int int }
     [ XQueryPointer drop ] with-out-parameters
-    [ 4 ndrop ] 3dip ;
+    [ 4drop ] 3dip ;
 
 SYMBOL: mouse-reset?
 
index e2309d9884d6cc90dfa79c831886778f88fc6ca5..0edcb3d80b30b3c45b2311a873eb881c9030b7cc 100644 (file)
@@ -61,7 +61,7 @@ M: clumps group@
 <PRIVATE
 
 : map-like ( seq n quot -- seq )
-    2keep drop '[ _ like ] map ; inline
+    keepd '[ _ like ] map ; inline
 
 PRIVATE>
 
index a1fe479f77455f22c8fea91e447126dcd83f3af1..f4490fb6201d137eaf13d289502cc709453cb024 100644 (file)
@@ -60,7 +60,7 @@ M: heap heap-size ( heap -- n )
 
 : 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 -- ? )
 
index 8e3d73487d6a0891129519b2107433dc2a506fba..fef85e3358f6db14e7f9734de797eed496c75375 100644 (file)
@@ -83,6 +83,7 @@ SYMBOL: vocab-articles
     ] map ;
 
 : contains-funky-elements? ( element -- ? )
+B
     {
         $shuffle
         $complex-shuffle
index 0a75bdf31f4334bee5926e65c1a8b4f16dc02f7b..2407a78dfaf611034af5b5de1702d90146714e0a 100644 (file)
@@ -259,7 +259,7 @@ DEFER: __
 
 : recover-fail ( try fail -- )
     [ drop call ] [
-        [ nip ] dip dup fail?
+        nipd dup fail?
         [ drop call ] [ nip throw ] if
     ] recover ; inline
 
index ba5802fc7ce1cc9691f8160bd031e1e4c021f644..9921b483f503d5fa807b93f537f3f0b8d1383884 100644 (file)
@@ -23,7 +23,7 @@ M: epoll-mx dispose* fd>> close-file ;
 : 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 ;
index fed9a480a3aa99fe6a9128f8efbf2e3f19c3c69d..72d7f4c474a778c78101f5fae0f571a3e2f1ef2c 100644 (file)
@@ -56,7 +56,7 @@ TYPED: buffer-read-into ( dst n: fixnum buffer: buffer -- count )
         pick c-ptr? [
             memcpy
         ] [
-            -rot swap
+            spin
             [ swap alien-unsigned-1 ]
             [ set-nth-unsafe ] bi-curry*
             [ bi ] 2curry each-integer
index 025b74103e930c676d15e7f4ed4f5fb101001f0a..005922c31ae1dffadfd83421069ab9a144a4f5c7 100644 (file)
@@ -20,29 +20,25 @@ utf32 "UTF-32" register-encoding
 
 ! 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
 
@@ -51,7 +47,9 @@ CONSTANT: bom-le B{ 0xff 0xfe 0 0 }
 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 ;
 
index 566f8c7a8c1cded73f9e0d3332db626b6c1e6f70..556bbfc4ee89be40eef6a62e3181d317ce852276 100755 (executable)
@@ -388,7 +388,7 @@ M: windows home
     FindStreamInfoStandard
     WIN32_FIND_STREAM_DATA <struct>
     0
-    [ FindFirstStream ] 2keep drop
+    [ FindFirstStream ] keepd
     over -1 <alien> = [
         2drop throw-win32-error
     ] [
index 77b54d7192edfda039b4865ba8779b542aabb45e..f37eb23a6c2a62028070ac953463b0204735dc7c 100644 (file)
@@ -89,25 +89,25 @@ M: input-port stream-read-unsafe
 : 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 ;
 
index 7ee03d3adf22e11475c2ef9fda98bf4fd5fb0e89..f23c635804155954512b85be15302c158112a914 100644 (file)
@@ -238,7 +238,7 @@ SYMBOL: default-secure-context
     ] [ 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+ ] }
index 0617c5ed1fa87eed9d5f195a9a42bc581ff18870..fbb5515d2fec05252561e1c502d58ed2bff8ac4f 100644 (file)
@@ -40,11 +40,11 @@ M: unix addrspec-of-family
 ! 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 ;
@@ -94,7 +94,7 @@ M: object (server)
 
 : 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 >= [
@@ -133,7 +133,7 @@ M: unix (broadcast)
     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
 
index e9ca95a5445bc6b7c45d536e70e44d722cc3fd41..9651b7917fc22f19b05f9e3ae4df50654f68d726 100755 (executable)
@@ -56,11 +56,11 @@ M: win32-socket dispose* ( stream -- )
 
 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 ;
index 70388535c16fcbdce58f415c55e7cb879c8f7438..5221846fa7deabe7a421aa78465e88e4b19a359f 100644 (file)
@@ -145,6 +145,6 @@ FUNCTION: int strerror_r ( int errno, char* buf, size_t buflen )
 
 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 ;
index b328df3ff9a25972da7e622fd0cb06750bd9619a..449031882da06888bb19291f96bbe659102e588b 100644 (file)
@@ -111,6 +111,6 @@ FUNCTION: int strerror_s ( char *buffer, size_t numberOfElements, int errnum )
 M: windows strerror ( errno -- str )
     [
         [ 1024 [ malloc &free ] keep ] dip
-        [ strerror_s drop ] 3keep 2drop
+        [ strerror_s drop ] keepdd
         utf8 alien>string
     ] with-destructors ;
index 0ccc1b25363b2ab8f56059e4b60d29d74baf881b..5b670b6dc1940d7a67a800658cffddee66b2226a 100644 (file)
@@ -134,7 +134,7 @@ PRIVATE>
     '[ _ [ _ 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:
index c9f9a0e5da76505c86d564e17a88f7d9abac257e..d7ddc2ef6f8f01014c45a7e6b41bd3e52b1356c9 100644 (file)
@@ -244,7 +244,7 @@ PRIVATE>
     [ 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 ;
index c4b713ad16f6362eef9e413e3b16fc73b98b213d..026d033a2d5132e9745ecb0ee9b4952c77c81e85 100644 (file)
@@ -359,7 +359,7 @@ M: float truncate
     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
index d9117f023f53683fd3ee7bc83f8fbe2195fb3dd4..244cf2f42f8bf1939b77e44b1d1535aa6614e71b 100644 (file)
@@ -28,7 +28,7 @@ SYMBOL: matrix
     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 [
index cc31dd6acde65ef007d4ad2f6f01c01bcd277721..fceee5a75dfe856804130b7f121edea9ea0d9776 100644 (file)
@@ -143,7 +143,7 @@ SYMBOL: fast-math-ops
 
 : 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
index 79bbeb046fbcb0acc3ff9b4b1a657c150fe1c203..32e0ce184ed0ceeb75d19afd9097d666826b269c 100644 (file)
@@ -269,7 +269,7 @@ ALIAS: std sample-std
 <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 * ;
@@ -281,7 +281,7 @@ PRIVATE>
 : 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
index 4291a30abad2df2284fa37a5913e393e4ccb069c..e2c9bb0448013d99db5a2167ca01a308eca3909b 100644 (file)
@@ -268,16 +268,16 @@ PRIVATE>
 : (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
index 0c52028a318d4324ab0d38bbb38e1409e63b567e..a4a21880e7c10c1b0ca2e3104252363fe4d9f01c 100644 (file)
@@ -66,7 +66,7 @@ PREDICATE: fragment-shader < gl-shader (fragment-shader?) ;
 : (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 )
index 0accf6f846ad5fb8fb898025988f7e0ae41b4463..da08270c4a2c2f8d5f85df7cb0a6244be972d7d3 100644 (file)
@@ -290,7 +290,7 @@ TUPLE: single-texture < disposable image dim loc texture-coords texture display-
 : tex-sub-image ( image -- )
     [ GL_TEXTURE_2D 0 0 0 ] dip
     [ dim>> first2 ]
-    [ image-format [ drop ] 2dip ]
+    [ image-format nipd ]
     [ bitmap>> ] tri
     glTexSubImage2D ;
 
index f0545a17a37944497b8a5b3de015ce7288a5d054..54b081fdeef88c0015f81eb9227e3dc86fa98ff3 100644 (file)
@@ -37,7 +37,7 @@ SYMBOL: error-stack
 
 : 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 ;
@@ -144,7 +144,7 @@ TUPLE: peg-head rule-id involved-set eval-set ;
     [ [ setup-growth ] 2keep ] 2dip
     [ dup eval-rule ] dip swap
         dup pick stop-growth? [
-        5 ndrop
+        5drop
     ] [
         over update-m
         (grow-lr)
@@ -347,7 +347,7 @@ TUPLE: satisfy-parser quot ;
     swap [
         drop f
     ] [
-        unclip-slice rot dupd call [
+        unclip-slice dup roll call [
             <parse-result>
         ] [
             2drop f
index 862eed1aa906268323f9ffae4aadaf6babdec9c8..368f7d6d3beff4d7228b8c643db3347b6c42c4f6 100644 (file)
@@ -95,7 +95,7 @@ M: persistent-vector ppush ( val pvec -- pvec' )
 
 : 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' )
index ff383b272b6990ca7a15ed6b7177c5f274eb081e..19d2d8710b9f884fd927b5e2300002b09401364b 100644 (file)
@@ -60,7 +60,7 @@ PRIVATE>
 :: 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>>
@@ -130,7 +130,7 @@ PRIVATE>
     ] [ 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) ;
index f16b1b4e862e4732bbc599d7b84fe20bd3cf4131..a0e3b02b7591be1c1a5e5bb1fb0806e68b395e42 100644 (file)
@@ -36,12 +36,10 @@ IN: sequences.generalizations.tests
     [ 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@
index f798106f7c17e0c0220809c8ed7990903a4f2758..ef83ab7e0d21c9fa79aa8b465acea4404a515476 100644 (file)
@@ -117,7 +117,7 @@ MACRO: (ncollect) ( n -- quot )
     [ { } 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)
     ] ;
index dbfc90d555061626b819f9ec0e2f8e80a376e56b..233683c47a62e60513106843e0fde3135a42ca95 100644 (file)
@@ -14,10 +14,10 @@ C: <merged> merged
     [ <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
index 6f139cbeeb9a2589b0ba829361ef1f71ce330fd6..0babf4b9c88ed00d5f0b6a510a596091c00d32ce 100644 (file)
@@ -62,7 +62,7 @@ TUPLE: sequence-parser sequence n ;
 : <safe-slice> ( from to seq -- slice/f )
     3dup {
         [ 2drop 0 < ]
-        [ [ drop ] 2dip length > ]
+        [ nipd length > ]
         [ drop > ]
     } 3|| [ 3drop f ] [ <slice-unsafe> ] if ; inline
 
index 94468e69e634fc00ccdaeeddf28c61210f57cfbf..543aed281427b12857dbc9c432df0100d2dff681 100644 (file)
@@ -25,7 +25,7 @@ PRIVATE>
     (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 ;
@@ -70,7 +70,7 @@ ERROR: unrolled-2bounds-error
     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>
 
@@ -93,7 +93,7 @@ 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
index 19458157d65165b7f5a70ee254a9d903445d62fa..df2b05b58ce9e5499dafb092b87badae1f8dcf58 100644 (file)
@@ -22,7 +22,7 @@ M: windowed-sequence length
     [ 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 [
diff --git a/basis/shuffle/shuffle-docs.factor b/basis/shuffle/shuffle-docs.factor
deleted file mode 100644 (file)
index 363727a..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-USING: help.markup help.syntax ;
-IN: shuffle
-
-HELP: spin  $complex-shuffle ;
-HELP: roll  $complex-shuffle ;
-HELP: -roll $complex-shuffle ;
-HELP: tuck  $complex-shuffle ;
index 4d176f7b3248fbd37fbd9d36b600244c7d413e91..b9eee02ce0e5f0449ef5c630a2efe8be00fb034b 100644 (file)
@@ -3,6 +3,3 @@ USING: shuffle tools.test ;
 { 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
index 03d3caed8be1f3233392bcd69eeb2e976330d088..bc78fd6dc88d01599f9aaf1df0bdf7e60581f8a5 100644 (file)
@@ -14,12 +14,6 @@ MACRO: shuffle-effect ( effect -- quot )
 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
index d56e2ee78509905edac305df336d68712b35f8c1..40486c679a293e9cc343626816091c6a1a81c81e 100644 (file)
@@ -61,23 +61,34 @@ IN: stack-checker.known-words
     } 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 )
index 93a3957dc348efaa79559fbc6a71c8250134e0e0..267245daedc65e9584f34e5b4404d3574201e285 100644 (file)
@@ -453,7 +453,7 @@ DEFER: eee'
 
 ! 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
index ec86089dbef6349f08297ad6e26136d83f60c356..3b424823d545f972759dfaa00ad46ee316332321 100644 (file)
@@ -20,7 +20,7 @@ ERROR: can't-deploy-library-file library ;
 
 : 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 -- )
index 39e4ce755ae2eb1360564291d367394e19054c88..2b7751d93292ac10f13ad9afca35735bba6bbb9f 100755 (executable)
@@ -458,7 +458,7 @@ SYMBOL: nc-buttons
 : 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 ;
index 5c9065dc91e3e28b5dfd7121a23ef907fa6a0bf5..791d71e1217d80d618787ada175a454c47337214 100644 (file)
@@ -137,7 +137,7 @@ DEFER: compose-iter
 
 : 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 [
index 4c4ddcde7ab6fd6ca9238b5d5a7cf47fa891a262..18a0e417509fe13aa8e517bbb415d64832f487a2 100755 (executable)
@@ -71,7 +71,7 @@ M: array array-base-type first ;
 >>
 
 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> ] ;
 
index e3f2da7b189fb18d9f6c4f39f146f3b066eff66f..8f910e0d269f4dce59d1c7865c256a5f98ab33af 100644 (file)
@@ -387,7 +387,7 @@ FUNCTION: DWORD GetNetworkParams ( PFIXED_INFO pFixedInfo, PULONG pOutBufLen )
 
 : 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>> [
index 2ba0edf6c67c2aa349c492250cfb2b88839e36eb..45a6f803b84655dc69f44ea361c817f7a95cf1aa 100644 (file)
@@ -1,44 +1,44 @@
-<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        ::= '&lt;'  Name Atts '&gt;'\r
-Etag        ::= '&lt;/' Name '&gt;'\r
-Pi          ::= '&lt;?' Name ' ' (((Char - S) Char*)? - (Char* '?&gt;' Char*)) '?&gt;'\r
-Atts        ::= (' ' Name '=' '"' Datachar* '"')*\r
-Datachar    ::= '&amp;amp;' | '&amp;lt;' | '&amp;gt;' | '&amp;quot;'\r
-                 | '&amp;#9;'| '&amp;#10;'| '&amp;#13;'\r
-                 | (Char - ('&amp;' | '&lt;' | '&gt;' | '"' | #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        ::= '&lt;'  Name Atts '&gt;'
+Etag        ::= '&lt;/' Name '&gt;'
+Pi          ::= '&lt;?' Name ' ' (((Char - S) Char*)? - (Char* '?&gt;' Char*)) '?&gt;'
+Atts        ::= (' ' Name '=' '"' Datachar* '"')*
+Datachar    ::= '&amp;amp;' | '&amp;lt;' | '&amp;gt;' | '&amp;quot;'
+                 | '&amp;#9;'| '&amp;#10;'| '&amp;#13;'
+                 | (Char - ('&amp;' | '&lt;' | '&gt;' | '"' | #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
index fc7310c68ef37c24061a8c4e7c15b36fc30b7fc3..9f976ec7749d48503cec5e3aaf0bb513f834be98 100644 (file)
@@ -1,60 +1,60 @@
-<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>
index 0d04064022586212103c401b3e5b5c787f0ddfc7..8d795851c9b0b4c17a5c996c3e41247e2c3d8620 100644 (file)
@@ -87,7 +87,7 @@ HINTS: next* { spot } ;
     [ 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
index 89bc0a6e93a71c5e2d6194789c524acc8115989a..a96389d30a523d6b95a5e663fcef8d3cc58e1714 100644 (file)
@@ -117,7 +117,7 @@ DEFER: finalize-rule-set
     [ 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
index 74fdfb56370214cd2dc0cf39837830b1eca5d324..2a4b3d9ebc88a3be7c3925cfb058778e62b4b36c 100644 (file)
@@ -38,7 +38,7 @@ M: c-ptr string>alien drop ;
     drop [ length ] keep over [
         1 + (byte-array) [
             [
-                [ [ string-nth-fast ] 2keep drop ]
+                [ [ string-nth-fast ] keepd ]
                 [ set-nth-unsafe ] bi*
             ] 2curry each-integer
         ] keep
index 40fb12ac8169a8b79513f59c516006b42f5ba731..9f4a4170429a09e1198e53649623f7fd0139b426 100644 (file)
@@ -37,7 +37,7 @@ M: assoc assoc-like drop ; inline
         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 )
@@ -156,7 +156,7 @@ M: assoc values [ nip ] { } assoc>map ;
     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 )
index 1ca47ee2ef5d6d371c6aac6d56f484ef93c17856..12667ffb5de83ce4b3daeac35116f26f250e300c 100644 (file)
@@ -97,7 +97,7 @@ M: tuple-class boa>object
     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 ;
index e260e3530ec326059943b46463c33775d3101a5a..029c8009392c1783682c0917e7e5447ffc7c6bca 100644 (file)
@@ -208,7 +208,7 @@ M: object final-class? drop f ;
     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 ;
index 010d4d4d975c68bcdf77d8ced6cd78a18403802b..ffdc4ead3976f70d8b155a00226218f433937770 100644 (file)
@@ -21,7 +21,7 @@ TUPLE: effect
     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
index 46629023ed7a16d7b64977bb7772e5c6841e1abc..75fdf63d279689f3cd5188f9cb65b0a30dc7e43f 100644 (file)
@@ -45,7 +45,7 @@ PRIVATE>
         { [ 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 ;
index 65fbb300f4833183c9deacc9e5d8a43af35c4205..7571eb66b9f459cb5b08b2195f958fa84abcb5da 100644 (file)
@@ -191,7 +191,7 @@ GENERIC#: check-combination-effect 1 ( combination effect -- )
 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 ] [
index 09189991f7daaabf04f3d9160f618c5ef14e00d1..2f7554a76287be101ae1cef43cadf8be2e95e5c5 100644 (file)
@@ -20,7 +20,7 @@ M: growable set-nth-unsafe underlying>> set-nth-unsafe ; inline
     [ 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>
index 1a7cbad43fbe8ab7a42f1a53e4292858405cc75e..aec8aa77f1994f100e1b96a2eeb8fbed33f08197 100644 (file)
@@ -49,7 +49,7 @@ TUPLE: hash-set
         [ pick or [ probe ] dip (new-key@) ]
         if
     ] [
-        [ [ pick ] dip = ] 2dip rot
+        [ pickd = ] 2dip rot
         [ nip [ drop ] 3dip f ]
         [ [ probe ] dip (new-key@) ]
         if
@@ -125,7 +125,7 @@ M: hash-set ?adjoin
 
 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
index d7763428d7c8db2a9eb8bdd31e56879e0dc79680..9cda95da6a20535e8ce7d9146f724acd1721fb49 100644 (file)
@@ -73,7 +73,7 @@ TUPLE: hashtable
         [ pick or [ probe ] dip (new-key@) ]
         if
     ] [
-        [ [ pick ] dip = ] 2dip rot
+        [ pickd = ] 2dip rot
         [ nip [ drop ] 3dip f ]
         [ [ probe ] dip (new-key@) ]
         if
@@ -154,7 +154,7 @@ M: hashtable set-at
 
 : 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>
index fc1d24375e15c06c3a40dee4a48353c34dbc4ef0..5fef2f1be637e6c2c1bc219255ec3975bf9890d5 100644 (file)
@@ -44,7 +44,7 @@ CONSTANT: replacement-char 0xfffd
     { 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
@@ -53,7 +53,7 @@ CONSTANT: replacement-char 0xfffd
     { byte-array } declare
     [ length ] keep over 0 <string> [
         [
-            [ [ nth-unsafe ] 2keep drop ]
+            [ [ nth-unsafe ] keepd ]
             [
                 pick 127 <=
                 [ set-string-nth-fast ]
@@ -119,17 +119,14 @@ M: decoder stream-read1 ( decoder -- ch )
 : (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
@@ -167,11 +164,11 @@ M: decoder stream-read-until
             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
index bce99cbcca734a89843f6a475ee64fba50720ea8..112667575b4be9e01465f75ff5ab262d93361496 100644 (file)
@@ -101,13 +101,13 @@ M: utf16le encode-char ( char stream encoding -- )
     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
index fc804f068084354ed0382c03eedee2c126af99b6..d1e345a2a8be4281f4e908f3cd4c227f7e51cfb7 100644 (file)
@@ -118,11 +118,11 @@ SYMBOL: error-stream
     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 )
@@ -173,7 +173,7 @@ CONSTANT: each-block-size 65536
 
 : (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 -- ... ) -- ... )
@@ -194,7 +194,7 @@ CONSTANT: each-block-size 65536
 : (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 ]
@@ -225,11 +225,11 @@ CONSTANT: each-block-size 65536
 <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 )
index d37a8a7490457d377e3ecd1219772745812fb88e..fd2b79b81995840698c7c54cfd98bf26eab52f87 100644 (file)
@@ -13,7 +13,7 @@ M: byte-vector stream-tell length ; inline
     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 } ;
index 8dc14ef55f9f9b1657c2919d0480eeef6bfbf05a..8d1d3207c5870b3bc0723cde1284fa0da04a0890 100644 (file)
@@ -53,9 +53,9 @@ M: c-reader stream-read1
 : 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
index 8760299b331d4e861223df20b91c2f49775adfd9..5a6a1618ca3d3f621613f38de63bd5c6992aec07 100644 (file)
@@ -41,7 +41,7 @@ ERROR: not-a-string obj ;
     [ 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
index a484139bc0c7fa2c80180ae73067a6fb519ec385..3f290bdea7391c33513eb6cf843ed93faaf6034f 100644 (file)
@@ -40,6 +40,9 @@ HELP: 2over $shuffle ;
 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 ;
index 23f12b419dc11730d0954aba9fdae3208e3b8208..a1942a4de870d5a40fc7cf0a97330ab43431fc5b 100644 (file)
@@ -132,7 +132,7 @@ IN: kernel.tests
 
 ! 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 -- )
@@ -201,3 +201,6 @@ IN: kernel.tests
 
 { 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
index cc2d132fda75524e7abe78645256c0f0149c55d6..cf1cf2a19270e33a26bf45da435c876dd74ef787 100644 (file)
@@ -116,6 +116,39 @@ DEFER: if
 
 : 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
@@ -129,6 +162,15 @@ DEFER: if
 : 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
index c70a16567314f1839eaa7eaabbade037c696a13a..6c66e7d9e3dfa0cd191ad0398b2f33c240b694bf 100644 (file)
@@ -245,50 +245,43 @@ GENERIC: prev-float ( m -- n )
 : 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 < [
index db8b42c2e4028a3bbf29e3300115414879fea9fc..a450b2b7f014ff73c158ddb30219efc2e0af6510 100644 (file)
@@ -309,7 +309,7 @@ DEFER: @neg-digit
             { [ 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
 
index 67b20a58868f79647ed627b75722f7e7f82a82d2..c40f9c31b02148117b479f484dbf4f387ba41412 100644 (file)
@@ -90,7 +90,7 @@ M: sequence nth-unsafe nth ; 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>
 
@@ -380,7 +380,7 @@ 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
 
@@ -447,7 +447,7 @@ PRIVATE>
     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
@@ -464,7 +464,7 @@ PRIVATE>
     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
@@ -506,7 +506,7 @@ PRIVATE>
     [ (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
@@ -524,7 +524,7 @@ PRIVATE>
     [ (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
@@ -793,7 +793,7 @@ PRIVATE>
     2over = [
         4drop
     ] [
-        [ [ pick [ dup dup ] dip + swap ] dip move-unsafe 1 - ] keep
+        [ [ [ ] [ nip + ] [ 2nip ] 3tri ] dip move-unsafe 1 - ] keep
         move-forward
     ] if ;
 
@@ -808,7 +808,7 @@ PRIVATE>
     pick 0 = [
         3drop
     ] [
-        pick over length + over
+        [ ] [ nip length + ] [ 2nip ] 3tri
         [ pick 0 > [ [ length ] keep ] dip (open-slice) ] 2dip
         set-length
     ] if ;
@@ -1089,7 +1089,7 @@ M: repetition sum [ elt>> ] [ length>> ] bi * ; inline
         [ 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>
index 5560bdcea38eb080146e08103873093a5c5d06b6..5afaf618d24872991a3099e73c2d46b2c6f6e6d5 100644 (file)
@@ -212,7 +212,7 @@ M: anonymous-intersection initial-value*
         { [ 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 )
 
index 4bbf642ca0d3312f2fd3508527200a591ed98bc1..0a6d1b8a62e3d4e16dc85edbcb1f4580ec26c8b0 100644 (file)
@@ -56,7 +56,8 @@ PRIVATE>
 
 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
index cee910b3b0a1c54378f014ad98467d9f026966e0..3226df0b1d89f2f2868657bf638e57068f902125 100644 (file)
@@ -111,16 +111,17 @@ M: word parent-word drop 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 ;
@@ -200,7 +201,7 @@ M: word reset-word
     ] 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)
index 4f0633b5d09b08f930f1308d56c091e0c3eff326..d014bb075bd7629bdb7ca17f99451dbc9d04c339 100755 (executable)
@@ -414,7 +414,7 @@ PRIVATE>
 : ((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 ;
index da1c0c2866e7aa77237a6ce5016fe19b2b74e93b..27da0347e9af32b057a95b0c96333cf9c4b960a2 100644 (file)
@@ -53,7 +53,7 @@ ERROR: key-exists value key assoc ;
     ] if ;
 
 : kv-with ( obj assoc quot -- assoc curried )
-    swapd [ [ -rot ] dip call ] 2curry ; inline
+    swapd [ -rotd call ] 2curry ; inline
 
 <PRIVATE
 
@@ -66,13 +66,13 @@ ERROR: key-exists value key assoc ;
 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
index 07ff68703a5a6883efc1aed1018d4bf7d9a1aab1..26e2aa97cf0d8e207c92f82a36479ab57d109e18 100644 (file)
@@ -127,7 +127,7 @@ PRIVATE>
 
 : 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>
 
index cbf124c45090740da56dfeb988676a0351b26ed5..081001628403b9502756c3e8163325987f6db4f0 100644 (file)
@@ -39,7 +39,7 @@ M: sodium-state get-checksum
     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 ;
index 274c0e860b4abf6d7e7a5b05b251f2dd20c7f416..3cd42feeb13215dcc4a82b3871aedc8039914080 100644 (file)
@@ -40,9 +40,6 @@ MACRO: cleave-array ( quots -- quot )
 : 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
 
@@ -85,10 +82,10 @@ MACRO:: n-falsify ( n -- quot )
 
 ! 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 )
index 24b59deb0d39827542fcfb33d83b80c6e6a44b43..667d750f267323af14410258e2ad83b0d327b16e 100644 (file)
@@ -92,8 +92,8 @@ M: ##gather-int-vector-2 rewrite rewrite-gather-vector-2 ;
 : 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 ;
index de093ac059f82a462f8b0a8ba120af7538ade6b0..d6599f7a5d475200234617f6c45b47905d12b95a 100644 (file)
@@ -55,7 +55,7 @@ IN: cpu.8080.test
     224 [
       32 [
         over 32 * over +  0x2400 + ! cpu h w addr
-        [ pick ] dip swap ram>> nth [
+        reach ram>> nth [
           [
             " 0 0 0" write
           ] [
index cd98113d77bb0591fdeafbcba2394303a90c048c..06787bae8843687159d0a21d1042a5adfdec8792 100644 (file)
@@ -40,18 +40,16 @@ IN: crypto.aes.utils
 : 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
index 5706ba783d042bda957a9da8907b2032d20048ce..389aba9539ed243102086c9b56ab5c4e2e348078 100644 (file)
@@ -21,7 +21,7 @@ IN: cuda.devices
 
 : 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 ;
index a5d55aefb685f9fbef6cc35c5e8e4a9a45841d4a..2d8eb9f533a1f4a51890ac62b781f9c4f17793b6 100644 (file)
@@ -574,7 +574,7 @@ MACRO: -nin- ( n -- quot )
 !
 
 : -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
index 57234f5659f247901e1c31a6b5e469fd5e6062c9..ef0df0b5cc3cf0014983e58d4dc786f7aba37b73 100644 (file)
@@ -94,7 +94,7 @@ sharpness-stack [ V{ t } ] initialize
     [ 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 ;
 
index 21e3b242786a097718f435520b55471661374eee..20a2033c7f38de2ab0270e8467c3201d53a6f611 100644 (file)
@@ -60,7 +60,7 @@ TUPLE: fluids-world < game-world
         <texture-2d>
     ]
     [
-        0 swap [ allocate-texture-image ] 3keep 2drop
+        0 swap [ allocate-texture-image ] keepdd
     ] bi ;
 
 SYMBOL: fluid
index 18773e79a46f35c64bb82d3f8e11fc81dc07f158..77db0a505eca8c30e7426d89e900e0cbae5fc74e 100644 (file)
@@ -72,7 +72,7 @@ M: z-up >y-up-axis!
     [ "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@ ]
index 3a4d72d1531f5bed2faea74544ef8c9bcb448963..5db5b75e0a0c9dff35da7d772137c0747e78a9ec 100644 (file)
@@ -43,10 +43,10 @@ FROM: generalizations => npick ;
 
 : 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 )
@@ -55,16 +55,16 @@ FROM: generalizations => npick ;
         { [ 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
index 7761669eeca2fb79d4d5df633f43bd6cc13cb840..e37f498b7d89ea1ca0715193c69854f53749719b 100755 (executable)
@@ -554,7 +554,7 @@ SYNTAX: UNIFORM-TUPLE:
 
 : 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 -- )
 
index 0b9474a7f1784cdc6c1a49664d162212244e3297..ddb7a062b3b75dc6c5ec6cd8707c9c62ec6b2fc0 100644 (file)
@@ -4,7 +4,7 @@ USING: kernel quoting sequences splitting ;
 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 ;
 
index b2db9b5d01edc731b96cd54c40965357351befbb..892b94de44dcf870d1c74b98992b4ca6107fe09c 100644 (file)
@@ -27,7 +27,7 @@ CONSTANT: IMAP4_SSL_PORT 993
         ! 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  ;
index d24dec443b9b0b026b4fa8e4218f52309ecab1db..1d27d4400033958a4cc7502f9c0f47cb7663a423 100644 (file)
@@ -70,7 +70,7 @@ M: unix send-to-trash ( path -- )
         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
index f5d3f50c6e4bd62e4d8cacea256d8cd4f2082a58..9ba613f2fae22df57c504a77895f403fb7fe4503 100644 (file)
@@ -102,7 +102,7 @@ M: irc-message set-irc-command
     [ 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>
 
index 0abb9c097b872556ce21f6bea2ff0b1db892f730..1d17f31563ba998ca9cd0c96fe7cfe54c9a7623c 100644 (file)
@@ -25,7 +25,7 @@ CONSTANT: max-speed 30.0
     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 ;
index e185f5d675a8e83c5bdc465e1eb2bcfd423ce176..71c85197e6af075ab56d8149e68f25249647cf3a 100644 (file)
@@ -42,7 +42,7 @@ STRUCT: EntryNew
     [ 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 )
index 82ad5612079fd641e41e71e29a96ca1f070ed381..9e47a5877fa7ed143ea619f357a7199ae622bc74 100644 (file)
@@ -18,6 +18,8 @@ CONSTANT: manual-substitutions
         { 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 ] }
@@ -144,7 +146,7 @@ CONSTANT: trivial-defs
         [
             {
                 [ length 4 <= ]
-                [ first { drop 2drop 3drop nip 2nip } member? ]
+                [ first { drop 2drop 3drop nip 2nip 3nip 4nip } member? ]
                 [ rest-slice [ boolean? ] all? ]
             } 1&&
         ]
index 2d8aabde0a194dde7f3c784ab12677f9bfec4214..23c62c9bda06ef4d2de82338e32a2213208d81c3 100644 (file)
@@ -33,4 +33,4 @@ PRIVATE>
     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
index 4512eb8f76567ab0e59b28d1be9ddd6274231143..2f716dfd5eda0033f27ff4ec3b98754f5b7afae5 100644 (file)
@@ -36,10 +36,8 @@ MACRO: ordinary-op ( word -- o )
 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 )
@@ -49,18 +47,19 @@ 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>
 
@@ -72,12 +71,12 @@ MACRO: dual-op ( word -- quot )
     '[ _ @ @ <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
index a2c4a676e35c30ebbec9ddca79e9c5bec9a08736..52c5027ada3d64bc73397c5dcd8e7c1448906c57 100644 (file)
@@ -27,4 +27,4 @@ PRIVATE>
 
 : weighted-cosine-similarity ( w a b -- n )
     [ weighted-v. ]
-    [ [ over ] dip [ weighted-norm ] 2bi@ * ] 3bi / ;
+    [ overd [ weighted-norm ] 2bi@ * ] 3bi / ;
index 3f8ccf4e5a4f3c1545234e714ce6371606866933..4a199111eed094051c2f15a5ca35d0b16cfc4cf9 100644 (file)
@@ -210,7 +210,7 @@ CONSTANT: smpte-framerate H{
     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 )
index b7e518522ae1ae7218d1ecdf2aa2c6aafb612e94..4ccd6eb3f318514e8bbbdae36d43d5e6e89d0a9a 100644 (file)
@@ -113,7 +113,7 @@ TUPLE: vbo
         <texture-2d>
     ]
     [
-        0 swap [ allocate-texture-image ] 3keep 2drop
+        0 swap [ allocate-texture-image ] keepdd
     ] bi ;
 
 : <model-buffers> ( models -- buffers )
@@ -184,8 +184,8 @@ TUPLE: vbo
     [
         {
             { "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 ;
index 78fb5d8ccee6fd4af096335e14ad852d6f9e2365..f9ba6cdf4ab1d8fc58527fab6f94dd87a3a32574 100644 (file)
@@ -42,7 +42,7 @@ DEFER: assoc>tuple
 
 : 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 ;
index 6a362bbef156632e37311b1aa0b862f73c633752..7f1505d65aeea9a2ed95490fdea4b0a5107d8069 100644 (file)
@@ -216,7 +216,7 @@ M: no-method error.
     [ "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 ]
index 4b34513017d56fc27a6430dd18eb9f8d3d45b555..9ef63e465443e124791dfafa93b56b797b391ef9 100644 (file)
@@ -4,7 +4,7 @@ IN: multi-methods.tests
 
 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
index 92ecdbc434483ec7289794ccd1a228e206b789f5..252a1368a230e8a08381fd6cfb5b23e5b1dfcffb 100644 (file)
@@ -58,7 +58,7 @@ ERROR: invalid-perlin-noise-table table ;
 ! 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
index f4ae603f6857917eed7469e6d20196e6e5d6af4b..97bedc4c4701cb8a63f7ec6154ee984b9ab63079 100755 (executable)
@@ -95,7 +95,7 @@ os macosx? "openal.alut.macosx" "openal.alut.other" ? require
 
 : 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 = [
index e0cc7c5a03e9ed1bdf8c8e3e24cb3c53ccbc5f96..c10c5a2281ce381b9b05ae5d5cc154b5da2d85e2 100755 (executable)
@@ -10,5 +10,5 @@ FUNCTION: void alutLoadWAVFile ( c-string fileName, ALenum* format, void** data,
 
 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 ;
index c2d7d1f23cd17694375d6928c42218471607a069..874dce17b97876ad8ad559d3334da05d9dde2e05 100755 (executable)
@@ -13,5 +13,5 @@ M: object load-wav-file ( filename -- format data size frequency )
     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 ;
index 8325be9a9cf169765f4e7fdaa95026c33a6185c3..db3e64fc1e4dfb639b38fcb895e1c7d28a4b8f9c 100644 (file)
@@ -19,19 +19,21 @@ ERROR: cl-error err ;
     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
@@ -463,7 +465,7 @@ PRIVATE>
 
 : <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
index 4be6bc27817e69a334ab6a947612dfc2737c5580..852e53b367a302a165067ba2833861372440dd9c 100644 (file)
@@ -46,7 +46,7 @@ M: demo-world pref-dim* ( gadget -- dim )
     [ 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
@@ -88,7 +88,7 @@ M: demo-world resize-world
         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{
index 523ff3a57a6af1ed26688f203e9b1acd656319d4..4bc26e347720272903b8f9808366218e38eb800e 100644 (file)
@@ -33,7 +33,7 @@ ERROR: no-pair-method a b generic ;
     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 ;
 
index 5759c1b3ec55c8ac3ca3ed18eb143c0bb96781d7..f30f70a71f58e54a3b26494b1e396cc496d3fa3e 100644 (file)
@@ -90,7 +90,7 @@ ERROR: pcre-error value ;
     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 ;
 
index cb077e3afa1256f38f722dc5c63856da719cdd85..6cbaa919ebf16d4ec2f9ca20cfafb4be39bb665b 100644 (file)
@@ -149,7 +149,7 @@ M: hr pdf-render
     [
         [ 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 ;
index 201e4f6743919754656c4f4322bdea403ec9a280..01637f381ec92a10cb5487257fbc1be5c96cf5b9 100644 (file)
@@ -41,7 +41,7 @@ PRIVATE>
 ! -------------------
 
 : 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 )
index f75950520d810b60efc29aa80a73eff96f266cbe..7099a5571bf04e931e417acf79b655ff1cf53314 100644 (file)
@@ -37,7 +37,7 @@ IN: project-euler.009
     ] { } 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 ;
index 12e92a8c790f32b6f231b212398fa1a101d9d53b..73950c89331925cf5b51c52bb265ae5427af8b15 100644 (file)
@@ -109,7 +109,7 @@ ERROR: missing-type type ;
 ! Callbacks
 : quot>py-callback ( quot: ( args kw -- ret ) -- alien )
     '[
-        [ nip ] dip
+        nipd
         [ [ py> ] [ { } ] if* ] bi@ @ >py
     ] PyCallback ; inline
 
index d9a02ecd84ed638b5d73106ab2bf5c5b19815d2f..7e6294a75d88964b7c7bfa170cfe254082f5c766 100644 (file)
@@ -37,8 +37,8 @@ TUPLE: cow ;
 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 ;
 
@@ -66,23 +66,26 @@ TUPLE: bull ;
 : 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 ;
index ca3849ada4baf3a41a86d2e375dcc4aba8bb4c73..546e53195d353612f579a289c26ee99b4abf083a 100644 (file)
@@ -111,7 +111,7 @@ IN: rosetta-code.raycasting
 : lincomb ( a b x -- w )
     3dup [ last ] tri@
     [ - ] curry bi@
-    [ drop ] 2dip
+    nipd
     neg 2dup + [ / ] curry bi@
     [ [ v*n ] curry ] bi@ bi*  v+ ;
 
index f8671a254d5be539e9ed25d87c6dfc8c8f2c51ee..334fc60b3f275f5cf73d455366fcdbb1c94b9d44 100644 (file)
@@ -36,7 +36,7 @@ IN: sequences.extras
 : 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
@@ -72,7 +72,7 @@ IN: sequences.extras
     [ 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
@@ -236,7 +236,7 @@ PRIVATE>
     ] 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 )
@@ -281,7 +281,7 @@ PRIVATE>
 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 )
@@ -538,7 +538,7 @@ PRIVATE>
     } 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 )
@@ -621,11 +621,11 @@ PRIVATE>
     '[ 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 )
index f6ffbf03afff962927323c7f5f982c8065a76830..0608480b62f5ba0a993906f2e4c6e46ef06f32b7 100644 (file)
@@ -21,7 +21,7 @@ TUPLE: factor-expr        expr ;
         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 ;
index fcddd58b6b9fe0ed99f561a8d96e7a097c07ebb7..66387a28823bb19f34b81c986525a2bfaa6690c9 100644 (file)
@@ -42,7 +42,7 @@ M: federal adjust-allowances* ( salary w4 collector entity -- newsalary )
 
 M: federal withholding* ( salary w4 tax-table entity -- x )
     drop
-    [ federal-tax ] 3keep drop
+    [ federal-tax ] 2keepd
     [ fica-tax ] 2keep
     medicare-tax + + ;
 
index d5aed2fca235c89f0e3aed6a1b3576b6bfa3d29a..4d99f0bd41e14b2362a29b9272e717cc0c274ac1 100644 (file)
@@ -22,7 +22,7 @@ IN: tetris.gl
 
 ! 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 -- )
index bfcba2e55b6795b92608f2814094c0dfe0ca4d33..1c4ff1b88a65e981d01bbaadf2617d427bdc61e6 100644 (file)
@@ -39,7 +39,7 @@ M: TYPE assoc-size handle>> DBRNUM ;
     dup DBITERINIT drop 0 int <ref>
     [ 2dup DBITERNEXT dup ] [
         [ memory>object ] [ tcfree ] bi
-        [ pick ] dip swap push
+        reach push
     ] while 3drop ;
 
 M: TYPE >alist
index 7897b6dbe12c2158aa7548d0612bdd63e4ef3af1..380898dae11a61d0503df935df58e295b2bf2641 100644 (file)
@@ -136,7 +136,7 @@ GENERIC: avl-delete ( key node -- node shorter? deleted? )
 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 ;
 
index 905ed6d9f199df36f7eb1c0e3cb6033b32dfb1fb..b9b00e2b47a092c4420b07a68dd39d9cc933349c 100644 (file)
@@ -320,7 +320,7 @@ DEFER: delete-node
 
 : (prune-extremity) ( parent node -- new-extremity )
     dup node-link [
-        [ nip ] dip (prune-extremity)
+        nipd (prune-extremity)
     ] [
         [ delete-node swap set-node-link ] keep
     ] if* ;
index fbdf080d634f3ad10ac150cce224aba3b011f265..0e5cc3f5a94b331ad89380fc6352dfa40759a751 100644 (file)
@@ -113,7 +113,7 @@ ALIAS: y second
 : 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
index 5adb516b0759a00993700868ff7f7501407daafb..92245e441241637ab24a61ca733bae633585a241 100644 (file)
-<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
-&nbsp;<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
-&nbsp;<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:&nbsp; 2 * frameWidth + conf.cols * &lt;width of &nbsp;&gt; + 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 &quot;readme.txt&quot;).<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
-  &lt;div id=&quot;myTerminal1&quot; style=&quot;position:absolute; top:100px; left:100px;&quot;&gt;\r
-     &lt;table class=&quot;termChrome&quot;&gt;\r
-       &lt;tbody&gt;\r
-        &lt;tr&gt;\r
-           &lt;td class=&quot;termTitle&quot;&gt;terminal 1&lt;/td&gt;\r
-        &lt;/tr&gt;\r
-        &lt;tr&gt;\r
-           &lt;td class=&quot;termBody&quot;&gt;&lt;div id=&quot;termDiv1&quot; style=&quot;position:relative&quot;&gt;&lt;/div&gt;&lt;/td&gt;\r
-        &lt;/tr&gt;\r
-       &lt;/tbody&gt;\r
-     &lt;/table&gt;\r
-   &lt;/div&gt;\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: &quot;termDiv1&quot;,\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( &quot;myTerminal1&quot;, 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
-&nbsp;<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 &quot;position&quot; set to &quot;relative&quot; and place this inside your layout. Call &quot;new Terminal()&quot; 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
-&nbsp;<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>  &lt;head&gt;\r
-  &lt;script&gt;\r
-    var term = new Terminal();\r
-    term.open();\r
-  &lt;/script&gt;\r
-  &lt;/head&gt;\r
-</PRE>\r
-Does work:\r
-<PRE>  &lt;head&gt;\r
-  &lt;script&gt;\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
-  &lt;/script&gt;\r
-  &lt;/head&gt;\r
-</PRE>\r
-c.f. &quot;readme.txt&quot;<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
-&nbsp;<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
-&nbsp;<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
-&nbsp;<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(&lt;row&gt;, &lt;col&gt;)</SPAN>' returns an array [&lt;row&gt;, &lt;col&gt;] with the position of the last character in the logical input line with ASCII value &gt;= 32 (0x20).<BR><BR>\r
-`<SPAN CLASS="prop">_getLineStart(&lt;row&gt;, &lt;col&gt;)</SPAN>' returns an array [&lt;row&gt;, &lt;col&gt;] with the position of the first character in the logical input line with ASCII value &gt;= 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
-&quot;^A&quot;. 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
-&nbsp;<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
-&nbsp;<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 &quot;termWhite&quot;\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
-&nbsp;<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 &quot;termlib.js&quot; 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(&quot;<I>headerLabel</I>&quot;, &quot;<I>value</I>&quot;)</TD><TD>set a HTTP header to be sent to the server</TD></TR>\r
-       <TR VALIGN="top"><TD NOWRAP CLASS="prop">getResponseHeader(&quot;<I>headerLabel</I>&quot;)</TD><TD>get a HTTP header sent from the server</TD></TR>\r
-       <TR VALIGN="top"><TD NOWRAP CLASS="prop">open(<I>method</I>, &quot;<I>url</I>&quot; [, <I>asyncFlag</I> [,<BR>&nbsp; &quot;<I>userid</I>&quot; [, &quot;<I>password</I>&quot;]]])</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
-       &nbsp;<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
-       &nbsp;<BR>\r
-               <A HREF="#top">&gt; top of page</A>\r
-       </TD></TR>\r
-       <TR><TD CLASS="lh13">\r
-       &nbsp;\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">
+&nbsp;<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>
+&nbsp;<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:&nbsp; 2 * frameWidth + conf.cols * &lt;width of &nbsp;&gt; + 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 &quot;readme.txt&quot;).<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>
+  &lt;div id=&quot;myTerminal1&quot; style=&quot;position:absolute; top:100px; left:100px;&quot;&gt;
+     &lt;table class=&quot;termChrome&quot;&gt;
+       &lt;tbody&gt;
+        &lt;tr&gt;
+           &lt;td class=&quot;termTitle&quot;&gt;terminal 1&lt;/td&gt;
+        &lt;/tr&gt;
+        &lt;tr&gt;
+           &lt;td class=&quot;termBody&quot;&gt;&lt;div id=&quot;termDiv1&quot; style=&quot;position:relative&quot;&gt;&lt;/div&gt;&lt;/td&gt;
+        &lt;/tr&gt;
+       &lt;/tbody&gt;
+     &lt;/table&gt;
+   &lt;/div&gt;
+
+   // get a terminal for this
+
+   var term1 = new Terminal(
+                 {
+                   x: 0,
+                   y: 0,
+                   id: 1,
+                   termDiv: &quot;termDiv1&quot;,
+                   handler: myTermHandler
+                 }
+              );
+   term1.open();
+   
+   // and this is how to move the chrome and the embedded terminal
+
+   TermGlobals.setElementXY( &quot;myTerminal1&quot;, 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>
+&nbsp;<BR>
+<B CLASS="quest">How can I embed a terminal relative to my HTML layout?</B><BR><BR>
+
+Define your devision element with attribute &quot;position&quot; set to &quot;relative&quot; and place this inside your layout. Call &quot;new Terminal()&quot; with config-values { x: 0, y: 0 } to leave it at its relative origin.
+       </TD></TR>
+       <TR><TD CLASS="lh13"><A NAME="syntax"></A>
+&nbsp;<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>  &lt;head&gt;
+  &lt;script&gt;
+    var term = new Terminal();
+    term.open();
+  &lt;/script&gt;
+  &lt;/head&gt;
+</PRE>
+Does work:
+<PRE>  &lt;head&gt;
+  &lt;script&gt;
+    var term;
+    
+    function termOpen() {
+       // to be called from outside after compile time
+       term = new Terminal();
+       term.open();
+    }
+  &lt;/script&gt;
+  &lt;/head&gt;
+</PRE>
+c.f. &quot;readme.txt&quot;<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>
+&nbsp;<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>
+&nbsp;<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>
+&nbsp;<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(&lt;row&gt;, &lt;col&gt;)</SPAN>' returns an array [&lt;row&gt;, &lt;col&gt;] with the position of the last character in the logical input line with ASCII value &gt;= 32 (0x20).<BR><BR>
+`<SPAN CLASS="prop">_getLineStart(&lt;row&gt;, &lt;col&gt;)</SPAN>' returns an array [&lt;row&gt;, &lt;col&gt;] with the position of the first character in the logical input line with ASCII value &gt;= 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 
+&quot;^A&quot;. And other browsers, which do catch such codes, are not very reliable in that.)
+       </TD></TR>
+       <TR><TD CLASS="lh13"><A NAME="historyunique"></A>
+&nbsp;<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>
+&nbsp;<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 &quot;termWhite&quot;
+   // 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>
+&nbsp;<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 &quot;termlib.js&quot; 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(&quot;<I>headerLabel</I>&quot;, &quot;<I>value</I>&quot;)</TD><TD>set a HTTP header to be sent to the server</TD></TR>
+       <TR VALIGN="top"><TD NOWRAP CLASS="prop">getResponseHeader(&quot;<I>headerLabel</I>&quot;)</TD><TD>get a HTTP header sent from the server</TD></TR>
+       <TR VALIGN="top"><TD NOWRAP CLASS="prop">open(<I>method</I>, &quot;<I>url</I>&quot; [, <I>asyncFlag</I> [,<BR>&nbsp; &quot;<I>userid</I>&quot; [, &quot;<I>password</I>&quot;]]])</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">
+       &nbsp;<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">
+       &nbsp;<BR>
+               <A HREF="#top">&gt; top of page</A>
+       </TD></TR>
+       <TR><TD CLASS="lh13">
+       &nbsp;
+       </TD></TR>
+</TABLE>
+
+<DIV ID="termDiv" STYLE="position:absolute; top:20px; left:100px;"></DIV>
+
+</BODY>
 </HTML>
\ No newline at end of file
index 1770b2ca13aa115d431f9ffd21fe8637aa5ca2b3..f38f6e15802e9f3074d968a6c0100bdb1b1b7e43 100644 (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 &quot;termlib.js&quot; 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 != &quot;&quot;) {\r
-        this.write(&quot;You typed: &quot;+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 &lt;http://www.masswerk.at&gt; in the\r
-       web page. The library should always be accompanied by the &quot;readme.txt&quot; and the sample HTML-documents.<BR><BR>\r
-\r
-       The term &quot;private use&quot; 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 &lt;<A HREF="http://www.masswerk.at/" TARGET="_blank">http://www.masswerk.at</A>&gt; 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 &quot;readme.txt&quot; 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 &quot;Version.Subversion&nbsp;(compatibility)&quot;.\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 &quot;TermApp&quot; ((c) N. Landsteiner 2003) and is in its\r
-       current form a down scaled spinn-off of the &quot;JS/UIX&quot; project. (JS/UIX is not a free&nbsp;software by now.)\r
-       c.f.: &lt;<A HREF="http://www.masswerk.at/jsuix/" TARGET="_blank">http://www.masswerk.at/jsuix</A>&gt;<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
-       &nbsp;<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 &quot;1.07 (original)&quot;.<BR>\r
-       The files are now provided with line breaks  in format &lt;CRLF&gt;.<BR>\r
-       &nbsp;\r
-       </TD></TR>\r
-       <TR><TD CLASS="lh13">\r
-       <B>Author</B><BR><BR>\r
-       &copy; Norbert Landsteiner 2003-2005<BR>\r
-       mass:werk &#150; 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
-       &nbsp;<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
-       &nbsp;<BR>\r
-               <A HREF="#top">&gt; top of page</A>\r
-       </TD></TR>\r
-       <TR><TD CLASS="lh13">\r
-       &nbsp;\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 &quot;termlib.js&quot; 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 != &quot;&quot;) {
+        this.write(&quot;You typed: &quot;+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 &lt;http://www.masswerk.at&gt; in the
+       web page. The library should always be accompanied by the &quot;readme.txt&quot; and the sample HTML-documents.<BR><BR>
+
+       The term &quot;private use&quot; 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 &lt;<A HREF="http://www.masswerk.at/" TARGET="_blank">http://www.masswerk.at</A>&gt; 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 &quot;readme.txt&quot; 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 &quot;Version.Subversion&nbsp;(compatibility)&quot;.
+       </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 &quot;TermApp&quot; ((c) N. Landsteiner 2003) and is in its
+       current form a down scaled spinn-off of the &quot;JS/UIX&quot; project. (JS/UIX is not a free&nbsp;software by now.)
+       c.f.: &lt;<A HREF="http://www.masswerk.at/jsuix/" TARGET="_blank">http://www.masswerk.at/jsuix</A>&gt;<BR><BR>
+
+       For version history: see the <A HREF="readme.txt">readme.txt</A>.
+       </TD></TR>
+       <TR><TD CLASS="lh13">
+       &nbsp;<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 &quot;1.07 (original)&quot;.<BR>
+       The files are now provided with line breaks  in format &lt;CRLF&gt;.<BR>
+       &nbsp;
+       </TD></TR>
+       <TR><TD CLASS="lh13">
+       <B>Author</B><BR><BR>
+       &copy; Norbert Landsteiner 2003-2005<BR>
+       mass:werk &#150; media environments<BR>
+       <A HREF="http://www.masswerk.at/" TARGET="_blank">http://www.masswerk.at</A>
+       </TD></TR>
+       <TR><TD CLASS="lh13">
+       &nbsp;<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">
+       &nbsp;<BR>
+               <A HREF="#top">&gt; top of page</A>
+       </TD></TR>
+       <TR><TD CLASS="lh13">
+       &nbsp;
+       </TD></TR>
+</TABLE>
+
+<DIV ID="termDiv" STYLE="position:absolute; top:20px; left:100px;"></DIV>
+
+</BODY>
 </HTML>
\ No newline at end of file
index 0a4e1ec63a7305de30b9ade57164a9ab65c0594b..23aaaefb72b91e6e68b13393b9d16504e05e2852 100644 (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>&nbsp;\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">&gt; open terminal 1 &nbsp;</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">&gt; open terminal 2 &nbsp;</A>\r
-       </TD></TR>\r
-       <TR><TD NOWRAP CLASS="lh15">\r
-               &nbsp;<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>&nbsp;
+       </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">&gt; open terminal 1 &nbsp;</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">&gt; open terminal 2 &nbsp;</A>
+       </TD></TR>
+       <TR><TD NOWRAP CLASS="lh15">
+               &nbsp;<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
index b332af1818c216d8cc920706203298f4b636a3e9..41b4c5ef62fed2e3ca535b3fcad33f7b75df58c0 100644 (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>&nbsp;\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">&gt; open terminal &nbsp;</A>\r
-       </TD></TR>\r
-       <TR><TD NOWRAP>\r
-               &nbsp;\r
-       </TD></TR>\r
-       <TR><TD NOWRAP CLASS="lh15">\r
-               &nbsp;<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>&nbsp;
+       </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">&gt; open terminal &nbsp;</A>
+       </TD></TR>
+       <TR><TD NOWRAP>
+               &nbsp;
+       </TD></TR>
+       <TR><TD NOWRAP CLASS="lh15">
+               &nbsp;<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
index e4629359502b57718d0bbbcc8c0279b2e95682ce..0532b8c25ca6d4bc56f37a8b656e4488dba63ace 100644 (file)
@@ -30,7 +30,7 @@ IN: zeromq.examples.taskvent
             ! 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
 
index 704cf706eba260474afe2813ef893e62516827bf..8854715036174267a86d0b35dcfae2d777d9ee1d 100644 (file)
@@ -53,7 +53,7 @@ syn match factorCallQuotation /\<call(\s\+\(\S*\s\+\)*--\(\s\+\S*\)*\s\+)\>/ con
 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?