libyasm
Data Structures | Typedefs | Functions
preproc.h File Reference

YASM preprocessor module interface. More...

Go to the source code of this file.

Data Structures

struct  yasm_preproc_module
 YASM preprocesor module interface. More...
 

Typedefs

typedef struct yasm_preproc_module yasm_preproc_module
 YASM preprocesor module interface. More...
 

Functions

yasm_preprocyasm_preproc_create (yasm_preproc_module *module, const char *in_filename, yasm_symtab *symtab, yasm_linemap *lm, yasm_errwarns *errwarns)
 Initialize preprocessor. More...
 
void yasm_preproc_destroy (yasm_preproc *preproc)
 Cleans up any allocated preproc memory. More...
 
char * yasm_preproc_get_line (yasm_preproc *preproc)
 Gets a single line of preprocessed source code. More...
 
size_t yasm_preproc_get_included_file (yasm_preproc *preproc, char *buf, size_t max_size)
 Get the next filename included by the source code. More...
 
void yasm_preproc_add_include_file (yasm_preproc *preproc, const char *filename)
 Pre-include a file. More...
 
void yasm_preproc_predefine_macro (yasm_preproc *preproc, const char *macronameval)
 Pre-define a macro. More...
 
void yasm_preproc_undefine_macro (yasm_preproc *preproc, const char *macroname)
 Un-define a macro. More...
 
void yasm_preproc_define_builtin (yasm_preproc *preproc, const char *macronameval)
 Define a builtin macro, preprocessed before the "standard" macros. More...
 
void yasm_preproc_add_standard (yasm_preproc *preproc, const char **macros)
 Define additional standard macros, preprocessed after the builtins but prior to any user-defined macros. More...
 

Detailed Description

YASM preprocessor module interface.

Definition in file preproc.h.

Typedef Documentation

YASM preprocesor module interface.

Function Documentation

void yasm_preproc_add_include_file ( yasm_preproc preproc,
const char *  filename 
)

Pre-include a file.

Parameters
preprocpreprocessor
filenamefilename
void yasm_preproc_add_standard ( yasm_preproc preproc,
const char **  macros 
)

Define additional standard macros, preprocessed after the builtins but prior to any user-defined macros.

Parameters
preprocpreprocessor
macrosNULL-terminated array of macro strings
yasm_preproc* yasm_preproc_create ( yasm_preproc_module module,
const char *  in_filename,
yasm_symtab symtab,
yasm_linemap lm,
yasm_errwarns errwarns 
)

Initialize preprocessor.

The preprocessor needs access to the object format module to find out any output format specific macros.

Parameters
modulepreprocessor module
in_filenameinitial starting filename, or "-" to read from stdin
symtabsymbol table (may be NULL if none)
lmline mapping repository
errwarnserror/warning set
Returns
New preprocessor.
Note
Errors/warnings are stored into errwarns.
void yasm_preproc_define_builtin ( yasm_preproc preproc,
const char *  macronameval 
)

Define a builtin macro, preprocessed before the "standard" macros.

Parameters
preprocpreprocessor
macronameval"name=value" string
void yasm_preproc_destroy ( yasm_preproc preproc)

Cleans up any allocated preproc memory.

Parameters
preprocpreprocessor
size_t yasm_preproc_get_included_file ( yasm_preproc preproc,
char *  buf,
size_t  max_size 
)

Get the next filename included by the source code.

Parameters
preprocpreprocessor
bufdestination buffer for filename
max_sizemaximum number of bytes that can be returned in buf
Returns
Actual number of bytes returned in buf.
char* yasm_preproc_get_line ( yasm_preproc preproc)

Gets a single line of preprocessed source code.

Parameters
preprocpreprocessor
Returns
Allocated line of code, without the trailing
.
void yasm_preproc_predefine_macro ( yasm_preproc preproc,
const char *  macronameval 
)

Pre-define a macro.

Parameters
preprocpreprocessor
macronameval"name=value" string
void yasm_preproc_undefine_macro ( yasm_preproc preproc,
const char *  macroname 
)

Un-define a macro.

Parameters
preprocpreprocessor
macronamemacro name