2024-03-20 00:48:21 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include "api.h"
|
|
|
|
|
|
|
|
#ifdef _WIN32
|
|
|
|
#include <Windows.h>
|
|
|
|
static void showError(const char *er) {
|
|
|
|
int ret = MessageBoxA(NULL,er,"Quit the program?",MB_YESNO|MB_ICONQUESTION|MB_DEFBUTTON2|MB_APPLMODAL);
|
2024-03-20 06:25:29 +00:00
|
|
|
if(ret == IDYES) {
|
2024-03-20 00:48:21 +00:00
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#else
|
|
|
|
static void showError(const char *er){
|
|
|
|
fprintf(stderr,"%s\n",er);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
void reportError(const char *fmt,...){
|
|
|
|
va_list ap;
|
|
|
|
char buf[512];
|
|
|
|
va_start(ap,fmt);
|
|
|
|
vsnprintf(buf,sizeof buf,fmt,ap);
|
|
|
|
va_end(ap);
|
|
|
|
}
|