Commit 2b1728f7 authored by Sven Gestegård Robertz's avatar Sven Gestegård Robertz
Browse files

modified examples/simple to run both versions

parent 7a3d1a76
### Example compile script, showing the steps required to build a labcomm application
### (including compiler and libs). Also illustrates how versions 2013 and 2006 coexist
# For current version (2013)
(cd ../..; make all)
mkdir -p gen
java -jar ../../compiler/labComm.jar --ver=2006 --java=gen --c=gen/simple.c --h=gen/simple.h --python=gen/simple.py simple.lc
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 -Wall -Werror -I. -I../../lib/c -L../../lib/c \
-o example_encoder example_encoder.c gen/simple.c \
-llabcomm -Tlabcomm.linkscript
gcc -Wall -Werror -I . -I ../../lib/c -L../../lib/c \
-o example_decoder example_decoder.c gen/simple.c \
-llabcomm -Tlabcomm.linkscript
# For version 2006
javac -cp ../../lib/java:. gen/*.java Encoder06.java Decoder06.java
mkdir -p gen06
java -jar ../../compiler/labComm.jar --ver=2006 --java=gen06 --c=gen06/simple.c --h=gen06/simple.h --python=gen06/simple.py simple.lc
# gcc -Wall -Werror -I. -I../../lib/c -L../../lib/c \
# -o example_encoder example_encoder.c gen/simple.c \
# -llabcomm -Tlabcomm.linkscript
#gcc -Wall -Werror -I . -I ../../lib/c -L../../lib/c \
# -o example_decoder example_decoder.c gen/simple.c \
# -llabcomm -Tlabcomm.linkscript
javac -cp ../../lib/java:. gen06/*.java Encoder06.java Decoder06.java
gcc -Wall -Werror -I. -I../../lib/c/2006 -L../../lib/c \
-o example_encoder06 example_encoder06.c gen/simple.c \
-o example_encoder06 example_encoder06.c gen06/simple.c \
-llabcomm -Tlabcomm.linkscript
gcc -Wall -Werror -I . -I ../../lib/c/2006 -L../../lib/c \
-o example_decoder06 example_decoder06.c gen/simple.c \
-o example_decoder06 example_decoder06.c gen06/simple.c \
-llabcomm -Tlabcomm.linkscript
#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
......
......@@ -5,7 +5,7 @@
#include <labcomm2006_default_error_handler.h>
#include <labcomm2006_default_memory.h>
#include <labcomm2006_default_scheduler.h>
#include "gen/simple.h"
#include "gen06/simple.h"
#include <stdio.h>
static void handle_simple_theTwoInts(simple_TwoInts *v,void *context) {
......
......@@ -5,7 +5,7 @@
#include <labcomm2006_default_error_handler.h>
#include <labcomm2006_default_memory.h>
#include <labcomm2006_default_scheduler.h>
#include "gen/simple.h"
#include "gen06/simple.h"
#include <stdio.h>
int main(int argc, char *argv[]) {
......
export LD_LIBRARY_PATH=../../lib/c/
echo
echo "********************************************"
echo "*** Running example for version 2013 ***"
echo "********************************************"
echo
java -cp .:../../lib/java:gen Encoder encoded_data
./example_decoder encoded_data
......@@ -8,3 +13,13 @@ java -cp .:../../lib/java:gen Decoder encoded_data
echo "running python decoder (from wiki_example):"
PYTHONPATH=../../lib/python ../wiki_example/example_decoder.py encoded_data
echo
echo "*******************************************************"
echo "*** Running C and Java example for version 2006 ***"
echo "*******************************************************"
echo
java -cp .:../../lib/java:gen06 Encoder06 encoded_data06
./example_decoder06 encoded_data06
./example_encoder06 encoded_data06
java -cp .:../../lib/java:gen06 Decoder06 encoded_data06
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment