Sub(JS key) { this.key = key; }
public void put(JS key, JS val) throws JSExn { Ibex.this.put(JSU.S(JSU.toString(this.key) + "." + JSU.toString(key)), val); }
public JS get(JS key) throws JSExn { return Ibex.this.get(JSU.S(JSU.toString(this.key) + "." + JSU.toString(key))); }
- public JS call(JS[] args) throws JSExn { return Ibex.this.call(this.key, args); }
public JS call(JS method, JS[] args) throws JSExn {
+ if (method == null) return super.call(null, args);
return Ibex.this.call(JSU.S(JSU.toString(this.key) + "." + JSU.toString(method)), args);
}
}
case "stream.parse.xml": if(args[0] == null) return null; new XMLHelper(args[1]).doParse(args[0]); return null;
// FIXME backgrounding
case "stream.parse.utf8": if(args[0] == null) return null;
- try { return JSU.S(new String(InputStreamToByteArray.convert(args[0].getInputStream()))); }
+ try { return JSU.S(new String(InputStreamToByteArray.convert(JSU.getInputStream(args[0])))); }
catch (Exception e) { Log.warn(this, e); }
//#end
break;
callargs3[0] = JSU.S(c.getLocalName());
callargs3[1] = attrs;
callargs3[2] = JSU.S(c.getUri());
- startElement.call(callargs3);
+ startElement.call(null, callargs3);
} catch (JSExn jse) { throw new Wrapper(jse);
} finally { callargs3[0] = callargs3[1] = callargs3[2] = null; } }
public void endElement(Tree.Element c) throws XML.Exn { try {
callargs2[0] = JSU.S(c.getLocalName());
callargs2[1] = JSU.S(c.getUri());
- endElement.call(callargs2);
+ endElement.call(null, callargs2);
} catch (JSExn jse) { throw new Wrapper(jse); } finally { callargs2[0] = callargs2[1] = null; } }
public void characters(char[] ch, int start, int length) throws XML.Exn { try {
callargs1[0] = JSU.S(new String(ch, start, length));
- characters.call(callargs1);
+ characters.call(null, callargs1);
} catch (JSExn jse) { throw new Wrapper(jse); } finally { callargs1[0] = null; } }
public void whitespace(char[] ch, int start, int length) throws XML.Exn { try {
callargs1[0] = JSU.S(new String(ch, start, length));
- whitespace.call(callargs1);
+ whitespace.call(null, callargs1);
} catch (JSExn jse) { throw new Wrapper(jse); } finally { callargs1[0] = null; } }
public void doParse(JS s) throws JSExn {
try {
- parse(new BufferedReader(new InputStreamReader(s.getInputStream())));
+ parse(new BufferedReader(new InputStreamReader(JSU.getInputStream(s))));
} catch (Wrapper e) {
throw e.wrapee;
} catch (XML.Exn e) {
}
// FEATURE: This is a gross hack
public InputStream getImage() throws JSExn {
- try {
- InputStream in = getInputStream();
+ //try {
+ InputStream in = JSU.getInputStream(this);
if (in != null) return in;
- } catch (IOException e) { /* DELIBERATE */ }
+ //} catch (IOException e) { /* DELIBERATE */ }
String[] exts = new String[] { ".png", ".jpeg", ".gif" };
- for (int i=0; i < exts.length; i++)
- try {
- InputStream in = parent.get(JSU.S(JSU.toString(parentkey) + exts[i])).getInputStream();
+ for (int i=0; i < exts.length; i++) {
+ //try {
+ in = JSU.getInputStream(parent.get(JSU.S(JSU.toString(parentkey) + exts[i])));
if (in != null) return in;
- } catch (IOException f) { /* DELIBERATE */ }
+ //} catch (IOException f) { /* DELIBERATE */ }
+ }
return null;
}
public JS getStatic() throws JSExn {
for(Blessing b = parent; b.parentkey != null; b = b.parent) s = JSU.str(b.parentkey) + "." + s;
return s;
}
- public JS call(JS[] args) throws JSExn {
+ public JS call(JS method, JS[] args) throws JSExn {
+ if (method != null) return super.call(method, args);
if (args.length != 1) throw new JSExn("can only call a template with one arg");
getStatic();
if (t == null) throw new JSExn("No such template " + JSU.str(parentkey));
return t;
}
// JS:FIXME: Blessing shouldn't need to roll its own JS.Clone implementation
- public InputStream getInputStream() throws JSExn, IOException { return clonee.getInputStream(); }
+ //public InputStream getInputStream() throws JSExn, IOException { return clonee.getInputStream(); }
}
}
b.putAndTriggerTraps(b.get(JSU.S("numchildren")), kid);
}
- if (script != null) JSU.cloneWithNewGlobalScope(script, pis).call(callempty);
+ if (script != null) JSU.cloneWithNewGlobalScope(script, pis).call(null, callempty);
for(int i=0; keys != null && i < keys.length; i++) {
if (keys[i] == null) continue;
public TemplateHelper(String sourceName, JS s, Ibex ibex) throws XML.Exn, IOException, JSExn {
this.sourceName = sourceName;
this.ibex = ibex;
- InputStream is = s.getInputStream();
+ InputStream is = JSU.getInputStream(s);
Ibex.Blessing b = Ibex.Blessing.getBlessing(s).parent;
while(b != null) {
if(b.parentkey != null) initial_uri = JSU.toString(b.parentkey) + (initial_uri.equals("") ? "" : "." + initial_uri);
JS staticScript = parseScript(static_content, static_content_start);
t.staticObject = new JS.Obj();
JS staticScope = new PerInstantiationScope(null, ibex, null, t.staticObject);
- if (staticScript != null) JSU.cloneWithNewGlobalScope(staticScript, staticScope).call(callempty);
+ if (staticScript != null) JSU.cloneWithNewGlobalScope(staticScript, staticScope).call(null, callempty);
}
private JS parseScript(StringBuffer content, int content_start) throws IOException {