renamed a few macro names that were left out previously

- renamed AFN to FUN and BFN to FNC
This commit is contained in:
hyung-hwan 2009-02-01 04:06:30 +00:00
parent 4f968e7f11
commit 6affaf4d37
8 changed files with 70 additions and 70 deletions

View File

@ -272,7 +272,7 @@ static void print_usage (const qse_char_t* argv0)
}
}
static int bfn_sleep (
static int fnc_sleep (
qse_awk_rtx_t* run, const qse_char_t* fnm, qse_size_t fnl)
{
qse_size_t nargs;
@ -566,14 +566,14 @@ static qse_awk_t* open_awk (void)
/*
qse_awk_seterrstr (awk, QSE_AWK_EGBLRED,
QSE_T("\uC804\uC5ED\uBCC0\uC218 \'%.*s\'\uAC00 \uC7AC\uC815\uC758 \uB418\uC5C8\uC2B5\uB2C8\uB2E4"));
qse_awk_seterrstr (awk, QSE_AWK_EAFNRED,
qse_awk_seterrstr (awk, QSE_AWK_EFUNRED,
QSE_T("\uD568\uC218 \'%.*s\'\uAC00 \uC7AC\uC815\uC758 \uB418\uC5C8\uC2B5\uB2C8\uB2E4"));
*/
/*qse_awk_setkeyword (awk, QSE_T("func"), 4, QSE_T("FX"), 2);*/
if (qse_awk_addfnc (awk,
QSE_T("sleep"), 5, 0,
1, 1, QSE_NULL, bfn_sleep) == QSE_NULL)
1, 1, QSE_NULL, fnc_sleep) == QSE_NULL)
{
qse_awk_close (awk);
qse_printf (QSE_T("ERROR: cannot add function 'sleep'\n"));

View File

@ -481,8 +481,8 @@ public:
ERR_BLKEND = QSE_AWK_EBLKEND,
ERR_DUPBEG = QSE_AWK_EDUPBEG,
ERR_DUPEND = QSE_AWK_EDUPEND,
ERR_BFNRED = QSE_AWK_EBFNRED,
ERR_AFNRED = QSE_AWK_EAFNRED,
ERR_FNCRED = QSE_AWK_EFNCRED,
ERR_FUNRED = QSE_AWK_EFUNRED,
ERR_GBLRED = QSE_AWK_EGBLRED,
ERR_PARRED = QSE_AWK_EPARRED,
ERR_VARRED = QSE_AWK_EVARRED,
@ -529,8 +529,8 @@ public:
ERR_RNEXTEND = QSE_AWK_ERNEXTEND,
ERR_RNEXTFBEG = QSE_AWK_ERNEXTFBEG,
ERR_RNEXTFEND = QSE_AWK_ERNEXTFEND,
ERR_BFNUSER = QSE_AWK_EBFNUSER,
ERR_BFNIMPL = QSE_AWK_EBFNIMPL,
ERR_FNCUSER = QSE_AWK_EFNCUSER,
ERR_FNCIMPL = QSE_AWK_EFNCIMPL,
ERR_IOUSER = QSE_AWK_EIOUSER,
ERR_IONONE = QSE_AWK_EIONONE,
ERR_IOIMPL = QSE_AWK_EIOIMPL,

View File

@ -288,8 +288,8 @@ enum qse_awk_errnum_t
QSE_AWK_EBLKEND, /* END requires an action block */
QSE_AWK_EDUPBEG, /* duplicate BEGIN */
QSE_AWK_EDUPEND, /* duplicate END */
QSE_AWK_EBFNRED, /* intrinsic function redefined */
QSE_AWK_EAFNRED, /* function redefined */
QSE_AWK_EFNCRED, /* intrinsic function redefined */
QSE_AWK_EFUNRED, /* function redefined */
QSE_AWK_EGBLRED, /* global variable redefined */
QSE_AWK_EPARRED, /* parameter redefined */
QSE_AWK_EVARRED, /* named variable redefined */
@ -341,8 +341,8 @@ enum qse_awk_errnum_t
QSE_AWK_ERNEXTEND, /* next called from END */
QSE_AWK_ERNEXTFBEG, /* nextfile called from BEGIN */
QSE_AWK_ERNEXTFEND, /* nextfile called from END */
QSE_AWK_EBFNUSER, /* wrong intrinsic function implementation */
QSE_AWK_EBFNIMPL, /* intrinsic function handler failed */
QSE_AWK_EFNCUSER, /* wrong intrinsic function implementation */
QSE_AWK_EFNCIMPL, /* intrinsic function handler failed */
QSE_AWK_EIOUSER, /* wrong user io handler implementation */
QSE_AWK_EIONONE, /* no such io name found */
QSE_AWK_EIOIMPL, /* i/o callback returned an error */

View File

@ -856,7 +856,7 @@ static qse_awk_nde_t* parse_function (qse_awk_t* awk)
/* check if it is a builtin function */
if (qse_awk_getfnc (awk, name, name_len) != QSE_NULL)
{
SETERRARG (awk, QSE_AWK_EBFNRED, awk->token.line, name, name_len);
SETERRARG (awk, QSE_AWK_EFNCRED, awk->token.line, name, name_len);
return QSE_NULL;
}
@ -864,7 +864,7 @@ static qse_awk_nde_t* parse_function (qse_awk_t* awk)
{
/* the function is defined previously */
SETERRARG (
awk, QSE_AWK_EAFNRED, awk->token.line,
awk, QSE_AWK_EFUNRED, awk->token.line,
name, name_len);
return QSE_NULL;
}
@ -1520,7 +1520,7 @@ static int add_global (
if (qse_awk_getfnc (awk, name, len) != QSE_NULL)
{
SETERRARG (
awk, QSE_AWK_EBFNRED, awk->token.line,
awk, QSE_AWK_EFNCRED, awk->token.line,
name, len);
return -1;
}
@ -1529,7 +1529,7 @@ static int add_global (
if (qse_map_search (awk->tree.funs, name, len) != QSE_NULL)
{
SETERRARG (
awk, QSE_AWK_EAFNRED, line,
awk, QSE_AWK_EFUNRED, line,
name, len);
return -1;
}
@ -1539,7 +1539,7 @@ static int add_global (
if (qse_map_search (awk->parse.funs, name, len) != QSE_NULL)
{
SETERRARG (
awk, QSE_AWK_EAFNRED, line,
awk, QSE_AWK_EFUNRED, line,
name, len);
return -1;
}
@ -1709,7 +1709,7 @@ static qse_awk_t* collect_locals (
if (qse_awk_getfnc (awk, local.ptr, local.len) != QSE_NULL)
{
SETERRARG (
awk, QSE_AWK_EBFNRED, awk->token.line,
awk, QSE_AWK_EFNCRED, awk->token.line,
local.ptr, local.len);
return QSE_NULL;
}
@ -1726,7 +1726,7 @@ static qse_awk_t* collect_locals (
if (iscur || qse_map_search (awk->tree.funs, local.ptr, local.len) != QSE_NULL)
{
SETERRARG (
awk, QSE_AWK_EAFNRED, awk->token.line,
awk, QSE_AWK_EFUNRED, awk->token.line,
local.ptr, local.len);
return QSE_NULL;
}
@ -1737,7 +1737,7 @@ static qse_awk_t* collect_locals (
local.ptr, local.len) != QSE_NULL)
{
SETERRARG (
awk, QSE_AWK_EAFNRED, awk->token.line,
awk, QSE_AWK_EFUNRED, awk->token.line,
local.ptr, local.len);
return QSE_NULL;
}
@ -3445,7 +3445,7 @@ static qse_awk_nde_t* parse_primary_ident (qse_awk_t* awk, qse_size_t line)
/* check if it is a builtin function */
if (qse_awk_getfnc (awk, name_dup, name_len) != QSE_NULL)
{
SETERRARG (awk, QSE_AWK_EBFNRED, line, name_dup, name_len);
SETERRARG (awk, QSE_AWK_EFNCRED, line, name_dup, name_len);
goto exit_func;
}
@ -3460,7 +3460,7 @@ static qse_awk_nde_t* parse_primary_ident (qse_awk_t* awk, qse_size_t line)
if (iscur || qse_map_search (awk->tree.funs, name_dup, name_len) != QSE_NULL)
{
/* the function is defined previously */
SETERRARG (awk, QSE_AWK_EAFNRED, line, name_dup, name_len);
SETERRARG (awk, QSE_AWK_EFUNRED, line, name_dup, name_len);
goto exit_func;
}
@ -3468,7 +3468,7 @@ static qse_awk_nde_t* parse_primary_ident (qse_awk_t* awk, qse_size_t line)
name_dup, name_len) != QSE_NULL)
{
/* is it one of the function calls found so far? */
SETERRARG (awk, QSE_AWK_EAFNRED, line, name_dup, name_len);
SETERRARG (awk, QSE_AWK_EFUNRED, line, name_dup, name_len);
goto exit_func;
}
#if 0
@ -3628,7 +3628,7 @@ static qse_awk_nde_t* parse_hashidx (
/* check if it is a builtin function */
if (qse_awk_getfnc (awk, name, name_len) != QSE_NULL)
{
SETERRARG (awk, QSE_AWK_EBFNRED, line, name, name_len);
SETERRARG (awk, QSE_AWK_EFNCRED, line, name, name_len);
goto exit_func;
}
@ -3643,7 +3643,7 @@ static qse_awk_nde_t* parse_hashidx (
if (iscur || qse_map_search (awk->tree.funs, name, name_len) != QSE_NULL)
{
/* the function is defined previously */
SETERRARG (awk, QSE_AWK_EAFNRED, line, name, name_len);
SETERRARG (awk, QSE_AWK_EFUNRED, line, name, name_len);
goto exit_func;
}
@ -3651,7 +3651,7 @@ static qse_awk_nde_t* parse_hashidx (
awk->parse.funs, name, name_len) != QSE_NULL)
{
/* is it one of the function calls found so far? */
SETERRARG (awk, QSE_AWK_EAFNRED, line, name, name_len);
SETERRARG (awk, QSE_AWK_EFUNRED, line, name, name_len);
goto exit_func;
}
#if 0
@ -3757,7 +3757,7 @@ static qse_awk_nde_t* parse_fncall (
if (fnc != QSE_NULL)
{
call->type = QSE_AWK_NDE_BFN;
call->type = QSE_AWK_NDE_FNC;
call->line = line;
call->next = QSE_NULL;
@ -3783,7 +3783,7 @@ static qse_awk_nde_t* parse_fncall (
}
else
{
call->type = QSE_AWK_NDE_AFN;
call->type = QSE_AWK_NDE_FUN;
call->line = line;
call->next = QSE_NULL;
call->what.fun.name.ptr = name;

View File

@ -1482,7 +1482,7 @@ static int qse_awk_runfunc (qse_awk_rtx_t* run, const qse_char_t* name)
/* forge a fake node containing a function call */
nde.type = QSE_AWK_NDE_AFN;
nde.type = QSE_AWK_NDE_FUN;
nde.line = 0;
nde.next = QSE_NULL;
nde.what.fun.name.ptr = (qse_char_t*)name;
@ -1693,7 +1693,7 @@ static int ____run_main_to_be_removed____ (
struct capture_retval_data_t crdata;
qse_awk_nde_call_t nde;
nde.type = QSE_AWK_NDE_AFN;
nde.type = QSE_AWK_NDE_FUN;
nde.line = 0;
nde.next = QSE_NULL;
nde.what.fun.name.ptr = (qse_char_t*)main;
@ -6088,7 +6088,7 @@ static qse_awk_val_t* eval_call (
/* the handler has not set the error.
* fix it */
qse_awk_rtx_seterror (
run, QSE_AWK_EBFNIMPL,
run, QSE_AWK_EFNCIMPL,
nde->line, QSE_NULL, 0);
}
else

View File

@ -771,9 +771,9 @@ int qse_awk_runsimple (qse_awk_t* awk, qse_char_t** icf, qse_awk_runcbs_t* cbs)
/*** EXTRA BUILTIN FUNCTIONS ***/
enum
{
BFN_MATH_LD,
BFN_MATH_D,
BFN_MATH_F
FNC_MATH_LD,
FNC_MATH_D,
FNC_MATH_F
};
static int fnc_math_1 (
@ -795,20 +795,20 @@ static int fnc_math_1 (
if (n == -1) return -1;
if (n == 0) rv = (qse_real_t)lv;
if (type == BFN_MATH_LD)
if (type == FNC_MATH_LD)
{
long double (*rf) (long double) =
(long double(*)(long double))f;
r = qse_awk_rtx_makerealval (run, rf(rv));
}
else if (type == BFN_MATH_D)
else if (type == FNC_MATH_D)
{
double (*rf) (double) = (double(*)(double))f;
r = qse_awk_rtx_makerealval (run, rf(rv));
}
else
{
QSE_ASSERT (type == BFN_MATH_F);
QSE_ASSERT (type == FNC_MATH_F);
float (*rf) (float) = (float(*)(float))f;
r = qse_awk_rtx_makerealval (run, rf(rv));
}
@ -847,20 +847,20 @@ static int fnc_math_2 (
if (n == -1) return -1;
if (n == 0) rv1 = (qse_real_t)lv1;
if (type == BFN_MATH_LD)
if (type == FNC_MATH_LD)
{
long double (*rf) (long double,long double) =
(long double(*)(long double,long double))f;
r = qse_awk_rtx_makerealval (run, rf(rv0,rv1));
}
else if (type == BFN_MATH_D)
else if (type == FNC_MATH_D)
{
double (*rf) (double,double) = (double(*)(double,double))f;
r = qse_awk_rtx_makerealval (run, rf(rv0,rv1));
}
else
{
QSE_ASSERT (type == BFN_MATH_F);
QSE_ASSERT (type == FNC_MATH_F);
float (*rf) (float,float) = (float(*)(float,float))f;
r = qse_awk_rtx_makerealval (run, rf(rv0,rv1));
}
@ -880,11 +880,11 @@ static int fnc_sin (qse_awk_rtx_t* run, const qse_char_t* fnm, qse_size_t fnl)
return fnc_math_1 (
run, fnm, fnl,
#if defined(HAVE_SINL)
BFN_MATH_LD, (void*)sinl
FNC_MATH_LD, (void*)sinl
#elif defined(HAVE_SIN)
BFN_MATH_D, (void*)sin
FNC_MATH_D, (void*)sin
#elif defined(HAVE_SINF)
BFN_MATH_F, (void*)sinf
FNC_MATH_F, (void*)sinf
#else
#error ### no sin function available ###
#endif
@ -896,11 +896,11 @@ static int fnc_cos (qse_awk_rtx_t* run, const qse_char_t* fnm, qse_size_t fnl)
return fnc_math_1 (
run, fnm, fnl,
#if defined(HAVE_COSL)
BFN_MATH_LD, (void*)cosl
FNC_MATH_LD, (void*)cosl
#elif defined(HAVE_COS)
BFN_MATH_D, (void*)cos
FNC_MATH_D, (void*)cos
#elif defined(HAVE_COSF)
BFN_MATH_F, (void*)cosf
FNC_MATH_F, (void*)cosf
#else
#error ### no cos function available ###
#endif
@ -912,11 +912,11 @@ static int fnc_tan (qse_awk_rtx_t* run, const qse_char_t* fnm, qse_size_t fnl)
return fnc_math_1 (
run, fnm, fnl,
#if defined(HAVE_TANL)
BFN_MATH_LD, (void*)tanl
FNC_MATH_LD, (void*)tanl
#elif defined(HAVE_TAN)
BFN_MATH_D, (void*)tan
FNC_MATH_D, (void*)tan
#elif defined(HAVE_TANF)
BFN_MATH_F, (void*)tanf
FNC_MATH_F, (void*)tanf
#else
#error ### no tan function available ###
#endif
@ -928,11 +928,11 @@ static int fnc_atan (qse_awk_rtx_t* run, const qse_char_t* fnm, qse_size_t fnl)
return fnc_math_1 (
run, fnm, fnl,
#if defined(HAVE_ATANL)
BFN_MATH_LD, (void*)atanl
FNC_MATH_LD, (void*)atanl
#elif defined(HAVE_ATAN)
BFN_MATH_D, (void*)atan
FNC_MATH_D, (void*)atan
#elif defined(HAVE_ATANF)
BFN_MATH_F, (void*)atanf
FNC_MATH_F, (void*)atanf
#else
#error ### no atan function available ###
#endif
@ -944,11 +944,11 @@ static int fnc_atan2 (qse_awk_rtx_t* run, const qse_char_t* fnm, qse_size_t fnl)
return fnc_math_2 (
run, fnm, fnl,
#if defined(HAVE_ATAN2L)
BFN_MATH_LD, (void*)atan2l
FNC_MATH_LD, (void*)atan2l
#elif defined(HAVE_ATAN2)
BFN_MATH_D, (void*)atan2
FNC_MATH_D, (void*)atan2
#elif defined(HAVE_ATAN2F)
BFN_MATH_F, (void*)atan2f
FNC_MATH_F, (void*)atan2f
#else
#error ### no atan2 function available ###
#endif
@ -960,11 +960,11 @@ static int fnc_log (qse_awk_rtx_t* run, const qse_char_t* fnm, qse_size_t fnl)
return fnc_math_1 (
run, fnm, fnl,
#if defined(HAVE_LOGL)
BFN_MATH_LD, (void*)logl
FNC_MATH_LD, (void*)logl
#elif defined(HAVE_LOG)
BFN_MATH_D, (void*)log
FNC_MATH_D, (void*)log
#elif defined(HAVE_LOGF)
BFN_MATH_F, (void*)logf
FNC_MATH_F, (void*)logf
#else
#error ### no log function available ###
#endif
@ -976,11 +976,11 @@ static int fnc_exp (qse_awk_rtx_t* run, const qse_char_t* fnm, qse_size_t fnl)
return fnc_math_1 (
run, fnm, fnl,
#if defined(HAVE_EXPL)
BFN_MATH_LD, (void*)expl
FNC_MATH_LD, (void*)expl
#elif defined(HAVE_EXP)
BFN_MATH_D, (void*)exp
FNC_MATH_D, (void*)exp
#elif defined(HAVE_EXPF)
BFN_MATH_F, (void*)expf
FNC_MATH_F, (void*)expf
#else
#error ### no exp function available ###
#endif
@ -992,11 +992,11 @@ static int fnc_sqrt (qse_awk_rtx_t* run, const qse_char_t* fnm, qse_size_t fnl)
return fnc_math_1 (
run, fnm, fnl,
#if defined(HAVE_SQRTL)
BFN_MATH_LD, (void*)sqrtl
FNC_MATH_LD, (void*)sqrtl
#elif defined(HAVE_SQRT)
BFN_MATH_D, (void*)sqrt
FNC_MATH_D, (void*)sqrt
#elif defined(HAVE_SQRTF)
BFN_MATH_F, (void*)sqrtf
FNC_MATH_F, (void*)sqrtf
#else
#error ### no sqrt function available ###
#endif

View File

@ -535,7 +535,7 @@ static int print_expression (qse_awk_t* awk, qse_awk_nde_t* nde)
break;
}
case QSE_AWK_NDE_BFN:
case QSE_AWK_NDE_FNC:
{
qse_awk_nde_call_t* px = (qse_awk_nde_call_t*)nde;
PUT_SRCSTRX (awk,
@ -546,7 +546,7 @@ static int print_expression (qse_awk_t* awk, qse_awk_nde_t* nde)
break;
}
case QSE_AWK_NDE_AFN:
case QSE_AWK_NDE_FUN:
{
qse_awk_nde_call_t* px = (qse_awk_nde_call_t*)nde;
PUT_SRCSTRX (awk,
@ -1256,7 +1256,7 @@ void qse_awk_clrpt (qse_awk_t* awk, qse_awk_nde_t* tree)
break;
}
case QSE_AWK_NDE_BFN:
case QSE_AWK_NDE_FNC:
{
qse_awk_nde_call_t* px = (qse_awk_nde_call_t*)p;
/* QSE_AWK_FREE (awk, px->what.fnc); */
@ -1266,7 +1266,7 @@ void qse_awk_clrpt (qse_awk_t* awk, qse_awk_nde_t* tree)
break;
}
case QSE_AWK_NDE_AFN:
case QSE_AWK_NDE_FUN:
{
qse_awk_nde_call_t* px = (qse_awk_nde_call_t*)p;
QSE_AWK_FREE (awk, px->what.fun.name.ptr);

View File

@ -52,8 +52,8 @@ enum qse_awk_nde_type_t
QSE_AWK_NDE_EXP_INCPRE,
QSE_AWK_NDE_EXP_INCPST,
QSE_AWK_NDE_CND,
QSE_AWK_NDE_BFN,
QSE_AWK_NDE_AFN,
QSE_AWK_NDE_FNC,
QSE_AWK_NDE_FUN,
QSE_AWK_NDE_INT,
QSE_AWK_NDE_REAL,
QSE_AWK_NDE_STR,
@ -258,7 +258,7 @@ struct qse_awk_nde_var_t
qse_awk_nde_t* idx; /* QSE_NULL for non-XXXXIDX */
};
/* QSE_AWK_NDE_BFN, QSE_AWK_NDE_AFN */
/* QSE_AWK_NDE_FNC, QSE_AWK_NDE_FUN */
struct qse_awk_nde_call_t
{
QSE_AWK_NDE_HDR;