isalive

This keyword checks the status of the argument symbol_name, to see whether the variable is in scope, and whether it can be referenced. The value returned by isalive specifies the current status of the variable.

Syntax:

int isalive (symbol_name)
void symbol_name;

image\lamp.gifYou must precede this keyword with ce on the command line.

where:

symbol_name The variable name used for the symbol that isalive tests the scope of.

Return Value

integer

The return value can have one of four values [ -1, 0, 1, 2 ]

 

-1

Symbol does not exist

 

0

Symbol not currently active (cannot be referenced, said to be out of scope).

 

1

Symbol currently active (symbol is part of local procedure, also called an automatic variable).

 

2

Available on the stack (symbol is not part of local procedure, also called an external (active), global (active), or static automatic variable (inactive, but containing stored memory contents) ).

 

Rules

The argument of isalive must be a variable that has no return value. The argument cannot be a function.

Examples

You can use the following syntax for the isalive macro when checking the status of a variable used in its argument. Note: the keywords CEXPRESSION and CE are equivalent.

CEXPRESSION isalive(xxx)  
/* Returns -1 if the symbol xxx does not exist. */

ADD var1
CE isalive(var1)

/* Returns 1 since var1 is defined and active. */