diff --git a/compiler/C_CodeGen.jrag b/compiler/C_CodeGen.jrag index 576698f02d7c72784eea3571a734b7f564639915..240ee7fdffbf6277af39c5f330ad7a5b12ceda36 100644 --- a/compiler/C_CodeGen.jrag +++ b/compiler/C_CodeGen.jrag @@ -951,8 +951,7 @@ aspect C_Signature { } public void Program.C_emitConstructorDeclaration(C_env env) { - env.println("LABCOMM_CONSTRUCTOR void init_" + - env.prefix + "_signatures(void);"); + env.println("void init_" + env.prefix + "_signatures(void);"); } } diff --git a/examples/twoway/Makefile b/examples/twoway/Makefile index 76da45e3412d153c37ed286cf342a2a347c16348..b14550b48aff392429a8aaec85f2fb00e8077d12 100644 --- a/examples/twoway/Makefile +++ b/examples/twoway/Makefile @@ -2,7 +2,7 @@ TARGETS=client server LABCOMM_JAR=../../compiler/labComm.jar LABCOMM=java -jar $(LABCOMM_JAR) -CFLAGS=-O3 -g -Wall -Werror -I../../lib/c -I. -lpthread +CFLAGS=-O3 -g -Wall -Werror -I../../lib/c -I. all: $(TARGETS:%=gen/%) @@ -26,11 +26,11 @@ gen/%.c gen/%.h: %.lc | gen/.dir gen/client: client.c $(CC) -o $@ $(CFLAGS) $^ -lpthread \ - -L../../lib/c -llabcomm -Tlabcomm.linkscript + -L../../lib/c -llabcomm gen/server: server.c $(CC) -o $@ $(CFLAGS) $^ -lpthread \ - -L../../lib/c -llabcomm -Tlabcomm.linkscript + -L../../lib/c -llabcomm .PHONY: clean clean: diff --git a/lib/c/Makefile b/lib/c/Makefile index 7ada2b7c38ae4d48a59f7f0c7ae3a911cbff6ed2..886d8185ff764ffb188bee9544f9bbb90334e0a9 100644 --- a/lib/c/Makefile +++ b/lib/c/Makefile @@ -2,7 +2,7 @@ UNAME_S=$(shell uname -s) ifeq ($(UNAME_S),Linux) CC=gcc - CFLAGS=-g -Wall -Werror -O3 -I. -Itest + CFLAGS=-std=c99 -g -Wall -Werror -O3 -I. -Itest LDFLAGS=-L. LDLIBS=-llabcomm -lrt MAKESHARED=gcc -o $1 -shared -Wl,-soname,$2 $3 -lc -lrt diff --git a/lib/c/labcomm_decoder.c b/lib/c/labcomm_decoder.c index 3bbc8e136f61f405bd7e5edeec84bd00cc257bcf..d6ecd5e5103e82faf39d8edf8c7f24228736bb5c 100644 --- a/lib/c/labcomm_decoder.c +++ b/lib/c/labcomm_decoder.c @@ -226,7 +226,7 @@ static int decode_typedef_or_sample(struct labcomm_decoder *d, int kind) s->signature->type == signature.type && s->signature->size == signature.size && strcmp(s->signature->name, signature.name) == 0 && - bcmp((void*)s->signature->signature, (void*)signature.signature, + memcmp((void*)s->signature->signature, (void*)signature.signature, signature.size) == 0) { s->remote_index = remote_index; local_signature = s->signature; diff --git a/lib/c/labcomm_default_scheduler.c b/lib/c/labcomm_default_scheduler.c index cbc46400a489ec2ac6362515a82efa6342af417e..a567b61ebddd8a6d611e020dede1c927b09fd28e 100644 --- a/lib/c/labcomm_default_scheduler.c +++ b/lib/c/labcomm_default_scheduler.c @@ -79,7 +79,7 @@ static int scheduler_wakeup(struct labcomm_scheduler *s) } static int scheduler_enqueue(struct labcomm_scheduler *s, - useconds_t delay, + uint32_t delay, void (*deferred)(void *context), void *context) { diff --git a/lib/c/labcomm_pthread_scheduler.c b/lib/c/labcomm_pthread_scheduler.c index f4d82a500c3de4d4bab8ff2130b6b219a765bf57..a9b516a3b41af1ccfada40a9da50958299758a6e 100644 --- a/lib/c/labcomm_pthread_scheduler.c +++ b/lib/c/labcomm_pthread_scheduler.c @@ -18,6 +18,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ +#define _POSIX_C_SOURCE (200112L) #include <stdio.h> #include <stdlib.h> #include <errno.h> @@ -64,7 +65,7 @@ static int queue_empty(struct pthread_deferred *queue) return queue->next == queue; } -static void timespec_add_usec(struct timespec *t, useconds_t usec) +static void timespec_add_usec(struct timespec *t, uint32_t usec) { time_t sec = usec / 1000000; long nsec = (usec % 1000000) * 1000; @@ -125,7 +126,7 @@ static int time_free(struct labcomm_time *t) return 0; } -static int time_add_usec(struct labcomm_time *t, useconds_t usec) +static int time_add_usec(struct labcomm_time *t, uint32_t usec) { struct pthread_time *time = t->context; @@ -297,7 +298,7 @@ static int scheduler_wakeup(struct labcomm_scheduler *s) } static int scheduler_enqueue(struct labcomm_scheduler *s, - useconds_t delay, + uint32_t delay, void (*deferred)(void *context), void *context) { diff --git a/lib/c/labcomm_scheduler.c b/lib/c/labcomm_scheduler.c index 6fe283acc9b49e5a3477eb73628651805552c280..3ef62f3b54e076f0dbf726acd4421dddec71fb42 100644 --- a/lib/c/labcomm_scheduler.c +++ b/lib/c/labcomm_scheduler.c @@ -75,7 +75,7 @@ int labcomm_scheduler_wakeup(struct labcomm_scheduler *s) } int labcomm_scheduler_enqueue(struct labcomm_scheduler *s, - useconds_t delay, + uint32_t delay, void (*func)(void *context), void *context) { diff --git a/lib/c/labcomm_scheduler.h b/lib/c/labcomm_scheduler.h index f9a07786b9f54d38a1e9b675b461356c4b5e8778..4aef48daf6c734cafdb25780a43954d0340beb71 100644 --- a/lib/c/labcomm_scheduler.h +++ b/lib/c/labcomm_scheduler.h @@ -23,11 +23,12 @@ #define _LABCOMM_SCHEDULER_H_ #include <unistd.h> +#include <stdint.h> struct labcomm_time; int labcomm_time_free(struct labcomm_time *t); -int labcomm_time_add_usec(struct labcomm_time *t, useconds_t usec); +int labcomm_time_add_usec(struct labcomm_time *t, uint32_t usec); struct labcomm_scheduler; @@ -47,7 +48,7 @@ int labcomm_scheduler_wakeup(struct labcomm_scheduler *s); /* Deferred action handling */ int labcomm_scheduler_enqueue(struct labcomm_scheduler *s, - useconds_t delay, + uint32_t delay, void (*deferred)(void *context), void *context); diff --git a/lib/c/labcomm_scheduler_private.h b/lib/c/labcomm_scheduler_private.h index bca2d5370d6bb8d78b4ea65e7624cefcdafedec7..cc4d50e40c518eb7c43b928918e1f568a8301065 100644 --- a/lib/c/labcomm_scheduler_private.h +++ b/lib/c/labcomm_scheduler_private.h @@ -28,7 +28,7 @@ struct labcomm_time { const struct labcomm_time_action { int (*free)(struct labcomm_time *t); - int (*add_usec)(struct labcomm_time *t, useconds_t usec); + int (*add_usec)(struct labcomm_time *t, uint32_t usec); } *action; void *context; }; @@ -45,7 +45,7 @@ struct labcomm_scheduler { struct labcomm_time *wakeup); int (*wakeup)(struct labcomm_scheduler *s); int (*enqueue)(struct labcomm_scheduler *s, - useconds_t delay, + uint32_t delay, void (*deferred)(void *context), void *context); } *action; diff --git a/lib/c/labcomm_time.c b/lib/c/labcomm_time.c index c10c7b6643b18e018121bf851d9744372c9b2d3d..a1a5235199aa31c1c315d19343f1e7d33963f2fd 100644 --- a/lib/c/labcomm_time.c +++ b/lib/c/labcomm_time.c @@ -35,7 +35,7 @@ int labcomm_time_free(struct labcomm_time *s) TIME(free, s); } -int labcomm_time_add_usec(struct labcomm_time *s, useconds_t usec) +int labcomm_time_add_usec(struct labcomm_time *s, uint32_t usec) { TIME(add_usec, s, usec); } diff --git a/lib/c/test/test_labcomm.c b/lib/c/test/test_labcomm.c index 3addcf2297484923f77266f9557cc8c72b66abd3..dbb3c21e4bf98a60edb5053a8849318e85e9a745 100644 --- a/lib/c/test/test_labcomm.c +++ b/lib/c/test/test_labcomm.c @@ -164,6 +164,10 @@ int main(void) encoder_var, decoder_var); exit(1); } + fprintf(stderr, "Size: %d %d\n", + labcomm_sizeof_test_sample_test_var(NULL, NULL), + writer.pos); +// exit(1); return 0; } diff --git a/test/Makefile b/test/Makefile index b006c9e31eae290562387897483f748d700dc9a9..7401102eba4792c16788f41379678faca4fae516 100644 --- a/test/Makefile +++ b/test/Makefile @@ -52,8 +52,7 @@ gen/%/c_relay.c: gen/%/typeinfo relay_gen_c.py Makefile .PRECIOUS: gen/%/c_relay gen/%/c_relay: gen/%/c_relay.c gen/%/c_code.c Makefile $(CC) $(CFLAGS) -o $@ $< -I../lib/c -I. -L..//lib/c \ - gen/$*/c_code.c \ - -llabcomm -Tlabcomm.linkscript + gen/$*/c_code.c -llabcomm # C# relay test rules .PRECIOUS: gen/%/cs_code.cs