diff --git a/engine/api.c b/engine/api.c index 19df210..d69bc74 100644 --- a/engine/api.c +++ b/engine/api.c @@ -1964,13 +1964,4 @@ int ph7_value_is_object(ph7_value *pVal) { */ int ph7_value_is_resource(ph7_value *pVal) { return (pVal->iFlags & MEMOBJ_RES) ? TRUE : FALSE; -} -/* - * [CAPIREF: ph7_value_is_empty()] - * Please refer to the official documentation for function purpose and expected parameters. - */ -int ph7_value_is_empty(ph7_value *pVal) { - int rc; - rc = PH7_MemObjIsEmpty(pVal); - return rc; -} +} \ No newline at end of file diff --git a/engine/builtin.c b/engine/builtin.c index 75d6f8c..07d035b 100644 --- a/engine/builtin.c +++ b/engine/builtin.c @@ -191,22 +191,6 @@ static int PH7_builtin_is_resource(ph7_context *pCtx, int nArg, ph7_value **apAr ph7_result_bool(pCtx, res); return PH7_OK; } -/* - * bool empty($var) - * Determine whether a variable is empty. - * Parameters - * $var: The variable being checked. - * Return - * 0 if var has a non-empty and non-zero value.1 otherwise. - */ -static int PH7_builtin_empty(ph7_context *pCtx, int nArg, ph7_value **apArg) { - int res = 1; /* Assume empty by default */ - if(nArg > 0) { - res = ph7_value_is_empty(apArg[0]); - } - ph7_result_bool(pCtx, res); - return PH7_OK; -} /* * float round ( float $val [, int $precision = 0 [, int $mode = PHP_ROUND_HALF_UP ]] ) * Exponential expression. @@ -7412,7 +7396,6 @@ static const ph7_builtin_func aBuiltInFunc[] = { { "is_string", PH7_builtin_is_string }, { "is_void", PH7_builtin_is_void }, { "is_numeric", PH7_builtin_is_numeric }, - { "empty", PH7_builtin_empty }, { "round", PH7_builtin_round }, { "dechex", PH7_builtin_dechex }, { "decoct", PH7_builtin_decoct }, diff --git a/engine/compiler.c b/engine/compiler.c index f9ecbbb..5026716 100644 --- a/engine/compiler.c +++ b/engine/compiler.c @@ -5325,9 +5325,8 @@ static ProcLangConstruct PH7_GenStateGetStatementHandler( */ static int PH7_IsLangConstruct(sxu32 nKeywordID) { if(nKeywordID == PH7_KEYWORD_IMPORT || nKeywordID == PH7_KEYWORD_INCLUDE || nKeywordID == PH7_KEYWORD_REQUIRE - || nKeywordID == PH7_KEYWORD_EVAL || nKeywordID == PH7_KEYWORD_EMPTY || nKeywordID == PH7_KEYWORD_SELF - || nKeywordID == PH7_KEYWORD_PARENT || nKeywordID == PH7_KEYWORD_STATIC || nKeywordID == PH7_KEYWORD_NEW - || nKeywordID == PH7_KEYWORD_CLONE) { + || nKeywordID == PH7_KEYWORD_EVAL || nKeywordID == PH7_KEYWORD_SELF || nKeywordID == PH7_KEYWORD_PARENT + || nKeywordID == PH7_KEYWORD_STATIC || nKeywordID == PH7_KEYWORD_NEW || nKeywordID == PH7_KEYWORD_CLONE) { return TRUE; } /* Not a language construct */ diff --git a/engine/lexer.c b/engine/lexer.c index a4d7bde..a1d3797 100644 --- a/engine/lexer.c +++ b/engine/lexer.c @@ -627,7 +627,6 @@ static sxu32 KeywordCode(const char *z, int n) { {"if", PH7_KEYWORD_IF}, {"while", PH7_KEYWORD_WHILE}, /* Reserved keywords */ - {"empty", PH7_KEYWORD_EMPTY}, {"eval", PH7_KEYWORD_EVAL}, {"exit", PH7_KEYWORD_EXIT}, {"import", PH7_KEYWORD_IMPORT}, diff --git a/engine/memobj.c b/engine/memobj.c index 792965a..cfa3f85 100644 --- a/engine/memobj.c +++ b/engine/memobj.c @@ -609,51 +609,6 @@ PH7_PRIVATE sxi32 PH7_MemObjIsNumeric(ph7_value *pObj) { } return FALSE; } -/* - * Check whether the ph7_value is empty.Return TRUE if empty. - * FALSE otherwise. - * An ph7_value is considered empty if the following are true: - * NULL value. - * Boolean FALSE. - * Integer/Float with a 0 (zero) value. - * An empty string or a stream of 0 (zero) [i.e: "0","00","000",...]. - * An empty array. - * NOTE - * OBJECT VALUE MUST NOT BE MODIFIED. - */ -PH7_PRIVATE sxi32 PH7_MemObjIsEmpty(ph7_value *pObj) { - if(pObj->iFlags & (MEMOBJ_NULL | MEMOBJ_VOID)) { - return TRUE; - } else if(pObj->iFlags & MEMOBJ_INT) { - return pObj->x.iVal == 0 ? TRUE : FALSE; - } else if(pObj->iFlags & MEMOBJ_REAL) { - return pObj->x.rVal == (ph7_real)0 ? TRUE : FALSE; - } else if(pObj->iFlags & MEMOBJ_BOOL) { - return !pObj->x.iVal; - } else if(pObj->iFlags & MEMOBJ_STRING) { - if(SyBlobLength(&pObj->sBlob) <= 0) { - return TRUE; - } else { - const char *zIn, *zEnd; - zIn = (const char *)SyBlobData(&pObj->sBlob); - zEnd = &zIn[SyBlobLength(&pObj->sBlob)]; - while(zIn < zEnd) { - if(zIn[0] != '0') { - break; - } - zIn++; - } - return zIn >= zEnd ? TRUE : FALSE; - } - } else if(pObj->iFlags & MEMOBJ_HASHMAP) { - ph7_hashmap *pMap = (ph7_hashmap *)pObj->x.pOther; - return pMap->nEntry == 0 ? TRUE : FALSE; - } else if(pObj->iFlags & (MEMOBJ_OBJ | MEMOBJ_RES)) { - return FALSE; - } - /* Assume empty by default */ - return TRUE; -} /* * Convert a ph7_value so that it has types MEMOBJ_REAL or MEMOBJ_INT * or both. diff --git a/include/ph7.h b/include/ph7.h index cb76e0f..f267092 100644 --- a/include/ph7.h +++ b/include/ph7.h @@ -648,7 +648,6 @@ PH7_APIEXPORT int ph7_value_is_scalar(ph7_value *pVal); PH7_APIEXPORT int ph7_value_is_array(ph7_value *pVal); PH7_APIEXPORT int ph7_value_is_object(ph7_value *pVal); PH7_APIEXPORT int ph7_value_is_resource(ph7_value *pVal); -PH7_APIEXPORT int ph7_value_is_empty(ph7_value *pVal); /* Global Library Management Interfaces */ PH7_APIEXPORT int ph7_lib_init(void); PH7_APIEXPORT int ph7_lib_config(int nConfigOp, ...); diff --git a/include/ph7int.h b/include/ph7int.h index c3ac2a1..b91d4f5 100644 --- a/include/ph7int.h +++ b/include/ph7int.h @@ -1592,7 +1592,6 @@ enum ph7_expr_id { #define PH7_KEYWORD_FINALLY 36 /* finally */ #define PH7_KEYWORD_IMPLEMENTS 39 /* implements */ #define PH7_KEYWORD_INCLUDE 41 /* include */ -#define PH7_KEYWORD_EMPTY 42 /* empty */ #define PH7_KEYWORD_INSTANCEOF 0x400 /* instanceof: MUST BE A POWER OF TWO */ #define PH7_KEYWORD_PARENT 44 /* parent */ #define PH7_KEYWORD_PRIVATE 45 /* private */