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

11.4 PSYX Manager

11.4.3 PSYX Calling


long SendPSYXInGroup(long ID, long class, int mustBeLoaded, long msg, 
	int mod, void *msgData);
#define SendPSYX(ID, msg, mod, data) \
	SendPSYXInGroup(ID, EveryPSYXGroup, TRUE, msg, mod, data)
#define SendPSYXGroup(class, msg, mod, data) \
	SendPSYXInGroup('****', class, TRUE, msg, mod, data)
 

Sends the given PSYX a message. The use of mod and msgData depend on the message sent.

ID is the PSYX to which the message is being sent. If ID is '????', the message is sent to each loaded PSYX in class until one accepts to the message. If ID is '****', the message is sent to all PSYXs in class. If class is 0, the call will apply to all classes.

If mustBeLoaded is TRUE, the message will only be sent to PSYX(s) which are loaded. If mustBeLoaded is FALSE with ID == '????', the call will be attempted first with loaded PSYXs.

The return value is the PSYX which received the message, or 0 if the message failed. If ID == '****', the return value is the last PSYX to receive the message.

PSYXerror is set to pe_unknown if the PSYX ID is bad. If the PSYX was not loaded and mustBeLoaded is TRUE, PSYXerror is set to pe_not_loaded. If the specified PSYX is not in the specified class, PSYXerror is set to pe_wrong_group. If the PSYX does not know the message, PSYXerror is set to pe_bad_message.

long SendPSYXInGroupString(long ID, long class, char *stringMsg, 
	int mod, void *msgData);
#define SendPSYXString(ID, str, spec, data) \
	SendPSYXInGroupString(ID, str, spec, data)
 

Like SendPSYXInGroup(), except that a string message is accepted. This string message is converted to a message ID by sending pGetMsgCode to the PSYX.

The errors are the same as for SendPSYXInGroup().

long CallPSYX(long ID, long msg, int mod, ...);
#define GetPSYXMessageCode(ID, str, code) \
	GetPSYXInGroupMessageCode(ID, EveryPSYXGroup, str, code)
#define GetPSYXGroupMessageCode(class, str, code) \
	GetPSYXInGroupMessageCode('????', class, str, code)
 

This function acts differently, depending on whether the message for the PSYX is in a message table or not.

If the message is not in the PSYX's message table, then all of the extra parameters after mod are bundled together as a data block and the pointer to the block is passed in as the msgData.

If the message is in the PSYX's message table, the parameters specified after mod are all passed directly to the function.

Due to this difference in definition, CallPSYX() should used if and only if the message is required to be in the message table.

PSYXerror is set to pe_unknown if the PSYX ID is bad. If the PSYX does not know the message, PSYXerror is set to pe_bad_message.

long GetPSYXInGroupMessageCode(long ID, long class, char *stringMsg, 
	long *msgCode);
 

Sends a the pGetMsgCode message to the PSYX so it can convert the message string into a message code.

ID and class are as with SendPSYXInGroup(), except that an ID of '****' is converted to '????'.

If a PSYX knows the string message, the resulting code is put into *msgCode and the responding PSYX ID is returned.

Errors are as with SendPSYXInGroup().

int FillInFunctionList(long ID, long *msgCodes, int count);
 

Checks the PSYX's message table for each of the codes in the msgCode; if a function is found for the message, the message is replaced in the array by the address of the function; if a function is not found, the message is replaced by 0 and PSYXerror is set to pe_bad_message, but the process continues to the end of msgCodes anyway. count is the length of the msgCodes array.

The function returns TRUE if the whole table was filled in, or FALSE if any error occurred.

PSYXerror is set to pe_unknown if the PSYX ID is bad.


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

Generated with CERN WebMaker