[Next] [Previous] [Up] [Top] [Contents] [Index]

6.1 Implementing Custom Actions

6.1.2 Dereferencing Parameters

After a PSYX has accepted an action, it will recieve a pGetProcParams message asking it to dereference a set of action parameters. The msgData parameter for this message will point to a structure:

typedef struct {
	long proc;
	short *paramc;
	short *params;
	Ptr	*return_params;
	short trial;
	short event;
} GetPSYXActionParamParams;

long proc; In - the msgCode of the action

short *paramc; In/Out - A pointer to the number of parameters passed in. This number should be modified if a different number of parameters is passed out after dereferencing.

short *params; In - An array of indices to be used with GetParamString() to get the string representations of the parameters.

Ptr *return_params; Out - A pointer to an array of pointers to the dereferenced parameters. This pointer will be passed back in when the action is executed.

short trial; In - The trial in which the action will be executed.

short event; In - The event which owns the action.

In response to this message, the PSYX should read each parameter and determine whether it needs to be pre-processed in some way (e.g. converted to a number, or to some internal representation). An array of pointers, each pointing to the PSYX dereferenced form of its respective parameter, should be created and passed back in return_params. If the number of pointers in the array is different from the value passed in via paramc, then *paramc should be updated to represent the number of pointers passed out.

The pointer array in return_params will be passed back to the PSYX when the action is executed. It should be allocated with the IMSMalloc() function (called just like malloc()). If it is, then it will be freed automatically when the Trial Manager frees its internal data structures, otherwise the PSYX will have to keep track of it and free it when it is deinitialized.

The string values referred to by *params should be read using the GetParamString() function. For example, to get the string value of the first parameter, call

str = GetParamString(msgData->params[0])

This will return a read only string containing the parameter value to be dereferenced.

PSYX Programmer's Manual - 24 AUG 95
[Next] [Previous] [Up] [Top] [Contents] [Index]

Generated with CERN WebMaker