- ABORT
- ABORT"
- ABS
- ACCEPT
- ACTION-OF
- AGAIN
- ALIGN
- ALIGNED
- ALLOT
- AND
- BASE
- BEGIN
- BL
- BUFFER:
- [
- [CHAR]
- [COMPILE]
- [']
- CASE
- C,
- CELL+
- CELLS
- C@
- CHAR
- CHAR+
- CHARS
- COMPILE,
- CONSTANT
- COUNT
- CR
- CREATE
- C!
- :
- :NONAME
- ,
- C"
- DECIMAL
- DEFER
- DEFER@
- DEFER!
- DEPTH
- DO
- DOES>
- DROP
- DUP
- /
- /MOD
- .R
- .(
- ."
- ELSE
- EMIT
- ENDCASE
- ENDOF
- ENVIRONMENT?
- ERASE
- EVALUATE
- EXECUTE
- EXIT
- =
- FALSE
- FILL
- FIND
- FM/MOD
- @
- HERE
- HEX
- HOLD
- HOLDS
- I
- IF
- IMMEDIATE
- INVERT
- IS
- J
- KEY
- LEAVE
- LITERAL
- LOOP
- LSHIFT
- MARKER
- MAX
- MIN
- MOD
- MOVE
- M*
- -
- NEGATE
- NIP
- OF
- OR
- OVER
- 1-
- 1+
- PAD
- PARSE-NAME
- PARSE
- PICK
- POSTPONE
- +
- +LOOP
- +!
- QUIT
- RECURSE
- REFILL
- REPEAT
- RESTORE-INPUT
- R@
- ROLL
- ROT
- RSHIFT
- R>
- SAVE-INPUT
- SIGN
- SM/REM
- SOURCE-ID
- SOURCE
- SPACE
- SPACES
- STATE
- SWAP
- ;
- S\"
- S"
- S>D
- !
- THEN
- TO
- TRUE
- TUCK
- TYPE
- '
- *
- */
- */MOD
- 2DROP
- 2DUP
- 2/
- 2@
- 2OVER
- 2R@
- 2R>
- 2SWAP
- 2!
- 2*
- 2>R
- U.R
- UM/MOD
- UM*
- UNLOOP
- UNTIL
- UNUSED
- U.
- U<
- U>
- VALUE
- VARIABLE
- WHILE
- WITHIN
- WORD
- XOR
- 0=
- 0<
- 0>
- 0<>
- \
- .
- <
- >
- <>
- #>
- <#
- #
- #S
- (
- ?DO
- ?DUP
- >BODY
- >IN
- >NUMBER
- >R
6.2.2148 RESTORE-INPUT CORE EXT
Attempt to restore the input source specification to the state described by x1 through xn. flag is true if the input source specification cannot be so restored.
An ambiguous condition exists if the input source represented by the arguments is not the same as the current input source.
See:
ContributeContributions
ruv [274] Address of the input buffer after RESTORE-INPUTRequest for clarification2023-02-07 10:03:28
The section 3.3.3.5 Input buffers says:
The address and length returned by
SOURCE
, the string returned byPARSE
, and directly computed input-buffer addresses are valid only until the text interpreter does I/O to refill the input buffer or the input source is changed.
So, refill
may change the the address of the input buffer. And the following line:
:noname ( -- ) source drop refill drop postpone \ source drop <> . ; execute
may print -1
as well as 0
.
So a question arises: may restore-input
change the address of the input buffer so it will distinct from the address before save-input
?
I think, it may, since restore-input
can do I/O. Hence, we should conclude that a particular state of the input buffer does not include the address where this buffer is located.
And it means that the fragment:
:noname ( -- ) source drop save-input refill drop restore-input abort" cannot restore input" source drop <> . ; execute
may print -1
as well as 0
.
ruv [275] About behavior or RESTORE-INPUTComment2023-02-07 16:09:01
It can be not obvious on the first glance from the specifications that:
restore-input
is not obligated to be paired withsave-input
one-to-one.restore-input
can be applied one time, several times (more than 1), or even never to the same input source specification.
The input source specification, which save-input
returns, is a kind of a position in the input source, and a program may use this position zero, one, or more times within this input source. And this position should be a valid parameter all the time while the program has access to the corresponding input source.
After performing restore-input
, the input buffer content should be the same as it was on the time of getting the position.