Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Sven Gestegård Robertz
LabComm
Commits
dd7bfe04
Commit
dd7bfe04
authored
Apr 25, 2013
by
Sven Robertz
Browse files
fixed java gen for var size arrays
parent
f086893e
Changes
2
Hide whitespace changes
Inline
Side-by-side
compiler/Java_CodeGen.jrag
View file @
dd7bfe04
...
...
@@ -485,7 +485,7 @@ aspect Java_Class {
}
public String VariableSize.Java_emitEncoder(Java_env env, String name) {
env.println("e.encode
Int
(" + name + ".length);");
env.println("e.encode
Packed32
(" + name + ".length);");
return name + ".length";
}
...
...
examples/simple/Encoder.java
View file @
dd7bfe04
...
...
@@ -18,6 +18,7 @@ public class Encoder
encoder
=
new
LabCommEncoderChannel
(
out
);
theTwoInts
.
register
(
encoder
);
IntString
.
register
(
encoder
);
TwoArrays
.
register
(
encoder
);
}
public
void
doEncode
()
throws
java
.
io
.
IOException
{
...
...
@@ -29,11 +30,24 @@ public class Encoder
y
.
x
=
37
;
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
);
theTwoInts
.
encode
(
encoder
,
x
);
System
.
out
.
println
(
"Encoding IntString, x="
+
y
.
x
+
", s="
+
y
.
s
);
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
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment