renamed qse_getawknilval() to qse_get_awk_nil_val().
fixed a segfault issue caused by unfinised changes required for new xtn management scheme
This commit is contained in:
parent
24bcca71bf
commit
76d6999f37
@ -1046,7 +1046,17 @@ public:
|
||||
/// The call() function invokes a function named \a name.
|
||||
///
|
||||
int call (
|
||||
const char_t* name, ///< function name
|
||||
const qse_mchar_t* name, ///< function name
|
||||
Value* ret, ///< return value holder
|
||||
const Value* args, ///< argument array
|
||||
size_t nargs ///< number of arguments
|
||||
);
|
||||
|
||||
///
|
||||
/// The call() function invokes a function named \a name.
|
||||
///
|
||||
int call (
|
||||
const qse_wchar_t* name, ///< function name
|
||||
Value* ret, ///< return value holder
|
||||
const Value* args, ///< argument array
|
||||
size_t nargs ///< number of arguments
|
||||
|
@ -3341,10 +3341,10 @@ qse_mchar_t* qse_awk_rtx_wcsntombsdup (
|
||||
|
||||
|
||||
/**
|
||||
* The qse_getawknilval() function returns the pointer to the predefined
|
||||
* The qse_get_awk_nil_val() function returns the pointer to the predefined
|
||||
* nil value. you can call this without creating a runtime context.
|
||||
*/
|
||||
QSE_EXPORT qse_awk_val_t* qse_getawknilval (
|
||||
QSE_EXPORT qse_awk_val_t* qse_get_awk_nil_val (
|
||||
void
|
||||
);
|
||||
|
||||
|
@ -305,19 +305,19 @@ void Awk::Value::operator delete[] (void* ptr)
|
||||
}
|
||||
#endif
|
||||
|
||||
Awk::Value::Value (): run (QSE_NULL), val (qse_getawknilval())
|
||||
Awk::Value::Value (): run (QSE_NULL), val (qse_get_awk_nil_val())
|
||||
{
|
||||
cached.str.ptr = QSE_NULL;
|
||||
cached.str.len = 0;
|
||||
}
|
||||
|
||||
Awk::Value::Value (Run& run): run (&run), val (qse_getawknilval())
|
||||
Awk::Value::Value (Run& run): run (&run), val (qse_get_awk_nil_val())
|
||||
{
|
||||
cached.str.ptr = QSE_NULL;
|
||||
cached.str.len = 0;
|
||||
}
|
||||
|
||||
Awk::Value::Value (Run* run): run (run), val (qse_getawknilval())
|
||||
Awk::Value::Value (Run* run): run (run), val (qse_get_awk_nil_val())
|
||||
{
|
||||
cached.str.ptr = QSE_NULL;
|
||||
cached.str.len = 0;
|
||||
@ -380,7 +380,7 @@ void Awk::Value::clear ()
|
||||
}
|
||||
|
||||
run = QSE_NULL;
|
||||
val = qse_getawknilval();
|
||||
val = qse_get_awk_nil_val();
|
||||
}
|
||||
}
|
||||
|
||||
@ -1124,13 +1124,13 @@ void Awk::retrieveError (Run* run)
|
||||
|
||||
static void fini_xtn (qse_awk_t* awk)
|
||||
{
|
||||
xtn_t* xtn = (xtn_t*)qse_awk_getxtn(awk);
|
||||
xtn_t* xtn = GET_XTN(awk);
|
||||
xtn->awk->uponClosing ();
|
||||
}
|
||||
|
||||
static void clear_xtn (qse_awk_t* awk)
|
||||
{
|
||||
xtn_t* xtn = (xtn_t*)qse_awk_getxtn(awk);
|
||||
xtn_t* xtn = GET_XTN(awk);
|
||||
xtn->awk->uponClearing ();
|
||||
}
|
||||
|
||||
@ -1311,7 +1311,7 @@ int Awk::loop (Value* ret)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int Awk::call (const char_t* name, Value* ret, const Value* args, size_t nargs)
|
||||
int Awk::call (const qse_mchar_t* name, Value* ret, const Value* args, size_t nargs)
|
||||
{
|
||||
QSE_ASSERT (this->awk != QSE_NULL);
|
||||
QSE_ASSERT (this->runctx.rtx != QSE_NULL);
|
||||
@ -1336,7 +1336,48 @@ int Awk::call (const char_t* name, Value* ret, const Value* args, size_t nargs)
|
||||
for (size_t i = 0; i < nargs; i++) ptr[i] = (val_t*)args[i];
|
||||
}
|
||||
|
||||
val_t* rv = qse_awk_rtx_call(this->runctx.rtx, name, ptr, nargs);
|
||||
val_t* rv = qse_awk_rtx_callwithmbs(this->runctx.rtx, name, ptr, nargs);
|
||||
|
||||
if (ptr != QSE_NULL && ptr != buf) qse_awk_freemem (awk, ptr);
|
||||
|
||||
if (rv == QSE_NULL)
|
||||
{
|
||||
this->retrieveError (&this->runctx);
|
||||
return -1;
|
||||
}
|
||||
|
||||
ret->setVal (&this->runctx, rv);
|
||||
|
||||
qse_awk_rtx_refdownval (this->runctx.rtx, rv);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int Awk::call (const qse_wchar_t* name, Value* ret, const Value* args, size_t nargs)
|
||||
{
|
||||
QSE_ASSERT (this->awk != QSE_NULL);
|
||||
QSE_ASSERT (this->runctx.rtx != QSE_NULL);
|
||||
|
||||
val_t* buf[16];
|
||||
val_t** ptr = QSE_NULL;
|
||||
|
||||
if (args != QSE_NULL)
|
||||
{
|
||||
if (nargs <= QSE_COUNTOF(buf)) ptr = buf;
|
||||
else
|
||||
{
|
||||
ptr = (val_t**)qse_awk_allocmem(awk, QSE_SIZEOF(val_t*) * nargs);
|
||||
if (ptr == QSE_NULL)
|
||||
{
|
||||
this->runctx.setError (QSE_AWK_ENOMEM);
|
||||
this->retrieveError (&this->runctx);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < nargs; i++) ptr[i] = (val_t*)args[i];
|
||||
}
|
||||
|
||||
val_t* rv = qse_awk_rtx_callwithwcs(this->runctx.rtx, name, ptr, nargs);
|
||||
|
||||
if (ptr != QSE_NULL && ptr != buf) qse_awk_freemem (awk, ptr);
|
||||
|
||||
|
@ -42,7 +42,7 @@ qse_awk_val_t* qse_awk_val_nil = (qse_awk_val_t*)&awk_nil;
|
||||
qse_awk_val_t* qse_awk_val_zls = (qse_awk_val_t*)&awk_zls;
|
||||
qse_awk_val_t* qse_awk_val_zlm = (qse_awk_val_t*)&awk_zlm;
|
||||
|
||||
qse_awk_val_t* qse_getawknilval (void)
|
||||
qse_awk_val_t* qse_get_awk_nil_val (void)
|
||||
{
|
||||
return (qse_awk_val_t*)&awk_nil;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user