3 : CMOVE ( src dest length -- )
10 -ROT OVER - ( length src (dest-src) )
11 -ROT DUP ROT + SWAP ( (dest-src) (src+length) src )
15 OVER I + ( (dest-src) i@ (dest-src+i) )
22 : CMOVE> ( src dest length -- )
28 -ROT OVER - ( length src (dest-src) )
29 -ROT DUP ROT + 1- ( (dest-src) src (src+length-1) )
40 ( Compile-mode word which compiles everything until the next
41 double quote as a litstring. )
42 : S" IMMEDIATE ( -- addr len )
43 ['] LITSTRING , ( compile LITSTRING )
44 HERE ( save the address of the length word on the stack )
45 0 , ( dummy length - we don't know what it is yet )
48 >IN @ #IB @ >= IF \ End of IB?
49 QUERY-INPUT \ Get next line
52 IB >IN @ + @ 1 >IN +! \ Get char from IB
58 DROP ( drop the double quote character at the end )
59 DUP ( get the saved address of the length word )
60 HERE SWAP - ( calculate the length )
61 1- ( subtract 1 (because we measured from the start of the length word) )
62 SWAP ! ( and back-fill the length location )
65 ( Compile-mode word which compiles everything until the
66 next double quote as a litstring and appends a TYPE. )
72 ( Interpret-mode word which prints everything until the next
73 right-paren to the terminal. )
76 >IN @ #IB @ >= IF \ End of IB?
77 QUERY-INPUT \ Get next line
80 IB >IN @ + @ 1 >IN +! \ Get char from IB
83 DROP ( drop the double quote character )
84 EXIT ( return from this function )
90 ( Converts address of counted string into address of
91 start of string and length of string. )
92 : COUNT ( addr1 -- addr2 n )
95 ( Compares two strings, returns 0 if identical. )
96 : COMPARE ( addr1 n1 addr2 n2 -- res )
104 2dup i + @ swap i + @ <> if
112 ( Converts a string to lower case. )
113 : TOLOWER ( addr n -- )
115 dup i + @ dup dup ( addr char char char )
117 swap [char] Z <= and if
118 [char] A - [char] a +
128 ( Abort if flag is true. )
129 : ABORT" IMMEDIATE ( flag -- )
134 s" Aborted: " ['] lit , , ['] lit , , ['] swap ,