--- gforth/prim 2002/12/19 23:23:49 1.107 +++ gforth/prim 2002/12/30 22:41:07 1.111 @@ -105,6 +105,7 @@ \E \E set-current \E store-optimization on +\E ' noop tail-nextp2 ! \ now INST_TAIL just stores, but does not jump \ \ @@ -817,6 +818,8 @@ lshift ( u1 n -- u2 ) core l_shift : 0 ?DO 2* LOOP ; +\g compare + \ comparisons(prefix, args, prefix, arg1, arg2, wordsets...) define(comparisons, $1= ( $2 -- f ) $6 $3equals @@ -938,8 +941,6 @@ f = FLAG(u1-u2 < u3-u2); : over - >r - r> u< ; -\g internal - sp@ ( -- a_addr ) gforth sp_fetch a_addr = sp+1; @@ -1090,6 +1091,8 @@ w = sp[u+1]; \ toggle is high-level: 0.11/0.42% +\g memory + @ ( a_addr -- w ) core fetch ""@i{w} is the cell stored at @i{a_addr}."" w = *a_addr; @@ -1211,6 +1214,8 @@ c_addr2 = c_addr1+1; : dup 1+ swap c@ ; +\g compiler + (f83find) ( c_addr u f83name1 -- f83name2 ) new paren_f83find for (; f83name1 != NULL; f83name1 = (struct F83Name *)(f83name1->next)) if ((UCell)F83NAME_COUNT(f83name1)==u && @@ -1605,19 +1610,19 @@ wior = IOR(rename(tilde_cstr(c_addr1, u1 file-position ( wfileid -- ud wior ) file file_position /* !! use tell and lseek? */ -ud = LONG2UD(ftell((FILE *)wfileid)); -wior = IOR(UD2LONG(ud)==-1); +ud = OFF2UD(ftello((FILE *)wfileid)); +wior = IOR(UD2OFF(ud)==-1); reposition-file ( ud wfileid -- wior ) file reposition_file -wior = IOR(fseek((FILE *)wfileid, UD2LONG(ud), SEEK_SET)==-1); +wior = IOR(fseeko((FILE *)wfileid, UD2OFF(ud), SEEK_SET)==-1); file-size ( wfileid -- ud wior ) file file_size struct stat buf; wior = IOR(fstat(fileno((FILE *)wfileid), &buf)==-1); -ud = LONG2UD(buf.st_size); +ud = OFF2UD(buf.st_size); resize-file ( ud wfileid -- wior ) file resize_file -wior = IOR(ftruncate(fileno((FILE *)wfileid), UD2LONG(ud))==-1); +wior = IOR(ftruncate(fileno((FILE *)wfileid), UD2OFF(ud))==-1); read-file ( c_addr u1 wfileid -- u2 wior ) file read_file /* !! fread does not guarantee enough */ @@ -2022,6 +2027,8 @@ df_addr = (DFloat *)((((Cell)c_addr)+(si \+ \+glocals +\g locals + @local# ( #noffset -- w ) gforth fetch_local_number w = *(Cell *)(lp+noffset); @@ -2093,6 +2100,8 @@ r = fp[u+1]; /* +1, because update of fp \+OS +\g syslib + define(`uploop', `pushdef(`$1', `$2')_uploop(`$1', `$2', `$3', `$4', `$5')`'popdef(`$1')') define(`_uploop', @@ -2528,10 +2537,9 @@ SUPER_CONTINUE; acondbranch(a?branch,f --,f83 aquestion_branch, ,if (f==0) { ,: - 0= dup \ !f !f \ !! still uses relative addresses - r> dup @ \ !f !f IP branchoffset - rot and + \ !f IP|IP+branchoffset - swap 0= cell and + \ IP'' + 0= dup 0= \ !f f + r> tuck cell+ \ !f branchoffset f IP+ + and -rot @ and or \ f&IP+|!f&branch >r ;) \ we don't need an lp_plus_store version of the ?dup-stuff, because it @@ -2782,4 +2790,6 @@ a_prim = decompile_code(a_code); include(peeprules.vmg) +\g end + \+