diff --git a/Makefile b/Makefile index e9388b0bb0aa7719c8b28f19187ac2f9f0feb60d..375a244fd6ac7b83395e517e50a99d7ddd8d3979 100644 --- a/Makefile +++ b/Makefile @@ -32,3 +32,14 @@ clean-compiler: .PHONY: clean-% clean-%: $(MAKE) -C $* -e clean + +.PHONY: distclean +distclean: $(SUBDIRS:%=distclean-%) + +.PHONY: distclean-compiler +distclean-compiler: + cd compiler ; ant clean + +.PHONY: distclean-% +distclean-%: + $(MAKE) -C $* -e distclean diff --git a/examples/Makefile b/examples/Makefile index 5f7d860359bc7c0bfce9350bed9e1575015f3158..6ec4b20df5e362fd78bbea0c9b5fc4d1ab18cb77 100644 --- a/examples/Makefile +++ b/examples/Makefile @@ -6,5 +6,5 @@ test: echo More to be done... cd simple ; sh compile.sh && sh run.sh -clean: +clean distclean: echo To be done... diff --git a/lib/Makefile b/lib/Makefile index fd00fcf6f108866a57bf3e55ee7e95d9a1483adb..ed696a878ae4cc8bdbb0292731f8e2e69cbbe32d 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -10,3 +10,8 @@ clean: cd c ; make clean cd csharp ; make clean cd java ; make clean + +distclean: + cd c ; make distclean + cd csharp ; make clean + cd java ; make clean diff --git a/lib/c/labcomm.c b/lib/c/labcomm.c index 216ca646e803636c6d6afd1263f801a2cdde5c21..978640f4eb53d600f335bf619212139dcb6c39e8 100644 --- a/lib/c/labcomm.c +++ b/lib/c/labcomm.c @@ -568,6 +568,7 @@ struct labcomm_decoder *labcomm_decoder_new( result->reader->data_size = 0; result->reader->count = 0; result->reader->pos = 0; + result->reader->error = 0; result->lock = lock; result->on_error = on_error_fprintf; result->on_new_datatype = on_new_datatype; diff --git a/lib/c/labcomm_fd_reader.c b/lib/c/labcomm_fd_reader.c index a9ee68c7c453527c2b48ad67a5c769a9bfc41d21..d67e6f6572a05fd8f3d04bf25593ef98e68794f3 100644 --- a/lib/c/labcomm_fd_reader.c +++ b/lib/c/labcomm_fd_reader.c @@ -76,6 +76,7 @@ static int fd_fill(struct labcomm_reader *r, void *context) err = read(fd_context->fd, r->data, r->data_size); if (err <= 0) { r->count = 0; + r->error = -EPIPE; result = -EPIPE; } else { r->count = err; diff --git a/lib/c/labcomm_private.h b/lib/c/labcomm_private.h index 4bd2777e4fe17e8a36113519f6ae9a7b1d2141fd..695938dc95dcd389cc050a92bc42d68ea5d8f2a4 100644 --- a/lib/c/labcomm_private.h +++ b/lib/c/labcomm_private.h @@ -158,6 +158,9 @@ static inline unsigned int labcomm_read_packed32(struct labcomm_reader *r) if (r->pos >= r->count) { r->action->fill(r, r->context); + if (r->error != 0) { + goto out; + } } tmp = r->data[r->pos]; r->pos++; @@ -166,6 +169,7 @@ static inline unsigned int labcomm_read_packed32(struct labcomm_reader *r) break; } } +out: return result; } diff --git a/test/Makefile b/test/Makefile index 0edf4601dcabf160db0fedbcd26c6797afd90864..75a98a21da89218958a8ad3897734ca0014f9168 100644 --- a/test/Makefile +++ b/test/Makefile @@ -10,8 +10,8 @@ test: $(TESTS:%=test_%) # PYTHONPATH=../lib/python \ # ./test_encoder_decoder.py --labcomm="$(LABCOMM)" basic.lc -.PHONY: clean -clean: +.PHONY: clean distclean +clean distclean: rm -rf gen .PHONY: test_%