Commit 1279cb03 authored by Sven Gestegård Robertz's avatar Sven Gestegård Robertz
Browse files

c decoder still skips pragma, decoding is wip, see comment

parent 2720b0d8
......@@ -27,6 +27,7 @@ OBJS=labcomm_memory.o \
labcomm.o \
labcomm_dynamic_buffer_writer.o \
labcomm_fd_reader.o labcomm_fd_writer.o \
labcomm_bytearray_reader.o \
labcomm_pthread_scheduler.o
#FIXME: labcomm_mem_reader.o labcomm_mem_writer.o
......
......@@ -34,9 +34,15 @@ struct labcomm_bytearray_reader {
int bytearray_size;
};
#if 0
// XXX HERE BE DRAGONS: version removed?
static int bytearray_alloc(struct labcomm_reader *r,
struct labcomm_reader_action_context *action_context,
char *version)
#else
static int bytearray_alloc(struct labcomm_reader *r,
struct labcomm_reader_action_context *action_context)
#endif
{
int result = 0;
......
......@@ -233,6 +233,7 @@ out:
static int decoder_skip(struct labcomm_decoder *d, int len)
{
int i;
printf("skipping %d bytes\n", len);
for(i = 0; i <len; i++){
labcomm_read_byte(d->reader);
if (d->reader->error < 0) {
......@@ -252,6 +253,7 @@ static int decode_pragma(struct labcomm_decoder *d, int len)
}
int bytes = labcomm_size_string(pragma_type);
int psize = len-bytes;
printf("got pragma: %s\n", pragma_type);
if(0 /*d->pragma_handler*/) {
//read the entire packet to a buffer and then run
// decode on that through a bytearray_reader.
......@@ -265,11 +267,15 @@ static int decode_pragma(struct labcomm_decoder *d, int len)
goto out;
}
}
printf("read %d bytes\n", psize);
//TODO: add wrapped decoders, and create pragma decoder that does not
// expect a version packet
struct labcomm_reader *pr = labcomm_bytearray_reader_new(
d->reader->memory, pragma_data, psize);
struct labcomm_decoder *pd = labcomm_decoder_new(
pr, d->error, d->memory, d->scheduler);
/* d->prama_handler(pd, ptype, plen); */
labcomm_decoder_run(pd);
internal_labcomm_decoder_free(pd);
result = 0;
......
Markdown is supported
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