libyasm

libyasm/coretype.h

Go to the documentation of this file.
00001 
00030 #ifndef YASM_CORETYPE_H
00031 #define YASM_CORETYPE_H
00032 
00033 #ifndef YASM_LIB_DECL
00034 #define YASM_LIB_DECL
00035 #endif
00036 
00038 typedef struct yasm_arch yasm_arch;
00040 typedef struct yasm_preproc yasm_preproc;
00042 typedef struct yasm_parser yasm_parser;
00044 typedef struct yasm_objfmt yasm_objfmt;
00046 typedef struct yasm_dbgfmt yasm_dbgfmt;
00048 typedef struct yasm_listfmt yasm_listfmt;
00049 
00051 typedef struct yasm_objfmt_module yasm_objfmt_module;
00053 typedef struct yasm_dbgfmt_module yasm_dbgfmt_module;
00054 
00060 typedef struct yasm_stdmac {
00061     const char *parser;         
00062     const char *preproc;        
00067     const char **macros;
00068 } yasm_stdmac;
00069 
00073 typedef struct yasm_assoc_data_callback {
00077     void (*destroy) (/*@only@*/ void *data);
00078 
00084     void (*print) (void *data, FILE *f, int indent_level);
00085 } yasm_assoc_data_callback;
00086 
00090 typedef struct yasm_errwarns yasm_errwarns;
00091 
00093 typedef struct yasm_bytecode yasm_bytecode;
00094 
00096 typedef struct yasm_object yasm_object;
00097 
00099 typedef struct yasm_section yasm_section;
00100 
00102 typedef struct yasm_symtab yasm_symtab;
00103 
00105 typedef struct yasm_symrec yasm_symrec;
00106 
00108 typedef struct yasm_expr yasm_expr;
00110 typedef struct yasm_intnum yasm_intnum;
00114 typedef struct yasm_floatnum yasm_floatnum;
00115 
00121 typedef struct yasm_value {
00126     /*@null@*/ /*@only@*/ yasm_expr *abs;
00127 
00131     /*@null@*/ /*@dependent@*/ yasm_symrec *rel;
00132 
00134     /*@null@*/ /*@dependent@*/ yasm_symrec *wrt;
00135 
00139     unsigned int seg_of : 1;
00140 
00145     unsigned int rshift : 7;
00146 
00152     unsigned int curpos_rel : 1;
00153 
00158     unsigned int ip_rel : 1;
00159 
00164     unsigned int jump_target : 1;
00165 
00172     unsigned int section_rel : 1;
00173 
00175     unsigned int no_warn : 1;
00176 
00180     unsigned int sign : 1;
00181 
00183     unsigned int size : 8;
00184 } yasm_value;
00185 
00187 #define YASM_VALUE_RSHIFT_MAX   127
00188 
00192 typedef struct yasm_linemap yasm_linemap;
00193 
00197 typedef struct yasm_valparam yasm_valparam;
00201 typedef struct yasm_valparamhead yasm_valparamhead;
00205 typedef struct yasm_directive yasm_directive;
00206 
00210 typedef struct yasm_effaddr yasm_effaddr;
00211 
00215 typedef struct yasm_insn yasm_insn;
00216 
00218 typedef enum yasm_expr_op {
00219     YASM_EXPR_IDENT,    
00220     YASM_EXPR_ADD,      
00221     YASM_EXPR_SUB,      
00222     YASM_EXPR_MUL,      
00223     YASM_EXPR_DIV,      
00224     YASM_EXPR_SIGNDIV,  
00225     YASM_EXPR_MOD,      
00226     YASM_EXPR_SIGNMOD,  
00227     YASM_EXPR_NEG,      
00228     YASM_EXPR_NOT,      
00229     YASM_EXPR_OR,       
00230     YASM_EXPR_AND,      
00231     YASM_EXPR_XOR,      
00232     YASM_EXPR_XNOR,     
00233     YASM_EXPR_NOR,      
00234     YASM_EXPR_SHL,      
00235     YASM_EXPR_SHR,      
00236     YASM_EXPR_LOR,      
00237     YASM_EXPR_LAND,     
00238     YASM_EXPR_LNOT,     
00239     YASM_EXPR_LXOR,     
00240     YASM_EXPR_LXNOR,    
00241     YASM_EXPR_LNOR,     
00242     YASM_EXPR_LT,       
00243     YASM_EXPR_GT,       
00244     YASM_EXPR_EQ,       
00245     YASM_EXPR_LE,       
00246     YASM_EXPR_GE,       
00247     YASM_EXPR_NE,       
00248     YASM_EXPR_NONNUM,   
00249     YASM_EXPR_SEG,      
00250     YASM_EXPR_WRT,      
00252     YASM_EXPR_SEGOFF    
00253 } yasm_expr_op;
00254 
00273 typedef int (*yasm_output_value_func)
00274     (yasm_value *value, /*@out@*/ unsigned char *buf, unsigned int destsize,
00275      unsigned long offset, yasm_bytecode *bc, int warn, /*@null@*/ void *d);
00276 
00294 typedef int (*yasm_output_reloc_func)
00295     (yasm_symrec *sym, yasm_bytecode *bc, unsigned char *buf,
00296      unsigned int destsize, unsigned int valsize, int warn, void *d);
00297 
00305 YASM_LIB_DECL
00306 int yasm__mergesort(void *base, size_t nmemb, size_t size,
00307                     int (*compar)(const void *, const void *));
00308 
00315 YASM_LIB_DECL
00316 /*@null@*/ char *yasm__strsep(char **stringp, const char *delim);
00317 
00324 YASM_LIB_DECL
00325 int yasm__strcasecmp(const char *s1, const char *s2);
00326 
00334 YASM_LIB_DECL
00335 int yasm__strncasecmp(const char *s1, const char *s2, size_t n);
00336 
00342 YASM_LIB_DECL
00343 /*@only@*/ char *yasm__xstrdup(const char *str);
00344 
00351 YASM_LIB_DECL
00352 /*@only@*/ char *yasm__xstrndup(const char *str, size_t max);
00353 
00360 YASM_LIB_DECL
00361 extern /*@only@*/ /*@out@*/ void * (*yasm_xmalloc) (size_t size);
00362 
00370 YASM_LIB_DECL
00371 extern /*@only@*/ void * (*yasm_xcalloc) (size_t nelem, size_t elsize);
00372 
00380 YASM_LIB_DECL
00381 extern /*@only@*/ void * (*yasm_xrealloc)
00382     (/*@only@*/ /*@out@*/ /*@returned@*/ /*@null@*/ void *oldmem, size_t size)
00383     /*@modifies oldmem@*/;
00384 
00389 YASM_LIB_DECL
00390 extern void (*yasm_xfree) (/*@only@*/ /*@out@*/ /*@null@*/ void *p)
00391     /*@modifies p@*/;
00392 
00393 #endif