Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
L
LabComm
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Sven Gestegård Robertz
LabComm
Commits
dd7bfe04
Commit
dd7bfe04
authored
11 years ago
by
Sven Robertz
Browse files
Options
Downloads
Patches
Plain Diff
fixed java gen for var size arrays
parent
f086893e
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
compiler/Java_CodeGen.jrag
+1
-1
1 addition, 1 deletion
compiler/Java_CodeGen.jrag
examples/simple/Encoder.java
+14
-0
14 additions, 0 deletions
examples/simple/Encoder.java
with
15 additions
and
1 deletion
compiler/Java_CodeGen.jrag
+
1
−
1
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";
}
...
...
This diff is collapsed.
Click to expand it.
examples/simple/Encoder.java
+
14
−
0
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
);
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment