Revision: 3694
          http://vexi.svn.sourceforge.net/vexi/?rev=3694&view=rev
Author:   mkpg2
Date:     2009-09-28 13:31:51 +0000 (Mon, 28 Sep 2009)

Log Message:
-----------
Small refactoring.

Modified Paths:
--------------
    trunk/core/buildcore/build.conf.txt
    trunk/core/org.ibex.js/src/org/ibex/js/Interpreter.jpp
    trunk/core/org.ibex.js/src/org/ibex/js/JS.jpp
    trunk/core/org.ibex.js/src/org/ibex/js/JSArray.jpp
    trunk/core/org.ibex.js/src/org/ibex/js/JSArrayLike.java
    trunk/core/org.ibex.js/src/org/ibex/js/JSPojoWrapper.java
    trunk/core/org.ibex.js/src/org/ibex/js/JSU.jpp
    trunk/core/org.vexi.core/src/org/vexi/core/Box.jpp
    trunk/core/org.vexi.core/src/org/vexi/core/Vexi.jpp

Modified: trunk/core/buildcore/build.conf.txt
===================================================================
--- trunk/core/buildcore/build.conf.txt 2009-09-23 15:54:13 UTC (rev 3693)
+++ trunk/core/buildcore/build.conf.txt 2009-09-28 13:31:51 UTC (rev 3694)
@@ -19,4 +19,8 @@
 
 
 ### Compile in debug information
-debug=yes
\ No newline at end of file
+debug=yes
+
+### Location of the vexi signing directory (usually secret.vexi unless
+### you are a different organisiation)
+secret.dir=secret.xxx

Modified: trunk/core/org.ibex.js/src/org/ibex/js/Interpreter.jpp
===================================================================
--- trunk/core/org.ibex.js/src/org/ibex/js/Interpreter.jpp      2009-09-23 
15:54:13 UTC (rev 3693)
+++ trunk/core/org.ibex.js/src/org/ibex/js/Interpreter.jpp      2009-09-28 
13:31:51 UTC (rev 3694)
@@ -812,7 +812,7 @@
         }
         public JS.Keys keys() throws JSExn { return new 
JSArrayLike.Keys(this);}
                public JS[] toArray() { return args;}
-               public int length(){ return args.length; }
+               public int size(){ return args.length; }
     }
 
     static class TrapArgs extends JS.Immutable {

Modified: trunk/core/org.ibex.js/src/org/ibex/js/JS.jpp
===================================================================
--- trunk/core/org.ibex.js/src/org/ibex/js/JS.jpp       2009-09-23 15:54:13 UTC 
(rev 3693)
+++ trunk/core/org.ibex.js/src/org/ibex/js/JS.jpp       2009-09-28 13:31:51 UTC 
(rev 3694)
@@ -957,7 +957,7 @@
         }
 
         public JS getElement(int i) throws JSExn { return get(JSU.N(i)); }
-        public int length() throws JSExn { return bt.treeSize(); }
+        public int size() throws JSExn { return bt.treeSize(); }
 
         public JS[] toArray() throws JSExn { throw new JSExn("Cannot convert 
proxylist to an array"); }
         public JS.Keys keys() throws JSExn { return new 
JSArrayLike.Keys(this); }

Modified: trunk/core/org.ibex.js/src/org/ibex/js/JSArray.jpp
===================================================================
--- trunk/core/org.ibex.js/src/org/ibex/js/JSArray.jpp  2009-09-23 15:54:13 UTC 
(rev 3693)
+++ trunk/core/org.ibex.js/src/org/ibex/js/JSArray.jpp  2009-09-28 13:31:51 UTC 
(rev 3694)
@@ -194,6 +194,7 @@
     public JS new_(JS[] args) throws JSExn { throw new JSExn(type() +" is not 
a constructor"); }
     public JS apply(JS target, JS[] args) throws JSExn { throw new 
JSExn("Cannot call a " + type()); }
     public JS callMethod(JS this_, JS method, JS[] args) throws JSExn {
+       JSArrayLike thisArr = (JSArrayLike)this_;
         //#switch(JSU.toString(method))
        case "concat": return concat(args);
                case "copy": return copy();
@@ -234,7 +235,7 @@
     }
 
     private void concat_fill(JSArrayLike arr) throws JSExn {           
-               for (int i=0; i<arr.length(); i++) {
+               for (int i=0; i<arr.size(); i++) {
                        add(arr.getElement(i));
                }
     }
@@ -264,7 +265,7 @@
                    throw new JSExn("Arg "+i+" not an []");
                }
                JSArrayLike a = ((JSArrayLike)args[i]);
-               l += a.length();
+               l += a.size();
        }
        JSArray r = new JSArray(l);
        r.concat_fill(this);
@@ -362,7 +363,6 @@
     }
     
     public JS getElement(int i) throws JSExn { return (JS) get(i); }
-    public int length() { return size(); }
     public JS[] toArray() {
        JS[] r = new JS[size()];
        for (int i=0; i<size(); i++) {

Modified: trunk/core/org.ibex.js/src/org/ibex/js/JSArrayLike.java
===================================================================
--- trunk/core/org.ibex.js/src/org/ibex/js/JSArrayLike.java     2009-09-23 
15:54:13 UTC (rev 3693)
+++ trunk/core/org.ibex.js/src/org/ibex/js/JSArrayLike.java     2009-09-28 
13:31:51 UTC (rev 3694)
@@ -3,7 +3,7 @@
 public interface JSArrayLike extends JS {
        public JS[] toArray() throws JSExn;
        public JS getElement(int i) throws JSExn;
-       public int length() throws JSExn;
+       public int size() throws JSExn;
     static public class Keys extends JS.Keys {
        JSArrayLike keysof;
        public Keys(JSArrayLike obj) {
@@ -11,15 +11,15 @@
                this.keysof = obj;
        }
                public boolean hasKey(JS key) throws JSExn {
-                       return JSU.isInt(key) && (JSU.toInt(key)< 
keysof.length());
+                       return JSU.isInt(key) && (JSU.toInt(key)< 
keysof.size());
                }
                public Enumeration iterator() throws JSExn {
                        return new Enumeration(null) {
                        private int n = 0;
-                       public boolean _hasNext() throws JSExn { return n < 
keysof.length(); }
+                       public boolean _hasNext() throws JSExn { return n < 
keysof.size(); }
                        public JS _next() { return JSU.N(n++); }
                    };
                }
-               public int size() throws JSExn { return keysof.length(); }
+               public int size() throws JSExn { return keysof.size(); }
     }
 }

Modified: trunk/core/org.ibex.js/src/org/ibex/js/JSPojoWrapper.java
===================================================================
--- trunk/core/org.ibex.js/src/org/ibex/js/JSPojoWrapper.java   2009-09-23 
15:54:13 UTC (rev 3693)
+++ trunk/core/org.ibex.js/src/org/ibex/js/JSPojoWrapper.java   2009-09-28 
13:31:51 UTC (rev 3694)
@@ -112,7 +112,7 @@
         
         if(js instanceof JSArray){
             JSArray js_ = (JSArray)js;
-            Object[] r = new Object[js_.length()];
+            Object[] r = new Object[js_.size()];
             for(int i=0; i<r.length; i++){
                 r[i] = jsToDynamic(js_.get(JSU.N(i)));
             }

Modified: trunk/core/org.ibex.js/src/org/ibex/js/JSU.jpp
===================================================================
--- trunk/core/org.ibex.js/src/org/ibex/js/JSU.jpp      2009-09-23 15:54:13 UTC 
(rev 3693)
+++ trunk/core/org.ibex.js/src/org/ibex/js/JSU.jpp      2009-09-28 13:31:51 UTC 
(rev 3694)
@@ -242,6 +242,25 @@
         }
     }
     
+    /** lets us put multi-level get/put/call keys all in the same method */
+    static public class Sub extends JS.Obj {
+        final JS main;
+        final JS key;
+        public Sub(JS main, JS key) { 
+               this.main = main;
+               this.key = key; 
+        }
+        public void put(JS key, JS val) throws JSExn {
+               main.put(JSU.S(JSU.toString(this.key) + "." + 
JSU.toString(key)), val);
+        }
+        public JS get(JS key) throws JSExn {
+            return main.get(JSU.S(JSU.toString(this.key) + "." + 
JSU.toString(key)));
+        }
+        public JS callMethod(JS this_, JS method, JS[] args) throws JSExn {
+            return main.callMethod(this_, JSU.S(JSU.toString(this.key) + "." + 
JSU.toString(method)), args);
+        }
+    }
+    
 
     
     ///////

Modified: trunk/core/org.vexi.core/src/org/vexi/core/Box.jpp
===================================================================
--- trunk/core/org.vexi.core/src/org/vexi/core/Box.jpp  2009-09-23 15:54:13 UTC 
(rev 3693)
+++ trunk/core/org.vexi.core/src/org/vexi/core/Box.jpp  2009-09-28 13:31:51 UTC 
(rev 3694)
@@ -3141,5 +3141,5 @@
     // JSArrayLike
     public JS getElement(int i) throws JSExn { return get(i); }
     public JS[] toArray() throws JSExn { throw new JSExn("Cannot convert box 
to an array"); }
-    public int length() throws JSExn { return 
JSU.toInt(getAndTriggerTraps(SC_numchildren)); }
+    public int size() throws JSExn { return 
JSU.toInt(getAndTriggerTraps(SC_numchildren)); }
 }

Modified: trunk/core/org.vexi.core/src/org/vexi/core/Vexi.jpp
===================================================================
--- trunk/core/org.vexi.core/src/org/vexi/core/Vexi.jpp 2009-09-23 15:54:13 UTC 
(rev 3693)
+++ trunk/core/org.vexi.core/src/org/vexi/core/Vexi.jpp 2009-09-28 13:31:51 UTC 
(rev 3694)
@@ -6,6 +6,7 @@
 
 import org.ibex.crypto.MD5;
 import org.ibex.js.*;
+import org.ibex.js.JSU.*;
 import org.vexi.js.*;
 import org.ibex.util.Cache;
 import org.ibex.util.Callable;
@@ -249,27 +250,13 @@
         }
         return ret;
     }
-
-    /** lets us put multi-level get/put/call keys all in the same method */
-    private class Sub extends JS.Obj {
-        JS key;
-        Sub(JS key) { this.key = key; }
-        public void put(JS key, JS val) throws JSExn {
-            Vexi.this.put(JSU.S(JSU.toString(this.key) + "." + 
JSU.toString(key)), val);
-        }
-        public JS get(JS key) throws JSExn {
-            return Vexi.this.get(JSU.S(JSU.toString(this.key) + "." + 
JSU.toString(key)));
-        }
-        public JS callMethod(JS this_, JS method, JS[] args) throws JSExn {
-            return Vexi.this.callMethod(this_, JSU.S(JSU.toString(this.key) + 
"." + JSU.toString(method)), args);
-        }
-    }
     
     private Cache subCache = new Cache(20);
     private Sub getSub(JS key) {
+       // DUBIOUS unnecessary caching?
         Sub ret = (Sub)subCache.get(key);
         if (ret == null) {
-            subCache.put(key, ret = new Sub(key));
+            subCache.put(key, ret = new Sub(this, key));
         }
         return ret;
     }


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
Come build with us! The BlackBerry&reg; Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9&#45;12, 2009. Register now&#33;
http://p.sf.net/sfu/devconf
_______________________________________________
Vexi-svn mailing list
Vexi-svn@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/vexi-svn

Reply via email to