version 1.255, 2010/08/31 20:10:59
|
version 1.265, 2012/02/21 21:34:10
|
Line 1
|
Line 1
|
\ Gforth primitives |
\ Gforth primitives |
|
|
\ Copyright (C) 1995,1996,1997,1998,2000,2003,2004,2005,2006,2007,2008,2009 Free Software Foundation, Inc. |
\ Copyright (C) 1995,1996,1997,1998,2000,2003,2004,2005,2006,2007,2008,2009,2010,2011 Free Software Foundation, Inc. |
|
|
\ This file is part of Gforth. |
\ This file is part of Gforth. |
|
|
Line 618 f_fp = fp;
|
Line 618 f_fp = fp;
|
c_lp = lp; |
c_lp = lp; |
a_newhandler = rp-5; |
a_newhandler = rp-5; |
|
|
|
(throw1) ( ... wball a_handler -- ... wball ) gforth paren_throw1 |
|
rp = a_handler; |
|
lp = (Address)rp[1]; |
|
fp = (Float *)rp[2]; |
|
sp = (Cell *)rp[3]; |
|
#ifndef NO_IP |
|
ip=IP; |
|
#endif |
|
SUPER_END; |
|
VM_JUMP(EXEC1(*(Xt *)rp[4])); |
|
|
|
|
\+ |
\+ |
|
|
\ don't make any assumptions where the return stack is!! |
\ don't make any assumptions where the return stack is!! |
Line 1091 lshift ( u1 n -- u2 ) core l_shift
|
Line 1103 lshift ( u1 n -- u2 ) core l_shift
|
: |
: |
0 ?DO 2* LOOP ; |
0 ?DO 2* LOOP ; |
|
|
|
umax ( u1 u2 -- u ) core |
|
if (u1<u2) |
|
u = u2; |
|
else |
|
u = u1; |
|
: |
|
2dup u< IF swap THEN drop ; |
|
|
|
umin ( u1 u2 -- u ) core |
|
if (u1<u2) |
|
u = u1; |
|
else |
|
u = u2; |
|
: |
|
2dup u> IF swap THEN drop ; |
|
|
\g compare |
\g compare |
|
|
\ comparisons(prefix, args, prefix, arg1, arg2, wordsets...) |
\ comparisons(prefix, args, prefix, arg1, arg2, wordsets...) |
Line 1792 if (a_addr1==NULL)
|
Line 1820 if (a_addr1==NULL)
|
else |
else |
a_addr2 = (Cell *)realloc(a_addr1, u); |
a_addr2 = (Cell *)realloc(a_addr1, u); |
wior = IOR(a_addr2==NULL); /* !! Define a return code */ |
wior = IOR(a_addr2==NULL); /* !! Define a return code */ |
|
if (a_addr2==NULL) |
|
a_addr2 = a_addr1; |
|
|
strerror ( n -- c_addr u ) gforth |
strerror ( n -- c_addr u ) gforth |
c_addr = (Char *)strerror(n); |
c_addr = (Char *)strerror(n); |
Line 2019 duser = timeval2us(&time1);
|
Line 2049 duser = timeval2us(&time1);
|
dsystem = DZERO; |
dsystem = DZERO; |
#endif |
#endif |
|
|
|
ntime ( -- dtime ) gforth |
|
""Report the current time in nanoseconds since some epoch."" |
|
struct timespec time1; |
|
#ifdef HAVE_CLOCK_GETTIME |
|
clock_gettime(CLOCK_REALTIME,&time1); |
|
#else |
|
struct timeval time2; |
|
gettimeofday(&time2,NULL); |
|
time1.tv_sec = time2.tv_sec; |
|
time1.tv_nsec = time2.tv_usec*1000; |
|
#endif |
|
dtime = timespec2ns(&time1); |
|
|
\+ |
\+ |
|
|
\+floating |
\+floating |
Line 2528 u = (c_addr[0] << 8) | (c_addr[1]);
|
Line 2571 u = (c_addr[0] << 8) | (c_addr[1]);
|
|
|
be-ul@ ( c_addr -- u ) gforth l_fetch_be |
be-ul@ ( c_addr -- u ) gforth l_fetch_be |
""@i{u} is the zero-extended 32-bit big endian value stored at @i{c_addr}."" |
""@i{u} is the zero-extended 32-bit big endian value stored at @i{c_addr}."" |
u = (c_addr[0] << 24) | (c_addr[1] << 16) | (c_addr[2] << 8) | (c_addr[3]); |
u = ((Cell)c_addr[0] << 24) | (c_addr[1] << 16) | (c_addr[2] << 8) | (c_addr[3]); |
|
|
le-uw@ ( c_addr -- u ) gforth w_fetch_le |
le-uw@ ( c_addr -- u ) gforth w_fetch_le |
""@i{u} is the zero-extended 16-bit little endian value stored at @i{c_addr}."" |
""@i{u} is the zero-extended 16-bit little endian value stored at @i{c_addr}."" |
Line 2536 u = (c_addr[1] << 8) | (c_addr[0]);
|
Line 2579 u = (c_addr[1] << 8) | (c_addr[0]);
|
|
|
le-ul@ ( c_addr -- u ) gforth l_fetch_le |
le-ul@ ( c_addr -- u ) gforth l_fetch_le |
""@i{u} is the zero-extended 32-bit little endian value stored at @i{c_addr}."" |
""@i{u} is the zero-extended 32-bit little endian value stored at @i{c_addr}."" |
u = (c_addr[3] << 24) | (c_addr[2] << 16) | (c_addr[1] << 8) | (c_addr[0]); |
u = ((Cell)c_addr[3] << 24) | (c_addr[2] << 16) | (c_addr[1] << 8) | (c_addr[0]); |
|
|
\+64bit |
\+64bit |
|
|