FUNCTIONS ^

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)

Create a new macro definition node and store it in the macro_table table

macro_param *new_macro_param(char const *const value)

Constructor for a 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)

Add a macro parameter by name of name to the macro definition macro.

void new_macro_const(macro_table *const table, char const *const name, char const *const value)

Define a new .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)

Check 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)

Store the character c in macro's body buffer.

void store_macro_string(macro_def *const macro, char *const str, ...)

Store the string 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)

Find the specified macro. If the specified macro does not exist, NULL is returned.

macro_table *new_macro_table(macro_table *const current)

Create a new macro_table structure; set current as its previous. The newly created table is returned.

void delete_macro_table(macro_table *table)

Free resources allocated for the macro_table table.

void declare_macro_local(macro_def *const macro, char *const name)

Declare name as a .macro_local for the macro definition macro.

int is_macro_local(macro_def *const macro, char *const name)

Check whether name was declared as a .macro_local in the macro definition macro.


parrot