fixed a bug in hawk::function_exists()
This commit is contained in:
parent
f33862b3d1
commit
1636a84baa
@ -203,6 +203,9 @@ static int fnc_function_exists (hawk_rtx_t* rtx, const hawk_fnc_info_t* fi)
|
|||||||
{
|
{
|
||||||
rx = (hawk_rtx_findfunwithoocstr(rtx, name.ptr) != HAWK_NULL);
|
rx = (hawk_rtx_findfunwithoocstr(rtx, name.ptr) != HAWK_NULL);
|
||||||
if (!rx)
|
if (!rx)
|
||||||
|
{
|
||||||
|
rx = (hawk_findfncwithoocs(hawk_rtx_gethawk(rtx), &name) != HAWK_NULL);
|
||||||
|
if (!rx)
|
||||||
{
|
{
|
||||||
hawk_mod_sym_t sym;
|
hawk_mod_sym_t sym;
|
||||||
mod_data_t* md;
|
mod_data_t* md;
|
||||||
@ -215,6 +218,7 @@ static int fnc_function_exists (hawk_rtx_t* rtx, const hawk_fnc_info_t* fi)
|
|||||||
hawk_mtx_unlock (&md->mq_mtx);
|
hawk_mtx_unlock (&md->mq_mtx);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
hawk_rtx_freevaloocstr (rtx, a0, name.ptr);
|
hawk_rtx_freevaloocstr (rtx, a0, name.ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2006,6 +2006,7 @@ static int fnc_wtermsig (hawk_rtx_t* rtx, const hawk_fnc_info_t* fi)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(WCOREDUMP)
|
||||||
static int fnc_wcoredump (hawk_rtx_t* rtx, const hawk_fnc_info_t* fi)
|
static int fnc_wcoredump (hawk_rtx_t* rtx, const hawk_fnc_info_t* fi)
|
||||||
{
|
{
|
||||||
hawk_int_t wstatus;
|
hawk_int_t wstatus;
|
||||||
@ -2014,6 +2015,7 @@ static int fnc_wcoredump (hawk_rtx_t* rtx, const hawk_fnc_info_t* fi)
|
|||||||
hawk_rtx_setretval (rtx, hawk_rtx_makeintval(rtx, rv));
|
hawk_rtx_setretval (rtx, hawk_rtx_makeintval(rtx, rv));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static int fnc_kill (hawk_rtx_t* rtx, const hawk_fnc_info_t* fi)
|
static int fnc_kill (hawk_rtx_t* rtx, const hawk_fnc_info_t* fi)
|
||||||
{
|
{
|
||||||
@ -5833,7 +5835,9 @@ static hawk_mod_fnc_tab_t fnctab[] =
|
|||||||
{
|
{
|
||||||
/* keep this table sorted for binary search in query(). */
|
/* keep this table sorted for binary search in query(). */
|
||||||
|
|
||||||
|
#if defined(WCOREDUMP)
|
||||||
{ HAWK_T("WCOREDUMP"), { { 1, 1, HAWK_NULL }, fnc_wcoredump, 0 } },
|
{ HAWK_T("WCOREDUMP"), { { 1, 1, HAWK_NULL }, fnc_wcoredump, 0 } },
|
||||||
|
#endif
|
||||||
{ HAWK_T("WEXITSTATUS"), { { 1, 1, HAWK_NULL }, fnc_wexitstatus, 0 } },
|
{ HAWK_T("WEXITSTATUS"), { { 1, 1, HAWK_NULL }, fnc_wexitstatus, 0 } },
|
||||||
{ HAWK_T("WIFEXITED"), { { 1, 1, HAWK_NULL }, fnc_wifexited, 0 } },
|
{ HAWK_T("WIFEXITED"), { { 1, 1, HAWK_NULL }, fnc_wifexited, 0 } },
|
||||||
{ HAWK_T("WIFSIGNALED"), { { 1, 1, HAWK_NULL }, fnc_wifsignaled, 0 } },
|
{ HAWK_T("WIFSIGNALED"), { { 1, 1, HAWK_NULL }, fnc_wifsignaled, 0 } },
|
||||||
@ -6129,17 +6133,23 @@ static hawk_mod_int_tab_t inttab[] =
|
|||||||
|
|
||||||
{ HAWK_T("STRFTIME_UTC"), { STRFTIME_UTC } },
|
{ HAWK_T("STRFTIME_UTC"), { STRFTIME_UTC } },
|
||||||
|
|
||||||
|
#if defined(VDISCARD)
|
||||||
{ HAWK_T("TC_CC_VDISCARD"), { VDISCARD } },
|
{ HAWK_T("TC_CC_VDISCARD"), { VDISCARD } },
|
||||||
|
#endif
|
||||||
{ HAWK_T("TC_CC_VEOF"), { VEOF } },
|
{ HAWK_T("TC_CC_VEOF"), { VEOF } },
|
||||||
{ HAWK_T("TC_CC_VEOL"), { VEOL } },
|
{ HAWK_T("TC_CC_VEOL"), { VEOL } },
|
||||||
{ HAWK_T("TC_CC_VEOL2"), { VEOL2 } },
|
{ HAWK_T("TC_CC_VEOL2"), { VEOL2 } },
|
||||||
{ HAWK_T("TC_CC_VERASE"), { VERASE } },
|
{ HAWK_T("TC_CC_VERASE"), { VERASE } },
|
||||||
{ HAWK_T("TC_CC_VINTR"), { VINTR } },
|
{ HAWK_T("TC_CC_VINTR"), { VINTR } },
|
||||||
{ HAWK_T("TC_CC_VKILL"), { VKILL } },
|
{ HAWK_T("TC_CC_VKILL"), { VKILL } },
|
||||||
|
#if defined(VLNEXT)
|
||||||
{ HAWK_T("TC_CC_VLNEXT"), { VLNEXT } },
|
{ HAWK_T("TC_CC_VLNEXT"), { VLNEXT } },
|
||||||
|
#endif
|
||||||
{ HAWK_T("TC_CC_VMIN"), { VMIN } },
|
{ HAWK_T("TC_CC_VMIN"), { VMIN } },
|
||||||
{ HAWK_T("TC_CC_VQUIT"), { VQUIT } },
|
{ HAWK_T("TC_CC_VQUIT"), { VQUIT } },
|
||||||
{ HAWK_T("TC_CC_VREPINT"), { VREPRINT } },
|
#if defined(VREPRINT)
|
||||||
|
{ HAWK_T("TC_CC_VREPRINT"), { VREPRINT } },
|
||||||
|
#endif
|
||||||
{ HAWK_T("TC_CC_VSTART"), { VSTART } },
|
{ HAWK_T("TC_CC_VSTART"), { VSTART } },
|
||||||
{ HAWK_T("TC_CC_VSTOP"), { VSTOP } },
|
{ HAWK_T("TC_CC_VSTOP"), { VSTOP } },
|
||||||
{ HAWK_T("TC_CC_VSUSP"), { VSUSP } },
|
{ HAWK_T("TC_CC_VSUSP"), { VSUSP } },
|
||||||
@ -6147,7 +6157,9 @@ static hawk_mod_int_tab_t inttab[] =
|
|||||||
{ HAWK_T("TC_CC_VSWTC"), { VSWTC } }, /* hard to define with an alternative value when it's not available */
|
{ HAWK_T("TC_CC_VSWTC"), { VSWTC } }, /* hard to define with an alternative value when it's not available */
|
||||||
#endif
|
#endif
|
||||||
{ HAWK_T("TC_CC_VTIME"), { VTIME } },
|
{ HAWK_T("TC_CC_VTIME"), { VTIME } },
|
||||||
|
#if defined(VWERASE)
|
||||||
{ HAWK_T("TC_CC_VWERASE"), { VWERASE } },
|
{ HAWK_T("TC_CC_VWERASE"), { VWERASE } },
|
||||||
|
#endif
|
||||||
|
|
||||||
{ HAWK_T("TC_CFLAG_B0"), { B0 } },
|
{ HAWK_T("TC_CFLAG_B0"), { B0 } },
|
||||||
{ HAWK_T("TC_CFLAG_B110"), { B110 } },
|
{ HAWK_T("TC_CFLAG_B110"), { B110 } },
|
||||||
@ -6193,7 +6205,9 @@ static hawk_mod_int_tab_t inttab[] =
|
|||||||
{ HAWK_T("TC_IFLAG_IGNBRK"), { IGNBRK } },
|
{ HAWK_T("TC_IFLAG_IGNBRK"), { IGNBRK } },
|
||||||
{ HAWK_T("TC_IFLAG_IGNCR"), { IGNCR } },
|
{ HAWK_T("TC_IFLAG_IGNCR"), { IGNCR } },
|
||||||
{ HAWK_T("TC_IFLAG_IGNPAR"), { IGNPAR } },
|
{ HAWK_T("TC_IFLAG_IGNPAR"), { IGNPAR } },
|
||||||
|
#if defined(IMAXBEL)
|
||||||
{ HAWK_T("TC_IFLAG_IMAXBEL"),{ IMAXBEL } },
|
{ HAWK_T("TC_IFLAG_IMAXBEL"),{ IMAXBEL } },
|
||||||
|
#endif
|
||||||
{ HAWK_T("TC_IFLAG_INLCR"), { INLCR } },
|
{ HAWK_T("TC_IFLAG_INLCR"), { INLCR } },
|
||||||
{ HAWK_T("TC_IFLAG_INPCK"), { INPCK } },
|
{ HAWK_T("TC_IFLAG_INPCK"), { INPCK } },
|
||||||
{ HAWK_T("TC_IFLAG_ISTRIP"), { ISTRIP } },
|
{ HAWK_T("TC_IFLAG_ISTRIP"), { ISTRIP } },
|
||||||
|
@ -11,6 +11,8 @@ function run_test_001 ()
|
|||||||
tap_ensure (hawk::function_exists(1.69), 0, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (hawk::function_exists(1.69), 0, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
tap_ensure (hawk::function_exists("111"), 0, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (hawk::function_exists("111"), 0, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
tap_ensure (hawk::function_exists(@b"111"), 0, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (hawk::function_exists(@b"111"), 0, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
|
tap_ensure (hawk::function_exists("length"), 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
|
tap_ensure (hawk::function_exists(@b"length"), 1, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
|
|
||||||
tap_ensure (hawk::call(@b"length", "hawk"), 4, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (hawk::call(@b"length", "hawk"), 4, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
tap_ensure (hawk::call("length", @b"hawk"), 4, @SCRIPTNAME, @SCRIPTLINE);
|
tap_ensure (hawk::call("length", @b"hawk"), 4, @SCRIPTNAME, @SCRIPTLINE);
|
||||||
|
Loading…
Reference in New Issue
Block a user