version 1.112, 2003/01/01 17:28:29
|
version 1.120, 2003/01/10 21:19:59
|
Line 1404 while(a_addr != NULL)
|
Line 1404 while(a_addr != NULL)
|
rdrop r> |
rdrop r> |
REPEAT nip nip ; |
REPEAT nip nip ; |
|
|
(hashkey) ( c_addr u1 -- u2 ) gforth paren_hashkey |
|
u2=0; |
|
while(u1--) |
|
u2+=(Cell)toupper(*c_addr++); |
|
: |
|
0 -rot bounds ?DO I c@ toupper + LOOP ; |
|
|
|
(hashkey1) ( c_addr u ubits -- ukey ) gforth paren_hashkey1 |
(hashkey1) ( c_addr u ubits -- ukey ) gforth paren_hashkey1 |
""ukey is the hash key for the string c_addr u fitting in ubits bits"" |
""ukey is the hash key for the string c_addr u fitting in ubits bits"" |
/* this hash function rotates the key at every step by rot bits within |
/* this hash function rotates the key at every step by rot bits within |
Line 1473 f_addr = (Float *)((((Cell)c_addr)+(size
|
Line 1466 f_addr = (Float *)((((Cell)c_addr)+(size
|
: |
: |
[ 1 floats 1- ] Literal + [ -1 floats ] Literal and ; |
[ 1 floats 1- ] Literal + [ -1 floats ] Literal and ; |
|
|
>body ( xt -- a_addr ) core to_body |
|
"" Get the address of the body of the word represented by @i{xt} (the address |
|
of the word's data field)."" |
|
a_addr = PFA(xt); |
|
: |
|
2 cells + ; |
|
|
|
\ threading stuff is currently only interesting if we have a compiler |
\ threading stuff is currently only interesting if we have a compiler |
\fhas? standardthreading has? compiler and [IF] |
\fhas? standardthreading has? compiler and [IF] |
|
|
>code-address ( xt -- c_addr ) gforth to_code_address |
|
""@i{c-addr} is the code address of the word @i{xt}."" |
|
/* !! This behaves installation-dependently for DOES-words */ |
|
c_addr = (Address)CODE_ADDRESS(xt); |
|
: |
|
@ ; |
|
|
|
>does-code ( xt -- a_addr ) gforth to_does_code |
|
""If @i{xt} is the execution token of a child of a @code{DOES>} word, |
|
@i{a-addr} is the start of the Forth code after the @code{DOES>}; |
|
Otherwise @i{a-addr} is 0."" |
|
a_addr = (Cell *)DOES_CODE(xt); |
|
: |
|
cell+ @ ; |
|
|
|
code-address! ( c_addr xt -- ) gforth code_address_store |
|
""Create a code field with code address @i{c-addr} at @i{xt}."" |
|
MAKE_CF(xt, c_addr); |
|
: |
|
! ; |
|
|
|
does-code! ( a_addr xt -- ) gforth does_code_store |
|
""Create a code field at @i{xt} for a child of a @code{DOES>}-word; |
|
@i{a-addr} is the start of the Forth code after @code{DOES>}."" |
|
MAKE_DOES_CF(xt, a_addr); |
|
: |
|
dodoes: over ! cell+ ! ; |
|
|
|
does-handler! ( a_addr -- ) gforth does_handler_store |
|
""Create a @code{DOES>}-handler at address @i{a-addr}. Normally, |
|
@i{a-addr} points just behind a @code{DOES>}."" |
|
MAKE_DOES_HANDLER(a_addr); |
|
: |
|
drop ; |
|
|
|
/does-handler ( -- n ) gforth slash_does_handler |
|
""The size of a @code{DOES>}-handler (includes possible padding)."" |
|
/* !! a constant or environmental query might be better */ |
|
n = DOES_HANDLER_SIZE; |
|
: |
|
2 cells ; |
|
|
|
threading-method ( -- n ) gforth threading_method |
threading-method ( -- n ) gforth threading_method |
""0 if the engine is direct threaded. Note that this may change during |
""0 if the engine is direct threaded. Note that this may change during |
the lifetime of an image."" |
the lifetime of an image."" |
Line 1886 flag = FLAG(!fnmatch(pattern, string, 0)
|
Line 1829 flag = FLAG(!fnmatch(pattern, string, 0)
|
newline ( -- c_addr u ) gforth |
newline ( -- c_addr u ) gforth |
""String containing the newline sequence of the host OS"" |
""String containing the newline sequence of the host OS"" |
char newline[] = { |
char newline[] = { |
#if defined(unix) || defined(__MACH__) |
#if DIRSEP=='/' |
/* Darwin/MacOS X sets __MACH__, but not unix. */ |
/* Unix */ |
'\n' |
'\n' |
#else |
#else |
|
/* DOS, Win, OS/2 */ |
'\r','\n' |
'\r','\n' |
#endif |
#endif |
}; |
}; |
Line 1941 comparisons(f0, r, f_zero_, r, 0., float
|
Line 1885 comparisons(f0, r, f_zero_, r, 0., float
|
d>f ( d -- r ) float d_to_f |
d>f ( d -- r ) float d_to_f |
#ifdef BUGGY_LONG_LONG |
#ifdef BUGGY_LONG_LONG |
extern double ldexp(double x, int exp); |
extern double ldexp(double x, int exp); |
r = ldexp((Float)d.hi,CELL_BITS) + (Float)d.lo; |
if (d.hi<0) { |
|
DCell d2=dnegate(d); |
|
r = -(ldexp((Float)d2.hi,CELL_BITS) + (Float)d2.lo); |
|
} else |
|
r = ldexp((Float)d.hi,CELL_BITS) + (Float)d.lo; |
#else |
#else |
r = d; |
r = d; |
#endif |
#endif |
Line 2450 xt = peephole_opt(xt1, xt2, wpeeptable);
|
Line 2398 xt = peephole_opt(xt1, xt2, wpeeptable);
|
compile-prim ( xt1 -- xt2 ) obsolete compile_prim |
compile-prim ( xt1 -- xt2 ) obsolete compile_prim |
xt2 = (Xt)compile_prim((Label)xt1); |
xt2 = (Xt)compile_prim((Label)xt1); |
|
|
|
compile-prim1 ( a_prim -- ) gforth compile_prim1 |
|
""compile prim (incl. immargs) at @var{a_prim}"" |
|
compile_prim1(a_prim); |
|
|
|
finish-code ( -- ) gforth finish_code |
|
""Perform delayed steps in code generation (branch resolution, I-cache |
|
flushing)."" |
|
finish_code(); |
|
|
|
forget-dyncode ( c_code -- f ) gforth-internal forget_dyncode |
|
f = forget_dyncode(c_code); |
|
|
|
decompile-prim ( a_code -- a_prim ) gforth-internal decompile_prim |
|
""a_prim is the code address of the primitive that has been |
|
compile_prim1ed to a_code"" |
|
a_prim = (Label)decompile_code((Label)a_code); |
|
|
\ set-next-code and call2 do not appear in images and can be |
\ set-next-code and call2 do not appear in images and can be |
\ renumbered arbitrarily |
\ renumbered arbitrarily |
|
|
Line 2467 JUMP(a_callee);
|
Line 2432 JUMP(a_callee);
|
assert(0); |
assert(0); |
#endif |
#endif |
|
|
compile-prim1 ( a_prim -- ) gforth compile_prim1 |
|
""compile prim (incl. immargs) at @var{a_prim}"" |
|
compile_prim1(a_prim); |
|
|
|
finish-code ( -- ) gforth finish_code |
|
""Perform delayed steps in code generation (branch resolution, I-cache |
|
flushing)."" |
|
finish_code(); |
|
|
|
forget-dyncode ( c_code -- f ) gforth-internal forget_dyncode |
|
f = forget_dyncode(c_code); |
|
|
|
decompile-prim ( a_code -- a_prim ) gforth-internal decompile_prim |
|
""a_prim is the code address of the primitive that has been |
|
compile_prim1ed to a_code"" |
|
a_prim = decompile_code(a_code); |
|
|
|
\+ |
\+ |
|
|
include(peeprules.vmg) |
include(peeprules.vmg) |