libyasm

libyasm/objfmt.h

Go to the documentation of this file.
00001 
00030 #ifndef YASM_OBJFMT_H
00031 #define YASM_OBJFMT_H
00032 
00033 #ifndef YASM_DOXYGEN
00034 
00037 typedef struct yasm_objfmt_base {
00039     const struct yasm_objfmt_module *module;
00040 } yasm_objfmt_base;
00041 #endif
00042 
00044 struct yasm_objfmt_module {
00046     const char *name;
00047 
00049     const char *keyword;
00050 
00054     /*@null@*/ const char *extension;
00055 
00059     const unsigned char default_x86_mode_bits;
00060 
00062     const unsigned char id_at_ok;
00063 
00069     const char **dbgfmt_keywords;
00070 
00074     const char *default_dbgfmt_keyword;
00075 
00077     /*@null@*/ const yasm_directive *directives;
00078 
00080     const yasm_stdmac *stdmacs;
00081 
00089     /*@null@*/ /*@only@*/ yasm_objfmt * (*create) (yasm_object *object);
00090 
00094     void (*output) (yasm_object *o, FILE *f, int all_syms,
00095                     yasm_errwarns *errwarns);
00096 
00100     void (*destroy) (/*@only@*/ yasm_objfmt *objfmt);
00101 
00105     yasm_section * (*add_default_section) (yasm_object *object);
00106 
00110     void (*init_new_section) (yasm_section *section, unsigned long line);
00111 
00115     /*@observer@*/ /*@null@*/ yasm_section *
00116         (*section_switch)(yasm_object *object, yasm_valparamhead *valparams,
00117                           /*@null@*/ yasm_valparamhead *objext_valparams,
00118                           unsigned long line);
00119 
00123     /*@observer@*/ /*@null@*/ yasm_symrec *
00124         (*get_special_sym)(yasm_object *object, const char *name,
00125                            const char *parser);
00126 };
00127 
00133 /*@null@*/ /*@only@*/ yasm_objfmt *yasm_objfmt_create
00134     (const yasm_objfmt_module *module, yasm_object *object);
00135 
00146 void yasm_objfmt_output(yasm_object *object, FILE *f, int all_syms,
00147                         yasm_errwarns *errwarns);
00148 
00152 void yasm_objfmt_destroy(/*@only@*/ yasm_objfmt *objfmt);
00153 
00158 yasm_section *yasm_objfmt_add_default_section(yasm_object *object);
00159 
00165 void yasm_objfmt_init_new_section(yasm_object *object, unsigned long line);
00166 
00176 /*@observer@*/ /*@null@*/ yasm_section *yasm_objfmt_section_switch
00177     (yasm_object *object, yasm_valparamhead *valparams,
00178      /*@null@*/ yasm_valparamhead *objext_valparams, unsigned long line);
00179 
00187 /*@observer@*/ /*@null@*/ yasm_symrec *yasm_objfmt_get_special_sym
00188     (yasm_object *object, const char *name, const char *parser);
00189 
00190 #ifndef YASM_DOXYGEN
00191 
00192 /* Inline macro implementations for objfmt functions */
00193 
00194 #define yasm_objfmt_create(module, object) module->create(object)
00195 
00196 #define yasm_objfmt_output(object, f, all_syms, ews) \
00197     ((yasm_objfmt_base *)((object)->objfmt))->module->output \
00198         (object, f, all_syms, ews)
00199 #define yasm_objfmt_destroy(objfmt) \
00200     ((yasm_objfmt_base *)objfmt)->module->destroy(objfmt)
00201 #define yasm_objfmt_section_switch(object, vpms, oe_vpms, line) \
00202     ((yasm_objfmt_base *)((object)->objfmt))->module->section_switch \
00203         (object, vpms, oe_vpms, line)
00204 #define yasm_objfmt_add_default_section(object) \
00205     ((yasm_objfmt_base *)((object)->objfmt))->module->add_default_section \
00206         (object)
00207 #define yasm_objfmt_init_new_section(section, line) \
00208     ((yasm_objfmt_base *)((object)->objfmt))->module->init_new_section \
00209         (section, line)
00210 #define yasm_objfmt_get_special_sym(object, name, parser) \
00211     ((yasm_objfmt_base *)((object)->objfmt))->module->get_special_sym \
00212         (object, name, parser)
00213 
00214 #endif
00215 
00216 #endif