Implementation of opcode chains, that are used to drive the encoding and decoding process. More...
#include <dballe/core/vartable.h>
Go to the source code of this file.
Data Structures | |
struct | _bufrex_opcode |
List node containing an entry of a BUFR or CREX data descriptor section. More... | |
Typedefs | |
typedef struct _bufrex_opcode * | bufrex_opcode |
Functions | |
void | bufrex_opcode_delete (bufrex_opcode *entry) |
Delete a bufrex_opcode chain. | |
dba_err | bufrex_opcode_append (bufrex_opcode *entry, dba_varcode value) |
Append an entry to an opcode chain. | |
dba_err | bufrex_opcode_prepend (bufrex_opcode *dest, bufrex_opcode src) |
Duplicate an opcode chain and insert it before an existing bufrex_opcode. | |
dba_err | bufrex_opcode_join (bufrex_opcode *op1, bufrex_opcode op2) |
Attach a bufrex_opcode chain to the end of another. | |
dba_err | bufrex_opcode_pop (bufrex_opcode *chain, bufrex_opcode *head) |
Detach the first element from a bufrex_opcode list. | |
dba_err | bufrex_opcode_pop_n (bufrex_opcode *chain, bufrex_opcode *head, int length) |
Detach the first `length' elements from a bufrex_opcode list. | |
void | bufrex_opcode_print (bufrex_opcode chain, void *outstream) |
Print the contents of the given chain to the given output stream. |
Implementation of opcode chains, that are used to drive the encoding and decoding process.
typedef struct _bufrex_opcode* bufrex_opcode |
List node containing an entry of a BUFR or CREX data descriptor section.
dba_err bufrex_opcode_append | ( | bufrex_opcode * | entry, |
dba_varcode | value | ||
) |
Append an entry to an opcode chain.
entry | opcode entry to append the entry to |
value | Value to append to the entry. See vartable.h |
void bufrex_opcode_delete | ( | bufrex_opcode * | entry ) |
Delete a bufrex_opcode chain.
entry | The chain to be deleted. After the call, entry will be NULL. |
dba_err bufrex_opcode_join | ( | bufrex_opcode * | op1, |
bufrex_opcode | op2 | ||
) |
Attach a bufrex_opcode chain to the end of another.
op1 | The first bufrex_opcode chain to be joined |
op2 | bufrex_opcode chain to be attached to the end of op1 |
dba_err bufrex_opcode_pop | ( | bufrex_opcode * | chain, |
bufrex_opcode * | head | ||
) |
Detach the first element from a bufrex_opcode list.
chain | The bufrex_opcode chain whose first element is to be detached. |
head | Where will be stored the detached first element of the opcode list. |
References _bufrex_opcode::next.
dba_err bufrex_opcode_pop_n | ( | bufrex_opcode * | chain, |
bufrex_opcode * | head, | ||
int | length | ||
) |
Detach the first `length' elements from a bufrex_opcode list.
chain | The bufrex_opcode chain whose first element is to be detached. |
head | Where will be stored the detached first element of the opcode list. |
length | Number of items to detach |
References DBA_RUN_OR_RETURN.
dba_err bufrex_opcode_prepend | ( | bufrex_opcode * | dest, |
bufrex_opcode | src | ||
) |
Duplicate an opcode chain and insert it before an existing bufrex_opcode.
To insert a chain in a specific point of an existing chain, do this:
DBA_RUN_OR_RETURN(bufrex_opcode_prepend(&(oldnode->next), newchain));
This can be used to duplicate opcode chains, as in:
bufrex_opcode newchain = NULL; DBA_RUN_OR_RETURN(bufrex_opcode_prepend(&newchain, oldchain));
dest | The bufrex_opcode before which the chain is to be copied |
src | The bufrex_opcode chain to copy |
References _bufrex_opcode::next, and _bufrex_opcode::val.
void bufrex_opcode_print | ( | bufrex_opcode | chain, |
void * | outstream | ||
) |
Print the contents of the given chain to the given output stream.
This function is used mainly for debugging purposes.
chain | The bufrex_opcode chain to print |
outstream | The output stream (a FILE* variable) to print to. void* is used to avoid including stdio.h just for this debugging function. |
References DBA_VAR_F, DBA_VAR_X, DBA_VAR_Y, _bufrex_opcode::next, and _bufrex_opcode::val.