version 1.14, 1997/02/08 22:58:10
|
version 1.18, 1997/03/19 18:27:16
|
Line 24 HEX
|
Line 24 HEX
|
|
|
\ labels for some code addresses |
\ labels for some code addresses |
|
|
|
doer? :docon [IF] |
: docon: ( -- addr ) \ gforth |
: docon: ( -- addr ) \ gforth |
\G the code address of a @code{CONSTANT} |
\G the code address of a @code{CONSTANT} |
['] bl >code-address ; |
['] bl >code-address ; |
|
[THEN] |
|
|
: docol: ( -- addr ) \ gforth |
: docol: ( -- addr ) \ gforth |
\G the code address of a colon definition |
\G the code address of a colon definition |
['] docon: >code-address ; |
['] docol: >code-address ; |
|
|
|
doer? :dovar [IF] |
: dovar: ( -- addr ) \ gforth |
: dovar: ( -- addr ) \ gforth |
\G the code address of a @code{CREATE}d word |
\G the code address of a @code{CREATE}d word |
['] udp >code-address ; |
['] udp >code-address ; |
|
[THEN] |
|
|
|
doer? :douser [IF] |
: douser: ( -- addr ) \ gforth |
: douser: ( -- addr ) \ gforth |
\G the code address of a @code{USER} variable |
\G the code address of a @code{USER} variable |
['] s0 >code-address ; |
['] s0 >code-address ; |
|
[THEN] |
|
|
|
doer? :dodefer [IF] |
: dodefer: ( -- addr ) \ gforth |
: dodefer: ( -- addr ) \ gforth |
\G the code address of a @code{defer}ed word |
\G the code address of a @code{defer}ed word |
['] source >code-address ; |
['] source >code-address ; |
|
[THEN] |
|
|
|
doer? :dofield [IF] |
: dofield: ( -- addr ) \ gforth |
: dofield: ( -- addr ) \ gforth |
\G the code address of a @code{field} |
\G the code address of a @code{field} |
['] reveal-method >code-address ; |
['] reveal-method >code-address ; |
|
[THEN] |
|
|
|
has-prims 0= [IF] |
|
: dodoes: ( -- addr ) \ gforth |
|
\G the code address of a @code{field} |
|
['] spaces >code-address ; |
|
[THEN] |
|
|
NIL AConstant NIL \ gforth |
NIL AConstant NIL \ gforth |
|
|
\ Aliases |
\ Aliases |
|
|
' i Alias r@ |
' i Alias r@ ( -- w ; R: w -- w ) \ core r-fetch |
|
\ copy w from the return stack to the data stack |
|
|
\ Bit string manipulation 06oct92py |
\ Bit string manipulation 06oct92py |
|
|
Line 248 Defer source ( -- addr count ) \ core
|
Line 265 Defer source ( -- addr count ) \ core
|
: (compile) ( -- ) \ gforth |
: (compile) ( -- ) \ gforth |
r> dup cell+ >r @ compile, ; |
r> dup cell+ >r @ compile, ; |
|
|
: postpone, ( w xt -- ) |
: postpone, ( w xt -- ) \ gforth postpone-comma |
\g Compiles the compilation semantics represented by @var{w xt}. |
\g Compiles the compilation semantics represented by @var{w xt}. |
dup ['] execute = |
dup ['] execute = |
if |
if |
Line 473 Defer 'throw
|
Line 490 Defer 'throw
|
|
|
: throw ( y1 .. ym error/0 -- y1 .. ym / z1 .. zn error ) \ exception |
: throw ( y1 .. ym error/0 -- y1 .. ym / z1 .. zn error ) \ exception |
?DUP IF |
?DUP IF |
[ here 9 cells ! ] \ entry point for signal handler |
[ has-header [IF] here 9 cells ! [THEN] ] \ entry point for signal handler |
handler @ dup 0= IF |
handler @ dup 0= IF |
[ has-os [IF] ] |
[ has-os [IF] ] |
2 (bye) |
2 (bye) |
Line 731 Create ??? 0 , 3 c, char ? c, char ? c,
|
Line 748 Create ??? 0 , 3 c, char ? c, char ? c,
|
: !does ( addr -- ) \ gforth store-does |
: !does ( addr -- ) \ gforth store-does |
lastxt does-code! ; |
lastxt does-code! ; |
: (does>) ( R: addr -- ) |
: (does>) ( R: addr -- ) |
r> /does-handler + !does ; |
r> cfaligned /does-handler + !does ; |
: dodoes, ( -- ) |
: dodoes, ( -- ) |
here /does-handler allot does-handler! ; |
cfalign here /does-handler allot does-handler! ; |
|
|
|
doer? :dovar [IF] |
: Create ( "name" -- ) \ core |
: Create ( "name" -- ) \ core |
Header reveal dovar: cfa, ; |
Header reveal dovar: cfa, ; |
|
[ELSE] |
|
: Create ( "name" -- ) \ core |
|
Header reveal here lastcfa ! 0 A, 0 , DOES> ; |
|
[THEN] |
|
|
\ Create Variable User Constant 17mar93py |
\ Create Variable User Constant 17mar93py |
|
|
Line 744 Create ??? 0 , 3 c, char ? c, char ? c,
|
Line 766 Create ??? 0 , 3 c, char ? c, char ? c,
|
Create 0 , ; |
Create 0 , ; |
: AVariable ( "name" -- ) \ gforth |
: AVariable ( "name" -- ) \ gforth |
Create 0 A, ; |
Create 0 A, ; |
: 2VARIABLE ( "name" -- ) \ double |
: 2Variable ( "name" -- ) \ double |
create 0 , 0 , ; |
create 0 , 0 , ; |
|
|
|
: uallot ( n -- ) udp @ swap udp +! ; |
|
|
|
doer? :douser [IF] |
: User ( "name" -- ) \ gforth |
: User ( "name" -- ) \ gforth |
Variable ; |
Header reveal douser: cfa, cell uallot , ; |
: AUser ( "name" -- ) \ gforth |
: AUser ( "name" -- ) \ gforth |
AVariable ; |
User ; |
|
[ELSE] |
|
: User Create uallot , DOES> @ up @ + ; |
|
: AUser User ; |
|
[THEN] |
|
|
: (Constant) Header reveal docon: cfa, ; |
doer? :docon [IF] |
|
: (Constant) Header reveal docon: cfa, ; |
|
[ELSE] |
|
: (Constant) Create DOES> @ ; |
|
[THEN] |
: Constant ( w "name" -- ) \ core |
: Constant ( w "name" -- ) \ core |
\G Defines constant @var{name} |
\G Defines constant @var{name} |
\G |
\G |
Line 760 Create ??? 0 , 3 c, char ? c, char ? c,
|
Line 793 Create ??? 0 , 3 c, char ? c, char ? c,
|
(Constant) , ; |
(Constant) , ; |
: AConstant ( addr "name" -- ) \ gforth |
: AConstant ( addr "name" -- ) \ gforth |
(Constant) A, ; |
(Constant) A, ; |
|
: Value ( w "name" -- ) \ core-ext |
|
(Constant) , ; |
|
|
: 2Constant ( w1 w2 "name" -- ) \ double |
: 2Constant ( w1 w2 "name" -- ) \ double |
Create ( w1 w2 "name" -- ) |
Create ( w1 w2 "name" -- ) |
Line 767 Create ??? 0 , 3 c, char ? c, char ? c,
|
Line 802 Create ??? 0 , 3 c, char ? c, char ? c,
|
DOES> ( -- w1 w2 ) |
DOES> ( -- w1 w2 ) |
2@ ; |
2@ ; |
|
|
|
doer? :dofield [IF] |
|
: (Field) Header reveal dofield: cfa, ; |
|
[ELSE] |
|
: (Field) Create DOES> @ + ; |
|
[THEN] |
\ IS Defer What's Defers TO 24feb93py |
\ IS Defer What's Defers TO 24feb93py |
|
|
|
doer? :dodefer [IF] |
: Defer ( "name" -- ) \ gforth |
: Defer ( "name" -- ) \ gforth |
\ !! shouldn't it be initialized with abort or something similar? |
\ !! shouldn't it be initialized with abort or something similar? |
Header Reveal dodefer: cfa, |
Header Reveal dodefer: cfa, |
['] noop A, ; |
['] noop A, ; |
\ Create ( -- ) |
[ELSE] |
\ ['] noop A, |
: Defer ( "name" -- ) \ gforth |
\ DOES> ( ??? ) |
Create ['] noop A, |
\ perform ; |
DOES> @ execute ; |
|
[THEN] |
|
|
: Defers ( "name" -- ) \ gforth |
: Defers ( "name" -- ) \ gforth |
' >body @ compile, ; immediate |
' >body @ compile, ; immediate |
Line 920 end-struct interpret/compile-struct
|
Line 962 end-struct interpret/compile-struct
|
then |
then |
then ; |
then ; |
|
|
: find ( c-addr -- xt +-1 / c-addr 0 ) \ core |
: find ( c-addr -- xt +-1 / c-addr 0 ) \ core,search |
dup count sfind dup |
dup count sfind dup |
if |
if |
rot drop |
rot drop |
Line 1260 DEFER DOERROR
|
Line 1302 DEFER DOERROR
|
\ : .name ( name -- ) name>string type space ; |
\ : .name ( name -- ) name>string type space ; |
\ : words listwords @ |
\ : words listwords @ |
\ BEGIN @ dup WHILE dup .name REPEAT drop ; |
\ BEGIN @ dup WHILE dup .name REPEAT drop ; |
Defer 'cold ' noop IS 'cold |
Defer 'cold ( -- ) \ gforth tick-cold |
|
\ hook (deferred word) for things to do right before interpreting the |
|
\ command-line arguments |
|
' noop IS 'cold |
|
|
: cold ( -- ) \ gforth |
: cold ( -- ) \ gforth |
[ has-os [IF] ] |
|
stdout TO outfile-id |
|
[ [THEN] ] |
|
[ has-files [IF] ] |
[ has-files [IF] ] |
pathstring 2@ process-path pathdirs 2! |
pathstring 2@ process-path pathdirs 2! |
init-included-files |
init-included-files |
Line 1305 Defer 'cold ' noop IS 'cold
|
Line 1347 Defer 'cold ' noop IS 'cold
|
." Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA." cr ; |
." Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA." cr ; |
|
|
: boot ( path **argv argc -- ) |
: boot ( path **argv argc -- ) |
|
main-task up! |
|
[ has-os [IF] ] |
|
stdout TO outfile-id |
|
[ [THEN] ] |
[ has-files [IF] ] |
[ has-files [IF] ] |
argc ! argv ! pathstring 2! |
argc ! argv ! pathstring 2! |
[ [THEN] ] |
[ [THEN] ] |
main-task up! |
|
sp@ s0 ! |
sp@ s0 ! |
[ has-locals [IF] ] |
[ has-locals [IF] ] |
lp@ forthstart 7 cells + @ - |
lp@ forthstart 7 cells + @ - |