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

Added distclean target.

Somewhat improved error handling in readers.
parent ebae0d9b
...@@ -32,3 +32,14 @@ clean-compiler: ...@@ -32,3 +32,14 @@ clean-compiler:
.PHONY: clean-% .PHONY: clean-%
clean-%: clean-%:
$(MAKE) -C $* -e 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
...@@ -6,5 +6,5 @@ test: ...@@ -6,5 +6,5 @@ test:
echo More to be done... echo More to be done...
cd simple ; sh compile.sh && sh run.sh cd simple ; sh compile.sh && sh run.sh
clean: clean distclean:
echo To be done... echo To be done...
...@@ -10,3 +10,8 @@ clean: ...@@ -10,3 +10,8 @@ clean:
cd c ; make clean cd c ; make clean
cd csharp ; make clean cd csharp ; make clean
cd java ; make clean cd java ; make clean
distclean:
cd c ; make distclean
cd csharp ; make clean
cd java ; make clean
...@@ -568,6 +568,7 @@ struct labcomm_decoder *labcomm_decoder_new( ...@@ -568,6 +568,7 @@ struct labcomm_decoder *labcomm_decoder_new(
result->reader->data_size = 0; result->reader->data_size = 0;
result->reader->count = 0; result->reader->count = 0;
result->reader->pos = 0; result->reader->pos = 0;
result->reader->error = 0;
result->lock = lock; result->lock = lock;
result->on_error = on_error_fprintf; result->on_error = on_error_fprintf;
result->on_new_datatype = on_new_datatype; result->on_new_datatype = on_new_datatype;
......
...@@ -76,6 +76,7 @@ static int fd_fill(struct labcomm_reader *r, void *context) ...@@ -76,6 +76,7 @@ static int fd_fill(struct labcomm_reader *r, void *context)
err = read(fd_context->fd, r->data, r->data_size); err = read(fd_context->fd, r->data, r->data_size);
if (err <= 0) { if (err <= 0) {
r->count = 0; r->count = 0;
r->error = -EPIPE;
result = -EPIPE; result = -EPIPE;
} else { } else {
r->count = err; r->count = err;
......
...@@ -158,6 +158,9 @@ static inline unsigned int labcomm_read_packed32(struct labcomm_reader *r) ...@@ -158,6 +158,9 @@ static inline unsigned int labcomm_read_packed32(struct labcomm_reader *r)
if (r->pos >= r->count) { if (r->pos >= r->count) {
r->action->fill(r, r->context); r->action->fill(r, r->context);
if (r->error != 0) {
goto out;
}
} }
tmp = r->data[r->pos]; tmp = r->data[r->pos];
r->pos++; r->pos++;
...@@ -166,6 +169,7 @@ static inline unsigned int labcomm_read_packed32(struct labcomm_reader *r) ...@@ -166,6 +169,7 @@ static inline unsigned int labcomm_read_packed32(struct labcomm_reader *r)
break; break;
} }
} }
out:
return result; return result;
} }
......
...@@ -10,8 +10,8 @@ test: $(TESTS:%=test_%) ...@@ -10,8 +10,8 @@ test: $(TESTS:%=test_%)
# PYTHONPATH=../lib/python \ # PYTHONPATH=../lib/python \
# ./test_encoder_decoder.py --labcomm="$(LABCOMM)" basic.lc # ./test_encoder_decoder.py --labcomm="$(LABCOMM)" basic.lc
.PHONY: clean .PHONY: clean distclean
clean: clean distclean:
rm -rf gen rm -rf gen
.PHONY: test_% .PHONY: test_%
......
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