Commit 11902762 authored by Anders Blomdell's avatar Anders Blomdell
Browse files

Various small tweaks.

parent 5fde48f3
all:
cd c ; make
cd csharp ; make
cd java ; make
clean:
cd c ; make clean
cd csharp ; make clean
cd java ; make clean
......@@ -7,8 +7,8 @@ LDFLAGS = -L.
LDLIBS_TEST = -Tlabcomm.linkscript -lcunit -llabcomm
OBJS= labcomm.o labcomm_dynamic_buffer_writer.o labcomm_fd_reader.o labcomm_fd_writer.o labcomm_mem_reader.o labcomm_mem_writer.o
LABCOMMC_PATH=../../compiler
LABCOMMC_JAR=$(LABCOMMC_PATH)/labComm.jar
LABCOMM_JAR=../../compiler/labComm.jar
LABCOMM=java -jar $(LABCOMM_JAR)
TESTS=test_labcomm_basic_type_encoding test_labcomm_generated_encoding test_labcomm
#FIXME: test_labcomm_errors
......@@ -33,7 +33,7 @@ endif
.PHONY: all run-test clean distclean
all: liblabcomm.a test/test_labcomm_errors
all: liblabcomm.a
liblabcomm.a: $(OBJS)
ar -r liblabcomm.a $^
......@@ -68,19 +68,19 @@ $(TEST_DIR)/gen:
mkdir -p $@
$(TEST_DIR)/gen/%.c $(TEST_DIR)/gen/%.h: $(TEST_DIR)/%.lc | $(TEST_DIR)/gen
java -jar $(LABCOMMC_JAR) \
$(LABCOMM) \
--c=$(TEST_DIR)/gen/$*.c \
--h=$(TEST_DIR)/gen/$*.h \
$<
$(TEST_GEN_DIR)/%.c $(TEST_GEN_DIR)/%.h: $(TESTDATA_DIR)/%.lc \
$(LABCOMMC_JAR) | $(TEST_GEN_DIR)
java -jar $(LABCOMMC_JAR) \
$(LABCOMM_JAR) | $(TEST_GEN_DIR)
$(LABCOMM) \
--c=$(patsubst %.h,%.c,$@) --h=$(patsubst %.c,%.h,$@) $<
$(LABCOMMC_JAR):
$(LABCOMM_JAR):
@echo "======Building LabComm compiler======"
cd $(LABCOMMC_PATH); ant jar
cd $(shell dirname $(LABCOMM_JAR)); ant jar
@echo "======End building LabComm compiler======"
%.o: %.c %.h
......
......@@ -16,6 +16,7 @@ int labcomm_fd_reader(
switch (action) {
case labcomm_reader_alloc: {
#ifndef LABCOMM_FD_OMIT_VERSION
va_list ap;
va_start(ap, action);
char *version = va_arg(ap, char *);
......@@ -23,7 +24,7 @@ int labcomm_fd_reader(
read(*fd, tmp, strlen(version));
free(tmp);
#endif
r->data = malloc(BUFFER_SIZE);
if (r->data) {
r->data_size = BUFFER_SIZE;
......@@ -34,7 +35,9 @@ int labcomm_fd_reader(
}
r->count = 0;
r->pos = 0;
va_end(ap);
#ifndef LABCOMM_FD_OMIT_VERSION
va_end(ap);
#endif
} break;
case labcomm_reader_start:
case labcomm_reader_continue: {
......
......@@ -17,11 +17,13 @@ int labcomm_fd_writer(
switch (action) {
case labcomm_writer_alloc: {
#ifndef LABCOMM_FD_OMIT_VERSION
va_list ap;
va_start(ap, action);
char *version = va_arg(ap, char *);
write(*fd, version, strlen(version));
#endif
w->data = malloc(BUFFER_SIZE);
if (! w->data) {
result = -ENOMEM;
......@@ -33,7 +35,9 @@ int labcomm_fd_writer(
w->count = BUFFER_SIZE;
w->pos = 0;
}
#ifndef LABCOMM_FD_OMIT_VERSION
va_end(ap);
#endif
} break;
case labcomm_writer_free: {
free(w->data);
......
......@@ -3,3 +3,5 @@ sample byte B;
sample struct {
int i;
} S1;
sample int I[_];
sample struct { int i; } P[_];
MODULES=LabCommDispatcher \
LabCommDecoderRegistry \
LabComm \
LabCommSample \
LabCommHandler \
LabCommEncoderRegistry \
LabCommDecoder \
LabCommType \
LabCommEncoderChannel \
LabCommEncoder \
LabCommDecoderChannel \
all: labcomm.jar
labcomm.jar: gen/JAVAC
echo $@
cd gen ; jar cf ../$@ se/lth/control/labcomm/*.class
gen:
mkdir gen
gen/JAVAC: $(MODULES:%=se/lth/control/labcomm/%.java) Makefile | gen
javac -d gen $(filter %.java, $^)
touch $@
clean:
rm -rf labcomm.jar gen
Supports Markdown
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