Loading...
Searching...
No Matches
macro.f90

Go to the source code of this file.

Data Types

interface  macro
 Derived type representing a single preprocessor macro Extends string with macro-specific fields: replacement value, parameters, variadic flag, and cyclic self-reference detection. More...
interface  add
 Add one or more macros to a dynamic table. More...
interface  clear
 Remove all macros from a table. More...
interface  get
 Retrieve a macro by index. More...
interface  insert
 Insert more macro to a dynamic table. More...
interface  remove
 Remove a macro at given index. More...
interface  sizeof
 Return current number of stored macros. More...

Functions/Subroutines

type(macro) function macro_new (name, val)
 Construct a new macro object.
character(:) function, allocatable, public expand_all (ctx, macros, stitch, has_extra, implicit_conti)
 Fully expand a line including predefined macros (FILE, LINE, etc.) First performs normal macro expansion via expand_macros(), then substitutes standard predefined tokens with current file/line/date information.
character(:) function, allocatable, public expand_macros (line, macros, stitch, implicit_conti, ctx)
 Core recursive macro expander (handles function-like, variadic, #, ##).
logical function, public is_defined (name, macros, idx)
 Check if a macro with given name exists in table.
character(:) function, allocatable tostring (any)
 Generic conversion of polymorphic value to string Used internally during macro argument stringification and debugging. Supports integers, reals, logicals, characters, and complex.
subroutine add_to (array, val)
 Internal helper: grow dynamic macro array in chunks for efficiency Adds a new macro to the allocatable array, growing in BUFFER_SIZE increments. Also detects direct self-references (A → A) and marks both sides as cyclic.
subroutine add_item (this, m)
 Add a complete macro object to the table.
subroutine add_item_from_name (this, name)
 Add macro by name only (value = empty).
subroutine add_item_from_name_and_value (this, name, value)
 Add macro with name and replacement text.
subroutine add_range (this, m)
 Add multiple macros at once.
subroutine clear_item (this)
 Remove all macros from table.
type(macro) function, allocatable get_item (this, key)
 Retrieve macro by 1-based index.
subroutine insert_item (this, i, m)
 Insert macro at specific position.
integer function size_item (this)
 Return number of defined macros.
subroutine remove_item (this, i)
 Remove macro at given index.

Variables

integer, parameter buffer_size = 256
 Default buffer size.