Skip to content
Snippets Groups Projects
Commit dd7bfe04 authored by Sven Robertz's avatar Sven Robertz
Browse files

fixed java gen for var size arrays

parent f086893e
No related branches found
No related tags found
No related merge requests found
...@@ -485,7 +485,7 @@ aspect Java_Class { ...@@ -485,7 +485,7 @@ aspect Java_Class {
} }
public String VariableSize.Java_emitEncoder(Java_env env, String name) { public String VariableSize.Java_emitEncoder(Java_env env, String name) {
env.println("e.encodeInt(" + name + ".length);"); env.println("e.encodePacked32(" + name + ".length);");
return name + ".length"; return name + ".length";
} }
......
...@@ -18,6 +18,7 @@ public class Encoder ...@@ -18,6 +18,7 @@ public class Encoder
encoder = new LabCommEncoderChannel(out); encoder = new LabCommEncoderChannel(out);
theTwoInts.register(encoder); theTwoInts.register(encoder);
IntString.register(encoder); IntString.register(encoder);
TwoArrays.register(encoder);
} }
public void doEncode() throws java.io.IOException { public void doEncode() throws java.io.IOException {
...@@ -29,11 +30,24 @@ public class Encoder ...@@ -29,11 +30,24 @@ public class Encoder
y.x = 37; y.x = 37;
y.s = "Testing, testing"; y.s = "Testing, testing";
TwoArrays ta = new TwoArrays();
ta.fixed = new int[] {14, 25};
// ta.variable = new int[][] {{1,2},{0x11,0x12},{0x21,0x22},{0x31,0x32}};
ta.variable = new int[][] {{1,2, 3, 4},{0x21,0x22,0x23,0x24}};
System.out.println("Encoding theTwoInts, a="+x.a+", b="+x.b); System.out.println("Encoding theTwoInts, a="+x.a+", b="+x.b);
theTwoInts.encode(encoder, x); theTwoInts.encode(encoder, x);
System.out.println("Encoding IntString, x="+y.x+", s="+y.s); System.out.println("Encoding IntString, x="+y.x+", s="+y.s);
IntString.encode(encoder, y); IntString.encode(encoder, y);
System.out.println("Encoding TwoArrays");
for(int i = 0; i < ta.variable.length; i++) {
for(int j=0; j < ta.variable[0].length; j++)
System.out.println(ta.variable[i][j]);
System.out.println("---");
}
TwoArrays.encode(encoder, ta);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment