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

pragma todo added

parent fbeec9d9
No related branches found
No related tags found
No related merge requests found
Discussion 141023
TODO:
*** new labcomm packet types:
TYPE_DEF = 0x03 // for (possibly) hierarchical type definitions
TYPE_BINDING = 0x04 // binding a sample def to a type def
*** rewrite malloc of received samples to utilize the packet length field
to allocate a single object before parsing the sample byte stream
*** labcomm language: add type for type_ref to facilitate references to
labcomm sample_defs (and type_defs) in (primarily) pragmas
E.g., sample ... foo;
sample ... bar;
sample struct {
...
type[2] some_refs;
} some_pragma;
my_lc_some_pragma sp;
sp.some_refs = {&labcomm_signature_my_lc_foo,
&labcomm_signature_my_lc_bar};
labcomm_encode_my_lc_some_pragma(enc, &sp);
This is to avoid exposing local_to_remote and remote_to_local
*** refactor {encoder,decoder}registry to separate the actual encoder
from the registry
- currently, the assignment of local indices is done in the "constructor"
which means that the registries will be very thin
*** labcomm_pragma_builder(struct labcomm_encoder *enc);
- looks like an encoder to enable reuse of the generated encode functions
- allocates memory in the enclosing encoder, enc.
- deallocates memory when packet is sent
*** Pragma handler
- is a decoder, to which the user registers handlers for pragma samples
- has/gets a byte_array_reader in the context
- the "surrounding" decoder will deallocate the pragma packet when the
pragma handler returns
______________________________________________________________
______________preliminary sketch of pragma____________________
A pragma "packet" is a sequence of fields, where each field is A pragma "packet" is a sequence of fields, where each field is
a labcomm sample (in order to keep labcomm in-band self-describing). a labcomm sample (in order to keep labcomm in-band self-describing).
...@@ -56,6 +111,8 @@ alt 1. standard handlers, parameter pragma_type to handle function ...@@ -56,6 +111,8 @@ alt 1. standard handlers, parameter pragma_type to handle function
-- this means adding a parameter to all handlers -- this means adding a parameter to all handlers
(where null means not pragma) (where null means not pragma)
void handle_some_pragma(some_pragma *v, void *context, char * pragma_type);
alt 2. standard handlers, but separate register_pragma_handler function alt 2. standard handlers, but separate register_pragma_handler function
use the handler context to store and communicate pragma-specific data. use the handler context to store and communicate pragma-specific data.
...@@ -63,9 +120,21 @@ alt 2. standard handlers, but separate register_pragma_handler function ...@@ -63,9 +120,21 @@ alt 2. standard handlers, but separate register_pragma_handler function
and that the handler context for pragmas need to be specified and that the handler context for pragmas need to be specified
(by labcomm) (by labcomm)
1. alt 3 have a single handler for pragma packets as the interface upwards
from the labcomm lib. That handler is then responsible for managing
and multiplexing pragma types based on the type field in the pragma
packet.
void handle_some_pragma(some_pragma *v, void *context, char * pragma_type); The labcomm libraries can provide a default implementation of a
pragma_handler, to facilitate the common cases and reduce the
amount of boilerplate code.
struct pragma_packet {
char *pragma_type;
char *packed_data;
}
void handle_pragma(struct pragma_packet *p, void *context);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment