libyasm

libyasm/listfmt.h

Go to the documentation of this file.
00001 
00030 #ifndef YASM_LISTFMT_H
00031 #define YASM_LISTFMT_H
00032 
00033 #ifndef YASM_DOXYGEN
00034 
00037 typedef struct yasm_listfmt_base {
00039     const struct yasm_listfmt_module *module;
00040 } yasm_listfmt_base;
00041 #endif
00042 
00044 typedef struct yasm_listfmt_module {
00046     const char *name;
00047 
00049     const char *keyword;
00050 
00058     /*@null@*/ /*@only@*/ yasm_listfmt * (*create)
00059         (const char *in_filename, const char *obj_filename);
00060 
00064     void (*destroy) (/*@only@*/ yasm_listfmt *listfmt);
00065 
00069     void (*output) (yasm_listfmt *listfmt, FILE *f, yasm_linemap *linemap,
00070                     yasm_arch *arch);
00071 } yasm_listfmt_module;
00072 
00077 const char *yasm_listfmt_keyword(const yasm_listfmt *listfmt);
00078 
00087 /*@null@*/ /*@only@*/ yasm_listfmt *yasm_listfmt_create
00088     (const yasm_listfmt_module *module, const char *in_filename,
00089      const char *obj_filename);
00090 
00094 void yasm_listfmt_destroy(/*@only@*/ yasm_listfmt *listfmt);
00095 
00103 void yasm_listfmt_output(yasm_listfmt *listfmt, FILE *f,
00104                          yasm_linemap *linemap, yasm_arch *arch);
00105 
00106 #ifndef YASM_DOXYGEN
00107 
00108 /* Inline macro implementations for listfmt functions */
00109 
00110 #define yasm_listfmt_keyword(listfmt) \
00111     (((yasm_listfmt_base *)listfmt)->module->keyword)
00112 
00113 #define yasm_listfmt_create(module, in_filename, obj_filename) \
00114     module->create(in_filename, obj_filename)
00115 
00116 #define yasm_listfmt_destroy(listfmt) \
00117     ((yasm_listfmt_base *)listfmt)->module->destroy(listfmt)
00118 
00119 #define yasm_listfmt_output(listfmt, f, linemap, a) \
00120     ((yasm_listfmt_base *)listfmt)->module->output(listfmt, f, linemap, a)
00121 
00122 #endif
00123 
00124 #endif