Go to the source code of this file.
#define DUMP_BUF_SIZE 128 |
Initializes the table with error messages taken from TR_ERRORS.
Definition at line 91 of file errors.c.
Frees atoms holding error texts.
Definition at line 127 of file errors.c.
- Parameters
-
code | error code |
data | error data |
- Returns
- error atom
Creates an error atom with reference count 1. The reference count of data
is increased. Initializes the error position to be a list containing one element, which is the data
parameter itself.
Definition at line 152 of file errors.c.
172 printf(
"<ATOM> [%08x] error=[code=%d]\n",(
int)a,code);
182 #ifdef DEBUG_RUNTIME_ATOMS
186 dump_atom_address( a );
191 #ifdef DEBUG_COMPILETIME_ATOMS
195 dump_atom_address( a );
- Parameters
-
filename | file name associated with the error |
- Returns
- error atom
Creates error atom describing OS error.
Definition at line 217 of file errors.c.
- Parameters
-
code | error code |
position | character position within the source |
source | (sub)word containing the source |
- Returns
- error atom
Creates error atom describing an error generated by the parser.
Definition at line 245 of file errors.c.
- Parameters
-
error | error to which new position will be added |
source | error source |
Adds a new error position to an already existing error atom. The error position is simply an atom which may have been extracted from the actual source. The new error position is inserted in the first place of the list of error positions.
Definition at line 268 of file errors.c.
- Parameters
-
Deletes error atom by returning it back to the data pool. The source atom is dereferenced.
Definition at line 290 of file errors.c.
- Parameters
-
data | data to search for |
source | source where the data is found |
- Returns
- position of data within found source
Tries to identify the position of the first (sub)word in the data in the original source. This function returns the character position and the source. If the source cannot be identified, then return -1 and set source
to NULL.
Definition at line 314 of file errors.c.
void dump_neighbourhood |
( |
chars_t |
source, |
|
|
int |
position |
|
) |
| |
- Parameters
-
source | source containing the neighbourhood |
position | position marking the neighbourhood |
Dumps a piece of source code containing given position. The dumped neighbourhood starts before the position and end after it in a way that: (1) at most LEFT_DIST chars before the position are included (2) at most RIGHT_DIST chars after the position are included (3) the neightbourhood contains characters from a single line only Dumped neighbourhood is output as a single line with an arrow anove it pointing the exact position.
Definition at line 360 of file errors.c.
362 if( !source || position<0 )
return;
370 if( position-left == 0 ) {ellipses=0;
break;}
373 char_t ch = *(source+(position-left-1));
374 if( ch==
TEXT(
'\n') || ch==
TEXT(
'\r') ) {ellipses=0;
break;}
376 while( left && ((*(source+position-left))<=
TEXT(
' ')) ) left--;
381 char_t ch = *(source+(position+right+1));
382 if( ch==
'\n' || ch==
'\r' || ch==
'\0')
break;
388 for( i=0,s=source+position-left; i<left+right+1; i++,s++ )
outter( s, 1 );
389 if( *(source+position+right+1)>=
TEXT(
' ') )
392 for( i=0; i<left+3*ellipses; i++ )
outter(
TEXT(
" "), 1 );
- Parameters
-
a | atom to dump |
level | dump level |
Dumps error atom through the current outter function.
Definition at line 411 of file errors.c.
413 #define DUMP_BUF_SIZE 128
void clear_all_errors |
( |
) | |
|
Clears all errors recorder in all_errors except for the one stored in last_error
Definition at line 503 of file errors.c.
506 if( err==
NULL )
return;