1 \ @(#) misc1.fth 98/01/26 1.2
\r
2 \ miscellaneous words
\r
5 \ Copyright 1994 3DO, Phil Burk, Larry Polansky, Devid Rosenboom
\r
7 \ The pForth software code is dedicated to the public domain,
\r
8 \ and any third party may reproduce, distribute and modify
\r
9 \ the pForth software code or any derivative works thereof
\r
10 \ without any compensation or license. The pForth software
\r
11 \ code is provided on an "as is" basis without any warranty
\r
12 \ of any kind, including, without limitation, the implied
\r
13 \ warranties of merchantability and fitness for a particular
\r
14 \ purpose and their equivalents under the laws of any jurisdiction.
\r
22 : (WARNING") ( flag $message -- )
\r
29 : WARNING" ( flag <message> -- , print warning if true. )
\r
30 [compile] " ( compile message )
\r
32 IF compile (warning")
\r
37 : (ABORT") ( flag $message -- )
\r
39 IF count type cr abort
\r
44 : ABORT" ( flag <message> -- , print warning if true. )
\r
45 [compile] " ( compile message )
\r
53 : ?PAUSE ( -- , Pause if key hit. )
\r
55 IF key drop cr ." Hit space to continue, any other key to abort:"
\r
56 key dup emit BL = not abort" Terminated"
\r
62 : CR? ( -- , do CR if near end )
\r
63 OUT @ #cols 16 - 10 max >
\r
68 : CLS ( -- clear screen )
\r
71 : PAGE ( -- , clear screen, compatible with Brodie )
\r
75 : $ ( <number> -- N , convert next number as hex )
\r
77 32 lword number? num_type_single = not
\r
78 abort" Not a single number!"
\r
81 IF [compile] literal
\r
92 variable TAB-WIDTH 8 TAB-WIDTH !
\r
93 : TAB ( -- , tab over to next stop )
\r
94 out @ tab-width @ mod
\r
95 tab-width @ swap - spaces
\r
98 \ Vocabulary listing
\r
102 WHILE dup id. tab cr? ?pause
\r
111 variable CLOSEST-NFA
\r
112 variable CLOSEST-XT
\r
114 : >NAME ( xt -- nfa , scans dictionary for closest nfa, SLOW! )
\r
119 IF ( -- addr nfa ) 2dup name> ( addr nfa addr xt ) <
\r
120 IF true ( addr below this cfa, can't be it)
\r
121 ELSE ( -- addr nfa )
\r
122 2dup name> ( addr nfa addr xt ) =
\r
123 IF ( found it ! ) dup closest-nfa ! false
\r
124 ELSE dup name> closest-xt @ >
\r
125 IF dup closest-nfa ! dup name> closest-xt !
\r
134 REPEAT ( -- cfa nfa )
\r
139 : @EXECUTE ( addr -- , execute if non-zero )
\r
145 : TOLOWER ( char -- char_lower )
\r
148 IF ascii A - ascii a +
\r
153 : EVALUATE ( i*x c-addr num -- j*x , evaluate string of Forth )
\r
154 \ save current input state and switch to passed in string
\r
160 \ interpret the string
\r
162 \ restore input state
\r
168 : \S ( -- , comment out rest of file )
\r
171 BEGIN \ using REFILL is safer than popping SOURCE-ID
\r