version 1.19, 1999/02/16 06:32:33
|
version 1.20, 1999/02/20 22:13:23
|
Line 92 const Create bases 10 , 2 , A , 10
|
Line 92 const Create bases 10 , 2 , A , 10
|
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 |
Line 110 const Create bases 10 , 2 , A , 10
|
Line 110 const Create bases 10 , 2 , A , 10
|
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 |