qse/ase/lib/utl/assert.c

33 lines
774 B
C
Raw Normal View History

2008-06-04 03:00:14 +00:00
/*
2008-06-27 00:44:41 +00:00
* $Id: assert.c 223 2008-06-26 06:44:41Z baconevi $
2008-06-04 03:00:14 +00:00
*/
2008-06-27 00:44:41 +00:00
#include <ase/types.h>
#include <ase/macros.h>
2008-06-07 04:19:57 +00:00
2008-06-04 03:00:14 +00:00
#ifndef NDEBUG
2008-06-10 00:49:17 +00:00
#include <ase/utl/stdio.h>
2008-06-04 03:00:14 +00:00
#include <stdlib.h>
2008-06-10 00:49:17 +00:00
void ase_assert_failed (
2008-06-07 04:19:57 +00:00
const ase_char_t* expr, const ase_char_t* desc,
const ase_char_t* file, ase_size_t line)
2008-06-04 03:00:14 +00:00
{
2008-06-10 00:57:20 +00:00
ase_fprintf (ASE_STDERR, ASE_T("=[ASSERTION FAILURE]============================================================"));
ase_fprintf (ASE_STDERR, ASE_T("FILE %s LINE %lu: %s\n"),
file, (unsigned long)line, expr);
if (desc != ASE_NULL)
2008-06-07 04:19:57 +00:00
{
2008-06-10 00:57:20 +00:00
ase_fprintf (ASE_STDERR, ASE_T("DESCRIPTION: %s\n"),
2008-06-07 04:19:57 +00:00
file, (unsigned long)line, expr, desc);
}
2008-06-10 00:57:20 +00:00
ase_fprintf (ASE_STDERR, ASE_T("================================================================================"));
2008-06-07 04:19:57 +00:00
2008-06-04 03:00:14 +00:00
abort ();
}
#endif