// Copyright 2004 Adam Megacz, see the COPYING file for licensing [GPL]
-package org.xwt;
+package org.ibex;
import java.io.*;
-import java.net.*;
-import java.text.*;
-import java.util.*;
-import org.xwt.js.*;
-import org.xwt.util.*;
-import org.xwt.translators.*;
+import org.ibex.js.*;
+import org.ibex.util.*;
import org.bouncycastle.util.encoders.Base64;
-/** Singleton class that provides all functionality in the xwt.* namespace */
-public final class XWT extends JS.Cloneable {
+/** Singleton class that provides all functionality in the ibex.* namespace */
+public final class Ibex extends JS.Cloneable {
// FIXME remove this
private final JS rr;
- public XWT(Stream rr) { this.rr = bless(rr); }
+ public Ibex(Stream rr) { this.rr = bless(rr); }
public JS resolveString(String str, boolean permitAbsolute) throws JSExn {
if (str.indexOf("://") != -1) {
private class Sub extends JS {
String key;
Sub(String key) { this.key = key; }
- public void put(Object key, Object val) throws JSExn { XWT.this.put(this.key + "." + key, val); }
- public Object get(Object key) throws JSExn { return XWT.this.get(this.key + "." + key); }
+ public void put(Object key, Object val) throws JSExn { Ibex.this.put(this.key + "." + key, val); }
+ public Object get(Object key) throws JSExn { return Ibex.this.get(this.key + "." + key); }
public Object call(Object a0, Object a1, Object a2, Object[] rest, int nargs) throws JSExn {
- return XWT.this.callMethod(this.key, a0, a1, a2, rest, nargs);
+ return Ibex.this.callMethod(this.key, a0, a1, a2, rest, nargs);
}
public Object callMethod(Object method, Object a0, Object a1, Object a2, Object[] rest, int nargs) throws JSExn {
- return XWT.this.callMethod(this.key + "." + method, a0, a1, a2, rest, nargs);
+ return Ibex.this.callMethod(this.key + "." + method, a0, a1, a2, rest, nargs);
}
}
private Cache subCache = new Cache(20);
public Object get(Object name) throws JSExn {
if (name instanceof String && ((String)name).length() == 0) return rr;
//#switch(name)
- case "math": return xwtMath;
- case "string": return xwtString;
+ case "math": return ibexMath;
+ case "string": return ibexString;
case "date": return METHOD;
case "box": return new Box();
case "clone": return METHOD;
HTTP.Proxy.Authorization.waitingForUser.release();
return;
//#end
- throw new JSExn("attempted to put unknown property: xwt."+name);
+ throw new JSExn("attempted to put unknown property: ibex."+name);
}
public Object callMethod(Object name, Object a, Object b, Object c, Object[] rest, int nargs) throws JSExn {
}
} catch (RuntimeException e) {
// FIXME: maybe JSExn should take a second argument, Exception
- Log.warn(this, "xwt."+name+"() threw: " + e);
- throw new JSExn("invalid argument for xwt object method "+name+"()");
+ Log.warn(this, "ibex."+name+"() threw: " + e);
+ throw new JSExn("invalid argument for ibex object method "+name+"()");
}
- throw new JSExn("invalid number of arguments for xwt object method "+name+"()");
+ throw new JSExn("invalid number of arguments for ibex object method "+name+"()");
}
public Stream url2res(String url) throws JSExn {
}
}
- public static final JSMath xwtMath = new JSMath() {
+ public static final JSMath ibexMath = new JSMath() {
private JS gs = new JSScope.Global();
public Object get(Object key) throws JSExn {
//#switch(key)
}
};
- public static final JS xwtString = new JS() {
+ public static final JS ibexString = new JS() {
private JS gs = new JSScope.Global();
public void put(Object key, Object val) { }
public Object get(Object key) throws JSExn {
}
// FEATURE: move this into builtin.xwar
- public Blessing bless(JS b) { return new XWT.Blessing((JS.Cloneable)b, this, null, null); }
+ public Blessing bless(JS b) { return new Ibex.Blessing((JS.Cloneable)b, this, null, null); }
public static class Blessing extends JS.Clone {
- private XWT xwt;
+ private Ibex ibex;
private Template t = null;
private Object parentkey = null;
private Blessing parent = null;
- public Blessing(JS.Cloneable clonee, XWT xwt, Blessing parent, Object parentkey) {
- super(clonee); this.xwt = xwt; this.parentkey = parentkey; this.parent = parent; }
+ public Blessing(JS.Cloneable clonee, Ibex ibex, Blessing parent, Object parentkey) {
+ super(clonee); this.ibex = ibex; this.parentkey = parentkey; this.parent = parent; }
public Object get(Object key) throws JSExn {
- return key.equals("") ? ((Object)getStatic()) : (new Blessing((JS.Cloneable)clonee.get(key), xwt, this, key));
+ return key.equals("") ? ((Object)getStatic()) : (new Blessing((JS.Cloneable)clonee.get(key), ibex, this, key));
}
public static Blessing getBlessing(Object o) {
if (!(o instanceof JS)) return null;
public JSScope getStatic() {
try {
// FIXME background?
- if (t == null) t = Template.buildTemplate(Stream.getInputStream(parent.get(parentkey + ".xwt")), xwt);
+ if (t == null) t = Template.buildTemplate(Stream.getInputStream(parent.get(parentkey + ".ixt")), ibex);
return t.staticScope;
} catch (Exception e) {
Log.error(this, e);