Commit 9bfa7c14 authored by Sven Gestegård Robertz's avatar Sven Gestegård Robertz
Browse files

c encoding, java skipping pragma

parent 86728095
...@@ -23,15 +23,15 @@ int main(int argc, char *argv[]) { ...@@ -23,15 +23,15 @@ int main(int argc, char *argv[]) {
labcomm_default_scheduler); labcomm_default_scheduler);
labcomm_encoder_register_test_twoLines(encoder); labcomm_encoder_register_test_twoLines(encoder);
#ifdef OLD_METADATA #ifndef WITHOUT_PRAGMA
struct labcomm_encoder *mdt = labcomm_metadata_begin(encoder, struct labcomm_encoder *pb = labcomm_pragma_builder_new(encoder,
&labcomm_signature_test_twoLines); "se.lth.cs.sven.pragma");
labcomm_encoder_register_test_Comment(mdt); labcomm_encoder_register_test_Comment(pb);
test_Comment comment; test_Comment comment;
comment.id = 17; comment.id = 17;
comment.comment = "This is a metadata comment..."; comment.comment = "This is a metadata comment...";
labcomm_encode_test_Comment(mdt, &comment); labcomm_encode_test_Comment(pb, &comment);
labcomm_metadata_end(mdt); labcomm_pragma_send(pb);
#endif #endif
test_twoLines tl; test_twoLines tl;
......
...@@ -126,6 +126,10 @@ int labcomm_decoder_ioctl(struct labcomm_decoder *decoder, ...@@ -126,6 +126,10 @@ int labcomm_decoder_ioctl(struct labcomm_decoder *decoder,
...); ...);
/* pragma */ /* pragma */
struct labcomm_encoder *labcomm_pragma_builder_new(
struct labcomm_encoder *e,
char * pragma_type) ;
int labcomm_pragma_send(struct labcomm_encoder* e);
struct labcomm_pragma_handler { struct labcomm_pragma_handler {
//struct labcomm_decoder_registry *registry; //struct labcomm_decoder_registry *registry;
//TODO: implement map (char * pragma_type) --> decoder_registry * //TODO: implement map (char * pragma_type) --> decoder_registry *
......
...@@ -97,7 +97,8 @@ struct pragma_packet_builder { ...@@ -97,7 +97,8 @@ struct pragma_packet_builder {
struct labcomm_encoder *labcomm_pragma_builder_new( struct labcomm_encoder *labcomm_pragma_builder_new(
struct labcomm_encoder *e, struct labcomm_encoder *e,
char * pragma_type) { char * pragma_type)
{
struct labcomm_writer *dyn_writer = labcomm_dynamic_buffer_writer_new( struct labcomm_writer *dyn_writer = labcomm_dynamic_buffer_writer_new(
e->memory); e->memory);
struct labcomm_encoder *pb = labcomm_encoder_new(dyn_writer, struct labcomm_encoder *pb = labcomm_encoder_new(dyn_writer,
......
...@@ -37,6 +37,12 @@ public class DecoderChannel implements Decoder { ...@@ -37,6 +37,12 @@ public class DecoderChannel implements Decoder {
ReadBytes(signature, signature_length); ReadBytes(signature, signature_length);
registry.add(index, name, signature); registry.add(index, name, signature);
} break; } break;
case Constant.PRAGMA: {
System.out.println("Pragma: skipping "+length+" bytes");
for(int i=0; i<length; i++) {
decodeByte();
}
} break;
default: { default: {
DecoderRegistry.Entry e = registry.get(tag); DecoderRegistry.Entry e = registry.get(tag);
if (e == null) { if (e == null) {
......
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