*** empty log message ***
This commit is contained in:
parent
761af88ace
commit
1519f0212f
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* $Id: awk.h,v 1.51 2006-04-17 16:12:02 bacon Exp $
|
* $Id: awk.h,v 1.52 2006-04-18 10:28:03 bacon Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _XP_AWK_AWK_H_
|
#ifndef _XP_AWK_AWK_H_
|
||||||
@ -80,7 +80,7 @@ enum
|
|||||||
XP_AWK_ENOSUCHFUNC, /* no such function */
|
XP_AWK_ENOSUCHFUNC, /* no such function */
|
||||||
XP_AWK_ENOTASSIGNABLE, /* not indexable value */
|
XP_AWK_ENOTASSIGNABLE, /* not indexable value */
|
||||||
XP_AWK_ENOTINDEXABLE, /* not indexable value */
|
XP_AWK_ENOTINDEXABLE, /* not indexable value */
|
||||||
XP_AWK_EINDEX, /* wrong index */
|
XP_AWK_EWRONGINDEX, /* wrong index */
|
||||||
XP_AWK_EINTERNAL /* internal error */
|
XP_AWK_EINTERNAL /* internal error */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* $Id: run.c,v 1.54 2006-04-17 16:12:02 bacon Exp $
|
* $Id: run.c,v 1.55 2006-04-18 10:28:03 bacon Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <xp/awk/awk_i.h>
|
#include <xp/awk/awk_i.h>
|
||||||
@ -884,14 +884,16 @@ static xp_awk_val_t* __do_assignment_globalidx (
|
|||||||
/* TODO: how to tell memory from conversion error? */
|
/* TODO: how to tell memory from conversion error? */
|
||||||
xp_awk_refdownval (awk, tmp);
|
xp_awk_refdownval (awk, tmp);
|
||||||
/*PANIC (awk, XP_AWK_ENOMEM);*/
|
/*PANIC (awk, XP_AWK_ENOMEM);*/
|
||||||
PANIC (awk, XP_AWK_EINDEX);
|
PANIC (awk, XP_AWK_EWRONGINDEX);
|
||||||
}
|
}
|
||||||
|
|
||||||
xp_awk_refdownval (awk, tmp);
|
xp_awk_refdownval (awk, tmp);
|
||||||
/* TODO: nde = nde->next; */
|
/* TODO: nde = nde->next; */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
xp_printf (XP_TEXT("**** index str=>%s, map->ref=%d, map->type=%d\n"), str, map->ref, map->type);
|
xp_printf (XP_TEXT("**** index str=>%s, map->ref=%d, map->type=%d\n"), str, map->ref, map->type);
|
||||||
|
*/
|
||||||
pair = xp_awk_map_get (map->map, str);
|
pair = xp_awk_map_get (map->map, str);
|
||||||
if (xp_awk_map_put(map->map, str, val) == XP_NULL)
|
if (xp_awk_map_put(map->map, str, val) == XP_NULL)
|
||||||
{
|
{
|
||||||
@ -899,9 +901,12 @@ xp_printf (XP_TEXT("**** index str=>%s, map->ref=%d, map->type=%d\n"), str, map-
|
|||||||
PANIC (awk, XP_AWK_ENOMEM);
|
PANIC (awk, XP_AWK_ENOMEM);
|
||||||
}
|
}
|
||||||
|
|
||||||
xp_free (str);
|
|
||||||
if (pair != XP_NULL)
|
if (pair != XP_NULL)
|
||||||
{
|
{
|
||||||
|
/* str is freed only if the key is in the map.
|
||||||
|
* otherwise, it will be taken by the map */
|
||||||
|
xp_free (str);
|
||||||
|
|
||||||
/* decrease the reference count for the old value
|
/* decrease the reference count for the old value
|
||||||
* only when the assignment is successful */
|
* only when the assignment is successful */
|
||||||
xp_awk_refdownval (awk, pair->val);
|
xp_awk_refdownval (awk, pair->val);
|
||||||
@ -2182,7 +2187,7 @@ static xp_awk_val_t* __eval_globalidx (xp_awk_t* awk, xp_awk_nde_t* nde)
|
|||||||
/* TODO: how to tell memory error from conversion error? */
|
/* TODO: how to tell memory error from conversion error? */
|
||||||
xp_awk_refdownval (awk, idx);
|
xp_awk_refdownval (awk, idx);
|
||||||
/*PANIC (awk, XP_AWK_ENOMEM);*/
|
/*PANIC (awk, XP_AWK_ENOMEM);*/
|
||||||
PANIC (awk, XP_AWK_EINDEX);
|
PANIC (awk, XP_AWK_EWRONGINDEX);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* TODO: check this out........ */
|
/* TODO: check this out........ */
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* $Id: val.c,v 1.20 2006-04-17 16:12:02 bacon Exp $
|
* $Id: val.c,v 1.21 2006-04-18 10:28:03 bacon Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <xp/awk/awk_i.h>
|
#include <xp/awk/awk_i.h>
|
||||||
@ -122,6 +122,11 @@ xp_awk_val_t* xp_awk_makestrval2 (
|
|||||||
|
|
||||||
static void __free_map_val (xp_awk_t* awk, void* v)
|
static void __free_map_val (xp_awk_t* awk, void* v)
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
|
xp_printf (XP_TEXT("refdown in map free..."));
|
||||||
|
xp_awk_printval (v);
|
||||||
|
xp_printf (XP_TEXT("\n"));
|
||||||
|
*/
|
||||||
xp_awk_refdownval (awk, v);
|
xp_awk_refdownval (awk, v);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -129,7 +134,7 @@ xp_awk_val_t* xp_awk_makemapval (xp_awk_t* awk)
|
|||||||
{
|
{
|
||||||
xp_awk_val_map_t* val;
|
xp_awk_val_map_t* val;
|
||||||
|
|
||||||
val = (xp_awk_val_map_t*)xp_malloc(xp_sizeof(xp_awk_val_map_t));
|
val = (xp_awk_val_map_t*) xp_malloc (xp_sizeof(xp_awk_val_map_t));
|
||||||
if (val == XP_NULL) return XP_NULL;
|
if (val == XP_NULL) return XP_NULL;
|
||||||
|
|
||||||
val->type = XP_AWK_VAL_MAP;
|
val->type = XP_AWK_VAL_MAP;
|
||||||
@ -155,6 +160,9 @@ void xp_awk_freeval (xp_awk_t* awk, xp_awk_val_t* val)
|
|||||||
{
|
{
|
||||||
if (xp_awk_isbuiltinval(val)) return;
|
if (xp_awk_isbuiltinval(val)) return;
|
||||||
|
|
||||||
|
xp_printf (XP_TEXT("freeing ... "));
|
||||||
|
xp_awk_printval (val);
|
||||||
|
xp_printf (XP_TEXT("\n"));
|
||||||
switch (val->type)
|
switch (val->type)
|
||||||
{
|
{
|
||||||
case XP_AWK_VAL_NIL:
|
case XP_AWK_VAL_NIL:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user