Browse Source

Update code formatting.

master
Rafal Kupiec 8 months ago
parent
commit
e1e6a19f30
Signed by: belliash <belliash@codingworkshop.eu.org> GPG Key ID: 4E829243E0CFE6B4
11 changed files with 414 additions and 414 deletions
  1. +1
    -1
      engine/api.c
  2. +116
    -116
      engine/builtin.c
  3. +2
    -2
      engine/compiler.c
  4. +104
    -104
      engine/hashmap.c
  5. +1
    -1
      engine/lib/dataset.c
  6. +2
    -2
      engine/oop.c
  7. +72
    -72
      engine/vm.c
  8. +33
    -33
      modules/ctype/ctype.c
  9. +5
    -5
      modules/json/json.c
  10. +20
    -20
      modules/math/math.c
  11. +58
    -58
      modules/xml/xml.c

+ 1
- 1
engine/api.c View File

@@ -879,7 +879,7 @@ const char *ph7_value_to_string(ph7_value *pValue, int *pLen) {
*/
void *ph7_value_to_resource(ph7_value *pValue) {
if((pValue->nType & MEMOBJ_RES) == 0) {
/* Not a resource,return NULL */
/* Not a resource, return NULL */
return 0;
}
return pValue->x.pOther;


+ 116
- 116
engine/builtin.c
File diff suppressed because it is too large
View File


+ 2
- 2
engine/compiler.c View File

@@ -4929,7 +4929,7 @@ static ProcLangConstruct PH7_GenStateGetStatementHandler(
if(nKeywordID == PH7_KEYWORD_STATIC && pLookahead && (pLookahead->nType & PH7_TK_OP)) {
const ph7_expr_op *pOp = (const ph7_expr_op *)pLookahead->pUserData;
if(pOp && pOp->iOp == EXPR_OP_DC /*::*/) {
/* 'static' (class context),return null */
/* 'static' (class context), return null */
return 0;
}
}
@@ -5247,7 +5247,7 @@ PH7_PRIVATE sxi32 PH7_GenCompileError(ph7_gen_state *pGen, sxi32 nErrType, sxu32
/* Peek the processed file path if available */
pFile = (SyString *)SySetPeek(&pGen->pVm->aFiles);
if(pGen->xErr == 0) {
/* No available error consumer,return immediately */
/* No available error consumer, return immediately */
return SXRET_OK;
}
switch(nErrType) {


+ 104
- 104
engine/hashmap.c View File

@@ -227,7 +227,7 @@ static sxi32 HashmapGrowBucket(ph7_hashmap *pMap) {
pMap->apBucket = apNew;
pMap->nSize = nNew;
if(apOld == 0) {
/* First allocated table [i.e: no entry],return immediately */
/* First allocated table [i.e: no entry], return immediately */
return SXRET_OK;
}
/* Rehash old entries */
@@ -1315,7 +1315,7 @@ PH7_PRIVATE void PH7_HashmapResetLoopCursor(ph7_hashmap *pMap) {
PH7_PRIVATE ph7_hashmap_node *PH7_HashmapGetNextEntry(ph7_hashmap *pMap) {
ph7_hashmap_node *pCur = pMap->pCur;
if(pCur == 0) {
/* End of the list,return null */
/* End of the list, return null */
return 0;
}
/* Advance the node cursor */
@@ -1782,7 +1782,7 @@ static int ph7_hashmap_sort(ph7_context *pCtx, int nArg, ph7_value **apArg) {
ph7_hashmap *pMap;
/* Make sure we are dealing with a valid hashmap */
if(nArg < 1 || !ph7_value_is_array(apArg[0])) {
/* Missing/Invalid arguments,return FALSE */
/* Missing/Invalid arguments, return FALSE */
ph7_result_bool(pCtx, 0);
return PH7_OK;
}
@@ -1802,7 +1802,7 @@ static int ph7_hashmap_sort(ph7_context *pCtx, int nArg, ph7_value **apArg) {
/* Rehash [Do not maintain index association as requested by the PHP specification] */
HashmapSortRehash(pMap);
}
/* All done,return TRUE */
/* All done, return TRUE */
ph7_result_bool(pCtx, 1);
return PH7_OK;
}
@@ -1825,7 +1825,7 @@ static int ph7_hashmap_asort(ph7_context *pCtx, int nArg, ph7_value **apArg) {
ph7_hashmap *pMap;
/* Make sure we are dealing with a valid hashmap */
if(nArg < 1 || !ph7_value_is_array(apArg[0])) {
/* Missing/Invalid arguments,return FALSE */
/* Missing/Invalid arguments, return FALSE */
ph7_result_bool(pCtx, 0);
return PH7_OK;
}
@@ -1847,7 +1847,7 @@ static int ph7_hashmap_asort(ph7_context *pCtx, int nArg, ph7_value **apArg) {
pMap->pLast = pMap->pLast->pPrev;
}
}
/* All done,return TRUE */
/* All done, return TRUE */
ph7_result_bool(pCtx, 1);
return PH7_OK;
}
@@ -1870,7 +1870,7 @@ static int ph7_hashmap_arsort(ph7_context *pCtx, int nArg, ph7_value **apArg) {
ph7_hashmap *pMap;
/* Make sure we are dealing with a valid hashmap */
if(nArg < 1 || !ph7_value_is_array(apArg[0])) {
/* Missing/Invalid arguments,return FALSE */
/* Missing/Invalid arguments, return FALSE */
ph7_result_bool(pCtx, 0);
return PH7_OK;
}
@@ -1892,7 +1892,7 @@ static int ph7_hashmap_arsort(ph7_context *pCtx, int nArg, ph7_value **apArg) {
pMap->pLast = pMap->pLast->pPrev;
}
}
/* All done,return TRUE */
/* All done, return TRUE */
ph7_result_bool(pCtx, 1);
return PH7_OK;
}
@@ -1915,7 +1915,7 @@ static int ph7_hashmap_ksort(ph7_context *pCtx, int nArg, ph7_value **apArg) {
ph7_hashmap *pMap;
/* Make sure we are dealing with a valid hashmap */
if(nArg < 1 || !ph7_value_is_array(apArg[0])) {
/* Missing/Invalid arguments,return FALSE */
/* Missing/Invalid arguments, return FALSE */
ph7_result_bool(pCtx, 0);
return PH7_OK;
}
@@ -1937,7 +1937,7 @@ static int ph7_hashmap_ksort(ph7_context *pCtx, int nArg, ph7_value **apArg) {
pMap->pLast = pMap->pLast->pPrev;
}
}
/* All done,return TRUE */
/* All done, return TRUE */
ph7_result_bool(pCtx, 1);
return PH7_OK;
}
@@ -1960,7 +1960,7 @@ static int ph7_hashmap_krsort(ph7_context *pCtx, int nArg, ph7_value **apArg) {
ph7_hashmap *pMap;
/* Make sure we are dealing with a valid hashmap */
if(nArg < 1 || !ph7_value_is_array(apArg[0])) {
/* Missing/Invalid arguments,return FALSE */
/* Missing/Invalid arguments, return FALSE */
ph7_result_bool(pCtx, 0);
return PH7_OK;
}
@@ -1982,7 +1982,7 @@ static int ph7_hashmap_krsort(ph7_context *pCtx, int nArg, ph7_value **apArg) {
pMap->pLast = pMap->pLast->pPrev;
}
}
/* All done,return TRUE */
/* All done, return TRUE */
ph7_result_bool(pCtx, 1);
return PH7_OK;
}
@@ -2005,7 +2005,7 @@ static int ph7_hashmap_rsort(ph7_context *pCtx, int nArg, ph7_value **apArg) {
ph7_hashmap *pMap;
/* Make sure we are dealing with a valid hashmap */
if(nArg < 1 || !ph7_value_is_array(apArg[0])) {
/* Missing/Invalid arguments,return FALSE */
/* Missing/Invalid arguments, return FALSE */
ph7_result_bool(pCtx, 0);
return PH7_OK;
}
@@ -2025,7 +2025,7 @@ static int ph7_hashmap_rsort(ph7_context *pCtx, int nArg, ph7_value **apArg) {
/* Rehash [Do not maintain index association as requested by the PHP specification] */
HashmapSortRehash(pMap);
}
/* All done,return TRUE */
/* All done, return TRUE */
ph7_result_bool(pCtx, 1);
return PH7_OK;
}
@@ -2047,7 +2047,7 @@ static int ph7_hashmap_usort(ph7_context *pCtx, int nArg, ph7_value **apArg) {
ph7_hashmap *pMap;
/* Make sure we are dealing with a valid hashmap */
if(nArg < 1 || !ph7_value_is_array(apArg[0])) {
/* Missing/Invalid arguments,return FALSE */
/* Missing/Invalid arguments, return FALSE */
ph7_result_bool(pCtx, 0);
return PH7_OK;
}
@@ -2069,7 +2069,7 @@ static int ph7_hashmap_usort(ph7_context *pCtx, int nArg, ph7_value **apArg) {
/* Rehash [Do not maintain index association as requested by the PHP specification] */
HashmapSortRehash(pMap);
}
/* All done,return TRUE */
/* All done, return TRUE */
ph7_result_bool(pCtx, 1);
return PH7_OK;
}
@@ -2092,7 +2092,7 @@ static int ph7_hashmap_uasort(ph7_context *pCtx, int nArg, ph7_value **apArg) {
ph7_hashmap *pMap;
/* Make sure we are dealing with a valid hashmap */
if(nArg < 1 || !ph7_value_is_array(apArg[0])) {
/* Missing/Invalid arguments,return FALSE */
/* Missing/Invalid arguments, return FALSE */
ph7_result_bool(pCtx, 0);
return PH7_OK;
}
@@ -2116,7 +2116,7 @@ static int ph7_hashmap_uasort(ph7_context *pCtx, int nArg, ph7_value **apArg) {
pMap->pLast = pMap->pLast->pPrev;
}
}
/* All done,return TRUE */
/* All done, return TRUE */
ph7_result_bool(pCtx, 1);
return PH7_OK;
}
@@ -2139,7 +2139,7 @@ static int ph7_hashmap_uksort(ph7_context *pCtx, int nArg, ph7_value **apArg) {
ph7_hashmap *pMap;
/* Make sure we are dealing with a valid hashmap */
if(nArg < 1 || !ph7_value_is_array(apArg[0])) {
/* Missing/Invalid arguments,return FALSE */
/* Missing/Invalid arguments, return FALSE */
ph7_result_bool(pCtx, 0);
return PH7_OK;
}
@@ -2163,7 +2163,7 @@ static int ph7_hashmap_uksort(ph7_context *pCtx, int nArg, ph7_value **apArg) {
pMap->pLast = pMap->pLast->pPrev;
}
}
/* All done,return TRUE */
/* All done, return TRUE */
ph7_result_bool(pCtx, 1);
return PH7_OK;
}
@@ -2181,7 +2181,7 @@ static int ph7_hashmap_shuffle(ph7_context *pCtx, int nArg, ph7_value **apArg) {
ph7_hashmap *pMap;
/* Make sure we are dealing with a valid hashmap */
if(nArg < 1 || !ph7_value_is_array(apArg[0])) {
/* Missing/Invalid arguments,return FALSE */
/* Missing/Invalid arguments, return FALSE */
ph7_result_bool(pCtx, 0);
return PH7_OK;
}
@@ -2195,7 +2195,7 @@ static int ph7_hashmap_shuffle(ph7_context *pCtx, int nArg, ph7_value **apArg) {
pMap->pLast = pMap->pLast->pPrev;
}
}
/* All done,return TRUE */
/* All done, return TRUE */
ph7_result_bool(pCtx, 1);
return PH7_OK;
}
@@ -2217,7 +2217,7 @@ static int ph7_hashmap_count(ph7_context *pCtx, int nArg, ph7_value **apArg) {
int bRecursive = FALSE;
sxi64 iCount;
if(nArg < 1) {
/* Missing arguments,return 0 */
/* Missing arguments, return 0 */
ph7_result_int(pCtx, 0);
return PH7_OK;
}
@@ -2248,13 +2248,13 @@ static int ph7_hashmap_count(ph7_context *pCtx, int nArg, ph7_value **apArg) {
static int ph7_hashmap_key_exists(ph7_context *pCtx, int nArg, ph7_value **apArg) {
sxi32 rc;
if(nArg < 2) {
/* Missing arguments,return FALSE */
/* Missing arguments, return FALSE */
ph7_result_bool(pCtx, 0);
return PH7_OK;
}
/* Make sure we are dealing with a valid hashmap */
if(!ph7_value_is_array(apArg[1])) {
/* Invalid argument,return FALSE */
/* Invalid argument, return FALSE */
ph7_result_bool(pCtx, 0);
return PH7_OK;
}
@@ -2275,19 +2275,19 @@ static int ph7_hashmap_key_exists(ph7_context *pCtx, int nArg, ph7_value **apArg
static int ph7_hashmap_pop(ph7_context *pCtx, int nArg, ph7_value **apArg) {
ph7_hashmap *pMap;
if(nArg < 1) {
/* Missing arguments,return null */
/* Missing arguments, return null */
ph7_result_null(pCtx);
return PH7_OK;
}
/* Make sure we are dealing with a valid hashmap */
if(!ph7_value_is_array(apArg[0])) {
/* Invalid argument,return null */
/* Invalid argument, return null */
ph7_result_null(pCtx);
return PH7_OK;
}
pMap = (ph7_hashmap *)apArg[0]->x.pOther;
if(pMap->nEntry < 1) {
/* Noting to pop,return NULL */
/* Noting to pop, return NULL */
ph7_result_null(pCtx);
} else {
ph7_hashmap_node *pLast = pMap->pLast;
@@ -2322,13 +2322,13 @@ static int ph7_hashmap_push(ph7_context *pCtx, int nArg, ph7_value **apArg) {
sxi32 rc;
int i;
if(nArg < 1) {
/* Missing arguments,return 0 */
/* Missing arguments, return 0 */
ph7_result_int(pCtx, 0);
return PH7_OK;
}
/* Make sure we are dealing with a valid hashmap */
if(!ph7_value_is_array(apArg[0])) {
/* Invalid argument,return 0 */
/* Invalid argument, return 0 */
ph7_result_int(pCtx, 0);
return PH7_OK;
}
@@ -2356,20 +2356,20 @@ static int ph7_hashmap_push(ph7_context *pCtx, int nArg, ph7_value **apArg) {
static int ph7_hashmap_shift(ph7_context *pCtx, int nArg, ph7_value **apArg) {
ph7_hashmap *pMap;
if(nArg < 1) {
/* Missing arguments,return null */
/* Missing arguments, return null */
ph7_result_null(pCtx);
return PH7_OK;
}
/* Make sure we are dealing with a valid hashmap */
if(!ph7_value_is_array(apArg[0])) {
/* Invalid argument,return null */
/* Invalid argument, return null */
ph7_result_null(pCtx);
return PH7_OK;
}
/* Point to the internal representation of the hashmap */
pMap = (ph7_hashmap *)apArg[0]->x.pOther;
if(pMap->nEntry < 1) {
/* Empty hashmap,return NULL */
/* Empty hashmap, return NULL */
ph7_result_null(pCtx);
} else {
ph7_hashmap_node *pEntry = pMap->pFirst;
@@ -2411,7 +2411,7 @@ static sxi32 HashmapCurrentValue(ph7_context *pCtx, ph7_hashmap *pMap, int iDire
ph7_hashmap_node *pCur = pMap->pCur;
ph7_value *pVal;
if(pCur == 0) {
/* Cursor does not point to anything,return FALSE */
/* Cursor does not point to anything, return FALSE */
ph7_result_bool(pCtx, 0);
return PH7_OK;
}
@@ -2426,7 +2426,7 @@ static sxi32 HashmapCurrentValue(ph7_context *pCtx, ph7_hashmap *pMap, int iDire
pCur = pMap->pCur;
}
if(pCur == 0) {
/* End of input reached,return FALSE */
/* End of input reached, return FALSE */
ph7_result_bool(pCtx, 0);
return PH7_OK;
}
@@ -2453,13 +2453,13 @@ static sxi32 HashmapCurrentValue(ph7_context *pCtx, ph7_hashmap *pMap, int iDire
*/
static int ph7_hashmap_current(ph7_context *pCtx, int nArg, ph7_value **apArg) {
if(nArg < 1) {
/* Missing arguments,return FALSE */
/* Missing arguments, return FALSE */
ph7_result_bool(pCtx, 0);
return PH7_OK;
}
/* Make sure we are dealing with a valid hashmap */
if(!ph7_value_is_array(apArg[0])) {
/* Invalid argument,return FALSE */
/* Invalid argument, return FALSE */
ph7_result_bool(pCtx, 0);
return PH7_OK;
}
@@ -2478,13 +2478,13 @@ static int ph7_hashmap_current(ph7_context *pCtx, int nArg, ph7_value **apArg) {
*/
static int ph7_hashmap_next(ph7_context *pCtx, int nArg, ph7_value **apArg) {
if(nArg < 1) {
/* Missing arguments,return FALSE */
/* Missing arguments, return FALSE */
ph7_result_bool(pCtx, 0);
return PH7_OK;
}
/* Make sure we are dealing with a valid hashmap */
if(!ph7_value_is_array(apArg[0])) {
/* Invalid argument,return FALSE */
/* Invalid argument, return FALSE */
ph7_result_bool(pCtx, 0);
return PH7_OK;
}
@@ -2503,13 +2503,13 @@ static int ph7_hashmap_next(ph7_context *pCtx, int nArg, ph7_value **apArg) {
*/
static int ph7_hashmap_prev(ph7_context *pCtx, int nArg, ph7_value **apArg) {
if(nArg < 1) {
/* Missing arguments,return FALSE */
/* Missing arguments, return FALSE */
ph7_result_bool(pCtx, 0);
return PH7_OK;
}
/* Make sure we are dealing with a valid hashmap */
if(!ph7_value_is_array(apArg[0])) {
/* Invalid argument,return FALSE */
/* Invalid argument, return FALSE */
ph7_result_bool(pCtx, 0);
return PH7_OK;
}
@@ -2527,13 +2527,13 @@ static int ph7_hashmap_prev(ph7_context *pCtx, int nArg, ph7_value **apArg) {
static int ph7_hashmap_end(ph7_context *pCtx, int nArg, ph7_value **apArg) {
ph7_hashmap *pMap;
if(nArg < 1) {
/* Missing arguments,return FALSE */
/* Missing arguments, return FALSE */
ph7_result_bool(pCtx, 0);
return PH7_OK;
}
/* Make sure we are dealing with a valid hashmap */
if(!ph7_value_is_array(apArg[0])) {
/* Invalid argument,return FALSE */
/* Invalid argument, return FALSE */
ph7_result_bool(pCtx, 0);
return PH7_OK;
}
@@ -2556,13 +2556,13 @@ static int ph7_hashmap_end(ph7_context *pCtx, int nArg, ph7_value **apArg) {
static int ph7_hashmap_reset(ph7_context *pCtx, int nArg, ph7_value **apArg) {
ph7_hashmap *pMap;
if(nArg < 1) {
/* Missing arguments,return FALSE */
/* Missing arguments, return FALSE */
ph7_result_bool(pCtx, 0);
return PH7_OK;
}
/* Make sure we are dealing with a valid hashmap */
if(!ph7_value_is_array(apArg[0])) {
/* Invalid argument,return FALSE */
/* Invalid argument, return FALSE */
ph7_result_bool(pCtx, 0);
return PH7_OK;
}
@@ -2590,20 +2590,20 @@ static int ph7_hashmap_simple_key(ph7_context *pCtx, int nArg, ph7_value **apArg
ph7_hashmap_node *pCur;
ph7_hashmap *pMap;
if(nArg < 1) {
/* Missing arguments,return NULL */
/* Missing arguments, return NULL */
ph7_result_null(pCtx);
return PH7_OK;
}
/* Make sure we are dealing with a valid hashmap */
if(!ph7_value_is_array(apArg[0])) {
/* Invalid argument,return NULL */
/* Invalid argument, return NULL */
ph7_result_null(pCtx);
return PH7_OK;
}
pMap = (ph7_hashmap *)apArg[0]->x.pOther;
pCur = pMap->pCur;
if(pCur == 0) {
/* Cursor does not point to anything,return NULL */
/* Cursor does not point to anything, return NULL */
ph7_result_null(pCtx);
return PH7_OK;
}
@@ -2637,20 +2637,20 @@ static int ph7_hashmap_each(ph7_context *pCtx, int nArg, ph7_value **apArg) {
ph7_value *pVal;
ph7_value sKey;
if(nArg < 1) {
/* Missing arguments,return FALSE */
/* Missing arguments, return FALSE */
ph7_result_bool(pCtx, 0);
return PH7_OK;
}
/* Make sure we are dealing with a valid hashmap */
if(!ph7_value_is_array(apArg[0])) {
/* Invalid argument,return FALSE */
/* Invalid argument, return FALSE */
ph7_result_bool(pCtx, 0);
return PH7_OK;
}
/* Point to the internal representation that describe the input hashmap */
pMap = (ph7_hashmap *)apArg[0]->x.pOther;
if(pMap->pCur == 0) {
/* Cursor does not point to anything,return FALSE */
/* Cursor does not point to anything, return FALSE */
ph7_result_bool(pCtx, 0);
return PH7_OK;
}
@@ -2757,13 +2757,13 @@ static int ph7_hashmap_values(ph7_context *pCtx, int nArg, ph7_value **apArg) {
ph7_value *pObj;
sxu32 n;
if(nArg < 1) {
/* Missing arguments,return NULL */
/* Missing arguments, return NULL */
ph7_result_null(pCtx);
return PH7_OK;
}
/* Make sure we are dealing with a valid hashmap */
if(!ph7_value_is_array(apArg[0])) {
/* Invalid argument,return NULL */
/* Invalid argument, return NULL */
ph7_result_null(pCtx);
return PH7_OK;
}
@@ -2814,13 +2814,13 @@ static int ph7_hashmap_keys(ph7_context *pCtx, int nArg, ph7_value **apArg) {
sxi32 rc;
sxu32 n;
if(nArg < 1) {
/* Missing arguments,return NULL */
/* Missing arguments, return NULL */
ph7_result_null(pCtx);
return PH7_OK;
}
/* Make sure we are dealing with a valid hashmap */
if(!ph7_value_is_array(apArg[0])) {
/* Invalid argument,return NULL */
/* Invalid argument, return NULL */
ph7_result_null(pCtx);
return PH7_OK;
}
@@ -2884,7 +2884,7 @@ static int ph7_hashmap_merge(ph7_context *pCtx, int nArg, ph7_value **apArg) {
ph7_value *pArray;
int i;
if(nArg < 1) {
/* Missing arguments,return NULL */
/* Missing arguments, return NULL */
ph7_result_null(pCtx);
return PH7_OK;
}
@@ -2964,7 +2964,7 @@ static int ph7_hashmap_slice(ph7_context *pCtx, int nArg, ph7_value **apArg) {
int bPreserve;
sxi32 rc;
if(nArg < 2 || !ph7_value_is_array(apArg[0])) {
/* Missing/Invalid arguments,return NULL */
/* Missing/Invalid arguments, return NULL */
ph7_result_null(pCtx);
return PH7_OK;
}
@@ -2977,7 +2977,7 @@ static int ph7_hashmap_slice(ph7_context *pCtx, int nArg, ph7_value **apArg) {
iOfft = (int)pSrc->nEntry + iOfft;
}
if(iOfft < 0 || iOfft > (int)pSrc->nEntry) {
/* Invalid offset,return the last entry */
/* Invalid offset, return the last entry */
iOfft = (int)pSrc->nEntry - 1;
}
/* Get the length */
@@ -3001,7 +3001,7 @@ static int ph7_hashmap_slice(ph7_context *pCtx, int nArg, ph7_value **apArg) {
return PH7_OK;
}
if(iLength < 1) {
/* Don't bother processing,return the empty array */
/* Don't bother processing, return the empty array */
ph7_result_value(pCtx, pArray);
return PH7_OK;
}
@@ -3066,7 +3066,7 @@ static int ph7_hashmap_splice(ph7_context *pCtx, int nArg, ph7_value **apArg) {
int iLength, iOfft;
sxi32 rc;
if(nArg < 2 || !ph7_value_is_array(apArg[0])) {
/* Missing/Invalid arguments,return NULL */
/* Missing/Invalid arguments, return NULL */
ph7_result_null(pCtx);
return PH7_OK;
}
@@ -3099,7 +3099,7 @@ static int ph7_hashmap_splice(ph7_context *pCtx, int nArg, ph7_value **apArg) {
return PH7_OK;
}
if(iLength < 1) {
/* Don't bother processing,return the empty array */
/* Don't bother processing, return the empty array */
ph7_result_value(pCtx, pArray);
return PH7_OK;
}
@@ -3184,7 +3184,7 @@ static int ph7_hashmap_in_array(ph7_context *pCtx, int nArg, ph7_value **apArg)
int bStrict;
int rc;
if(nArg < 2) {
/* Missing argument,return FALSE */
/* Missing argument, return FALSE */
ph7_result_bool(pCtx, 0);
return PH7_OK;
}
@@ -3230,13 +3230,13 @@ static int ph7_hashmap_search(ph7_context *pCtx, int nArg, ph7_value **apArg) {
sxu32 n;
int rc;
if(nArg < 2) {
/* Missing argument,return FALSE*/
/* Missing argument, return FALSE*/
ph7_result_bool(pCtx, 0);
return PH7_OK;
}
bStrict = FALSE;
if(!ph7_value_is_array(apArg[1])) {
/* hasystack must be an array,return FALSE */
/* hasystack must be an array, return FALSE */
ph7_result_bool(pCtx, 0);
return PH7_OK;
}
@@ -3266,7 +3266,7 @@ static int ph7_hashmap_search(ph7_context *pCtx, int nArg, ph7_value **apArg) {
PH7_MemObjRelease(&sVal);
PH7_MemObjRelease(&sNeedle);
if(rc == 0) {
/* Match found,return key */
/* Match found, return key */
if(pEntry->iType == HASHMAP_INT_NODE) {
/* INT key */
ph7_result_int64(pCtx, pEntry->xKey.iKey);
@@ -3282,7 +3282,7 @@ static int ph7_hashmap_search(ph7_context *pCtx, int nArg, ph7_value **apArg) {
pEntry = pEntry->pPrev; /* Reverse link */
n--;
}
/* No such value,return FALSE */
/* No such value, return FALSE */
ph7_result_bool(pCtx, 0);
return PH7_OK;
}
@@ -3309,7 +3309,7 @@ static int ph7_hashmap_diff(ph7_context *pCtx, int nArg, ph7_value **apArg) {
sxu32 n;
int i;
if(nArg < 1 || !ph7_value_is_array(apArg[0])) {
/* Missing arguments,return NULL */
/* Missing arguments, return NULL */
ph7_result_null(pCtx);
return PH7_OK;
}
@@ -3393,7 +3393,7 @@ static int ph7_hashmap_udiff(ph7_context *pCtx, int nArg, ph7_value **apArg) {
sxu32 n;
int i;
if(nArg < 2 || !ph7_value_is_array(apArg[0])) {
/* Missing/Invalid arguments,return NULL */
/* Missing/Invalid arguments, return NULL */
ph7_result_null(pCtx);
return PH7_OK;
}
@@ -3472,7 +3472,7 @@ static int ph7_hashmap_diff_assoc(ph7_context *pCtx, int nArg, ph7_value **apArg
sxu32 n;
int i;
if(nArg < 1 || !ph7_value_is_array(apArg[0])) {
/* Missing arguments,return NULL */
/* Missing arguments, return NULL */
ph7_result_null(pCtx);
return PH7_OK;
}
@@ -3566,7 +3566,7 @@ static int ph7_hashmap_diff_uassoc(ph7_context *pCtx, int nArg, ph7_value **apAr
sxu32 n;
int i;
if(nArg < 2 || !ph7_value_is_array(apArg[0])) {
/* Missing/Invalid arguments,return NULL */
/* Missing/Invalid arguments, return NULL */
ph7_result_null(pCtx);
return PH7_OK;
}
@@ -3656,7 +3656,7 @@ static int ph7_hashmap_diff_key(ph7_context *pCtx, int nArg, ph7_value **apArg)
sxu32 n;
int i;
if(nArg < 1 || !ph7_value_is_array(apArg[0])) {
/* Missing arguments,return NULL */
/* Missing arguments, return NULL */
ph7_result_null(pCtx);
return PH7_OK;
}
@@ -3735,7 +3735,7 @@ static int ph7_hashmap_intersect(ph7_context *pCtx, int nArg, ph7_value **apArg)
sxu32 n;
int i;
if(nArg < 1 || !ph7_value_is_array(apArg[0])) {
/* Missing arguments,return NULL */
/* Missing arguments, return NULL */
ph7_result_null(pCtx);
return PH7_OK;
}
@@ -3813,7 +3813,7 @@ static int ph7_hashmap_intersect_assoc(ph7_context *pCtx, int nArg, ph7_value **
sxu32 n;
int i;
if(nArg < 1 || !ph7_value_is_array(apArg[0])) {
/* Missing arguments,return NULL */
/* Missing arguments, return NULL */
ph7_result_null(pCtx);
return PH7_OK;
}
@@ -3901,7 +3901,7 @@ static int ph7_hashmap_intersect_key(ph7_context *pCtx, int nArg, ph7_value **ap
sxu32 n;
int i;
if(nArg < 1 || !ph7_value_is_array(apArg[0])) {
/* Missing arguments,return NULL */
/* Missing arguments, return NULL */
ph7_result_null(pCtx);
return PH7_OK;
}
@@ -3987,7 +3987,7 @@ static int ph7_hashmap_uintersect(ph7_context *pCtx, int nArg, ph7_value **apArg
sxu32 n;
int i;
if(nArg < 2 || !ph7_value_is_array(apArg[0])) {
/* Missing/Invalid arguments,return NULL */
/* Missing/Invalid arguments, return NULL */
ph7_result_null(pCtx);
return PH7_OK;
}
@@ -4060,7 +4060,7 @@ static int ph7_hashmap_fill(ph7_context *pCtx, int nArg, ph7_value **apArg) {
ph7_value *pArray;
int i, nEntry;
if(nArg < 3) {
/* Missing arguments,return NULL */
/* Missing arguments, return NULL */
ph7_result_null(pCtx);
return PH7_OK;
}
@@ -4099,13 +4099,13 @@ static int ph7_hashmap_fill_keys(ph7_context *pCtx, int nArg, ph7_value **apArg)
ph7_value *pArray;
sxu32 n;
if(nArg < 2) {
/* Missing arguments,return NULL */
/* Missing arguments, return NULL */
ph7_result_null(pCtx);
return PH7_OK;
}
/* Make sure we are dealing with a valid hashmap */
if(!ph7_value_is_array(apArg[0])) {
/* Invalid argument,return NULL */
/* Invalid argument, return NULL */
ph7_result_null(pCtx);
return PH7_OK;
}
@@ -4147,13 +4147,13 @@ static int ph7_hashmap_combine(ph7_context *pCtx, int nArg, ph7_value **apArg) {
ph7_value *pArray;
sxu32 n;
if(nArg < 2) {
/* Missing arguments,return FALSE */
/* Missing arguments, return FALSE */
ph7_result_bool(pCtx, 0);
return PH7_OK;
}
/* Make sure we are dealing with a valid hashmap */
if(!ph7_value_is_array(apArg[0]) || !ph7_value_is_array(apArg[1])) {
/* Invalid argument,return FALSE */
/* Invalid argument, return FALSE */
ph7_result_bool(pCtx, 0);
return PH7_OK;
}
@@ -4161,7 +4161,7 @@ static int ph7_hashmap_combine(ph7_context *pCtx, int nArg, ph7_value **apArg) {
pKey = (ph7_hashmap *)apArg[0]->x.pOther;
pValue = (ph7_hashmap *)apArg[1]->x.pOther;
if(pKey->nEntry != pValue->nEntry) {
/* Array length differs,return FALSE */
/* Array length differs, return FALSE */
ph7_result_bool(pCtx, 0);
return PH7_OK;
}
@@ -4202,13 +4202,13 @@ static int ph7_hashmap_reverse(ph7_context *pCtx, int nArg, ph7_value **apArg) {
int bPreserve;
sxu32 n;
if(nArg < 1) {
/* Missing arguments,return NULL */
/* Missing arguments, return NULL */
ph7_result_null(pCtx);
return PH7_OK;
}
/* Make sure we are dealing with a valid hashmap */
if(!ph7_value_is_array(apArg[0])) {
/* Invalid argument,return NULL */
/* Invalid argument, return NULL */
ph7_result_null(pCtx);
return PH7_OK;
}
@@ -4259,13 +4259,13 @@ static int ph7_hashmap_unique(ph7_context *pCtx, int nArg, ph7_value **apArg) {
sxi32 rc;
sxu32 n;
if(nArg < 1) {
/* Missing arguments,return NULL */
/* Missing arguments, return NULL */
ph7_result_null(pCtx);
return PH7_OK;
}
/* Make sure we are dealing with a valid hashmap */
if(!ph7_value_is_array(apArg[0])) {
/* Invalid argument,return NULL */
/* Invalid argument, return NULL */
ph7_result_null(pCtx);
return PH7_OK;
}
@@ -4317,13 +4317,13 @@ static int ph7_hashmap_flip(ph7_context *pCtx, int nArg, ph7_value **apArg) {
ph7_value sVal;
sxu32 n;
if(nArg < 1) {
/* Missing arguments,return NULL */
/* Missing arguments, return NULL */
ph7_result_null(pCtx);
return PH7_OK;
}
/* Make sure we are dealing with a valid hashmap */
if(!ph7_value_is_array(apArg[0])) {
/* Invalid argument,return NULL */
/* Invalid argument, return NULL */
ph7_result_null(pCtx);
return PH7_OK;
}
@@ -4432,19 +4432,19 @@ static int ph7_hashmap_sum(ph7_context *pCtx, int nArg, ph7_value **apArg) {
ph7_hashmap *pMap;
ph7_value *pObj;
if(nArg < 1) {
/* Missing arguments,return 0 */
/* Missing arguments, return 0 */
ph7_result_int(pCtx, 0);
return PH7_OK;
}
/* Make sure we are dealing with a valid hashmap */
if(!ph7_value_is_array(apArg[0])) {
/* Invalid argument,return 0 */
/* Invalid argument, return 0 */
ph7_result_int(pCtx, 0);
return PH7_OK;
}
pMap = (ph7_hashmap *)apArg[0]->x.pOther;
if(pMap->nEntry < 1) {
/* Nothing to compute,return 0 */
/* Nothing to compute, return 0 */
ph7_result_int(pCtx, 0);
return PH7_OK;
}
@@ -4534,19 +4534,19 @@ static int ph7_hashmap_product(ph7_context *pCtx, int nArg, ph7_value **apArg) {
ph7_hashmap *pMap;
ph7_value *pObj;
if(nArg < 1) {
/* Missing arguments,return 0 */
/* Missing arguments, return 0 */
ph7_result_int(pCtx, 0);
return PH7_OK;
}
/* Make sure we are dealing with a valid hashmap */
if(!ph7_value_is_array(apArg[0])) {
/* Invalid argument,return 0 */
/* Invalid argument, return 0 */
ph7_result_int(pCtx, 0);
return PH7_OK;
}
pMap = (ph7_hashmap *)apArg[0]->x.pOther;
if(pMap->nEntry < 1) {
/* Nothing to compute,return 0 */
/* Nothing to compute, return 0 */
ph7_result_int(pCtx, 0);
return PH7_OK;
}
@@ -4583,7 +4583,7 @@ static int ph7_hashmap_rand(ph7_context *pCtx, int nArg, ph7_value **apArg) {
ph7_hashmap *pMap;
int nItem = 1;
if(nArg < 1) {
/* Missing argument,return NULL */
/* Missing argument, return NULL */
ph7_result_null(pCtx);
return PH7_OK;
}
@@ -4595,7 +4595,7 @@ static int ph7_hashmap_rand(ph7_context *pCtx, int nArg, ph7_value **apArg) {
/* Point to the internal representation of the input hashmap */
pMap = (ph7_hashmap *)apArg[0]->x.pOther;
if(pMap->nEntry < 1) {
/* Empty hashmap,return NULL */
/* Empty hashmap, return NULL */
ph7_result_null(pCtx);
return PH7_OK;
}
@@ -4698,7 +4698,7 @@ static int ph7_hashmap_chunk(ph7_context *pCtx, int nArg, ph7_value **apArg) {
sxu32 nSize;
sxu32 n;
if(nArg < 2 || !ph7_value_is_array(apArg[0])) {
/* Invalid arguments,return NULL */
/* Invalid arguments, return NULL */
ph7_result_null(pCtx);
return PH7_OK;
}
@@ -4779,7 +4779,7 @@ static int ph7_hashmap_pad(ph7_context *pCtx, int nArg, ph7_value **apArg) {
ph7_value *pArray;
int nEntry;
if(nArg < 3 || !ph7_value_is_array(apArg[0])) {
/* Invalid arguments,return NULL */
/* Invalid arguments, return NULL */
ph7_result_null(pCtx);
return PH7_OK;
}
@@ -4850,7 +4850,7 @@ static int ph7_hashmap_replace(ph7_context *pCtx, int nArg, ph7_value **apArg) {
ph7_value *pArray;
int i;
if(nArg < 1) {
/* Invalid arguments,return NULL */
/* Invalid arguments, return NULL */
ph7_result_null(pCtx);
return PH7_OK;
}
@@ -4896,7 +4896,7 @@ static int ph7_hashmap_filter(ph7_context *pCtx, int nArg, ph7_value **apArg) {
int keep;
sxu32 n;
if(nArg < 1 || !ph7_value_is_array(apArg[0])) {
/* Invalid arguments,return NULL */
/* Invalid arguments, return NULL */
ph7_result_null(pCtx);
return PH7_OK;
}
@@ -4958,7 +4958,7 @@ static int ph7_hashmap_map(ph7_context *pCtx, int nArg, ph7_value **apArg) {
ph7_hashmap *pMap;
sxu32 n;
if(nArg < 2 || !ph7_value_is_array(apArg[1])) {
/* Invalid arguments,return NULL */
/* Invalid arguments, return NULL */
ph7_result_null(pCtx);
return PH7_OK;
}
@@ -5023,7 +5023,7 @@ static int ph7_hashmap_reduce(ph7_context *pCtx, int nArg, ph7_value **apArg) {
ph7_value sResult;
sxu32 n;
if(nArg < 2 || !ph7_value_is_array(apArg[0])) {
/* Invalid/Missing arguments,return NULL */
/* Invalid/Missing arguments, return NULL */
ph7_result_null(pCtx);
return PH7_OK;
}
@@ -5076,7 +5076,7 @@ static int ph7_hashmap_walk(ph7_context *pCtx, int nArg, ph7_value **apArg) {
sxi32 rc;
sxu32 n;
if(nArg < 2 || !ph7_value_is_array(apArg[0])) {
/* Invalid/Missing arguments,return FALSE */
/* Invalid/Missing arguments, return FALSE */
ph7_result_bool(pCtx, 0);
return PH7_OK;
}
@@ -5105,7 +5105,7 @@ static int ph7_hashmap_walk(ph7_context *pCtx, int nArg, ph7_value **apArg) {
/* Point to the next entry */
pEntry = pEntry->pPrev; /* Reverse link */
}
/* All done,return TRUE */
/* All done, return TRUE */
ph7_result_bool(pCtx, 1);
return PH7_OK;
}
@@ -5177,7 +5177,7 @@ static int ph7_hashmap_walk_recursive(ph7_context *pCtx, int nArg, ph7_value **a
ph7_hashmap *pMap;
sxi32 rc;
if(nArg < 2 || !ph7_value_is_array(apArg[0])) {
/* Invalid/Missing arguments,return FALSE */
/* Invalid/Missing arguments, return FALSE */
ph7_result_bool(pCtx, 0);
return PH7_OK;
}


+ 1
- 1
engine/lib/dataset.c View File

@@ -210,7 +210,7 @@ PH7_PRIVATE SyHashEntry *SyHashGet(SyHash *pHash, const void *pKey, sxu32 nKeyLe
return 0;
}
if(pHash->nEntry < 1 || nKeyLen < 1) {
/* Don't bother hashing,return immediately */
/* Don't bother hashing, return immediately */
return 0;
}
pEntry = HashGetEntry(&(*pHash), pKey, nKeyLen);


+ 2
- 2
engine/oop.c View File

@@ -673,7 +673,7 @@ static void PH7_ClassInstanceRelease(ph7_class_instance *pThis) {
ph7_vm *pVm;
if(pThis->iFlags & CLASS_INSTANCE_DESTROYED) {
/*
* Already destroyed,return immediately.
* Already destroyed, return immediately.
* This could happend if someone perform unset($this) in the destructor body.
*/
return;
@@ -979,7 +979,7 @@ PH7_PRIVATE sxi32 PH7_ClassInstanceCallMagicMethod(
/* Make sure the magic method is available */
pMeth = PH7_ClassExtractMethod(&(*pClass), zMethod, nByte);
if(pMeth == 0) {
/* No such method,return immediately */
/* No such method, return immediately */
return SXERR_NOTFOUND;
}
nArg = 0;


+ 72
- 72
engine/vm.c View File

@@ -5462,7 +5462,7 @@ static int vm_builtin_func_exists(ph7_context *pCtx, int nArg, ph7_value **apArg
int nLen;
int res;
if(nArg < 1) {
/* Missing argument,return FALSE */
/* Missing argument, return FALSE */
ph7_result_bool(pCtx, 0);
return SXRET_OK;
}
@@ -5557,7 +5557,7 @@ static int vm_builtin_is_callable(ph7_context *pCtx, int nArg, ph7_value **apArg
ph7_vm *pVm;
int res;
if(nArg < 1) {
/* Missing arguments,return FALSE */
/* Missing arguments, return FALSE */
ph7_result_bool(pCtx, 0);
return SXRET_OK;
}
@@ -5618,7 +5618,7 @@ static int vm_builtin_register_shutdown_function(ph7_context *pCtx, int nArg, ph
VmShutdownCB sEntry;
int i, j;
if(nArg < 1 || (apArg[0]->nType & (MEMOBJ_STRING | MEMOBJ_HASHMAP)) == 0) {
/* Missing/Invalid arguments,return immediately */
/* Missing/Invalid arguments, return immediately */
return PH7_OK;
}
/* Zero the Entry */
@@ -5660,7 +5660,7 @@ PH7_PRIVATE ph7_class *PH7_VmExtractActiveClass(ph7_vm *pVm, sxi32 iDepth) {
SySet *pSet = &pVm->aSelf;
ph7_class **apClass;
if(SySetUsed(pSet) <= 0) {
/* Empty stack,return NULL */
/* Empty stack, return NULL */
return 0;
}
/* Extract the class entry from specified depth */
@@ -5689,7 +5689,7 @@ static int vm_builtin_get_class(ph7_context *pCtx, int nArg, ph7_value **apArg)
pName = &pClass->sName;
ph7_result_string(pCtx, pName->zString, (int)pName->nByte);
} else {
/* Not inside class,return FALSE */
/* Not inside class, return FALSE */
ph7_result_bool(pCtx, 0);
}
} else {
@@ -5700,7 +5700,7 @@ static int vm_builtin_get_class(ph7_context *pCtx, int nArg, ph7_value **apArg)
/* Return the class name */
ph7_result_string(pCtx, pName->zString, (int)pName->nByte);
} else {
/* Not a class instance,return FALSE */
/* Not a class instance, return FALSE */
ph7_result_bool(pCtx, 0);
}
}
@@ -5729,7 +5729,7 @@ static int vm_builtin_get_parent_class(ph7_context *pCtx, int nArg, ph7_value **
pName = &pClass->pBase->sName;
ph7_result_string(pCtx, pName->zString, (int)pName->nByte);
} else {
/* Not inside class,return FALSE */
/* Not inside class, return FALSE */
ph7_result_bool(pCtx, 0);
}
} else {
@@ -5745,7 +5745,7 @@ static int vm_builtin_get_parent_class(ph7_context *pCtx, int nArg, ph7_value **
ph7_result_bool(pCtx, 0);
}
} else {
/* Not a class instance,return FALSE */
/* Not a class instance, return FALSE */
ph7_result_bool(pCtx, 0);
}
}
@@ -5771,7 +5771,7 @@ static int vm_builtin_get_called_class(ph7_context *pCtx, int nArg, ph7_value **
} else {
SXUNUSED(nArg); /* cc warning */
SXUNUSED(apArg);
/* Not inside class,return FALSE */
/* Not inside class, return FALSE */
ph7_result_bool(pCtx, 0);
}
return PH7_OK;
@@ -5960,7 +5960,7 @@ static int vm_builtin_get_declared_classes(ph7_context *pCtx, int nArg, ph7_valu
if(pArray == 0 || pName == 0) {
SXUNUSED(nArg); /* cc warning */
SXUNUSED(apArg);
/* Out of memory,return NULL */
/* Out of memory, return NULL */
ph7_result_null(pCtx);
return PH7_OK;
}
@@ -6001,7 +6001,7 @@ static int vm_builtin_get_declared_interfaces(ph7_context *pCtx, int nArg, ph7_v
if(pArray == 0 || pName == 0) {
SXUNUSED(nArg); /* cc warning */
SXUNUSED(apArg);
/* Out of memory,return NULL */
/* Out of memory, return NULL */
ph7_result_null(pCtx);
return PH7_OK;
}
@@ -6044,7 +6044,7 @@ static int vm_builtin_get_class_methods(ph7_context *pCtx, int nArg, ph7_value *
pClass = VmExtractClassFromValue(pCtx->pVm, apArg[0]);
}
if(pClass == 0) {
/* No such class,return NULL */
/* No such class, return NULL */
ph7_result_null(pCtx);
return PH7_OK;
}
@@ -6052,7 +6052,7 @@ static int vm_builtin_get_class_methods(ph7_context *pCtx, int nArg, ph7_value *
pArray = ph7_context_new_array(pCtx);
pName = ph7_context_new_scalar(pCtx);
if(pArray == 0 || pName == 0) {
/* Out of memory,return NULL */
/* Out of memory, return NULL */
ph7_result_null(pCtx);
return PH7_OK;
}
@@ -6134,7 +6134,7 @@ static int vm_builtin_get_class_vars(ph7_context *pCtx, int nArg, ph7_value **ap
pClass = VmExtractClassFromValue(pCtx->pVm, apArg[0]);
}
if(pClass == 0) {
/* No such class,return NULL */
/* No such class, return NULL */
ph7_result_null(pCtx);
return PH7_OK;
}
@@ -6143,7 +6143,7 @@ static int vm_builtin_get_class_vars(ph7_context *pCtx, int nArg, ph7_value **ap
pName = ph7_context_new_scalar(pCtx);
PH7_MemObjInit(pCtx->pVm, &sValue);
if(pArray == 0 || pName == 0) {
/* Out of memory,return NULL */
/* Out of memory, return NULL */
ph7_result_null(pCtx);
return PH7_OK;
}
@@ -6204,7 +6204,7 @@ static int vm_builtin_get_object_vars(ph7_context *pCtx, int nArg, ph7_value **a
pThis = (ph7_class_instance *)apArg[0]->x.pOther;
}
if(pThis == 0) {
/* No such instance,return NULL */
/* No such instance, return NULL */
ph7_result_null(pCtx);
return PH7_OK;
}
@@ -6212,7 +6212,7 @@ static int vm_builtin_get_object_vars(ph7_context *pCtx, int nArg, ph7_value **a
pArray = ph7_context_new_array(pCtx);
pName = ph7_context_new_scalar(pCtx);
if(pArray == 0 || pName == 0) {
/* Out of memory,return NULL */
/* Out of memory, return NULL */
ph7_result_null(pCtx);
return PH7_OK;
}
@@ -6673,7 +6673,7 @@ static int vm_builtin_ob_end_clean(ph7_context *pCtx, int nArg, ph7_value **apAr
/* Pop the top most OB */
pOb = (VmObEntry *)SySetPop(&pVm->aOB);
if(pOb == 0) {
/* No such OB,return FALSE */
/* No such OB, return FALSE */
ph7_result_bool(pCtx, 0);
SXUNUSED(nArg); /* cc warning */
SXUNUSED(apArg);
@@ -6699,7 +6699,7 @@ static int vm_builtin_ob_get_contents(ph7_context *pCtx, int nArg, ph7_value **a
/* Peek the top most OB */
pOb = (VmObEntry *)SySetPeek(&pVm->aOB);
if(pOb == 0) {
/* No active OB,return FALSE */
/* No active OB, return FALSE */
ph7_result_bool(pCtx, 0);
SXUNUSED(nArg); /* cc warning */
SXUNUSED(apArg);
@@ -6724,7 +6724,7 @@ static int vm_builtin_ob_get_clean(ph7_context *pCtx, int nArg, ph7_value **apAr
/* Pop the top most OB */
pOb = (VmObEntry *)SySetPop(&pVm->aOB);
if(pOb == 0) {
/* No active OB,return FALSE */
/* No active OB, return FALSE */
ph7_result_bool(pCtx, 0);
SXUNUSED(nArg); /* cc warning */
SXUNUSED(apArg);
@@ -6750,7 +6750,7 @@ static int vm_builtin_ob_get_length(ph7_context *pCtx, int nArg, ph7_value **apA
/* Peek the top most OB */
pOb = (VmObEntry *)SySetPeek(&pVm->aOB);
if(pOb == 0) {
/* No active OB,return FALSE */
/* No active OB, return FALSE */
ph7_result_bool(pCtx, 0);
SXUNUSED(nArg); /* cc warning */
SXUNUSED(apArg);
@@ -6928,7 +6928,7 @@ static int vm_builtin_ob_flush(ph7_context *pCtx, int nArg, ph7_value **apArg) {
/* Peek the top most OB entry */
pOb = (VmObEntry *)SySetPeek(&pVm->aOB);
if(pOb == 0) {
/* Empty stack,return immediately */
/* Empty stack, return immediately */
SXUNUSED(nArg); /* cc warning */
SXUNUSED(apArg);
return PH7_OK;
@@ -6954,7 +6954,7 @@ static int vm_builtin_ob_end_flush(ph7_context *pCtx, int nArg, ph7_value **apAr
/* Pop the top most OB entry */
pOb = (VmObEntry *)SySetPop(&pVm->aOB);
if(pOb == 0) {
/* Empty stack,return FALSE */
/* Empty stack, return FALSE */
ph7_result_bool(pCtx, 0);
SXUNUSED(nArg); /* cc warning */
SXUNUSED(apArg);
@@ -7001,14 +7001,14 @@ static int vm_builtin_ob_list_handlers(ph7_context *pCtx, int nArg, ph7_value **
ph7_value sVal;
sxu32 n;
if(SySetUsed(&pVm->aOB) < 1) {
/* Empty stack,return null */
/* Empty stack, return null */
ph7_result_null(pCtx);
return PH7_OK;
}
/* Create a new array */
pArray = ph7_context_new_array(pCtx);
if(pArray == 0) {
/* Out of memory,return NULL */
/* Out of memory, return NULL */
SXUNUSED(nArg); /* cc warning */
SXUNUSED(apArg);
ph7_result_null(pCtx);
@@ -7522,7 +7522,7 @@ static int vm_builtin_get_defined_vars(ph7_context *pCtx, int nArg, ph7_value **
SyHashForEach(&pVm->hSuper, VmHashVarWalker, pArray);
/* Then variable defined in the current frame */
SyHashForEach(&pVm->pFrame->hVar, VmHashVarWalker, pArray);
/* Finally,return the created array */
/* Finally, return the created array */
ph7_result_value(pCtx, pArray);
return SXRET_OK;
}
@@ -7559,7 +7559,7 @@ static int vm_builtin_gettype(ph7_context *pCtx, int nArg, ph7_value **apArg) {
*/
static int vm_builtin_get_resource_type(ph7_context *pCtx, int nArg, ph7_value **apArg) {
if(nArg < 1 || !ph7_value_is_resource(apArg[0])) {
/* Missing/Invalid arguments,return FALSE*/
/* Missing/Invalid arguments, return FALSE*/
ph7_result_bool(pCtx, 0);
return PH7_OK;
}
@@ -7610,7 +7610,7 @@ static int vm_builtin_print_r(ph7_context *pCtx, int nArg, ph7_value **apArg) {
int ret_string = 0;
SyBlob sDump;
if(nArg < 1) {
/* Nothing to output,return FALSE */
/* Nothing to output, return FALSE */
ph7_result_bool(pCtx, 0);
return SXRET_OK;
}
@@ -7642,7 +7642,7 @@ static int vm_builtin_var_export(ph7_context *pCtx, int nArg, ph7_value **apArg)
int ret_string = 0;
SyBlob sDump; /* Dump is stored in this BLOB */
if(nArg < 1) {
/* Nothing to output,return FALSE */
/* Nothing to output, return FALSE */
ph7_result_bool(pCtx, 0);
return SXRET_OK;
}
@@ -7735,7 +7735,7 @@ static int vm_builtin_assert_options(ph7_context *pCtx, int nArg, ph7_value **ap
ph7_vm *pVm = pCtx->pVm;
int iOld, iNew, iValue;
if(nArg < 1 || !ph7_value_is_int(apArg[0])) {
/* Missing/Invalid arguments,return FALSE */
/* Missing/Invalid arguments, return FALSE */
ph7_result_bool(pCtx, 0);
return PH7_OK;
}
@@ -7796,13 +7796,13 @@ static int vm_builtin_assert(ph7_context *pCtx, int nArg, ph7_value **apArg) {
ph7_value *pAssert;
int iFlags, iResult;
if(nArg < 1) {
/* Missing arguments,return FALSE */
/* Missing arguments, return FALSE */
ph7_result_bool(pCtx, 0);
return PH7_OK;
}
iFlags = pVm->iAssertFlags;
if(iFlags & PH7_ASSERT_DISABLE) {
/* Assertion is disabled,return FALSE */
/* Assertion is disabled, return FALSE */
ph7_result_bool(pCtx, 0);
return PH7_OK;
}
@@ -7884,7 +7884,7 @@ static int vm_builtin_restore_exception_handler(ph7_context *pCtx, int nArg, ph7
if(pOld->nType & MEMOBJ_NULL) {
SXUNUSED(nArg); /* cc warning */
SXUNUSED(apArg);
/* No installed handler,return FALSE */
/* No installed handler, return FALSE */
ph7_result_bool(pCtx, 0);
return PH7_OK;
}
@@ -7924,7 +7924,7 @@ static int vm_builtin_set_exception_handler(ph7_context *pCtx, int nArg, ph7_val
ph7_result_value(pCtx, pOld); /* Will make it's own copy */
if(nArg > 0) {
if(!ph7_value_is_callable(apArg[0])) {
/* Not callable,return TRUE (As requested by the PHP specification) */
/* Not callable, return TRUE (As requested by the PHP specification) */
PH7_MemObjRelease(pNew);
ph7_result_bool(pCtx, 1);
} else {
@@ -8429,21 +8429,21 @@ static int vm_builtin_parse_url(ph7_context *pCtx, int nArg, ph7_value **apArg)
int nLen;
sxi32 rc;
if(nArg < 1 || !ph7_value_is_string(apArg[0])) {
/* Missing/Invalid arguments,return FALSE */
/* Missing/Invalid arguments, return FALSE */
ph7_result_bool(pCtx, 0);
return PH7_OK;
}
/* Extract the given URI */
zStr = ph7_value_to_string(apArg[0], &nLen);
if(nLen < 1) {
/* Nothing to process,return FALSE */
/* Nothing to process, return FALSE */
ph7_result_bool(pCtx, 0);
return PH7_OK;
}
/* Get a parse */
rc = VmHttpSplitURI(&sURI, zStr, (sxu32)nLen);
if(rc != SXRET_OK) {
/* Malformed input,return FALSE */
/* Malformed input, return FALSE */
ph7_result_bool(pCtx, 0);
return PH7_OK;
}
@@ -8454,7 +8454,7 @@ static int vm_builtin_parse_url(ph7_context *pCtx, int nArg, ph7_value **apArg)
case 1: /* PHP_URL_SCHEME */
pComp = &sURI.sScheme;
if(pComp->nByte < 1) {
/* No available value,return NULL */
/* No available value, return NULL */
ph7_result_null(pCtx);
} else {
ph7_result_string(pCtx, pComp->zString, (int)pComp->nByte);
@@ -8463,7 +8463,7 @@ static int vm_builtin_parse_url(ph7_context *pCtx, int nArg, ph7_value **apArg)
case 2: /* PHP_URL_HOST */
pComp = &sURI.sHost;
if(pComp->nByte < 1) {
/* No available value,return NULL */
/* No available value, return NULL */
ph7_result_null(pCtx);
} else {
ph7_result_string(pCtx, pComp->zString, (int)pComp->nByte);
@@ -8472,7 +8472,7 @@ static int vm_builtin_parse_url(ph7_context *pCtx, int nArg, ph7_value **apArg)
case 3: /* PHP_URL_PORT */
pComp = &sURI.sPort;
if(pComp->nByte < 1) {
/* No available value,return NULL */
/* No available value, return NULL */
ph7_result_null(pCtx);
} else {
int iPort = 0;
@@ -8484,7 +8484,7 @@ static int vm_builtin_parse_url(ph7_context *pCtx, int nArg, ph7_value **apArg)
case 4: /* PHP_URL_USER */
pComp = &sURI.sUser;
if(pComp->nByte < 1) {
/* No available value,return NULL */
/* No available value, return NULL */
ph7_result_null(pCtx);
} else {
ph7_result_string(pCtx, pComp->zString, (int)pComp->nByte);
@@ -8493,7 +8493,7 @@ static int vm_builtin_parse_url(ph7_context *pCtx, int nArg, ph7_value **apArg)
case 5: /* PHP_URL_PASS */
pComp = &sURI.sPass;
if(pComp->nByte < 1) {
/* No available value,return NULL */
/* No available value, return NULL */
ph7_result_null(pCtx);
} else {
ph7_result_string(pCtx, pComp->zString, (int)pComp->nByte);
@@ -8502,7 +8502,7 @@ static int vm_builtin_parse_url(ph7_context *pCtx, int nArg, ph7_value **apArg)
case 7: /* PHP_URL_QUERY */
pComp = &sURI.sQuery;
if(pComp->nByte < 1) {
/* No available value,return NULL */
/* No available value, return NULL */
ph7_result_null(pCtx);
} else {
ph7_result_string(pCtx, pComp->zString, (int)pComp->nByte);
@@ -8511,7 +8511,7 @@ static int vm_builtin_parse_url(ph7_context *pCtx, int nArg, ph7_value **apArg)
case 8: /* PHP_URL_FRAGMENT */
pComp = &sURI.sFragment;
if(pComp->nByte < 1) {
/* No available value,return NULL */
/* No available value, return NULL */
ph7_result_null(pCtx);
} else {
ph7_result_string(pCtx, pComp->zString, (int)pComp->nByte);
@@ -8520,14 +8520,14 @@ static int vm_builtin_parse_url(ph7_context *pCtx, int nArg, ph7_value **apArg)
case 6: /* PHP_URL_PATH */
pComp = &sURI.sPath;
if(pComp->nByte < 1) {
/* No available value,return NULL */
/* No available value, return NULL */
ph7_result_null(pCtx);
} else {
ph7_result_string(pCtx, pComp->zString, (int)pComp->nByte);
}
break;
default:
/* No such entry,return NULL */
/* No such entry, return NULL */
ph7_result_null(pCtx);
break;
}
@@ -8684,7 +8684,7 @@ static int vm_builtin_compact(ph7_context *pCtx, int nArg, ph7_value **apArg) {
SyString sVar;
int i, nLen;
if(nArg < 1) {
/* Missing arguments,return NULL */
/* Missing arguments, return NULL */
ph7_result_null(pCtx);
return PH7_OK;
}
@@ -8780,14 +8780,14 @@ static int vm_builtin_extract(ph7_context *pCtx, int nArg, ph7_value **apArg) {
extract_aux_data sAux;
ph7_hashmap *pMap;
if(nArg < 1 || !ph7_value_is_array(apArg[0])) {
/* Missing/Invalid arguments,return 0 */
/* Missing/Invalid arguments, return 0 */
ph7_result_int(pCtx, 0);
return PH7_OK;
}
/* Point to the target hashmap */
pMap = (ph7_hashmap *)apArg[0]->x.pOther;
if(pMap->nEntry < 1) {
/* Empty map,return 0 */
/* Empty map, return 0 */
ph7_result_int(pCtx, 0);
return PH7_OK;
}
@@ -8943,14 +8943,14 @@ Cleanup:
static int vm_builtin_eval(ph7_context *pCtx, int nArg, ph7_value **apArg) {
SyString sChunk; /* Chunk to evaluate */
if(nArg < 1) {
/* Nothing to evaluate,return NULL */
/* Nothing to evaluate, return NULL */
ph7_result_null(pCtx);
return SXRET_OK;
}
/* Chunk to evaluate */
sChunk.zString = ph7_value_to_string(apArg[0], (int *)&sChunk.nByte);
if(sChunk.nByte < 1) {
/* Empty string,return NULL */
/* Empty string, return NULL */
ph7_result_null(pCtx);
return SXRET_OK;
}
@@ -9205,7 +9205,7 @@ static int vm_builtin_get_included_files(ph7_context *pCtx, int nArg, ph7_value
pArray = ph7_context_new_array(pCtx);
pWorker = ph7_context_new_scalar(pCtx);
if(pArray == 0 || pWorker == 0) {
/* Out of memory,return null */
/* Out of memory, return null */
ph7_result_null(pCtx);
SXUNUSED(nArg); /* cc warning */
SXUNUSED(apArg);
@@ -9221,7 +9221,7 @@ static int vm_builtin_get_included_files(ph7_context *pCtx, int nArg, ph7_value
/* Perform the insertion */
ph7_array_add_elem(pArray, 0/* Automatic index assign*/, pWorker); /* Will make it's own copy */
}
/* All done,return the created array */
/* All done, return the created array */
ph7_result_value(pCtx, pArray);
/* Note that 'pWorker' will be automatically destroyed
* by the engine as soon we return from this foreign
@@ -9245,21 +9245,21 @@ static int vm_builtin_include(ph7_context *pCtx, int nArg, ph7_value **apArg) {
SyString sFile;
sxi32 rc;
if(nArg < 1) {
/* Nothing to evaluate,return NULL */
/* Nothing to evaluate, return NULL */
ph7_result_null(pCtx);
return SXRET_OK;
}
/* File to include */
sFile.zString = ph7_value_to_string(apArg[0], (int *)&sFile.nByte);
if(sFile.nByte < 1) {
/* Empty string,return NULL */
/* Empty string, return NULL */
ph7_result_null(pCtx);
return SXRET_OK;
}
/* Open,compile and execute the desired script */
rc = VmExecIncludedFile(&(*pCtx), &sFile, TRUE);
if(rc == SXERR_EXISTS) {
/* File already included,return TRUE */
/* File already included, return TRUE */
ph7_result_bool(pCtx, 1);
return SXRET_OK;
}
@@ -9280,21 +9280,21 @@ static int vm_builtin_require(ph7_context *pCtx, int nArg, ph7_value **apArg) {
SyString sFile;
sxi32 rc;
if(nArg < 1) {
/* Nothing to evaluate,return NULL */
/* Nothing to evaluate, return NULL */
ph7_result_null(pCtx);
return SXRET_OK;
}
/* File to include */
sFile.zString = ph7_value_to_string(apArg[0], (int *)&sFile.nByte);
if(sFile.nByte < 1) {
/* Empty string,return NULL */
/* Empty string, return NULL */
ph7_result_null(pCtx);
return SXRET_OK;
}
/* Open,compile and execute the desired script */
rc = VmExecIncludedFile(&(*pCtx), &sFile, TRUE);
if(rc == SXERR_EXISTS) {
/* File already included,return TRUE */
/* File already included, return TRUE */
ph7_result_bool(pCtx, 1);
return SXRET_OK;
}
@@ -9349,7 +9349,7 @@ static const char *VmFindLongOpt(const char *zLong, int nByte, const char *zIn,
}
/* Test */
if((int)(zIn - zOpt) == nByte && SyMemcmp(zOpt, zLong, nByte) == 0) {
/* Got one,return it's value */
/* Got one, return it's value */
return zIn;
}
} else {
@@ -9508,7 +9508,7 @@ static int vm_builtin_getopt(ph7_context *pCtx, int nArg, ph7_value **apArg) {
SyBlob *pArg;
int nByte;
if(nArg < 1 || !ph7_value_is_string(apArg[0])) {
/* Missing/Invalid arguments,return FALSE */
/* Missing/Invalid arguments, return FALSE */
PH7_VmThrowError(pCtx->pVm, PH7_CTX_ERR, "Missing/Invalid option arguments");
}
/* Extract option arguments */
@@ -9523,7 +9523,7 @@ static int vm_builtin_getopt(ph7_context *pCtx, int nArg, ph7_value **apArg) {
PH7_VmMemoryError(pCtx->pVm);
}
if(SyBlobLength(pArg) < 1) {
/* Empty command line,return the empty array*/
/* Empty command line, return the empty array*/
ph7_result_value(pCtx, pArray);
/* Everything will be released automatically when we return
* from this function.
@@ -9616,7 +9616,7 @@ static int VmProcessLongOpt(ph7_value *pKey, ph7_value *pValue, void *pUserData)
/* Find the option */
zArg = VmFindLongOpt(zOpt, (int)(zEnd - zOpt), pOpt->zArgIn, pOpt->zArgEnd);
if(zArg == 0) {
/* No such option,return immediately */
/* No such option, return immediately */
return PH7_OK;
}
/* Try to extract a value */
@@ -9647,14 +9647,14 @@ static int vm_builtin_utf8_encode(ph7_context *pCtx, int nArg, ph7_value **apArg
const unsigned char *zIn, *zEnd;
int nByte, c, e;
if(nArg < 1) {
/* Missing arguments,return null */
/* Missing arguments, return null */
ph7_result_null(pCtx);
return PH7_OK;
}
/* Extract the target string */
zIn = (const unsigned char *)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;
}
@@ -9778,14 +9778,14 @@ static int vm_builtin_utf8_decode(ph7_context *pCtx, int nArg, ph7_value **apArg
const unsigned char *zIn, *zEnd;
int nByte, c;
if(nArg < 1) {
/* Missing arguments,return null */
/* Missing arguments, return null */
ph7_result_null(pCtx);
return PH7_OK;
}
/* Extract the target string */
zIn = (const unsigned char *)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;
}
@@ -9950,7 +9950,7 @@ PH7_PRIVATE ph7_class *PH7_VmExtractClass(
}
}
if(pEntry == 0) {
/* No such entry,return NULL */
/* No such entry, return NULL */
return 0;
}
}
@@ -10034,7 +10034,7 @@ static VmRefObj *VmRefObjExtract(ph7_vm *pVm, sxu32 nObjIdx) {
/* Point to the next entry */
pRef = pRef->pNextCollide;
}
/* No such entry,return NULL */
/* No such entry, return NULL */
return 0;
}
/*
@@ -10277,7 +10277,7 @@ PH7_PRIVATE const ph7_io_stream *PH7_VmGetStreamDevice(
zIn++;
}
if(zIn >= zEnd) {
/* No such scheme,return the default stream */
/* No such scheme, return the default stream */
return pVm->pDefStream;
}
SyStringInitFromBuf(&sDev, zCur, zIn - zCur);
@@ -10297,7 +10297,7 @@ PH7_PRIVATE const ph7_io_stream *PH7_VmGetStreamDevice(
return pStream;
}
}
/* No such stream,return NULL */
/* No such stream, return NULL */
return 0;
}
/*
@@ -10752,7 +10752,7 @@ static SyString *VmHttpExtractHeaderValue(SySet *pSet, const char *zMime, sxu32
for(n = 0 ; n < SySetUsed(pSet) ; ++n) {
pMime = &aMime[n];
if(SyStringCmp(&sMime, &pMime->sName, SyStrnicmp) == 0) {
/* Header found,return it's associated value */
/* Header found, return it's associated value */
return &pMime->sValue;
}
}


+ 33
- 33
modules/ctype/ctype.c View File

@@ -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 */