diff --git a/doc/pragma-skiss.txt b/doc/pragma-skiss.txt index e941fb4cbce449dbd51a6a8583898e1ee7bb8cb9..9fb2912c0169f759f6dd8dbf40aa4929743f87d4 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); + + + +