10.8. Type macro and template structure support
The TYPEMACRO_BOOST module provides infrastructure for defining type macros — custom compile-time type transformations. Type macros allow introducing new type syntax that expands into standard daslang types during compilation.
All functions and symbols are in “typemacro_boost” module, use require to get access to it.
require daslib/typemacro_boost
10.8.1. Structures
- TypeMacroTemplateArgument
struct TypeMacroTemplateArgument
10.8.2. Function annotations
- typemacro_function
Function annotation typemacro_function
- typemacro_template_function
Function annotation typemacro_template_function
10.8.3. Structure macros
- template_tuple
Structure annotation template_tuple
- template_structure
Structure annotation template_structure
- typemacro_documentation
Structure annotation typemacro_documentation
- typemacro_template
Structure annotation typemacro_template
10.8.4. Enum helpers
- int64_to_enum(_enu: auto(ET); value: int64 ): ET
def int64_to_enum (_enu: auto(ET); value: int64) : ET
- Arguments:
_enu : auto(ET)
value : int64
10.8.5. Template structure instantiation
- is_typemacro_template_instance(passArgument: TypeDeclPtr; templateType: TypeDeclPtr; extra: array<tuple<string;string>> = array<tuple<string;string>>() ): bool
def is_typemacro_template_instance (passArgument: TypeDeclPtr; templateType: TypeDeclPtr; extra: array<tuple<string;string>> = array<tuple<string;string>>()) : bool
- Arguments:
passArgument : TypeDeclPtr
templateType : TypeDeclPtr
extra : array<tuple<string;string>>
- make_typemacro_template_instance(instance_type: Structure?; template_type: Structure?; ex: array<tuple<string;string>> = array<tuple<string;string>>() )
def make_typemacro_template_instance (instance_type: Structure?; template_type: Structure?; ex: array<tuple<string;string>> = array<tuple<string;string>>())
- template_structure_name(base: Structure?; arguments: array<TypeMacroTemplateArgument>; extra: array<tuple<string;string>> = array<tuple<string;string>>() ): string
def template_structure_name (base: Structure?; arguments: array<TypeMacroTemplateArgument>; extra: array<tuple<string;string>> = array<tuple<string;string>>()) : string
- Arguments:
base : Structure?
arguments : array< TypeMacroTemplateArgument>
extra : array<tuple<string;string>>
10.8.6. Type inference helpers
- add_structure_aliases(structType: Structure?; args: array<TypeMacroTemplateArgument> )
def add_structure_aliases (structType: Structure?; var args: array<TypeMacroTemplateArgument>)
- Arguments:
structType : Structure?
args : array< TypeMacroTemplateArgument>
- infer_struct_aliases(structType: Structure?; args: array<TypeMacroTemplateArgument> ): bool
def infer_struct_aliases (structType: Structure?; var args: array<TypeMacroTemplateArgument>) : bool
- Arguments:
structType : Structure?
args : array< TypeMacroTemplateArgument>
- infer_template_types(passArgument: TypeDeclPtr; args: array<TypeMacroTemplateArgument> ): TypeDeclPtr
def infer_template_types (passArgument: TypeDeclPtr; var args: array<TypeMacroTemplateArgument>) : TypeDeclPtr
- Arguments:
passArgument : TypeDeclPtr
args : array< TypeMacroTemplateArgument>
- verify_arguments(args: array<TypeMacroTemplateArgument> ): bool
def verify_arguments (var args: array<TypeMacroTemplateArgument>) : bool
- Arguments:
args : array< TypeMacroTemplateArgument>
10.8.7. String constant access
- get_string_const(expr: ExpressionPtr ): string
def get_string_const (expr: ExpressionPtr) : string
- Arguments:
expr : ExpressionPtr
10.8.8. Work tracking
- is_custom_work_done(structType: Structure? ): bool
def is_custom_work_done (structType: Structure?) : bool
- Arguments:
structType : Structure?
- mark_custom_work_done(structType: Structure? )
def mark_custom_work_done (var structType: Structure?)
- Arguments:
structType : Structure?
10.8.9. Type macro arguments
10.8.9.1. typemacro_argument
- typemacro_argument(dimExpr: auto; index: int; constType: ExprConstString; defaultValue: auto(ValueT) ): ValueT
def typemacro_argument (dimExpr: auto; index: int; var constType: ExprConstString; var defaultValue: auto(ValueT)) : ValueT
- Arguments:
dimExpr : auto
index : int
constType : ExprConstString
defaultValue : auto(ValueT)
- typemacro_argument(dimExpr: auto; index: int; constType: auto(ExprConstType); defaultValue: auto(ValueT) ): ValueT