add: dprintf for Windows

This commit is contained in:
2024-01-21 12:54:19 +01:00
parent c733b17acb
commit 85c3c2cbc9
4 changed files with 28 additions and 0 deletions

View File

@@ -8,6 +8,22 @@
int fstream = 0;
int pasm_debug_mode = 0;
#ifdef _WIN32 // i swear i hate windows at this point
#include <stdarg.h>
#include <io.h>
int dprintf(int stream, const char * format, ...) {
char buf[256] = {0}; //might overflow but whatever, fuck Windows
va_list args;
va_start(args, format);
int wrote = vsprintf(buf, format, args);
_write(stream, buf, sizeof(buf));
va_end(args);
return wrote;
}
#endif
void show_error(size_t line, char *line_) {
#ifdef _WIN32
int wrote = dprintf(fstream, "%llu| ", line + 1);