Commit | Line | Data |
---|---|---|
9ed84d89 JB |
1 | #include <stdio.h> |
2 | #include <wchar.h> | |
15ad4b5a | 3 | #include <stdarg.h> |
9ed84d89 | 4 | |
f196dae5 | 5 | #include "print_helper.h" |
e70feb8c JB |
6 | #include "global_vars.h" |
7 | ||
8 | void pr_warning(const char* format, ...) { | |
9ed84d89 JB |
9 | va_list args; |
10 | ||
11 | va_start(args, format); | |
12 | fprintf(stdout, format, args); | |
13 | va_end(args); | |
6c47be32 | 14 | fflush(stdout); |
9ed84d89 JB |
15 | } |
16 | ||
17 | void pr_error(const char *format, ...) { | |
18 | va_list args; | |
19 | ||
20 | va_start(args, format); | |
21 | fprintf(stderr, format, args); | |
22 | va_end(args); | |
6c47be32 | 23 | fflush(stderr); |
9ed84d89 JB |
24 | } |
25 | ||
e70feb8c JB |
26 | #if DEBUG |
27 | void pr_debug(const char *format, ...) { | |
28 | va_list args; | |
29 | ||
30 | va_start(args, format); | |
31 | fprintf(stderr, format, args); | |
32 | va_end(args); | |
6c47be32 | 33 | fflush(stderr); |
e70feb8c JB |
34 | } |
35 | #else | |
36 | void pr_debug(const char *format, ...); | |
37 | #endif /* DEBUG */ | |
38 | ||
9ed84d89 JB |
39 | void wpr_warning(const wchar_t *format, ...) { |
40 | va_list args; | |
41 | ||
42 | va_start(args, format); | |
43 | fwprintf(stdout, format, args); | |
44 | va_end(args); | |
6c47be32 | 45 | fflush(stdout); |
9ed84d89 JB |
46 | } |
47 | ||
48 | void wpr_error(const wchar_t *format, ...) { | |
49 | va_list args; | |
50 | ||
51 | va_start(args, format); | |
52 | fwprintf(stderr, format, args); | |
53 | va_end(args); | |
6c47be32 | 54 | fflush(stderr); |
9ed84d89 | 55 | } |
e70feb8c | 56 | |
f196dae5 | 57 | void wprint_token(FILE* out_file) { |
48e4b4ad | 58 | if (tokenType == MOT || tokenType == MOTCLE) { |
f196dae5 | 59 | fwprintf(out_file, L"%20s: %ls\n", tokenTypestr[tokenType], token[tokenFound].value); |
48e4b4ad | 60 | } else { |
f196dae5 | 61 | fwprintf(out_file, L"%20s\n", tokenTypestr[tokenType]); |
e70feb8c | 62 | } |
f196dae5 | 63 | fflush(out_file); |
e70feb8c | 64 | } |
15ad4b5a JB |
65 | |
66 | void wprint_ctoken(FILE* out_file) { | |
67 | if (tokenType == MOT || tokenType == MOTCLE) { | |
68 | fwprintf(out_file, L"%20s: %ls\n", tokenTypestr[tokenType], tokenValue); | |
69 | } else { | |
70 | fwprintf(out_file, L"%20s\n", tokenTypestr[tokenType]); | |
71 | } | |
72 | fflush(out_file); | |
73 | } |