diff --git a/src/class.js b/src/class.js
index 9154393..9d1d344 100644
--- a/src/class.js
+++ b/src/class.js
@@ -267,6 +267,10 @@ ClassDefinition.prototype.calculateEffectiveMembers = function(){
return [this.effectiveFields,this.effectiveMethods];
}
+function instanceToString(){
+ return "<" + this["class"].className + ">";
+}
+
ClassDefinition.prototype.makeInstance = function(){
if (!this.inited) { this.initializeClass(); }
var newInstance = {};
@@ -276,6 +280,7 @@ ClassDefinition.prototype.makeInstance = function(){
}
}
newInstance["class"] = this;
+ newInstance["toString"] = instanceToString;
return newInstance;
}
diff --git a/src/constantPool.js b/src/constantPool.js
index 396dcf8..d3e7668 100644
--- a/src/constantPool.js
+++ b/src/constantPool.js
@@ -72,7 +72,9 @@ var constLong = function(){
this.low = null;
this.id = CONSTANT_Long;
this.read = function (dStream){
- this.value = dStream.getInt64();
+ var high = dStream.getU4();
+ var low = dStream.getU4();
+ this.value = math.Long.fromBits(low,high)
}
};
@@ -124,6 +126,7 @@ var constClass = function(){
throw "Class name index doesn't point to Utf8 in the Constant Pool";
}
this.name_ref = ref;
+ this.jvmClassName = canonicalName(this.name_ref);
}
};
diff --git a/src/cpu.js b/src/cpu.js
index ea9ae92..7313783 100644
--- a/src/cpu.js
+++ b/src/cpu.js
@@ -22,6 +22,28 @@ var JVM = function(params,args){
this.method_area = {};
this.level = 0;
this.classpath = params.classes_to_load;
+ for (var i=0; i/g, '>').replace(/"/g, '"');
+}
+
#define LOG(msg) write(msg);\
if (console){\
console.log(msg);\
diff --git a/src/nativeArrays.js b/src/nativeArrays.js
new file mode 100644
index 0000000..87dafe4
--- /dev/null
+++ b/src/nativeArrays.js
@@ -0,0 +1,52 @@
+/* -*- Mode: Javascript -*-
+ * -*- coding: UTF-8 -*-
+ * Copyright (C) 2011 by Artur Ventura
+ *
+ * File: nativeArray.js
+ * Time-stamp: Fri Jul 15 02:46:27 2011
+ *
+ * Author: Artur Ventura
+ *
+ */
+
+#include "cpu.jsh"
+
+function printNativeArray(){
+ var result = "[";
+ if(this.primitive){
+ switch(this['class']){
+ case T_BOOLEAN:
+ result += "Z";
+ break;
+ case T_BYTE:
+ result += "B";
+ break;
+ case T_CHAR:
+ result += "C";
+ break;
+ case T_DOUBLE:
+ result += "D";
+ break;
+ case T_FLOAT:
+ result += "F";
+ break
+ case T_INT:
+ result += "I";
+ break
+ case T_LONG:
+ result += "J";
+ break
+ case T_SHORT:
+ result += "B";
+ break
+ }
+ }else{
+ result+="L" + this['class'].className + ";";
+ }
+ return result + "#" + this.length;
+}
+
+function make1DNativeArray(count,primitive,type){
+ var inst = {toString: printNativeArray,length:count, dimensions:1, value:[], primitive:primitive, 'class':type};
+ return inst;
+}
\ No newline at end of file
diff --git a/webserver/index.html b/webserver/index.html
index 89e6f20..40c261d 100644
--- a/webserver/index.html
+++ b/webserver/index.html
@@ -4,7 +4,20 @@