X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=lexer%2Fprint_helper.c;h=8d6ddb447e3a9ab894521ccf8057ce0c80a7c753;hb=654a57aed094d4c4bfb4d71a7fdd54b1069465e0;hp=23684d5e22e6785fdd30fc7925b82bbb5e26cac0;hpb=82220449f3f8d1c25474651379118eda02430a3c;p=TP_AL_C.git diff --git a/lexer/print_helper.c b/lexer/print_helper.c index 23684d5..8d6ddb4 100644 --- a/lexer/print_helper.c +++ b/lexer/print_helper.c @@ -1,7 +1,7 @@ -#include #include -#include +#include +#include "print_helper.h" #include "global_vars.h" void pr_warning(const char* format, ...) { @@ -10,6 +10,7 @@ void pr_warning(const char* format, ...) { va_start(args, format); fprintf(stdout, format, args); va_end(args); + fflush(stdout); } void pr_error(const char *format, ...) { @@ -18,6 +19,7 @@ void pr_error(const char *format, ...) { va_start(args, format); fprintf(stderr, format, args); va_end(args); + fflush(stderr); } #if DEBUG @@ -27,6 +29,7 @@ void pr_debug(const char *format, ...) { va_start(args, format); fprintf(stderr, format, args); va_end(args); + fflush(stderr); } #else void pr_debug(const char *format, ...); @@ -38,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, ...) { @@ -46,12 +50,23 @@ void wpr_error(const wchar_t *format, ...) { va_start(args, format); fwprintf(stderr, format, args); va_end(args); + fflush(stderr); +} + +void wprint_token(FILE* out_file) { + if (tokenType == MOT || tokenType == MOTCLE) { + fwprintf(out_file, L"%20s: %ls\n", tokenTypestr[tokenType], token[tokenFound].value); + } else { + fwprintf(out_file, L"%20s\n", tokenTypestr[tokenType]); + } + fflush(out_file); } -void wprint_token() { +void wprint_ctoken(FILE* out_file) { if (tokenType == MOT || tokenType == MOTCLE) { - fwprintf(target, L"%20s: %ls\n", tokenTypestr[tokenType], token[tokenFound].value); + fwprintf(out_file, L"%20s: %ls\n", tokenTypestr[tokenType], tokenValue); } else { - fwprintf(target, L"%20s\n", tokenTypestr[tokenType]); + fwprintf(out_file, L"%20s\n", tokenTypestr[tokenType]); } + fflush(out_file); }