-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patherrors.c
More file actions
55 lines (43 loc) · 1.13 KB
/
Copy patherrors.c
File metadata and controls
55 lines (43 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include "gbparse.h"
#include "gbasm.h"
#include "errors.h"
void no_memory(void) {
gbasm_error("not enough memory!");
}
void gbasm_error(const char *message, ...) {
va_list args;
fprintf(stderr, "%s: error: ", gbasm_filename);
va_start(args, message);
vfprintf(stderr, message, args);
va_end(args);
fputc('\n', stderr);
exit(1);
}
void gbasm_warning(const char *message, ...) {
va_list args;
fprintf(stderr, "%s: warning: ", gbasm_filename);
va_start(args, message);
vfprintf(stderr, message, args);
va_end(args);
fputc('\n', stderr);
}
void location_error(YYLTYPE loc, char *message, ...) {
va_list args;
fprintf(stderr, "%s:%d:%d: error: ", input_filename, loc.first_line, loc.first_column);
va_start(args, message);
vfprintf(stderr, message, args);
va_end(args);
fputc('\n', stderr);
exit(1);
}
void location_warning(YYLTYPE loc, char *message, ...) {
va_list args;
fprintf(stderr, "%s:%d:%d: warning: ", input_filename, loc.first_line, loc.first_column);
va_start(args, message);
vfprintf(stderr, message, args);
va_end(args);
fputc('\n', stderr);
}