tagged release 0.7.1
[parrot.git] / compilers / pirc / macro / macro.h
blob0884139c8ad9992915e4cbb79635eeeb7f25f5ca
1 /*
2 * $Id$
3 * Copyright (C) 2007, The Perl Foundation.
4 */
5 #ifndef PARROT_PIR_MACRO_H_GUARD
6 #define PARROT_PIR_MACRO_H_GUARD
8 typedef struct list {
9 char *item;
11 struct list *next;
13 } list;
16 typedef struct macro_def {
17 char *name;
18 char *body;
19 int line_defined;
20 list *parameters;
22 struct macro_def *next;
24 } macro_def;
27 /* A constant table represents a "scope" for macro and constants.
28 * All .macro_const and .macro definitions are stored in the "global"
29 * table, but when expanding a macro, the parameter values are stored
30 * in a "local" table, which is "pushed" onto a conceptual stack.
31 * This conceptual stack is implemented by linking the tables together.
32 * When searching in a table, the table elements are search first, and
33 * when the element is not found, the element is looked for in the
34 * table pointed to by the "prev" field.
36 typedef struct constant_table {
37 macro_def *definitions;
38 /* constant tables are linked through this pointer,
39 * and organized as a stack. If a constant is not found
40 * in this table, then the previous table is tried, and so on,
41 * while there is a previous table.
43 struct constant_table *prev;
45 } constant_table;
48 #endif /* PARROT_PIR_MACRO_H_GUARD */
51 * Local variables:
52 * c-file-style: "parrot"
53 * End:
54 * vim: expandtab shiftwidth=4: