( -- c-addr u )
c-addr is the address of, and u is the number of characters in, the input buffer.
SOURCE simplifies the process of directly accessing the input buffer by hiding the differences between its location for different input sources. This also gives implementors more flexibility in their implementation of buffering mechanisms for different input sources. The committee moved away from an input buffer specification consisting of a collection of individual variables, declaring TIB and #TIB obsolescent.
In this system TIB and #TIB always point to (words) input area.
SOURCE and the contents of >IN completly describes the input.
: SOURCE ( -- addr n )
TIB
#TIB @
;
CORE
( "< spaces >name" -- char )
Skip leading space delimiters. Parse name delimited by a space. Put the value of its first character onto the stack.
Typical use: ... CHAR A CONSTANT "A" ...
: CHAR ( -- char)
BL (word) DROP char@
;
TOOLS
( -- )
Copy and display the values currently on the data stack. The format of the display is implementation-dependent.
.S may be implemented using pictured numeric output words. Consequently, its use may corrupt the transient region identified by #>.
.S is a debugging convenience found on almost all Forth systems. It is universally mentioned in Forth texts.
COLDFORTH
The picture number words are used but the picture number words can be
nested so .S can be used within <# if you must use <# instead of [#
| : _?stack_empty ( -- ) DEPTH 0< ABORT" Stack empty" ;
: .S ( ? -- ?)
_?stack_empty DEPTH CR IF
@s _%data_stack_end @ 4- 4- DO
I @ .h
-4 +LOOP
THEN
." <-Top "
send
;
' .S (.S) t!
tick CORE
( "<space>name" -- xt )
Skip leading space delimiters. Parse name delimited by a space. Find name and return xt, the execution token for name. An ambiguous condition exists if name is not found.
When interpreting, ' xyz EXECUTE is equivalent to xyz.
| : ?token ( flag--)
ABORT" Can't use input token."
;
: ' ( "name" -- xt)
_defined \ FALSE | xt -1 | xt 1(--
0= \ true|xt false(--
\ ABORT if name not found
?token \ xt(--
;