- public static synchronized ImageDecoder decodeJPEG(InputStream is, String name) {
- return platform._decodeJPEG(is, name);
- }
-
- // Helpful font parsing stuff //////////////////////////////////////////////////////
-
- public static class ParsedFont {
- public ParsedFont() { }
- public ParsedFont(String s) { parse(s); }
- public int size = 10;
- public String name = "";
-
- public boolean italic = false;
- public boolean bold = false;
- public boolean underline = false;
- public boolean dotted_underline = false;
-
- private static int stoi(Object o) {
- if (o == null) return 0;
- if (o instanceof Integer) return ((Integer)o).intValue();
-
- String s = o.toString();
- try { return Integer.parseInt(s.indexOf('.') == -1 ? s : s.substring(0, s.indexOf('.'))); }
- catch (NumberFormatException e) { return 0; }
- }
-
- public void parse(String font) {
- int i = 0;
- while(i < font.length() && !Character.isDigit(font.charAt(i)) && font.charAt(i) != '*') i++;
- name = font.substring(0, i).toLowerCase().replace('_', ' ');
- size = 10;
- italic = false;
- bold = false;
- underline = false;
- dotted_underline = false;
- if (i != font.length()) {
- if (font.charAt(i) == '*') {
- size = 0;
- i++;
- } else {
- int j = i;
- while (j < font.length() && Character.isDigit(font.charAt(j))) j++;
- if (i != j) size = stoi(font.substring(i, j));
- i = j;
- }
- while(i < font.length()) {
- switch (font.charAt(i)) {
- case 'b': bold = true; break;
- case 'i': italic = true; break;
- case 'd': dotted_underline = true; break;
- case 'u': underline = true; break;
- }
- i++;
- }
- }
- }
-
- }
-
+ /** returns a Scheduler instance; used to implement platform-specific schedulers */
+ protected Scheduler _getScheduler() { return new Scheduler(); }
+ public static Scheduler getScheduler() { return platform._getScheduler(); }
+
+ public static void running() { platform._running(); }
+ public void _running() { new Semaphore().block(); }