diff options
| author | Keith Packard <keithp@keithp.com> | 2010-08-26 23:41:26 -0700 |
|---|---|---|
| committer | Keith Packard <keithp@keithp.com> | 2010-08-26 23:41:26 -0700 |
| commit | f0fd423d0bf83bc5c3f9d39e9c09397fbe8caed2 (patch) | |
| tree | 641291f859fc6fb128a0da0575c23be2db1fc56d /ao-tools/altosui/AltosParse.java | |
| parent | 68b2b66d7574dfd0bd5e3571b8ffad32ca5d2b73 (diff) | |
altosui: Move number parsing code to Altos general class
This moves these shared functions to the global shared class.
Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'ao-tools/altosui/AltosParse.java')
| -rw-r--r-- | ao-tools/altosui/AltosParse.java | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/ao-tools/altosui/AltosParse.java b/ao-tools/altosui/AltosParse.java index a60dc694..4d82de78 100644 --- a/ao-tools/altosui/AltosParse.java +++ b/ao-tools/altosui/AltosParse.java @@ -20,10 +20,16 @@ package altosui; import java.text.*; import java.lang.*; +import altosui.Altos; + public class AltosParse { + static boolean isdigit(char c) { + return '0' <= c && c <= '9'; + } + static int parse_int(String v) throws ParseException { try { - return Integer.parseInt(v); + return Altos.fromdec(v); } catch (NumberFormatException e) { throw new ParseException("error parsing int " + v, 0); } @@ -31,7 +37,7 @@ public class AltosParse { static int parse_hex(String v) throws ParseException { try { - return Integer.parseInt(v, 16); + return Altos.fromhex(v); } catch (NumberFormatException e) { throw new ParseException("error parsing hex " + v, 0); } |
