Data Structures | Typedefs | Functions

opcode.h File Reference

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_opcodebufrex_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.

Detailed Description

Implementation of opcode chains, that are used to drive the encoding and decoding process.


Typedef Documentation

typedef struct _bufrex_opcode* bufrex_opcode

List node containing an entry of a BUFR or CREX data descriptor section.


Function Documentation

dba_err bufrex_opcode_append ( bufrex_opcode entry,
dba_varcode  value 
)

Append an entry to an opcode chain.

Parameters:
entryopcode entry to append the entry to
valueValue to append to the entry. See vartable.h
Returns:
The error indicator for the function
void bufrex_opcode_delete ( bufrex_opcode entry )

Delete a bufrex_opcode chain.

Parameters:
entryThe 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.

Parameters:
op1The first bufrex_opcode chain to be joined
op2bufrex_opcode chain to be attached to the end of op1
Returns:
The error indicator for the function
dba_err bufrex_opcode_pop ( bufrex_opcode chain,
bufrex_opcode head 
)

Detach the first element from a bufrex_opcode list.

Parameters:
chainThe bufrex_opcode chain whose first element is to be detached.
headWhere will be stored the detached first element of the opcode list.
Returns:
The error indicator for the function

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.

Parameters:
chainThe bufrex_opcode chain whose first element is to be detached.
headWhere will be stored the detached first element of the opcode list.
lengthNumber of items to detach
Returns:
The error indicator for the function

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));
Parameters:
destThe bufrex_opcode before which the chain is to be copied
srcThe bufrex_opcode chain to copy
Returns:
The error indicator for the function

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.

Parameters:
chainThe bufrex_opcode chain to print
outstreamThe 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.