--- gforth/prim 2002/12/03 10:47:49 1.103 +++ gforth/prim 2002/12/27 16:22:03 1.109 @@ -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 \ \ @@ -1288,7 +1289,8 @@ while(u1--) ASCII strings (larger if ubits is large), and should share no divisors with ubits. */ -unsigned rot = ((char []){5,0,1,2,3,4,5,5,5,5,3,5,5,5,5,7,5,5,5,5,7,5,5,5,5,6,5,5,5,5,7,5,5})[ubits]; +static char rot_values[] = {5,0,1,2,3,4,5,5,5,5,3,5,5,5,5,7,5,5,5,5,7,5,5,5,5,6,5,5,5,5,7,5,5}; +unsigned rot = rot_values[ubits]; Char *cp = c_addr; for (ukey=0; cp>(ubits-rot))) @@ -1604,19 +1606,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 */ @@ -1808,16 +1810,9 @@ floor ( r1 -- r2 ) float /* !! unclear wording */ r2 = floor(r1); -(fround) ( r1 -- r2 ) gforth paren_f_round -""Round to the nearest integral value. Primitive variant (unused)"" -/* !! eliminate this as primitive? */ -/* !! unclear wording */ -#ifdef HAVE_RINT +fround ( r1 -- r2 ) gforth f_round +""Round to the nearest integral value."" r2 = rint(r1); -#else -r2 = floor(r1+0.5); -/* !! This is not quite true to the rounding rules given in the standard */ -#endif fmax ( r1 r2 -- r3 ) float f_max if (r1r ; +\ set-next-code and call2 do not appear in images and can be +\ renumbered arbitrarily + set-next-code ( #w -- ) gforth set_next_code #ifdef NO_IP next_code = (Label)w; @@ -2773,6 +2771,14 @@ finish-code ( -- ) gforth finish_code 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)