2003/11/17 01:53:24
authormegacz <megacz@xwt.org>
Fri, 30 Jan 2004 07:41:35 +0000 (07:41 +0000)
committermegacz <megacz@xwt.org>
Fri, 30 Jan 2004 07:41:35 +0000 (07:41 +0000)
darcs-hash:20040130074135-2ba56-71de282f4c168d50aaf140eaa022ab49800ec815.gz

Makefile
Makefile.upstream
src/org/xwt/Box.java
src/org/xwt/HTTP.java

index ea56dea..83efe78 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -46,12 +46,12 @@ jar                    := $(shell ((type fastjar &>/dev/null) && echo fastjar) |
 include Makefile.upstream
 
 # figure out what stuff in org.xwt.plat.* this platform requires (its superclasses)
-all_java_sources  := $(filter-out build/java/org/xwt/mips/%, $(patsubst src/%.java,     build/java/%.java, $(shell find src -name '*.java')))
-all_java_sources  += build/java/org/xwt/translators/FreetypeVM.java
+java_sources      := $(patsubst src/%.java,     build/java/%.java, $(shell find src -name '*.java' \! -path 'src/org/xwt/mips/*'))
+java_sources      += build/java/org/xwt/translators/FreetypeVM.java
+all_java_sources  := $(java_sources)
 
-java_sources      := $(all_java_sources)
-nonplat_java_sources      := $(filter-out build/java/org/xwt/plat/%, $(all_java_sources))
-plat_java_sources      := $(filter build/java/org/xwt/plat/%, $(all_java_sources))
+nonplat_java_sources      := $(filter-out build/java/org/xwt/plat/%, $(java_sources))
+plat_java_sources         := $(filter build/java/org/xwt/plat/%, $(java_sources))
 
 build/java/org/xwt/translators/FreetypeVM.java: build/res/freetype.mips build/class/org/xwt/mips/Compiler.class
        mkdir -p build/java/org/xwt/translators
@@ -76,20 +76,20 @@ build/class/org/xwt/util/Preprocessor.class: src/org/xwt/util/Preprocessor.java
        mkdir -p build/class/org/xwt/util/
        ./.jikes $<
 
-build/class/org/xwt/mips/Compiler.class: src/org/xwt/mips/*.* .jikes
+build/class/org/xwt/mips/Compiler.class: src/org/xwt/mips/*.java
+       make .jikes
        @echo -e "\n\033[1mcompiling          .java -> .class: $<\033[0m"
        mkdir -p build/class/org/xwt/mips/
        ./.jikes $<
 
-
 # this forces a clean build every time because jikes is so damn buggy
-preprocess: $(all_java_sources)
+preprocess: $(java_sources)
 compile: .compile
-.compile: $(all_java_sources) .jikes
+.compile: $(java_sources) .jikes 
        @echo -e "\n\033[1mcompiling          .java -> .class: src/**/*.java\033[0m"
-       rm -rf build/class
+       @rm -f $(java_sources:build/java/%.java=build/class/%.class)
        mkdir -p build/class
-       @./.jikes $(all_java_sources)
+       @./.jikes $(java_sources)
        touch .compile
 
 # PHASE 4: gcj-generated headers
@@ -337,4 +337,4 @@ dist-private:
 test: JVM; /System/Library/Frameworks/JavaVM.framework/Versions/1.3.1/Commands/java -jar build/JVM/xwt.jar http://localhost/demo.xwar
 #test: JVM; java -jar build/JVM/xwt.jar http://localhost/demo.xwar
 
-oldcompile: preprocess; CLASSPATH=$$CLASSPATH:lib/libgcj-minimal.jar javac -d build/class `find build/java/ -name \*.java`
+oldcompile: preprocess; CLASSPATH=$$CLASSPATH:lib/libgcj-minimal.jar javac -d build/class `find build/java/ src/org/xwt/mips -name \*.java`
index 2434fa7..331065e 100644 (file)
@@ -167,7 +167,7 @@ endif
 .jikes:
        @echo -e "\n\033[1mdetecting your jikes installation...\033[0m"
        echo "#!/bin/sh" > .jikes
-       echo 'for A in `find build/class -name \*.class`; do mv $$A $$A.old; done;' >> .jikes
+       #echo 'for A in `find build/class -name \*.class`; do mv $$A $$A.old; done;' >> .jikes
        echo -n 'PATH=upstream/install/bin:$$PATH jikes -classpath lib/libgcj-minimal.jar $$@ -d build/class/ -sourcepath build/java/ ' >> .jikes
        (type jikes && (jikes --version | grep "Version 1.18")) || make .install_jikes-1.18_ target=
        echo -n "$(jikes_flags) -bootclasspath " >> .jikes
@@ -177,8 +177,8 @@ endif
        java -cp . GetBootClassPath >> .jikes
        rm GetBootClassPath.*
        echo 'EXIT=$$?' >> .jikes
-       echo 'for A in `find build/class -name \*.class`; do test -e $$A.old && cmp -s $$A $$A.old && mv $$A.old $$A; done' >> .jikes
-       echo 'for A in `find build/class -name \*.class`; do test -e $$A.old && rm $$A.old; done' >> .jikes
+       #echo 'for A in `find build/class -name \*.class`; do test -e $$A.old && cmp -s $$A $$A.old && mv $$A.old $$A; done' >> .jikes
+       #echo 'for A in `find build/class -name \*.class`; do test -e $$A.old && rm $$A.old; done' >> .jikes
        echo 'exit $$EXIT' >> .jikes
        mv .jikes .jikes+
        cp .jikes+ .jikes
index 864d332..8e51542 100644 (file)
@@ -355,13 +355,18 @@ public abstract class Box extends JSScope implements JSTrap.JSTrappable {
     public int localToGlobalX(int x) { return parent == null ? x : parent.globalToLocalX(x + this.x); }
     public int localToGlobalY(int y) { return parent == null ? y : parent.globalToLocalY(y + this.y); }
     
-    public Object call(Object method, JSArray args) throws JS.Exn {
-        if (!"indexof".equals(method)) return null;
-        Box b = (Box)args.elementAt(0);
-        if (b.parent != this) return (redirect == null || redirect == this) ? N(-1) : redirect.call(method, args);
+    public Object callMethod(Object method, Object a0, Object a1, Object a2, Object[] rest, int nargs) throws JS.Exn {
+        if (nargs != 1 || !"indexof".equals(method)) return super.callMethod(method, a0, a1, a2, rest, nargs);
+        Box b = (Box)a0;
+        if (b.parent != this)
+            return (redirect == null || redirect == this) ?
+                N(-1) :
+                redirect.callMethod(method, a0, a1, a2, rest, nargs);
         return N(b.getIndexInParent());
     }
 
+    public Enumeration keys() { throw new Error("you cannot apply for..in to a " + this.getClass().getName()); }
+
     /** to be filled in by the Tree implementation */
     abstract void put(int i, Object value);
     public int numchildren = 0;
@@ -378,6 +383,7 @@ public abstract class Box extends JSScope implements JSTrap.JSTrappable {
             return redirect == null ? null : redirect == this ? getChild(toInt(name)) : redirect.get(name);
 
         //#switch(name)
+        case "indexof": return METHOD;
         case "text": return text;
         case "path": throw new JS.Exn("cannot read from the path property");
         case "fill": return colorToString(fillcolor);
index f3ff183..4853a13 100644 (file)
@@ -288,9 +288,7 @@ public class HTTP {
         String pac = null;
         try {
             org.xwt.js.JSArray args = new org.xwt.js.JSArray();
-            args.addElement(url.toString());
-            args.addElement(url.getHost());
-            Object obj = pacFunc.call(null, args);
+            Object obj = pacFunc.call(url.toString(), url.getHost(), null, null, 2);
             if (Log.verbose) Log.log(this, "  PAC script returned \"" + obj + "\"");
             pac = obj.toString();
         } catch (Throwable e) {
@@ -786,7 +784,7 @@ public class HTTP {
                 }
 
                 JSFunction scr = JS.parse("PAC script at " + url, 0, new StringReader(script));
-                scr.cloneWithNewParentJSScope(proxyAutoConfigRootJSScope).call(null, new JSArray());
+                scr.cloneWithNewParentJSScope(proxyAutoConfigRootJSScope).call(null, null, null, null, 0);
                 return (JSCallable)proxyAutoConfigRootJSScope.get("FindProxyForURL");
             } catch (Exception e) {
                 if (Log.on) {
@@ -863,8 +861,8 @@ public class HTTP {
                 else return super.get(name);
             }
         
-            private static final JSObj proxyConfigBindings = new JSObj();
-            private static final JSObj ProxyConfig = new JSObj() {
+            private static final JS proxyConfigBindings = new JS();
+            private static final JS ProxyConfig = new JS() {
                     public Object get(Object name) {
                         if (name.equals("bindings")) return proxyConfigBindings;
                         return null;