YASM virtual line mapping interface.
More...
Go to the source code of this file.
|
YASM_LIB_DECL yasm_linemap * | yasm_linemap_create (void) |
| Create a new line mapping repository. More...
|
|
YASM_LIB_DECL void | yasm_linemap_destroy (yasm_linemap *linemap) |
| Clean up any memory allocated for a repository. More...
|
|
YASM_LIB_DECL unsigned long | yasm_linemap_get_current (yasm_linemap *linemap) |
| Get the current line position in a repository. More...
|
|
YASM_LIB_DECL int | yasm_linemap_get_source (yasm_linemap *linemap, unsigned long line, yasm_bytecode **bcp, const char **sourcep) |
| Get bytecode and source line information, if any, for a virtual line. More...
|
|
YASM_LIB_DECL void | yasm_linemap_add_source (yasm_linemap *linemap, yasm_bytecode *bc, const char *source) |
| Add bytecode and source line information to the current virtual line. More...
|
|
YASM_LIB_DECL unsigned long | yasm_linemap_goto_next (yasm_linemap *linemap) |
| Go to the next line (increments the current virtual line). More...
|
|
YASM_LIB_DECL void | yasm_linemap_set (yasm_linemap *linemap, const char *filename, unsigned long virtual_line, unsigned long file_line, unsigned long line_inc) |
| Set a new file/line physical association starting point at the specified virtual line. More...
|
|
YASM_LIB_DECL unsigned long | yasm_linemap_poke (yasm_linemap *linemap, const char *filename, unsigned long file_line) |
| Poke a single file/line association, restoring the original physical association starting point. More...
|
|
YASM_LIB_DECL void | yasm_linemap_lookup (yasm_linemap *linemap, unsigned long line, const char **filename, unsigned long *file_line) |
| Look up the associated physical file and line for a virtual line. More...
|
|
YASM_LIB_DECL int | yasm_linemap_traverse_filenames (yasm_linemap *linemap, void *d, int(*func)(const char *filename, void *d)) |
| Traverses all filenames used in a linemap, calling a function on each filename. More...
|
|
YASM virtual line mapping interface.
Definition in file linemap.h.
Add bytecode and source line information to the current virtual line.
- Attention
- Deletes any existing bytecode and source line information for the current virtual line.
- Parameters
-
linemap | line mapping repository |
bc | bytecode (if any) |
source | source code line |
- Note
- The source code line pointer is NOT kept, it is strdup'ed.
Create a new line mapping repository.
- Returns
- New repository.
YASM_LIB_DECL void yasm_linemap_destroy |
( |
yasm_linemap * |
linemap | ) |
|
Clean up any memory allocated for a repository.
- Parameters
-
linemap | line mapping repository |
YASM_LIB_DECL unsigned long yasm_linemap_get_current |
( |
yasm_linemap * |
linemap | ) |
|
Get the current line position in a repository.
- Parameters
-
linemap | line mapping repository |
- Returns
- Current virtual line.
YASM_LIB_DECL int yasm_linemap_get_source |
( |
yasm_linemap * |
linemap, |
|
|
unsigned long |
line, |
|
|
yasm_bytecode ** |
bcp, |
|
|
const char ** |
sourcep |
|
) |
| |
Get bytecode and source line information, if any, for a virtual line.
- Parameters
-
linemap | line mapping repository |
line | virtual line |
bcp | pointer to return bytecode into |
sourcep | pointer to return source code line pointer into |
- Returns
- Zero if source line information available for line, nonzero if not.
- Note
- If source line information is not available, bcp and sourcep targets are set to NULL.
YASM_LIB_DECL unsigned long yasm_linemap_goto_next |
( |
yasm_linemap * |
linemap | ) |
|
Go to the next line (increments the current virtual line).
- Parameters
-
linemap | line mapping repository |
- Returns
- The current (new) virtual line.
YASM_LIB_DECL void yasm_linemap_lookup |
( |
yasm_linemap * |
linemap, |
|
|
unsigned long |
line, |
|
|
const char ** |
filename, |
|
|
unsigned long * |
file_line |
|
) |
| |
Look up the associated physical file and line for a virtual line.
- Parameters
-
linemap | line mapping repository |
line | virtual line |
filename | physical file name (output) |
file_line | physical line number (output) |
YASM_LIB_DECL unsigned long yasm_linemap_poke |
( |
yasm_linemap * |
linemap, |
|
|
const char * |
filename, |
|
|
unsigned long |
file_line |
|
) |
| |
Poke a single file/line association, restoring the original physical association starting point.
Caution: increments the current virtual line twice.
- Parameters
-
linemap | line mapping repository |
filename | physical file name (if NULL, not changed) |
file_line | physical line number |
- Returns
- The virtual line number of the poked association.
YASM_LIB_DECL void yasm_linemap_set |
( |
yasm_linemap * |
linemap, |
|
|
const char * |
filename, |
|
|
unsigned long |
virtual_line, |
|
|
unsigned long |
file_line, |
|
|
unsigned long |
line_inc |
|
) |
| |
Set a new file/line physical association starting point at the specified virtual line.
line_inc indicates how much the "real" line is incremented by for each virtual line increment (0 is perfectly legal).
- Parameters
-
linemap | line mapping repository |
filename | physical file name (if NULL, not changed) |
virtual_line | virtual line number (if 0, linemap->current is used) |
file_line | physical line number |
line_inc | line increment |
YASM_LIB_DECL int yasm_linemap_traverse_filenames |
( |
yasm_linemap * |
linemap, |
|
|
void * |
d, |
|
|
int(*)(const char *filename, void *d) |
func |
|
) |
| |
Traverses all filenames used in a linemap, calling a function on each filename.
- Parameters
-
linemap | line mapping repository |
d | data pointer passed to func on each call |
func | function |
- Returns
- Stops early (and returns func's return value) if func returns a nonzero value; otherwise 0.