Example 2–1 Workspace Structure Definition and Initialization
typedef struct {
unsigned int length;
/** length of workspace **/
void *data;
/** pointer to workspace **/
} ACMSDI_WORKSPACE;
.
.
.
#define ACMSDI_INIT_WORKSPACE(_wksp, _rec)\
{\
_wksp.length = sizeof(_rec);\
_wksp.record = &(_rec);\
}
To pass more than one workspace to a procedure, use an array of the ACMSDI_
WORKSPACE structures. Example 2–2 passes two workspaces.
Example 2–2 Passing Workspaces to a Procedure
ACMSDI_WORKSPACE
wksp_array[2];
struct {
char ctrl_key[5];
char error_message[80];
} control_wksp;
struct {
int id_number;
char first_name[15];
char last_name[25];
} employee_record;
ACMSDI_INIT_WORKSPACE (wksp_array[0], control_wksp);
ACMSDI_INIT_WORKSPACE (wksp_array[1], employee_record);
The array wksp_array is defined with two elements of type ACMSDI_
WORKSPACE. The structure definitions control_wksp and employee_record
define the elements of the array. The two macro ACMSDI_INIT_WORKSPACE
calls initialize the array of structures.
TP Desktop Connector Portable API Client Services 2–5