libyasm
preproc.h
Go to the documentation of this file.
1 
30 #ifndef YASM_PREPROC_H
31 #define YASM_PREPROC_H
32 
33 #ifndef YASM_DOXYGEN
34 
37 typedef struct yasm_preproc_base {
39  const struct yasm_preproc_module *module;
40 } yasm_preproc_base;
41 #endif
42 
44 typedef struct yasm_preproc_module {
46  const char *name;
47 
49  const char *keyword;
50 
64  /*@only@*/ yasm_preproc * (*create) (const char *in_filename,
65  yasm_symtab *symtab,
66  yasm_linemap *lm,
67  yasm_errwarns *errwarns);
68 
72  void (*destroy) (/*@only@*/ yasm_preproc *preproc);
73 
77  char * (*get_line) (yasm_preproc *preproc);
78 
82  size_t (*get_included_file) (yasm_preproc *preproc, /*@out@*/ char *buf,
83  size_t max_size);
84 
88  void (*add_include_file) (yasm_preproc *preproc, const char *filename);
89 
93  void (*predefine_macro) (yasm_preproc *preproc, const char *macronameval);
94 
98  void (*undefine_macro) (yasm_preproc *preproc, const char *macroname);
99 
103  void (*define_builtin) (yasm_preproc *preproc, const char *macronameval);
104 
108  void (*add_standard) (yasm_preproc *preproc, const char **macros);
110 
123  (yasm_preproc_module *module, const char *in_filename,
124  yasm_symtab *symtab, yasm_linemap *lm, yasm_errwarns *errwarns);
125 
129 void yasm_preproc_destroy(/*@only@*/ yasm_preproc *preproc);
130 
135 char *yasm_preproc_get_line(yasm_preproc *preproc);
136 
144  /*@out@*/ char *buf, size_t max_size);
145 
151  const char *filename);
152 
158  const char *macronameval);
159 
164 void yasm_preproc_undefine_macro(yasm_preproc *preproc, const char *macroname);
165 
171  const char *macronameval);
172 
179  const char **macros);
180 
181 #ifndef YASM_DOXYGEN
182 
183 /* Inline macro implementations for preproc functions */
184 
185 #define yasm_preproc_create(module, in_filename, symtab, lm, ews) \
186  module->create(in_filename, symtab, lm, ews)
187 
188 #define yasm_preproc_destroy(preproc) \
189  ((yasm_preproc_base *)preproc)->module->destroy(preproc)
190 #define yasm_preproc_get_line(preproc) \
191  ((yasm_preproc_base *)preproc)->module->get_line(preproc)
192 #define yasm_preproc_get_included_file(preproc, buf, max_size) \
193  ((yasm_preproc_base *)preproc)->module->get_included_file(preproc, buf, max_size)
194 #define yasm_preproc_add_include_file(preproc, filename) \
195  ((yasm_preproc_base *)preproc)->module->add_include_file(preproc, filename)
196 #define yasm_preproc_predefine_macro(preproc, macronameval) \
197  ((yasm_preproc_base *)preproc)->module->predefine_macro(preproc, \
198  macronameval)
199 #define yasm_preproc_undefine_macro(preproc, macroname) \
200  ((yasm_preproc_base *)preproc)->module->undefine_macro(preproc, macroname)
201 #define yasm_preproc_define_builtin(preproc, macronameval) \
202  ((yasm_preproc_base *)preproc)->module->define_builtin(preproc, \
203  macronameval)
204 #define yasm_preproc_add_standard(preproc, macros) \
205  ((yasm_preproc_base *)preproc)->module->add_standard(preproc, \
206  macros)
207 
208 #endif
209 
210 #endif