next up previous contents
Next: Data Flexibility Up: Serialisation Previous: Functionality   Contents

Data Parsing

The serialisation mechanism relies upon a parse string to control the function seialise_parse() to process the data from each data structure. This is stored in

tina_data_info_array[*(int *) data - ts_base_id].swap_string

where ts_bas_id is the base address of the TINA structure ts_id tags and defined by ts_base_id = TS_ID_BASE.

The basic data types are as follows:

k = unsigned short
b = unsigned char
u = unsigned int
h = short
c = char
i = int
f = float
g = double
. = pointer (generally not usable after transfer).
w = function pointers ( generally not usable after transfer).
, = filler (see below)
o = unknown (but 4 bytes long)
l = unknown (but 4 bytes long)
e = unknown (but 8 bytes long)

These leave the transferred data unmodified on reconstruction.

The most important (tagged) data types are:

t = Previously defined TINA data structure
p = pointer to TINA data structure
s = pointer to string ( char *)

as these specify a recursion down the structure to serialise and transfer further TINA data.

The swap-string variable is defined starting from the first variable defined in a data structure following the Ts_id.

This string can contain real numbers (0-10) which encode the number of repeated data types. The repeated data type may be parenthasized (with either "(" or "[" bracket types) so that complicated structures can be represented concisely. It is perhaps inevitable that some data may be redundant when transmitted to another processor, a repeat number of "0" signals the serialisation code to ignore this item. Trailing items can also be ignored by prematurely truncating the parse string. The variables which are communicated during the serialisation process are thus completely specifiable by the user.

eg:

typedef struct conic
{
    Ts_id ts_id;                /* Tina structure identifier */
    unsigned int type;
    unsigned int label;
    int filler1;
    double a, b, c, d, e, f;   /* algebraic formula */
    double theta, alpha, beta;
    struct vec2 center;
    int filler2;
    double t1, t2;       /* conic params of p1 and p2 */
    int branch;          /* for hyperbola only */
    List *props;         /* property list */
} Conic;

#define CONIC_SWAP_STRING "uuigggggggggtiggip"

The string allows the use of comments delimited by "/" eg:

TS_SWAP_STRING_SET(Line3,"/type/u/label/u/p1/t/p2/t/p/t/v/t/length/f/props/p"


next up previous contents
Next: Data Flexibility Up: Serialisation Previous: Functionality   Contents
root 2017-11-22