summaryrefslogtreecommitdiff
path: root/build/macro.h
blob: 8d3b8d0d2298ab9786eb258ccbf286376cfcbd6b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#ifndef _MACRO_H_
#define _MACRO_H_

/* macro.h - %macro handling */

struct MacroEntry {
    char *name;
    char *expansion;
};

struct MacroContext {
    struct MacroEntry *macroTable;
    int macrosAllocated;
    int firstFree;
};

void initMacros(struct MacroContext *mc);
void freeMacros(struct MacroContext *mc);

void addMacro(struct MacroContext *mc, char *name, char *expansion);

/* Expand all macros in buf, in place */
int expandMacros(struct MacroContext *mc, char *buf);

#endif