altosuilib: Track open frames, exit when none remain
[fw/altos] / altoslib / AltosParse.java
index ae88182de638e8c3d4e2c6dc1b66789c94708d00..fbd049ae7a3da093c89de7ea5345546a4d3b8bf5 100644 (file)
@@ -26,6 +26,14 @@ public class AltosParse {
        }
 
        public static int parse_int(String v) throws ParseException {
+               try {
+                       return (int) AltosLib.fromdec(v);
+               } catch (NumberFormatException e) {
+                       throw new ParseException("error parsing int " + v, 0);
+               }
+       }
+
+       public static long parse_long(String v) throws ParseException {
                try {
                        return AltosLib.fromdec(v);
                } catch (NumberFormatException e) {
@@ -53,6 +61,10 @@ public class AltosParse {
                }
        }
 
+       public static String format_double_locale(double number) {
+               return nf_locale.format(number);
+       }
+
        public static double parse_double_net(String str) throws ParseException {
                try {
                        return nf_net.parse(str.trim()).doubleValue();
@@ -61,6 +73,10 @@ public class AltosParse {
                }
        }
 
+       public static String format_double_net(double number) {
+               return nf_net.format(number);
+       }
+
        public static double parse_coord(String coord) throws ParseException {
                String[]        dsf = coord.split("\\D+");