| |
|
| : save-input ( -- x1 .. xn n ) \ core-ext |
: save-input ( -- x1 .. xn n ) \ core-ext |
| >in @ |
>in @ |
| loadfile @ ?dup |
loadfile @ |
| IF dup file-position throw sourceline# >tib @ 6 |
if |
| #tib @ >tib +! |
loadfile @ file-position throw |
| ELSE sourceline# 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 sourceline# <> 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 ; |
| |
|
| |
|
| |
|