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
c222f77c
Commit
c222f77c
authored
Feb 19, 2013
by
Sven Robertz
Browse files
added var array
parent
4143e65f
Changes
3
Hide whitespace changes
Inline
Side-by-side
examples/simple/Decoder.java
View file @
c222f77c
...
...
@@ -5,7 +5,7 @@ import java.io.InputStream;
import
se.lth.control.labcomm.LabCommDecoderChannel
;
public
class
Decoder
implements
TwoInts
.
Handler
,
IntString
.
Handler
implements
TwoInts
.
Handler
,
IntString
.
Handler
,
TwoArrays
.
Handler
{
LabCommDecoderChannel
decoder
;
...
...
@@ -16,6 +16,7 @@ public class Decoder
decoder
=
new
LabCommDecoderChannel
(
in
);
TwoInts
.
register
(
decoder
,
this
);
IntString
.
register
(
decoder
,
this
);
TwoArrays
.
register
(
decoder
,
this
);
try
{
System
.
out
.
println
(
"Running decoder."
);
...
...
@@ -33,6 +34,18 @@ public class Decoder
System
.
out
.
println
(
"Got IntString, x="
+
d
.
x
+
", s="
+
d
.
s
);
}
public
void
handle_TwoArrays
(
TwoArrays
d
)
throws
java
.
io
.
IOException
{
System
.
out
.
println
(
"Got TwoArrays:"
);
for
(
int
i
=
0
;
i
<
d
.
fixed
.
length
;
i
++)
{
System
.
out
.
print
(
d
.
fixed
[
i
]+
" "
);
}
System
.
out
.
println
();
for
(
int
i
=
0
;
i
<
d
.
variable
[
0
].
length
;
i
++)
{
System
.
out
.
print
(
d
.
variable
[
0
][
i
]+
" "
);
System
.
out
.
print
(
d
.
variable
[
1
][
i
]+
" "
);
}
System
.
out
.
println
();
}
public
static
void
main
(
String
[]
arg
)
throws
Exception
{
Decoder
example
=
new
Decoder
(
...
...
examples/simple/example_encoder.c
View file @
c222f77c
...
...
@@ -28,19 +28,25 @@ int main(int argc, char *argv[]) {
printf
(
"Encoding TwoInts, a=%d, b=%d
\n
"
,
ti
.
a
,
ti
.
b
);
labcomm_encode_simple_TwoInts
(
encoder
,
&
ti
);
int
foo
[
1
0
];
int
foo
[
2
0
];
simple_TwoArrays
ta
;
ta
.
fixed
.
a
[
0
]
=
17
;
ta
.
fixed
.
a
[
1
]
=
42
;
ta
.
variable
.
n_
0
=
10
;
ta
.
variable
.
n_
1
=
10
;
ta
.
variable
.
a
=
foo
;
int
k
;
for
(
k
=
0
;
k
<
20
;
k
++
)
{
foo
[
k
]
=
k
;
}
labcomm_encode_simple_TwoArrays
(
encoder
,
&
ta
);
ti
.
a
=
23
;
ti
.
b
=
47
;
printf
(
"Encoding TwoInts, a=%d, b=%d
\n
"
,
ti
.
a
,
ti
.
b
);
labcomm_encode_simple_TwoInts
(
encoder
,
&
ti
);
labcomm_encode_simple_TwoArrays
(
encoder
,
&
ta
);
}
examples/simple/simple.lc
View file @
c222f77c
...
...
@@ -15,5 +15,5 @@ sample struct {
sample struct {
int fixed[2];
int variable[_];
int variable[
2,
_];
} TwoArrays;
Write
Preview
Supports
Markdown
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