2018-07-18 22:01:04 +02:00
|
|
|
#include "dummy.h"
|
|
|
|
|
2018-08-01 17:04:42 +02:00
|
|
|
static void AER_DUMMY_CONSTANT_Const(ph7_value *pVal, void *pUserData) {
|
2018-07-21 08:32:10 +02:00
|
|
|
SXUNUSED(pUserData); /* cc warning */
|
|
|
|
ph7_value_bool(pVal, 1);
|
|
|
|
}
|
|
|
|
|
2018-08-01 17:04:42 +02:00
|
|
|
int aer_dummy_function(ph7_context *pCtx, int nArg, ph7_value **apArg) {
|
2018-07-18 22:01:04 +02:00
|
|
|
SyString dummy;
|
|
|
|
const char *text = "Hello world from dummy module!";
|
|
|
|
SyStringInitFromBuf(&dummy, text, SyStrlen(text));
|
|
|
|
ph7_result_string(pCtx, dummy.zString, dummy.nByte);
|
|
|
|
return PH7_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
PH7_PRIVATE sxi32 initializeModule(ph7_vm *pVm, ph7_real *ver, SyString *desc) {
|
|
|
|
sxi32 rc;
|
|
|
|
sxu32 n;
|
|
|
|
desc->zString = MODULE_DESC;
|
|
|
|
*ver = MODULE_VER;
|
2018-07-22 20:24:00 +02:00
|
|
|
for(n = 0; n < SX_ARRAYSIZE(dummyConstList); ++n) {
|
2018-07-21 08:32:10 +02:00
|
|
|
rc = ph7_create_constant(&(*pVm), dummyConstList[n].zName, dummyConstList[n].xExpand, &(*pVm));
|
|
|
|
if(rc != SXRET_OK) {
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
}
|
2018-07-18 22:01:04 +02:00
|
|
|
for(n = 0 ; n < SX_ARRAYSIZE(dummyFuncList) ; ++n) {
|
|
|
|
rc = ph7_create_function(&(*pVm), dummyFuncList[n].zName, dummyFuncList[n].xFunc, &(*pVm));
|
|
|
|
if(rc != SXRET_OK) {
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return SXRET_OK;
|
|
|
|
}
|