Further improvements to the Java to ActionScript converter.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4499 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -278,6 +278,11 @@ public class ActionScriptSource
|
|||||||
return "int";
|
return "int";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Float.TYPE.equals(type) ||
|
||||||
|
Double.TYPE.equals(type)) {
|
||||||
|
return "Number";
|
||||||
|
}
|
||||||
|
|
||||||
if (Long.TYPE.equals(type)) {
|
if (Long.TYPE.equals(type)) {
|
||||||
return "Long";
|
return "Long";
|
||||||
}
|
}
|
||||||
@@ -649,6 +654,7 @@ public class ActionScriptSource
|
|||||||
Member curmem = null;
|
Member curmem = null;
|
||||||
while ((line = bin.readLine()) != null) {
|
while ((line = bin.readLine()) != null) {
|
||||||
line = line.replaceAll("\\s+$", "");
|
line = line.replaceAll("\\s+$", "");
|
||||||
|
// System.err.println(" " + mode + " : " + line);
|
||||||
switch (mode) {
|
switch (mode) {
|
||||||
case PREAMBLE:
|
case PREAMBLE:
|
||||||
// look for the package declaration
|
// look for the package declaration
|
||||||
@@ -667,6 +673,10 @@ public class ActionScriptSource
|
|||||||
imports = accum.toString();
|
imports = accum.toString();
|
||||||
accum.setLength(0);
|
accum.setLength(0);
|
||||||
mode = Mode.CLASSCOMMENT;
|
mode = Mode.CLASSCOMMENT;
|
||||||
|
} else if (line.startsWith("public ")) {
|
||||||
|
imports = accum.toString();
|
||||||
|
accum.setLength(0);
|
||||||
|
mode = line.endsWith("{") ? Mode.CLASSBODY : Mode.CLASSDECL;
|
||||||
}
|
}
|
||||||
accum.append(line).append("\n");
|
accum.append(line).append("\n");
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -295,6 +295,12 @@ public class GenActionScriptTask extends Task
|
|||||||
} else if (type.equals(Long.TYPE)) {
|
} else if (type.equals(Long.TYPE)) {
|
||||||
return "new Long(ins.readInt(), ins.readInt())";
|
return "new Long(ins.readInt(), ins.readInt())";
|
||||||
|
|
||||||
|
} else if (type.equals(Float.TYPE)) {
|
||||||
|
return "ins.readFloat()";
|
||||||
|
|
||||||
|
} else if (type.equals(Double.TYPE)) {
|
||||||
|
return "ins.readDouble()";
|
||||||
|
|
||||||
} else if (type.isArray()) {
|
} else if (type.isArray()) {
|
||||||
if (Byte.TYPE.equals(type.getComponentType())) {
|
if (Byte.TYPE.equals(type.getComponentType())) {
|
||||||
return "(ins.readObject() as ByteArray)";
|
return "(ins.readObject() as ByteArray)";
|
||||||
@@ -331,6 +337,12 @@ public class GenActionScriptTask extends Task
|
|||||||
" out.writeInt(" +
|
" out.writeInt(" +
|
||||||
name + " == null ? 0 : " + name + ".high)";
|
name + " == null ? 0 : " + name + ".high)";
|
||||||
|
|
||||||
|
} else if (type.equals("float")) {
|
||||||
|
return "writeFloat(" + name + ")";
|
||||||
|
|
||||||
|
} else if (type.equals("double")) {
|
||||||
|
return "writeDouble(" + name + ")";
|
||||||
|
|
||||||
} else if (type.equals("java.lang.String")) {
|
} else if (type.equals("java.lang.String")) {
|
||||||
return "writeField(" + name + ")";
|
return "writeField(" + name + ")";
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user