This commit is contained in:
hyung-hwan 2008-06-10 00:57:20 +00:00
parent b8952fa1eb
commit 0c8fe75ed1
3 changed files with 9 additions and 81 deletions

View File

@ -45,39 +45,6 @@ struct mmgr_data_t
}; };
#endif #endif
#ifndef NDEBUG
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);
#if defined(_WIN32)
n = _vsntprintf (buf, ASE_COUNTOF(buf), fmt, ap);
if (n < 0) buf[ASE_COUNTOF(buf)-1] = ASE_T('\0');
#if defined(_MSC_VER) && (_MSC_VER<1400)
MessageBox (NULL, buf,
ASE_T("Assertion Failure"), MB_OK|MB_ICONERROR);
#else
MessageBox (NULL, buf,
ASE_T("\uB2DD\uAE30\uB9AC \uC870\uB610"), MB_OK|MB_ICONERROR);
#endif
#else
ase_vprintf (fmt, ap);
#endif
va_end (ap);
}
#endif
static void local_dprintf (const ase_char_t* fmt, ...) static void local_dprintf (const ase_char_t* fmt, ...)
{ {
va_list ap; va_list ap;

View File

@ -28,40 +28,6 @@
#include <mcheck.h> #include <mcheck.h>
#endif #endif
#ifndef NDEBUG
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);
#if defined(_WIN32)
n = _vsntprintf (buf, ASE_COUNTOF(buf), fmt, ap);
if (n < 0) buf[ASE_COUNTOF(buf)-1] = ASE_T('\0');
#if defined(_MSC_VER) && (_MSC_VER<1400)
MessageBox (NULL, buf,
ASE_T("Assertion Failure"), MB_OK|MB_ICONERROR);
#else
MessageBox (NULL, buf,
ASE_T("\uB2DD\uAE30\uB9AC \uC870\uB610"), MB_OK|MB_ICONERROR);
#endif
#else
ase_vprintf (fmt, ap);
#endif
va_end (ap);
}
#endif
static ase_ssize_t get_input ( static ase_ssize_t get_input (
int cmd, void* arg, ase_char_t* data, ase_size_t size) int cmd, void* arg, ase_char_t* data, ase_size_t size)
{ {

View File

@ -1,5 +1,5 @@
/* /*
* $Id: assert.c 200 2008-06-09 06:49:17Z baconevi $ * $Id: assert.c 201 2008-06-09 06:57:20Z baconevi $
*/ */
#include <ase/cmn/types.h> #include <ase/cmn/types.h>
@ -14,21 +14,16 @@ void ase_assert_failed (
const ase_char_t* expr, const ase_char_t* desc, const ase_char_t* expr, const ase_char_t* desc,
const ase_char_t* file, ase_size_t line) const ase_char_t* file, ase_size_t line)
{ {
if (desc == ASE_NULL) ase_fprintf (ASE_STDERR, ASE_T("=[ASSERTION FAILURE]============================================================"));
{ ase_fprintf (ASE_STDERR, ASE_T("FILE %s LINE %lu: %s\n"),
ase_fprintf (
ASE_STDERR,
ASE_T("ASSERTION FAILURE AT FILE %s LINE %lu\n%s\n"),
file, (unsigned long)line, expr); file, (unsigned long)line, expr);
}
else
{
ase_fprintf (
ASE_STDERR,
ASE_T("ASSERTION FAILURE AT FILE %s LINE %lu\n%s\n\nDESCRIPTION:\n%s\n"),
file, (unsigned long)line, expr, desc);
if (desc != ASE_NULL)
{
ase_fprintf (ASE_STDERR, ASE_T("DESCRIPTION: %s\n"),
file, (unsigned long)line, expr, desc);
} }
ase_fprintf (ASE_STDERR, ASE_T("================================================================================"));
abort (); abort ();
} }