enable

Enable a method to receive incoming event or query messages.

Syntax

status = enable ( method ) ;

Arguments

list method

Return Value

str status

Warnings

%UNDEFINED : Method 'name' is not a variable.

%BRANCH : Could not find 'method'.

Exceptions

%ARGUMENT : Invalid arguments. Usage: status = enable ( method ) ;

%IDENTIFIER : 'variable' argument is not a valid identifier, literal, or reference

Description

An enabled method is available for execution by EVENT or QUERY messages. The disable method is used to prevent the method from being invoked by incoming EVENT or QUERY messages. All methods are disabled by default.

/*--Example 1 -------------------------------*/
connect() {
  /* Received connect message from sender.
     .
     .
     . */
  
  return ;
}
/* Enable the connect method */
enable ( connect );
/* Enter IDLE state and wait for connect message */
idle();
/*--Example 2 -------------------------------*/
on_message CHECK_MESSAGE() ;
.
.
.
CHECK_MESSAGE()
{
  /* If the incoming method is MYMETHOD, don't execute it */
   if ( method() == "MYMETHOD" ) disable MYMETHOD :
}
      

      

Examples

To execute the example below, press or modify the example to try different variations.

Related Links

disable