diff options
| author | Xavi Del Campo <xavi.dcr@tutanota.com> | 2020-01-31 10:32:23 +0100 |
|---|---|---|
| committer | Xavi Del Campo <xavi.dcr@tutanota.com> | 2020-01-31 10:32:23 +0100 |
| commit | 7c24e9a9b02b04dcaf9507acb94091ea70a2c02d (patch) | |
| tree | c28d0748652ad4b4222309e46e6cfc82c0906220 /tools/spasm/error.c | |
| parent | a2b7b6bb1cc2f4a3258b7b2dbc92399d151f864d (diff) | |
| download | psxsdk-7c24e9a9b02b04dcaf9507acb94091ea70a2c02d.tar.gz | |
Imported pristine psxsdk-20190410 from official repo
Diffstat (limited to 'tools/spasm/error.c')
| -rw-r--r-- | tools/spasm/error.c | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/tools/spasm/error.c b/tools/spasm/error.c new file mode 100644 index 0000000..019c3da --- /dev/null +++ b/tools/spasm/error.c @@ -0,0 +1,58 @@ +#include "spasm.h" + +static void show_line(void) +{ + printf("%s\n", curLine); + printf("^^^^^^^^^^^^^^\n"); +} + +void instruction_error(char *format, ...) +{ + va_list ap; + + va_start(ap, format); + + printf("Line %d: Error(%s) - ", line_number, curIns); + vprintf(format, ap); + printf("\n"); + show_line(); + + va_end(ap); + + exit(EXIT_FAILURE); +} + +void instruction_warning(char *format, ...) +{ + if(curPass <= 0) + return; + + va_list ap; + + va_start(ap, format); + + printf("Line %d: Warning (%s) - ", line_number, curIns); + vprintf(format, ap); + printf("\n"); + show_line(); + + va_end(ap); +} + +void assembler_error(char *format, ...) +{ + va_list ap; + + va_start(ap, format); + + printf("Line %d, assembler error: ", line_number); + vprintf(format, ap); + printf("\n"); + show_line(); + + va_end(ap); + + exit(EXIT_FAILURE); +} + +
\ No newline at end of file |
