*** empty log message ***
This commit is contained in:
parent
09dd5ff969
commit
6be17e0e0c
@ -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_
|
#ifndef _ASE_AWK_AWK_H_
|
||||||
@ -320,9 +320,12 @@ enum
|
|||||||
/* assertion statement */
|
/* assertion statement */
|
||||||
#ifdef NDEBUG
|
#ifdef NDEBUG
|
||||||
#define ASE_AWK_ASSERT(awk,expr) ((void)0)
|
#define ASE_AWK_ASSERT(awk,expr) ((void)0)
|
||||||
|
#define ASE_AWK_ASSERTX(awk,expr,desc) ((void)0)
|
||||||
#else
|
#else
|
||||||
#define ASE_AWK_ASSERT(awk,expr) (void)((expr) || \
|
#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
|
#endif
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
@ -422,7 +425,8 @@ ase_char_t* ase_awk_strxnstr (
|
|||||||
|
|
||||||
/* abort function for assertion. use ASE_AWK_ASSERT instead */
|
/* abort function for assertion. use ASE_AWK_ASSERT instead */
|
||||||
int ase_awk_assertfail (ase_awk_t* awk,
|
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 */
|
/* utility functions to convert an error number ot a string */
|
||||||
const ase_char_t* ase_awk_geterrstr (int errnum);
|
const ase_char_t* ase_awk_geterrstr (int errnum);
|
||||||
|
@ -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>
|
#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;
|
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 (
|
ase_awk_pair_t* ase_awk_map_get (
|
||||||
|
@ -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>
|
#include <ase/awk/awk_i.h>
|
||||||
@ -1061,11 +1061,22 @@ exit_loop:
|
|||||||
}
|
}
|
||||||
|
|
||||||
int ase_awk_assertfail (ase_awk_t* awk,
|
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)
|
||||||
|
{
|
||||||
|
if (desc == ASE_NULL)
|
||||||
{
|
{
|
||||||
awk->syscas.aprintf (
|
awk->syscas.aprintf (
|
||||||
ASE_T("ASSERTION FAILURE AT FILE %s, LINE %d\n%s\n"),
|
ASE_T("ASSERTION FAILURE AT FILE %s LINE %d\n%s\n"),
|
||||||
file, line, expr);
|
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 ();
|
awk->syscas.abort ();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -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>
|
#include <ase/awk/awk_i.h>
|
||||||
@ -298,8 +298,10 @@ xp_printf (ASE_T("\n"));*/
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ASE_AWK_ASSERT (run->awk,
|
ASE_AWK_ASSERTX (run->awk,
|
||||||
!"should never happen - invalid value type");
|
!"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"));
|
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--;
|
val->ref--;
|
||||||
if (val->ref <= 0)
|
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;
|
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--;
|
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? */
|
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;
|
return ase_false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* $Id: lsp.h,v 1.32 2006-10-30 11:26:56 bacon Exp $
|
* $Id: lsp.h,v 1.33 2006-10-30 14:31:37 bacon Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _ASE_LSP_LSP_H_
|
#ifndef _ASE_LSP_LSP_H_
|
||||||
@ -93,14 +93,17 @@ enum
|
|||||||
|
|
||||||
typedef ase_lsp_obj_t* (*ase_lsp_prim_t) (ase_lsp_t* lsp, ase_lsp_obj_t* obj);
|
typedef ase_lsp_obj_t* (*ase_lsp_prim_t) (ase_lsp_t* lsp, ase_lsp_obj_t* obj);
|
||||||
|
|
||||||
|
/* assertion statement */
|
||||||
#ifdef NDEBUG
|
#ifdef NDEBUG
|
||||||
#define ASE_LSP_ASSERT(lsp,expr) ((void)0)
|
#define ASE_LSP_ASSERT(lsp,expr) ((void)0)
|
||||||
|
#define ASE_LSP_ASSERTX(lsp,expr,desc) ((void)0)
|
||||||
#else
|
#else
|
||||||
#define ASE_LSP_ASSERT(lsp,expr) (void)((expr) || \
|
#define ASE_LSP_ASSERT(lsp,expr) (void)((expr) || \
|
||||||
(ase_lsp_assertfail(lsp, ASE_T(#expr), ASE_T(__FILE__), __LINE__), 0))
|
(ase_lsp_assertfail (lsp, ASE_T(#expr), ASE_NULL, ASE_T(__FILE__), __LINE__), 0))
|
||||||
|
#define ASE_LSP_ASSERTX(lsp,expr,desc) (void)((expr) || \
|
||||||
|
(ase_lsp_assertfail (lsp, ASE_T(#expr), ASE_T(desc), ASE_T(__FILE__), __LINE__), 0))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
@ -158,7 +161,8 @@ ase_char_t* ase_lsp_strxnstr (
|
|||||||
|
|
||||||
/* abort function for assertion. use ASE_LSP_ASSERT instead */
|
/* abort function for assertion. use ASE_LSP_ASSERT instead */
|
||||||
int ase_lsp_assertfail (ase_lsp_t* lsp,
|
int ase_lsp_assertfail (ase_lsp_t* lsp,
|
||||||
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);
|
||||||
|
|
||||||
const ase_char_t* ase_lsp_geterrstr (int errnum);
|
const ase_char_t* ase_lsp_geterrstr (int errnum);
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* $Id: mem.c,v 1.20 2006-10-30 11:26:56 bacon Exp $
|
* $Id: mem.c,v 1.21 2006-10-30 14:31:37 bacon Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <ase/lsp/lsp_i.h>
|
#include <ase/lsp/lsp_i.h>
|
||||||
@ -224,22 +224,27 @@ 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)
|
void ase_lsp_lockobj (ase_lsp_t* lsp, ase_lsp_obj_t* obj)
|
||||||
{
|
{
|
||||||
ASE_LSP_ASSERT (lsp, obj != ASE_NULL);
|
ASE_LSP_ASSERTX (lsp, obj != ASE_NULL,
|
||||||
ASE_LSP_LOCK(obj) = 1;
|
"an object pointer should not be ASE_NULL");
|
||||||
//ASE_LSP_MARK(obj) = 1;
|
ASE_LSP_LOCK(obj)++;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ase_lsp_unlockobj (ase_lsp_t* lsp, ase_lsp_obj_t* obj)
|
void ase_lsp_unlockobj (ase_lsp_t* lsp, ase_lsp_obj_t* obj)
|
||||||
{
|
{
|
||||||
ASE_LSP_ASSERT (lsp, obj != ASE_NULL);
|
ASE_LSP_ASSERTX (lsp, obj != ASE_NULL,
|
||||||
ASE_LSP_LOCK(obj) = 0;
|
"an object pointer should not be ASE_NULL");
|
||||||
|
ASE_LSP_ASSERTX (lsp, ASE_LSP_LOCK(obj) > 0,
|
||||||
|
"the lock count should be greater than zero to be unlocked");
|
||||||
|
ASE_LSP_LOCK(obj)--;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ase_lsp_unlockallobjs (ase_lsp_t* lsp, ase_lsp_obj_t* obj)
|
void ase_lsp_unlockallobjs (ase_lsp_t* lsp, ase_lsp_obj_t* obj)
|
||||||
{
|
{
|
||||||
ASE_LSP_ASSERT (lsp, obj != ASE_NULL);
|
ASE_LSP_ASSERTX (lsp, obj != ASE_NULL,
|
||||||
|
"an object pointer should not be ASE_NULL");
|
||||||
ASE_LSP_LOCK(obj) = 0;
|
ASE_LSP_ASSERTX (lsp, ASE_LSP_LOCK(obj) > 0,
|
||||||
|
"the lock count should be greater than zero to be unlocked");
|
||||||
|
ASE_LSP_LOCK(obj)--;
|
||||||
|
|
||||||
if (ASE_LSP_TYPE(obj) == ASE_LSP_OBJ_CONS)
|
if (ASE_LSP_TYPE(obj) == ASE_LSP_OBJ_CONS)
|
||||||
{
|
{
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* $Id: misc.c,v 1.4 2006-10-28 16:08:34 bacon Exp $
|
* $Id: misc.c,v 1.5 2006-10-30 14:31:37 bacon Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <ase/lsp/lsp_i.h>
|
#include <ase/lsp/lsp_i.h>
|
||||||
@ -751,11 +751,21 @@ ase_char_t* ase_lsp_strxnstr (
|
|||||||
}
|
}
|
||||||
|
|
||||||
int ase_lsp_assertfail (ase_lsp_t* lsp,
|
int ase_lsp_assertfail (ase_lsp_t* lsp,
|
||||||
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)
|
||||||
|
{
|
||||||
|
if (desc == ASE_NULL)
|
||||||
{
|
{
|
||||||
lsp->syscas.aprintf (
|
lsp->syscas.aprintf (
|
||||||
ASE_T("ASSERTION FAILURE AT FILE %s, LINE %d\n%s\n"),
|
ASE_T("ASSERTION FAILURE AT FILE %s LINE %d\n%s\n"),
|
||||||
file, line, expr);
|
file, line, expr);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
lsp->syscas.aprintf (
|
||||||
|
ASE_T("ASSERTION FAILURE AT FILE %s LINE %d\n%s\n\nDESCRIPTION:\n%s\n"),
|
||||||
|
file, line, expr, desc);
|
||||||
|
}
|
||||||
lsp->syscas.abort ();
|
lsp->syscas.abort ();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* $Id: obj.h,v 1.12 2006-10-30 03:49:05 bacon Exp $
|
* $Id: obj.h,v 1.13 2006-10-30 14:31:37 bacon Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _ASE_LSP_OBJ_H_
|
#ifndef _ASE_LSP_OBJ_H_
|
||||||
@ -40,9 +40,9 @@ typedef struct ase_lsp_obj_prim_t ase_lsp_obj_prim_t;
|
|||||||
|
|
||||||
struct ase_lsp_objhdr_t
|
struct ase_lsp_objhdr_t
|
||||||
{
|
{
|
||||||
ase_uint32_t type: 24;
|
ase_uint32_t type: 8;
|
||||||
ase_uint32_t mark: 4;
|
ase_uint32_t mark: 8;
|
||||||
ase_uint32_t lock: 4;
|
ase_uint32_t lock: 16;
|
||||||
ase_size_t size;
|
ase_size_t size;
|
||||||
ase_lsp_obj_t* link;
|
ase_lsp_obj_t* link;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user