From f0fd423d0bf83bc5c3f9d39e9c09397fbe8caed2 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Thu, 26 Aug 2010 23:41:26 -0700 Subject: altosui: Move number parsing code to Altos general class This moves these shared functions to the global shared class. Signed-off-by: Keith Packard --- ao-tools/altosui/AltosParse.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'ao-tools/altosui/AltosParse.java') 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); } -- cgit v1.2.3