Skip to content
Snippets Groups Projects
Commit a8c10f92 authored by Anders Blomdell's avatar Anders Blomdell
Browse files

Temporary fix of examples/simple (need to fix liblabcomm)...

parent 70b290de
No related branches found
No related tags found
No related merge requests found
(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
......
......@@ -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;
}
......@@ -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;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment