In the User Function window:
Return Type: |
Multiple |
Input Parameters: |
long a; struct b { long aa; char bb[20]; short cc; }; |
Output Parameters: |
long y; char z[20]; |
In the state table:
NUMBER func10_long, STRING func10_string, STRING send1_char, NUMBER send3_long, STRING send3_short, NUMBER send9_long; AssignData(send3_long, "ASSIGN", "10") AssignData(send9_long, "ASSIGN", "1") ; AssignData(send1_char, "ASSIGN", "f10") ; AssignData(send3_short, "ASSIGN", "2") ; SendData("CUSTOM_SERVER", "TEST_PARMS", 30, "TEST_PARMS_func10", send3_long, send9_long, send1_char, send3_short) ; ReceiveData("CUSTOM_SERVER", "TEST_PARMS", 30, "TEST_PARMS_func10", func10_long, func10_string) ;
So, using the data in SendData (above), the values for successive ReceiveData actions are:
func10_long |
func10_string |
1 |
f10 |
2 |
f10 |
3 |
f10 |
4 |
f10 |
A fifth ReceiveData has the edge EDGE_RECEIVE_DATA_NO_MORE_DATA.
Example code
char *TEST_PARMS_func10 (a, b) long a; TEST_PARMS_func10_1_ST *b; /* System Generated */ { long count; /* will return this number of groups */ long i; char *buf_ptr; if (a > 4) { count = 4; } else if (a < 1) { count = 1; } else { count = a; } /* endif */ buf_ptr = TP_buffer; /* * 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 */ for (i = 1; i <= count; i++) { *(long *)buf_ptr = i; buf_ptr += sizeof (i); strcpy (buf_ptr, b->TEST_PARMS_func10_bb); buf_ptr += strlen (b->TEST_PARMS_func10_bb) + 1; } /* endfor */ return(TP_buffer); }