throw new JSExn("invalid resource specifier " + url);
}
case "thread.sleep": sleep(JS.toInt(a)); return null;
- case "regexp": return JS.newRegexp(a, null);
+ case "regexp": return new JSRegexp(a, null);
case "net.rpc.xml": return new XMLRPC(JS.toString(a), "");
case "crypto.rsa": /* FEATURE */ return null;
case "crypto.md5": /* FEATURE */ return null;
case 2:
//#jswitch(name)
case "stream.watch": return new Stream.ProgressWatcher(a, b);
- case "regexp": return JS.newRegexp(a, b);
+ case "regexp": return new JSRegexp(a, b);
//#end
case 3:
//#jswitch(name)
// FEATURE: move this into builtin.xwar
public Blessing bless(JS b) throws JSExn { return new Ibex.Blessing(b, this, null, null); }
- // FIXME: Does this really need to extends JS.Clone?
- // FEATURE: Mandate that Blessings use only String keys?
- public static class Blessing extends JS.Clone {
+ // JS:FIXME: This doesn't properly handle traps
+ public static class Blessing extends JS.O {
private Ibex ibex;
private Template t = null;
public JS parentkey = null;
public Blessing parent = null;
+ public JS clonee;
private Hash cache = new Hash();
public Blessing(JS clonee, Ibex ibex, Blessing parent, JS parentkey) throws JSExn {
- super(clonee); this.ibex = ibex; this.parentkey = parentkey; this.parent = parent; }
+ this.clonee = clonee; this.ibex = ibex; this.parentkey = parentkey; this.parent = parent; }
public JS get(JS key) throws JSExn {
if (JS.isString(key) && JS.toString(key).equals("")) return getStatic();
if (cache.get(key) != null) return (JS)cache.get(key);
} catch (IOException f) { /* DELIBERATE */ }
return null;
}
- public JSScope getStatic() throws JSExn {
+ public JS getStatic() throws JSExn {
try {
if (t == null) {
// FEATURE: Might want to handle the ".t" part better
JS res = parent.get(JS.S(JS.toString(parentkey) + ".t"));
t = Template.buildTemplate(description(), res, ibex);
}
- return t != null ? t.staticScope : null;
+ return t != null ? t.staticObject : null;
} catch (Exception e) {
Log.error(this, e);
return null;
}
private String description() {
String s = JS.debugToString(parentkey);
- for(Blessing b = parent; b != null; b = b.parent) s = JS.debugToString(parentkey) + "." + s;
+ for(Blessing b = parent; b.parentkey != null; b = b.parent) s = JS.debugToString(b.parentkey) + "." + s;
return s;
}
public JS call(JS a, JS b, JS c, JS[] rest, int nargs) throws JSExn {
if (t == null) throw new JSExn("No such template " + JS.debugToString(parentkey));
return t;
}
+ // JS:FIXME: Blessing shouldn't need to roll its own JS.Clone implementation
+ public InputStream getInputStream() throws IOException { return clonee.getInputStream(); }
}
}