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
Anders Blomdell
LabComm
Commits
a8c10f92
Commit
a8c10f92
authored
May 16, 2013
by
Anders Blomdell
Browse files
Temporary fix of examples/simple (need to fix liblabcomm)...
parent
70b290de
Changes
3
Hide whitespace changes
Inline
Side-by-side
examples/simple/compile.sh
View file @
a8c10f92
(
cd
../../lib/c
;
make
-e
LABCOMM_NO_EXPERIMENTAL
=
true
)
#
(cd ../../lib/c; make -e LABCOMM_NO_EXPERIMENTAL=true)
(
cd
../../compiler
;
ant jar
)
mkdir
-p
gen
java
-jar
../../compiler/labComm.jar
--java
=
gen
--c
=
gen/simple.c
--h
=
gen/simple.h
--python
=
gen/simple.py simple.lc
javac
-cp
../../lib/java:. gen/
*
.java Encoder.java Decoder.java
gcc
-o
example_encoder
-L
../../lib/c
-I
.
-I
../../lib/c example_encoder.c gen/simple.c
-llabcomm
gcc
-o
example_decoder
-L
../../lib/c
-I
.
-I
../../lib/c example_decoder.c gen/simple.c
-llabcomm
gcc
-Wall
-Werror
-I
.
-I
../../lib/c
\
-DLABCOMM_FD_OMIT_VERSION
\
-DLABCOMM_ENCODER_LINEAR_SEARCH
\
gen/simple.c ../../lib/c/labcomm.c
\
../../lib/c/labcomm_dynamic_buffer_writer.c
\
../../lib/c/labcomm_fd_writer.c
\
-o
example_encoder example_encoder.c
gcc
-Wall
-Werror
-I
.
-I
../../lib/c
\
-DLABCOMM_FD_OMIT_VERSION
\
-DLABCOMM_ENCODER_LINEAR_SEARCH
\
gen/simple.c ../../lib/c/labcomm.c
\
../../lib/c/labcomm_dynamic_buffer_writer.c
\
../../lib/c/labcomm_fd_reader.c
\
-o
example_decoder example_decoder.c
#gcc -o example_encoder -I . -I ../../lib/c example_encoder.c gen/simple.c ../../lib/c/labcomm.c ../../lib/c/labcomm_fd_reader_writer.c
...
...
examples/simple/example_decoder.c
View file @
a8c10f92
...
...
@@ -19,37 +19,39 @@ static void handle_simple_IntString(simple_IntString *v,void *context) {
static
void
handle_simple_TwoArrays
(
simple_TwoArrays
*
d
,
void
*
context
)
{
printf
(
"Got TwoArrays:"
);
int
i
;
int
i
,
j
;
for
(
i
=
0
;
i
<
2
;
i
++
)
{
printf
(
"%d "
,
d
->
fixed
.
a
[
i
]);
}
printf
(
"
\n
"
);
for
(
i
=
0
;
i
<
d
->
variable
.
n_1
;
i
++
)
{
printf
(
"%d "
,
d
->
variable
.
a
[
0
+
2
*
i
]);
printf
(
"%d "
,
d
->
variable
.
a
[
1
+
2
*
i
]);
for
(
i
=
0
;
i
<
2
;
i
++
)
{
for
(
j
=
0
;
j
<
d
->
variable
.
n_1
;
j
++
)
{
printf
(
"%d "
,
d
->
variable
.
a
[
i
*
d
->
variable
.
n_1
+
j
]);
}
printf
(
"
\n
"
);
}
printf
(
"
\n
"
);
}
static
void
handle_simple_TwoFixedArrays
(
simple_TwoFixedArrays
*
d
,
void
*
context
)
{
printf
(
"Got TwoFixedArrays:"
);
int
i
;
int
i
,
j
;
for
(
i
=
0
;
i
<
2
;
i
++
)
{
printf
(
"%d "
,
d
->
a
.
a
[
i
]);
}
printf
(
"
\n
"
);
for
(
i
=
0
;
i
<
3
;
i
++
)
{
printf
(
"%d "
,
d
->
b
.
a
[
0
+
2
*
i
]);
printf
(
"%d "
,
d
->
b
.
a
[
1
+
2
*
i
]);
for
(
i
=
0
;
i
<
2
;
i
++
)
{
for
(
j
=
0
;
j
<
3
;
j
++
)
{
printf
(
"%d "
,
d
->
b
.
a
[
i
][
j
]);
}
printf
(
"
\n
"
);
}
printf
(
"
\n
"
);
}
int
main
(
int
argc
,
char
*
argv
[])
{
int
fd
;
struct
labcomm_decoder
*
decoder
;
void
*
context
=
NULL
;
int
i
,
j
;
char
*
filename
=
argv
[
1
];
printf
(
"C decoder reading from %s
\n
"
,
filename
);
...
...
@@ -70,4 +72,6 @@ int main(int argc, char *argv[]) {
labcomm_decoder_run
(
decoder
);
printf
(
"--- End Of File ---:
\n
"
);
labcomm_decoder_free
(
decoder
);
return
0
;
}
examples/simple/example_encoder.c
View file @
a8c10f92
...
...
@@ -8,7 +8,6 @@
int
main
(
int
argc
,
char
*
argv
[])
{
int
fd
;
struct
labcomm_encoder
*
encoder
;
int
i
,
j
;
char
*
filename
=
argv
[
1
];
printf
(
"C encoder writing to %s
\n
"
,
filename
);
...
...
@@ -65,4 +64,5 @@ int main(int argc, char *argv[]) {
labcomm_encoder_register_simple_TwoFixedArrays
(
encoder
);
labcomm_encode_simple_TwoFixedArrays
(
encoder
,
&
tfa
);
return
0
;
}
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