libyasm/coretype.h File Reference

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...

Defines

#define YASM_VALUE_RSHIFT_MAX   127
 Maximum value of yasm_value.rshift.

Typedefs

typedef yasm_arch yasm_arch
 Architecture instance (mostly opaque type).
typedef yasm_preproc yasm_preproc
 Preprocessor interface.
typedef yasm_parser yasm_parser
 Parser instance (mostly opaque type).
typedef yasm_objfmt yasm_objfmt
 Object format interface.
typedef yasm_dbgfmt yasm_dbgfmt
 Debug format interface.
typedef yasm_listfmt yasm_listfmt
 List format interface.
typedef yasm_objfmt_module yasm_objfmt_module
 Object format module interface.
typedef yasm_dbgfmt_module yasm_dbgfmt_module
 Debug format module interface.
typedef yasm_errwarns yasm_errwarns
 Set of collected error/warnings (opaque type).
typedef yasm_bytecode yasm_bytecode
 Bytecode.
typedef yasm_object yasm_object
 Object.
typedef yasm_section yasm_section
 Section (opaque type).
typedef yasm_symtab yasm_symtab
 Symbol table (opaque type).
typedef yasm_symrec yasm_symrec
 Symbol record (opaque type).
typedef yasm_expr yasm_expr
 Expression.
typedef yasm_intnum yasm_intnum
 Integer value (opaque type).
typedef yasm_floatnum yasm_floatnum
 Floating point value (opaque type).
typedef yasm_linemap yasm_linemap
 Line number mapping repository (opaque type).
typedef yasm_valparam yasm_valparam
 Value/parameter pair (opaque type).
typedef yasm_valparamhead yasm_valparamhead
 List of value/parameters (opaque type).
typedef yasm_directive yasm_directive
 Directive list entry.
typedef yasm_effaddr yasm_effaddr
 An effective address.
typedef yasm_insn yasm_insn
 An instruction.
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.
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.

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_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.
YASM_LIB_DECL char * yasm__strsep (char **stringp, const char *delim)
 Separate string by delimiters.
YASM_LIB_DECL int yasm__strcasecmp (const char *s1, const char *s2)
 Compare two strings, ignoring case differences.
YASM_LIB_DECL int yasm__strncasecmp (const char *s1, const char *s2, size_t n)
 Compare portion of two strings, ignoring case differences.
YASM_LIB_DECL char * yasm__xstrdup (const char *str)
 strdup() implementation using yasm_xmalloc().
YASM_LIB_DECL char * yasm__xstrndup (const char *str, size_t max)
 strndup() implementation using yasm_xmalloc().

Variables

YASM_LIB_DECL void *(*) yasm_xmalloc (size_t size)
 Error-checking memory allocation.
YASM_LIB_DECL void *(*) yasm_xcalloc (size_t nelem, size_t elsize)
 Error-checking memory allocation (with clear-to-0).
YASM_LIB_DECL void *(*) yasm_xrealloc (void *oldmem, size_t size)
 Error-checking memory reallocation.
YASM_LIB_DECL void(*) yasm_xfree (void *p)
 Error-checking memory deallocation.


Detailed Description

YASM core types and utility functions.

Definition in file coretype.h.


Typedef Documentation

typedef struct yasm_arch yasm_arch

Architecture instance (mostly opaque type).

See also:
arch.h for details.

Definition at line 42 of file coretype.h.

typedef struct yasm_bytecode yasm_bytecode

Bytecode.

See also:
bytecode.h for details and related functions.

Definition at line 97 of file coretype.h.

typedef struct yasm_dbgfmt yasm_dbgfmt

Debug format interface.

See also:
dbgfmt.h for details.

Definition at line 50 of file coretype.h.

typedef struct yasm_dbgfmt_module yasm_dbgfmt_module

Debug format module interface.

See also:
dbgfmt.h for details.

Definition at line 57 of file coretype.h.

typedef struct yasm_directive yasm_directive

Directive list entry.

See also:
valparam.h for details and related functions.

Definition at line 209 of file coretype.h.

typedef struct yasm_effaddr yasm_effaddr

An effective address.

See also:
insn.h for related functions.

Definition at line 214 of file coretype.h.

typedef struct yasm_errwarns yasm_errwarns

Set of collected error/warnings (opaque type).

See also:
errwarn.h for details.

Definition at line 94 of file coretype.h.

typedef struct yasm_expr yasm_expr

Expression.

See also:
expr.h for details and related functions.

Definition at line 112 of file coretype.h.

typedef struct yasm_floatnum yasm_floatnum

Floating point value (opaque type).

See also:
floatnum.h for related functions.

Definition at line 118 of file coretype.h.

typedef struct yasm_insn yasm_insn

An instruction.

See also:
insn.h for related functions.

Definition at line 219 of file coretype.h.

typedef struct yasm_intnum yasm_intnum

Integer value (opaque type).

See also:
intnum.h for related functions.

Definition at line 114 of file coretype.h.

typedef struct yasm_linemap yasm_linemap

Line number mapping repository (opaque type).

See also:
linemap.h for related functions.

Definition at line 196 of file coretype.h.

typedef struct yasm_listfmt yasm_listfmt

List format interface.

See also:
listfmt.h for details.

Definition at line 52 of file coretype.h.

typedef struct yasm_object yasm_object

Object.

See also:
section.h for details and related functions.

Definition at line 100 of file coretype.h.

typedef struct yasm_objfmt yasm_objfmt

Object format interface.

See also:
objfmt.h for details.

Definition at line 48 of file coretype.h.

typedef struct yasm_objfmt_module yasm_objfmt_module

Object format module interface.

See also:
objfmt.h for details.

Definition at line 55 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.

Parameters:
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)
Returns:
Nonzero if an error occurred, 0 otherwise.

Definition at line 299 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.

Parameters:
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)
Returns:
Nonzero if an error occurred, 0 otherwise.

Definition at line 278 of file coretype.h.

typedef struct yasm_parser yasm_parser

Parser instance (mostly opaque type).

See also:
parser.h for details.

Definition at line 46 of file coretype.h.

typedef struct yasm_preproc yasm_preproc

Preprocessor interface.

See also:
preproc.h for details.

Definition at line 44 of file coretype.h.

typedef struct yasm_section yasm_section

Section (opaque type).

See also:
section.h for related functions.

Definition at line 103 of file coretype.h.

typedef struct yasm_symrec yasm_symrec

Symbol record (opaque type).

See also:
symrec.h for related functions.

Definition at line 109 of file coretype.h.

typedef struct yasm_symtab yasm_symtab

Symbol table (opaque type).

See also:
symrec.h for related functions.

Definition at line 106 of file coretype.h.

typedef struct yasm_valparam yasm_valparam

Value/parameter pair (opaque type).

See also:
valparam.h for related functions.

Definition at line 201 of file coretype.h.

typedef struct yasm_valparamhead yasm_valparamhead

List of value/parameters (opaque type).

See also:
valparam.h for related functions.

Definition at line 205 of file coretype.h.


Enumeration Type Documentation

enum yasm_expr_op

Expression operators usable in yasm_expr expressions.

Enumerator:
YASM_EXPR_IDENT  No operation, just a value.

YASM_EXPR_ADD  Arithmetic addition (+).

YASM_EXPR_SUB  Arithmetic subtraction (-).

YASM_EXPR_MUL  Arithmetic multiplication (*).

YASM_EXPR_DIV  Arithmetic unsigned division.

YASM_EXPR_SIGNDIV  Arithmetic signed division.

YASM_EXPR_MOD  Arithmetic unsigned modulus.

YASM_EXPR_SIGNMOD  Arithmetic signed modulus.

YASM_EXPR_NEG  Arithmetic negation (-).

YASM_EXPR_NOT  Bitwise negation.

YASM_EXPR_OR  Bitwise OR.

YASM_EXPR_AND  Bitwise AND.

YASM_EXPR_XOR  Bitwise XOR.

YASM_EXPR_XNOR  Bitwise XNOR.

YASM_EXPR_NOR  Bitwise NOR.

YASM_EXPR_SHL  Shift left (logical).

YASM_EXPR_SHR  Shift right (logical).

YASM_EXPR_LOR  Logical OR.

YASM_EXPR_LAND  Logical AND.

YASM_EXPR_LNOT  Logical negation.

YASM_EXPR_LXOR  Logical XOR.

YASM_EXPR_LXNOR  Logical XNOR.

YASM_EXPR_LNOR  Logical NOR.

YASM_EXPR_LT  Less than comparison.

YASM_EXPR_GT  Greater than comparison.

YASM_EXPR_EQ  Equality comparison.

YASM_EXPR_LE  Less than or equal to comparison.

YASM_EXPR_GE  Greater than or equal to comparison.

YASM_EXPR_NE  Not equal comparison.

YASM_EXPR_NONNUM  Start of non-numeric operations (not an op).

YASM_EXPR_SEG  SEG operator (gets segment portion of address).

YASM_EXPR_WRT  WRT operator (gets offset of address relative to some other segment).

YASM_EXPR_SEGOFF  The ':' in segment:offset.

Definition at line 222 of file coretype.h.


Function Documentation

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.

For internal use only.

Parameters:
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.

For internal use only.

Parameters:
s1 string 1
s2 string 2
Returns:
0 if strings are equal, -1 if s1<s2, 1 if s1>s2.

YASM_LIB_DECL int yasm__strncasecmp ( const char *  s1,
const char *  s2,
size_t  n 
)

Compare portion of two strings, ignoring case differences.

For internal use only.

Parameters:
s1 string 1
s2 string 2
n maximum number of characters to compare
Returns:
0 if strings are equal, -1 if s1<s2, 1 if s1>s2.

YASM_LIB_DECL char* yasm__strsep ( char **  stringp,
const char *  delim 
)

Separate string by delimiters.

For internal use only.

Parameters:
stringp string
delim set of 1 or more delimiters
Returns:
First/next substring.

YASM_LIB_DECL char* yasm__xstrdup ( const char *  str  ) 

strdup() implementation using yasm_xmalloc().

For internal use only.

Parameters:
str string
Returns:
Newly allocated duplicate string.

YASM_LIB_DECL char* yasm__xstrndup ( const char *  str,
size_t  max 
)

strndup() implementation using yasm_xmalloc().

For internal use only.

Parameters:
str string
max maximum number of characters to copy
Returns:
Newly allocated duplicate string.


Variable Documentation

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.

Parameters:
size number of elements to allocate
elsize size (in bytes) of each element
Returns:
Allocated and cleared memory block.

YASM_LIB_DECL void(*) yasm_xfree(void *p)

Error-checking memory deallocation.

A default implementation is provided that calls yasm_fatal() on allocation errors.

Parameters:
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.

Parameters:
size number of bytes to allocate
Returns:
Allocated memory block.

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.

Parameters:
oldmem memory block to resize
elsize new size, in bytes
Returns:
Re-allocated memory block.


Generated on Thu Jul 24 01:23:31 2008 for libyasm by  doxygen 1.5.2