
		/* macros for freezer variables. */

	/* some macros which deal with levels of variables. */
# define MAX_VAR_INDEX  ((REFLONG)0x0000ffffL) /* 2^16-1 actually: maximum index. */
# define MAX_VAR_ELEV   ((REFLONG)0xffL)       /* 2^8-1 (or 255): maximum elevation. */
# define MAX_VAR_LEVEL  ((REFLONG)0xffL)       /* 2^8-1 (or 255): maximum level. */
	/* encoding of index, elevation and level of a variable:
		lower 16 bits: index,
		middle 8 bits: elevation,
		high 8 bits: level. */
# define INDEX_MASK ((REFLONG)0x0000ffffL)
# define ELEV_MASK ((REFLONG)0x00ff0000L)
# define LEVEL_MASK ((REFLONG)0xff000000L)
# define index_of(var) ((unsigned REFLONG)(INDEX_MASK & (var)))
# define elevation_of(var) ((unsigned REFLONG)((ELEV_MASK & (var)) >> 16))
# define level_of(var) ((unsigned REFLONG)((LEVEL_MASK & (var)) >> 24))
# define make_level(level) (((unsigned REFLONG) (level) << 24) & LEVEL_MASK)
# define change_var_level(field, change) (index_of(field) | make_level(level_of(field)+(change)))


	/* metacode definition. */
#define META_ACTIVE          '!'
#define META_BRACKET         '*'
#define META_FIRST_BRACKET   '-'
#define META_SVAR            's'
#define META_EVAR            'e'
#define META_TVAR            't'
#define META_QUOTE           'm'
#define META_QUOTE2          'q'


/* for the new encoding.
          meta-variable encoded as a meta-bracket 
          [s.type '.' s.name-macrodigit '.' (e.expr) e.level] 
          e.level ::= -*
          at present e.expr ::= e.elevation, but must be "any" expressison.
          e.elevation := '1'*
*/

# define type_of_metavar(var_type,var) \
         switch (var -> foll -> pair.c) { \
                case META_EVAR: var_type = 'E'; break; \
                case META_TVAR: var_type = 'T'; break; \
                case META_SVAR: var_type = 'S'; break; \
                default: \
                fprintf(fd, "Illegal type of metavariable. %c\n", var -> foll -> pair.c);\
		break; \
         } 

# define index_of_metavar(var) ((unsigned REFLONG)(var -> foll -> foll -> pair.n))

