CAlive will introduce
contextual #defines. This will allow simplified names to be used in a
contextual { } block attached to the parent thing.
Example:
#define _YES 1
#define _NO 0
// CAlive alternate #define context, similar to "#define myMacro(a,b)"
define myMacro(a,b)
{{
some_function(a, b)
}} contextual {
#define _YES 0xff
#define _NO 0x7f
}
function main
{
// Uses global scope
printf("Value of _YES=%d and _NO=%d\n", _YES, _NO);
// Uses contextual scope
myMacro(_YES, _NO);
}
function some_function
| params int p1, int p2
{
printf("Value of p1=%u and p2=%u\n", p1, p2);
}
In this code, the output will be:
Value of _YES=1 and _NO=0
Value of p1=255 and p2=127
--
Rick C. Hodgin