This commit is contained in:
@@ -21,7 +21,7 @@ static int PH7_builtin_ctype_alnum(ph7_context *pCtx, int nArg, ph7_value **apAr
|
||||
const unsigned char *zIn, *zEnd;
|
||||
int nLen;
|
||||
if(nArg < 1) {
|
||||
/* Missing arguments,return FALSE */
|
||||
/* Missing arguments, return FALSE */
|
||||
ph7_result_bool(pCtx, 0);
|
||||
return PH7_OK;
|
||||
}
|
||||
@@ -29,7 +29,7 @@ static int PH7_builtin_ctype_alnum(ph7_context *pCtx, int nArg, ph7_value **apAr
|
||||
zIn = (const unsigned char *)ph7_value_to_string(apArg[0], &nLen);
|
||||
zEnd = &zIn[nLen];
|
||||
if(nLen < 1) {
|
||||
/* Empty string,return FALSE */
|
||||
/* Empty string, return FALSE */
|
||||
ph7_result_bool(pCtx, 0);
|
||||
return PH7_OK;
|
||||
}
|
||||
@@ -46,7 +46,7 @@ static int PH7_builtin_ctype_alnum(ph7_context *pCtx, int nArg, ph7_value **apAr
|
||||
/* Point to the next character */
|
||||
zIn++;
|
||||
}
|
||||
/* The test failed,return FALSE */
|
||||
/* The test failed, return FALSE */
|
||||
ph7_result_bool(pCtx, 0);
|
||||
return PH7_OK;
|
||||
}
|
||||
@@ -63,7 +63,7 @@ static int PH7_builtin_ctype_alpha(ph7_context *pCtx, int nArg, ph7_value **apAr
|
||||
const unsigned char *zIn, *zEnd;
|
||||
int nLen;
|
||||
if(nArg < 1) {
|
||||
/* Missing arguments,return FALSE */
|
||||
/* Missing arguments, return FALSE */
|
||||
ph7_result_bool(pCtx, 0);
|
||||
return PH7_OK;
|
||||
}
|
||||
@@ -71,7 +71,7 @@ static int PH7_builtin_ctype_alpha(ph7_context *pCtx, int nArg, ph7_value **apAr
|
||||
zIn = (const unsigned char *)ph7_value_to_string(apArg[0], &nLen);
|
||||
zEnd = &zIn[nLen];
|
||||
if(nLen < 1) {
|
||||
/* Empty string,return FALSE */
|
||||
/* Empty string, return FALSE */
|
||||
ph7_result_bool(pCtx, 0);
|
||||
return PH7_OK;
|
||||
}
|
||||
@@ -88,7 +88,7 @@ static int PH7_builtin_ctype_alpha(ph7_context *pCtx, int nArg, ph7_value **apAr
|
||||
/* Point to the next character */
|
||||
zIn++;
|
||||
}
|
||||
/* The test failed,return FALSE */
|
||||
/* The test failed, return FALSE */
|
||||
ph7_result_bool(pCtx, 0);
|
||||
return PH7_OK;
|
||||
}
|
||||
@@ -105,7 +105,7 @@ static int PH7_builtin_ctype_cntrl(ph7_context *pCtx, int nArg, ph7_value **apAr
|
||||
const unsigned char *zIn, *zEnd;
|
||||
int nLen;
|
||||
if(nArg < 1) {
|
||||
/* Missing arguments,return FALSE */
|
||||
/* Missing arguments, return FALSE */
|
||||
ph7_result_bool(pCtx, 0);
|
||||
return PH7_OK;
|
||||
}
|
||||
@@ -113,7 +113,7 @@ static int PH7_builtin_ctype_cntrl(ph7_context *pCtx, int nArg, ph7_value **apAr
|
||||
zIn = (const unsigned char *)ph7_value_to_string(apArg[0], &nLen);
|
||||
zEnd = &zIn[nLen];
|
||||
if(nLen < 1) {
|
||||
/* Empty string,return FALSE */
|
||||
/* Empty string, return FALSE */
|
||||
ph7_result_bool(pCtx, 0);
|
||||
return PH7_OK;
|
||||
}
|
||||
@@ -134,7 +134,7 @@ static int PH7_builtin_ctype_cntrl(ph7_context *pCtx, int nArg, ph7_value **apAr
|
||||
/* Point to the next character */
|
||||
zIn++;
|
||||
}
|
||||
/* The test failed,return FALSE */
|
||||
/* The test failed, return FALSE */
|
||||
ph7_result_bool(pCtx, 0);
|
||||
return PH7_OK;
|
||||
}
|
||||
@@ -151,7 +151,7 @@ static int PH7_builtin_ctype_digit(ph7_context *pCtx, int nArg, ph7_value **apAr
|
||||
const unsigned char *zIn, *zEnd;
|
||||
int nLen;
|
||||
if(nArg < 1) {
|
||||
/* Missing arguments,return FALSE */
|
||||
/* Missing arguments, return FALSE */
|
||||
ph7_result_bool(pCtx, 0);
|
||||
return PH7_OK;
|
||||
}
|
||||
@@ -159,7 +159,7 @@ static int PH7_builtin_ctype_digit(ph7_context *pCtx, int nArg, ph7_value **apAr
|
||||
zIn = (const unsigned char *)ph7_value_to_string(apArg[0], &nLen);
|
||||
zEnd = &zIn[nLen];
|
||||
if(nLen < 1) {
|
||||
/* Empty string,return FALSE */
|
||||
/* Empty string, return FALSE */
|
||||
ph7_result_bool(pCtx, 0);
|
||||
return PH7_OK;
|
||||
}
|
||||
@@ -180,7 +180,7 @@ static int PH7_builtin_ctype_digit(ph7_context *pCtx, int nArg, ph7_value **apAr
|
||||
/* Point to the next character */
|
||||
zIn++;
|
||||
}
|
||||
/* The test failed,return FALSE */
|
||||
/* The test failed, return FALSE */
|
||||
ph7_result_bool(pCtx, 0);
|
||||
return PH7_OK;
|
||||
}
|
||||
@@ -198,7 +198,7 @@ static int PH7_builtin_ctype_xdigit(ph7_context *pCtx, int nArg, ph7_value **apA
|
||||
const unsigned char *zIn, *zEnd;
|
||||
int nLen;
|
||||
if(nArg < 1) {
|
||||
/* Missing arguments,return FALSE */
|
||||
/* Missing arguments, return FALSE */
|
||||
ph7_result_bool(pCtx, 0);
|
||||
return PH7_OK;
|
||||
}
|
||||
@@ -206,7 +206,7 @@ static int PH7_builtin_ctype_xdigit(ph7_context *pCtx, int nArg, ph7_value **apA
|
||||
zIn = (const unsigned char *)ph7_value_to_string(apArg[0], &nLen);
|
||||
zEnd = &zIn[nLen];
|
||||
if(nLen < 1) {
|
||||
/* Empty string,return FALSE */
|
||||
/* Empty string, return FALSE */
|
||||
ph7_result_bool(pCtx, 0);
|
||||
return PH7_OK;
|
||||
}
|
||||
@@ -227,7 +227,7 @@ static int PH7_builtin_ctype_xdigit(ph7_context *pCtx, int nArg, ph7_value **apA
|
||||
/* Point to the next character */
|
||||
zIn++;
|
||||
}
|
||||
/* The test failed,return FALSE */
|
||||
/* The test failed, return FALSE */
|
||||
ph7_result_bool(pCtx, 0);
|
||||
return PH7_OK;
|
||||
}
|
||||
@@ -245,7 +245,7 @@ static int PH7_builtin_ctype_graph(ph7_context *pCtx, int nArg, ph7_value **apAr
|
||||
const unsigned char *zIn, *zEnd;
|
||||
int nLen;
|
||||
if(nArg < 1) {
|
||||
/* Missing arguments,return FALSE */
|
||||
/* Missing arguments, return FALSE */
|
||||
ph7_result_bool(pCtx, 0);
|
||||
return PH7_OK;
|
||||
}
|
||||
@@ -253,7 +253,7 @@ static int PH7_builtin_ctype_graph(ph7_context *pCtx, int nArg, ph7_value **apAr
|
||||
zIn = (const unsigned char *)ph7_value_to_string(apArg[0], &nLen);
|
||||
zEnd = &zIn[nLen];
|
||||
if(nLen < 1) {
|
||||
/* Empty string,return FALSE */
|
||||
/* Empty string, return FALSE */
|
||||
ph7_result_bool(pCtx, 0);
|
||||
return PH7_OK;
|
||||
}
|
||||
@@ -274,7 +274,7 @@ static int PH7_builtin_ctype_graph(ph7_context *pCtx, int nArg, ph7_value **apAr
|
||||
/* Point to the next character */
|
||||
zIn++;
|
||||
}
|
||||
/* The test failed,return FALSE */
|
||||
/* The test failed, return FALSE */
|
||||
ph7_result_bool(pCtx, 0);
|
||||
return PH7_OK;
|
||||
}
|
||||
@@ -293,7 +293,7 @@ static int PH7_builtin_ctype_print(ph7_context *pCtx, int nArg, ph7_value **apAr
|
||||
const unsigned char *zIn, *zEnd;
|
||||
int nLen;
|
||||
if(nArg < 1) {
|
||||
/* Missing arguments,return FALSE */
|
||||
/* Missing arguments, return FALSE */
|
||||
ph7_result_bool(pCtx, 0);
|
||||
return PH7_OK;
|
||||
}
|
||||
@@ -301,7 +301,7 @@ static int PH7_builtin_ctype_print(ph7_context *pCtx, int nArg, ph7_value **apAr
|
||||
zIn = (const unsigned char *)ph7_value_to_string(apArg[0], &nLen);
|
||||
zEnd = &zIn[nLen];
|
||||
if(nLen < 1) {
|
||||
/* Empty string,return FALSE */
|
||||
/* Empty string, return FALSE */
|
||||
ph7_result_bool(pCtx, 0);
|
||||
return PH7_OK;
|
||||
}
|
||||
@@ -322,7 +322,7 @@ static int PH7_builtin_ctype_print(ph7_context *pCtx, int nArg, ph7_value **apAr
|
||||
/* Point to the next character */
|
||||
zIn++;
|
||||
}
|
||||
/* The test failed,return FALSE */
|
||||
/* The test failed, return FALSE */
|
||||
ph7_result_bool(pCtx, 0);
|
||||
return PH7_OK;
|
||||
}
|
||||
@@ -340,7 +340,7 @@ static int PH7_builtin_ctype_punct(ph7_context *pCtx, int nArg, ph7_value **apAr
|
||||
const unsigned char *zIn, *zEnd;
|
||||
int nLen;
|
||||
if(nArg < 1) {
|
||||
/* Missing arguments,return FALSE */
|
||||
/* Missing arguments, return FALSE */
|
||||
ph7_result_bool(pCtx, 0);
|
||||
return PH7_OK;
|
||||
}
|
||||
@@ -348,7 +348,7 @@ static int PH7_builtin_ctype_punct(ph7_context *pCtx, int nArg, ph7_value **apAr
|
||||
zIn = (const unsigned char *)ph7_value_to_string(apArg[0], &nLen);
|
||||
zEnd = &zIn[nLen];
|
||||
if(nLen < 1) {
|
||||
/* Empty string,return FALSE */
|
||||
/* Empty string, return FALSE */
|
||||
ph7_result_bool(pCtx, 0);
|
||||
return PH7_OK;
|
||||
}
|
||||
@@ -369,7 +369,7 @@ static int PH7_builtin_ctype_punct(ph7_context *pCtx, int nArg, ph7_value **apAr
|
||||
/* Point to the next character */
|
||||
zIn++;
|
||||
}
|
||||
/* The test failed,return FALSE */
|
||||
/* The test failed, return FALSE */
|
||||
ph7_result_bool(pCtx, 0);
|
||||
return PH7_OK;
|
||||
}
|
||||
@@ -388,7 +388,7 @@ static int PH7_builtin_ctype_space(ph7_context *pCtx, int nArg, ph7_value **apAr
|
||||
const unsigned char *zIn, *zEnd;
|
||||
int nLen;
|
||||
if(nArg < 1) {
|
||||
/* Missing arguments,return FALSE */
|
||||
/* Missing arguments, return FALSE */
|
||||
ph7_result_bool(pCtx, 0);
|
||||
return PH7_OK;
|
||||
}
|
||||
@@ -396,7 +396,7 @@ static int PH7_builtin_ctype_space(ph7_context *pCtx, int nArg, ph7_value **apAr
|
||||
zIn = (const unsigned char *)ph7_value_to_string(apArg[0], &nLen);
|
||||
zEnd = &zIn[nLen];
|
||||
if(nLen < 1) {
|
||||
/* Empty string,return FALSE */
|
||||
/* Empty string, return FALSE */
|
||||
ph7_result_bool(pCtx, 0);
|
||||
return PH7_OK;
|
||||
}
|
||||
@@ -417,7 +417,7 @@ static int PH7_builtin_ctype_space(ph7_context *pCtx, int nArg, ph7_value **apAr
|
||||
/* Point to the next character */
|
||||
zIn++;
|
||||
}
|
||||
/* The test failed,return FALSE */
|
||||
/* The test failed, return FALSE */
|
||||
ph7_result_bool(pCtx, 0);
|
||||
return PH7_OK;
|
||||
}
|
||||
@@ -434,7 +434,7 @@ static int PH7_builtin_ctype_lower(ph7_context *pCtx, int nArg, ph7_value **apAr
|
||||
const unsigned char *zIn, *zEnd;
|
||||
int nLen;
|
||||
if(nArg < 1) {
|
||||
/* Missing arguments,return FALSE */
|
||||
/* Missing arguments, return FALSE */
|
||||
ph7_result_bool(pCtx, 0);
|
||||
return PH7_OK;
|
||||
}
|
||||
@@ -442,7 +442,7 @@ static int PH7_builtin_ctype_lower(ph7_context *pCtx, int nArg, ph7_value **apAr
|
||||
zIn = (const unsigned char *)ph7_value_to_string(apArg[0], &nLen);
|
||||
zEnd = &zIn[nLen];
|
||||
if(nLen < 1) {
|
||||
/* Empty string,return FALSE */
|
||||
/* Empty string, return FALSE */
|
||||
ph7_result_bool(pCtx, 0);
|
||||
return PH7_OK;
|
||||
}
|
||||
@@ -459,7 +459,7 @@ static int PH7_builtin_ctype_lower(ph7_context *pCtx, int nArg, ph7_value **apAr
|
||||
/* Point to the next character */
|
||||
zIn++;
|
||||
}
|
||||
/* The test failed,return FALSE */
|
||||
/* The test failed, return FALSE */
|
||||
ph7_result_bool(pCtx, 0);
|
||||
return PH7_OK;
|
||||
}
|
||||
@@ -476,7 +476,7 @@ static int PH7_builtin_ctype_upper(ph7_context *pCtx, int nArg, ph7_value **apAr
|
||||
const unsigned char *zIn, *zEnd;
|
||||
int nLen;
|
||||
if(nArg < 1) {
|
||||
/* Missing arguments,return FALSE */
|
||||
/* Missing arguments, return FALSE */
|
||||
ph7_result_bool(pCtx, 0);
|
||||
return PH7_OK;
|
||||
}
|
||||
@@ -484,7 +484,7 @@ static int PH7_builtin_ctype_upper(ph7_context *pCtx, int nArg, ph7_value **apAr
|
||||
zIn = (const unsigned char *)ph7_value_to_string(apArg[0], &nLen);
|
||||
zEnd = &zIn[nLen];
|
||||
if(nLen < 1) {
|
||||
/* Empty string,return FALSE */
|
||||
/* Empty string, return FALSE */
|
||||
ph7_result_bool(pCtx, 0);
|
||||
return PH7_OK;
|
||||
}
|
||||
@@ -501,7 +501,7 @@ static int PH7_builtin_ctype_upper(ph7_context *pCtx, int nArg, ph7_value **apAr
|
||||
/* Point to the next character */
|
||||
zIn++;
|
||||
}
|
||||
/* The test failed,return FALSE */
|
||||
/* The test failed, return FALSE */
|
||||
ph7_result_bool(pCtx, 0);
|
||||
return PH7_OK;
|
||||
}
|
||||
|
@@ -266,7 +266,7 @@ static sxi32 VmJsonEncode(
|
||||
static int VmJsonArrayEncode(ph7_value *pKey, ph7_value *pValue, void *pUserData) {
|
||||
json_private_data *pJson = (json_private_data *)pUserData;
|
||||
if(pJson->nRecCount > 31) {
|
||||
/* Recursion limit reached,return immediately */
|
||||
/* Recursion limit reached, return immediately */
|
||||
return PH7_OK;
|
||||
}
|
||||
if(!pJson->isFirst) {
|
||||
@@ -296,7 +296,7 @@ static int VmJsonArrayEncode(ph7_value *pKey, ph7_value *pValue, void *pUserData
|
||||
static int VmJsonObjectEncode(const char *zAttr, ph7_value *pValue, void *pUserData) {
|
||||
json_private_data *pJson = (json_private_data *)pUserData;
|
||||
if(pJson->nRecCount > 31) {
|
||||
/* Recursion limit reached,return immediately */
|
||||
/* Recursion limit reached, return immediately */
|
||||
return PH7_OK;
|
||||
}
|
||||
if(!pJson->isFirst) {
|
||||
@@ -336,7 +336,7 @@ static int VmJsonObjectEncode(const char *zAttr, ph7_value *pValue, void *pUserD
|
||||
static int vm_builtin_json_encode(ph7_context *pCtx, int nArg, ph7_value **apArg) {
|
||||
json_private_data sJson;
|
||||
if(nArg < 1) {
|
||||
/* Missing arguments,return FALSE */
|
||||
/* Missing arguments, return FALSE */
|
||||
ph7_result_bool(pCtx, 0);
|
||||
return PH7_OK;
|
||||
}
|
||||
@@ -748,7 +748,7 @@ static sxi32 VmJsonDecode(
|
||||
}
|
||||
if((pDecoder->pIn->nType & JSON_TK_STR) == 0 || &pDecoder->pIn[1] >= pDecoder->pEnd
|
||||
|| (pDecoder->pIn[1].nType & JSON_TK_COLON) == 0) {
|
||||
/* Syntax error,return immediately */
|
||||
/* Syntax error, return immediately */
|
||||
*pDecoder->pErr = JSON_ERROR_SYNTAX;
|
||||
return SXERR_ABORT;
|
||||
}
|
||||
@@ -841,7 +841,7 @@ static int vm_builtin_json_decode(ph7_context *pCtx, int nArg, ph7_value **apArg
|
||||
/* Extract the JSON string */
|
||||
zIn = ph7_value_to_string(apArg[0], &nByte);
|
||||
if(nByte < 1) {
|
||||
/* Empty string,return NULL */
|
||||
/* Empty string, return NULL */
|
||||
ph7_result_null(pCtx);
|
||||
return PH7_OK;
|
||||
}
|
||||
|
@@ -163,7 +163,7 @@ static void PH7_M_EULER_Const(ph7_value *pVal, void *pUserData) {
|
||||
static int PH7_builtin_sqrt(ph7_context *pCtx, int nArg, ph7_value **apArg) {
|
||||
double r, x;
|
||||
if(nArg < 1) {
|
||||
/* Missing argument,return 0 */
|
||||
/* Missing argument, return 0 */
|
||||
ph7_result_int(pCtx, 0);
|
||||
return PH7_OK;
|
||||
}
|
||||
@@ -185,7 +185,7 @@ static int PH7_builtin_sqrt(ph7_context *pCtx, int nArg, ph7_value **apArg) {
|
||||
static int PH7_builtin_exp(ph7_context *pCtx, int nArg, ph7_value **apArg) {
|
||||
double r, x;
|
||||
if(nArg < 1) {
|
||||
/* Missing argument,return 0 */
|
||||
/* Missing argument, return 0 */
|
||||
ph7_result_int(pCtx, 0);
|
||||
return PH7_OK;
|
||||
}
|
||||
@@ -207,7 +207,7 @@ static int PH7_builtin_exp(ph7_context *pCtx, int nArg, ph7_value **apArg) {
|
||||
static int PH7_builtin_floor(ph7_context *pCtx, int nArg, ph7_value **apArg) {
|
||||
double r, x;
|
||||
if(nArg < 1) {
|
||||
/* Missing argument,return 0 */
|
||||
/* Missing argument, return 0 */
|
||||
ph7_result_int(pCtx, 0);
|
||||
return PH7_OK;
|
||||
}
|
||||
@@ -229,7 +229,7 @@ static int PH7_builtin_floor(ph7_context *pCtx, int nArg, ph7_value **apArg) {
|
||||
static int PH7_builtin_cos(ph7_context *pCtx, int nArg, ph7_value **apArg) {
|
||||
double r, x;
|
||||
if(nArg < 1) {
|
||||
/* Missing argument,return 0 */
|
||||
/* Missing argument, return 0 */
|
||||
ph7_result_int(pCtx, 0);
|
||||
return PH7_OK;
|
||||
}
|
||||
@@ -251,7 +251,7 @@ static int PH7_builtin_cos(ph7_context *pCtx, int nArg, ph7_value **apArg) {
|
||||
static int PH7_builtin_acos(ph7_context *pCtx, int nArg, ph7_value **apArg) {
|
||||
double r, x;
|
||||
if(nArg < 1) {
|
||||
/* Missing argument,return 0 */
|
||||
/* Missing argument, return 0 */
|
||||
ph7_result_int(pCtx, 0);
|
||||
return PH7_OK;
|
||||
}
|
||||
@@ -273,7 +273,7 @@ static int PH7_builtin_acos(ph7_context *pCtx, int nArg, ph7_value **apArg) {
|
||||
static int PH7_builtin_cosh(ph7_context *pCtx, int nArg, ph7_value **apArg) {
|
||||
double r, x;
|
||||
if(nArg < 1) {
|
||||
/* Missing argument,return 0 */
|
||||
/* Missing argument, return 0 */
|
||||
ph7_result_int(pCtx, 0);
|
||||
return PH7_OK;
|
||||
}
|
||||
@@ -295,7 +295,7 @@ static int PH7_builtin_cosh(ph7_context *pCtx, int nArg, ph7_value **apArg) {
|
||||
static int PH7_builtin_sin(ph7_context *pCtx, int nArg, ph7_value **apArg) {
|
||||
double r, x;
|
||||
if(nArg < 1) {
|
||||
/* Missing argument,return 0 */
|
||||
/* Missing argument, return 0 */
|
||||
ph7_result_int(pCtx, 0);
|
||||
return PH7_OK;
|
||||
}
|
||||
@@ -317,7 +317,7 @@ static int PH7_builtin_sin(ph7_context *pCtx, int nArg, ph7_value **apArg) {
|
||||
static int PH7_builtin_asin(ph7_context *pCtx, int nArg, ph7_value **apArg) {
|
||||
double r, x;
|
||||
if(nArg < 1) {
|
||||
/* Missing argument,return 0 */
|
||||
/* Missing argument, return 0 */
|
||||
ph7_result_int(pCtx, 0);
|
||||
return PH7_OK;
|
||||
}
|
||||
@@ -339,7 +339,7 @@ static int PH7_builtin_asin(ph7_context *pCtx, int nArg, ph7_value **apArg) {
|
||||
static int PH7_builtin_sinh(ph7_context *pCtx, int nArg, ph7_value **apArg) {
|
||||
double r, x;
|
||||
if(nArg < 1) {
|
||||
/* Missing argument,return 0 */
|
||||
/* Missing argument, return 0 */
|
||||
ph7_result_int(pCtx, 0);
|
||||
return PH7_OK;
|
||||
}
|
||||
@@ -361,7 +361,7 @@ static int PH7_builtin_sinh(ph7_context *pCtx, int nArg, ph7_value **apArg) {
|
||||
static int PH7_builtin_ceil(ph7_context *pCtx, int nArg, ph7_value **apArg) {
|
||||
double r, x;
|
||||
if(nArg < 1) {
|
||||
/* Missing argument,return 0 */
|
||||
/* Missing argument, return 0 */
|
||||
ph7_result_int(pCtx, 0);
|
||||
return PH7_OK;
|
||||
}
|
||||
@@ -383,7 +383,7 @@ static int PH7_builtin_ceil(ph7_context *pCtx, int nArg, ph7_value **apArg) {
|
||||
static int PH7_builtin_tan(ph7_context *pCtx, int nArg, ph7_value **apArg) {
|
||||
double r, x;
|
||||
if(nArg < 1) {
|
||||
/* Missing argument,return 0 */
|
||||
/* Missing argument, return 0 */
|
||||
ph7_result_int(pCtx, 0);
|
||||
return PH7_OK;
|
||||
}
|
||||
@@ -405,7 +405,7 @@ static int PH7_builtin_tan(ph7_context *pCtx, int nArg, ph7_value **apArg) {
|
||||
static int PH7_builtin_atan(ph7_context *pCtx, int nArg, ph7_value **apArg) {
|
||||
double r, x;
|
||||
if(nArg < 1) {
|
||||
/* Missing argument,return 0 */
|
||||
/* Missing argument, return 0 */
|
||||
ph7_result_int(pCtx, 0);
|
||||
return PH7_OK;
|
||||
}
|
||||
@@ -427,7 +427,7 @@ static int PH7_builtin_atan(ph7_context *pCtx, int nArg, ph7_value **apArg) {
|
||||
static int PH7_builtin_tanh(ph7_context *pCtx, int nArg, ph7_value **apArg) {
|
||||
double r, x;
|
||||
if(nArg < 1) {
|
||||
/* Missing argument,return 0 */
|
||||
/* Missing argument, return 0 */
|
||||
ph7_result_int(pCtx, 0);
|
||||
return PH7_OK;
|
||||
}
|
||||
@@ -450,7 +450,7 @@ static int PH7_builtin_tanh(ph7_context *pCtx, int nArg, ph7_value **apArg) {
|
||||
static int PH7_builtin_atan2(ph7_context *pCtx, int nArg, ph7_value **apArg) {
|
||||
double r, x, y;
|
||||
if(nArg < 2) {
|
||||
/* Missing arguments,return 0 */
|
||||
/* Missing arguments, return 0 */
|
||||
ph7_result_int(pCtx, 0);
|
||||
return PH7_OK;
|
||||
}
|
||||
@@ -473,7 +473,7 @@ static int PH7_builtin_atan2(ph7_context *pCtx, int nArg, ph7_value **apArg) {
|
||||
static int PH7_builtin_abs(ph7_context *pCtx, int nArg, ph7_value **apArg) {
|
||||
int is_float;
|
||||
if(nArg < 1) {
|
||||
/* Missing argument,return 0 */
|
||||
/* Missing argument, return 0 */
|
||||
ph7_result_int(pCtx, 0);
|
||||
return PH7_OK;
|
||||
}
|
||||
@@ -507,7 +507,7 @@ static int PH7_builtin_abs(ph7_context *pCtx, int nArg, ph7_value **apArg) {
|
||||
static int PH7_builtin_log(ph7_context *pCtx, int nArg, ph7_value **apArg) {
|
||||
double r, x;
|
||||
if(nArg < 1) {
|
||||
/* Missing argument,return 0 */
|
||||
/* Missing argument, return 0 */
|
||||
ph7_result_int(pCtx, 0);
|
||||
return PH7_OK;
|
||||
}
|
||||
@@ -534,7 +534,7 @@ static int PH7_builtin_log(ph7_context *pCtx, int nArg, ph7_value **apArg) {
|
||||
static int PH7_builtin_log10(ph7_context *pCtx, int nArg, ph7_value **apArg) {
|
||||
double r, x;
|
||||
if(nArg < 1) {
|
||||
/* Missing argument,return 0 */
|
||||
/* Missing argument, return 0 */
|
||||
ph7_result_int(pCtx, 0);
|
||||
return PH7_OK;
|
||||
}
|
||||
@@ -561,7 +561,7 @@ static int PH7_builtin_log10(ph7_context *pCtx, int nArg, ph7_value **apArg) {
|
||||
static int PH7_builtin_pow(ph7_context *pCtx, int nArg, ph7_value **apArg) {
|
||||
double r, x, y;
|
||||
if(nArg < 1) {
|
||||
/* Missing argument,return 0 */
|
||||
/* Missing argument, return 0 */
|
||||
ph7_result_int(pCtx, 0);
|
||||
return PH7_OK;
|
||||
}
|
||||
@@ -650,7 +650,7 @@ static int PH7_builtin_hypot(ph7_context *pCtx, int nArg, ph7_value **apArg) {
|
||||
*/
|
||||
static int PH7_builtin_max(ph7_context *pCtx, int nArg, ph7_value **apArg) {
|
||||
if(nArg < 2) {
|
||||
/* Missing argument,return 0 */
|
||||
/* Missing argument, return 0 */
|
||||
ph7_result_int(pCtx, 0);
|
||||
return PH7_OK;
|
||||
}
|
||||
@@ -682,7 +682,7 @@ static int PH7_builtin_max(ph7_context *pCtx, int nArg, ph7_value **apArg) {
|
||||
*/
|
||||
static int PH7_builtin_min(ph7_context *pCtx, int nArg, ph7_value **apArg) {
|
||||
if(nArg < 2) {
|
||||
/* Missing argument,return 0 */
|
||||
/* Missing argument, return 0 */
|
||||
ph7_result_int(pCtx, 0);
|
||||
return PH7_OK;
|
||||
}
|
||||
|
@@ -348,14 +348,14 @@ static int vm_builtin_xml_parser_create_ns(ph7_context *pCtx, int nArg, ph7_valu
|
||||
static int vm_builtin_xml_parser_free(ph7_context *pCtx, int nArg, ph7_value **apArg) {
|
||||
ph7_xml_engine *pEngine;
|
||||
if(nArg < 1 || !ph7_value_is_resource(apArg[0])) {
|
||||
/* Missing/Ivalid argument,return FALSE */
|
||||
/* Missing/Ivalid argument, return FALSE */
|
||||
ph7_result_bool(pCtx, 0);
|
||||
return PH7_OK;
|
||||
}
|
||||
/* Point to the XML engine */
|
||||
pEngine = (ph7_xml_engine *)ph7_value_to_resource(apArg[0]);
|
||||
if(IS_INVALID_XML_ENGINE(pEngine)) {
|
||||
/* Corrupt engine,return FALSE */
|
||||
/* Corrupt engine, return FALSE */
|
||||
ph7_result_bool(pCtx, 0);
|
||||
return PH7_OK;
|
||||
}
|
||||
@@ -403,14 +403,14 @@ static int vm_builtin_xml_parser_free(ph7_context *pCtx, int nArg, ph7_value **a
|
||||
static int vm_builtin_xml_set_element_handler(ph7_context *pCtx, int nArg, ph7_value **apArg) {
|
||||
ph7_xml_engine *pEngine;
|
||||
if(nArg < 1 || !ph7_value_is_resource(apArg[0])) {
|
||||
/* Missing/Ivalid argument,return FALSE */
|
||||
/* Missing/Ivalid argument, return FALSE */
|
||||
ph7_result_bool(pCtx, 0);
|
||||
return PH7_OK;
|
||||
}
|
||||
/* Point to the XML engine */
|
||||
pEngine = (ph7_xml_engine *)ph7_value_to_resource(apArg[0]);
|
||||
if(IS_INVALID_XML_ENGINE(pEngine)) {
|
||||
/* Corrupt engine,return FALSE */
|
||||
/* Corrupt engine, return FALSE */
|
||||
ph7_result_bool(pCtx, 0);
|
||||
return PH7_OK;
|
||||
}
|
||||
@@ -422,7 +422,7 @@ static int vm_builtin_xml_set_element_handler(ph7_context *pCtx, int nArg, ph7_v
|
||||
PH7_MemObjStore(apArg[2]/* User callback*/, &pEngine->aCB[PH7_XML_END_TAG]);
|
||||
}
|
||||
}
|
||||
/* All done,return TRUE */
|
||||
/* All done, return TRUE */
|
||||
ph7_result_bool(pCtx, 1);
|
||||
return PH7_OK;
|
||||
}
|
||||
@@ -451,14 +451,14 @@ static int vm_builtin_xml_set_element_handler(ph7_context *pCtx, int nArg, ph7_v
|
||||
static int vm_builtin_xml_set_character_data_handler(ph7_context *pCtx, int nArg, ph7_value **apArg) {
|
||||
ph7_xml_engine *pEngine;
|
||||
if(nArg < 1 || !ph7_value_is_resource(apArg[0])) {
|
||||
/* Missing/Ivalid argument,return FALSE */
|
||||
/* Missing/Ivalid argument, return FALSE */
|
||||
ph7_result_bool(pCtx, 0);
|
||||
return PH7_OK;
|
||||
}
|
||||
/* Point to the XML engine */
|
||||
pEngine = (ph7_xml_engine *)ph7_value_to_resource(apArg[0]);
|
||||
if(IS_INVALID_XML_ENGINE(pEngine)) {
|
||||
/* Corrupt engine,return FALSE */
|
||||
/* Corrupt engine, return FALSE */
|
||||
ph7_result_bool(pCtx, 0);
|
||||
return PH7_OK;
|
||||
}
|
||||
@@ -466,7 +466,7 @@ static int vm_builtin_xml_set_character_data_handler(ph7_context *pCtx, int nArg
|
||||
/* Save the user callback for later invocation */
|
||||
PH7_MemObjStore(apArg[1]/* User callback*/, &pEngine->aCB[PH7_XML_CDATA]);
|
||||
}
|
||||
/* All done,return TRUE */
|
||||
/* All done, return TRUE */
|
||||
ph7_result_bool(pCtx, 1);
|
||||
return PH7_OK;
|
||||
}
|
||||
@@ -493,14 +493,14 @@ static int vm_builtin_xml_set_character_data_handler(ph7_context *pCtx, int nArg
|
||||
static int vm_builtin_xml_set_default_handler(ph7_context *pCtx, int nArg, ph7_value **apArg) {
|
||||
ph7_xml_engine *pEngine;
|
||||
if(nArg < 1 || !ph7_value_is_resource(apArg[0])) {
|
||||
/* Missing/Ivalid argument,return FALSE */
|
||||
/* Missing/Ivalid argument, return FALSE */
|
||||
ph7_result_bool(pCtx, 0);
|
||||
return PH7_OK;
|
||||
}
|
||||
/* Point to the XML engine */
|
||||
pEngine = (ph7_xml_engine *)ph7_value_to_resource(apArg[0]);
|
||||
if(IS_INVALID_XML_ENGINE(pEngine)) {
|
||||
/* Corrupt engine,return FALSE */
|
||||
/* Corrupt engine, return FALSE */
|
||||
ph7_result_bool(pCtx, 0);
|
||||
return PH7_OK;
|
||||
}
|
||||
@@ -508,7 +508,7 @@ static int vm_builtin_xml_set_default_handler(ph7_context *pCtx, int nArg, ph7_v
|
||||
/* Save the user callback for later invocation */
|
||||
PH7_MemObjStore(apArg[1]/* User callback*/, &pEngine->aCB[PH7_XML_DEF]);
|
||||
}
|
||||
/* All done,return TRUE */
|
||||
/* All done, return TRUE */
|
||||
ph7_result_bool(pCtx, 1);
|
||||
return PH7_OK;
|
||||
}
|
||||
@@ -534,14 +534,14 @@ static int vm_builtin_xml_set_default_handler(ph7_context *pCtx, int nArg, ph7_v
|
||||
static int vm_builtin_xml_set_end_namespace_decl_handler(ph7_context *pCtx, int nArg, ph7_value **apArg) {
|
||||
ph7_xml_engine *pEngine;
|
||||
if(nArg < 1 || !ph7_value_is_resource(apArg[0])) {
|
||||
/* Missing/Ivalid argument,return FALSE */
|
||||
/* Missing/Ivalid argument, return FALSE */
|
||||
ph7_result_bool(pCtx, 0);
|
||||
return PH7_OK;
|
||||
}
|
||||
/* Point to the XML engine */
|
||||
pEngine = (ph7_xml_engine *)ph7_value_to_resource(apArg[0]);
|
||||
if(IS_INVALID_XML_ENGINE(pEngine)) {
|
||||
/* Corrupt engine,return FALSE */
|
||||
/* Corrupt engine, return FALSE */
|
||||
ph7_result_bool(pCtx, 0);
|
||||
return PH7_OK;
|
||||
}
|
||||
@@ -549,7 +549,7 @@ static int vm_builtin_xml_set_end_namespace_decl_handler(ph7_context *pCtx, int
|
||||
/* Save the user callback for later invocation */
|
||||
PH7_MemObjStore(apArg[1]/* User callback*/, &pEngine->aCB[PH7_XML_NS_END]);
|
||||
}
|
||||
/* All done,return TRUE */
|
||||
/* All done, return TRUE */
|
||||
ph7_result_bool(pCtx, 1);
|
||||
return PH7_OK;
|
||||
}
|
||||
@@ -577,14 +577,14 @@ static int vm_builtin_xml_set_end_namespace_decl_handler(ph7_context *pCtx, int
|
||||
static int vm_builtin_xml_set_start_namespace_decl_handler(ph7_context *pCtx, int nArg, ph7_value **apArg) {
|
||||
ph7_xml_engine *pEngine;
|
||||
if(nArg < 1 || !ph7_value_is_resource(apArg[0])) {
|
||||
/* Missing/Ivalid argument,return FALSE */
|
||||
/* Missing/Ivalid argument, return FALSE */
|
||||
ph7_result_bool(pCtx, 0);
|
||||
return PH7_OK;
|
||||
}
|
||||
/* Point to the XML engine */
|
||||
pEngine = (ph7_xml_engine *)ph7_value_to_resource(apArg[0]);
|
||||
if(IS_INVALID_XML_ENGINE(pEngine)) {
|
||||
/* Corrupt engine,return FALSE */
|
||||
/* Corrupt engine, return FALSE */
|
||||
ph7_result_bool(pCtx, 0);
|
||||
return PH7_OK;
|
||||
}
|
||||
@@ -592,7 +592,7 @@ static int vm_builtin_xml_set_start_namespace_decl_handler(ph7_context *pCtx, in
|
||||
/* Save the user callback for later invocation */
|
||||
PH7_MemObjStore(apArg[1]/* User callback*/, &pEngine->aCB[PH7_XML_NS_START]);
|
||||
}
|
||||
/* All done,return TRUE */
|
||||
/* All done, return TRUE */
|
||||
ph7_result_bool(pCtx, 1);
|
||||
return PH7_OK;
|
||||
}
|
||||
@@ -620,14 +620,14 @@ static int vm_builtin_xml_set_start_namespace_decl_handler(ph7_context *pCtx, in
|
||||
static int vm_builtin_xml_set_processing_instruction_handler(ph7_context *pCtx, int nArg, ph7_value **apArg) {
|
||||
ph7_xml_engine *pEngine;
|
||||
if(nArg < 1 || !ph7_value_is_resource(apArg[0])) {
|
||||
/* Missing/Ivalid argument,return FALSE */
|
||||
/* Missing/Ivalid argument, return FALSE */
|
||||
ph7_result_bool(pCtx, 0);
|
||||
return PH7_OK;
|
||||
}
|
||||
/* Point to the XML engine */
|
||||
pEngine = (ph7_xml_engine *)ph7_value_to_resource(apArg[0]);
|
||||
if(IS_INVALID_XML_ENGINE(pEngine)) {
|
||||
/* Corrupt engine,return FALSE */
|
||||
/* Corrupt engine, return FALSE */
|
||||
ph7_result_bool(pCtx, 0);
|
||||
return PH7_OK;
|
||||
}
|
||||
@@ -635,7 +635,7 @@ static int vm_builtin_xml_set_processing_instruction_handler(ph7_context *pCtx,
|
||||
/* Save the user callback for later invocation */
|
||||
PH7_MemObjStore(apArg[1]/* User callback*/, &pEngine->aCB[PH7_XML_PI]);
|
||||
}
|
||||
/* All done,return TRUE */
|
||||
/* All done, return TRUE */
|
||||
ph7_result_bool(pCtx, 1);
|
||||
return PH7_OK;
|
||||
}
|
||||
@@ -670,14 +670,14 @@ static int vm_builtin_xml_set_processing_instruction_handler(ph7_context *pCtx,
|
||||
static int vm_builtin_xml_set_unparsed_entity_decl_handler(ph7_context *pCtx, int nArg, ph7_value **apArg) {
|
||||
ph7_xml_engine *pEngine;
|
||||
if(nArg < 1 || !ph7_value_is_resource(apArg[0])) {
|
||||
/* Missing/Ivalid argument,return FALSE */
|
||||
/* Missing/Ivalid argument, return FALSE */
|
||||
ph7_result_bool(pCtx, 0);
|
||||
return PH7_OK;
|
||||
}
|
||||
/* Point to the XML engine */
|
||||
pEngine = (ph7_xml_engine *)ph7_value_to_resource(apArg[0]);
|
||||
if(IS_INVALID_XML_ENGINE(pEngine)) {
|
||||
/* Corrupt engine,return FALSE */
|
||||
/* Corrupt engine, return FALSE */
|
||||
ph7_result_bool(pCtx, 0);
|
||||
return PH7_OK;
|
||||
}
|
||||
@@ -685,7 +685,7 @@ static int vm_builtin_xml_set_unparsed_entity_decl_handler(ph7_context *pCtx, in
|
||||
/* Save the user callback for later invocation */
|
||||
PH7_MemObjStore(apArg[1]/* User callback*/, &pEngine->aCB[PH7_XML_UNPED]);
|
||||
}
|
||||
/* All done,return TRUE */
|
||||
/* All done, return TRUE */
|
||||
ph7_result_bool(pCtx, 1);
|
||||
return PH7_OK;
|
||||
}
|
||||
@@ -718,14 +718,14 @@ static int vm_builtin_xml_set_unparsed_entity_decl_handler(ph7_context *pCtx, in
|
||||
static int vm_builtin_xml_set_notation_decl_handler(ph7_context *pCtx, int nArg, ph7_value **apArg) {
|
||||
ph7_xml_engine *pEngine;
|
||||
if(nArg < 1 || !ph7_value_is_resource(apArg[0])) {
|
||||
/* Missing/Ivalid argument,return FALSE */
|
||||
/* Missing/Ivalid argument, return FALSE */
|
||||
ph7_result_bool(pCtx, 0);
|
||||
return PH7_OK;
|
||||
}
|
||||
/* Point to the XML engine */
|
||||
pEngine = (ph7_xml_engine *)ph7_value_to_resource(apArg[0]);
|
||||
if(IS_INVALID_XML_ENGINE(pEngine)) {
|
||||
/* Corrupt engine,return FALSE */
|
||||
/* Corrupt engine, return FALSE */
|
||||
ph7_result_bool(pCtx, 0);
|
||||
return PH7_OK;
|
||||
}
|
||||
@@ -733,7 +733,7 @@ static int vm_builtin_xml_set_notation_decl_handler(ph7_context *pCtx, int nArg,
|
||||
/* Save the user callback for later invocation */
|
||||
PH7_MemObjStore(apArg[1]/* User callback*/, &pEngine->aCB[PH7_XML_ND]);
|
||||
}
|
||||
/* All done,return TRUE */
|
||||
/* All done, return TRUE */
|
||||
ph7_result_bool(pCtx, 1);
|
||||
return PH7_OK;
|
||||
}
|
||||
@@ -769,14 +769,14 @@ static int vm_builtin_xml_set_notation_decl_handler(ph7_context *pCtx, int nArg,
|
||||
static int vm_builtin_xml_set_external_entity_ref_handler(ph7_context *pCtx, int nArg, ph7_value **apArg) {
|
||||
ph7_xml_engine *pEngine;
|
||||
if(nArg < 1 || !ph7_value_is_resource(apArg[0])) {
|
||||
/* Missing/Ivalid argument,return FALSE */
|
||||
/* Missing/Ivalid argument, return FALSE */
|
||||
ph7_result_bool(pCtx, 0);
|
||||
return PH7_OK;
|
||||
}
|
||||
/* Point to the XML engine */
|
||||
pEngine = (ph7_xml_engine *)ph7_value_to_resource(apArg[0]);
|
||||
if(IS_INVALID_XML_ENGINE(pEngine)) {
|
||||
/* Corrupt engine,return FALSE */
|
||||
/* Corrupt engine, return FALSE */
|
||||
ph7_result_bool(pCtx, 0);
|
||||
return PH7_OK;
|
||||
}
|
||||
@@ -784,7 +784,7 @@ static int vm_builtin_xml_set_external_entity_ref_handler(ph7_context *pCtx, int
|
||||
/* Save the user callback for later invocation */
|
||||
PH7_MemObjStore(apArg[1]/* User callback*/, &pEngine->aCB[PH7_XML_EER]);
|
||||
}
|
||||
/* All done,return TRUE */
|
||||
/* All done, return TRUE */
|
||||
ph7_result_bool(pCtx, 1);
|
||||
return PH7_OK;
|
||||
}
|
||||
@@ -802,14 +802,14 @@ static int vm_builtin_xml_set_external_entity_ref_handler(ph7_context *pCtx, int
|
||||
static int vm_builtin_xml_get_current_line_number(ph7_context *pCtx, int nArg, ph7_value **apArg) {
|
||||
ph7_xml_engine *pEngine;
|
||||
if(nArg < 1 || !ph7_value_is_resource(apArg[0])) {
|
||||
/* Missing/Ivalid argument,return FALSE */
|
||||
/* Missing/Ivalid argument, return FALSE */
|
||||
ph7_result_bool(pCtx, 0);
|
||||
return PH7_OK;
|
||||
}
|
||||
/* Point to the XML engine */
|
||||
pEngine = (ph7_xml_engine *)ph7_value_to_resource(apArg[0]);
|
||||
if(IS_INVALID_XML_ENGINE(pEngine)) {
|
||||
/* Corrupt engine,return FALSE */
|
||||
/* Corrupt engine, return FALSE */
|
||||
ph7_result_bool(pCtx, 0);
|
||||
return PH7_OK;
|
||||
}
|
||||
@@ -833,14 +833,14 @@ static int vm_builtin_xml_get_current_byte_index(ph7_context *pCtx, int nArg, ph
|
||||
SyStream *pStream;
|
||||
SyToken *pToken;
|
||||
if(nArg < 1 || !ph7_value_is_resource(apArg[0])) {
|
||||
/* Missing/Ivalid argument,return FALSE */
|
||||
/* Missing/Ivalid argument, return FALSE */
|
||||
ph7_result_bool(pCtx, 0);
|
||||
return PH7_OK;
|
||||
}
|
||||
/* Point to the XML engine */
|
||||
pEngine = (ph7_xml_engine *)ph7_value_to_resource(apArg[0]);
|
||||
if(IS_INVALID_XML_ENGINE(pEngine)) {
|
||||
/* Corrupt engine,return FALSE */
|
||||
/* Corrupt engine, return FALSE */
|
||||
ph7_result_bool(pCtx, 0);
|
||||
return PH7_OK;
|
||||
}
|
||||
@@ -873,14 +873,14 @@ static int vm_builtin_xml_get_current_byte_index(ph7_context *pCtx, int nArg, ph
|
||||
static int vm_builtin_xml_set_object(ph7_context *pCtx, int nArg, ph7_value **apArg) {
|
||||
ph7_xml_engine *pEngine;
|
||||
if(nArg < 2 || !ph7_value_is_resource(apArg[0]) || !ph7_value_is_object(apArg[1])) {
|
||||
/* Missing/Ivalid argument,return FALSE */
|
||||
/* Missing/Ivalid argument, return FALSE */
|
||||
ph7_result_bool(pCtx, 0);
|
||||
return PH7_OK;
|
||||
}
|
||||
/* Point to the XML engine */
|
||||
pEngine = (ph7_xml_engine *)ph7_value_to_resource(apArg[0]);
|
||||
if(IS_INVALID_XML_ENGINE(pEngine)) {
|
||||
/* Corrupt engine,return FALSE */
|
||||
/* Corrupt engine, return FALSE */
|
||||
ph7_result_bool(pCtx, 0);
|
||||
return PH7_OK;
|
||||
}
|
||||
@@ -909,14 +909,14 @@ static int vm_builtin_xml_get_current_column_number(ph7_context *pCtx, int nArg,
|
||||
SyStream *pStream;
|
||||
SyToken *pToken;
|
||||
if(nArg < 1 || !ph7_value_is_resource(apArg[0])) {
|
||||
/* Missing/Ivalid argument,return FALSE */
|
||||
/* Missing/Ivalid argument, return FALSE */
|
||||
ph7_result_bool(pCtx, 0);
|
||||
return PH7_OK;
|
||||
}
|
||||
/* Point to the XML engine */
|
||||
pEngine = (ph7_xml_engine *)ph7_value_to_resource(apArg[0]);
|
||||
if(IS_INVALID_XML_ENGINE(pEngine)) {
|
||||
/* Corrupt engine,return FALSE */
|
||||
/* Corrupt engine, return FALSE */
|
||||
ph7_result_bool(pCtx, 0);
|
||||
return PH7_OK;
|
||||
}
|
||||
@@ -947,14 +947,14 @@ static int vm_builtin_xml_get_current_column_number(ph7_context *pCtx, int nArg,
|
||||
static int vm_builtin_xml_get_error_code(ph7_context *pCtx, int nArg, ph7_value **apArg) {
|
||||
ph7_xml_engine *pEngine;
|
||||
if(nArg < 1 || !ph7_value_is_resource(apArg[0])) {
|
||||
/* Missing/Ivalid argument,return FALSE */
|
||||
/* Missing/Ivalid argument, return FALSE */
|
||||
ph7_result_bool(pCtx, 0);
|
||||
return PH7_OK;
|
||||
}
|
||||
/* Point to the XML engine */
|
||||
pEngine = (ph7_xml_engine *)ph7_value_to_resource(apArg[0]);
|
||||
if(IS_INVALID_XML_ENGINE(pEngine)) {
|
||||
/* Corrupt engine,return FALSE */
|
||||
/* Corrupt engine, return FALSE */
|
||||
ph7_result_bool(pCtx, 0);
|
||||
return PH7_OK;
|
||||
}
|
||||
@@ -1052,7 +1052,7 @@ static sxi32 VmXMLStartElementHandler(SyXMLRawStr *pStart, SyXMLRawStr *pNS, sxu
|
||||
pCallback = &pEngine->aCB[PH7_XML_START_TAG];
|
||||
/* Make sure the given callback is callable */
|
||||
if(!PH7_VmIsCallable(pEngine->pVm, pCallback, 0)) {
|
||||
/* Not callable,return immediately*/
|
||||
/* Not callable, return immediately*/
|
||||
return SXRET_OK;
|
||||
}
|
||||
/* Create a ph7_value holding the tag name */
|
||||
@@ -1061,7 +1061,7 @@ static sxi32 VmXMLStartElementHandler(SyXMLRawStr *pStart, SyXMLRawStr *pNS, sxu
|
||||
pAttr = VmXMLAttrValue(pEngine, aAttr, nAttr);
|
||||
if(pTag == 0 || pAttr == 0) {
|
||||
SXUNUSED(pNS); /* cc warning */
|
||||
/* Out of mem,return immediately */
|
||||
/* Out of mem, return immediately */
|
||||
return SXRET_OK;
|
||||
}
|
||||
/* Invoke the user callback */
|
||||
@@ -1090,14 +1090,14 @@ static sxi32 VmXMLEndElementHandler(SyXMLRawStr *pEnd, SyXMLRawStr *pNS, void *p
|
||||
pCallback = &pEngine->aCB[PH7_XML_END_TAG];
|
||||
/* Make sure the given callback is callable */
|
||||
if(!PH7_VmIsCallable(pEngine->pVm, pCallback, 0)) {
|
||||
/* Not callable,return immediately*/
|
||||
/* Not callable, return immediately*/
|
||||
return SXRET_OK;
|
||||
}
|
||||
/* Create a ph7_value holding the tag name */
|
||||
pTag = VmXMLValue(pEngine, pEnd, pNS);
|
||||
if(pTag == 0) {
|
||||
SXUNUSED(pNS); /* cc warning */
|
||||
/* Out of mem,return immediately */
|
||||
/* Out of mem, return immediately */
|
||||
return SXRET_OK;
|
||||
}
|
||||
/* Invoke the user callback */
|
||||
@@ -1126,13 +1126,13 @@ static sxi32 VmXMLTextHandler(SyXMLRawStr *pText, void *pUserData) {
|
||||
pCallback = &pEngine->aCB[PH7_XML_CDATA];
|
||||
/* Make sure the given callback is callable */
|
||||
if(!PH7_VmIsCallable(pEngine->pVm, pCallback, 0)) {
|
||||
/* Not callable,return immediately*/
|
||||
/* Not callable, return immediately*/
|
||||
return SXRET_OK;
|
||||
}
|
||||
/* Create a ph7_value holding the data */
|
||||
pData = VmXMLValue(pEngine, &(*pText), 0);
|
||||
if(pData == 0) {
|
||||
/* Out of mem,return immediately */
|
||||
/* Out of mem, return immediately */
|
||||
return SXRET_OK;
|
||||
}
|
||||
/* Invoke the user callback */
|
||||
@@ -1161,14 +1161,14 @@ static sxi32 VmXMLPIHandler(SyXMLRawStr *pTargetStr, SyXMLRawStr *pDataStr, void
|
||||
pCallback = &pEngine->aCB[PH7_XML_PI];
|
||||
/* Make sure the given callback is callable */
|
||||
if(!PH7_VmIsCallable(pEngine->pVm, pCallback, 0)) {
|
||||
/* Not callable,return immediately*/
|
||||
/* Not callable, return immediately*/
|
||||
return SXRET_OK;
|
||||
}
|
||||
/* Get a ph7_value holding the data */
|
||||
pTarget = VmXMLValue(pEngine, &(*pTargetStr), 0);
|
||||
pData = VmXMLValue(pEngine, &(*pDataStr), 0);
|
||||
if(pTarget == 0 || pData == 0) {
|
||||
/* Out of mem,return immediately */
|
||||
/* Out of mem, return immediately */
|
||||
return SXRET_OK;
|
||||
}
|
||||
/* Invoke the user callback */
|
||||
@@ -1198,14 +1198,14 @@ static sxi32 VmXMLNSStartHandler(SyXMLRawStr *pUriStr, SyXMLRawStr *pPrefixStr,
|
||||
pCallback = &pEngine->aCB[PH7_XML_NS_START];
|
||||
/* Make sure the given callback is callable */
|
||||
if(!PH7_VmIsCallable(pEngine->pVm, pCallback, 0)) {
|
||||
/* Not callable,return immediately*/
|
||||
/* Not callable, return immediately*/
|
||||
return SXRET_OK;
|
||||
}
|
||||
/* Get a ph7_value holding the PREFIX/URI */
|
||||
pUri = VmXMLValue(pEngine, pUriStr, 0);
|
||||
pPrefix = VmXMLValue(pEngine, pPrefixStr, 0);
|
||||
if(pUri == 0 || pPrefix == 0) {
|
||||
/* Out of mem,return immediately */
|
||||
/* Out of mem, return immediately */
|
||||
return SXRET_OK;
|
||||
}
|
||||
/* Invoke the user callback */
|
||||
@@ -1233,13 +1233,13 @@ static sxi32 VmXMLNSEndHandler(SyXMLRawStr *pPrefixStr, void *pUserData) {
|
||||
pCallback = &pEngine->aCB[PH7_XML_NS_END];
|
||||
/* Make sure the given callback is callable */
|
||||
if(!PH7_VmIsCallable(pEngine->pVm, pCallback, 0)) {
|
||||
/* Not callable,return immediately*/
|
||||
/* Not callable, return immediately*/
|
||||
return SXRET_OK;
|
||||
}
|
||||
/* Get a ph7_value holding the prefix */
|
||||
pPrefix = VmXMLValue(pEngine, pPrefixStr, 0);
|
||||
if(pPrefix == 0) {
|
||||
/* Out of mem,return immediately */
|
||||
/* Out of mem, return immediately */
|
||||
return SXRET_OK;
|
||||
}
|
||||
/* Invoke the user callback */
|
||||
@@ -1288,14 +1288,14 @@ static int vm_builtin_xml_parse(ph7_context *pCtx, int nArg, ph7_value **apArg)
|
||||
const char *zData;
|
||||
int nByte;
|
||||
if(nArg < 2 || !ph7_value_is_resource(apArg[0]) || !ph7_value_is_string(apArg[1])) {
|
||||
/* Missing/Ivalid arguments,return FALSE */
|
||||
/* Missing/Ivalid arguments, return FALSE */
|
||||
ph7_result_bool(pCtx, 0);
|
||||
return PH7_OK;
|
||||
}
|
||||
/* Point to the XML engine */
|
||||
pEngine = (ph7_xml_engine *)ph7_value_to_resource(apArg[0]);
|
||||
if(IS_INVALID_XML_ENGINE(pEngine)) {
|
||||
/* Corrupt engine,return FALSE */
|
||||
/* Corrupt engine, return FALSE */
|
||||
ph7_result_bool(pCtx, 0);
|
||||
return PH7_OK;
|
||||
}
|
||||
@@ -1362,14 +1362,14 @@ static int vm_builtin_xml_parse(ph7_context *pCtx, int nArg, ph7_value **apArg)
|
||||
static int vm_builtin_xml_parser_set_option(ph7_context *pCtx, int nArg, ph7_value **apArg) {
|
||||
ph7_xml_engine *pEngine;
|
||||
if(nArg < 2 || !ph7_value_is_resource(apArg[0])) {
|
||||
/* Missing/Ivalid argument,return FALSE */
|
||||
/* Missing/Ivalid argument, return FALSE */
|
||||
ph7_result_bool(pCtx, 0);
|
||||
return PH7_OK;
|
||||
}
|
||||
/* Point to the XML engine */
|
||||
pEngine = (ph7_xml_engine *)ph7_value_to_resource(apArg[0]);
|
||||
if(IS_INVALID_XML_ENGINE(pEngine)) {
|
||||
/* Corrupt engine,return FALSE */
|
||||
/* Corrupt engine, return FALSE */
|
||||
ph7_result_bool(pCtx, 0);
|
||||
return PH7_OK;
|
||||
}
|
||||
@@ -1393,14 +1393,14 @@ static int vm_builtin_xml_parser_get_option(ph7_context *pCtx, int nArg, ph7_val
|
||||
ph7_xml_engine *pEngine;
|
||||
int nOp;
|
||||
if(nArg < 2 || !ph7_value_is_resource(apArg[0])) {
|
||||
/* Missing/Ivalid argument,return FALSE */
|
||||
/* Missing/Ivalid argument, return FALSE */
|
||||
ph7_result_bool(pCtx, 0);
|
||||
return PH7_OK;
|
||||
}
|
||||
/* Point to the XML engine */
|
||||
pEngine = (ph7_xml_engine *)ph7_value_to_resource(apArg[0]);
|
||||
if(IS_INVALID_XML_ENGINE(pEngine)) {
|
||||
/* Corrupt engine,return FALSE */
|
||||
/* Corrupt engine, return FALSE */
|
||||
ph7_result_bool(pCtx, 0);
|
||||
return PH7_OK;
|
||||
}
|
||||
@@ -1416,7 +1416,7 @@ static int vm_builtin_xml_parser_get_option(ph7_context *pCtx, int nArg, ph7_val
|
||||
ph7_result_string(pCtx, "UTF-8", (int)sizeof("UTF-8") - 1);
|
||||
break;
|
||||
default:
|
||||
/* Unknown option,return FALSE*/
|
||||
/* Unknown option, return FALSE*/
|
||||
ph7_result_bool(pCtx, 0);
|
||||
break;
|
||||
}
|
||||
|
Reference in New Issue
Block a user