// output a string, debug version only. Assumes string ends with a newline. VOID DebugOut ( CHAR * szOut ) { #ifndef MAC int id; #endif //!MAC if (hFileOutput) { fputs(szOut, hFileOutput); fputs("\n", hFileOutput); } else { #ifdef MAC MacMessageBox(szOut); #else //MAC id = MessageBox(NULL, szOut, "MkTypLib debug output. OK to continue, CANCEL to quit.", MB_OKCANCEL); if (id == IDCANCEL) ErrorExit(); // clean up and exit(1) #endif //MAC } }
void ErrorMessageBox (const char *msg, const char *caption, unsigned int flags) { // Platform independent cleanup. SDL_Quit(); // not exiting threads causes another exception delete gameServer; gameServer = NULL; delete sound; sound = NULL; #ifdef _WIN32 // Windows implementation, using MessageBox. // Translate spring flags to corresponding win32 dialog flags unsigned int winFlags = 0; // MB_OK is default (0) if (flags & MBF_EXCL) winFlags |= MB_ICONEXCLAMATION; if (flags & MBF_INFO) winFlags |= MB_ICONINFORMATION; MessageBox (GetActiveWindow(), msg, caption, winFlags); // TODO: write Mac OS X specific message box #elif defined(__APPLE__) MacMessageBox(msg, caption, flags); #else // X implementation X_MessageBox(msg, caption, flags); #endif exit(-1); // continuing execution when SDL_Quit has already been run will result in a crash }
// display a line to the user. Assumes line doesn't end with a newline. VOID FAR DisplayLine(CHAR * szOutput) { if (hFileOutput) { #ifndef MAC // convert szOutput in-place to OEM char set AnsiToOem(szOutput, szOutput); #endif // !MAC fputs(szOutput, hFileOutput); fputs("\n", hFileOutput); #ifndef MAC // convert back to ANSI in case the caller reuses this string OemToAnsi(szOutput, szOutput); #endif // !MAC } else { #ifdef NO_MPW MacMessageBox(szOutput); #else //NO_MPW #ifndef WIN16 #ifndef MAC // convert szOutput in-place to OEM char set AnsiToOem(szOutput, szOutput); #endif // !MAC printf("%s\n", szOutput); #ifndef MAC // convert back to ANSI in case the caller reuses this string OemToAnsi(szOutput, szOutput); #endif // !MAC #else //!WIN16 // poor man's output under Windows MessageBox(NULL, szOutput, szAppTitle, MB_OK); #endif //!WIN16 #endif //NO_MPW } }