v6502
The MOS 6502 Virtual Machine and Toolchain Infrastructure
error.h
Go to the documentation of this file.
1 
4 /*
5  * Copyright (c) 2013 Daniel Loffgren
6  *
7  * Permission is hereby granted, free of charge, to any person obtaining a copy
8  * of this software and associated documentation files (the "Software"), to
9  * deal in the Software without restriction, including without limitation the
10  * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
11  * sell copies of the Software, and to permit persons to whom the Software is
12  * furnished to do so, subject to the following conditions:
13  *
14  * The above copyright notice and this permission notice shall be included in
15  * all copies or substantial portions of the Software.
16  *
17  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
23  * IN THE SOFTWARE.
24  */
25 
26 #ifndef v6502_error_h
27 #define v6502_error_h
28 
30 extern const char *currentLineText;
32 extern unsigned long currentLineNum;
34 extern const char *currentFileName;
36 extern unsigned int currentErrorCount;
37 
41 void as6502_fatal(const char *reason) __attribute((noreturn));
43 void as6502_error(unsigned long loc, unsigned long len, const char *reason, ...);
45 void as6502_warn(unsigned long loc, unsigned long len, const char *reason, ...);
47 void as6502_note(unsigned long lineNumber, const char *reason, ...);
49 void as6502_underline(const char *str, unsigned long loc, unsigned long len);
52 #endif
void as6502_note(unsigned long lineNumber, const char *reason,...)
Called for code notation which pertain to preceding errors or warnings, this can reference other code...
Definition: error.c:103
void as6502_error(unsigned long loc, unsigned long len, const char *reason,...)
Called for code errors detected during assembly, which prevent producing a binary.
Definition: error.c:88
unsigned int currentErrorCount
Current total number of errors encountered.
Definition: error.c:36
void as6502_warn(unsigned long loc, unsigned long len, const char *reason,...)
Called for code warnings detected during assembly, which don't prevent producing a binary...
Definition: error.c:96
const char * currentFileName
Current file name.
Definition: error.c:35
const char * currentLineText
Current line number.
Definition: error.c:33
void as6502_underline(const char *str, unsigned long loc, unsigned long len)
This function outputs an underline annotation for a given character range.
Definition: error.c:118
void as6502_fatal(const char *reason) __attribute((noreturn))
Called for fatal errors during assembly, such as internal memory failures.
unsigned long currentLineNum
Current line number.
Definition: error.c:34