blob: b2f85a3ad54a5f82a54b7b070dc9b8b9b78ead50 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
Description: An upstream patch to not accept "-" as a valid number.
Origin: upstream; http://git.savannah.gnu.org/cgit/gforth.git/commit/kernel/int.fs?id=babed75bb2adb3420d9dd9b8f5184a82f664a551
Author: Anton Ertl <anton@mips.complang.tuwien.ac.at>
Last-Update: 2009-08-22
--- a/kernel/int.fs
+++ b/kernel/int.fs
@@ -163,21 +163,24 @@
over c@ '' = if
1 /string s'>unumber? exit
endif
- base @ >r getbase sign? >r
- 0. 2swap
- BEGIN ( d addr len )
- dup >r >number dup
- WHILE \ there are characters left
- dup r> -
- WHILE \ the last >number parsed something
- dup 1- dpl ! over c@ [char] . =
- WHILE \ the current char is '.'
- 1 /string
- REPEAT THEN \ there are unparseable characters left
- 2drop rdrop false
+ base @ >r getbase sign?
+ over if
+ >r 0. 2swap
+ BEGIN ( d addr len )
+ dup >r >number dup
+ WHILE \ there are characters left
+ dup r> -
+ WHILE \ the last >number parsed something
+ dup 1- dpl ! over c@ [char] . =
+ WHILE \ the current char is '.'
+ 1 /string
+ REPEAT THEN \ there are unparseable characters left
+ 2drop rdrop false
+ ELSE
+ rdrop 2drop r> ?dnegate true
+ THEN
ELSE
- rdrop 2drop r> ?dnegate true
- THEN
+ drop 2drop 0. false THEN
r> base ! ;
\ ouch, this is complicated; there must be a simpler way - anton
|