Diff for /gforth/extend.fs between versions 1.12 and 1.14

version 1.12, 1995/11/07 18:06:39 version 1.14, 1995/12/04 16:38:52
Line 129  decimal Line 129  decimal
 \ SOURCE-ID SAVE-INPUT RESTORE-INPUT                    11jun93jaw  \ SOURCE-ID SAVE-INPUT RESTORE-INPUT                    11jun93jaw
   
 : source-id ( -- 0 | -1 | fileid ) \ core-ext source-i-d  : source-id ( -- 0 | -1 | fileid ) \ core-ext source-i-d
   loadfile @ dup 0= IF  drop loadline @ 0 min  THEN ;    loadfile @ dup 0= IF  drop sourceline# 0 min  THEN ;
   
 : save-input ( -- x1 .. xn n ) \ core-ext  : save-input ( -- x1 .. xn n ) \ core-ext
   >in @      >in @
   loadfile @ ?dup      loadfile @
   IF    dup file-position throw loadline @ >tib @ 6      if
         #tib @ >tib +!          loadfile @ file-position throw
   ELSE  loadline @ blk @ linestart @ >tib @ 5 THEN      else
 ;          blk @
           linestart @
       then
       sourceline#
       >tib @
       source-id
       6 ;
   
 : restore-input ( x1 .. xn n -- flag ) \ core-ext  : restore-input ( x1 .. xn n -- flag ) \ core-ext
   swap >tib !      6 <> -12 and throw
   6 = IF   loadline ! rot dup loadfile !      source-id <> -12 and throw
            reposition-file IF drop true EXIT THEN      >tib !
       ELSE linestart ! blk !      >r ( line# )
            dup loadline @ <> IF 2drop true EXIT THEN      loadfile @ 0<>
            loadline !      if
       THEN          loadfile @ reposition-file throw
   >in ! false ;      else
           linestart !
           blk !
           sourceline# r@ <> blk @ 0= and loadfile @ 0= and
           if
               drop rdrop true EXIT
           then
       then
       r> loadline !
       >in !
       false ;
   
   \ : save-input ( -- x1 .. xn n ) \ core-ext
   \   >in @
   \   loadfile @ ?dup
   \   IF    dup file-position throw sourceline# >tib @ 6
   \         #tib @ >tib +!
   \   ELSE  sourceline# blk @ linestart @ >tib @ 5 THEN
   \ ;
   
   \ : restore-input ( x1 .. xn n -- flag ) \ core-ext
   \   swap >tib !
   \   6 = IF   loadline ! rot dup loadfile !
   \            reposition-file IF drop true EXIT THEN
   \       ELSE linestart ! blk !
   \            dup sourceline# <> IF 2drop true EXIT THEN
   \            loadline !
   \       THEN
   \   >in ! false ;
   
   
   

Removed from v.1.12  
changed lines
  Added in v.1.14


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>