TOC PREV NEXT INDEX

Put your logo here!


6 Classification and Constants (hla.hhf)


This header file contains numeric constants produced by some of the HLA symbol-table compile-time functions. Please see the HLA.HHF header file for a complete list of the supported constants.

6.1 Classification Macros

The hla.hhf module contains some macros that test the type of an identifier at compile time. These macros/functions are the following:

hla.IsUns( identifier )
 

This macro returns a compile-time expression that evaluates true if the specified identifier is an uns8, uns16, or uns32 object.

hla.IsInt( identifier )
 

This macro returns a compile-time expression that evaluates true if the specified identifier is an int8, int16, or int32 object.

hla.IsHex( identifier )
 

This macro returns a compile-time expression that evaluates true if the specified identifier is a byte, word, or dword object.

hla.IsNumber( identifier )
 

This macro returns a compile-time expression that evaluates true if the specified identifier is an uns8, uns16, uns32, int8, int16, int32, byte, word, or dword object.

hla.IsReal( identifier )
 

This macro returns a compile-time expression that evaluates true if the specified identifier is a real32, real64, or real80 object.

hla.IsNumeric( identifier )
 

This macro returns a compile-time expression that evaluates true if the specified identifier is an uns8, uns16, uns32, int8, int16, int32, byte, word, dword, real32, real64, or real80 object.

hla.IsOrdinal( identifier )
 

This macro returns a compile-time expression that evaluates true if the specified identifier is an uns8, uns16, uns32, int8, int16, int32, boolean, char, byte, word, dword, or enumerated data type object.

6.2 @class Constants

The HLA compile-time @class function returns the following values to denote the classification of an identifier. If a symbol appears more than once in a program, the @class function returns the classification value for the symbol currently in scope.
Table 1 @Class Return Values
Name
Value
Description
hla.cIllegal
0
Symbol doesn't have a legal HLA classification.
hla.cConstant
1
Symbol was defined in the CONST section.
hla.cValue
2
Symbol was defined in the VAL section.
hla.cType
3
Symbol was defined in the TYPE section.
hla.cVar
4
Symbol was defined in the VAR section
hla.cParm
5
Symbol is a parameter.
hla.cStatic
6
Symbol was defined in a STATIC, READONLY, or STORAGE section.
hla.cLabel
7
Symbol is a statement label.
hla.cMacro
8
Symbol is a macro.
hla.cKeyword
9
Symbol is an HLA reserved word.
hla.cTerminator
10
Symbol is an HLA TERMINATOR macro.
hla.cProgram
11
PROGRAM or UNIT identifier.
hla.cProc
12
Identifier is the name of a (non-class) procedure.
hla.cClassProc
13
Identifier is the name of a class procedure.
hla.cClassIter
14
Identifier is the name of a class iterator.
hla.cMethod
15
Identifier is the name of a class method.
hla.cIterator
16
Identifier is the name of a (non-class) iterator.
hla.cNamespace
17
Identifier is a name space ID.
hla.cRegister
18
Identifier is an 80x86 register name.
hla.cNone
19
Reserved.

6.3 HLA pType Constants

The HLA @ptype compile-time function returns the following values for the symbol you pass as a parameter to the function.

Table 2 : @pType Return Values
Symbol
Value
Description
hla.ptIllegal
0
Symbol is undefined or is not an object to which a type can be applied.
hla.ptBoolean
1
Symbol is of type boolean.
hla.ptEnum
2
Symbol is an enumerated type.
hla.ptUns8
3
Symbol is an UNS8 object.
hla.ptUns16
4
Symbol is an UNS16 object.
hla.ptUns32
5
Symbol is an UNS32 object.
hla.ptByte
6
Symbol is a BYTE object.
hla.ptWord
7
Symbol is a WORD object.
hla.ptDWord
8
Symbol is a DWORD object.
hla.ptInt8
9
Symbol is an INT8 object.
hla.ptInt16
10
Symbol is an INT16 object.
hla.ptInt32
11
Symbol is an INT32 object.
hla.ptChar
12
Symbol is of type CHAR.
hla.ptReal32
13
Symbol is a REAL32 object.
hla.ptReal64
14
Symbol is a REAL64 object.
hla.ptReal80
15
Symbol is a REAL80 object.
hla.ptString
16
Symbol has the STRING type.
hla.ptCset
17
Symbol's type is CSET.
hla.ptArray
18
The symbol is an array object.
hla.ptRecord
19
The symbol is a record object.
hla.ptUnion
20
The symbol is a union object.
hla.ptClass
21
The symbol is a class object.
hla.ptProcptr
22
The symbol's type is "pointer to a procedure".
hla.ptThunk
23
The symbol is a THUNK type.
hla.ptPointer
24
The symbol is a POINTER object.
hla.ptQWord
25
The symbol is a QWORD object.
hla.ptTByte
26
The symbol is a TBYTE (ten-byte) object.
hla.ptLabel
27
The symbol is a statement label object.
hla.ptProc
28
The symbol denotes a procedure.
hla.ptMethod
29
The symbol denotes a method.
hla.ptClassProc
30
The symbol is a procedure within a class.
hla.ptClassIter
31
The symbol denotes an iterator within a class.
hla.ptProgram
32
The symbol is the program's or unit's identifier.
hla.ptMacro
33
The identifier is a macro.
hla.ptText
34
The identifier is a text object (note: @ptype does not return this value since HLA expands the text prior to processing by @ptype).
hla.ptNamespace
35
The identifier is a namespace ID.
hla.ptSegment
36
The identifier is a segment ID.
hla.ptAnonRec
37
The identifier is an anonymous record within a union (internal use only, @ptype will never return this value).
hla.ptVariant
38
This value is reserved for internal use by HLA.
hla.ptError
39
This value indicates a cascading error in an expression. Generally, you will not get this value from @ptype unless there was some sort of error in the parameter to pass to @ptype.

6.4 @pClass Return Values

The HLA @pClass function expects a procedure's parameter name as its sole parameter. It returns one of the following constants that denotes the parameter passing mechanism for the parameter. Note that @pClass' return values are defined only for parameter identifiers.

Table 3 @pClass Return Values
Symbol
Value
Description
hla.illegal_pc
0
May be returned if the symbol is not a parameter.
hla.valp_pc
1
Returned if parameter is passed by value.
hla.refp_pc
2
@pClass returns this value if you pass the parameter by reference.
hla.vrp_pc
3
Denotes that you've passed the parameter by value/result.
hla.result_pc
4
This value means that you've passed the parameter by result.
hla.name_pc
5
This value indicates that you've passed the parameter by name.
hla.lazy_pc
6
This value indicates that you've passed the parameter by lazy evaluation.

6.5 @section Return Results

The following constants correspond to bits in the value returned by @section. They denote the current position of the compiler in the code.

Table 4
Symbol
Value
Description
hla.inConst
1
Bit zero is set if HLA is current processing definitions in a CONST section.
hla.inVal
2
Bit one is set if HLA is current processing definitions in a VAL section.
hla.inType
4
Bit two is set if HLA is current processing definitions in a TYPE section.
hla.inVar
8
Bit three is set if HLA is current processing definitions in a VAR section.
hla.inStatic
$10
Bit four is set if HLA is current processing definitions in a STATIC section.
hla.inReadonly
$20
Bit five is set if HLA is current processing definitions in a READONLY section.
hla.inStorage
$40
Bit six is set if HLA is current processing definitions in a STORAGE section.
hla.inMain
$1000
Bit 12 is set if HLA is current processing statements in the main program.
hla.inProcedure
$2000
Bit 13 is set if HLA is current processing statements in a procedure.
hla.inMethod
$4000
Bit 14 is set if HLA is current processing statements in a method.
hla.inIterator
$8000
Bit 15 is set if HLA is current processing statements in an iterator.
hla.inMacro
$1_0000
Bit 16 is set if HLA is current processing statements in a macro.
hla.inKeyword
$2_0000
Bit 17 is set if HLA is current processing statements in a keyword macro.
hla.inTerminator
$4_0000
Bit 18 is set if HLA is current processing statements in a terminator macro.
hla.inThunk
$8_0000
Bit 19 is set if HLA is current processing statements in a thunk's body.
hla.inUnit
$80_0000
Bit 23 is set if HLA is current processing statements in a unit.
hla.inProgram
$100_0000
Bit 24 is set if HLA is current processing statements in a program (not a unit).
hla.inRecord
$200_0000
Bit 25 is set if HLA is current processing declarations in a record definition.
hla.inUnion
$400_0000
Bit 26 is set if HLA is current processing declarations in a union.
hla.inClass
$800_0000
Bit 27 is set if HLA is current processing declarations in a class.
hla.inNamespace
$1000_0000
Bit 28 is set if HLA is current processing declarations in a union.

6.6 hla.genLabel Macro

The hla.genlabel macro generates a sequence of strings that are unique, legal, HLA identifiers (within the current compilation, do not use these as public symbols). Typically, you would take the string that this macro returns and convert that string to an actual symbol using the @TEXT function.

Here's the definition of getLabel in the HLA header file:

val

_hla_labelCnt_ := 0;

#macro genLabel;

"_genLabel_" + string( hla._hla_labelCnt_ ) + "_"

?hla._hla_labelCnt_ := hla._hla_labelCnt_ + 1;

#endmacro;


 


TOC PREV NEXT INDEX