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:
.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
......@@ -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...
......@@ -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
......@@ -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;
......
......@@ -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;
......
......@@ -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;
}
......
......@@ -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_%
......
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