In the User Function window:
| Return Type: |
Multiple |
| Input Parameters: |
long a; |
| Output Parameters: |
short z; |
In the state table:
NUMBER func8_short, NUMBER send3_long;
AssignData(send3_long, "ASSIGN", "4") ;
SendData("CUSTOM_SERVER", "TEST_PARMS", 30, "TEST_PARMS_func8",
send3_long) ;
ReceiveData("CUSTOM_SERVER", "TEST_PARMS", 30, "TEST_PARMS_func8",
func8_short) ;
So, using the data in SendData (above):
Example code
char *TEST_PARMS_func8 (a)
long a;
{
long count; /* will return this number of groups */
long i;
char *buf_ptr;
buf_ptr = TP_buffer;
if (a == 2) {
count = 9;
} else if (a == 4) {
count = 3;
} else {
return (NULL);
} /* endif */
/*
* Multiple return the first element MUST be the number
of multiples
*/
*(long *)buf_ptr = count;
buf_ptr += sizeof(count);
/*
* Put each iteration in to the return buffer
* (Squares from 1 to the number of returned elements)
*/
for (i = 1; i <= count; i++) {
*(short *)buf_ptr = i * i;
buf_ptr += sizeof(short);
} /* endfor */
return (TP_buffer);
}