parrotcode: Untitled | |
Contents | Compilers |
This file contains functions that manage the macro datastructures. Actual expansion of the macros is completely handled in the lexer (pir.l).
macro_def *new_macro(macro_table *const table, char *const name, int lineno)
table
macro_param *new_macro_param(char const *const value)
macro_param
struct object.
Initializes the name
attribute of the macro_param
object to value
.
A pointer to the newly allocated macro_param
object is returned.void add_macro_param(macro_def *const macro, char *const name)
name
to the macro definition macro
.void new_macro_const(macro_table *const table, char const *const name, char const *const value)
.macro_const
,
by name of name
as an alias for value
The new macro const is entered in the macro_table table
void check_size(macro_def *const macro, unsigned length)
macro
's buffer size whether length
bytes can be added; if not,
then the buffer is doubled in size.void store_macro_char(macro_def *const macro, char c)
c
in macro
's body buffer.void store_macro_string(macro_def *const macro, char *const str, ...)
str
in macro
's body buffer.
The total number of characters to be written should not exceed MAX_NUM_CHARS.
It's not known beforehand how much space we need in the buffer due to the var.
arg.
list.macro_def *find_macro(constant_table *const table, char *const name)
macro_table *new_macro_table(macro_table *const current)
current
as its previous.
The newly created table is returned.void delete_macro_table(macro_table *table)
table
.void declare_macro_local(macro_def *const macro, char *const name)
name
as a .macro_local
for the macro definition macro
.int is_macro_local(macro_def *const macro, char *const name)
name
was declared as a .macro_local
in the macro definition macro
.
|