| drop |
drop |
| THEN ; |
THEN ; |
| |
|
| \ ouch, this is complicated; there must be a simpler way - anton |
: sign? ( addr u -- addr u flag ) |
| : s>number? ( addr len -- d f ) |
|
| \ converts string addr len into d, flag indicates success |
|
| base @ >r dpl on |
|
| over c@ '- = dup >r |
over c@ '- = dup >r |
| IF |
IF |
| 1 /string |
1 /string |
| THEN |
THEN |
| getbase dpl on 0. 2swap |
r> ; |
| |
|
| |
: s>unumber? ( addr u -- ud flag ) |
| |
0. 2swap |
| BEGIN ( d addr len ) |
BEGIN ( d addr len ) |
| dup >r >number dup |
dup >r >number dup |
| WHILE \ there are characters left |
WHILE \ there are characters left |
| WHILE \ the current char is '.' |
WHILE \ the current char is '.' |
| 1 /string |
1 /string |
| REPEAT THEN \ there are unparseable characters left |
REPEAT THEN \ there are unparseable characters left |
| 2drop rdrop false |
rdrop 2drop false |
| |
ELSE |
| |
rdrop 2drop true |
| |
THEN ; |
| |
|
| |
\ ouch, this is complicated; there must be a simpler way - anton |
| |
: s>number? ( addr len -- d f ) |
| |
\ converts string addr len into d, flag indicates success |
| |
base @ >r dpl on sign? >r getbase |
| |
s>unumber? |
| |
0= IF |
| |
false |
| ELSE \ no characters left, all ok |
ELSE \ no characters left, all ok |
| 2drop rdrop r> |
r> |
| IF |
IF |
| dnegate |
dnegate |
| THEN |
THEN |