*** empty log message ***
This commit is contained in:
parent
38407c1dac
commit
b0770101b8
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* $Id: func.c,v 1.22 2006-08-18 17:46:07 bacon Exp $
|
* $Id: func.c,v 1.23 2006-08-19 16:34:24 bacon Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <xp/awk/awk_i.h>
|
#include <xp/awk/awk_i.h>
|
||||||
@ -546,14 +546,19 @@ static int __bfn_split (xp_awk_t* awk, void* run)
|
|||||||
xp_assert (a1->type == XP_AWK_VAL_INT);
|
xp_assert (a1->type == XP_AWK_VAL_INT);
|
||||||
a1r = (xp_awk_val_t**)((xp_awk_val_int_t*)a1)->val;
|
a1r = (xp_awk_val_t**)((xp_awk_val_int_t*)a1)->val;
|
||||||
|
|
||||||
/* TODO: error handling... */
|
/* TODO: check memory leaks and other errors */
|
||||||
t1 = xp_awk_makemapval (run);
|
t1 = xp_awk_makemapval (run);
|
||||||
if (t1 == XP_NULL)
|
if (t1 == XP_NULL)
|
||||||
{
|
{
|
||||||
|
if (a0->type != XP_AWK_VAL_STR) xp_free (str);
|
||||||
xp_awk_seterrnum (run, XP_AWK_ENOMEM);
|
xp_awk_seterrnum (run, XP_AWK_ENOMEM);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
xp_awk_refdownval (run, *a1r);
|
||||||
|
*a1r = t1;
|
||||||
|
xp_awk_refupval (*a1r);
|
||||||
|
|
||||||
p = str; left = len; num = 0;
|
p = str; left = len; num = 0;
|
||||||
while (p != XP_NULL)
|
while (p != XP_NULL)
|
||||||
{
|
{
|
||||||
@ -609,10 +614,6 @@ static int __bfn_split (xp_awk_t* awk, void* run)
|
|||||||
|
|
||||||
if (a0->type != XP_AWK_VAL_STR) xp_free (str);
|
if (a0->type != XP_AWK_VAL_STR) xp_free (str);
|
||||||
|
|
||||||
xp_awk_refdownval (run, *a1r);
|
|
||||||
*a1r = t1;
|
|
||||||
xp_awk_refupval (*a1r);
|
|
||||||
|
|
||||||
t1 = xp_awk_makeintval (run, num);
|
t1 = xp_awk_makeintval (run, num);
|
||||||
if (t1 == XP_NULL)
|
if (t1 == XP_NULL)
|
||||||
{
|
{
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* $Id: run.c,v 1.170 2006-08-18 17:46:07 bacon Exp $
|
* $Id: run.c,v 1.171 2006-08-19 16:34:24 bacon Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <xp/awk/awk_i.h>
|
#include <xp/awk/awk_i.h>
|
||||||
@ -147,6 +147,7 @@ static xp_awk_val_t* __eval_afn (xp_awk_run_t* run, xp_awk_nde_t* nde);
|
|||||||
static xp_awk_val_t* __eval_call (
|
static xp_awk_val_t* __eval_call (
|
||||||
xp_awk_run_t* run, xp_awk_nde_t* nde,
|
xp_awk_run_t* run, xp_awk_nde_t* nde,
|
||||||
const xp_char_t* bfn_arg_spec, xp_awk_afn_t* afn);
|
const xp_char_t* bfn_arg_spec, xp_awk_afn_t* afn);
|
||||||
|
static void* __get_reference (xp_awk_run_t* run, xp_awk_nde_t* nde);
|
||||||
|
|
||||||
static xp_awk_val_t* __eval_int (xp_awk_run_t* run, xp_awk_nde_t* nde);
|
static xp_awk_val_t* __eval_int (xp_awk_run_t* run, xp_awk_nde_t* nde);
|
||||||
static xp_awk_val_t* __eval_real (xp_awk_run_t* run, xp_awk_nde_t* nde);
|
static xp_awk_val_t* __eval_real (xp_awk_run_t* run, xp_awk_nde_t* nde);
|
||||||
@ -3866,15 +3867,12 @@ static xp_awk_val_t* __eval_call (
|
|||||||
spec = bfn_arg_spec[nargs];
|
spec = bfn_arg_spec[nargs];
|
||||||
if (spec == XP_T('m'))
|
if (spec == XP_T('m'))
|
||||||
{
|
{
|
||||||
/* reference required */
|
void* ref;
|
||||||
if (p->type != XP_AWK_NDE_NAMED &&
|
xp_awk_val_t* tmp;
|
||||||
p->type != XP_AWK_NDE_GLOBAL &&
|
|
||||||
p->type != XP_AWK_NDE_LOCAL &&
|
ref = __get_reference (run, p);
|
||||||
p->type != XP_AWK_NDE_ARG &&
|
|
||||||
p->type != XP_AWK_NDE_NAMEDIDX &&
|
if (ref == XP_NULL)
|
||||||
p->type != XP_AWK_NDE_GLOBALIDX &&
|
|
||||||
p->type != XP_AWK_NDE_LOCALIDX &&
|
|
||||||
p->type != XP_AWK_NDE_ARGIDX)
|
|
||||||
{
|
{
|
||||||
xp_awk_refupval (v);
|
xp_awk_refupval (v);
|
||||||
xp_awk_refdownval (run, v);
|
xp_awk_refdownval (run, v);
|
||||||
@ -3884,14 +3882,7 @@ static xp_awk_val_t* __eval_call (
|
|||||||
PANIC (run, XP_AWK_EVALTYPE);
|
PANIC (run, XP_AWK_EVALTYPE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (p->type == XP_AWK_NDE_GLOBAL)
|
tmp = xp_awk_makeintval (run, (xp_long_t)ref);
|
||||||
{
|
|
||||||
xp_awk_val_t* tmp;
|
|
||||||
xp_awk_nde_var_t* tgt =
|
|
||||||
(xp_awk_nde_var_t*)p;
|
|
||||||
|
|
||||||
tmp = xp_awk_makeintval (
|
|
||||||
run, (xp_long_t)&STACK_GLOBAL(run,tgt->id.idxa));
|
|
||||||
if (tmp == XP_NULL)
|
if (tmp == XP_NULL)
|
||||||
{
|
{
|
||||||
xp_awk_refupval (v);
|
xp_awk_refupval (v);
|
||||||
@ -3906,7 +3897,6 @@ static xp_awk_val_t* __eval_call (
|
|||||||
|
|
||||||
v = tmp;
|
v = tmp;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
if (spec == XP_T('m'))
|
if (spec == XP_T('m'))
|
||||||
@ -4037,6 +4027,24 @@ static xp_awk_val_t* __eval_call (
|
|||||||
return (n == -1)? XP_NULL: v;
|
return (n == -1)? XP_NULL: v;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void* __get_reference (xp_awk_run_t* run, xp_awk_nde_t* nde)
|
||||||
|
{
|
||||||
|
xp_awk_nde_var_t* tgt = (xp_awk_nde_var_t*)nde;
|
||||||
|
|
||||||
|
if (nde->type == XP_AWK_NDE_GLOBAL)
|
||||||
|
return &STACK_GLOBAL(run,tgt->id.idxa);
|
||||||
|
|
||||||
|
if (nde->type == XP_AWK_NDE_LOCAL)
|
||||||
|
return &STACK_LOCAL(run,tgt->id.idxa);
|
||||||
|
|
||||||
|
if (nde->type == XP_AWK_NDE_ARG)
|
||||||
|
return &STACK_ARG(run,tgt->id.idxa);
|
||||||
|
|
||||||
|
/* TODO: NAMED ... */
|
||||||
|
|
||||||
|
return XP_NULL;
|
||||||
|
}
|
||||||
|
|
||||||
static xp_awk_val_t* __eval_int (xp_awk_run_t* run, xp_awk_nde_t* nde)
|
static xp_awk_val_t* __eval_int (xp_awk_run_t* run, xp_awk_nde_t* nde)
|
||||||
{
|
{
|
||||||
xp_awk_val_t* val;
|
xp_awk_val_t* val;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user