*** empty log message ***

This commit is contained in:
hyung-hwan 2007-03-08 13:58:52 +00:00
parent b7d81d2544
commit 8a7e79a9c9
3 changed files with 55 additions and 52 deletions

View File

@ -1,5 +1,5 @@
/* /*
* $Id: prim_compar.c,v 1.15 2007-03-07 12:14:29 bacon Exp $ * $Id: prim_compar.c,v 1.16 2007-03-08 13:58:52 bacon Exp $
* *
* {License} * {License}
*/ */
@ -10,7 +10,7 @@
{ \ { \
ase_lsp_obj_t* p1, * p2; \ ase_lsp_obj_t* p1, * p2; \
int res; \ int res; \
ASE_ASSERT (lsp, ASE_LSP_TYPE(args) == ASE_LSP_OBJ_CONS); \ ASE_ASSERT (ASE_LSP_TYPE(args) == ASE_LSP_OBJ_CONS); \
\ \
p1 = ase_lsp_eval (lsp, ASE_LSP_CAR(args)); \ p1 = ase_lsp_eval (lsp, ASE_LSP_CAR(args)); \
if (p1 == ASE_NULL) return ASE_NULL; \ if (p1 == ASE_NULL) return ASE_NULL; \

View File

@ -1,5 +1,5 @@
/* /*
* $Id: prim_math.c,v 1.19 2007-02-13 06:00:20 bacon Exp $ * $Id: prim_math.c,v 1.20 2007-03-08 13:58:52 bacon Exp $
* *
* {License} * {License}
*/ */
@ -13,7 +13,7 @@ ase_lsp_obj_t* ase_lsp_prim_plus (ase_lsp_t* lsp, ase_lsp_obj_t* args)
ase_real_t rval = .0; ase_real_t rval = .0;
ase_bool_t realnum = ase_false; ase_bool_t realnum = ase_false;
ASE_LSP_ASSERT (lsp, ASE_LSP_TYPE(args) == ASE_LSP_OBJ_CONS); ASE_ASSERT (ASE_LSP_TYPE(args) == ASE_LSP_OBJ_CONS);
body = args; body = args;
while (ASE_LSP_TYPE(body) == ASE_LSP_OBJ_CONS) while (ASE_LSP_TYPE(body) == ASE_LSP_OBJ_CONS)
@ -25,7 +25,7 @@ ase_lsp_obj_t* ase_lsp_prim_plus (ase_lsp_t* lsp, ase_lsp_obj_t* args)
{ {
if (body == args) if (body == args)
{ {
ASE_LSP_ASSERT (lsp, realnum == ase_false); ASE_ASSERT (realnum == ase_false);
ival = ASE_LSP_IVAL(tmp); ival = ASE_LSP_IVAL(tmp);
} }
else else
@ -40,7 +40,7 @@ ase_lsp_obj_t* ase_lsp_prim_plus (ase_lsp_t* lsp, ase_lsp_obj_t* args)
{ {
if (body == args) if (body == args)
{ {
ASE_LSP_ASSERT (lsp, realnum == ase_false); ASE_ASSERT (realnum == ase_false);
realnum = ase_true; realnum = ase_true;
rval = ASE_LSP_RVAL(tmp); rval = ASE_LSP_RVAL(tmp);
} }
@ -64,7 +64,7 @@ ase_lsp_obj_t* ase_lsp_prim_plus (ase_lsp_t* lsp, ase_lsp_obj_t* args)
body = ASE_LSP_CDR(body); body = ASE_LSP_CDR(body);
} }
ASE_LSP_ASSERT (lsp, body == lsp->mem->nil); ASE_ASSERT (body == lsp->mem->nil);
tmp = (realnum)? tmp = (realnum)?
ase_lsp_makerealobj (lsp->mem, rval): ase_lsp_makerealobj (lsp->mem, rval):
@ -81,7 +81,7 @@ ase_lsp_obj_t* ase_lsp_prim_minus (ase_lsp_t* lsp, ase_lsp_obj_t* args)
ase_real_t rval = .0; ase_real_t rval = .0;
ase_bool_t realnum = ase_false; ase_bool_t realnum = ase_false;
ASE_LSP_ASSERT (lsp, ASE_LSP_TYPE(args) == ASE_LSP_OBJ_CONS); ASE_ASSERT (ASE_LSP_TYPE(args) == ASE_LSP_OBJ_CONS);
body = args; body = args;
while (ASE_LSP_TYPE(body) == ASE_LSP_OBJ_CONS) while (ASE_LSP_TYPE(body) == ASE_LSP_OBJ_CONS)
@ -94,7 +94,7 @@ ase_lsp_obj_t* ase_lsp_prim_minus (ase_lsp_t* lsp, ase_lsp_obj_t* args)
{ {
if (body == args) if (body == args)
{ {
ASE_LSP_ASSERT (lsp, realnum == ase_false); ASE_ASSERT (realnum == ase_false);
ival = ASE_LSP_IVAL(tmp); ival = ASE_LSP_IVAL(tmp);
} }
else else
@ -109,7 +109,7 @@ ase_lsp_obj_t* ase_lsp_prim_minus (ase_lsp_t* lsp, ase_lsp_obj_t* args)
{ {
if (body == args) if (body == args)
{ {
ASE_LSP_ASSERT (lsp, realnum == ase_false); ASE_ASSERT (realnum == ase_false);
realnum = ase_true; realnum = ase_true;
rval = ASE_LSP_RVAL(tmp); rval = ASE_LSP_RVAL(tmp);
} }
@ -133,7 +133,7 @@ ase_lsp_obj_t* ase_lsp_prim_minus (ase_lsp_t* lsp, ase_lsp_obj_t* args)
body = ASE_LSP_CDR(body); body = ASE_LSP_CDR(body);
} }
ASE_LSP_ASSERT (lsp, body == lsp->mem->nil); ASE_ASSERT (body == lsp->mem->nil);
tmp = (realnum)? tmp = (realnum)?
ase_lsp_makerealobj (lsp->mem, rval): ase_lsp_makerealobj (lsp->mem, rval):
@ -150,7 +150,7 @@ ase_lsp_obj_t* ase_lsp_prim_mul (ase_lsp_t* lsp, ase_lsp_obj_t* args)
ase_real_t rval = .0; ase_real_t rval = .0;
ase_bool_t realnum = ase_false; ase_bool_t realnum = ase_false;
ASE_LSP_ASSERT (lsp, ASE_LSP_TYPE(args) == ASE_LSP_OBJ_CONS); ASE_ASSERT (ASE_LSP_TYPE(args) == ASE_LSP_OBJ_CONS);
body = args; body = args;
while (ASE_LSP_TYPE(body) == ASE_LSP_OBJ_CONS) while (ASE_LSP_TYPE(body) == ASE_LSP_OBJ_CONS)
@ -162,7 +162,7 @@ ase_lsp_obj_t* ase_lsp_prim_mul (ase_lsp_t* lsp, ase_lsp_obj_t* args)
{ {
if (body == args) if (body == args)
{ {
ASE_LSP_ASSERT (lsp, realnum == ase_false); ASE_ASSERT (realnum == ase_false);
ival = ASE_LSP_IVAL(tmp); ival = ASE_LSP_IVAL(tmp);
} }
else else
@ -177,7 +177,7 @@ ase_lsp_obj_t* ase_lsp_prim_mul (ase_lsp_t* lsp, ase_lsp_obj_t* args)
{ {
if (body == args) if (body == args)
{ {
ASE_LSP_ASSERT (lsp, realnum == ase_false); ASE_ASSERT (realnum == ase_false);
realnum = ase_true; realnum = ase_true;
rval = ASE_LSP_RVAL(tmp); rval = ASE_LSP_RVAL(tmp);
} }
@ -201,7 +201,7 @@ ase_lsp_obj_t* ase_lsp_prim_mul (ase_lsp_t* lsp, ase_lsp_obj_t* args)
body = ASE_LSP_CDR(body); body = ASE_LSP_CDR(body);
} }
ASE_LSP_ASSERT (lsp, body == lsp->mem->nil); ASE_ASSERT (body == lsp->mem->nil);
tmp = (realnum)? tmp = (realnum)?
ase_lsp_makerealobj (lsp->mem, rval): ase_lsp_makerealobj (lsp->mem, rval):
@ -218,7 +218,7 @@ ase_lsp_obj_t* ase_lsp_prim_div (ase_lsp_t* lsp, ase_lsp_obj_t* args)
ase_real_t rval = .0; ase_real_t rval = .0;
ase_bool_t realnum = ase_false; ase_bool_t realnum = ase_false;
ASE_LSP_ASSERT (lsp, ASE_LSP_TYPE(args) == ASE_LSP_OBJ_CONS); ASE_ASSERT (ASE_LSP_TYPE(args) == ASE_LSP_OBJ_CONS);
body = args; body = args;
while (ASE_LSP_TYPE(body) == ASE_LSP_OBJ_CONS) while (ASE_LSP_TYPE(body) == ASE_LSP_OBJ_CONS)
@ -230,7 +230,7 @@ ase_lsp_obj_t* ase_lsp_prim_div (ase_lsp_t* lsp, ase_lsp_obj_t* args)
{ {
if (body == args) if (body == args)
{ {
ASE_LSP_ASSERT (lsp, realnum == ase_false); ASE_ASSERT (realnum == ase_false);
ival = ASE_LSP_IVAL(tmp); ival = ASE_LSP_IVAL(tmp);
} }
else else
@ -252,7 +252,7 @@ ase_lsp_obj_t* ase_lsp_prim_div (ase_lsp_t* lsp, ase_lsp_obj_t* args)
{ {
if (body == args) if (body == args)
{ {
ASE_LSP_ASSERT (lsp, realnum == ase_false); ASE_ASSERT (realnum == ase_false);
realnum = ase_true; realnum = ase_true;
rval = ASE_LSP_RVAL(tmp); rval = ASE_LSP_RVAL(tmp);
} }
@ -276,7 +276,7 @@ ase_lsp_obj_t* ase_lsp_prim_div (ase_lsp_t* lsp, ase_lsp_obj_t* args)
body = ASE_LSP_CDR(body); body = ASE_LSP_CDR(body);
} }
ASE_LSP_ASSERT (lsp, body == lsp->mem->nil); ASE_ASSERT (body == lsp->mem->nil);
tmp = (realnum)? tmp = (realnum)?
ase_lsp_makerealobj (lsp->mem, rval): ase_lsp_makerealobj (lsp->mem, rval):
@ -291,7 +291,7 @@ ase_lsp_obj_t* ase_lsp_prim_mod (ase_lsp_t* lsp, ase_lsp_obj_t* args)
ase_lsp_obj_t* body, * tmp; ase_lsp_obj_t* body, * tmp;
ase_long_t ival = 0; ase_long_t ival = 0;
ASE_LSP_ASSERT (lsp, ASE_LSP_TYPE(args) == ASE_LSP_OBJ_CONS); ASE_ASSERT (ASE_LSP_TYPE(args) == ASE_LSP_OBJ_CONS);
body = args; body = args;
while (ASE_LSP_TYPE(body) == ASE_LSP_OBJ_CONS) while (ASE_LSP_TYPE(body) == ASE_LSP_OBJ_CONS)
@ -342,7 +342,7 @@ ase_lsp_obj_t* ase_lsp_prim_mod (ase_lsp_t* lsp, ase_lsp_obj_t* args)
body = ASE_LSP_CDR(body); body = ASE_LSP_CDR(body);
} }
ASE_LSP_ASSERT (lsp, body == lsp->mem->nil); ASE_ASSERT (body == lsp->mem->nil);
tmp = ase_lsp_makeintobj (lsp->mem, ival); tmp = ase_lsp_makeintobj (lsp->mem, ival);
if (tmp == ASE_NULL) return ASE_NULL; if (tmp == ASE_NULL) return ASE_NULL;

View File

@ -28,6 +28,40 @@
#include <ase/utl/main.c> #include <ase/utl/main.c>
#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)
{ {
@ -193,12 +227,6 @@ static ase_cint_t custom_lsp_tolower (void* custom, ase_cint_t c)
return ase_tolower (c); return ase_tolower (c);
} }
static void custom_lsp_abort (void* custom)
{
abort ();
}
static int custom_lsp_sprintf ( static int custom_lsp_sprintf (
void* custom, ase_char_t* buf, ase_size_t size, void* custom, ase_char_t* buf, ase_size_t size,
const ase_char_t* fmt, ...) const ase_char_t* fmt, ...)
@ -213,31 +241,6 @@ static int custom_lsp_sprintf (
return n; return n;
} }
static void custom_lsp_aprintf (void* custom, 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);
}
static void custom_lsp_dprintf (void* custom, const ase_char_t* fmt, ...) static void custom_lsp_dprintf (void* custom, const ase_char_t* fmt, ...)
{ {