libyasm
|
YASM core types and utility functions. More...
Go to the source code of this file.
Data Structures | |
struct | yasm_stdmac |
Standard macro structure for modules that allows association of a set of standard macros with a parser/preprocessor combination. More... | |
struct | yasm_assoc_data_callback |
YASM associated data callback structure. More... | |
struct | yasm_value |
A value. More... | |
Macros | |
#define | YASM_LIB_DECL |
#define | YASM_VALUE_RSHIFT_MAX 127 |
Maximum value of yasm_value.rshift. | |
Typedefs | |
typedef struct yasm_arch | yasm_arch |
Architecture instance (mostly opaque type). More... | |
typedef struct yasm_preproc | yasm_preproc |
Preprocessor interface. More... | |
typedef struct yasm_parser | yasm_parser |
Parser instance (mostly opaque type). More... | |
typedef struct yasm_objfmt | yasm_objfmt |
Object format interface. More... | |
typedef struct yasm_dbgfmt | yasm_dbgfmt |
Debug format interface. More... | |
typedef struct yasm_listfmt | yasm_listfmt |
List format interface. More... | |
typedef struct yasm_objfmt_module | yasm_objfmt_module |
Object format module interface. More... | |
typedef struct yasm_dbgfmt_module | yasm_dbgfmt_module |
Debug format module interface. More... | |
typedef struct yasm_stdmac | yasm_stdmac |
Standard macro structure for modules that allows association of a set of standard macros with a parser/preprocessor combination. More... | |
typedef struct yasm_assoc_data_callback | yasm_assoc_data_callback |
YASM associated data callback structure. More... | |
typedef struct yasm_errwarns | yasm_errwarns |
Set of collected error/warnings (opaque type). More... | |
typedef struct yasm_bytecode | yasm_bytecode |
Bytecode. More... | |
typedef struct yasm_object | yasm_object |
Object. More... | |
typedef struct yasm_section | yasm_section |
Section (opaque type). More... | |
typedef struct yasm_symtab | yasm_symtab |
Symbol table (opaque type). More... | |
typedef struct yasm_symrec | yasm_symrec |
Symbol record (opaque type). More... | |
typedef struct yasm_expr | yasm_expr |
Expression. More... | |
typedef struct yasm_intnum | yasm_intnum |
Integer value (opaque type). More... | |
typedef struct yasm_floatnum | yasm_floatnum |
Floating point value (opaque type). More... | |
typedef struct yasm_value | yasm_value |
A value. More... | |
typedef struct yasm_linemap | yasm_linemap |
Line number mapping repository (opaque type). More... | |
typedef struct yasm_valparam | yasm_valparam |
Value/parameter pair (opaque type). More... | |
typedef struct yasm_valparamhead | yasm_valparamhead |
List of value/parameters (opaque type). More... | |
typedef struct yasm_directive | yasm_directive |
Directive list entry. More... | |
typedef struct yasm_effaddr | yasm_effaddr |
An effective address. More... | |
typedef struct yasm_insn | yasm_insn |
An instruction. More... | |
typedef enum yasm_expr_op | yasm_expr_op |
Expression operators usable in yasm_expr expressions. More... | |
typedef int(* | yasm_output_value_func )(yasm_value *value, unsigned char *buf, unsigned int destsize, unsigned long offset, yasm_bytecode *bc, int warn, void *d) |
Convert yasm_value to its byte representation. More... | |
typedef int(* | yasm_output_reloc_func )(yasm_symrec *sym, yasm_bytecode *bc, unsigned char *buf, unsigned int destsize, unsigned int valsize, int warn, void *d) |
Convert a symbol reference to its byte representation. More... | |
Enumerations | |
enum | yasm_expr_op { YASM_EXPR_IDENT, YASM_EXPR_ADD, YASM_EXPR_SUB, YASM_EXPR_MUL, YASM_EXPR_DIV, YASM_EXPR_SIGNDIV, YASM_EXPR_MOD, YASM_EXPR_SIGNMOD, YASM_EXPR_NEG, YASM_EXPR_NOT, YASM_EXPR_OR, YASM_EXPR_AND, YASM_EXPR_XOR, YASM_EXPR_XNOR, YASM_EXPR_NOR, YASM_EXPR_SHL, YASM_EXPR_SHR, YASM_EXPR_LOGIC, YASM_EXPR_LOR, YASM_EXPR_LAND, YASM_EXPR_LNOT, YASM_EXPR_LXOR, YASM_EXPR_LXNOR, YASM_EXPR_LNOR, YASM_EXPR_LT, YASM_EXPR_GT, YASM_EXPR_EQ, YASM_EXPR_LE, YASM_EXPR_GE, YASM_EXPR_NE, YASM_EXPR_NONNUM, YASM_EXPR_SEG, YASM_EXPR_WRT, YASM_EXPR_SEGOFF } |
Expression operators usable in yasm_expr expressions. More... | |
Functions | |
YASM_LIB_DECL int | yasm__mergesort (void *base, size_t nmemb, size_t size, int(*compar)(const void *, const void *)) |
Sort an array using merge sort algorithm. More... | |
YASM_LIB_DECL char * | yasm__strsep (char **stringp, const char *delim) |
Separate string by delimiters. More... | |
YASM_LIB_DECL int | yasm__strcasecmp (const char *s1, const char *s2) |
Compare two strings, ignoring case differences. More... | |
YASM_LIB_DECL int | yasm__strncasecmp (const char *s1, const char *s2, size_t n) |
Compare portion of two strings, ignoring case differences. More... | |
YASM_LIB_DECL char * | yasm__xstrdup (const char *str) |
strdup() implementation using yasm_xmalloc(). More... | |
YASM_LIB_DECL char * | yasm__xstrndup (const char *str, size_t max) |
strndup() implementation using yasm_xmalloc(). More... | |
Variables | |
YASM_LIB_DECL void *(* | yasm_xmalloc )(size_t size) |
Error-checking memory allocation. More... | |
YASM_LIB_DECL void *(* | yasm_xcalloc )(size_t nelem, size_t elsize) |
Error-checking memory allocation (with clear-to-0). More... | |
YASM_LIB_DECL void *(* | yasm_xrealloc )(void *oldmem, size_t size) |
Error-checking memory reallocation. More... | |
YASM_LIB_DECL void(* | yasm_xfree )(void *p) |
Error-checking memory deallocation. More... | |
YASM core types and utility functions.
Definition in file coretype.h.
Architecture instance (mostly opaque type).
Definition at line 38 of file coretype.h.
typedef struct yasm_assoc_data_callback yasm_assoc_data_callback |
YASM associated data callback structure.
Many data structures can have arbitrary data associated with them.
typedef struct yasm_bytecode yasm_bytecode |
Bytecode.
Definition at line 93 of file coretype.h.
typedef struct yasm_dbgfmt yasm_dbgfmt |
typedef struct yasm_dbgfmt_module yasm_dbgfmt_module |
Debug format module interface.
Definition at line 53 of file coretype.h.
typedef struct yasm_directive yasm_directive |
Directive list entry.
Definition at line 205 of file coretype.h.
typedef struct yasm_effaddr yasm_effaddr |
An effective address.
Definition at line 210 of file coretype.h.
typedef struct yasm_errwarns yasm_errwarns |
Set of collected error/warnings (opaque type).
Definition at line 90 of file coretype.h.
Expression.
Definition at line 108 of file coretype.h.
typedef enum yasm_expr_op yasm_expr_op |
Expression operators usable in yasm_expr expressions.
typedef struct yasm_floatnum yasm_floatnum |
Floating point value (opaque type).
Definition at line 114 of file coretype.h.
typedef struct yasm_intnum yasm_intnum |
Integer value (opaque type).
Definition at line 110 of file coretype.h.
typedef struct yasm_linemap yasm_linemap |
Line number mapping repository (opaque type).
Definition at line 192 of file coretype.h.
typedef struct yasm_listfmt yasm_listfmt |
typedef struct yasm_object yasm_object |
Object.
Definition at line 96 of file coretype.h.
typedef struct yasm_objfmt yasm_objfmt |
typedef struct yasm_objfmt_module yasm_objfmt_module |
Object format module interface.
Definition at line 51 of file coretype.h.
typedef int(* yasm_output_reloc_func)(yasm_symrec *sym, yasm_bytecode *bc, unsigned char *buf, unsigned int destsize, unsigned int valsize, int warn, void *d) |
Convert a symbol reference to its byte representation.
Usually implemented by object formats and debug formats to keep track of relocations generated by themselves.
sym | symbol |
bc | current bytecode (usually passed into higher-level calling function) |
buf | buffer for byte representation |
destsize | destination size (in bytes) |
valsize | size (in bits) |
warn | enables standard warnings: zero for none; nonzero for overflow/underflow floating point warnings; negative for signed integer warnings, positive for unsigned integer warnings |
d | objfmt-specific data (passed into higher-level calling function) |
Definition at line 296 of file coretype.h.
typedef int(* yasm_output_value_func)(yasm_value *value,unsigned char *buf, unsigned int destsize, unsigned long offset, yasm_bytecode *bc, int warn,void *d) |
Convert yasm_value to its byte representation.
Usually implemented by object formats to keep track of relocations and verify legal expressions. Must put the value into the least significant bits of the destination, unless shifted into more significant bits by the shift parameter. The destination bits must be cleared before being set.
value | value |
buf | buffer for byte representation |
destsize | destination size (in bytes) |
offset | offset (in bytes) of the expr contents from the start of the bytecode (needed for relative) |
bc | current bytecode (usually passed into higher-level calling function) |
warn | enables standard warnings: zero for none; nonzero for overflow/underflow floating point warnings |
d | objfmt-specific data (passed into higher-level calling function) |
Definition at line 275 of file coretype.h.
typedef struct yasm_parser yasm_parser |
Parser instance (mostly opaque type).
Definition at line 42 of file coretype.h.
typedef struct yasm_preproc yasm_preproc |
typedef struct yasm_section yasm_section |
Section (opaque type).
Definition at line 99 of file coretype.h.
typedef struct yasm_stdmac yasm_stdmac |
Standard macro structure for modules that allows association of a set of standard macros with a parser/preprocessor combination.
A NULL-terminated array of these structures is used in a number of module interfaces.
typedef struct yasm_symrec yasm_symrec |
Symbol record (opaque type).
Definition at line 105 of file coretype.h.
typedef struct yasm_symtab yasm_symtab |
Symbol table (opaque type).
Definition at line 102 of file coretype.h.
typedef struct yasm_valparam yasm_valparam |
Value/parameter pair (opaque type).
Definition at line 197 of file coretype.h.
typedef struct yasm_valparamhead yasm_valparamhead |
List of value/parameters (opaque type).
Definition at line 201 of file coretype.h.
typedef struct yasm_value yasm_value |
enum yasm_expr_op |
Expression operators usable in yasm_expr expressions.
Definition at line 218 of file coretype.h.
YASM_LIB_DECL int yasm__mergesort | ( | void * | base, |
size_t | nmemb, | ||
size_t | size, | ||
int(*)(const void *, const void *) | compar | ||
) |
Sort an array using merge sort algorithm.
base | base of array |
nmemb | number of elements in array |
size | size of each array element |
compar | element comparison function |
YASM_LIB_DECL int yasm__strcasecmp | ( | const char * | s1, |
const char * | s2 | ||
) |
Compare two strings, ignoring case differences.
s1 | string 1 |
s2 | string 2 |
YASM_LIB_DECL int yasm__strncasecmp | ( | const char * | s1, |
const char * | s2, | ||
size_t | n | ||
) |
Compare portion of two strings, ignoring case differences.
s1 | string 1 |
s2 | string 2 |
n | maximum number of characters to compare |
YASM_LIB_DECL char* yasm__strsep | ( | char ** | stringp, |
const char * | delim | ||
) |
Separate string by delimiters.
stringp | string |
delim | set of 1 or more delimiters |
YASM_LIB_DECL char* yasm__xstrdup | ( | const char * | str | ) |
strdup() implementation using yasm_xmalloc().
str | string |
YASM_LIB_DECL char* yasm__xstrndup | ( | const char * | str, |
size_t | max | ||
) |
strndup() implementation using yasm_xmalloc().
str | string |
max | maximum number of characters to copy |
YASM_LIB_DECL void*(* yasm_xcalloc)(size_t nelem, size_t elsize) |
Error-checking memory allocation (with clear-to-0).
A default implementation is provided that calls yasm_fatal() on allocation errors. A replacement should never return NULL.
size | number of elements to allocate |
elsize | size (in bytes) of each element |
YASM_LIB_DECL void(* yasm_xfree)(void *p) |
Error-checking memory deallocation.
A default implementation is provided that calls yasm_fatal() on allocation errors.
p | memory block to free |
YASM_LIB_DECL void*(* yasm_xmalloc)(size_t size) |
Error-checking memory allocation.
A default implementation is provided that calls yasm_fatal() on allocation errors. A replacement should never return NULL.
size | number of bytes to allocate |
YASM_LIB_DECL void*(* yasm_xrealloc)(void *oldmem, size_t size) |
Error-checking memory reallocation.
A default implementation is provided that calls yasm_fatal() on allocation errors. A replacement should never return NULL.
oldmem | memory block to resize |
elsize | new size, in bytes |