home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 3: Developer Tools / Linux Cubed Series 3 - Developer Tools.iso / devel / lang / forth / pfe-0.000 / pfe-0 / pfe-0.9.13 / help / dpans.hlp next >
Encoding:
Text File  |  1995-04-27  |  110.0 KB  |  3,493 lines

  1. #
  2. # The text in this file is an excerpt from the
  3. #
  4. # draft proposed american national standard for information systems --
  5. # programming languages --
  6. # Forth
  7. # (X3J14 dpANS-6 -- June 30, 1993)
  8. #
  9.  
  10.  
  11. #
  12. # 6.1 Core words
  13. #
  14.  
  15.  
  16. : ! 'store' CORE ( x a-addr -- )
  17.  
  18. Store x at a-addr. See: 3.3.3.1 Address alignment.
  19.  
  20.  
  21. : # 'number-sign' CORE ( ud1 -- ud2 )
  22.  
  23. Divide ud1 by the number in BASE giving the quotient ud2 and the
  24. remainder n. (n is the least-significant digit of ud1.) Convert n to
  25. external form and add the resulting character to the beginning of the
  26. pictured numeric output string. An ambiguous condition *exists if #
  27. executes outside of a <# #> delimited number conversion. See: 6.1.0040
  28. #>, 6.1.0050 #S, 6.1.0490 <#.
  29.  
  30.  
  31. : #> 'number-sign-greater' CORE ( xd -- c-addr u )
  32.  
  33. Drop xd. Make the pictured numeric output string available as a
  34. character string. c-addr and u specify the resulting character string.
  35. A program may replace characters within the string. See: 6.1.0030 #,
  36. 6.1.0050 #S, 6.1.0490 <#.
  37.  
  38.  
  39. : #S 'number-sign-s' CORE ( ud1 -- ud2 )
  40.  
  41. Convert one digit of ud1 according to the rule for #. Continue
  42. conversion until the quotient is zero. ud2 is zero. An ambiguous
  43. condition exists if #S executes outside of a <# #> delimited number
  44. conversion. See6.1.0030 #, 6.1.0040 #>, 6.1.0490 <#.
  45.  
  46.  
  47. : ' 'tick' CORE ( '<spaces>name' -- xt )
  48.  
  49. Skip leading space delimiters. Parse name delimited by a space. Find
  50. name and return xt, the execution token for name. An ambiguous
  51. condition exists if name is not found. When interpreting, ' name
  52. EXECUTE is equivalent to name. See: 3.4 The Forth text interpreter,
  53. 3.4.1 Parsing, A.6.1.2033 POSTPONE, A.6.1.2510 ['], D.6.7 Immediacy.
  54.  
  55.  
  56. : ( 'paren' CORE
  57.  
  58. Compilation: Perform the execution semantics given below.
  59.  
  60. Execution: ( 'ccc<paren>' -- )
  61.  
  62. Parse ccc delimited by a right parenthesis ')'. ( is an immediate
  63. word. The number of characters in ccc may be zero to the number of
  64. characters in the parse area. See: 3.4.1 Parsing, 11.6.1.0080 (.
  65.  
  66. ( 'paren' FILE ( 'ccc<paren>' -- )
  67.  
  68. Extend the semantics of 6.1.0080 ( to include: When parsing from a
  69. text file, if the end of the parse area is reached before a right
  70. parenthesisis found, refill the input buffer from the next line of the
  71. file, set >IN to zero, and resumeparsing, repeating this process until
  72. either a right parenthesis is found or the end of the file is reached.
  73.  
  74.  
  75. : * 'star' CORE ( n1|u1 n2|u2 -- n3|u3 )
  76.  
  77. Multiply n1|u1 by n2|u2 giving the product n3|u3.
  78.  
  79.  
  80. : */ 'star-slash' CORE ( n1 n2 n -- n4 )
  81.  
  82. Multiply n1 by n2 producing the double-cell intermediate result d.
  83. Divide d by n3 giving the single-cell quotient n4. An ambiguous
  84. condition exists if n3 is zero or if the quotient n4 lies outside the
  85. range of a signed number. If d and n3 differ in sign, the
  86. implementation-defined result returned will be the same as that
  87. returned by either the phrase >R M* R> FM/MODSWAP DROP or the phrase
  88. >R M* R> SM/REM SWAP DROP. See: 3.2.2.1 Integer division.
  89.  
  90.  
  91. : */MOD 'star-slash-mod' CORE ( n1 n2 n3 -- n4 n5 )
  92.  
  93. Multiply n1 by n2 producing the intermediate double cell result d.
  94. Divide d by n3 producing the single-cell remainder n4 and the
  95. single-cell quotient n5. An ambiguous condition exists if n3 is zero,
  96. or if the quotient n5 lies outside the range of a single-cell signed
  97. integer. If d and n3 differ in sign, the implementation-defined result
  98. returned will be the same as that returned by either the phrase >R M*
  99. R> FM/MOD or the phrase >R M* R> SM/REM. See: 3.2.2.1 Integer
  100. division.
  101.  
  102.  
  103. : + 'plus' CORE ( n1|u1 n2|u2 -- n3|u3 )
  104.  
  105. Add n2|u2 to n1|u1, giving the sum n3|u3. See: 3.3.3.1 Address
  106. alignment.
  107.  
  108.  
  109. : +! 'plus-store' CORE ( n|u a-addr -- )
  110.  
  111. Add n|u to the single-cell number at a-addr. See: 3.3.3.1 Address
  112. alignment.
  113.  
  114.  
  115. : +LOOP 'plus-loop' CORE 
  116.  
  117. Interpretation: Interpretation semantics for this word are undefined.
  118.  
  119. Compilation: ( C: do-sys -- )
  120. Append the run-time semantics given below to the current
  121. definition. Resolve the destination of all unresolved occurrences of
  122. LEAVE between the location given by do-sys and the next location for a
  123. transfer of control, to execute the words following +LOOP.\
  124.  
  125. Run-time: ( n -- ) ( R: loop-sys1 -- | loop-sys2 )
  126. An ambiguous condition exists if the loop control parameters are
  127. unavailable. Add n to the loop index. If the loop index did not cross
  128. the boundary between the loop limit minus one and the loop limit,
  129. continue execution at the beginning of the loop. Otherwise, discard
  130. the current loop control parameters and continue execution immediately
  131. following the loop. See: 6.1.1240 DO, 6.1.1680 I, 6.1.1760 LEAVE.
  132.  
  133.  
  134. : , 'comma' CORE ( x -- )
  135.  
  136. Reserve one cell of data space and store x in the cell. If the
  137. data-space pointer is aligned when 'begins execution, it will remain
  138. aligned when , finishes execution. An ambiguous condition exists if
  139. the data-space pointer is not aligned prior to execution of ,. See:
  140. 3.3.3 Data space, 3.3.3.1 Address alignment.
  141.  
  142.  
  143. : - 'minus' CORE ( n1|u1 n2|u2 -- n3|u3 )
  144.  
  145. Subtract n2|u2 from n1|u1, giving the difference n3|u3. See: 3.3.3.1
  146. Address alignment.
  147.  
  148.  
  149. : . 'dot' CORE ( n -- )
  150.  
  151. Display n in free field format. See: 3.2.1.2 Digit conversion,
  152. 3.2.1.3 Free-field number display.
  153.  
  154.  
  155. : ." 'dot-quote' CORE
  156.  
  157. Interpretation: Interpretation semantics for this word are undefined.
  158.  
  159. Compilation: ( ' ccc<quote>' -- )
  160.  
  161. Parse ccc delimited by " (double-quote). Append the run-time
  162. semantics given below to the current definition.
  163.  
  164. Run-time: ( -- )
  165.  
  166. Display ccc. See: 3.4.1 Parsing, 6.2.0200 .(.
  167.  
  168.  
  169. : / 'slash' CORE ( n1 n2 -- n3 )
  170.  
  171. Divide n1 by n2, giving the single-cell quotient n3. An ambiguous
  172. condition exists if n2 is zero. If n1 and n2 differ in sign, the
  173. implementation-defined result returned will be the same as that
  174. returned by either the phrase >R S>D R> FM/MOD SWAP DROP or the phrase
  175. >R S>D R> SM/REM SWAP DROP. See: 3.2.2.1 Integer division.
  176.  
  177.  
  178. : /MOD 'slash-mod' CORE ( n1 n2 -- n3 n4 )
  179.  
  180. Divide n1 by n2, giving the single-cell remainder n3 and the
  181. single-cell quotient n4. An ambiguous condition exists if n2 is
  182. zero. If n1 and n2 differ in sign, the implementation-defined result
  183. returned will be the same as that returned by either the phrase >R S>D
  184. R>FM/MOD or the phrase >R S>D R> SM/REM. See: 3.2.2.1 Integer
  185. division.
  186.  
  187.  
  188. : 0< 'zero-less' CORE ( n -- flag )
  189.  
  190. flag is true if and only if n is less than zero.
  191.  
  192.  
  193. : 0= 'zero-equals' CORE ( x -- flag )
  194.  
  195. flag is true if and only if x is equal to zero.
  196.  
  197.  
  198. : 1+ 'one-plus' CORE ( n1|u1 -- n2|u2 )
  199.  
  200. Add 1 to n1|u1 giving the sum n2|u2.
  201.  
  202.  
  203. : 1- 'one-minus' CORE ( n1|u1 -- n2|u2 )
  204.  
  205. Subtract 1 from n1|u1 giving the difference n2|u2.
  206.  
  207.  
  208. : 2! 'two-store' CORE ( x1 x2 a-addr -- )
  209.  
  210. Store the cell pair x1 x2 at a-addr, with x2 at a- addr and x1 at the
  211. next consecutive cell. It is equivalent to the sequence SWAP OVER !
  212. CELL+ !. See: 3.3.3.1 Address alignment.
  213.  
  214.  
  215. : 2* 'two-star' CORE ( x1 -- x2 )
  216.  
  217. 2 is the result of shifting x1 one bit toward the most- significant
  218. bit, filling the vacated least-significant bit with zero.
  219.  
  220.  
  221. : 2/ 'two-slash' CORE ( x1 -- x2 )
  222.  
  223. x2 is the result of shifting x1 one bit toward the least- significant
  224. bit, leaving the most-significant bit unchanged.
  225.  
  226.  
  227. : 2@ 'two-fetch' CORE ( a-addr -- x1 x2 )
  228.  
  229. Fetch the cell pair x1 x2 stored at a-addr. x2 is stored at a-addr and
  230. x1 at the next consecutive cell. It is equivalent to the sequence DUP
  231. CELL+ @ SWAP @. See: 3.3.3.1 Address alignmen, 6.1.0310 2!.
  232.  
  233.  
  234. : 2DROP 'two-drop' CORE ( x1 x2 -- )
  235.  
  236. Drop cell pair x1 x2 from the stack.
  237.  
  238.  
  239. : 2DUP 'two-dupe' CORE ( x1 x2 -- x1 x2 x1 x2 )
  240.  
  241. Duplicate cell pair x1 x2.
  242.  
  243.  
  244. : 2OVER 'two-over' CORE ( x1 x2 x3 x4 -- x1 x2 x3 x4 x1 x2 )
  245.  
  246. Copy cell pair x1 x2 to the top of the stack.
  247.  
  248.  
  249. : 2SWAP 'two-swap' CORE ( x1 x2 x3 x4 -- x3 x4 x1 x2 )
  250.  
  251. Exchange the top two cell pairs.
  252.  
  253.  
  254. : : 'colon' CORE ( C: '<spaces>name' -- colon-sys )
  255.  
  256. Skip leading space delimiters. Parse name delimited by a space. Create
  257. a definition for name, called a 'colon definition.' Enter compilation
  258. state and start the current definition, producing colon-sys. Append
  259. the initiation semantics given below to the current definition. The
  260. execution semantics of name will be determined by the words compiled
  261. into the body ofthe definition. The current definition shall not be
  262. findable in the dictionary until it is ended (or until the execution
  263. of DOES> in some systems).
  264.  
  265. Initiation: ( i*x -- i*x ) ( R: -- nest-sys )
  266.  
  267. Save implementationdependent information nest-sys about the calling
  268. definition. The stack effects i*x represent arguments to name.
  269.  
  270. name Execution: ( i*x -- j*x )
  271.  
  272. Execute the definition name. The stack effects i*x and j*x represent
  273. arguments to and results from name, respectively. See: 3.4 The Forth
  274. text interpreter, 3.4.1 Parsing, 3.4.5 Compilation, 6.1.1250
  275. DOES>,6.1.2500 [, 6.1.2540 ], 15.6.2.0470 ;CODE.
  276.  
  277.  
  278. : ; 'semicolon' CORE
  279.  
  280. Interpretation: Interpretation semantics for this word are undefined.
  281.  
  282. Compilation: ( C: colon-sys -- )
  283.  
  284. Append the run-time semantics below to the current definition. End the
  285. current definition, allow it to be found in the dictionary and enter
  286. interpretation state, consuming colon- sys. If the data-space pointer
  287. is not aligned, reserve enough data space to align it.
  288.  
  289. Run-time: ( -- ) ( R: nest-sys -- )
  290.  
  291. Return to the calling definition specified by nest-sys. See: 3.4 The
  292. Forth text interpreter, 3.4.5 Compilation.
  293.  
  294.  
  295. : < 'less-than' CORE ( n1 n2 -- flag )
  296.  
  297. flag is true if and only if n1 is less than n2. See: 6.1.2340 U<.
  298.  
  299.  
  300. : <# 'less-number-sign' CORE ( -- )
  301.  
  302. Initialize the pictured numeric output conversion process. See:
  303. 6.1.0030 #, 6.1.0040 #>, 6.1.0050 #S.
  304.  
  305.  
  306. : = 'equals' CORE ( x1 x2 -- flag )
  307.  
  308. flag is true if and only if x1 is bit-for-bit the same as x2.
  309.  
  310.  
  311. : > 'greater-than' CORE ( n1 n2 -- flag )
  312.  
  313. flag is true if and only if n1 is greater than n2. See: 6.2.2350 U>.
  314.  
  315.  
  316. : >BODY 'to-body' CORE ( xt -- a-addr )
  317.  
  318. a-addr is the data-field address corresponding to xt. An ambiguous
  319. condition exists if xt is not for a word defined via CREATE. See:
  320. 3.3.3 Data space.
  321.  
  322.  
  323. : >IN 'to-in' CORE ( -- a-addr )
  324.  
  325. a-addr is the address of a cell containing the offset in characters
  326. from the start of the input buffer to the start of the parse area.
  327.  
  328.  
  329. : >NUMBER 'to-number' CORE ( ud1 c-addr1 u1 -- ud2 c-addr2 u2 )
  330.  
  331. ud2 is the unsigned result of converting the characters within the
  332. string specified by c-addr1 u1 into digits, using the number in BASE,
  333. and adding each into ud1 after multiplying ud1 by thenumber in
  334. BASE. Conversion continues left-to- right until a character that is
  335. not convertible, including any '+' or '- ', is encountered or the
  336. string is entirely converted. c-addr2 is the location of the first
  337. unconverted character or the first character past the end of the
  338. string if the string was entirely converted. u2 is the number of
  339. unconverted characters in the string. An ambiguous condition exists if
  340. ud2 overflows during the conversion. See: 3.2.1.2 Digit conversion.
  341.  
  342.  
  343. : >R 'to-r' CORE
  344.  
  345. Interpretation: Interpretation semantics for this word are undefined.
  346.  
  347. Execution: ( x -- ) ( R: -- x )
  348. Move x to the return stack. See: 3.2.3.3 Return stack, 6.1.2060 R>,
  349. 6.1.2070 R@, 6.2.0340 2>R, 6.2.0410 2R>, 6.2.0415 2R@.
  350.  
  351.  
  352. : ?DUP 'question-dupe' CORE ( x -- 0 | x x )
  353.  
  354. Duplicate x if it is non-zero.
  355.  
  356.  
  357. : @ 'fetch' CORE ( a-addr -- x )
  358.  
  359. x is the value stored at a-addr. See: 3.3.3.1 Address alignment.
  360.  
  361.  
  362. : ABORT CORE ( i*x -- ) ( R: j*x -- )
  363.  
  364. Empty the data stack and perform the function of QUIT, which includes
  365. emptying the return stack, without displaying a message. See:
  366. 9.6.2.0670 ABORT.
  367.  
  368. ABORT EXCEPTION EXT
  369.  
  370. Extend the semantics of 6.1.0670 ABORT to be:
  371.  
  372. ( i*x -- ) ( R: j*x -- )
  373.  
  374. Perform the function of -1 THROW. See: 6.1.0670 ABORT.
  375.  
  376.  
  377. : ABORT" 'abort-quote' CORE
  378.  
  379. Interpretation: Interpretation semantics for this word are undefined.
  380. Compilation: ( 'ccc<quote>' -- )
  381.  
  382. Parse ccc delimited by a " (double quote). Append the run-time
  383. semantics given below to the current definition.
  384.  
  385. Run-time: ( i*x x1 -- | i*x ) ( R: j*x -- | j*x )
  386.  
  387. Remove x1 from the stack. If any bit of x1 is not zero, display ccc
  388. and perform an implementation-defined abort sequence that includes the
  389. function of ABORT. See: 3.4.1 Parsing, 9.6.2.0680 ABORT".
  390.  
  391. ABORT" 'abort-quote' EXCEPTION EXT
  392.  
  393. Extend the semantics of 6.1.0680 ABORT" to be: 
  394.  
  395. Interpretation: Interpretation semantics for this word are undefined.
  396.  
  397. Compilation: ( 'ccc<quote>' -- )
  398.  
  399. Parse ccc delimited by a " (double-quote)
  400.  
  401. Append the run-time semantics given below to the current definition.
  402.  
  403. Run-time: ( i*x x1 -- | i*x ) ( R: j*x -- | j*x )
  404.  
  405. Remove x1 from the stack. If any bit of x1 is not zero, perform the
  406. function of -2 THROW, displaying ccc if there is no exception frame on
  407. the exception stack. See: 3.4.1 Parsing, 6.1.0680 ABORT".
  408.  
  409.  
  410. : ABS 'abs' CORE ( n -- u )
  411.  
  412. u is the absolute value of n.
  413.  
  414.  
  415. : ACCEPT CORE ( c-addr +n1 -- +n2 )
  416.  
  417. Receive a string of at most +n1 characters. An ambiguous condition
  418. exists if +n1 is zero or greater than 32,767. Display graphic
  419. characters as they are received. A program that depends on the
  420. presence or absence of non-graphic characters in the string has an
  421. environmental dependency. The editing functions, if any, that the
  422. system performs in order to construct the string are implementation-
  423. defined.Input terminates when an implementation-defined line
  424. terminator is received. When input terminates, nothing is appended to
  425. the string, and the display is maintained in an implementation-defined
  426. way. +n2 is the length of the string stored at c-addr.
  427.  
  428.  
  429. : ALIGN CORE ( -- )
  430.  
  431. If the data-space pointer is not aligned, reserve enough space to
  432. align it. See: 3.3.3 Data space, 3.3.3.1 Address alignment.
  433.  
  434.  
  435. : ALIGNED CORE ( addr -- a-addr )
  436.  
  437. a-addr is the first aligned address greater than or equal to addr.
  438. See: 3.3.3.1 Address alignment.
  439.  
  440.  
  441. : ALLOT CORE ( n -- )
  442.  
  443. If n is greater than zero, reserve n address units of data space. If n
  444. is less than zero, release | n| address units of data space. If n is
  445. zero, leave the data-space pointer unchanged.If the data-space pointer
  446. is aligned and n is a multiple of the size of a cell when ALLOT begins
  447. execution, it will remain aligned when ALLOT finishes execution. If
  448. the data-space pointer is character aligned and n is a multiple of the
  449. size of a character when ALLOT begins execution, it will remain
  450. character aligned when ALLOT finishes execution. See: 3.3.3 Data
  451. space.
  452.  
  453.  
  454. : AND CORE ( x1 x2 -- x3 )
  455.  
  456. x3 is the bit-by-bit logical 'and' of x1 with x2.
  457.  
  458.  
  459. : BASE CORE ( -- a-addr )
  460.  
  461. a-addr is the address of a cell containing the current
  462. number-conversion radix {{2...36}}.
  463.  
  464.  
  465. : BEGIN CORE
  466.  
  467. Interpretation: Interpretation semantics for this word are undefined.
  468.  
  469. Compilation: ( C: -- dest )
  470.  
  471. Put the next location for a transfer of control, dest, onto the
  472. control flow stack. Append the run-time semantics given below to the
  473. current definition. 
  474.  
  475. Run-time: ( -- )
  476.  
  477. Continue execution. See: 3.2.3.2 Control-flow stack, 6.1.2140 REPEAT,
  478. 6.1.2390 UNTIL, 6.1.2430 WHILE.
  479.  
  480.  
  481. : BL 'b-l' CORE ( -- char )
  482.  
  483. char is the character value for a space.
  484.  
  485.  
  486. : C! 'c-store' CORE ( char c-addr -- )
  487.  
  488. Store char at c-addr. When character size is smaller than cell size,
  489. only the number of low-order bits corresponding to character size are
  490. transferred. See: 3.3.3.1 Address alignment
  491.  
  492.  
  493. : C, 'c-comma' CORE ( char -- )
  494.  
  495. Reserve space for one character in the data space and store char in
  496. the space. If the data-space pointer is character aligned when C,
  497. begins execution, it will remain character aligned when C, finishes
  498. execution. An ambiguous condition exists if the data-space pointer is
  499. not character-aligned prior to execution of C,. See: 3.3.3 Data
  500. space, 3.3.3.1 Address alignment.
  501.  
  502.  
  503. : C@ 'c-fetch' CORE ( c-addr -- char )
  504.  
  505. Fetch the character stored at c-addr. When the cell size is greater
  506. than character size, the unused high-order bits are all zeroes. See:
  507. 3.3.3.1 Address alignment.
  508.  
  509.  
  510. : CELL+ 'cell-plus' CORE ( a-addr1 -- a-addr2 )
  511.  
  512. Add the size in address units of a cell to a- addr1, giving a-addr2.
  513. See: 3.3.3.1 Address alignment.
  514.  
  515.  
  516. : CELLS CORE ( n1 -- n2 )
  517.  
  518. n2 is the size in address units of n1 cells.
  519.  
  520.  
  521. : CHAR 'char' CORE ( '<spaces>name' -- char )
  522.  
  523. Skip leading space delimiters. Parse name delimited by a space. Put
  524. the value of its first character onto the stack. See: 3.4.1 Parsing,
  525. 6.1.2520 [CHAR].
  526.  
  527.  
  528. : CHAR+ 'char-plus' CORE ( c-addr1 -- c-addr2 )
  529.  
  530. Add the size in address units of a character to c-addr1, giving
  531. c-addr2. See: 3.3.3.1 Address alignment.
  532.  
  533.  
  534. : CHARS 'chars' CORE ( n1 -- n2 )
  535.  
  536. n2 is the size in address units of n1 characters.
  537.  
  538.  
  539. : CONSTANT CORE ( x '<spaces>name' -- )
  540.  
  541. Skip leading space delimiters. Parse name delimited by a space. Create
  542. a definition for name with the execution semantics defined below. name
  543. is referred to as a 'constant.'  name Execution: ( -- x ) Place x on
  544. the stack. See: 3.4.1 Parsing.
  545.  
  546.  
  547. : COUNT CORE ( c-addr1 -- c-addr2 u )
  548.  
  549. Return the character string specification for the counted string
  550. stored at c-addr1. c-addr2 is the address of the first character after
  551. c-addr1. u is the contents of the character at c- addr1, which is the
  552. length in characters of the string at c-addr2.
  553.  
  554.  
  555. : CR 'c-r' CORE ( -- )
  556.  
  557. Cause subsequent output to appear at the beginning of the next line.
  558.  
  559.  
  560. : CREATE CORE ( '<spaces>name' -- )
  561.  
  562. Skip leading space delimiters. Parse name delimited by a space. Create
  563. a definition for name with the execution semantics defined below. If
  564. the data-space pointer is not aligned, reserve enough data space to
  565. align it. The new data-space pointer defines name's data field. CREATE
  566. does not allocate data space in name's data field.
  567.  
  568. name Execution: ( -- a-addr )
  569.  
  570. a-addr is the address of name's data field. The execution semantics
  571. of name may be extended by using DOES>. See: 3.3.3 Data space,
  572. 6.1.1250 DOES>.
  573.  
  574.  
  575. : DECIMAL CORE ( -- )
  576.  
  577. Set the numeric conversion radix to ten (decimal).
  578.  
  579.  
  580. : DEPTH CORE ( -- +n )
  581.  
  582. +n is the number of single-cell values contained in the data stack
  583. before +n was placed on the stack.
  584.  
  585.  
  586. : DO CORE
  587.  
  588. Interpretation: Interpretation semantics for this word are undefined.
  589.  
  590. Compilation: ( C: -- do-sys )
  591.  
  592. Place do-sys onto the control-flow stack. Append the run-time
  593. semantics given below to the current definition. The semantics are
  594. incomplete until resolved by a consumer of do-sys suchas LOOP.
  595.  
  596. Run-time: ( n1|u1 n2|u2 -- ) ( R: -- loop-sys )
  597.  
  598. Set up loop control parameters with index n2|u2 and limit n1|u1. An
  599. ambiguous condition exists if n1|u1 and n2|u2 are not both the same
  600. type. Anything already on the return stack becomes unavailable until
  601. the loop-control parameters are discarded. See: 3.2.3.2 Control-flow
  602. stack, 6.1.0140 +LOOP, 6.1.1800 LOOP.
  603.  
  604.  
  605. : DOES> 'does' CORE 
  606.  
  607. Interpretation: Interpretation semantics for this word are undefined.
  608.  
  609. Compilation: ( C: colon-sys1 -- colon-sys2 )
  610.  
  611. Append the run-time semantics below to the current definition. Whether
  612. or not the current definition is rendered findable in the dictionary
  613. by the compilation of DOES> is implementation defined. Consume
  614. colon-sys1 and produce colon- sys2. Append the initiation semantics
  615. given below to the current definition.
  616.  
  617. Run-time: ( -- ) ( R: nest-sys1 -- )
  618.  
  619. Replace the execution semantics of the most recent definition,
  620. referred to as name, with the name execution semantics given
  621. below. Return control to the calling definition specified by
  622. nest-sys1. An ambiguous condition exists if name was not defined with
  623. CREATE or a user-defined word that calls CREATE.
  624.  
  625. Initiation: ( i*x -- i*x a-addr ) ( R: -- nest-sys2 )
  626.  
  627. Save implementation-dependent information nest-sys2 about the calling
  628. definition. Place name's data field address on the stack. The stack
  629. effects i*x represent arguments to name.
  630.  
  631. name Execution: ( i*x -- j*x )
  632.  
  633. Execute the portion of the definition that begins with the initiation
  634. semantics appended by theDOES> which modified name. The stack effects
  635. i*x and j*x represent arguments to and results from name,
  636. respectively. See: 6.1.1000 CREATE.
  637.  
  638.  
  639. : DROP CORE ( x -- )
  640.  
  641. Remove x from the stack.
  642.  
  643.  
  644. : DUP 'dupe' CORE ( x -- x x )
  645.  
  646. Duplicate x.
  647.  
  648.  
  649. : ELSE CORE
  650.  
  651. Interpretation: Interpretation semantics for this word are undefined.
  652.  
  653. Compilation: ( C: orig1 -- orig2 )
  654.  
  655. Put the location of a new unresolved forward reference orig2 onto the
  656. control flow stack. Append the run- time semantics given below to the
  657. current definition. The semantics will be incomplete until orig2 is
  658. resolved (e.g., by THEN). Resolve the forward reference orig1 using
  659. the location following the appended execution semantics.
  660.  
  661. Run-time: ( -- )
  662.  
  663. Continue execution at the location given by the resolution of orig2.
  664. See: 6.1.1700 IF, 6.1.2270 THEN.
  665.  
  666.  
  667. : EMIT CORE ( x -- )
  668.  
  669. If x is a graphic character in the implementation-defined character
  670. set, display x. The effect of EMIT for all other values of x is
  671. implementation-defined. When passed a character whose character-
  672. defining bits have a value between hex 20 and 7E inclusive, the
  673. corresponding standard character, specified by 3.1.2.1 Graphic
  674. characters, is displayed. Because different output devices can respond
  675. differently to control characters, programs that use control
  676. characters to perform specific functions have an environmental
  677. dependency. Each EMIT deals with only one character. See: 6.1.2310
  678. TYPE.
  679.  
  680.  
  681. : ENVIRONMENT? 'environment-query' CORE ( c-addr u -- false | i*x true )
  682.  
  683. c-addr is the address of a character string and u is the string's
  684. character count. u may have a value in the range from zero to an
  685. implementation-defined maximum which shall not be less than 31. The
  686. character string should contain a keyword from 3.2.6 Environmental
  687. queries or the optional word sets to be checked for correspondence
  688. with an attribute of the present environment. If the system treats the
  689. attribute as unknown, the returned flag is false;otherwise, the flag
  690. is true and the i*x returned is of the type specified in the table for
  691. the attribute queried.
  692.  
  693.  
  694. : EVALUATE CORE ( i*x c-addr u -- j*x )
  695.  
  696. Save the current input source specification. Store minus-one (-1) in
  697. SOURCE-ID if it is present. Make the string described by c-addr and u
  698. both the input source and input buffer, set >IN to zero, and
  699. interpret. When the parse area is empty, restore the prior input
  700. source specification. Other stack effects are due to the words
  701. EVALUATEd.
  702.  
  703. EVALUATE BLOCK
  704.  
  705. Extend the semantics of 6.1.1360 EVALUATE to include: Store zero in BLK.
  706.  
  707.  
  708. : EXECUTE CORE ( i*x xt -- j*x )
  709.  
  710. Remove xt from the stack and perform the semantics identified by
  711. it. Other stack effects are due to the word EXECUTEd. See: 6.1.0070
  712. ', 6.1.2510 ['].
  713.  
  714.  
  715. : EXIT CORE 
  716.  
  717. Interpretation: Interpretation semantics for this word are undefined.
  718.  
  719. Execution: ( -- ) ( R: nest-sys -- )
  720.  
  721. Return control to the calling definition specified by nest-sys. Before
  722. executing EXIT within a do- loop, a program shall discard the
  723. loop-control parameters by executing UNLOOP. See: 3.2.3.3 Return
  724. stack, 6.1.2380 UNLOOP.
  725.  
  726.  
  727. : FILL CORE ( c-addr u char -- )
  728.  
  729. If u is greater than zero, store char in each of u consecutive
  730. characters of memory beginning at c-addr.
  731.  
  732.  
  733. : FIND CORE ( c-addr -- c-addr 0 | xt 1 | xt -1 )
  734.  
  735. Find the definition named in the counted string at c-addr. If the
  736. definition is not found, returnc- addr and zero. If the definition is
  737. found, return its execution token xt. If the definition is immediate,
  738. also return one (1), otherwise also return minus-one (-1). For a given
  739. string, the values returned by FIND while compiling may differ from
  740. those returned while not compiling. See: 3.4.2 Finding definition
  741. names, A.6.1.0070 ', A.6.1.2510 ['], A.6.1.2033 POSTPONE,D.6.7
  742. Immediacy.
  743.  
  744. FIND SEARCH
  745.  
  746. Extend the semantics of 6.1.1550 FIND to be: 
  747.  
  748. ( c-addr --- c-addr 0 | xt 1 | xt -1 )
  749.  
  750. Find the definition named in the counted string at c-addr. If the
  751. definition is not found after searching all the word lists in the
  752. search order, return c-addr and zero. If the definition is found,
  753. return xt. If the definition is immediate, also return one (1);
  754. otherwise also return minus-one (-1). For a given string, the values
  755. returned by FIND while compiling may differ from those returned while
  756. not compiling. See: 3.4.2 Finding definition names, 6.1.0070 ',
  757. 6.1.1550 FIND, 6.1.2033 POSTPONE, 6.1.2510 ['], D.6.7 Immediacy.
  758.  
  759.  
  760. : FM/MOD 'f-m-slash-mod' CORE ( d1 n1 -- n2 n3 )
  761.  
  762. Divide d1 by n1, giving the floored quotient n3 and the remainder
  763. n2. Input and output stack arguments are signed. An ambiguous
  764. condition exists if n1 is zero or if the quotient lies outside the
  765. range of a single-cell signed integer. See: 3.2.2.1 Integer division,
  766. 6.1.2214 SM/REM, 6.1.2370 UM/MOD.
  767.  
  768.  
  769. : HERE CORE ( -- addr )
  770.  
  771. addr is the data-space pointer. See: 3.3.3.2 Contiguous regions.
  772.  
  773.  
  774. : HOLD CORE ( char -- )
  775.  
  776. Add char to the beginning of the pictured numeric output string. An
  777. ambiguous condition exists if HOLD executes outside of a <# #>
  778. delimited number conversion.
  779.  
  780.  
  781. : I CORE
  782.  
  783. Interpretation: Interpretation semantics for this word are undefined.
  784.  
  785. Execution: ( -- n|u ) ( R: loop-sys -- loop-sys )
  786.  
  787. n|u is a copy of the current (innermost) loop index. An ambiguous
  788. condition exists if the loop control parameters are unavailable.
  789.  
  790.  
  791. : IF CORE
  792.  
  793. Interpretation: Interpretation semantics for this word are undefined.
  794.  
  795. Compilation: ( C: -- orig )
  796.  
  797. Put the location of a new unresolved forward reference orig onto the
  798. control flow stack. Append the run-time semantics given below to the
  799. current definition. The semantics are incomplete until orig is
  800. resolved, e.g., by THEN or ELSE.
  801.  
  802. Run-time: ( x -- )
  803.  
  804. If all bits of x are zero, continue execution at the location
  805. specified by the resolution of orig. See: 3.2.3.2 Control flow stack,
  806. 6.1.1310 ELSE, 6.1.2270 THEN.
  807.  
  808.  
  809. : IMMEDIATE CORE ( -- )
  810.  
  811. Make the most recent definition an immediate word. An ambiguous
  812. condition exists if the most recent definition does not have a name.
  813. See: D.6.7 Immediacy.
  814.  
  815.  
  816. : INVERT CORE ( x1 -- x2 )
  817.  
  818. Invert all bits of x1, giving its logical inverse x2. See: 6.1.1910
  819. NEGATE, 6.1.0270 0=.
  820.  
  821.  
  822. : J CORE
  823.  
  824. Interpretation: Interpretation semantics for this word are undefined.
  825.  
  826. Execution: ( -- n|u ) ( R: loop-sys -- loop-sys )
  827.  
  828. n|u is a copy of the index of the next outer loop. An ambiguous
  829. condition exists if the loop control parameters of the next outer loop
  830. are unavailable.
  831.  
  832.  
  833. : KEY CORE ( -- char )
  834.  
  835. Receive one character char, a member of the implementation-defined
  836. character set. Keyboard events that do not correspond to such
  837. characters are discarded until a valid character is received, and
  838. those events are subsequently unavailable. All standard characters can
  839. be received. Characters received by KEY are not displayed. Any
  840. standard character returned by KEY has the numeric value specified in
  841. 3.1.2.1 Graphic characters. Programs that require the ability to
  842. receive control characters have an environmental dependency. See:
  843. 10.6.2.1307 EKEY, 10.6.1.1755 KEY?.
  844.  
  845.  
  846. : LEAVE CORE
  847.  
  848. Interpretation: Interpretation semantics for this word are undefined.
  849.  
  850. Execution: ( -- ) ( R: loop-sys -- )
  851.  
  852. Discard the current loop control parameters. An ambiguous condition
  853. exists if they areunavailable. Continue execution immediately
  854. following the innermost syntactically enclosing DO ... LOOP or DO
  855. ... +LOOP. See: 3.2.3.3 Return stack, 6.1.0140 +LOOP, 6.1.1800 LOOP.
  856.  
  857.  
  858. : LITERAL CORE 
  859.  
  860. Interpretation: Interpretation semantics for this word are undefined.
  861.  
  862. Compilation: ( x -- )
  863.  
  864. Append the run-time semantics given below to the current definition.
  865.  
  866. Run-time: ( -- x )
  867.  
  868. Place x on the stack.
  869.  
  870.  
  871. : LOOP CORE
  872.  
  873. Interpretation: Interpretation semantics for this word are undefined.
  874.  
  875. Compilation: ( C: do-sys -- )
  876.  
  877. Append the run-time semantics given below to the current definition.
  878. Resolve the destination of all unresolved occurrences of LEAVE between
  879. the location given by do-sys and the next location for a transfer of
  880. control, to execute the words following the LOOP.
  881.  
  882. Run-time: ( -- ) ( R: loop-sys1 -- | loop-sys2 )
  883.  
  884. An ambiguous condition exists if the loop control parameters are
  885. unavailable. Add one to the loop index. If the loop index is then
  886. equal to the loop limit, discard the loop parameters and continue
  887. execution immediately following the loop. Otherwise continue execution
  888. at thebeginning of the loop. See: 6.1.1240 DO, 6.1.1680 I, 6.1.1760
  889. LEAVE.
  890.  
  891.  
  892. : LSHIFT 'l-shift' CORE ( x1 u -- x2 )
  893.  
  894. Perform a logical left shift of u bit-places on x1, giving x2. Put
  895. zero into the least significant bits vacated by the shift. An
  896. ambiguous condition exists if u is greater than or equal to the number
  897. of bits in a cell.
  898.  
  899.  
  900. : M* 'm-star' CORE ( n1 n2 -- d )
  901.  
  902. d is the signed product of n1 times n2.
  903.  
  904.  
  905. : MAX CORE ( n1 n2 -- n3 )
  906.  
  907. n3 is the greater of n1 and n2.
  908.  
  909.  
  910. : MIN CORE ( n1 n2 -- n3 )
  911.  
  912. n3 is the lesser of n1 and n2.
  913.  
  914.  
  915. : MOD CORE ( n1 n2 -- n3 )
  916.  
  917. Divide n1 by n2, giving the single-cell remainder n3. An ambiguous
  918. condition exists if n2 is zero. If n1 and n2 differ in sign, the
  919. implementation-defined result returned will be the same as that
  920. returned by either the phrase >R S>D R> FM/MOD DROP or the phrase >R
  921. S>DR> SM/REM DROP. See: 3.2.2.1 Integer division.
  922.  
  923.  
  924. : MOVE CORE ( addr1 addr2 u -- )
  925.  
  926. If u is greater than zero, copy the contents of u consecutive address
  927. units at addr1 to the u consecutive address units at addr2. After MOVE
  928. completes, the u consecutive address units at addr2 contain exactly
  929. what the u consecutive address units at addr1 contained before the
  930. move. See: 17.6.1.0910 CMOVE, 17.6.1.0920 CMOVE>.
  931.  
  932.  
  933. : NEGATE CORE ( n1 -- n2 )
  934.  
  935. Negate n1, giving its arithmetic inverse n2. See: 6.1.1720 INVERT,
  936. 6.1.0270 0=.
  937.  
  938.  
  939. : OR CORE ( x1 x2 -- x3 )
  940.  
  941. x3 is the bit-by-bit inclusive-or of x1 with x2.
  942.  
  943.  
  944. : OVER CORE ( x1 x2 -- x1 x2 x1 )
  945.  
  946. Place a copy of x1 on top of the stack.
  947.  
  948.  
  949. : POSTPONE CORE
  950.  
  951. Interpretation: Interpretation semantics for this word are undefined.
  952.  
  953. Compilation: ( '<spaces>name' -- )
  954.  
  955. Skip leading space delimiters. Parse name delimited by a space. Find
  956. name. Append the compilation semantics of name to the current
  957. definition. An ambiguous condition exists if name is not found. See:
  958. 3.4.1 Parsing.
  959.  
  960.  
  961. : QUIT CORE ( -- ) ( R: i*x -- )
  962.  
  963. Empty the return stack, store zero in SOURCE-ID if it is present, make
  964. the user input device the input source, and enter interpretation
  965. state. Do not display a message. Repeat the following: Accept a line
  966. from the input source into the input buffer, set >IN to zero, and
  967. interpret. Display the implementation-defined system prompt if in
  968. interpretation state, all processing has been completed, and no
  969. ambiguous condition exists. See: 3.4 The Forth text interpreter.
  970.  
  971.  
  972. : R> 'r-from' CORE 
  973.  
  974. Interpretation: Interpretation semantics for this word are undefined.
  975.  
  976. Execution: ( -- x ) ( R: x -- )
  977.  
  978. Move x from the return stack to the data stack. See: 3.2.3.3 Return
  979. stack, 6.1.0580 >R, 6.1.2070 R@, 6.2.0340 2>R, 6.2.0410 2R>, 6.2.0415
  980. 2R@.
  981.  
  982.  
  983. : R@ 'r-fetch' CORE
  984.  
  985. Interpretation: Interpretation semantics for this word are undefined.
  986.  
  987. Execution: ( -- x ) ( R: x -- x )
  988.  
  989. Copy x from the return stack to the data stack. See: 3.2.3.3 Return
  990. stack, 6.1.0580 >R, 6.1.2060 R>, 6.2.0340 2>R, 6.2.0410 2R>, 6.2.0415
  991. 2R@.
  992.  
  993.  
  994. : RECURSE CORE
  995.  
  996. Interpretation: Interpretation semantics for this word are undefined.
  997.  
  998. Compilation: ( -- )
  999.  
  1000. Append the execution semantics of the current definition to the
  1001. current definition. An ambiguous condition exists if RECURSE appears
  1002. in a definition after DOES>. See: 6.1.1250 DOES>, 6.1.2120 RECURSE.
  1003.  
  1004.  
  1005. : REPEAT CORE
  1006.  
  1007. Interpretation: Interpretation semantics for this word are undefined.
  1008.  
  1009. Compilation: ( C: orig dest -- )
  1010.  
  1011. Append the run-time semantics given below to the current definition,
  1012. resolving the backward reference dest. Resolve the forward reference
  1013. orig using the location following the appended execution semantics.
  1014.  
  1015. Run-time: ( -- )
  1016.  
  1017. Continue execution at the location given by dest. See: 6.1.0760
  1018. BEGIN, 6.1.2430 WHILE.
  1019.  
  1020.  
  1021. : ROT 'rote' CORE ( x1 x2 x3 -- x2 x3 x1 )
  1022.  
  1023. Rotate the top three stack entries.
  1024.  
  1025.  
  1026. : RSHIFT 'r-shift' CORE ( x1 u -- x2 )
  1027.  
  1028. Perform a logical right shift of u bit-places on x1, giving x2. Put
  1029. zero into the most significant bits vacated by the shift. An ambiguous
  1030. condition exists if u is greater than or equal to the number of bits
  1031. in a cell.
  1032.  
  1033.  
  1034. : S" 's-quote' CORE
  1035.  
  1036. Interpretation: Interpretation semantics for this word are undefined.
  1037.  
  1038. Compilation: ( 'ccc<quote>' -- )
  1039.  
  1040. Parse ccc delimited by " (double-quote). Append the run-time
  1041. semantics given below to the current definition.
  1042.  
  1043. Run-time: ( -- c-addr u )
  1044.  
  1045. Return c-addr and u describing a string consisting of the characters
  1046. ccc. A program shall not alter the returned string. See: 3.4.1
  1047. Parsing, 6.2.0855 C", 11.6.1.2165 S".
  1048.  
  1049. S" 's-quote' FILE
  1050.  
  1051. Extend the semantics of 6.1.2165 S" to be: 
  1052.  
  1053. Interpretation: ( 'ccc<quote>' -- c-addr u )
  1054.  
  1055. Parse ccc delimited by " (double quote). Store the resulting string
  1056. c-addr u at a temporary l ocation. The maximum length of the temporary
  1057. buffer is implementation- dependent but shall be no less than 80
  1058. characters. Subsequent uses of S" may overwrite the temporary
  1059. buffer. At least one such buffer shall be provided.
  1060.  
  1061. Compilation: ( 'ccc<quote>' -- )
  1062.  
  1063. Parse ccc delimited by " (double quote). Append the run-time semantics
  1064. given below to the current definition. Run-time: ( -- c-addr u )
  1065. Return c-addr and u that describe a string consisting of the
  1066. characters ccc. See: 3.4.1 Parsing, 6.2.0855 C", 6.1.2165 S", 11.3.5
  1067. Other transient regions.
  1068.  
  1069.  
  1070. : S>D 's-to-d' CORE ( n -- d )
  1071.  
  1072. Convert the number n to the double-cell number d with the same
  1073. numerical value.
  1074.  
  1075.  
  1076. : SIGN CORE ( n -- )
  1077.  
  1078. If n is negative, add a minus sign to the beginning of the pictured
  1079. numeric output string. An ambiguous condition exists if SIGN executes
  1080. outside of a <# #> delimited number conversion.
  1081.  
  1082.  
  1083. : SM/REM 's-m-slash-rem' CORE ( d1 n1 -- n2 n3 )
  1084.  
  1085. Divide d1 by n1, giving the symmetric quotient n3 and the remainder
  1086. n2. Input and output stack arguments are signed. An ambiguous
  1087. condition exists if n1 is zero or if the quotient lies outside the
  1088. range of a single-cell signed integer. See: 3.2.2.1 Integer division,
  1089. 6.1.1561, FM/MOD, 6.1.2370, UM/MOD.
  1090.  
  1091.  
  1092. : SOURCE CORE ( -- c-addr u )
  1093.  
  1094. c-addr is the address of, and u is the number of characters in, the
  1095. input buffer.
  1096.  
  1097.  
  1098. : SPACE CORE ( -- )
  1099.  
  1100. Display one space.
  1101.  
  1102.  
  1103. : SPACES CORE ( n -- )
  1104.  
  1105. If n is greater than zero, display n spaces.
  1106.  
  1107.  
  1108. : STATE CORE ( -- a-addr )
  1109.  
  1110. a-addr is the address of a cell containing the compilation-state
  1111. flag. STATE is true when in compilation state, false otherwise. The
  1112. true value in STATE is non-zero, but is otherwise
  1113. implementation-defined. Only the following standard words alter the
  1114. value in STATE: : (colon), ; (semicolon), ABORT, QUIT, : NONAME, [
  1115. (left-bracket), and ] (right-bracket). Note: A program shall not
  1116. directly alter the contents of STATE. See: 3.4 The Forth text
  1117. interpreter, 6.1.0450 : , 6.1.0460 ;, 6.1.0670 ABORT, 6.1.2050
  1118. QUIT,6.1.2500 [, 6.1.2540 ], 6.2.0455 : NONAME, 15.6.2.2250 STATE.
  1119.  
  1120. STATE TOOLS EXT ( -- a-addr )
  1121.  
  1122. Extend the semantics of 6.1.2250 STATE to allow ;CODE to change the
  1123. value in STATE. A program shall not directly alter the contents of
  1124. STATE. See: 3.4 The Forth text interpreter, 6.1.0450 : , 6.1.0460 ;,
  1125. 6.1.0670 ABORT, 6.1.2050 QUIT,6.1.2250 STATE, 6.1.2500 [, 6.1.2540 ],
  1126. 6.2.0455 : NONAME, 15.6.2.0470 ;CODE.
  1127.  
  1128.  
  1129. : SWAP CORE ( x1 x2 -- x2 x1 )
  1130.  
  1131. Exchange the top two stack items.
  1132.  
  1133.  
  1134. : THEN CORE
  1135.  
  1136. Interpretation: Interpretation semantics for this word are undefined.
  1137.  
  1138. Compilation: ( C: orig -- )
  1139.  
  1140. Resolve the forward reference orig using the location of the execution
  1141. semantics. Append the run-time semantics given below to the current
  1142. definition.
  1143.  
  1144. Run-time: ( -- )
  1145.  
  1146. Continue execution. See: 6.1.1310 ELSE, 6.1.1700 IF.
  1147.  
  1148.  
  1149. : TYPE CORE ( c-addr u -- )
  1150.  
  1151. If u is greater than zero, display the character string specified by
  1152. c-addr and u. When passed a character in a character string whose
  1153. character-defining bits have a value between hex 20 and 7E inclusive,
  1154. the corresponding standard character, specified by 3.1.2.1graphic
  1155. characters, is displayed. Because different output devices can respond
  1156. differently to control characters, programs that use control
  1157. characters to perform specific functions have an environmental
  1158. dependency. See: 6.1.1320 EMIT.
  1159.  
  1160.  
  1161. : U. 'u-dot' CORE ( u -- )
  1162.  
  1163. Display u in free field format.
  1164.  
  1165.  
  1166. : U< 'u-less-than' CORE ( u1 u2 -- flag )
  1167.  
  1168. flag is true if and only if u1 is less than u2. See: 6.1.0480 <.
  1169.  
  1170.  
  1171. : UM* 'u-m-star' CORE ( u1 u2 -- ud )
  1172.  
  1173. Multiply u1 by u2, giving the unsigned double-cell product ud. All
  1174. values and arithmetic are unsigned.
  1175.  
  1176.  
  1177. : UM/MOD 'u-m-slash-mod' CORE ( ud u1 -- u2 u3 )
  1178.  
  1179. Divide ud by u1, giving the quotient u3 and the remainder u2. All
  1180. values and arithmetic areunsigned. An ambiguous condition exists if u1
  1181. is zero or if the quotient lies outside the rangeof a single-cell
  1182. unsigned integer. See: 3.2.2.1 Integer division, 6.1.1561 FM/MOD,
  1183. 6.1.2214 SM/REM.
  1184.  
  1185.  
  1186. : UNLOOP CORE
  1187.  
  1188. Interpretation: Interpretation semantics for this word are undefined.
  1189.  
  1190. Execution: ( -- ) ( R: loop-sys -- )
  1191.  
  1192. Discard the loop-control parameters for the current nesting level. An
  1193. UNLOOP is required for each nesting level before the definition may be
  1194. EXITed. An ambiguous condition exists if the loop-control parameters
  1195. are unavailable. See: 3.2.3.3 Return stack.
  1196.  
  1197.  
  1198. : UNTIL CORE
  1199.  
  1200. Interpretation: Interpretation semantics for this word are undefined.
  1201.  
  1202. Compilation: ( C: dest -- )
  1203.  
  1204. Append the run-time semantics given below to the current definition,
  1205. resolving the backward reference dest.
  1206.  
  1207. Run-time: ( x -- )
  1208.  
  1209. If all bits of x are zero, continue execution at the location
  1210. specified by dest. See: 6.1.0760 BEGIN.
  1211.  
  1212.  
  1213. : VARIABLE CORE ( '<spaces>name' -- )
  1214.  
  1215. Skip leading space delimiters. Parse name delimited by a space. Create
  1216. a definition for name with the execution semantics defined
  1217. below. Reserve one cell of data space at an alignedaddress. name is
  1218. referred to as a 'variable'.
  1219.  
  1220. name Execution: ( -- a-addr )
  1221.  
  1222. a-addr is the address of the reserved cell. A program is responsible
  1223. for initializing the contents of the reserved cell. See: 3.4.1
  1224. Parsing.
  1225.  
  1226.  
  1227. : WHILE CORE
  1228.  
  1229. Interpretation: Interpretation semantics for this word are undefined.
  1230.  
  1231. Compilation: ( C: dest -- orig dest )
  1232.  
  1233. Put the location of a new unresolved forward reference orig onto the
  1234. control flow stack, under the existing dest. Append the run-time
  1235. semantics given below to the current definition. The semantics are
  1236. incomplete until orig and dest are resolved (e.g., by REPEAT).
  1237.  
  1238. Run-time: ( x -- )
  1239.  
  1240. If all bits of x are zero, continue execution at the location
  1241. specified by the resolution of orig.
  1242.  
  1243.  
  1244. : WORD CORE ( char '<chars>ccc<char>' -- c-addr )
  1245.  
  1246. Skip leading delimiters. Parse characters ccc delimited by char. An
  1247. ambiguous condition exists if the length of the parsed string is
  1248. greater than the implementation-defined length of acounted
  1249. string. c-addr is the address of a transient region containing the
  1250. parsed word as a counted string. If the parse area was empty or
  1251. contained no characters other than the delimiter, the resulting string
  1252. has a zero length. A space, not included in the length, follows the
  1253. string. A program may replace characters within the string. Note: The
  1254. requirement to follow the string with a space is obsolescent and is
  1255. included as a concession to existing programs that use CONVERT. A
  1256. program shall not depend on the existence of the space. See: 3.3.3.6
  1257. Other transient regions, 3.4.1 Parsing.
  1258.  
  1259.  
  1260. : XOR 'x-or' CORE ( x1 x2 -- x3 )
  1261.  
  1262. x3 is the bit-by-bit exclusive-or of x1 with x2.
  1263.  
  1264.  
  1265. : [ 'left-bracket' CORE
  1266.  
  1267. Interpretation: Interpretation semantics for this word are undefined.
  1268.  
  1269. Compilation: Perform the execution semantics given below.
  1270.  
  1271. Execution: ( -- )
  1272.  
  1273. Enter interpretation state. [ is an immediate word. See: 3.4 The
  1274. Forth text interpreter, 3.4.5 Compilation, 6.1.2540 ].
  1275.  
  1276.  
  1277. : ['] 'bracket-tick' CORE
  1278.  
  1279. Interpretation: Interpretation semantics for this word are undefined.
  1280.  
  1281. Compilation: ( '<spaces>name' -- )
  1282.  
  1283. Skip leading space delimiters. Parse name delimited by a space. Find
  1284. name. Append the run-time semantics given below to the current
  1285. definition. An ambiguous condition exists if name is not found.
  1286.  
  1287. Run-time: ( -- xt )
  1288.  
  1289. Place name's execution token xt on the stack. The execution token
  1290. returned by the compiled phrase '['] X ' is the same value returned by
  1291. '' X ' outside of compilation state. See: 3.4.1 Parsing, A.6.1.0070
  1292. ', A.6.1.2033 POSTPONE, D.6.7 Immediacy.
  1293.  
  1294.  
  1295. : [CHAR] 'bracket-char' CORE
  1296.  
  1297. Interpretation: Interpretation semantics for this word are undefined.
  1298.  
  1299. Compilation: ( '<spaces>name' -- )
  1300.  
  1301. Skip leading space delimiters. Parse name delimited by a space. Append
  1302. the run-time semantics given below to the current definition.
  1303.  
  1304. Run-time: ( -- char )
  1305.  
  1306. Place char, the value of the first character of name, on the stack.
  1307. See: 3.4.1 Parsing, 6.1.0895 CHAR.
  1308.  
  1309.  
  1310. : ] 'right-bracket' CORE ( -- )
  1311.  
  1312. Enter compilation state. See: 3.4 The Forth text interpreter, 3.4.5
  1313. Compilation, 6.1.2500 [.
  1314.  
  1315.  
  1316. #
  1317. # 6.2 Core extension words
  1318. #
  1319.  
  1320.  
  1321. : #TIB 'number-t-i-b' CORE EXT ( -- a-addr )
  1322.  
  1323. a-addr is the address of a cell containing the number of characters in
  1324. the terminal input buffer. Note: This word is obsolescent and is
  1325. included as a concession to existing implementations.
  1326.  
  1327.  
  1328. : .( 'dot-paren'' CORE EXT
  1329. Compilation: Perform the execution semantics given below.
  1330.  
  1331. Execution: ( 'ccc<paren>' -- )
  1332.  
  1333. Parse and display ccc delimited by a right parenthesis ')'. .( is an
  1334. immediate word. See: 3.4.1 Parsing, 6.1.0190 .".
  1335.  
  1336.  
  1337. : .R 'dot-r' CORE EXT ( n1 n2 -- )
  1338.  
  1339. Display n1 right aligned in a field n2 characters wide. If the number
  1340. of characters required to display n1 is greater than n2, all digits
  1341. are displayed with no leading spaces in a field as wide as necessary.
  1342.  
  1343.  
  1344. : 0<> 'zero-not-equals' CORE EXT ( x -- flag )
  1345.  
  1346. flag is true if and only if x is not equal to zero.
  1347.  
  1348.  
  1349. : 0> 'zero-greater' CORE EXT ( n -- flag )
  1350.  
  1351. flag is true if and only if n is greater than zero.
  1352.  
  1353.  
  1354. : 2>R 'two-to-r' CORE EXT
  1355.  
  1356. Interpretation: Interpretation semantics for this word are undefined.
  1357.  
  1358. Execution: ( x1 x2 -- ) ( R: -- x1 x2 )
  1359.  
  1360. Transfer cell pair x1 x2 to the return stack. Semantically equivalent
  1361. to SWAP >R >R. See: 3.2.3.3 Return stack, 6.1.0580 >R, 6.1.2060 R>,
  1362. 6.1.2070 R@, 6.2.0410 2R>, 6.2.0415 2R@.
  1363.  
  1364.  
  1365. : 2R> 'two-r-from' CORE EXT
  1366.  
  1367. Interpretation: Interpretation semantics for this word are undefined.
  1368.  
  1369. Execution: ( -- x1 x2 ) ( R: x1 x2 -- )
  1370.  
  1371. Transfer cell pair x1 x2 from the return stack. Semantically
  1372. equivalent to R> R> SWAP. See: 3.2.3.3 Return stack, 6.1.0580 >R,
  1373. 6.1.2060 R>, 6.1.2070 R@, 6.2.0340 2>R, 6.2.0415 2R@.
  1374.  
  1375.  
  1376. : 2R@ 'two-r-fetch' CORE EXT
  1377.  
  1378. Interpretation: Interpretation semantics for this word are undefined.
  1379.  
  1380. Execution: ( -- x1 x2 ) ( R: x1 x2 -- x1 x2 )
  1381.  
  1382. Copy cell pair x1 x2 from the return stack. Semantically equivalent to
  1383. R> R> 2DUP >R >R SWAP. See: 3.2.3.3 Return stack, 6.1.0580 >R,
  1384. 6.1.2060 R>, 6.1.2070 R@, 6.2.0340 2>R, 6.2.0410 2R>.
  1385.  
  1386.  
  1387. : :NONAME 'colon-no-name' CORE EXT ( C: -- colon-sys ) ( S: -- xt )
  1388.  
  1389. Create an execution token xt, enter compilation state and start the
  1390. current definition, producing colon-sys. Append the initiation
  1391. semantics given below to the current definition. The execution
  1392. semantics of xt will be determined by the words compiled into the body
  1393. of the definition. This definition can be executed later by using xt
  1394. EXECUTE. If the control-flow stack is implemented using the data
  1395. stack, colon-sys shall be the topmost item on the data stack. See
  1396. 3.2.3.2 Control-flow stack.
  1397.  
  1398. Initiation: ( i*x -- i*x ) ( R: -- nest-sys )
  1399.  
  1400. Save implementation- dependent information nest-sys about the calling
  1401. definition. The stack effects i*x represent arguments to xt.
  1402.  
  1403. xt Execution: ( i*x -- j*x )
  1404.  
  1405. Execute the definition specified by xt. The stack effects i*x and j*x
  1406. represent arguments to and results from xt, respectively.
  1407.  
  1408.  
  1409. : <> 'not-equals' CORE EXT ( x1 x2 -- flag )
  1410.  
  1411. flag is true if and only if x1 is not bit-for-bit the same as x2.
  1412.  
  1413.  
  1414. : ?DO 'question-do' CORE EXT
  1415.  
  1416. Interpretation: Interpretation semantics for this word are undefined.
  1417.  
  1418. Compilation: ( C: -- do-sys )
  1419.  
  1420. Put do-sys onto the control-flow stack. Append the run-time semantics
  1421. given below to the current definition. The semantics are incomplete
  1422. until resolved by a consumer of do-sys such as LOOP.
  1423.  
  1424. Run-time: (n1|u1 n2|u2 -- ) ( R: -- | loop-sys )
  1425.  
  1426. If n1|u1 is equal to n2|u2, continue execution at the location given
  1427. by the consumer of do- sys. Otherwise set up loop control parameters
  1428. with index n2|u2 and limit n1|u1 and continue executing immediately
  1429. following ?DO. Anything already on the return stack becomes
  1430. unavailable until the loop control parameters are discarded. An
  1431. ambiguous condition exists if n1|u1 and n2|u2 are not both of the same
  1432. type. See: 3.2.3.2 Control-flow stack, 6.1.0140 +LOOP, 6.1.1240 DO,
  1433. 6.1.1680 I, 6.1.1760 LEAVE,6.1.1800 LOOP, 6.1.2380 UNLOOP.
  1434.  
  1435.  
  1436. : AGAIN CORE EXT
  1437.  
  1438. Interpretation: Interpretation semantics for this word are undefined.
  1439.  
  1440. Compilation: ( C: dest -- )
  1441.  
  1442. Append the run-time semantics given below to the current definition,
  1443. resolving the backward reference dest.
  1444.  
  1445. Run-time: ( -- )
  1446.  
  1447. Continue execution at the location specified by dest. If no other
  1448. control flow words are used, any program code after AGAIN will not be
  1449. executed. See: 6.1.0760 BEGIN.
  1450.  
  1451.  
  1452. : C" 'c-quote' CORE EXT
  1453.  
  1454. Interpretation: Interpretation semantics for this word are undefined.
  1455.  
  1456. Compilation: ( 'ccc<quote>' -- )
  1457.  
  1458. Parse ccc delimited by " (double-quote) and append the run-time
  1459. semantics given below to the current definition.
  1460.  
  1461. Run-time: ( -- c-addr )
  1462.  
  1463. Return c-addr, a counted string consisting of the characters ccc. A
  1464. program shall not alter the returned string. See: 3.4.1 Parsing,
  1465. 6.1.2165 S", 11.6.1.2165 S".
  1466.  
  1467.  
  1468. : CASE CORE EXT
  1469.  
  1470. Interpretation: Interpretation semantics for this word are undefined.
  1471.  
  1472. Compilation: ( C: -- case-sys )
  1473.  
  1474. Mark the start of the CASE ... OF ... ENDOF ... ENDCASE
  1475. structure. Append the run-time semantics given below to the current
  1476. definition.
  1477.  
  1478. Run-time: ( -- )
  1479.  
  1480. Continue execution. See: 6.2.1342 ENDCASE, 6.2.1343 ENDOF, 6.2.1950 OF.
  1481.  
  1482.  
  1483. : COMPILE, 'compile-comma' CORE EXT
  1484.  
  1485. Interpretation: Interpretation semantics for this word are undefined.
  1486.  
  1487. Execution: ( xt -- )
  1488.  
  1489. Append the execution semantics of the definition represented by xt to
  1490. the execution semantics of the current definition.
  1491.  
  1492.  
  1493. : CONVERT CORE EXT ( ud1 c-addr1 -- ud2 c-addr2 )
  1494.  
  1495. ud2 is the result of converting the characters within the text
  1496. beginning at the first character after c- addr1 into digits, using the
  1497. number in BASE, and adding each digit to ud1 after multiplying ud1 by
  1498. the number in BASE. Conversion continues until a character that is not
  1499. convertible is encountered. c-addr2 is the location of the first
  1500. unconverted character. An ambiguous condition exists if ud2 overflows.
  1501. Note: This word is obsolescent and is included as a concession to
  1502. existing implementations. Its function is superseded by 6.1.0570
  1503. >NUMBER. See: 3.2.1.2 Digit conversion.
  1504.  
  1505.  
  1506. : ENDCASE 'end-case' CORE EXT
  1507.  
  1508. Interpretation: Interpretation semantics for this word are undefined.
  1509.  
  1510. Compilation: ( C: case-sys -- )
  1511.  
  1512. Mark the end of the CASE ... OF ... ENDOF ... ENDCASE structure. Use
  1513. case-sys to resolve the entire structure. Append the run-time
  1514. semantics given below to the current definition.
  1515.  
  1516. Run-time: ( x -- )
  1517.  
  1518. Discard the case selector x and continue execution. See: 6.2.0873
  1519. CASE, 6.2.1343 ENDOF, 6.2.1950 OF.
  1520.  
  1521.  
  1522. : ENDOF 'end-of' CORE EXT
  1523.  
  1524. Interpretation: Interpretation semantics for this word are undefined.
  1525.  
  1526. Compilation: ( C: case-sys1 of-sys -- case-sys2 )
  1527.  
  1528. Mark the end of the ... OF ... ENDOF ... part of the CASE
  1529. structure. The next location for a transfer of control resolves the
  1530. reference given by of-sys. Append the run-time semantics given below
  1531. to the current definition. Replace case- sys1 with case-sys2 on
  1532. thecontrol-flow stack, to be resolved by ENDCASE.
  1533.  
  1534. Run-time: ( -- )
  1535.  
  1536. Continue execution at the location specified by the consumer of
  1537. case-sys2. See: 6.2.0873 CASE, 6.2.1342 ENDCASE, 6.2.1950 OF.
  1538.  
  1539.  
  1540. : ERASE CORE EXT ( addr u -- )
  1541.  
  1542. If u is greater than zero, clear all bits in each of u consecutive
  1543. address units of memory beginning at addr .
  1544.  
  1545.  
  1546. : EXPECT CORE EXT ( c-addr +n -- )
  1547.  
  1548. Receive a string of at most +n characters. Display graphic characters
  1549. as they are received. A program that depends on the presence or
  1550. absence of non-graphic characters in the string has an environmental
  1551. dependency. The editing functions, if any, that the system performs in
  1552. order to construct the string of characters are implementation-defined.
  1553. Input terminates when an implementation-defined line terminator is
  1554. received or when the string is +n characters long. When input
  1555. terminates, nothing is appended to the string and the display is
  1556. maintained in an implementation-defined way.Store the string at c-
  1557. addr and its length in SPAN. Note: This word is obsolescent and is
  1558. included as a concession to existing implementations. Its function is
  1559. superseded by 6.1.0695 ACCEPT.
  1560.  
  1561.  
  1562. : FALSE CORE EXT ( -- false )
  1563.  
  1564. Return a false flag. See: 3.1.3.1 Flags
  1565.  
  1566.  
  1567. : HEX CORE EXT ( -- )
  1568.  
  1569. Set contents of BASE to sixteen.
  1570.  
  1571.  
  1572. : MARKER CORE EXT ( '<spaces>name' -- )
  1573.  
  1574. Skip leading space delimiters. Parse name delimited by a space. Create
  1575. a definition for name with the execution semantics defined below.
  1576.  
  1577. name Execution: ( -- )
  1578.  
  1579. Restore all dictionary allocation and search order pointers to the
  1580. state they had just prior to the definition of name. Remove the
  1581. definition of name and all subsequent definitions. Restoration of any
  1582. structures still existing that could refer to deleted definitions or
  1583. deallocated data spaceis not necessarily provided. No other contextual
  1584. information such as numeric base is affected. See: 3.4.1 Parsing,
  1585. 15.6.2.1580 FORGET.
  1586.  
  1587.  
  1588. : NIP CORE EXT ( x1 x2 -- x2 )
  1589.  
  1590. Drop the first item below the top of stack.
  1591.  
  1592.  
  1593. : OF CORE EXT
  1594.  
  1595. Interpretation: Interpretation semantics for this word are undefined.
  1596.  
  1597. Compilation: ( C: -- of-sys )
  1598.  
  1599. Put of-sys onto the control flow stack. Append the run-time semantics
  1600. given below to the current definition. The semantics are incomplete
  1601. until resolved by a consumer of of-sys such as ENDOF.
  1602.  
  1603. Run-time: ( x1 x2 -- | x1 )
  1604.  
  1605. If the two values on the stack are not equal, discard the top value
  1606. and continue execution at the location specified by the consumer of
  1607. of-sys, e.g., following the next ENDOF. Otherwise, discard both
  1608. values and continue execution in line. See: 6.2.0873 CASE, 6.2.1342
  1609. ENDCASE, 6.2.1343 ENDOF.
  1610.  
  1611.  
  1612. : PAD CORE EXT ( -- c-addr )
  1613.  
  1614. c-addr is the address of a transient region that can be used to hold
  1615. data for intermediate processing. See: 3.3.3.6 Other transient
  1616. regions.
  1617.  
  1618.  
  1619. : PARSE CORE EXT ( char 'ccc<char>' -- c-addr u )
  1620.  
  1621. Parse ccc delimited by the delimiter char. c-addr is the address
  1622. (within the input buffer) and u is the length of the parsed string. If
  1623. the parse area was empty, the resulting string has a zero length.
  1624. See: 3.4.1 Parsing.
  1625.  
  1626.  
  1627. : PICK CORE EXT ( xu ... x1 x0 u -- xu ... x1 x0 xu )
  1628.  
  1629. Remove u. Copy the xu to the top of the stack. An ambiguous condition
  1630. exists if there are less than u+2 items on the stack before PICK is
  1631. executed.
  1632.  
  1633.  
  1634. : QUERY CORE EXT ( -- )
  1635.  
  1636. Make the user input device the input source. Receive input into the
  1637. terminal input buffer, replacing any previous contents. Make the
  1638. result, whose address is returned by TIB, the input buffer. Set >IN to
  1639. zero. Note: This word is obsolescent and is included as a concession
  1640. to existing implementations.
  1641.  
  1642.  
  1643. : REFILL CORE EXT ( -- flag )
  1644.  
  1645. Attempt to fill the input buffer from the input source, returning a
  1646. true flag if successful. When the input source is the user input
  1647. device, attempt to receive input into the terminal input buffer. If
  1648. successful, make the result the input buffer, set >IN to zero, and
  1649. return true. Receipt of a line containing no characters is considered
  1650. successful. If there is no input available from the current input
  1651. source, return false. When the input source is a string from EVALUATE,
  1652. return false and perform no other action. See: 7.6.2.2125 REFILL,
  1653. 11.6.2.2125 REFILL.
  1654.  
  1655. REFILL BLOCK EXT ( -- flag )
  1656.  
  1657. Extend the execution semantics of 6.2.2125 REFILL with the following:
  1658. When the input source is a block, make the next block the input source
  1659. and current input buffer by adding one to the value of BLK and setting
  1660. >IN to zero. Return true if the new value of BLK is a valid block
  1661. number, otherwise false. See: 6.2.2125 REFILL, 11.6.2.2125 REFILL.
  1662.  
  1663. REFILL FILE EXT ( -- flag )
  1664.  
  1665. Extend the execution semantics of 6.2.2125 REFILL with the following:
  1666. When the input source is a text file, attempt to read the next line
  1667. from the text-input file. If successful, make the result the current
  1668. input buffer, set >IN to zero, and return true. Otherwise return
  1669. false. See: 6.2.2125 REFILL, 7.6.2.2125 REFILL.
  1670.  
  1671.  
  1672. : RESTORE-INPUT CORE EXT ( xn ... x1 n -- flag )
  1673.  
  1674. Attempt to restore the input source specification to the state
  1675. described by x1 through xn. flag is true if the input source
  1676. specification cannot be so restored. An ambiguous condition exists if
  1677. the input source represented by the arguments is not the same as the
  1678. current input source. See: A.6.2.2182 SAVE-INPUT.
  1679.  
  1680.  
  1681. : ROLL CORE EXT ( xu xu-1 ... x0 u -- xu-1 ... x0 xu )
  1682.  
  1683. Remove u. Rotate u+1 items on the top of the stack. An ambiguous
  1684. condition exists if there are less than u+2 items on the stack before
  1685. ROLL is executed.
  1686.  
  1687.  
  1688. : SAVE-INPUT CORE EXT ( -- xn ... x1 n )
  1689.  
  1690. x1 through xn describe the current state of the input source
  1691. specification for later use by RESTORE-INPUT.
  1692.  
  1693.  
  1694. : SOURCE-ID 'source-i-d' CORE EXT ( -- 0 | -1 )
  1695.  
  1696. Identifies the input source as follows: SOURCE-ID Input source -1
  1697. String (via EVALUATE) 0 User input device See: 11.6.1.2218 SOURCE-ID.
  1698.  
  1699. SOURCE-ID 'source-i-d' FILE ( -- 0 | -1 | fileid )
  1700.  
  1701. Extend 6.2.2218 SOURCE-ID to include text-file input as follows:
  1702.  
  1703.     SOURCE-ID    Input source
  1704.       fileid    Text file 'fileid'
  1705.         -1        String (via EVALUATE)
  1706.          0        User input device
  1707.  
  1708. An ambiguous condition exists if SOURCE-ID is used when BLK contains a
  1709. non-zero value.
  1710.  
  1711.  
  1712. : SPAN CORE EXT ( -- a-addr )
  1713.  
  1714. a-addr is the address of a cell containing the count of characters
  1715. stored by the last execution of EXPECT. Note: This word is
  1716. obsolescent and is included as a concession to existing
  1717. implementations.
  1718.  
  1719.  
  1720. : TIB 't-i-b' CORE EXT ( -- c-addr )
  1721.  
  1722. c-addr is the address of the terminal input buffer. Note: This word
  1723. is obsolescent and is included as a concession to existing
  1724. implementations.
  1725.  
  1726.  
  1727. : TO CORE EXT
  1728.  
  1729. Interpretation: ( x '<spaces>name' -- )
  1730.  
  1731. Skip leading spaces and parse name delimited by a space. Store x in
  1732. name. An ambiguous condition exists if name was not defined by VALUE.
  1733.  
  1734. Compilation: ( '<spaces>name' -- )
  1735.  
  1736. Skip leading spaces and parse name delimited by a space. Append the
  1737. run-time semantics given below to the current definition. An ambiguous
  1738. condition exists if name was not defined by VALUE.
  1739.  
  1740. Run-time: ( x -- )
  1741.  
  1742. Store x in name. Note: An ambiguous condition exists if either
  1743. POSTPONE or [COMPILE] is applied to TO. See: 6.2.2405 VALUE,
  1744. 13.6.1.2295 TO.
  1745.  
  1746. TO LOCAL
  1747.  
  1748. Extend the semantics of 6.2.2295 TO to be:
  1749.  
  1750. Interpretation: ( x '<spaces>name' -- )
  1751.  
  1752. Skip leading spaces and parse name delimited by a space. Store x in
  1753. name. An ambiguous condition exists if name was not defined by VALUE.
  1754.  
  1755. Compilation: ( '<spaces>name' -- )
  1756.  
  1757. Skip leading spaces and parse name delimited by a space. Append the
  1758. run-time semantics given below to the current definition. An ambiguous
  1759. condition exists if name was not definedby either VALUE or (LOCAL).
  1760.  
  1761. Run-time: ( x -- )
  1762.  
  1763. Store x in name. Note: An ambiguous condition exists if either
  1764. POSTPONE or [COMPILE] is applied to TO. See: 3.4.1 Parsing, 6.2.2295
  1765. TO, 6.2.2405 VALUE, 13.6.1.0086 (LOCAL).
  1766.  
  1767.  
  1768. : TRUE CORE EXT ( -- true )
  1769.  
  1770. Return a true flag, a single-cell value with all bits set. See:
  1771. 3.1.3.1 Flags.
  1772.  
  1773.  
  1774. : TUCK CORE EXT ( x1 x2 -- x2 x1 x2 )
  1775.  
  1776. Copy the first (top) stack item below the second stack item.
  1777.  
  1778.  
  1779. : U.R 'u-dot-r' CORE EXT ( u n -- )
  1780.  
  1781. Display u right aligned in a field n characters wide. If the number of
  1782. characters required to display u is greater than n, all digits are
  1783. displayed with no leading spaces in a field as wide as necessary.
  1784.  
  1785.  
  1786. : U> 'u-greater-than' CORE EXT ( u1 u2 -- flag )
  1787.  
  1788. flag is true if and only if u1 is greater than u2. See: 6.1.0540 >.
  1789.  
  1790.  
  1791. : UNUSED CORE EXT ( -- u )
  1792.  
  1793. u is the amount of space remaining in the region addressed by HERE,
  1794. in address units.
  1795.  
  1796.  
  1797. : VALUE CORE EXT ( x '<spaces>name' -- )
  1798.  
  1799. Skip leading space delimiters. Parse name delimited by a space. Create
  1800. a definition for name with the execution semantics defined below, with
  1801. an initial value equal to x. name is referred to as a 'value'. name
  1802.  
  1803. Execution: ( -- x )
  1804.  
  1805. Place x on the stack. The value of x is that given when name was
  1806. created, until the phrase x TO name is executed, causing a new value
  1807. of x to be associated with name. See: 3.4.1 Parsing.
  1808.  
  1809.  
  1810. : WITHIN CORE EXT ( n1|u1 n2|u2 n3|u3 -- flag )
  1811.  
  1812. Perform a comparison of a test value n1|u1 with a lower limit n2|u2
  1813. and an upper limit n3|u3, returning true if either (n2|u2<n3|u3 and
  1814. (n2|u2<=n1|u1 and n1|u1<n3|u3)) or (n2|u2>n3|u3 and(n2|u2<=n1|u1 or
  1815. n1|u1<n3|u3)) is true, returning false otherwise. An ambiguous
  1816. condition exists if n1|u1, n2|u2, and n3|u3 are not all the same type.
  1817.  
  1818.  
  1819. : [COMPILE] 'bracket-compile' CORE EXT
  1820.  
  1821. Interpretation: Interpretation semantics for this word are undefined.
  1822.  
  1823. Compilation: ( '<spaces>name' -- )
  1824.  
  1825. Skip leading space delimiters. Parse name delimited by a space. Find
  1826. name. If name has other than default compilation semantics, append
  1827. them to the current definition; otherwise append the execution
  1828. semantics of name. An ambiguous condition exists if name is not found.
  1829. See: 3.4.1 Parsing.
  1830.  
  1831.  
  1832. : \ 'backslash' CORE EXT
  1833.  
  1834. Compilation: Perform the execution semantics given below.
  1835.  
  1836. Execution: ( 'ccc<eol>'-- )
  1837.  
  1838. Parse and discard the remainder of the parse area. \ is an immediate
  1839. word. See: 7.6.2.2535 \.
  1840.  
  1841. \ 'backslash' BLOCK EXT
  1842.  
  1843. Extend the semantics of 6.1.2535 \ to be: 
  1844.  
  1845. Compilation: Perform the execution semantics given below.
  1846.  
  1847. Execution: ( 'ccc<eol>'-- )
  1848.  
  1849. If BLK contains zero, parse and discard the remainder of the parse
  1850. area; otherwise parse and discard the portion of the parse area
  1851. corresponding to the remainder of the current line. \ is an immediate
  1852. word. See: 6.2.2535 \.
  1853.  
  1854.  
  1855. #
  1856. # 7.6.1 Block words
  1857. #
  1858.  
  1859.  
  1860. : BLK 'b-l-k' BLOCK ( -- a-addr )
  1861.  
  1862. a-addr is the address of a cell containing zero or the number of the
  1863. mass-storage block being interpreted. If BLK contains zero, the input
  1864. source is not a block and can be identified by SOURCE-ID, if SOURCE-ID
  1865. is available. An ambiguous condition exists if a program directly
  1866. alters the contents of BLK. See: 7.3.3 Block buffer regions.
  1867.  
  1868.  
  1869. : BLOCK BLOCK ( u -- a-addr )
  1870.  
  1871. a-addr is the address of the first character of the block buffer
  1872. assigned to mass-storage block u. An ambiguous condition exists if u
  1873. is not an available block number. If block u is already in a block
  1874. buffer, a-addr is the address of that block buffer. If block u is not
  1875. already in memory and there is an unassigned block buffer, transfer
  1876. block u from mass storage to an unassigned block buffer. a-addr is the
  1877. address of that block buffer. If block u is not already in memory and
  1878. there are no unassigned block buffers, unassign a block buffer. If the
  1879. block in that buffer has been UPDATEd, transfer the block to mass
  1880. storage and transfer block u from mass storage into that
  1881. buffer. a-addr is the address of that block buffer. At the conclusion
  1882. of the operation, the block buffer pointed to by a-addr is the current
  1883. block buffer and is assigned to u.
  1884.  
  1885.  
  1886. : BUFFER BLOCK ( u -- a-addr )
  1887.  
  1888. a-addr is the address of the first character of the block buffer
  1889. assigned to block u. The contents of the block are unspecified. An
  1890. ambiguous condition exists if u is not an availableblock number. If
  1891. block u is already in a block buffer, a-addr is the address of that
  1892. block buffer. If block u is not already in memory and there is an
  1893. unassigned buffer, a-addr is the address ofthat block buffer. If block
  1894. u is not already in memory and there are no unassigned block buffers,
  1895. unassign ablock buffer. If the block in that buffer has been UPDATEd,
  1896. transfer the block to mass storage. a-addr is the address of that
  1897. block buffer. At the conclusion of the operation, the block buffer
  1898. pointed to by a-addr is the current blockbuffer and is assigned to u.
  1899. See: 7.6.1.0800 BLOCK.
  1900.  
  1901.  
  1902. : FLUSH BLOCK ( -- )
  1903.  
  1904. Perform the function of SAVE-BUFFERS then unassign all block buffers.
  1905.  
  1906.  
  1907. : LOAD BLOCK ( i*x u -- j*x )
  1908.  
  1909. Save the current input-source specification. Store u in BLK (thus
  1910. making block u the input source and setting the input buffer to
  1911. encompass its contents), set >IN to zero, and interpret. When the
  1912. parse area is exhausted, restore the prior input source
  1913. specification. Other stack effects are due to the words LOADed. An
  1914. ambiguous condition exists if u is zero or is not a valid block
  1915. number. See: 3.4 The Forth text interpreter.
  1916.  
  1917.  
  1918. : SAVE-BUFFERS BLOCK ( -- )
  1919.  
  1920. Transfer the contents of each UPDATEd block buffer to mass storage.
  1921. Mark all buffers as unmodified.
  1922.  
  1923.  
  1924. : UPDATE BLOCK ( -- )
  1925.  
  1926. Mark the current block buffer as modified. An ambiguous condition
  1927. exists if there is no current block buffer. UPDATE does not
  1928. immediately cause I/O. See: 7.6.1.0800 BLOCK, 7.6.1.0820 BUFFER,
  1929. 7.6.1.1559 FLUSH, 7.6.1.2180 SAVE-BUFFERS.
  1930.  
  1931.  
  1932. #
  1933. # 7.6.2 Block extension words
  1934. #
  1935.  
  1936.  
  1937. : EMPTY-BUFFERS BLOCK EXT ( -- )
  1938.  
  1939. Unassign all block buffers. Do not transfer the contents of any
  1940. UPDATEd block buffer to mass storage. See: 7.6.1.0800 BLOCK.
  1941.  
  1942.  
  1943. : LIST BLOCK EXT ( u -- )
  1944.  
  1945. Display block u in an implementation-defined format. Store u in SCR.
  1946. See: 7.6.1.0800 BLOCK.
  1947.  
  1948.  
  1949. : SCR 's-c-r' BLOCK EXT ( -- a-addr )
  1950.  
  1951. a-addr is the address of a cell containing the block number of the
  1952. block most recently LISTed.
  1953.  
  1954.  
  1955. : THRU BLOCK EXT ( i*x u1 u2 -- j*x )
  1956.  
  1957. LOAD the mass storage blocks numbered u1 through u2 in sequence. Other
  1958. stack effects are due to the words LOADed.
  1959.  
  1960.  
  1961. #
  1962. # 8.6.1 Double-Number words
  1963. #
  1964.  
  1965.  
  1966. : 2CONSTANT 'two-constant' DOUBLE ( x1 x2 '<spaces>name' -- )
  1967.  
  1968. Skip leading space delimiters. Parse name delimited by a space. Create
  1969. a definition for name with the execution semantics defined below. name
  1970. is referred to as a 'two-constant.'
  1971.  
  1972. name Execution: ( -- x1 x2 )
  1973.  
  1974. Place cell pair x1 x2 on the stack. See: 3.4.1 Parsing.
  1975.  
  1976.  
  1977. : 2LITERAL 'two-literal' DOUBLE
  1978.  
  1979. Interpretation: Interpretation semantics for this word are undefined.
  1980.  
  1981. Compilation: ( x1 x2 -- )
  1982.  
  1983. Append the run-time semantics below to the current definition.
  1984.  
  1985. Run-time: ( -- x1 x2 )
  1986.  
  1987. Place cell pair x1 x2 on the stack. 
  1988.  
  1989.  
  1990. : 2VARIABLE 'two-variable' DOUBLE ( '<spaces>name' -- )
  1991.  
  1992. Skip leading space delimiters. Parse name delimited by a space. Create
  1993. a definition for name with the execution semantics defined below.
  1994. Reserve two consecutive cells of data space. name is referred to as a
  1995. 'two-variable.'
  1996.  
  1997. name Execution: ( -- a-addr )
  1998.  
  1999. a-addr is the address of the first (lowest address) cell of two
  2000. consecutive cells in data spacereserved by 2VARIABLE when it defined
  2001. name. A program is responsible for initializing the contents. See:
  2002. 3.4.1 Parsing, 6.1.2410 VARIABLE.
  2003.  
  2004.  
  2005. : D+ 'd-plus' DOUBLE ( d1|ud1 d2|ud2 -- d3|ud3 )
  2006.  
  2007. Add d2|ud2 to d1|ud1, giving the sum d3|ud3.
  2008.  
  2009.  
  2010. : D- 'd-minus' DOUBLE ( d1|ud1 d2|ud2 -- d3|ud3 )
  2011.  
  2012. Subtract d2|ud2 from d1|ud1, giving the difference d3|ud3.
  2013.  
  2014.  
  2015. : D. 'd-dot' DOUBLE ( d -- )
  2016.  
  2017. Display d in free field format.
  2018.  
  2019.  
  2020. : D.R 'd-dot-r' DOUBLE ( d n -- )
  2021.  
  2022. Display d right aligned in a field n characters wide. If the number of
  2023. characters required to display d is greater than n, all digits are
  2024. displayed with no leading spaces in a field as wide as necessary.
  2025.  
  2026.  
  2027. : D0< 'd-zero-less' DOUBLE ( d -- flag )
  2028.  
  2029. flag is true if and only if d is less than zero.
  2030.  
  2031.  
  2032. : D0= 'd-zero-equals' DOUBLE ( xd -- flag )
  2033.  
  2034. lag is true if and only if xd is equal to zero.
  2035.  
  2036.  
  2037. : D2* 'd-two-star' DOUBLE ( xd1 -- xd2 )
  2038.  
  2039. xd2 is the result of shifting xd1 one bit toward the most-significant
  2040. bit, filling the vacated least-significant bit with zero.
  2041.  
  2042.  
  2043. : D2/ 'd-two-slash' DOUBLE ( xd1 -- xd2 )
  2044.  
  2045. xd2 is the result of shifting xd1 one bit toward the least-significant
  2046. bit, leaving the most-significant bit unchanged.
  2047.  
  2048.  
  2049. : D< 'd-less-than' DOUBLE ( d1 d2 --- flag )
  2050.  
  2051. flag is true if and only if d1 is less than d2.
  2052.  
  2053.  
  2054. : D= 'd-equals' DOUBLE ( xd1 xd2 --- flag )
  2055.  
  2056. flag is true if and only if xd1 is bit-for-bit the same as xd2.
  2057.  
  2058.  
  2059. : D>S 'd-to-s' DOUBLE ( d --- n )
  2060.  
  2061. n is the equivalent of d. An ambiguous condition exists if d lies
  2062. outside the range of a signed single-cell number.
  2063.  
  2064.  
  2065. : DABS 'd-abs' DOUBLE ( d --- ud )
  2066.  
  2067. ud is the absolute value of d.
  2068.  
  2069.  
  2070. : DMAX 'd-max' DOUBLE ( d1 d2 --- d3 )
  2071.  
  2072. d3 is the greater of d1 and d2.
  2073.  
  2074.  
  2075. : DMIN 'd-min' DOUBLE ( d1 d2 --- d3 )
  2076.  
  2077. d3 is the lesser of d1 and d2.
  2078.  
  2079.  
  2080. : DNEGATE 'd-negate' DOUBLE ( d1 --- d2 )
  2081.  
  2082. d2 is the negation of d1.
  2083.  
  2084.  
  2085. : M*/ 'm-star-slash' DOUBLE ( d1 n1 +n2 --- d2 )
  2086.  
  2087. Multiply d1 by n1 producing the triple-cell intermediate result t.
  2088. Divide t by +n2 giving the double-cell quotient d2. An ambiguous
  2089. condition exists if +n2 is zero or negative, or the quotient lies
  2090. outside of the range of a double-precision signed integer.
  2091.  
  2092.  
  2093. : M+ 'm-plus' DOUBLE ( d1|ud1 n --- d2|ud2 )
  2094.  
  2095. Add n to d1|ud1, giving the sum d2|ud2.
  2096.  
  2097.  
  2098. #
  2099. # 8.6.2 Double-Number extension words
  2100. #
  2101.  
  2102.  
  2103. : 2ROT 'two-rote' DOUBLE EXT ( x1 x2 x3 x4 x5 x6 --- x3 x4 x5 x6 x1 x2 )
  2104.  
  2105. Rotate the top three cell pairs on the stack bringing cell pair x1 x2
  2106. to the top of the stack.
  2107.  
  2108.  
  2109. : DU< 'd-u-less' DOUBLE EXT ( ud1 ud2 --- flag )
  2110.  
  2111. flag is true if and only if ud1 is less than ud2.
  2112.  
  2113.  
  2114. #
  2115. # 9.6.1 Exception words
  2116. #
  2117.  
  2118.  
  2119. : CATCH EXCEPTION ( i*x xt --- j*x 0 | i*x n )
  2120.  
  2121. Push an exception frame on the exception stack and then execute the
  2122. execution token xt (as with EXECUTE) in such a way that control can be
  2123. transferred to a point just after CATCH ifTHROW is executed during the
  2124. execution of xt. If the execution of xt completes normally (i.e., the
  2125. exception frame pushed by this CATCH is not popped by an execution of
  2126. THROW) pop the exception frame and return zero on top of the data
  2127. stack, above whatever stack items would have been returned by xt
  2128. EXECUTE. Otherwise, the remainder of the execution semantics are
  2129. given by THROW.
  2130.  
  2131.  
  2132. : THROW EXCEPTION ( k*x n --- k*x | i*x n )
  2133.  
  2134. If any bits of n are non-zero, pop the topmost exception frame from
  2135. the exception stack, along with everything on the return stack above
  2136. that frame. Then restore the input source specification in use before
  2137. the corresponding CATCH and adjust the depths of all stacks defined by
  2138. this Standard so that they are the same as the depths saved in the
  2139. exception frame (i is the same number as the i in the input arguments
  2140. to the corresponding CATCH), put n on top of the data stack, and
  2141. transfer control to a point just after the CATCH that pushed that
  2142. exception frame. If the top of the stack is non zero and there is no
  2143. exception frame on the exception stack, the behavior is as follows: If
  2144. n is minus-one (-1), perform the function of 6.1.0670 ABORT (the
  2145. version of ABORT in the Core word set), displaying no message. If n is
  2146. minus-two, perform the function of 6.1.0680 ABORT" (the version of
  2147. ABORT" in the Core word set), displaying the characters ccc associated
  2148. with the ABORT" that generated the THROW. Otherwise, the system may
  2149. display an implementation-dependent message giving information about
  2150. the condition associated with the THROW code n. Subsequently, the
  2151. system shall perform the function of 6.1.0670 ABORT (the version of
  2152. ABORT in the Core word set).
  2153.  
  2154.  
  2155. #
  2156. # 10.6.1 Facility words
  2157. #
  2158.  
  2159.  
  2160. : AT-XY 'at-x-y' FACILITY ( u1 u2 -- )
  2161.  
  2162. Perform implementation-dependent steps so that the next character
  2163. displayed will appear in column u1, row u2 of the user output device,
  2164. the upper left corner of which is column zero, row zero. An ambiguous
  2165. condition exists if the operation cannot be performed on the user
  2166. output device with the specified parameters.
  2167.  
  2168.  
  2169. : KEY? 'key-question' FACILITY ( -- flag )
  2170.  
  2171. If a character is available, return true. Otherwise, return false. If
  2172. non-character keyboard events are available before the first valid
  2173. character, they are discarded and are subsequently unavailable. The
  2174. character shall be returned by the next execution of KEY.After KEY?
  2175. returns with a value of true, subsequent executions of KEY? prior to
  2176. the execution of KEY or EKEY also return true, without discarding
  2177. keyboard events.
  2178.  
  2179.  
  2180. : PAGE FACILITY ( -- )
  2181.  
  2182. Move to another page for output. Actual function depends on the output
  2183. device. On a terminal, PAGE clears the screen and resets the cursor
  2184. position to the upper left corner. On aprinter, PAGE performs a form
  2185. feed.
  2186.  
  2187.  
  2188. #
  2189. # 10.6.2 Facility extension words
  2190. #
  2191.  
  2192.  
  2193. : EKEY 'e-key' FACILITY EXT ( -- u )
  2194.  
  2195. Receive one keyboard event u. The encoding of keyboard events is
  2196. implementation defined. See: 10.6.1.1755 KEY?, 6.1.1750 KEY.
  2197.  
  2198.  
  2199. : EKEY>CHAR 'e-key-to-char' FACILITY EXT ( u --- u false | char true )
  2200.  
  2201. If the keyboard event u corresponds to a character in the
  2202. implementation-defined character set, return that character and true.
  2203. Otherwise return u and false.
  2204.  
  2205.  
  2206. : EKEY? 'e-key-question' FACILITY EXT ( -- flag )
  2207.  
  2208. If a keyboard event is available, returns true. Otherwise returns
  2209. false. The event shall be returned by the next execution of EKEY.
  2210. After EKEY? returns with a value of true, subsequent executions of
  2211. EKEY?  prior to the execution of KEY, KEY? or EKEY also return true,
  2212. referring to the same event.
  2213.  
  2214.  
  2215. : EMIT? 'emit-question' FACILITY EXT ( -- flag )
  2216.  
  2217. flag is true if the user output device is ready to accept data and the
  2218. execution of EMIT in place of EMIT? would not have suffered an
  2219. indefinite delay. If the device status is indeterminate, flag is true.
  2220.  
  2221.  
  2222. : MS FACILITY EXT ( u -- )
  2223.  
  2224. Wait at least u milliseconds. Note: The actual length and variability
  2225. of the time period depends upon the implementation-defined resolution
  2226. of the system clock and upon other system and computer characteristics
  2227. beyond the scope of this Standard.
  2228.  
  2229.  
  2230. : TIME&DATE 'time-and-date' FACILITY EXT ( -- +n1 +n2 +n3 +n4 +n5 +n6 )
  2231.  
  2232. Return the current time and date. +n1 is the second {0...59}, +n2 is
  2233. the minute {0...59}, +n3is the hour {0...23}, +n4 is the day {1...31}
  2234. +n5 is the month {1...12}, and +n6 is the year(e.g., 1991).
  2235.  
  2236.  
  2237. #
  2238. # 11.6.1 File Access words
  2239. #
  2240.  
  2241.  
  2242. : BIN FILE ( fam1 --- fam2 )
  2243.  
  2244. Modify the implementation-defined file access method fam1 to
  2245. additionally select a 'binary', i.e., not line oriented, file access
  2246. method, giving access method fam2. See: 11.6.1.2054 R/O, 11.6.1.2056
  2247. R/W, 11.6.1.2425 W/O.
  2248.  
  2249.  
  2250. : CLOSE-FILE FILE ( fileid --- ior )
  2251.  
  2252. Close the file identified by fileid. ior is the implementation-defined
  2253. I/O result code.
  2254.  
  2255.  
  2256. : CREATE-FILE FILE ( c-addr u fam --- fileid ior )
  2257.  
  2258. Create the file named in the character string specified by c-addr and
  2259. u, and open it with file access method fam. The meaning of values of
  2260. fam is implementation defined. If a file with the same name already
  2261. exists, recreate it as an empty file. If the file was successfully
  2262. created and opened, ior is zero, fileid is its identifier, and the
  2263. file has been positioned to the start of the file. Otherwise, ior is
  2264. the implementation-defined I/O result code and fileid is undefined.
  2265.  
  2266.  
  2267. : DELETE-FILE FILE ( c-addr u --- ior )
  2268.  
  2269. Delete the file named in the character string specified by c-addr u.
  2270. ior is the implementation-defined I/O result code.
  2271.  
  2272.  
  2273. : FILE-POSITION FILE ( fileid --- ud ior )
  2274.  
  2275. ud is the current file position for the file identified by fileid. ior
  2276. is the implementation-defined I/O result code. ud is undefined if ior
  2277. is non-zero.
  2278.  
  2279.  
  2280. : FILE-SIZE FILE ( fileid --- ud ior )
  2281.  
  2282. ud is the size, in characters, of the file identified by fileid. ior
  2283. is the implementation-defined I/O result code. This operation does not
  2284. affect the value returned by FILE-POSITION. ud is undefined if ior is
  2285. non-zero.
  2286.  
  2287.  
  2288. : INCLUDE-FILE FILE ( i*xfileid --- j*x )
  2289.  
  2290. Remove fileid from the stack. Save the current input source
  2291. specification, including the current value of SOURCE-ID. Store fileid
  2292. in SOURCE-ID. Make the file specified by fileid the input source.
  2293. Store zero in BLK. Other stack effects are due to the words INCLUDEd.
  2294. Repeat until end of file: read a line from the file, fill the input
  2295. buffer from the contents of that line, set >IN to zero, and interpret.
  2296. Text interpretation begins at the file position where the next file
  2297. read would occur. When the end of the file is reached, close the file
  2298. and restore the input source specification to its saved value. An
  2299. ambiguous condition exists if fileid is invalid, if there is an I/O
  2300. exception reading fileid, or if an I/O exception occurs while closing
  2301. fileid. When an ambiguous condition exists, the status (open or
  2302. closed) of any files that were being interpreted is
  2303. implementation-defined. See: 11.3.4 Input source.
  2304.  
  2305.  
  2306. : INCLUDED FILE ( i*x c-addr u --- j*x )
  2307.  
  2308. Remove c-addr u from the stack. Save the current input source
  2309. specification, including the current value of SOURCE-ID. Open the file
  2310. specified by c-addr u, store the resulting fileid in SOURCE-ID, and
  2311. make it the input source. Store zero in BLK. Other stack effects are
  2312. due to the words included. Repeat until end of file: read a line from
  2313. the file, fill the input buffer from the contents of that line, set
  2314. >IN to zero, and interpret. Text interpretation begins at the file
  2315. position where the next file read would occur. When the end of the
  2316. file is reached, close the file and restore the input source
  2317. specification toits saved value. An ambiguous condition exists if the
  2318. named file can not be opened, if an I/O exception occurs reading the
  2319. file, or if an I/O exception occurs while closing the file. When an
  2320. ambiguous condition exists, the status (open or closed) of any files
  2321. that were being interpreted is implementation-defined. See:
  2322. 11.6.1.1717 INCLUDE-FILE.
  2323.  
  2324.  
  2325. : OPEN-FILE FILE ( c-addr u fam --- fileid ior )
  2326.  
  2327. Open the file named in the character string specified by c-addr u,
  2328. with file access method indicated by fam. The meaning of values of fam
  2329. is implementation defined.If the file is successfully opened, ior is
  2330. zero, fileid is its identifier, and the file has been positioned to
  2331. the start of the file. Otherwise, ior is the implementation-defined
  2332. I/O result code and fileid is undefined.
  2333.  
  2334.  
  2335. : R/O 'r-o' FILE ( -- fam )
  2336.  
  2337. fam is the implementation-defined value for selecting the 'read only'
  2338. file access method. See: 11.6.1.1010 CREATE-FILE, 11.6.1.1970
  2339. OPEN-FILE.
  2340.  
  2341.  
  2342. : R/W 'r-w' FILE ( -- fam )
  2343.  
  2344. fam is the implementation-defined value for selecting the 'read/write'
  2345. file access method. See: 11.6.1.1010 CREATE-FILE, 11.6.1.1970
  2346. OPEN-FILE.
  2347.  
  2348.  
  2349. : READ-FILE FILE ( c-addr u1 fileid --- u2 ior )
  2350.  
  2351. Read u1 consecutive characters to c-addr from the current position of
  2352. the file identified by fileid. If u1 characters are read without an
  2353. exception, ior is zero and u2 is equal to u1. If the end of the file
  2354. is reached before u1 characters are read, ior is zero and u2 is the
  2355. number of characters actually read. If the operation is initiated when
  2356. the value returned by FILE-POSITION is equal to the value returned by
  2357. FILE- SIZE for the file identified by fileid, ior is zero and u2 is
  2358. zero. If an exception occurs, ior is the implementation-defined I/O
  2359. result code, and u2 is the number of characters transferred to c-addr
  2360. without an exception. An ambiguous condition exists if the operation
  2361. is initiated when the value returned by FILE-POSITION is greater than
  2362. the value returned by FILE-SIZE for the file identified by fileid, or
  2363. if the requested operation attempts to read portions of the file not
  2364. written. At the conclusion of the operation, FILE-POSITION returns
  2365. the next file position after thelast character read.
  2366.  
  2367.  
  2368. : READ-LINE FILE ( c-addr u1 fileid --- u2 flag ior )
  2369.  
  2370. Read the next line from the file specified by fileid into memory at
  2371. the address c-addr. At most u1 characters are read. Up to two
  2372. implementation-defined line terminating characters may be read into
  2373. memory at the end of the line, but are not included in the count u2.
  2374. The line buffer provided by c-addr should be at least u1+2 characters
  2375. long.If the operation succeeded, flag is true and ior is zero. If a
  2376. line terminator was received before u1 characters were read, then u2
  2377. is the number of characters, not including the line terminator,
  2378. actually read (0 <= u2 <= u1). When u1 = u2 the line terminator has
  2379. yet to be reached. If the operation is initiated when the value
  2380. returned by FILE- POSITION is equal to the value returned by FILE-SIZE
  2381. for the file identified by fileid, flag is false, ior is zero, and u2
  2382. is zero. If ior is non-zero, an exception occurred during the
  2383. operation and ior is the implementation-defined I/O result code. An
  2384. ambiguous condition exists if the operation is initiated when the
  2385. value returned by FILE- POSITION is greater than the value returned by
  2386. FILE-SIZE for the file identified by fileid, or if the requested
  2387. operation attempts to read portions of the file not written. At the
  2388. conclusion of the operation, FILE-POSITION returns the next file
  2389. position after the last character read.
  2390.  
  2391.  
  2392. : REPOSITION-FILE FILE ( ud fileid --- ior )
  2393.  
  2394. Reposition the file identified by fileid to ud. ior is the
  2395. implementation-defined I/O result code. An ambiguous condition exists
  2396. if the file is positioned outside the file boundaries. At the
  2397. conclusion of the operation, FILE-POSITION returns the value ud.
  2398.  
  2399.  
  2400. : RESIZE-FILE FILE ( ud fileid --- ior )
  2401.  
  2402. Set the size of the file identified by fileid to ud. ior is the
  2403. implementation-defined I/O result code. If the resultant file is
  2404. larger than the file before the operation, the portion of the file
  2405. added as aresult of the operation might not have been written. At the
  2406. conclusion of the operation, FILE-SIZE returns the value ud and
  2407. FILE-POSITION returns an unspecified value. See: 11.6.1.2080
  2408. READ-FILE, 11.6.1.2090 READ-LINE.
  2409.  
  2410.  
  2411. : W/O 'w-o' FILE ( -- fam )
  2412.  
  2413. fam is the implementation-defined value for selecting the 'write only'
  2414. file access method. See: 11.6.1.1010 CREATE-FILE, 11.6.1.1970
  2415. OPEN-FILE.
  2416.  
  2417.  
  2418. : WRITE-FILE FILE ( c-addr u fileid --- ior )
  2419.  
  2420. Write u characters from c-addr to the file identified by fileid
  2421. starting at its current position. ior is the implementation-defined
  2422. I/O result code. At the conclusion of the operation, FILE-POSITION
  2423. returns the next file position after thelast character written to the
  2424. file, and FILE-SIZE returns a value greater than or equal to the value
  2425. returned by FILE-POSITION. See: 11.6.1.2080 READ-FILE, 11.6.1.2090
  2426. READ-LINE.
  2427.  
  2428.  
  2429. : WRITE-LINE FILE ( c-addr u fileid --- ior )
  2430.  
  2431. Write u characters from c-addr followed by the implementation-dependent
  2432. line terminator to the file identified by fileid starting at its
  2433. current position. ior is the implementation-definedI/O result code. At
  2434. the conclusion of the operation, FILE-POSITION returns the next file
  2435. position after the last character written to the file, and FILE-SIZE
  2436. returns a value greater than or equal to the value returned by
  2437. FILE-POSITION. See: 11.6.1.2080 READ-FILE, 11.6.1.2090 READ-LINE.
  2438.  
  2439.  
  2440. #
  2441. # 11.6.2 File-Access extension words
  2442. #
  2443.  
  2444.  
  2445. : FILE-STATUS FILE EXT ( c-addr u --- x ior )
  2446.  
  2447. Return the status of the file identified by the character string
  2448. c-addr u. If the file exists, ior is zero; otherwise ior is the
  2449. implementation-defined I/O result code. x contains implementation-
  2450. defined information about the file.
  2451.  
  2452.  
  2453. : FLUSH-FILE FILE EXT ( fileid --- ior )
  2454.  
  2455. Attempt to force any buffered information written to the file referred
  2456. to by fileid to be written to mass storage, and the size information
  2457. for the file to be recorded in the storage directory if changed. If
  2458. the operation is successful, ior is zero. Otherwise, it is an
  2459. implementation-defined I/O result code.
  2460.  
  2461.  
  2462. : RENAME-FILE FILE EXT ( c-addr1 u1 c-addr2 u2 --- ior )
  2463.  
  2464. Rename the file named by the character string c-addr1 u1 to the name
  2465. in the character stringc-addr2 u2. ior is the implementation-defined
  2466. I/O result code.
  2467.  
  2468.  
  2469. #
  2470. # 12.6.1 Floating-Point words
  2471. #
  2472.  
  2473.  
  2474. : >FLOAT 'to-float' FLOATING ( c-addr u --- true | false ) ( F: -- r | )
  2475.  
  2476. An attempt is made to convert the string specified by c-addr and u to 
  2477. internal floating-point representation. If the string represents a 
  2478. valid floating-point number in the syntax below, its value r and true 
  2479. are returned. If the string does not represent a valid floating-point 
  2480. numberonly false is returned. A string of blanks should be treated as a 
  2481. special case representing zero.
  2482.  
  2483. The syntax of a convertible string
  2484.         := <significand>[<exponent>]
  2485.   <significand>    := [<sign>]{<digits>[.<digits0>] | .<digits>}
  2486.      <exponent>    := <marker><digits0>
  2487.        <marker>    := {<e-form> | <sign-form>}
  2488.        <e-form>    := <e-char>[<sign-form>]
  2489.     <sign-form>    := { + | }
  2490.        <e-char>    := { D | d | E | e )
  2491.  
  2492.  
  2493. : D>F 'd-to-f' FLOATING ( d -- ) ( F: -- r )
  2494.  
  2495. r is the floating-point equivalent of d. An ambiguous condition exists
  2496. if d cannot be precisely represented as a floating-point value.
  2497.  
  2498.  
  2499. : F! 'f-store' FLOATING ( f-addr -- ) ( F: r -- )
  2500.  
  2501. Store r at f-addr.
  2502.  
  2503.  
  2504. : F* 'f-star' FLOATING ( F: r1 r2 --- r3 )
  2505.  
  2506. Multiply r1 by r2 giving r3.
  2507.  
  2508.  
  2509. : F+ 'f-plus' FLOATING ( F: r1 r2 --- r3 )
  2510.  
  2511. Add r1 to r2 giving the sum r3.
  2512.  
  2513.  
  2514. : F- 'f-minus' FLOATING ( F: r1 r2 --- r3 )
  2515.  
  2516. Subtract r2 from r1, giving r3.
  2517.  
  2518.  
  2519. : F/ 'f-slash' FLOATING ( F: r1 r2 --- r3 )
  2520.  
  2521. Divide r1 by r2, giving the quotient r3. An ambiguous condition exists
  2522. if r2 is zero, or the quotient lies outside of the range of a
  2523. floating-point number.
  2524.  
  2525.  
  2526. : F0< 'f-zero-less-than' FLOATING ( -- flag ) ( F: r -- )
  2527.  
  2528. flag is true if and only if r is less than zero.
  2529.  
  2530.  
  2531. : F0= 'f-zero-equals' FLOATING ( -- flag ) ( F: r -- )
  2532.  
  2533. flag is true if and only if r is equal to zero.
  2534.  
  2535.  
  2536. : F< 'f-less-than' FLOATING ( -- flag ) ( F: r1 r2 -- )
  2537.  
  2538. flag is true if and only if r1 is less than r2.
  2539.  
  2540.  
  2541. : F>D 'f-to-d' FLOATING ( -- d ) ( F: r -- )
  2542.  
  2543. d is the double-cell signed-integer equivalent of the integer portion of 
  2544. r. The fractional portion of r is discarded. An ambiguous condition 
  2545. exists if the integer portion of r cannot be precisely represented as a 
  2546. double-cell signed integer.
  2547.  
  2548.  
  2549. : F@ 'f-fetch' FLOATING ( f-addr -- ) ( F: -- r )
  2550.  
  2551. r is the value stored at f-addr.
  2552.  
  2553.  
  2554. : FALIGN 'f-align' FLOATING ( -- )
  2555.  
  2556. If the data-space pointer is not float aligned, reserve enough data
  2557. space to make it so.
  2558.  
  2559.  
  2560. : FALIGNED 'f-aligned' FLOATING ( addr --- f-addr )
  2561.  
  2562. f-addr is the first float-aligned address greater than or equal to
  2563. addr.
  2564.  
  2565.  
  2566. : FCONSTANT 'f-constant' FLOATING
  2567.     ( '<spaces>name' -- ) ( F: r -- )
  2568.  
  2569. Skip leading space delimiters. Parse name delimited by a space. Create
  2570. a definition for namewith the execution semantics defined below. name
  2571. is referred to as an 'f-constant.'
  2572.  
  2573. name Execution: ( -- ) ( F: -- r )
  2574.  
  2575. Place r on the floating-point stack. See: 3.4.1 Parsing.
  2576.  
  2577.  
  2578. : FDEPTH 'f-depth' FLOATING ( -- +n )
  2579.  
  2580. +n is the number of values contained on the default separate floating-
  2581. point stack. If floating-point numbers are kept on the data stack, +n
  2582. is the current number of possible floating-point values contained on
  2583. the data stack.
  2584.  
  2585.  
  2586. : FDROP 'f-drop' FLOATING ( F: r -- )
  2587.  
  2588. Remove r from the floating-point stack.
  2589.  
  2590.  
  2591. : FDUP 'f-dupe' FLOATING ( F: r --- r r )
  2592.  
  2593. Duplicate r.
  2594.  
  2595.  
  2596. : FLITERAL 'f-literal' FLOATING
  2597.  
  2598. Interpretation: I nterpretation semantics for this word are undefined.
  2599.  
  2600. Compilation: ( F: r -- )
  2601.  
  2602. Append the run-time semantics given below to the current definition.
  2603. Run-time: ( F: -- r )
  2604.  
  2605. Place r on the floating-point stack.
  2606.  
  2607.  
  2608. : FLOAT+ 'float-plus' FLOATING ( f-addr1 --- f-addr2 )
  2609.  
  2610. Add the size in address units of a floating-point number to f-addr1,
  2611. giving f-addr2.
  2612.  
  2613.  
  2614. : FLOATS FLOATING ( n1 --- n2 )
  2615.  
  2616. n2 is the size in address units of n1 floating-point numbers.
  2617.  
  2618.  
  2619. : FLOOR FLOATING ( F: r1 --- r2 )
  2620.  
  2621. Round r1 to an integral value using the 'round toward negative
  2622. infinity' rule, giving r2.
  2623.  
  2624.  
  2625. : FMAX 'f-max' FLOATING ( F: r1 r2 --- r3 )
  2626.  
  2627. r3 is the greater of r1 and r2.
  2628.  
  2629.  
  2630. : FMIN 'f-min' FLOATING ( F: r1 r2 --- r3 )
  2631.  
  2632. r3 is the lesser of r1 and r2.
  2633.  
  2634.  
  2635. : FNEGATE 'f-negate' FLOATING ( F: r1 --- r2 )
  2636.  
  2637. r2 is the negation of r1.
  2638.  
  2639.  
  2640. : FOVER 'f-over' FLOATING ( F: r1 r2 --- r1 r2 r1 )
  2641.  
  2642. Place a copy of r1 on top of the floating-point stack.
  2643.  
  2644.  
  2645. : FROT 'f-rote' FLOATING ( F: r1 r2 r3 --- r2 r3 r1 )
  2646.  
  2647. Rotate the top three floating-point stack entries.
  2648.  
  2649.  
  2650. : FROUND 'f-round' FLOATING ( F: r1 --- r2 )
  2651.  
  2652. Round r1 to an integral value using the 'round to nearest' rule,
  2653. giving r2. See: 12.3.2 Floating-point operations.
  2654.  
  2655.  
  2656. : FSWAP 'f-swap' FLOATING ( F: r1 r2 --- r2 r1 )
  2657.  
  2658. Exchange the top two floating-point stack items.
  2659.  
  2660.  
  2661. : FVARIABLE 'f-variable' FLOATING ( '<spaces>name' -- )
  2662.  
  2663. Skip leading space delimiters. Parse name delimited by a space. Create
  2664. a definition for name with the execution semantics defined below.
  2665. Reserve 1 FLOATS address units of data spaceat a float-aligned
  2666. address. name is referred to as an 'f-variable.'
  2667.  
  2668. name Execution: ( --f-addr )
  2669.  
  2670. f-addr is the address of the data space reserved by FVARIABLE when it
  2671. created name. A program is responsible for initializing the contents
  2672. of the reserved space. See: 3.4.1 Parsing.
  2673.  
  2674.  
  2675. : REPRESENT FLOATING ( c-addr u --- n flag1 flag2 ) (F: r -- )
  2676.         or ( r c-addr u --- n flag1 flag2 )
  2677.  
  2678. At c-addr, place the character-string external representation of the
  2679. significand of the floating-point number r. Return the decimal-base
  2680. exponent as n, the sign as flag1 and 'valid result' asflag2. The
  2681. character string shall consist of the u most significant digits of the
  2682. significand represented as a decimal fraction with the implied decimal
  2683. point to the left of the first digit, and the first digit zero only if
  2684. all digits are zero. The significand is rounded to u digits following
  2685. the round to nearest rule; n is adjusted, if necessary, to correspond
  2686. to the rounded magnitude of the significand. If flag2 is true then r
  2687. was in the implementation-defined range of floating-point numbers. If
  2688. flag1 is true then r is negative. An ambiguous condition exists if the
  2689. value of BASE is not decimal ten. When flag2 is false, n and flag1 are
  2690. implementation defined, as are the contents of c-addr. Under these
  2691. circumstances, the string at c-addr shall consist of graphic characters.
  2692. See: 3.2.1.2 Digit conversion, 6.1.0750 BASE, 12.3.2 Floating-point
  2693. operations.
  2694.  
  2695.  
  2696. #
  2697. # 12.6.2 Floating-Point extension words
  2698. #
  2699.  
  2700.  
  2701. : DF! 'd-f-store' FLOATING EXT ( df-addr -- ) ( F: r -- )
  2702.  
  2703. Store the floating-point number r as a 64-bit IEEE double-precision
  2704. number at df-addr. If the significand of the internal representation
  2705. of r has more precision than the IEEE double-precision format, it will
  2706. be rounded using the 'round to nearest' rule. An ambiguous condition
  2707. exists if the exponent of r is too large to be accommodated in IEEE
  2708. double-precision format. See: 12.3.1.1 Addresses, 12.3.2
  2709. Floating-point operations.
  2710.  
  2711.  
  2712. : DF@ 'd-f-fetch' FLOATING EXT ( df-addr -- ) ( F: -- r )
  2713.  
  2714. Fetch the 64-bit IEEE double-precision number stored at df-addr to the
  2715. floating-point stack as r in the internal representation. If the IEEE
  2716. double-precision significand has more precision than the internal
  2717. representation it will be rounded to the internal representation using
  2718. the'round to nearest' rule. An ambiguous condition exists if the
  2719. exponent of the IEEE double-precision representation is too large to
  2720. be accommodated by the internal representation. See: 2.3.1.1
  2721. Addresses, 12.3.2 Floating-point operations.
  2722.  
  2723.  
  2724. : DFALIGN 'd-f-align' FLOATING EXT ( -- )
  2725.  
  2726. If the data-space pointer is not double-float aligned, reserve enough
  2727. data space to make it so. See: 12.3.1.1 Addresses.
  2728.  
  2729.  
  2730. : DFALIGNED 'd-f-aligned' FLOATING EXT ( addr --- df-addr )
  2731.  
  2732. df-addr is the first double-float-aligned address greater than or
  2733. equal to addr. See: 12.3.1.1 Addresses.
  2734.  
  2735.  
  2736. : DFLOAT+ 'd-float-plus' FLOATING EXT ( df-addr1 --- df-addr2 )
  2737.  
  2738. Add the size in address units of a 64-bit IEEE double-precision number
  2739. to df-addr1, giving df-addr2. See: 12.3.1.1 Addresses.
  2740.  
  2741.  
  2742. : DFLOATS 'd-floats' FLOATING EXT ( n1 --- n2 )
  2743.  
  2744. n2 is the size in address units of n1 64-bit IEEE double-precision
  2745. numbers.
  2746.  
  2747.  
  2748. : F** 'f-star-star' FLOATING EXT ( F: r1 r2 --- r3 )
  2749.  
  2750. Raise r1 to the power r2, giving the product r3.
  2751.  
  2752.  
  2753. : F. 'f-dot' FLOATING EXT ( -- ) ( F: r -- )
  2754.  
  2755. Display, with a trailing space, the top number on the floating-point
  2756. stack using fixed-point notation: [-]<digits>.<digits0> An ambiguous
  2757. condition exists if the value of BASE is not (decimal) ten or if the
  2758. character string representation exceeds the size of the pictured
  2759. numeric output string buffer. See: 12.6.1.0558 >FLOAT.
  2760.  
  2761.  
  2762. : FABS 'f-abs' FLOATING EXT ( F: r1 --- r2 )
  2763.  
  2764. r2 is the absolute value of r1.
  2765.  
  2766.  
  2767. : FACOS 'f-a-cos' FLOATING EXT ( F: r1 --- r2 )
  2768.  
  2769. r2 is the principal radian angle whose cosine is r1. An ambiguous
  2770. condition exists if |r1| is greater than 1.
  2771.  
  2772.  
  2773. : FACOSH 'f-a-cosh' FLOATING EXT ( F: r1 --- r2 )
  2774.  
  2775. r2 is the floating-point value whose hyperbolic cosine is r1. An
  2776. ambiguous condition exists if r1 is less than one.
  2777.  
  2778.  
  2779. : FALOG 'f-a-log' FLOATING EXT ( F: r1 --- r2 )
  2780.  
  2781. Raise ten to the power r1, giving r2.
  2782.  
  2783.  
  2784. : FASIN 'f-a-sine' FLOATING EXT ( F: r1 --- r2 )
  2785.  
  2786. r2 is the principal radian angle whose sine is r1. An ambiguous
  2787. condition exists if |r1| is greater than one.
  2788.  
  2789.  
  2790. : FASINH 'f-a-cinch' FLOATING EXT ( F: r1 --- r2 )
  2791.  
  2792. r2 is the floating-point value whose hyperbolic sine is r1. An
  2793. ambiguous condition exists if r1is less than zero.
  2794.  
  2795.  
  2796. : FATAN 'f-a-tan' FLOATING EXT ( F: r1 --- r2 )
  2797.  
  2798. r2 is the principal radian angle whose tangent is r1.
  2799.  
  2800.  
  2801. : FATAN2 'f-a-tan-two' FLOATING EXT ( F: r1 r2 --- r3 )
  2802.  
  2803. r3 is the radian angle whose tangent is r1/r2. An ambiguous condition
  2804. exists if r1 and r2 are zero.
  2805.  
  2806.  
  2807. : FATANH 'f-a-tan-h' FLOATING EXT ( F: r1 --- r2 )
  2808.  
  2809. r2 is the floating-point value whose hyperbolic tangent is r1. An
  2810. ambiguous condition exists if r1 is outside the range of -1E0 to 1E0.
  2811.  
  2812.  
  2813. : FCOS 'f-cos' FLOATING EXT ( F: r1 --- r2 )
  2814.  
  2815. r2 is the cosine of the radian angle r1.
  2816.  
  2817.  
  2818. : FCOSH 'f-cosh' FLOATING EXT ( F: r1 --- r2 )
  2819.  
  2820. r2 is the hyperbolic cosine of r1.
  2821.  
  2822.  
  2823. : FE. 'f-e-dot' FLOATING EXT ( -- ) ( F: r -- )
  2824.  
  2825. Display, with a trailing space, the top number on the floating-point
  2826. stack using engineering notation, where the significand is greater
  2827. than or equal to 1.0 and less than 1000.0 and the exponent is a
  2828. multiple of three. An ambiguous condition exists if the value of BASE
  2829. is not (decimal) ten or if the character string representation exceeds
  2830. the size of the pictured numeric output string buffer. See: 6.1.0750
  2831. BASE, 12.3.2 Floating-point operations, 12.6.1.2143 REPRESENT.
  2832.  
  2833.  
  2834. : FEXP 'f-e-x-p' FLOATING EXT ( F: r1 --- r2 )
  2835.  
  2836. Raise e to the power r1, giving r2.
  2837.  
  2838.  
  2839. : FEXPM1 'f-e-x-p-m-one' FLOATING EXT ( F: r1 --- r2 )
  2840.  
  2841. Raise e to the power r1 and subtract one, giving r2.
  2842.  
  2843.  
  2844. : FLN 'f-l-n' FLOATING EXT ( F: r1 --- r2 )
  2845.  
  2846. r2 is the natural logarithm of r1. An ambiguous condition exists if r1
  2847. is less than or equal to zero.
  2848.  
  2849.  
  2850. : FLNP1 'f-l-n-p-one' FLOATING EXT ( F: r1 --- r2 )
  2851.  
  2852. r2 is the natural logarithm of the quantity r1 plus one. An ambiguous
  2853. condition exists if r1 is less than or equal to negative one.
  2854.  
  2855.  
  2856. : FLOG 'f-log' FLOATING EXT ( F: r1 --- r2 )
  2857.  
  2858. r2 is the base-ten logarithm of r1. An ambiguous condition exists if
  2859. r1 is less than or equal to zero.
  2860.  
  2861.  
  2862. : FS. 'f-s-dot' FLOATING EXT ( -- ) ( F: r -- )
  2863.  
  2864. Display, with a trailing space, the top number on the floating-point 
  2865. stack in scientific notation: 
  2866.     <significand><exponent>where: 
  2867.     <significand> := [-]<digit>.<digits0>
  2868.        <exponent> := E[-]<digits>
  2869.  
  2870. An ambiguous condition exists if the value of BASE is not (decimal)
  2871. ten or if the character string representation exceeds the size of the
  2872. pictured numeric output string buffer. See: 6.1.0750 BASE, 12.3.2
  2873. Floating-point operations, 12.6.1.2143 REPRESENT.
  2874.  
  2875.  
  2876. : FSIN 'f-sine' FLOATING EXT ( F: r1 --- r2 )
  2877.  
  2878. r2 is the sine of the radian angle r1.
  2879.  
  2880.  
  2881. : FSINCOS 'f-sine-cos' FLOATING EXT ( F: r1 --- r2 r3 )
  2882.  
  2883. r2 is the sine of the radian angle r1. r3 is the cosine of the radian
  2884. angle r1.
  2885.  
  2886.  
  2887. : FSINH 'f-cinch' FLOATING EXT ( F: r1 --- r2 )
  2888.  
  2889. r2 is the hyperbolic sine of r1.
  2890.  
  2891.  
  2892. : FSQRT 'f-square-root' FLOATING EXT ( F: r1 --- r2 )
  2893.  
  2894. r2 is the square root of r1. An ambiguous condition exists if r1 is
  2895. less than zero.
  2896.  
  2897.  
  2898. : FTAN 'f-tan' FLOATING EXT ( F: r1 --- r2 )
  2899.  
  2900. r2 is the tangent of the radian angle r1. An ambiguous condition
  2901. exists if cos(r1) is zero.
  2902.  
  2903.  
  2904. : FTANH 'f-tan-h' FLOATING EXT ( F: r1 --- r2 )
  2905.  
  2906. r2 is the hyperbolic tangent of r1.
  2907.  
  2908.  
  2909. : F~ 'f-proximate' FLOATING EXT ( -- flag ) ( F: r1 r2 r3 -- )
  2910.  
  2911. If r3 is positive, flag is true if the absolute value of (r1 minus r2)
  2912. is less than r3.If r3 is zero, flag is true if the implementation-
  2913. dependent encoding of r1 and r2 are exactly identical (positive and
  2914. negative zero are unequal if they have distinct encodings). If r3 is
  2915. negative, flag is true if the absolute value of (r1 minus r2) is less
  2916. than the absolute value of r3 times the sum of the absolute values of
  2917. r1 and r2.
  2918.  
  2919.  
  2920. : PRECISION FLOATING EXT ( -- u )
  2921.  
  2922. Return the number of significant digits currently used by F., FE., or
  2923. FS. as u.
  2924.  
  2925.  
  2926. : SET-PRECISION FLOATING EXT ( u -- )
  2927.  
  2928. Set the number of significant digits currently used by F., FE., or FS.
  2929. to u.
  2930.  
  2931.  
  2932. : SF! 's-f-store' FLOATING EXT ( sf-addr -- ) ( F: r -- )
  2933.  
  2934. Store the floating-point number r as a 32-bit IEEE single-precision
  2935. number at sf-addr. If the significand of the internal representation
  2936. of r has more precision than the IEEE single-precision format, it will
  2937. be rounded using the 'round to nearest' rule. An ambiguous condition
  2938. exists if the exponent of r is too large to be accommodated by the
  2939. IEEE single-precision format. See: 12.3.1.1 Addresses, 12.3.2
  2940. Floating-point operations.
  2941.  
  2942.  
  2943. : SF@ 's-f-fetch' FLOATING EXT ( sf-addr -- ) ( F: --- r )
  2944.  
  2945. Fetch the 32-bit IEEE single-precision number stored at sf-addr to the
  2946. floating-point stack as r in the internal representation. If the IEEE
  2947. single-precision significand has more precision than the internal
  2948. representation, it will be rounded to the internal representation
  2949. using the'round to nearest' rule. An ambiguous condition exists if the
  2950. exponent of the IEEE single-precision representation is too large to
  2951. be accommodated by the internal representation. See: 12.3.1.1
  2952. Addresses, 12.3.2 Floating-point operations.
  2953.  
  2954.  
  2955. : SFALIGN 's-f-align' FLOATING EXT ( -- )
  2956.  
  2957. If the data-space pointer is not single-float aligned, reserve enough
  2958. data space to make it so. See: 12.3.1.1 Addresses.
  2959.  
  2960.  
  2961. : SFALIGNED 's-f-aligned' FLOATING EXT ( addr --- sf-addr )
  2962.  
  2963. sf-addr is the first single-float-aligned address greater than or
  2964. equal to addr. See: 12.3.1.1 Addresses.
  2965.  
  2966.  
  2967. : SFLOAT+ 's-float-plus' FLOATING EXT ( sf-addr1 --- sf-addr2 )
  2968.  
  2969. Add the size in address units of a 32-bit IEEE single-precision number
  2970. to sf-addr1, giving sf-addr2. See: 12.3.1.1 Addresses.
  2971.  
  2972.  
  2973. : SFLOATS 's-floats' FLOATING EXT ( n1 --- n2 )
  2974.  
  2975. n2 is the size in address units of n1 32-bit IEEE single-precision
  2976. numbers. See: 12.3.1.1 Addresses.
  2977.  
  2978.  
  2979. #
  2980. # 13.6.1 Locals words
  2981. #
  2982.  
  2983.  
  2984. : (LOCAL) 'Paren-local-paren' LOCAL
  2985.  
  2986. Interpretation: Interpretation semantics for this word are undefined.
  2987.  
  2988. Execution: ( c-addr u -- )
  2989.  
  2990. When executed during compilation, (LOCAL) passes a message to the
  2991. system that has one of two meanings. If u is non-zero, the message
  2992. identifies a new local whose definition name is given by the string of
  2993. characters identified by c-addr u. If u is zero, the message is 'last
  2994. local' and c-addr has no significance. The result of executing (LOCAL)
  2995. during compilation of a definition is to create a set of named local
  2996. identifiers, each of which is a definition name, that only have
  2997. execution semantics within the scope of that definition's source.
  2998.  
  2999. local Execution: ( -- x )
  3000.  
  3001. Push the local's value, x, onto the stack. The local's value is
  3002. initialized as described in 13.3.3 Processing locals and may be
  3003. changed by preceding the local's name with TO. An ambiguous condition
  3004. exists when local is executed while in interpretation state. Note:
  3005. This word does not have special compilation semantics in the usual
  3006. sense because it provides access to a system capability for use by
  3007. other user-defined words that do have them. However,the locals
  3008. facility as a whole and the sequence of messages passed defines
  3009. specific usage rules with semantic implications that are described in
  3010. detail in section 13.3.3 Processing locals.
  3011.  
  3012. Note: This word is not intended for direct use in a definition to
  3013. declare that definition's locals. It is instead used by system or user
  3014. compiling words. These compiling words in turn define their own
  3015. syntax, and may be used directly in definitions to declare locals. In
  3016. this context, the syntax for (LOCAL) is defined in terms of a sequence
  3017. of compile-time messages and is described in detail in section 13.3.3
  3018. Processing locals. Note: The Locals word set modifies the syntax and
  3019. semantics of 6.2.2295 TO as defined in the Core Extensions word set.
  3020. See: 3.4 The Forth text interpreter.
  3021.  
  3022.  
  3023. #
  3024. # 13.6.2 Locals extension words
  3025. #
  3026.  
  3027.  
  3028. : LOCALS| 'locals-bar' LOCAL EXT
  3029.  
  3030. Interpretation: Interpretation semantics for this word are undefined.
  3031.  
  3032. Compilation: ( 'name1' 'name2' ... 'namen' '|' -- )
  3033.  
  3034. Create up to eight local identifiers as described in (LOCAL). The list
  3035. of locals to be definedis terminated by |. Append the run-time
  3036. semantics given below to the current definition.
  3037.  
  3038. Run-time: ( xn ... x2 x1 -- )
  3039.  
  3040. Initialize up to eight local identifiers as described in 13.6.1.0086
  3041. (LOCAL), each of which takes as its initial value the top stack item,
  3042. removing it from the stack. Identifier name1 is initialized with x1,
  3043. identifier name2 with x2, etc. When invoked, each local will return
  3044. its value. The value of a local may be changed using 13.6.1.2295 TO.
  3045.  
  3046.  
  3047. #
  3048. # 14.6.1 Memory-Allocation words
  3049. #
  3050.  
  3051.  
  3052. : ALLOCATE MEMORY ( u --- a-addr ior )
  3053.  
  3054. Allocate u address units of contiguous data space. The data-space
  3055. pointer is unaffected by this operation. The initial content of the
  3056. allocated space is undefined.If the allocation succeeds, a-addr is the
  3057. aligned starting address of the allocated space and ior is zero. If
  3058. the operation fails, a-addr does not represent a valid address and ior
  3059. is the implementation-defined I/O result code. See: 6.1.1650 HERE,
  3060. 14.6.1.1605 FREE, 14.6.1.2145 RESIZE.
  3061.  
  3062.  
  3063. : FREE MEMORY ( a-addr --- ior )
  3064.  
  3065. Return the contiguous region of data space indicated by a-addr to the
  3066. system for later allocation. a-addr shall indicate a region of data
  3067. space that was previously obtained by ALLOCATE or RESIZE. The data-
  3068. space pointer is unaffected by this operation. If the operation
  3069. succeeds, ior is zero. If the operation fails, ior is the
  3070. implementation-defined I/O result code. See: 6.1.1650 HERE,
  3071. 14.6.1.0707 ALLOCATE, 14.6.1.2145 RESIZE.
  3072.  
  3073.  
  3074. : RESIZE MEMORY ( a-addr1 u --- a-addr2 ior )
  3075.  
  3076. Change the allocation of the contiguous data space starting at the
  3077. address a-addr1, previously allocated by ALLOCATE or RESIZE, to u
  3078. address units. u may be either larger or smaller than the current size
  3079. of the region. The data-space pointer is unaffected by this operation.
  3080. If the operation succeeds, a-addr2 is the aligned starting address of
  3081. u address units of allocated memory and ior is zero. a-addr2 may be,
  3082. but need not be, the same as a-addr1. If they are not the same, the
  3083. values contained in the region at a-addr1 are copied to a-addr2, up to
  3084. the minimum size of either of the two regions. If they are the same,
  3085. the values contained in the region are preserved to the minimum of u
  3086. or the original size. If a-addr2 is not the same as a-addr1, the
  3087. region of memory at a-addr1 is returned to the system according to the
  3088. operation of FREE. If the operation fails, a-addr2 equals a-addr1, the
  3089. region of memory at a-addr1 is unaffected, and ior is the
  3090. implementation-defined I/O result code. See: 6.1.1650 HERE,
  3091. 14.6.1.0707 ALLOCATE, 14.6.1.1605 FREE.
  3092.  
  3093.  
  3094. #
  3095. # 15.6.1 Programming-Tools words
  3096. #
  3097.  
  3098.  
  3099. : .S 'dot-s' TOOLS ( -- )
  3100.  
  3101. Copy and display the values currently on the data stack. The format of
  3102. the display is implementation-dependent. .S may be implemented using
  3103. pictured numeric output words. Consequently, its use may corrupt the
  3104. transient region identified by #>. See: 3.3.3.6 Other transient
  3105. regions.
  3106.  
  3107.  
  3108. : ? 'question' TOOLS ( a-addr -- )
  3109.  
  3110. Display the value stored at a-addr.? may be implemented using pictured
  3111. numeric output words. Consequently, its use may corrupt the transient
  3112. region identified by #>. See: 3.3.3.6 Other transient regions.
  3113.  
  3114.  
  3115. : DUMP TOOLS ( addr u -- )
  3116.  
  3117. Display the contents of u consecutive addresses starting at addr. The
  3118. format of the display is implementation dependent. DUMP may be
  3119. implemented using pictured numeric output words. Consequently, its use
  3120. may corrupt the transient region identified by #>. See: 3.3.3.6 Other
  3121. Transient Regions.
  3122.  
  3123.  
  3124. : SEE TOOLS ( '<spaces>name' -- )
  3125.  
  3126. Display a human-readable representation of the named word's
  3127. definition. The source of the representation (object-code
  3128. decompilation, source block, etc.) and the particular form of the
  3129. display is implementation defined. SEE may be implemented using
  3130. pictured numeric output words. Consequently, its use may corrupt the
  3131. transient region identified by #>. See: 3.3.3.6 Other transient
  3132. regions.
  3133.  
  3134.  
  3135. : WORDS TOOLS ( -- )
  3136.  
  3137. List the definition names in the first word list of the search order.
  3138. The format of the display isimplementation-dependent. WORDS may be
  3139. implemented using pictured numeric output words. Consequently, its use
  3140. may corrupt the transient region identified by #>. See: 3.3.3.6 Other
  3141. Transient Regions.
  3142.  
  3143.  
  3144. #
  3145. # 15.6.2 Programming-Tools extension words
  3146. #
  3147.  
  3148.  
  3149. : ;CODE 'semicolon-code' TOOLS EXT
  3150.  
  3151. Interpretation: Interpretation semantics for this word are undefined.
  3152.  
  3153. Compilation: ( C: colon-sys -- )
  3154.  
  3155. Append the run-time semantics below to the current definition. End the
  3156. current definition, allow it to be found in the dictionary, and enter
  3157. interpretation state, consuming colon-sys. Process subsequent
  3158. characters in the parse area in an implementation-defined manner, thus
  3159. generating corresponding machine code. Those characters typically
  3160. represent source code in a programming language, usually some form of
  3161. assembly language. The process continues, refilling the input buffer
  3162. as needed, until an implementation-defined ending sequence is
  3163. processed.
  3164.  
  3165. Run-time: ( -- ) ( R: nest-sys -- )
  3166.  
  3167. Replace the execution semantics of the most recent definition with the
  3168. name execution semantics given below. Return control to the calling
  3169. definition specified by nest-sys. An ambiguous condition exists if
  3170. the most recen definition was not defined with CREATE or a
  3171. user-defined word that calls CREATE.
  3172.  
  3173. name Execution: ( i*x --- j*x )
  3174.  
  3175. Perform the machine code sequence that was generated following ;CODE.
  3176. See: 6.1.1250 DOES>.
  3177.  
  3178.  
  3179. : AHEAD TOOLS EXT
  3180.  
  3181. Interpretation: Interpretation semantics for this word are undefined.
  3182.  
  3183. Compilation: ( C: -- orig )
  3184.  
  3185. Put the location of a new unresolved forward reference orig onto the
  3186. control flow stack. Append the run-time semantics given below to the
  3187. current definition. The semantics are incomplete until orig is
  3188. resolved (e.g., by THEN).
  3189.  
  3190. Run-time: ( -- )
  3191.  
  3192. Continue execution at the location specified by the resolution of
  3193. orig.
  3194.  
  3195.  
  3196. : ASSEMBLER TOOLS EXT ( -- )
  3197.  
  3198. Replace the first word list in the search order with the ASSEMBLER
  3199. word list. See: 16. The optional Search-Order word set.
  3200.  
  3201.  
  3202. : BYE TOOLS EXT ( -- )
  3203.  
  3204. Return control to the host operating system, if any.
  3205.  
  3206.  
  3207. : CODE TOOLS EXT ( '<spaces>name' -- )
  3208.  
  3209. Skip leading space delimiters. Parse name delimited by a space. Create
  3210. a definition for name, called a 'code definition,' with the execution
  3211. semantics defined below. Process subsequent characters in the parse
  3212. area in an implementation-defined manner, thus generating
  3213. corresponding machine code. Those characters typically represent
  3214. source code in a programming language, usually some form of assembly
  3215. language. The process continues, refilling the input buffer as needed,
  3216. until an implementation-defined ending sequence is processed. name
  3217.  
  3218. Execution: ( i*x --- j*x )
  3219.  
  3220. Execute the machine code sequence that was generated following CODE.
  3221. See: 3.4.1 Parsing.
  3222.  
  3223.  
  3224. : CS-PICK 'c-s-pick' TOOLS EXT
  3225.  
  3226. Interpretation: Interpretation semantics for this word are undefined.
  3227.  
  3228. Execution: ( C: destu ... orig0|dest0 --- destu ... orig0|dest0 destu) ( S: u -- )
  3229.  
  3230. Remove u. Copy destu to the top of the control-flow stack. An ambiguous condition exists if there are less than u+1 items, each of 
  3231. which shall be an orig or dest, on the control-flow stack before CS-PICK 
  3232. is executed. If the control-flow stack is implemented using the data 
  3233. stack, u shall be the topmost item on the data stack.
  3234.  
  3235.  
  3236. : CS-ROLL 'c-s-roll' TOOLS EXT Interpretation: Interpretation
  3237. semantics for this word are undefined. Execution: ( C: origu|destu
  3238. origu-1|destu-1 ... orig0|dest0 --- origu- 1|destu-1 ... orig0|dest0
  3239. origu|destu )
  3240.  
  3241.  S: u -- ) Remove u. Rotate u+1 elements on top of the control-flow
  3242. stack so that origu|destu is on top of the control-flow stack. An
  3243. ambiguous condition exists if there are less than u+1 items, each of
  3244. which shall be an orig or dest, on the control-flow stack before
  3245. CS-ROLL is executed. If the control-flow stack is implemented using
  3246. the data stack, u shall be the topmost item on the data stack.
  3247.  
  3248.  
  3249. : EDITOR TOOLS EXT ( -- )
  3250.  
  3251. Replace the first word list in the search order with the EDITOR word
  3252. list. See: 16. The Optional Search-Order Word Set.
  3253.  
  3254.  
  3255. : FORGET TOOLS EXT ( '<spaces>name' -- )
  3256.  
  3257. Skip leading space delimiters. Parse name delimited by a space. Find
  3258. name, then delete name from the dictionary along with all words added
  3259. to the dictionary after name. An ambiguous condition exists if name
  3260. cannot be found.If the Search-Order word set is present, FORGET
  3261. searches the compilation word list. An ambiguous condition exists if
  3262. the compilation word list is deleted. An ambiguous condition exists if
  3263. FORGET removes a word required for correct execution. Note: This word
  3264. is obsolescent and is included as a concession to existing
  3265. implementations. See: 3.4.1 Parsing.
  3266.  
  3267.  
  3268. : [ELSE] 'bracket-else' TOOLS EXT
  3269.  
  3270. Compilation: Perform the execution semantics given below.
  3271.  
  3272. Execution: ( '<spaces>name ... ' -- )
  3273.  
  3274. Skipping leading spaces, parse and discard space-delimited words from
  3275. the parse area, including nested occurrences of [IF] ... [THEN] and
  3276. [IF] ... [ELSE] ...[THEN], until the word [THEN] has been parsed and
  3277. discarded. If the parse area becomes exhausted, it is refilled as with
  3278. REFILL. [ELSE] is an immediate word. See: 3.4.1 Parsing.
  3279.  
  3280.  
  3281. : [IF] 'bracket-if' TOOLS EXT
  3282.  
  3283. Compilation: Perform the execution semantics given below.
  3284.  
  3285. Execution: ( flag | flag '<spaces>name ... ' -- )
  3286.  
  3287. If flag is true, do nothing. Otherwise, skipping leading spaces, parse
  3288. and discard space- delimited words from the parse area, including
  3289. nested occurrences of [IF] ... [THEN] and [IF] ... [ELSE] ... [THEN],
  3290. until either the word [ELSE] or the word [THEN] has been parsed and
  3291. discarded. If the parse area becomes exhausted, it is refilled as with
  3292. REFILL. [IF] is an immediate word. An ambiguous condition exists if
  3293. [IF] is POSTPONEd, or if the end of the input buffer is reached and
  3294. cannot be refilled before the terminating [ELSE] or [THEN] is parsed.
  3295. See: 3.4.1 Parsing.
  3296.  
  3297.  
  3298. : [THEN] 'bracket-then' TOOLS EXT
  3299.  
  3300. Compilation: Perform the execution semantics given below.
  3301.  
  3302. Execution: ( -- )
  3303.  
  3304. Does nothing. [THEN] is an immediate word.
  3305.  
  3306.  
  3307. #
  3308. # 16.6.1 Search-Order words
  3309. #
  3310.  
  3311.  
  3312. : DEFINITIONS SEARCH ( -- )
  3313.  
  3314. Make the compilation word list the same as the first word list in the
  3315. search order. Specifies that the names of subsequent definitions will
  3316. be placed in the compilation word list. Subsequent changes in the
  3317. search order will not affect the compilation word list. See: 16.3.3
  3318. Finding Definition Names.
  3319.  
  3320.  
  3321. : FORTH-WORDLIST SEARCH ( -- wid )
  3322.  
  3323. Return wid, the identifier of the word list that includes all standard
  3324. words provided by theimplementation. This word list is initially the
  3325. compilation word list and is part of the initial search order.
  3326.  
  3327.  
  3328. : GET-CURRENT SEARCH ( -- wid )
  3329.  
  3330. Return wid, the identifier of the compilation word list.
  3331.  
  3332.  
  3333. : GET-ORDER SEARCH ( -- widn ... wid1 n )
  3334.  
  3335. Returns the number of word lists n in the search order and the word
  3336. list identifiers widn ...wid1 identifying these word lists. wid1
  3337. identifies the word list that is searched first, and widn the word
  3338. list that is searched last. The search order is unaffected.
  3339.  
  3340.  
  3341. : SEARCH-WORDLIST SEARCH ( c-addr u wid -- 0 | xt 1 | xt -1 )
  3342.  
  3343. Find the definition identified by the string c-addr u in the word list
  3344. identified by wid. If the definition is not found, return zero. If the
  3345. definition is found, return its execution token xt and one (1) if the
  3346. definition is immediate, minus-one (-1) otherwise.
  3347.  
  3348.  
  3349. : SET-CURRENT SEARCH ( wid -- )
  3350.  
  3351. Set the compilation word list to the word list identified by wid.
  3352.  
  3353.  
  3354. : SET-ORDER SEARCH ( widn ... wid1 n -- )
  3355.  
  3356. Set the search order to the word lists identified by widn ... wid1.
  3357. Subsequently, word list wid1 will be searched first, with word list
  3358. widn searched last. If n is zero, empty the search order. If n is
  3359. minus one, set the search order to the implementation-defined minimum
  3360. search order. The minimum search order shall include the words
  3361. FORTH-WORDLIST and SET-ORDER. A system shall allow n to be at least
  3362. eight.
  3363.  
  3364.  
  3365. : WORDLIST SEARCH ( -- wid )
  3366.  
  3367. Creates a new empty word list, returning its word list identifier wid.
  3368. The new word list may be returned from a pool of preallocated word
  3369. lists or may be dynamically allocated in data space. A system shall
  3370. allow the creation of at least 8 new word lists in addition to any
  3371. provided as part of the system.
  3372.  
  3373.  
  3374. #
  3375. # 16.6.2 Search-Order extension words
  3376. #
  3377.  
  3378.  
  3379. : ALSO SEARCH EXT ( -- )
  3380.  
  3381. Transform the search order consisting of widn, ... wid2, wid1 (where
  3382. wid1 is searched first) into widn, ... wid2, wid1, wid1. An ambiguous
  3383. condition exists if there are too many word lists in the search order.
  3384.  
  3385.  
  3386. : FORTH SEARCH EXT ( -- )
  3387.  
  3388. Transform the search order consisting of widn, ... wid2, wid1 (where
  3389. wid1 is searched first) into widn, ... wid2, wid FORTH-WORDLIST.
  3390.  
  3391.  
  3392. : ONLY SEARCH EXT ( -- )
  3393.  
  3394. Set the search order to the implementation-defined minimum search
  3395. order. The minimum search order shall include the words
  3396. FORTH-WORDLIST and SET- ORDER.
  3397.  
  3398.  
  3399. : ORDER SEARCH EXT ( -- )
  3400.  
  3401. Display the word lists in the search order in their search order
  3402. sequence, from first searched to last searched. Also display the word
  3403. list into which new definitions will be placed. The display format is
  3404. implementation dependent. ORDER may be implemented using pictured
  3405. numeric output words. Consequently, its use may corrupt the transient
  3406. region identified by #>. See3.3.3.6 Other Transient Regions.
  3407.  
  3408.  
  3409. : PREVIOUS SEARCH EXT ( -- )
  3410.  
  3411. Transform the search order consisting of widn, ... wid2, wid1 (where
  3412. wid1 is searched first) into widn, ... wid2. An ambiguous condition
  3413. exists if the search order was empty before PREVIOUS was executed.
  3414.  
  3415.  
  3416. #
  3417. # 17.6.1 String words
  3418. #
  3419.  
  3420.  
  3421. : -TRAILING 'dash-trailing' STRING ( c-addr u1 --- c-addr u2 )
  3422.  
  3423. If u1 is greater than zero, u2 is equal to u1 less the number of
  3424. spaces at the end of the character string specified by c-addr u1. If
  3425. u1 is zero or the entire string consists of spaces, u2 is zero.
  3426.  
  3427.  
  3428. : /STRING 'slash-string' STRING ( c-addr1 u1 n --- c-addr2 u2 )
  3429.  
  3430. Adjust the character string at c-addr1 by n characters. The resulting
  3431. character string, specified by c-addr2 u2, begins at c-addr1 plus n
  3432. characters and is u1 minus n characters long.
  3433.  
  3434.  
  3435. : BLANK STRING ( c-addr u -- )
  3436.  
  3437. If u is greater than zero, store the character value for space in u
  3438. consecutive character positions beginning at c-addr.
  3439.  
  3440.  
  3441. : CMOVE 'c-move' STRING ( c-addr1 c-addr2 u -- )
  3442.  
  3443. If u is greater than zero, copy u consecutive characters from the data
  3444. space starting at c-addr1 to that starting at c-addr2, proceeding
  3445. character-by-character from lower addresses to higher addresses.
  3446. Contrast with: 17.6.1.0920 CMOVE>.
  3447.  
  3448.  
  3449. : CMOVE> 'c-move-up' STRING ( c-addr1 c-addr2 u -- )
  3450.  
  3451. If u is greater than zero, copy u consecutive characters from the data
  3452. space starting at c-addr1 to that starting at c-addr2, proceeding
  3453. character-by-character from higher addresses to lower addresses.
  3454. Contrast with: 17.6.1.0910 CMOVE.
  3455.  
  3456.  
  3457. : COMPARE STRING ( c-addr1 u1 c-addr2 u2 --- n )
  3458.  
  3459. Compare the string specified by c-addr1 u1 to the string specified by
  3460. c- addr2 u2. The strings are compared, beginning at the given
  3461. addresses, character by character, up to the length of the shorter
  3462. string or until a difference is found. If the two strings are
  3463. identical, n is zero. If the two strings are identical up to the
  3464. length of the shorter string, n is minus-one (-1) if u1 is less than
  3465. u2 and one (1) otherwise. If the two strings are not identical up to
  3466. the length of the shorter string, n is minus-one (-1) if the first
  3467. non-matching character in the string specified by c-addr1 u1 has a
  3468. lesser numeric value than the corresponding character in the string
  3469. specified by c-addr2 u2 and one (1) otherwise.
  3470.  
  3471.  
  3472. : SEARCH STRING ( c-addr1 u1 c-addr2 u2 --- c-addr3 u3 flag )
  3473.  
  3474. Search the string specified by c-addr1 u1 for the string specified by
  3475. c- addr2 u2. If flag is true, a match was found at c-addr3 with u3
  3476. characters remaining. If flag is false there was no match and c-addr3
  3477. is c-addr1 and u3 is u1.
  3478.  
  3479.  
  3480. : SLITERAL STRING
  3481.  
  3482. Interpretation: Interpretation semantics for this word are undefined.
  3483.  
  3484. Compilation: ( c-addr1 u -- )
  3485.  
  3486. Append the run-time semantics given below to the current definition.
  3487.  
  3488. Run-time: ( -- c-addr2 u )
  3489.  
  3490. Return c-addr2 u describing a string consisting of the characters
  3491. specified by c-addr1 u during compilation. A program shall not alter
  3492. the returned string.
  3493.