- } else if (args.length() == 3 && name.equals("soap")) {
- if (name.equals("soap")) {
- return new SOAP((String)args.elementAt(0), "", (String)args.elementAt(1), (String)args.elementAt(2));
- } else if (name.equals("graft")) {
- if (a instanceof Box) throw new JS.Exn("can't graft onto Boxes (yet)");
- if (a instanceof Number) throw new JS.Exn("can't graft onto Numbers (yet)");
- if (a instanceof String) throw new JS.Exn("can't graft onto Strings (yet)");
- if (a instanceof Res) return new Res.Graft((Res)a, b, c);
- return new JS.Graft((JS)a, b, c);
+
+ switch (nargs) {
+ case 0:
+ //#switch(name)
+ case "thread.yield": sleep(0); return null;
+ //#end
+ break;
+ case 1:
+ //#switch(name)
+ case "ui.browser": Platform.newBrowserWindow((String)a); return null;
+ case "clone": return new XWT((Stream)a);
+ case "stream.unzip": return new Stream.Zip((Stream)a);
+ case "stream.uncab": return new Stream.Cab((Stream)a);
+ case "stream.cache": try { return new Stream.CachedStream((Stream)a, "resources", true); }
+ catch (Stream.NotCacheableException e) { throw new JSExn("this resource cannot be cached"); }
+ case "stream.url": return url2res((String)a);
+ case "thread.sleep": sleep(JS.toInt(a)); return null;
+ case "log.debug": JS.log(this, a== null ? "**null**" : a.toString()); return null;
+ case "log.info": JS.log(this, a== null ? "**null**" : a.toString()); return null;
+ case "log.warn": JS.log(this, a== null ? "**null**" : a.toString()); return null;
+ case "log.error": JS.log(this, a== null ? "**null**" : a.toString()); return null;
+ case "regexp": return new JSRegexp(a, null);
+ case "rpc.xml": return new XMLRPC((String)a, "");
+ case "crypto.rsa": /* FEATURE */ return null;
+ case "crypto.md5": /* FEATURE */ return null;
+ case "crypto.sha1": /* FEATURE */ return null;
+ case "crypto.rc4": /* FEATURE */ return null;
+ case "stream.parse.html": /* FIXME */ return null;
+ case "stream.parse.xml": /* FIXME -- SAX NOT DOM!! */ return null;
+ case "stream.parse.utf8": /* FIXME */ return null;
+ //#end
+ break;
+ case 2:
+ //#switch(name)
+ case "stream.watch": return new Stream.ProgressWatcher((Stream)a, (JSFunction)b);
+ case "apply":
+ if (b instanceof Stream) Template.getTemplate((Stream)b).apply((Box)a, XWT.this);
+ else {
+ JS to = (JS)a, from = (JS)b; Object k;
+ for (Enumeration e = from.keys(); e.hasMoreElements();) {
+ k = e.nextElement(); to.put(k, from.get(k));
+ }
+ }
+ return a;
+ case "regexp": return new JSRegexp(a, b);
+ //#end
+ break;