Loading...
Searching...
No Matches
macro

Inherits string.

Definition

Representation of a preprocessor macro.

Construct a new macro definition.

A macro stores its identifier together with the metadata required during expansion:

  • replacement text,
  • formal parameter list,
  • variadic status,
  • cycle detection flags,
  • temporary activation state.

The type extends string so that the macro name itself behaves as a string value.

Examples

Object-like macro:

type(macro) :: m
m = macro('PI', '3.1415926535')

Function-like macro:

type(macro) :: m
m = macro('SQR(x)', '((x)*(x))')

Constructors

Initializes a new instance of the Macro Expansion class

Constructor

type(macro) function macro(character(*) name, (optional) character(*) val)
Parameters
[in]namemacro name
[in]val
(optional) value of the macro

Examples

type(macro) :: m
m = macro('_WIN32')
Returns
The constructed macro object.

Creates an initialized Macro Expansion object with the specified name and optional replacement text.

Parameter lists are initialized to empty, variadic expansion is disabled, and direct self-references are marked as cyclic.

Parameters
[in]nameMacro identifier.
[in]valReplacement text (default: empty).
Returns
Initialized macro object.

Definition at line 135 of file macro.f90.


The documentation for this interface was generated from the following file:

Variables

character(:), allocatable value
 Value of the macro.
type(string), dimension(:), allocatable params
 List of parameter for function like macros.
logical is_variadic
 Indicate whether the macro is variadic or not.
logical is_cyclic
 Indicates whether the macro has cyclic dependencies or not.
Variables inherited from string
character(:), allocatable chars
 Variable length character array.