Supplementing Generated C : Referencing Model Elements : Assigning Values to Rational Statemate Elements : Example

Example

The following is a supplemented basic activity that processes X,Y and generates two events according to the result: PROCESS_OK and PROCESS_ERROR.

void user_code_for_filter()
{
/* Parameters :
Input int X ;
Input int Y ;
Output event PROCESS_OK ;
Output event PROCESS_ERROR ;
*/
}

The supplemented procedure is shown below:

void user_code_for_filter()
{
/* Parameters :
Input int X ;
Input int Y ;
Output event PROCESS_OK ;
Output event PROCESS_ERROR ;
*/
apply_filter(X, Y, Z);
if (in_range(Z))
gen(&PROCESS_OK);
else
gen(&PROCESS_ERROR);
}