| |
|
| \ \ input stream primitives 23feb93py |
\ \ input stream primitives 23feb93py |
| |
|
| |
require ./basics.fs \ bounds decimal hex ... |
| |
require ./io.fs \ type ... |
| |
require ./nio.fs \ . <# ... |
| |
require ./errore.fs \ .error ... |
| |
require ./version.fs \ version-string |
| |
require ./../chains.fs |
| |
|
| : tib ( -- c-addr ) \ core-ext |
: tib ( -- c-addr ) \ core-ext |
| \G @var{c-addr} is the address of the Terminal Input Buffer. |
\G @var{c-addr} is the address of the Terminal Input Buffer. |
| \G OBSOLESCENT: @code{source} superceeds the function of this word. |
\G OBSOLESCENT: @code{source} superceeds the function of this word. |
| THEN ; |
THEN ; |
| |
|
| : sign? ( addr u -- addr u flag ) |
: sign? ( addr u -- addr u flag ) |
| over c@ '- = dup >r |
over c@ [char] - = dup >r |
| IF |
IF |
| 1 /string |
1 /string |
| THEN |
THEN |
| |
|
| \ \ header, finding, ticks 17dec92py |
\ \ header, finding, ticks 17dec92py |
| |
|
| $80 constant alias-mask \ set when the word is not an alias! |
hex |
| $40 constant immediate-mask |
80 constant alias-mask \ set when the word is not an alias! |
| $20 constant restrict-mask |
40 constant immediate-mask |
| |
20 constant restrict-mask |
| |
|
| \ higher level parts of find |
\ higher level parts of find |
| |
|
| |
|
| : interpret ( ?? -- ?? ) \ gforth |
: interpret ( ?? -- ?? ) \ gforth |
| \ interpret/compile the (rest of the) input buffer |
\ interpret/compile the (rest of the) input buffer |
| |
[ has? backtrace [IF] ] |
| rp@ backtrace-rp0 ! |
rp@ backtrace-rp0 ! |
| |
[ [THEN] ] |
| BEGIN |
BEGIN |
| ?stack name dup |
?stack name dup |
| WHILE |
WHILE |
| \ interpreter 30apr92py |
\ interpreter 30apr92py |
| |
|
| \ not the most efficient implementations of interpreter and compiler |
\ not the most efficient implementations of interpreter and compiler |
| | : interpreter ( c-addr u -- ) |
: interpreter ( c-addr u -- ) |
| 2dup find-name dup |
2dup find-name dup |
| if |
if |
| nip nip name>int execute |
nip nip name>int execute |
| [ [THEN] ] |
[ [THEN] ] |
| refill drop ; |
refill drop ; |
| |
|
| : (quit) BEGIN .status cr (query) interpret prompt AGAIN ; |
: (quit) |
| |
BEGIN .status cr (query) interpret prompt AGAIN ; |
| |
|
| ' (quit) IS 'quit |
' (quit) IS 'quit |
| |
|
| \G Display @var{u} as an unsigned hex number, prefixed with a "$" and |
\G Display @var{u} as an unsigned hex number, prefixed with a "$" and |
| \G followed by a space. |
\G followed by a space. |
| \G !! not used... |
\G !! not used... |
| '$ emit base @ swap hex u. base ! ; |
[char] $ emit base @ swap hex u. base ! ; |
| |
|
| : typewhite ( addr u -- ) \ gforth |
: typewhite ( addr u -- ) \ gforth |
| \ like type, but white space is printed instead of the characters |
\ like type, but white space is printed instead of the characters |
| loop ; |
loop ; |
| |
|
| DEFER DOERROR |
DEFER DOERROR |
| |
|
| |
has? backtrace [IF] |
| Defer dobacktrace ( -- ) |
Defer dobacktrace ( -- ) |
| ' noop IS dobacktrace |
' noop IS dobacktrace |
| |
[THEN] |
| |
|
| : .error-string ( throw-code -- ) |
: .error-string ( throw-code -- ) |
| dup -2 = |
dup -2 = |
| cell +LOOP |
cell +LOOP |
| .error-frame |
.error-frame |
| LOOP |
LOOP |
| drop dobacktrace |
drop |
| |
[ has? backtrace [IF] ] |
| |
dobacktrace |
| |
[ [THEN] ] |
| normal-dp dpp ! ; |
normal-dp dpp ! ; |
| |
|
| ' (DoError) IS DoError |
' (DoError) IS DoError |
| \ command-line arguments |
\ command-line arguments |
| ' noop IS 'cold |
' noop IS 'cold |
| |
|
| include ./../chains.fs |
|
| |
|
| Variable init8 |
Variable init8 |
| |
|