Line | |
---|
1 | #ifndef MAD_MACRO_H |
---|
2 | #define MAD_MACRO_H |
---|
3 | |
---|
4 | // types |
---|
5 | |
---|
6 | struct char_array; |
---|
7 | struct char_p_array; |
---|
8 | struct name_list; |
---|
9 | struct in_cmd; |
---|
10 | |
---|
11 | struct macro /* stores one line or macro definition */ |
---|
12 | { |
---|
13 | char name[NAME_L]; |
---|
14 | int n_formal; /* no. of formal parameters */ |
---|
15 | int dead; /* set to 1 to prevent line from expansion */ |
---|
16 | struct char_p_array* formal; /* list of formal parameters */ |
---|
17 | struct char_p_array* tokens; /* token pointers into body if split (line) */ |
---|
18 | struct char_array* body; /* contains all statements */ |
---|
19 | int stamp; |
---|
20 | }; |
---|
21 | |
---|
22 | struct macro_list |
---|
23 | { |
---|
24 | int stamp; |
---|
25 | char name[NAME_L]; |
---|
26 | int max, /* max. pointer array size */ |
---|
27 | curr; /* current occupation */ |
---|
28 | struct name_list* list; |
---|
29 | struct macro** macros; |
---|
30 | }; |
---|
31 | |
---|
32 | // interface |
---|
33 | |
---|
34 | int make_macro(char* statement); |
---|
35 | struct macro* new_macro(int n_formal, int length, int p_length); |
---|
36 | |
---|
37 | struct macro_list* new_macro_list(int length); |
---|
38 | void add_to_macro_list(struct macro*, struct macro_list*); |
---|
39 | int remove_from_name_list(char* name, struct name_list*); |
---|
40 | |
---|
41 | void disable_line(char* name, struct macro_list*); |
---|
42 | void replace_lines(struct macro*, int replace, char** reps); |
---|
43 | |
---|
44 | void exec_macro(struct in_cmd*, int pos); |
---|
45 | |
---|
46 | #endif // MAD_MACRO_H |
---|
47 | |
---|
Note: See
TracBrowser
for help on using the repository browser.