# The "dsproc" Package

These routines are meant to provide high level routines to process named objects (i.e. disc and connection arrayfiles).

Library: karma
Link With: -lkarma

#### Functions

dsproc_object | Process a Karma file.
dsproc_multi_array | Process a Karma data structure.

#### Prototype Functions

dsproc_PROTO_pre_process | Perform pre-processing on a multi_array data structure.
dsproc_PROTO_process_array | Process a general data structure into an output structure.
dsproc_PROTO_post_process | Perform post-processing on a multi_array data structure.

## Functions

void dsproc_object (CONST char *object, char *array_names[], unsigned int num_arrays, flag save_unproc_data, flag (*pre_process) (), flag (*process_array) (), flag (*post_process) (), unsigned int mmap_option)

Process a Karma file.

Parameters:

- object : The name of the Karma file to process. This is passed directly to dsxfr_get_multi. If this name is "connection" or is of the form: "connection[#]" then the routine will attempt to find data sent from a network connection using the "multi_array" protocol and will also send the resultant information down any network connections.
- array_names : The array names (general data structures) which are to be processed.
- num_arrays : The number of array names supplied. If this is 0, all array names are processed.
- save_unproc_data : If TRUE, then arrays with names which do not match are copied, rather than ignored.
- pre_process : The function which will process the input file prior to any general data structures being processed. The prototype function is dsproc_PROTO_pre_process. If this returns FALSE further processing is aborted.
- process_array : The function which is called to process each general data structure. The prototype function is dsproc_PROTO_process_array.
- post_process : The function which is called to process the multi_array descriptors prior to the output being saved/transmitted. The prototype function is dsproc_PROTO_post_process. This routine will usually add history information and copy over history information from the input array.
- mmap_option : This is passed directly to the dsxfr_get_multi routine. If the input data structure is likely to be modified, this value must be K_CH_MAP_NEVER, otherwise the data may be read-only memory mapped and writing to it will cause a segmentation fault. In addition, the cache parameter for dsxfr_get_multi is set to TRUE.

Returns: Nothing.
Multithreading Level: Unsafe

#### EXPERIMENTAL FUNCTION: subject to change without notice

void dsproc_multi_array (CONST multi_array *multi_desc, char *array_names[], unsigned int num_arrays, flag save_unproc_data, flag (*pre_process) (), flag (*process_array) (), flag (*post_process) () )

Process a Karma data structure.

Parameters:

- multi_desc : The multi_array descriptor to process.
- array_names : The array names (general data structures) which are to be processed.
- num_arrays : The number of array names supplied. If this is 0, all array names are processed.
- save_unproc_data : If TRUE, then arrays with names which do not match are copied, rather than ignored.
- pre_process : The function which will process the input file prior to any general data structures being processed. The prototype function is dsproc_PROTO_pre_process. If this returns FALSE further processing is aborted.
- process_array : The function which is called to process each general data structure. The prototype function is dsproc_PROTO_process_array.
- post_process : The function which is called to process the multi_array descriptors prior to the output being saved/transmitted. The prototype function is dsproc_PROTO_post_process. This routine will usually add history information and copy over history information from the input array.

Returns: Nothing.
Multithreading Level: Unsafe

## Prototype Functions

flag dsproc_PROTO_pre_process (CONST multi_array *multi_desc)

Perform pre-processing on a multi_array data structure.

Parameters:

- multi_desc : The data structure.

Returns: TRUE if processing is to continue, else FALSE.
Multithreading Level: Unsafe

flag dsproc_PROTO_process_array (CONST packet_desc *inp_desc, CONST char *inp_data, packet_desc **out_desc, char **out_data)

Process a general data structure into an output structure.

Parameters:

- inp_desc : The input descriptor.
- inp_data : The input data.
- out_desc : The output descriptor should be written here.
- out_data : The output data pointer should be written here.

Returns: TRUE on success, else FALSE.
Multithreading Level: Unsafe

flag dsproc_PROTO_post_process (CONST multi_array *inp_desc, multi_array *out_desc)

Perform post-processing on a multi_array data structure.

Parameters:

- inp_desc : The input multi_array descriptor.
- out_desc : The output multi_array_descriptor.

Returns: TRUE if the array is to be saved/transmitted, else FALSE.
Multithreading Level: Unsafe

Back to Karma Home Page