2006-06-16 14:31:42 +00:00
|
|
|
/*
|
2006-08-03 05:05:48 +00:00
|
|
|
* $Id: func.h,v 1.8 2006-08-03 05:05:47 bacon Exp $
|
2006-06-16 14:31:42 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _XP_AWK_FUNC_H_
|
|
|
|
#define _XP_AWK_FUNC_H_
|
|
|
|
|
|
|
|
#ifndef _XP_AWK_AWK_H_
|
|
|
|
#error Never include this file directly. Include <xp/awk/awk.h> instead
|
|
|
|
#endif
|
|
|
|
|
|
|
|
typedef struct xp_awk_bfn_t xp_awk_bfn_t;
|
|
|
|
|
|
|
|
struct xp_awk_bfn_t
|
|
|
|
{
|
2006-07-14 05:21:30 +00:00
|
|
|
const xp_char_t* name;
|
2006-08-03 05:05:48 +00:00
|
|
|
xp_size_t name_len;
|
2006-06-16 14:31:42 +00:00
|
|
|
int valid; /* the entry is valid when this option is set */
|
|
|
|
|
2006-06-21 15:37:51 +00:00
|
|
|
xp_size_t min_args;
|
|
|
|
xp_size_t max_args;
|
2006-06-20 15:27:50 +00:00
|
|
|
int (*handler) (void* run);
|
2006-07-13 15:43:39 +00:00
|
|
|
|
|
|
|
xp_awk_bfn_t* next;
|
2006-06-16 14:31:42 +00:00
|
|
|
};
|
|
|
|
|
2006-07-17 04:17:40 +00:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
/* ensure that this matches __sys_bfn in func.c */
|
|
|
|
|
|
|
|
XP_AWK_BFN_CLOSE,
|
|
|
|
XP_AWK_BFN_SYSTEM,
|
|
|
|
|
|
|
|
XP_AWK_BFN_SIN
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2006-06-16 14:31:42 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2006-07-14 04:19:22 +00:00
|
|
|
xp_awk_bfn_t* xp_awk_addbfn (
|
|
|
|
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*));
|
|
|
|
int xp_awk_delbfn (xp_awk_t* awk, const xp_char_t* name);
|
|
|
|
void xp_awk_clrbfn (xp_awk_t* awk);
|
2006-06-21 15:37:51 +00:00
|
|
|
xp_awk_bfn_t* xp_awk_getbfn (xp_awk_t* awk, const xp_char_t* name);
|
2006-06-16 14:31:42 +00:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif
|