*** empty log message ***

This commit is contained in:
hyung-hwan 2007-03-06 15:01:50 +00:00
parent 6fa4030f96
commit 09c4068531
7 changed files with 23 additions and 49 deletions

View File

@ -1,5 +1,5 @@
/*
* $Id: misc.c,v 1.1 2007-03-06 14:29:27 bacon Exp $
* $Id: misc.c,v 1.2 2007-03-06 15:01:50 bacon Exp $
*
* {License}
*/
@ -7,6 +7,8 @@
#include <ase/cmn/types.h>
#include <ase/cmn/macros.h>
#ifndef NDEBUG
int ase_assert_failed (
const ase_char_t* expr, const ase_char_t* desc,
const ase_char_t* file, ase_size_t line)
@ -29,3 +31,5 @@ int ase_assert_failed (
return 0;
}
#endif

View File

@ -1,5 +1,5 @@
/*
* $Id: err.c,v 1.14 2007-03-02 11:14:35 bacon Exp $
* $Id: err.c,v 1.15 2007-03-06 14:59:59 bacon Exp $
*
* {License}
*/
@ -55,7 +55,7 @@ void ase_lsp_seterror (
{
const ase_char_t* errfmt;
ASE_LSP_ASSERT (lsp, argcnt <= 5);
ASE_ASSERT (argcnt <= 5);
lsp->errnum = errnum;
errfmt = __geterrstr (errnum);

View File

@ -1,5 +1,5 @@
/*
* $Id: lsp.h,v 1.42 2007-03-06 14:58:00 bacon Exp $
* $Id: lsp.h,v 1.43 2007-03-06 14:59:59 bacon Exp $
*
* {License}
*/
@ -116,12 +116,6 @@ int ase_lsp_addprim (
ase_lsp_prim_t prim, ase_size_t min_args, ase_size_t max_args);
int ase_lsp_removeprim (ase_lsp_t* lsp, const ase_char_t* name);
/* abort function for assertion. use ASE_LSP_ASSERT instead */
int ase_lsp_assertfail (ase_lsp_t* lsp,
const ase_char_t* expr, const ase_char_t* desc,
const ase_char_t* file, int line);
#ifdef __cplusplus
}
#endif

View File

@ -1,5 +1,5 @@
/*
* $Id: mem.c,v 1.32 2007-02-24 14:32:11 bacon Exp $
* $Id: mem.c,v 1.33 2007-03-06 14:58:00 bacon Exp $
*
* {License}
*/
@ -138,8 +138,8 @@ ase_lsp_gc (mem);
void ase_lsp_dispose (
ase_lsp_mem_t* mem, ase_lsp_obj_t* prev, ase_lsp_obj_t* obj)
{
ASE_LSP_ASSERT (mem->lsp, obj != ASE_NULL);
ASE_LSP_ASSERT (mem->lsp, mem->count > 0);
ASE_ASSERT (obj != ASE_NULL);
ASE_ASSERT (mem->count > 0);
/* TODO: push the object to the free list for more
* efficient memory management */
@ -176,7 +176,7 @@ void ase_lsp_dispose_all (ase_lsp_mem_t* mem)
static void __mark_obj (ase_lsp_t* lsp, ase_lsp_obj_t* obj)
{
ASE_LSP_ASSERT (lsp, obj != ASE_NULL);
ASE_ASSERT (obj != ASE_NULL);
// TODO:....
// can it be recursive?
@ -206,18 +206,18 @@ static void __mark_obj (ase_lsp_t* lsp, ase_lsp_obj_t* obj)
*/
void ase_lsp_lockobj (ase_lsp_t* lsp, ase_lsp_obj_t* obj)
{
ASE_LSP_ASSERTX (lsp, obj != ASE_NULL,
ASE_ASSERTX (obj != ASE_NULL,
"an object pointer should not be ASE_NULL");
if (ASE_LSP_PERM(obj) == 0) ASE_LSP_LOCK(obj)++;
}
void ase_lsp_unlockobj (ase_lsp_t* lsp, ase_lsp_obj_t* obj)
{
ASE_LSP_ASSERTX (lsp, obj != ASE_NULL,
ASE_ASSERTX (obj != ASE_NULL,
"an object pointer should not be ASE_NULL");
if (ASE_LSP_PERM(obj) != 0) return;
ASE_LSP_ASSERTX (lsp, ASE_LSP_LOCK(obj) > 0,
ASE_ASSERTX (ASE_LSP_LOCK(obj) > 0,
"the lock count should be greater than zero to be unlocked");
ASE_LSP_LOCK(obj)--;
@ -225,12 +225,12 @@ void ase_lsp_unlockobj (ase_lsp_t* lsp, ase_lsp_obj_t* obj)
void ase_lsp_deepunlockobj (ase_lsp_t* lsp, ase_lsp_obj_t* obj)
{
ASE_LSP_ASSERTX (lsp, obj != ASE_NULL,
ASE_ASSERTX (obj != ASE_NULL,
"an object pointer should not be ASE_NULL");
if (ASE_LSP_PERM(obj) == 0)
{
ASE_LSP_ASSERTX (lsp, ASE_LSP_LOCK(obj) > 0,
ASE_ASSERTX (ASE_LSP_LOCK(obj) > 0,
"the lock count should be greater than zero to be unlocked");
ASE_LSP_LOCK(obj)--;
}
@ -532,7 +532,7 @@ ase_lsp_assoc_t* ase_lsp_lookup (ase_lsp_mem_t* mem, ase_lsp_obj_t* name)
ase_lsp_frame_t* frame;
ase_lsp_assoc_t* assoc;
ASE_LSP_ASSERT (mem->lsp, ASE_LSP_TYPE(name) == ASE_LSP_OBJ_SYM);
ASE_ASSERT (ASE_LSP_TYPE(name) == ASE_LSP_OBJ_SYM);
frame = mem->frame;
@ -584,7 +584,7 @@ ase_size_t ase_lsp_conslen (ase_lsp_mem_t* mem, ase_lsp_obj_t* obj)
{
ase_size_t count;
ASE_LSP_ASSERT (mem->lsp,
ASE_ASSERT (
obj == mem->nil || ASE_LSP_TYPE(obj) == ASE_LSP_OBJ_CONS);
count = 0;

View File

@ -1,5 +1,5 @@
/*
* $Id: misc.c,v 1.10 2007-02-24 14:32:11 bacon Exp $
* $Id: misc.c,v 1.11 2007-03-06 14:58:00 bacon Exp $
*
* {License}
*/
@ -573,25 +573,3 @@ ase_size_t ase_lsp_longtostr (
return ret;
}
int ase_lsp_assertfail (ase_lsp_t* lsp,
const ase_char_t* expr, const ase_char_t* desc,
const ase_char_t* file, int line)
{
if (desc == ASE_NULL)
{
lsp->prmfns.misc.aprintf (
lsp->prmfns.misc.custom_data,
ASE_T("ASSERTION FAILURE AT FILE %s LINE %d\n%s\n"),
file, line, expr);
}
else
{
lsp->prmfns.misc.aprintf (
lsp->prmfns.misc.custom_data,
ASE_T("ASSERTION FAILURE AT FILE %s LINE %d\n%s\n\nDESCRIPTION:\n%s\n"),
file, line, expr, desc);
}
lsp->prmfns.misc.abort (lsp->prmfns.misc.custom_data);
return 0;
}

View File

@ -1,5 +1,5 @@
/*
* $Id: read.c,v 1.32 2007-02-11 07:36:55 bacon Exp $
* $Id: read.c,v 1.33 2007-03-06 14:58:00 bacon Exp $
*
* {License}
*/
@ -117,7 +117,7 @@ static ase_lsp_obj_t* read_obj (ase_lsp_t* lsp)
return obj;
case TOKEN_IDENT:
ASE_LSP_ASSERT (lsp,
ASE_ASSERT (
lsp->mem->nil != ASE_NULL &&
lsp->mem->t != ASE_NULL);
@ -272,7 +272,7 @@ static int read_char (ase_lsp_t* lsp)
static int read_token (ase_lsp_t* lsp)
{
ASE_LSP_ASSERT (lsp, lsp->input_func != ASE_NULL);
ASE_ASSERT (lsp->input_func != ASE_NULL);
TOKEN_CLEAR (lsp);

View File

@ -301,9 +301,7 @@ int lsp_main (int argc, ase_char_t* argv[])
prmfns.ccls.custom_data = ASE_NULL;
prmfns.misc.sprintf = custom_lsp_sprintf;
prmfns.misc.aprintf = custom_lsp_aprintf;
prmfns.misc.dprintf = custom_lsp_dprintf;
prmfns.misc.abort = custom_lsp_abort;
prmfns.misc.custom_data = ASE_NULL;
lsp = ase_lsp_open (&prmfns, mem, inc);