*** empty log message ***
This commit is contained in:
parent
bf8c125f71
commit
bc06fd0557
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* $Id: func.c,v 1.9 2006-07-14 04:19:21 bacon Exp $
|
* $Id: func.c,v 1.10 2006-07-14 05:21:30 bacon Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <xp/awk/awk_i.h>
|
#include <xp/awk/awk_i.h>
|
||||||
@ -21,8 +21,6 @@ static xp_awk_bfn_t __sys_bfn[] =
|
|||||||
{ XP_NULL, 0, 0, 0, XP_NULL }
|
{ XP_NULL, 0, 0, 0, XP_NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
static xp_awk_bfn_t* __usr_bfn = XP_NULL;
|
|
||||||
|
|
||||||
xp_awk_bfn_t* xp_awk_addbfn (
|
xp_awk_bfn_t* xp_awk_addbfn (
|
||||||
xp_awk_t* awk, const xp_char_t* name, int when_valid,
|
xp_awk_t* awk, const xp_char_t* name, int when_valid,
|
||||||
xp_size_t min_args, xp_size_t max_args, int (*handler)(void*))
|
xp_size_t min_args, xp_size_t max_args, int (*handler)(void*))
|
||||||
@ -34,13 +32,8 @@ xp_awk_bfn_t* xp_awk_addbfn (
|
|||||||
p = (xp_awk_bfn_t*) xp_malloc (xp_sizeof(xp_awk_bfn_t));
|
p = (xp_awk_bfn_t*) xp_malloc (xp_sizeof(xp_awk_bfn_t));
|
||||||
if (p == XP_NULL) return XP_NULL;
|
if (p == XP_NULL) return XP_NULL;
|
||||||
|
|
||||||
p->name = xp_strdup(name);
|
/* NOTE: make sure that name is a constant string */
|
||||||
if (p->name == XP_NULL)
|
p->name = name;
|
||||||
{
|
|
||||||
xp_free (p);
|
|
||||||
return XP_NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
p->valid = when_valid;
|
p->valid = when_valid;
|
||||||
p->min_args = min_args;
|
p->min_args = min_args;
|
||||||
p->max_args = max_args;
|
p->max_args = max_args;
|
||||||
@ -64,7 +57,6 @@ int xp_awk_delbfn (xp_awk_t* awk, const xp_char_t* name)
|
|||||||
awk->bfn.user = p->next;
|
awk->bfn.user = p->next;
|
||||||
else pp->next = p->next;
|
else pp->next = p->next;
|
||||||
|
|
||||||
xp_free (p->name);
|
|
||||||
xp_free (p);
|
xp_free (p);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -83,10 +75,7 @@ void xp_awk_clrbfn (xp_awk_t* awk)
|
|||||||
while (p != XP_NULL)
|
while (p != XP_NULL)
|
||||||
{
|
{
|
||||||
np = p;
|
np = p;
|
||||||
|
|
||||||
xp_free (p->name);
|
|
||||||
xp_free (p);
|
xp_free (p);
|
||||||
|
|
||||||
p = np;
|
p = np;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* $Id: func.h,v 1.5 2006-07-14 04:19:21 bacon Exp $
|
* $Id: func.h,v 1.6 2006-07-14 05:21:30 bacon Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _XP_AWK_FUNC_H_
|
#ifndef _XP_AWK_FUNC_H_
|
||||||
@ -13,7 +13,7 @@ typedef struct xp_awk_bfn_t xp_awk_bfn_t;
|
|||||||
|
|
||||||
struct xp_awk_bfn_t
|
struct xp_awk_bfn_t
|
||||||
{
|
{
|
||||||
xp_char_t* name;
|
const xp_char_t* name;
|
||||||
int valid; /* the entry is valid when this option is set */
|
int valid; /* the entry is valid when this option is set */
|
||||||
|
|
||||||
xp_size_t min_args;
|
xp_size_t min_args;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* $Id: parse.c,v 1.136 2006-07-14 04:19:21 bacon Exp $
|
* $Id: parse.c,v 1.137 2006-07-14 05:21:30 bacon Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <xp/awk/awk_i.h>
|
#include <xp/awk/awk_i.h>
|
||||||
@ -2425,6 +2425,7 @@ static xp_awk_nde_t* __parse_fncall (
|
|||||||
call->next = XP_NULL;
|
call->next = XP_NULL;
|
||||||
|
|
||||||
/*call->what.bfn = bfn; */
|
/*call->what.bfn = bfn; */
|
||||||
|
call->what.bfn.name = bfn->name;
|
||||||
call->what.bfn.min_args = bfn->min_args;
|
call->what.bfn.min_args = bfn->min_args;
|
||||||
call->what.bfn.max_args = bfn->max_args;
|
call->what.bfn.max_args = bfn->max_args;
|
||||||
call->what.bfn.handler = bfn->handler;
|
call->what.bfn.handler = bfn->handler;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* $Id: tree.c,v 1.64 2006-07-14 04:19:22 bacon Exp $
|
* $Id: tree.c,v 1.65 2006-07-14 05:21:30 bacon Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <xp/awk/awk_i.h>
|
#include <xp/awk/awk_i.h>
|
||||||
@ -350,8 +350,7 @@ static int __print_expression (xp_awk_nde_t* nde)
|
|||||||
case XP_AWK_NDE_BFN:
|
case XP_AWK_NDE_BFN:
|
||||||
{
|
{
|
||||||
xp_awk_nde_call_t* px = (xp_awk_nde_call_t*)nde;
|
xp_awk_nde_call_t* px = (xp_awk_nde_call_t*)nde;
|
||||||
/*xp_printf (XP_T("%s ("), px->what.bfn->name);*/
|
xp_printf (XP_T("%s ("), px->what.bfn.name);
|
||||||
xp_printf (XP_T("__bfn ("));
|
|
||||||
if (__print_expression_list (px->args) == -1) return -1;
|
if (__print_expression_list (px->args) == -1) return -1;
|
||||||
xp_printf (XP_T(")"));
|
xp_printf (XP_T(")"));
|
||||||
break;
|
break;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* $Id: tree.h,v 1.59 2006-07-14 04:19:22 bacon Exp $
|
* $Id: tree.h,v 1.60 2006-07-14 05:21:30 bacon Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _XP_AWK_TREE_H_
|
#ifndef _XP_AWK_TREE_H_
|
||||||
@ -237,6 +237,7 @@ struct xp_awk_nde_call_t
|
|||||||
* needed during run-time. */
|
* needed during run-time. */
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
|
const xp_char_t* name;
|
||||||
xp_size_t min_args;
|
xp_size_t min_args;
|
||||||
xp_size_t max_args;
|
xp_size_t max_args;
|
||||||
int (*handler) (void* run);
|
int (*handler) (void* run);
|
||||||
|
Loading…
Reference in New Issue
Block a user