2007-07-16 20:16:00 +00:00
|
|
|
/*
|
2007-07-17 20:20:00 +00:00
|
|
|
* $Id: assert.cpp,v 1.2 2007/07/16 11:12:12 bacon Exp $
|
2007-07-16 20:16:00 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "stdafx.h"
|
|
|
|
|
|
|
|
#ifndef NDEBUG
|
|
|
|
|
|
|
|
#include <ase/cmn/types.h>
|
|
|
|
#include <ase/cmn/macros.h>
|
|
|
|
#include <windows.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <tchar.h>
|
|
|
|
|
2007-07-17 20:20:00 +00:00
|
|
|
#pragma warning(disable:4996)
|
|
|
|
#pragma unmanaged
|
|
|
|
|
2007-07-16 20:16:00 +00:00
|
|
|
void ase_assert_abort (void)
|
|
|
|
{
|
|
|
|
::abort ();
|
|
|
|
}
|
|
|
|
|
|
|
|
void ase_assert_printf (const ase_char_t* fmt, ...)
|
|
|
|
{
|
|
|
|
va_list ap;
|
|
|
|
#ifdef _WIN32
|
|
|
|
int n;
|
|
|
|
ase_char_t buf[1024];
|
|
|
|
#endif
|
|
|
|
|
|
|
|
va_start (ap, fmt);
|
|
|
|
|
|
|
|
n = _vsntprintf (buf, ASE_COUNTOF(buf), fmt, ap);
|
|
|
|
if (n < 0) buf[ASE_COUNTOF(buf)-1] = ASE_T('\0');
|
|
|
|
|
|
|
|
//ase_vprintf (fmt, ap);
|
|
|
|
::MessageBox (NULL, buf,
|
|
|
|
ASE_T("ASSERTION FAILURE"), MB_OK|MB_ICONERROR);
|
|
|
|
|
|
|
|
va_end (ap);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|