X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=lexer%2Fprint_helper.c;h=f7ab04ffb9887b2e2fbdf5d96ea06b6016ca509c;hb=48e4b4adcc62229b0006ca4c35e54d63a9f6cc9e;hp=d5ca8f0da8705e4865663718ce215a9fd3ea5bcd;hpb=9ed84d89d23a6198fd4157bfe93424b7b7582332;p=TP_AL_C.git diff --git a/lexer/print_helper.c b/lexer/print_helper.c index d5ca8f0..f7ab04f 100644 --- a/lexer/print_helper.c +++ b/lexer/print_helper.c @@ -2,12 +2,15 @@ #include #include -void pr_warning(const char *format, ...) { +#include "global_vars.h" + +void pr_warning(const char* format, ...) { va_list args; va_start(args, format); fprintf(stdout, format, args); va_end(args); + fflush(stdout); } void pr_error(const char *format, ...) { @@ -16,7 +19,21 @@ void pr_error(const char *format, ...) { va_start(args, format); fprintf(stderr, format, args); va_end(args); + fflush(stderr); +} + +#if DEBUG +void pr_debug(const char *format, ...) { + va_list args; + + va_start(args, format); + fprintf(stderr, format, args); + va_end(args); + fflush(stderr); } +#else +void pr_debug(const char *format, ...); +#endif /* DEBUG */ void wpr_warning(const wchar_t *format, ...) { va_list args; @@ -24,6 +41,7 @@ void wpr_warning(const wchar_t *format, ...) { va_start(args, format); fwprintf(stdout, format, args); va_end(args); + fflush(stdout); } void wpr_error(const wchar_t *format, ...) { @@ -32,4 +50,22 @@ void wpr_error(const wchar_t *format, ...) { va_start(args, format); fwprintf(stderr, format, args); va_end(args); + fflush(stderr); +} + +void wprint_token_stdout() { + if (tokenType == MOT || tokenType == MOTCLE) { + fwprintf(stdout, L"%20s: %ls\n", tokenTypestr[tokenType], token[tokenFound].value); + } else { + fwprintf(stdout, L"%20s\n", tokenTypestr[tokenType]); + } + fflush(stdout); +} + +void wprint_token_target() { + if (tokenType == MOT || tokenType == MOTCLE) { + fwprintf(target, L"%20s: %ls\n", tokenTypestr[tokenType], token[tokenFound].value); + } else { + fwprintf(target, L"%20s\n", tokenTypestr[tokenType]); + } }