trim down public api
[org.ibex.core.git] / src / org / ibex / js / Test.java
index 8e4be33..c432a6a 100644 (file)
@@ -31,6 +31,8 @@ public class Test extends JS {
     public JS get(JS key) throws JSExn {
         if(!JS.isString(key)) return null;
         if("print".equals(JS.toString(key))) return METHOD;
+        if("clone".equals(JS.toString(key))) return METHOD;
+        if("firethis".equals(JS.toString(key))) return METHOD;
         if("bgget".equals(JS.toString(key))) {
             action = "bgget";
             try {
@@ -51,8 +53,12 @@ public class Test extends JS {
             } catch(NotPauseableException e) {
                 throw new Error("should never happen");
             }
-        return;
-        }        
+            return;
+        }   
+        if("exit".equals(JS.toString(key))) {
+            System.exit(JS.toInt(val));
+            return;
+        }
         super.put(key,val);
     }
     
@@ -62,6 +68,16 @@ public class Test extends JS {
             System.out.println(JS.debugToString(a0));
             return null;
         }
+        if("clone".equals(JS.toString(method))) return a0 == null ? null : a0.jsclone();
+        if("firethis".equals(JS.toString(method))) {
+            String action = JS.toString(a0);
+            JS target = a1;
+            JS key = a2;
+            if(action.equals("get")) return a1.getAndTriggerTraps(key);
+            else if(action.equals("put")) a1.putAndTriggerTraps(key,JS.S("some value"));
+            else if(action.equals("trigger")) return target.justTriggerTraps(key,JS.S("some trigger value"));
+            return null;
+        }
         return null;
     }
 }