enhanced assertion output for win32
This commit is contained in:
		| @ -127,6 +127,7 @@ void qse_assert_failed ( | ||||
|  | ||||
| #else  /* macintosh */ | ||||
|  | ||||
|  | ||||
| #if defined(HAVE_BACKTRACE) | ||||
| 	void* btarray[128]; | ||||
| 	qse_size_t btsize, i; | ||||
| @ -134,6 +135,36 @@ void qse_assert_failed ( | ||||
| #endif | ||||
| 	qse_sio_t* sio, siobuf; | ||||
|  | ||||
|  | ||||
| 	#if defined(_WIN32) | ||||
| 	{ | ||||
| 		HANDLE stderr; | ||||
|  | ||||
| 		stderr = GetStdHandle (STD_ERROR_HANDLE); | ||||
| 		if (stderr != INVALID_HANDLE_VALUE) | ||||
| 		{ | ||||
| 			DWORD mode; | ||||
| 			if (GetConsoleMode (stderr, &mode) == FALSE) | ||||
| 				stderr = INVALID_HANDLE_VALUE; | ||||
| 		} | ||||
|  | ||||
| 		if (stderr == INVALID_HANDLE_VALUE) | ||||
| 		{ | ||||
| 			/* Use a message box if stderr is not available */ | ||||
|  | ||||
| 			qse_char_t tmp[512]; | ||||
| 			qse_strxfmt (tmp, QSE_COUNTOF(tmp),  | ||||
| 				QSE_T("FILE %s LINE %lu - %s%s%s"),  | ||||
| 				file, line, expr,  | ||||
| 				(desc? QSE_T("\n\n"): QSE_T("")), | ||||
| 				(desc? desc: QSE_T("")) | ||||
| 			); | ||||
| 			MessageBox (QSE_NULL, tmp, QSE_T("ASSERTION FAILURE"), MB_OK | MB_ICONERROR); | ||||
| 			goto done; | ||||
| 		} | ||||
| 	} | ||||
| 	#endif | ||||
|  | ||||
| 	sio = &siobuf; | ||||
| 	qse_sio_initstd ( | ||||
| 		sio, QSE_MMGR_GETDFL(), QSE_SIO_STDERR,  | ||||
| @ -196,6 +227,7 @@ void qse_assert_failed ( | ||||
| 	qse_sio_fini (sio); | ||||
| #endif /* macintosh */ | ||||
|  | ||||
| done: | ||||
| #if defined(_WIN32) | ||||
| 	ExitProcess (249); | ||||
| #elif defined(__OS2__) | ||||
|  | ||||
| @ -24,7 +24,7 @@ | ||||
|  | ||||
| #if !defined(QSE_HAVE_CONFIG_H) | ||||
| #	if defined(_WIN32) || defined(__OS2__) || defined(__DOS__) | ||||
| #		if (defined(__WATCOMC__) && (__WATCOMC__ < 1200)) | ||||
| #		if (defined(__WATCOMC__) && (__WATCOMC__ < 1200)) || defined(__BORLANDC__) | ||||
| #			undef HAVE_VA_COPY | ||||
| #			undef HAVE___VA_COPY | ||||
| #		else | ||||
|  | ||||
		Reference in New Issue
	
	Block a user