From fbeec9d97819d249b191c4ca324c198c2435d78b Mon Sep 17 00:00:00 2001 From: Sven Gestegard Robertz <sven.robertz@cs.lth.se> Date: Thu, 23 Oct 2014 13:47:19 +0200 Subject: [PATCH] sketch --- doc/pragma-skiss.txt | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/doc/pragma-skiss.txt b/doc/pragma-skiss.txt index e941fb4..9fb2912 100644 --- a/doc/pragma-skiss.txt +++ b/doc/pragma-skiss.txt @@ -24,8 +24,49 @@ void labcomm_pragma_add_ref(struct labcomm_signature sig); // One possible (pragma-type defined) semantic is that the latest type // reference applies to the fields following it. +A pragma packet is (under the hood) a struct labcomm_encoder, so that we +can reuse the sample_type_encode() function for adding pragma fields. + // an example session struct labcom_pragma_packet pp = labcomm_pragma_new(enc, some_type)); labcomm_pragma_add_ref(some_sig); +some_pragma_type_encode(pp, some_pragma_instance); +another_pragma_type_encode(pp, another_pragma_instance); labcomm_pragma_send(pp, enc); + + +#define labcomm_pragma_add_field(some_pragma_sample_type, value) \ + labcomm_encode_#some_pragma_sample_type, value) + +int labcomm_encode_test_twoLines( struct labcomm_encoder *e, + test_twoLines *v) +{ +return labcomm_internal_encode(e, + &labcomm_signature_test_twoLines, + (labcomm_enc oder_function) encode_test_twoLines, + v); +} + + + +receiving: + +alt 1. standard handlers, parameter pragma_type to handle function + -- this means adding a parameter to all handlers + (where null means not pragma) + +alt 2. standard handlers, but separate register_pragma_handler function + use the handler context to store and communicate pragma-specific data. + + -- this means that the decoder interface needs to be extended, + and that the handler context for pragmas need to be specified + (by labcomm) + +1. + +void handle_some_pragma(some_pragma *v, void *context, char * pragma_type); + + + + -- GitLab