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
cd7ccf44
Commit
cd7ccf44
authored
Nov 08, 2011
by
Sven Robertz
Browse files
small changes
parent
c11dc39c
Changes
3
Show whitespace changes
Inline
Side-by-side
examples/simple_java/README
View file @
cd7ccf44
NB! Before trying to build and run this example, make sure you have built the LabComm compiler
by running "ant jar" in the main directory (../../ seen from here).
This is a very simple example with one labcomm file (simple.lc) defining two samples.
This is a very simple example with one labcomm file (simple.lc) defining two samples.
Example source code: Encoders and decoders written in Java and C.
Example source code: Encoders and decoders written in Java and C.
Encoder.java
Encoder.java
...
...
examples/simple_java/example_encoder.c
View file @
cd7ccf44
...
@@ -18,10 +18,12 @@ int main(int argc, char *argv[]) {
...
@@ -18,10 +18,12 @@ int main(int argc, char *argv[]) {
simple_IntString
is
;
simple_IntString
is
;
is
.
x
=
24
;
is
.
x
=
24
;
is
.
s
=
"Hello, LabComm!"
;
is
.
s
=
"Hello, LabComm!"
;
printf
(
"Encoding IntString, x=%d, s=%s
\n
"
,
is
.
x
,
is
.
s
);
labcomm_encode_simple_IntString
(
encoder
,
&
is
);
labcomm_encode_simple_IntString
(
encoder
,
&
is
);
simple_TwoInts
ti
;
simple_TwoInts
ti
;
ti
.
a
=
13
;
ti
.
a
=
13
;
ti
.
b
=
37
;
ti
.
b
=
37
;
printf
(
"Encoding TwoInts, a=%d, b=%d
\n
"
,
ti
.
a
,
ti
.
b
);
labcomm_encode_simple_TwoInts
(
encoder
,
&
ti
);
labcomm_encode_simple_TwoInts
(
encoder
,
&
ti
);
}
}
examples/simple_java/run.sh
View file @
cd7ccf44
java
-cp
.:../../lib/java:gen Encoder encoded_data
java
-cp
.:../../lib/java:gen Encoder encoded_data
java
-cp
.:../../lib/java:gen Decoder encoded_data
./example_decoder encoded_data
./example_decoder encoded_data
./example_encoder encoded_data
java
-cp
.:../../lib/java:gen Decoder encoded_data
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