Skip to content
Snippets Groups Projects
Commit fbeec9d9 authored by Sven Gestegård Robertz's avatar Sven Gestegård Robertz
Browse files

sketch

parent 84c64434
Branches
No related tags found
No related merge requests found
......@@ -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);
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment