altosui: Move number parsing code to Altos general class
[fw/altos] / ao-tools / altosui / AltosParse.java
index a60dc69434a67aa454519979041fee7f7a4d47a3..4d82de7816ef2d625d3ef3ec386116c2bae527d7 100644 (file)
@@ -20,10 +20,16 @@ package altosui;
 import java.text.*;
 import java.lang.*;
 
 import java.text.*;
 import java.lang.*;
 
+import altosui.Altos;
+
 public class AltosParse {
 public class AltosParse {
+       static boolean isdigit(char c) {
+               return '0' <= c && c <= '9';
+       }
+
        static int parse_int(String v) throws ParseException {
                try {
        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);
                }
                } 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 {
 
        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);
                }
                } catch (NumberFormatException e) {
                        throw new ParseException("error parsing hex " + v, 0);
                }