| r> ; |
r> ; |
| |
|
| : s>unumber? ( addr u -- ud flag ) |
: s>unumber? ( addr u -- ud flag ) |
| |
base @ >r dpl on getbase |
| 0. 2swap |
0. 2swap |
| BEGIN ( d addr len ) |
BEGIN ( d addr len ) |
| dup >r >number dup |
dup >r >number dup |
| 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 |
| rdrop 2drop false |
2drop false |
| ELSE |
ELSE |
| rdrop 2drop true |
rdrop 2drop true |
| THEN ; |
THEN |
| |
r> base ! ; |
| |
|
| \ ouch, this is complicated; there must be a simpler way - anton |
\ ouch, this is complicated; there must be a simpler way - anton |
| : s>number? ( addr len -- d f ) |
: s>number? ( addr len -- d f ) |
| \ converts string addr len into d, flag indicates success |
\ converts string addr len into d, flag indicates success |
| base @ >r dpl on sign? >r getbase |
sign? >r |
| s>unumber? |
s>unumber? |
| 0= IF |
0= IF |
| false |
rdrop false |
| ELSE \ no characters left, all ok |
ELSE \ no characters left, all ok |
| r> |
r> |
| IF |
IF |
| dnegate |
dnegate |
| THEN |
THEN |
| true |
true |
| THEN |
THEN ; |
| r> base ! ; |
|
| |
|
| : s>number ( addr len -- d ) |
: s>number ( addr len -- d ) |
| \ don't use this, there is no way to tell success |
\ don't use this, there is no way to tell success |