*** empty log message ***

This commit is contained in:
2006-10-30 14:31:37 +00:00
parent 09dd5ff969
commit 6be17e0e0c
8 changed files with 84 additions and 38 deletions

View File

@ -1,5 +1,5 @@
/*
* $Id: awk.h,v 1.136 2006-10-28 05:24:07 bacon Exp $
* $Id: awk.h,v 1.137 2006-10-30 14:31:36 bacon Exp $
*/
#ifndef _ASE_AWK_AWK_H_
@ -320,9 +320,12 @@ enum
/* assertion statement */
#ifdef NDEBUG
#define ASE_AWK_ASSERT(awk,expr) ((void)0)
#define ASE_AWK_ASSERTX(awk,expr,desc) ((void)0)
#else
#define ASE_AWK_ASSERT(awk,expr) (void)((expr) || \
(ase_awk_assertfail (awk, ASE_T(#expr), ASE_T(__FILE__), __LINE__), 0))
(ase_awk_assertfail (awk, ASE_T(#expr), ASE_NULL, ASE_T(__FILE__), __LINE__), 0))
#define ASE_AWK_ASSERTX(awk,expr,desc) (void)((expr) || \
(ase_awk_assertfail (awk, ASE_T(#expr), ASE_T(desc), ASE_T(__FILE__), __LINE__), 0))
#endif
#ifdef __cplusplus
@ -422,7 +425,8 @@ ase_char_t* ase_awk_strxnstr (
/* abort function for assertion. use ASE_AWK_ASSERT instead */
int ase_awk_assertfail (ase_awk_t* awk,
const ase_char_t* expr, const ase_char_t* file, int line);
const ase_char_t* expr, const ase_char_t* desc,
const ase_char_t* file, int line);
/* utility functions to convert an error number ot a string */
const ase_char_t* ase_awk_geterrstr (int errnum);

View File

@ -1,5 +1,5 @@
/*
* $Id: map.c,v 1.29 2006-10-26 09:27:15 bacon Exp $
* $Id: map.c,v 1.30 2006-10-30 14:31:37 bacon Exp $
*/
#include <ase/awk/awk_i.h>
@ -75,7 +75,9 @@ void ase_awk_map_clear (ase_awk_map_t* map)
map->buck[i] = ASE_NULL;
}
ASE_AWK_ASSERT (map->awk, map->size == 0);
ASE_AWK_ASSERTX (map->awk, map->size == 0,
"the map should not contain any pairs of a key and a value"
"after it has been cleared");
}
ase_awk_pair_t* ase_awk_map_get (

View File

@ -1,5 +1,5 @@
/*
* $Id: misc.c,v 1.34 2006-10-28 05:24:07 bacon Exp $
* $Id: misc.c,v 1.35 2006-10-30 14:31:37 bacon Exp $
*/
#include <ase/awk/awk_i.h>
@ -1061,11 +1061,22 @@ exit_loop:
}
int ase_awk_assertfail (ase_awk_t* awk,
const ase_char_t* expr, const ase_char_t* file, int line)
const ase_char_t* expr, const ase_char_t* desc,
const ase_char_t* file, int line)
{
awk->syscas.aprintf (
ASE_T("ASSERTION FAILURE AT FILE %s, LINE %d\n%s\n"),
file, line, expr);
if (desc == ASE_NULL)
{
awk->syscas.aprintf (
ASE_T("ASSERTION FAILURE AT FILE %s LINE %d\n%s\n"),
file, line, expr);
}
else
{
awk->syscas.aprintf (
ASE_T("ASSERTION FAILURE AT FILE %s LINE %d\n%s\n\nDESCRIPTION:\n%s\n"),
file, line, expr, desc);
}
awk->syscas.abort ();
return 0;
}

View File

@ -1,5 +1,5 @@
/*
* $Id: val.c,v 1.79 2006-10-29 13:00:39 bacon Exp $
* $Id: val.c,v 1.80 2006-10-30 14:31:37 bacon Exp $
*/
#include <ase/awk/awk_i.h>
@ -298,8 +298,10 @@ xp_printf (ASE_T("\n"));*/
}
else
{
ASE_AWK_ASSERT (run->awk,
!"should never happen - invalid value type");
ASE_AWK_ASSERTX (run->awk,
!"should never happen - invalid value type",
"the type of a value should be one of ASE_AWK_VAL_XXX's"
"defined in val.h");
}
}
@ -325,7 +327,10 @@ ase_awk_dprintval (val);
xp_printf (ASE_T("\n"));
*/
ASE_AWK_ASSERT (run->awk, val->ref > 0);
ASE_AWK_ASSERTX (run->awk, val->ref > 0,
"the reference count of a value should be greater than zero"
"for it to be decremented. check the source code for any bugs");
val->ref--;
if (val->ref <= 0)
{
@ -342,7 +347,9 @@ void ase_awk_refdownval_nofree (ase_awk_run_t* run, ase_awk_val_t* val)
{
if (ase_awk_isbuiltinval(val)) return;
ASE_AWK_ASSERT (run->awk, val->ref > 0);
ASE_AWK_ASSERTX (run->awk, val->ref > 0,
"the reference count of a value should be greater than zero"
"for it to be decremented. check the source code for any bugs");
val->ref--;
}
@ -368,7 +375,10 @@ ase_bool_t ase_awk_valtobool (ase_awk_run_t* run, ase_awk_val_t* val)
return ase_false; /* TODO: is this correct? */
}
ASE_AWK_ASSERT (run->awk, !"should never happen - invalid value type");
ASE_AWK_ASSERTX (run->awk,
!"should never happen - invalid value type",
"the type of a value should be one of ASE_AWK_VAL_XXX's"
"defined in val.h");
return ase_false;
}