00001
00034 #ifndef YASM_PREPROC_H
00035 #define YASM_PREPROC_H
00036
00037 #ifndef YASM_DOXYGEN
00038
00041 typedef struct yasm_preproc_base {
00043 const struct yasm_preproc_module *module;
00044 } yasm_preproc_base;
00045 #endif
00046
00048 typedef struct yasm_preproc_module {
00050 const char *name;
00051
00053 const char *keyword;
00054
00068 yasm_preproc * (*create) (const char *in_filename,
00069 yasm_symtab *symtab,
00070 yasm_linemap *lm,
00071 yasm_errwarns *errwarns);
00072
00076 void (*destroy) ( yasm_preproc *preproc);
00077
00081 char * (*get_line) (yasm_preproc *preproc);
00082
00086 size_t (*get_included_file) (yasm_preproc *preproc, char *buf,
00087 size_t max_size);
00088
00092 void (*add_include_file) (yasm_preproc *preproc, const char *filename);
00093
00097 void (*predefine_macro) (yasm_preproc *preproc, const char *macronameval);
00098
00102 void (*undefine_macro) (yasm_preproc *preproc, const char *macroname);
00103
00107 void (*define_builtin) (yasm_preproc *preproc, const char *macronameval);
00108
00112 void (*add_standard) (yasm_preproc *preproc, const char **macros);
00113 } yasm_preproc_module;
00114
00126 yasm_preproc *yasm_preproc_create
00127 (yasm_preproc_module *module, const char *in_filename,
00128 yasm_symtab *symtab, yasm_linemap *lm, yasm_errwarns *errwarns);
00129
00133 void yasm_preproc_destroy( yasm_preproc *preproc);
00134
00139 char *yasm_preproc_get_line(yasm_preproc *preproc);
00140
00147 size_t yasm_preproc_get_included_file(yasm_preproc *preproc,
00148 char *buf, size_t max_size);
00149
00154 void yasm_preproc_add_include_file(yasm_preproc *preproc,
00155 const char *filename);
00156
00161 void yasm_preproc_predefine_macro(yasm_preproc *preproc,
00162 const char *macronameval);
00163
00168 void yasm_preproc_undefine_macro(yasm_preproc *preproc, const char *macroname);
00169
00174 void yasm_preproc_define_builtin(yasm_preproc *preproc,
00175 const char *macronameval);
00176
00182 void yasm_preproc_add_standard(yasm_preproc *preproc,
00183 const char **macros);
00184
00185 #ifndef YASM_DOXYGEN
00186
00187
00188
00189 #define yasm_preproc_create(module, in_filename, symtab, lm, ews) \
00190 module->create(in_filename, symtab, lm, ews)
00191
00192 #define yasm_preproc_destroy(preproc) \
00193 ((yasm_preproc_base *)preproc)->module->destroy(preproc)
00194 #define yasm_preproc_get_line(preproc) \
00195 ((yasm_preproc_base *)preproc)->module->get_line(preproc)
00196 #define yasm_preproc_get_included_file(preproc, buf, max_size) \
00197 ((yasm_preproc_base *)preproc)->module->get_included_file(preproc, buf, max_size)
00198 #define yasm_preproc_add_include_file(preproc, filename) \
00199 ((yasm_preproc_base *)preproc)->module->add_include_file(preproc, filename)
00200 #define yasm_preproc_predefine_macro(preproc, macronameval) \
00201 ((yasm_preproc_base *)preproc)->module->predefine_macro(preproc, \
00202 macronameval)
00203 #define yasm_preproc_undefine_macro(preproc, macroname) \
00204 ((yasm_preproc_base *)preproc)->module->undefine_macro(preproc, macroname)
00205 #define yasm_preproc_define_builtin(preproc, macronameval) \
00206 ((yasm_preproc_base *)preproc)->module->define_builtin(preproc, \
00207 macronameval)
00208 #define yasm_preproc_add_standard(preproc, macros) \
00209 ((yasm_preproc_base *)preproc)->module->add_standard(preproc, \
00210 macros)
00211
00212 #endif
00213
00214 #endif