*** empty log message ***

This commit is contained in:
hyung-hwan 2007-03-06 14:29:27 +00:00
parent 718ff6fe48
commit 8176d0c895
5 changed files with 62 additions and 9 deletions

View File

@ -1,5 +1,5 @@
/* /*
* $Id: macros.h,v 1.1 2007-03-06 14:16:52 bacon Exp $ * $Id: macros.h,v 1.2 2007-03-06 14:29:04 bacon Exp $
* *
* {License} * {License}
*/ */
@ -56,11 +56,11 @@
#define ASE_REPEAT(n,blk) \ #define ASE_REPEAT(n,blk) \
do { \ do { \
ase_size_t __ase_repeat_x1 = (ase_size_t)(n); \ ase_size_t __ase_repeat_x1__ = (ase_size_t)(n); \
ase_size_t __ase_repeat_x2 = __ase_repeat_x1 >> 4; \ ase_size_t __ase_repeat_x2__ = __ase_repeat_x1__ >> 4; \
__ase_repeat_x1 &= 15; \ __ase_repeat_x1__ &= 15; \
while (__ase_repeat_x1-- > 0) { blk; } \ while (__ase_repeat_x1__-- > 0) { blk; } \
while (__ase_repeat_x2-- > 0) { \ while (__ase_repeat_x2__-- > 0) { \
blk; blk; blk; blk; blk; blk; blk; blk; \ blk; blk; blk; blk; blk; blk; blk; blk; \
blk; blk; blk; blk; blk; blk; blk; blk; \ blk; blk; blk; blk; blk; blk; blk; blk; \
} \ } \
@ -96,6 +96,28 @@
#define ASE_END_PACKED_STRUCT() }; #define ASE_END_PACKED_STRUCT() };
#endif #endif
#ifdef NDEBUG
#define ASE_ASSERT(awk,expr) ((void)0)
#define ASE_ASSERTX(awk,expr,desc) ((void)0)
#else
#ifdef __cplusplus
extern "C" {
#endif
void ase_assert_abort (void);
void ase_assert_printf (const ase_char_t* fmt, ...);
int ase_assert_failed (
const ase_char_t* expr, const ase_char_t* desc,
const ase_char_t* file, ase_size_t line);
#ifdef __cplusplus
}
#endif
#define ASE_ASSERT(awk,expr) (void)((expr) || \
(ase_assert_failed (ASE_T(#expr), ASE_NULL, ASE_T(__FILE__), __LINE__), 0))
#define ASE_ASSERTX(awk,expr,desc) (void)((expr) || \
(ase_assert_failed (ASE_T(#expr), ASE_T(desc), ASE_T(__FILE__), __LINE__), 0))
#endif
#define ASE_MALLOC(mmgr,size) (mmgr)->malloc((mmgr)->custom_data, size) #define ASE_MALLOC(mmgr,size) (mmgr)->malloc((mmgr)->custom_data, size)
#define ASE_REALLOC(mmgr,ptr,size) (mmgr)->realloc((mmgr)->custom_data, ptr, size) #define ASE_REALLOC(mmgr,ptr,size) (mmgr)->realloc((mmgr)->custom_data, ptr, size)
#define ASE_FREE(mmgr,ptr) (mmgr)->free((mmgr)->custom_data, ptr) #define ASE_FREE(mmgr,ptr) (mmgr)->free((mmgr)->custom_data, ptr)

View File

@ -1,6 +1,6 @@
OUT = asecmn OUT = asecmn
C_SRCS = mem.c str.c C_SRCS = mem.c str.c misc.c
C_OBJS = $(C_SRCS:.c=.o) C_OBJS = $(C_SRCS:.c=.o)
CC = @CC@ CC = @CC@

View File

@ -1,6 +1,6 @@
OUT = asecmn OUT = asecmn
C_SRCS = mem.c str.c C_SRCS = mem.c str.c misc.c
C_OBJS = $(C_SRCS:.c=.obj) C_OBJS = $(C_SRCS:.c=.obj)
CC = bcc32 CC = bcc32

View File

@ -1,6 +1,6 @@
OUT = asecmn OUT = asecmn
C_SRCS = mem.c str.c C_SRCS = mem.c str.c misc.c
C_OBJS = $(C_SRCS:.c=.obj) C_OBJS = $(C_SRCS:.c=.obj)
CC = cl CC = cl

31
ase/cmn/misc.c Normal file
View File

@ -0,0 +1,31 @@
/*
* $Id: misc.c,v 1.1 2007-03-06 14:29:27 bacon Exp $
*
* {License}
*/
#include <ase/cmn/types.h>
#include <ase/cmn/macros.h>
int ase_assert_failed (
const ase_char_t* expr, const ase_char_t* desc,
const ase_char_t* file, ase_size_t line)
{
if (desc == ASE_NULL)
{
ase_assert_printf (
ASE_T("ASSERTION FAILURE AT FILE %s LINE %lu\n%s\n"),
file, (unsigned long)line, expr);
}
else
{
ase_assert_printf (
ASE_T("ASSERTION FAILURE AT FILE %s LINE %lu\n%s\n\nDESCRIPTION:\n%s\n"),
file, (unsigned long)line, expr, desc);
}
ase_assert_abort ();
return 0;
}