added qse_awk_val_fun_t

This commit is contained in:
hyung-hwan 2014-02-22 14:34:45 +00:00
parent d49fd50ecc
commit 7cc9a56d83
2 changed files with 33 additions and 1 deletions

View File

@ -315,6 +315,7 @@ struct qse_awk_val_map_data_t
typedef struct qse_awk_val_map_data_t qse_awk_val_map_data_t;
/* ------------------------------------------------------------------------ */
/**
@ -408,6 +409,13 @@ struct qse_awk_fun_t
};
typedef struct qse_awk_fun_t qse_awk_fun_t;
struct qse_awk_val_fun_t
{
QSE_AWK_VAL_HDR;
qse_awk_fun_t* fun;
};
typedef struct qse_awk_val_fun_t qse_awk_val_fun_t;
/* ------------------------------------------------------------------------ */
typedef qse_awk_flt_t (*qse_awk_math1_t) (
@ -1359,7 +1367,8 @@ enum qse_awk_val_type_t
QSE_AWK_VAL_REX = 4, /**< regular expression */
QSE_AWK_VAL_MAP = 5, /**< map */
QSE_AWK_VAL_REF = 6 /**< reference to other types */
QSE_AWK_VAL_REF = 6, /**< reference to other types */
QSE_AWK_VAL_FUN = 7
};
/**
@ -2486,6 +2495,11 @@ QSE_EXPORT qse_awk_val_t* qse_awk_rtx_makerefval (
qse_awk_val_t** adr
);
QSE_EXPORT qse_awk_val_t* qse_awk_rtx_makefunval (
qse_awk_rtx_t* rtx,
const qse_awk_fun_t* fun
);
/**
* The qse_awk_rtx_isstaticval() function determines if a value is static.
* A static value is allocated once and reused until a runtime context @ rtx

View File

@ -739,6 +739,24 @@ qse_awk_val_t* qse_awk_rtx_makerefval (
return (qse_awk_val_t*)val;
}
qse_awk_val_t* qse_awk_rtx_makefunval (
qse_awk_rtx_t* rtx, const qse_awk_fun_t* fun)
{
qse_awk_val_fun_t* val;
val = (qse_awk_val_fun_t*) QSE_AWK_ALLOC (
rtx->awk, QSE_SIZEOF(qse_awk_val_fun_t));
if (val == QSE_NULL)
{
qse_awk_rtx_seterrnum (rtx, QSE_AWK_ENOMEM, QSE_NULL);
return QSE_NULL;
}
val->type = QSE_AWK_VAL_FUN;
val->fun = fun;
return (qse_awk_val_t*)val;
}
/*
* if shared objects link a static library, statically defined objects