--- /dev/null
+package org.ibex.js;
+
+import java.io.*;
+
+public class Test extends JS {
+ public static void main(String[] args) throws Exception {
+ if(args.length == 0) { System.err.println("Usage Test filename"); System.exit(1); }
+ JS f = JS.fromReader(args[0],0,new FileReader(args[0]));
+ JSScope s = new JSScope(null);
+ s.put("sys",new Test());
+ f = JS.cloneWithNewParentScope(f,s);
+ Object ret = f.call(null,null,null,null,0);
+ System.out.println("Script returned: " + JS.toString(ret));
+ }
+
+ public Object get(Object key) throws JSExn {
+ if("print".equals(key)) return METHOD;
+ return super.get(key);
+ }
+
+ public Object callMethod(Object method, Object a0, Object a1, Object a2, Object[] rest, int nargs) throws JSExn {
+ if("print".equals(method)) {
+ System.out.println(JS.toString(a0));
+ return null;
+ }
+ return null;
+ }
+}