2020-04-04 07:35:07 -04:00
|
|
|
( Words allowing printing strings. Require core )
|
|
|
|
( This used to be in core, but some drivers providing EMIT
|
|
|
|
are much much easier to write with access to core words,
|
|
|
|
and these words below need EMIT... )
|
|
|
|
|
|
|
|
: (print)
|
|
|
|
BEGIN
|
2020-04-16 18:58:11 -04:00
|
|
|
C@+ ( a+1 c )
|
2020-04-04 07:35:07 -04:00
|
|
|
( exit if null )
|
|
|
|
DUP NOT IF 2DROP EXIT THEN
|
|
|
|
EMIT ( a )
|
|
|
|
AGAIN
|
|
|
|
;
|
|
|
|
|
|
|
|
: ."
|
2020-04-11 13:13:20 -04:00
|
|
|
34 , ( 34 == litWord )
|
2020-04-04 07:35:07 -04:00
|
|
|
BEGIN
|
2020-04-16 18:58:11 -04:00
|
|
|
C<
|
2020-04-04 07:35:07 -04:00
|
|
|
( 34 is ASCII for " )
|
2020-04-16 18:58:11 -04:00
|
|
|
DUP 34 = IF DROP 0 THEN
|
|
|
|
DUP C,
|
|
|
|
NOT UNTIL
|
2020-04-04 07:35:07 -04:00
|
|
|
COMPILE (print)
|
|
|
|
; IMMEDIATE
|
|
|
|
|
|
|
|
: ABORT" [COMPILE] ." COMPILE ABORT ; IMMEDIATE
|
|
|
|
|
|
|
|
: (uflw) ABORT" stack underflow" ;
|
|
|
|
: (wnf) ABORT" word not found" ;
|
2020-04-04 10:28:00 -04:00
|
|
|
|
|
|
|
: BS 8 EMIT ;
|
|
|
|
: LF 10 EMIT ;
|
|
|
|
: CR 13 EMIT ;
|
2020-04-14 09:05:43 -04:00
|
|
|
: CRLF CR LF ;
|
2020-04-04 10:28:00 -04:00
|
|
|
: SPC 32 EMIT ;
|