home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Simtel MSDOS 1992 June
/
SIMTEL_0692.cdr
/
msdos
/
forth
/
fifth.arc
/
ASCII.FIV
next >
Wrap
Text File
|
1986-01-07
|
2KB
|
44 lines
CREATE ASCII
CREATE WHITE
EDIT
\ White tests if the character on the top of stack is a white space character,
\ that is, a space, cr, tab, or line feed.
: white
dup 32 = \ Space.
over 13 = or \ CR.
over 9 = or \ Tab.
over 10 = or \ Line feed.
;
~UP
EDIT
\ Takes the next character in the input stream and generates the its ASCII
\ value. If the compiler is on, the code to push this ASCII representation
\ onto the stack is generated. A compile error occurs if ASCII is followed
\ by more than one character.
: ASCII
begin \ Find the beginning of the next word.
>in @ c@@ white \ Get the next character and test if white space.
1 >in +! \ Move text pointer to next character.
while \ Loop while white space.
drop \ Drop character if it is white space.
repeat
dup if else \ Test for end of text. (This is marked by 0)
cls \ Error if at end of text.
." EOT error on ASCII routine"
abort
endif
>in @ c@@ white over 0= or \ Test that only one character follows.
if
drop \ Drop the white space character.
else
drop cls \ More than one character follows.
." Illegal ASCII character"
abort
endif
state c@ if \ If the compiler is on,
['] literal execute \ compile a push of the ASCII value to the stack.
endif
; immediate
~UP
ABORT