705d68deec
With KEY and EMIT being switch words, most of the high layer can be defined before drivers. In addition to this change, I've compacted core blocks which were becoming quite sparse.
15 lines
423 B
Plaintext
15 lines
423 B
Plaintext
( r c -- r f )
|
|
( Parse digit c and accumulate into result r.
|
|
Flag f is 0 when c was a valid digit, 1 when c was WS,
|
|
-1 when c was an invalid digit. )
|
|
: _pdacc
|
|
DUP 0x21 < IF DROP 1 EXIT THEN
|
|
( parse char )
|
|
( if bad, return "r -1" )
|
|
'0' -
|
|
DUP 10 < NOT IF DROP -1 EXIT THEN
|
|
( good, add to running result )
|
|
SWAP 10 * + ( r*10+n )
|
|
0 ( good )
|
|
;
|