From: brian Date: Sat, 3 Jul 2004 17:22:04 +0000 (+0000) Subject: move JS's Hashtable to JS.O X-Git-Url: http://git.megacz.com/?p=org.ibex.core.git;a=commitdiff_plain;h=fffcafc33aa4066bdf85da7a32e1a1cdb9db2d6f;hp=592fa04faf2d7c5bbf5fceae5a81da13f4791261 move JS's Hashtable to JS.O darcs-hash:20040703172204-24bed-f5fa869bb332cc32377a1abdba413b6e4a29c254.gz --- diff --git a/src/org/ibex/core/Box.java b/src/org/ibex/core/Box.java index e39e201..bb8a27b 100644 --- a/src/org/ibex/core/Box.java +++ b/src/org/ibex/core/Box.java @@ -232,7 +232,7 @@ public final class Box extends JSScope implements Task { void resize(int x, int y, int width, int height) { if (x == this.x && y == this.y && width == this.width && height == this.height) return; - boolean sizechange = (this.width != width || this.height != height) && getTrap("SizeChange") != null; + boolean sizechange = (this.width != width || this.height != height) && hasTrap("SizeChange"); int thisx = parent == null ? 0 : this.x; int thisy = parent == null ? 0 : this.y; Box who = (parent == null ? this : parent); @@ -448,7 +448,7 @@ public final class Box extends JSScope implements Task { case "distanceto": Box b = (Box)a0; - JS ret = new JS(); + JS ret = new JS.O(); ret.put("x", N(b.localToGlobalX(0) - localToGlobalX(0))); ret.put("y", N(b.localToGlobalY(0) - localToGlobalY(0))); return ret; diff --git a/src/org/ibex/core/Ibex.java b/src/org/ibex/core/Ibex.java index 7b5f8b5..b44ba5a 100644 --- a/src/org/ibex/core/Ibex.java +++ b/src/org/ibex/core/Ibex.java @@ -307,7 +307,7 @@ public final class Ibex extends JS implements JS.Cloneable { } public void startElement(XML.Element c) throws XML.Exn { try { - JS attrs = new JS(); + JS attrs = new JS.O(); // FIXME attribute URIs? add an additional hash? for(int i=0; i 1) throw new JSExn("traps must take either one argument (write) or no arguments (read)"); boolean isRead = f.numFormalArgs == 0; - if (!isTrappable(name, isRead)) throw new JSExn("not allowed "+(isRead?"read":"write")+" trap on property: "+name); for(Trap t = getTrap(name); t != null; t = t.next) if (t.f == f) return; putTrap(name, new Trap(this, name.toString(), f, (Trap)getTrap(name))); } /** deletes a trap, if present */ - protected final void delTrap(Object name, JSFunction f) { + protected final void delTrap(Object name, JSFunction f) throws JSExn { Trap t = (Trap)getTrap(name); if (t == null) return; if (t.f == f) { putTrap(t.name, t.next); return; } diff --git a/src/org/ibex/js/JSArray.java b/src/org/ibex/js/JSArray.java index 7b90de7..168bab3 100644 --- a/src/org/ibex/js/JSArray.java +++ b/src/org/ibex/js/JSArray.java @@ -5,7 +5,7 @@ import org.ibex.util.*; import java.util.*; /** A JavaScript JSArray */ -public class JSArray extends JS { +public class JSArray extends JS.BT { private static final Object NULL = new Object(); public JSArray() { } diff --git a/src/org/ibex/js/JSRegexp.java b/src/org/ibex/js/JSRegexp.java index da22d2e..f203426 100644 --- a/src/org/ibex/js/JSRegexp.java +++ b/src/org/ibex/js/JSRegexp.java @@ -91,7 +91,7 @@ public class JSRegexp extends JS { private static Object matchToExecResult(REMatch match, RE re, String s) { try { - JS ret = new JS(); + JS ret = new JS.O(); ret.put("index", N(match.getStartIndex())); ret.put("input",s); int n = re.getNumSubs(); diff --git a/src/org/ibex/js/JSScope.java b/src/org/ibex/js/JSScope.java index e133f4c..663e24d 100644 --- a/src/org/ibex/js/JSScope.java +++ b/src/org/ibex/js/JSScope.java @@ -4,7 +4,8 @@ package org.ibex.js; // FIXME: should allow parentScope to be a JS, not a JSScope // FIXME: Index local vars by number and lookup in an array /** Implementation of a JavaScript Scope */ -public class JSScope extends JS { +// HACK = JSScope doesn't really need the BT, this is just for Box.java +public class JSScope extends JS.BT { private JSScope parentScope; diff --git a/src/org/ibex/net/HTTP.java b/src/org/ibex/net/HTTP.java index 211bb46..5f8a4ed 100644 --- a/src/org/ibex/net/HTTP.java +++ b/src/org/ibex/net/HTTP.java @@ -826,7 +826,7 @@ public class HTTP { return super.get(name); } - private static final JS proxyConfigBindings = new JS(); + private static final JS proxyConfigBindings = new JS.O(); private static final JS ProxyConfig = new JS() { public Object get(Object name) { if (name.equals("bindings")) return proxyConfigBindings; diff --git a/src/org/ibex/net/SOAP.java b/src/org/ibex/net/SOAP.java index 85670a3..55f18f5 100644 --- a/src/org/ibex/net/SOAP.java +++ b/src/org/ibex/net/SOAP.java @@ -41,7 +41,7 @@ public class SOAP extends XMLRPC { if (name.equals("SOAP-ENV:Fault")) fault = true; // add a generic struct; we'll change this if our type is different - objects.addElement(new JS()); + objects.addElement(new JS.O()); for(int i=0; i