case "date": return new JSDate(a, b, c, rest, nargs);
case "net.rpc.soap": return new SOAP(JS.toString(a), "", JS.toString(b), JS.toString(c));
// FIXME support object dumping
- case "log.debug": JS.debug(a== null ? "**null**" : a.toString()); return null;
- case "log.info": JS.info(a== null ? "**null**" : a.toString()); return null;
- case "log.warn": JS.warn(a== null ? "**null**" : a.toString()); return null;
- case "log.error": JS.error(a== null ? "**null**" : a.toString()); return null;
+ case "log.debug": JS.debug(a== null ? "**null**" : JS.debugToString(a)); return null;
+ case "log.info": JS.info(a== null ? "**null**" : JS.debugToString(a)); return null;
+ case "log.warn": JS.warn(a== null ? "**null**" : JS.debugToString(a)); return null;
+ case "log.error": JS.error(a== null ? "**null**" : JS.debugToString(a)); return null;
//#end
switch (nargs) {
// 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 {
private Ibex ibex;
private Template t = null;
} catch (IOException f) { /* DELIBERATE */ }
return null;
}
- public JSScope getStatic() {
+ public JSScope getStatic() throws JSExn {
try {
if (t == null) {
+ // FEATURE: Might want to handle the ".t" part better
JS res = (JS) parent.get(JS.S(JS.toString(parentkey) + ".t"));
- t = Template.buildTemplate(res.unclone().toString(), res, ibex);
+ // FIXME: need a better description (Stream.toString())
+ t = Template.buildTemplate(JS.toString(parentkey), res, ibex);
}
- return t.staticScope;
+ return t != null ? t.staticScope : null;
} catch (Exception e) {
Log.error(this, e);
return null;
}
}
public JS call(JS a, JS b, JS c, JS[] rest, int nargs) throws JSExn {
- // GROSS hack
- if (nargs != 1 && nargs != 9999) throw new JSExn("FIXME can only call with one arg");
+ if (nargs != 1) throw new JSExn("can only call a template with one arg");
getStatic();
if (t == null) throw new JSExn("No such template " + parentkey);
- if (nargs == 9999) /*return t;*/ throw new Error("FIXME"); // FIXME: 9999 stuff
if(!(a instanceof Box)) throw new JSExn("can only apply templates to boxes");
t.apply((Box)a);
return a;
}
+ // FEATURE: This is a gross hack
+ Template getTemplate() throws JSExn {
+ getStatic();
+ if (t == null) throw new JSExn("No such template " + JS.debugToString(parentkey));
+ return t;
+ }
}
}