relocated system/smptr primiives to pf-sys.c

This commit is contained in:
hyunghwan.chung
2017-12-08 15:28:51 +00:00
parent b6cb06c680
commit 471d8ad797
8 changed files with 887 additions and 766 deletions

View File

@ -460,3 +460,32 @@ moo_pfrc_t moo_pf_is_kind_of (moo_t* moo, moo_ooi_t nargs)
return MOO_PF_SUCCESS;
}
moo_pfrc_t moo_pf_responds_to (moo_t* moo, moo_ooi_t nargs)
{
moo_oop_t rcv, selector;
moo_oocs_t mthname;
rcv = MOO_STACK_GETRCV(moo, nargs);
selector = MOO_STACK_GETARG(moo, nargs, 0);
/*if (MOO_CLASSOF(moo,selector) != moo->_symbol)*/
if (!MOO_OOP_IS_POINTER(selector) || !MOO_OBJ_IS_CHAR_POINTER(selector))
{
moo_seterrbfmt (moo, MOO_EINVAL, "invalid argument - %O", selector);
return MOO_PF_FAILURE;
}
mthname.ptr = MOO_OBJ_GET_CHAR_SLOT(selector);
mthname.len = MOO_OBJ_GET_SIZE(selector);
if (moo_findmethod (moo, rcv, &mthname, 0))
{
MOO_STACK_SETRET (moo, nargs, moo->_true);
}
else
{
MOO_STACK_SETRET (moo, nargs, moo->_false);
}
return MOO_PF_SUCCESS;
}