added two more variants of Hawk::Run::setGlobal()
This commit is contained in:
parent
98e594190d
commit
ebdb8cecce
@ -1323,6 +1323,34 @@ int Hawk::Run::setGlobal (int id, const hawk_bch_t* ptr, hawk_oow_t len, bool mb
|
|||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int Hawk::Run::setGlobal (int id, const hawk_uch_t* ptr, bool mbs)
|
||||||
|
{
|
||||||
|
HAWK_ASSERT (this->rtx != HAWK_NULL);
|
||||||
|
|
||||||
|
hawk_val_t* tmp = mbs? hawk_rtx_makembsvalwithucstr(this->rtx, ptr):
|
||||||
|
hawk_rtx_makestrvalwithucstr(this->rtx, ptr);
|
||||||
|
if (HAWK_UNLIKELY(!tmp)) return -1;
|
||||||
|
|
||||||
|
hawk_rtx_refupval (this->rtx, tmp);
|
||||||
|
int n = hawk_rtx_setgbl(this->rtx, id, tmp);
|
||||||
|
hawk_rtx_refdownval (this->rtx, tmp);
|
||||||
|
return n;
|
||||||
|
}
|
||||||
|
|
||||||
|
int Hawk::Run::setGlobal (int id, const hawk_bch_t* ptr, bool mbs)
|
||||||
|
{
|
||||||
|
HAWK_ASSERT (this->rtx != HAWK_NULL);
|
||||||
|
|
||||||
|
hawk_val_t* tmp = mbs? hawk_rtx_makembsvalwithbcstr(this->rtx, ptr):
|
||||||
|
hawk_rtx_makestrvalwithbcstr(this->rtx, ptr);
|
||||||
|
if (HAWK_UNLIKELY(!tmp)) return -1;
|
||||||
|
|
||||||
|
hawk_rtx_refupval (this->rtx, tmp);
|
||||||
|
int n = hawk_rtx_setgbl(this->rtx, id, tmp);
|
||||||
|
hawk_rtx_refdownval (this->rtx, tmp);
|
||||||
|
return n;
|
||||||
|
}
|
||||||
|
|
||||||
int Hawk::Run::setGlobal (int id, const Value& gbl)
|
int Hawk::Run::setGlobal (int id, const Value& gbl)
|
||||||
{
|
{
|
||||||
HAWK_ASSERT (this->rtx != HAWK_NULL);
|
HAWK_ASSERT (this->rtx != HAWK_NULL);
|
||||||
|
@ -1239,6 +1239,8 @@ public:
|
|||||||
///
|
///
|
||||||
int setGlobal (int id, const hawk_uch_t* ptr, hawk_oow_t len, bool mbs = false);
|
int setGlobal (int id, const hawk_uch_t* ptr, hawk_oow_t len, bool mbs = false);
|
||||||
int setGlobal (int id, const hawk_bch_t* ptr, hawk_oow_t len, bool mbs = false);
|
int setGlobal (int id, const hawk_bch_t* ptr, hawk_oow_t len, bool mbs = false);
|
||||||
|
int setGlobal (int id, const hawk_uch_t* ptr, bool mbs = false);
|
||||||
|
int setGlobal (int id, const hawk_bch_t* ptr, bool mbs = false);
|
||||||
|
|
||||||
///
|
///
|
||||||
/// The setGlobal() function sets a global variable
|
/// The setGlobal() function sets a global variable
|
||||||
|
Loading…
Reference in New Issue
Block a user