From 7e3c79d3c5e7550096f03b9617c374363b478200 Mon Sep 17 00:00:00 2001 From: belliash Date: Mon, 13 Aug 2018 20:16:37 +0200 Subject: [PATCH] Functions naming cleanup --- engine/api.c | 10 +++++----- engine/compiler.c | 14 +++++++------- engine/lexer.c | 2 +- engine/vm.c | 2 +- include/compiler.h | 3 +-- include/ph7int.h | 4 ++-- 6 files changed, 17 insertions(+), 18 deletions(-) diff --git a/engine/api.c b/engine/api.c index 346c202..37d55ee 100644 --- a/engine/api.c +++ b/engine/api.c @@ -652,7 +652,7 @@ int ph7_vm_init( * This API does not actually evaluate the PHP code. It merely compile and prepares the PHP script * for evaluation. */ -static sxi32 ProcessScript( +static sxi32 ProcessSourceFile( ph7 *pEngine, /* Running PH7 engine */ ph7_vm **ppVm, /* OUT: A pointer to the virtual machine */ SyString *pScript, /* Raw PHP script to compile */ @@ -680,7 +680,7 @@ static sxi32 ProcessScript( PH7_VmPushFilePath(pVm, pFilePath, -1, TRUE, 0); } /* Compile the script */ - PH7_CompileScript(pVm, &(*pScript), iFlags); + PH7_CompileAerScript(pVm, &(*pScript), iFlags); if(pVm->sCodeGen.nErr > 0 || pVm == 0) { sxu32 nErr = pVm->sCodeGen.nErr; /* Compilation error or null ppVm pointer,release this VM */ @@ -740,7 +740,7 @@ int ph7_compile(ph7 *pEngine, const char *zSource, int nLen, ph7_vm **ppOutVm) { } #endif /* Compile the script */ - rc = ProcessScript(&(*pEngine), ppOutVm, &sScript, 0, 0); + rc = ProcessSourceFile(&(*pEngine), ppOutVm, &sScript, 0, 0); #if defined(PH7_ENABLE_THREADS) /* Leave engine mutex */ SyMutexLeave(sMPGlobal.pMutexMethods, pEngine->pMutex); /* NO-OP if sMPGlobal.nThreadingLevel != PH7_THREAD_LEVEL_MULTI */ @@ -772,7 +772,7 @@ int ph7_compile_v2(ph7 *pEngine, const char *zSource, int nLen, ph7_vm **ppOutVm } #endif /* Compile the script */ - rc = ProcessScript(&(*pEngine), ppOutVm, &sScript, iFlags, 0); + rc = ProcessSourceFile(&(*pEngine), ppOutVm, &sScript, iFlags, 0); #if defined(PH7_ENABLE_THREADS) /* Leave engine mutex */ SyMutexLeave(sMPGlobal.pMutexMethods, pEngine->pMutex); /* NO-OP if sMPGlobal.nThreadingLevel != PH7_THREAD_LEVEL_MULTI */ @@ -819,7 +819,7 @@ int ph7_compile_file(ph7 *pEngine, const char *zFilePath, ph7_vm **ppOutVm, int } else { /* Compile the file */ SyStringInitFromBuf(&sScript, pMapView, nSize); - rc = ProcessScript(&(*pEngine), ppOutVm, &sScript, iFlags, zFilePath); + rc = ProcessSourceFile(&(*pEngine), ppOutVm, &sScript, iFlags, zFilePath); /* Release the memory view of the whole file */ if(pVfs->xUnmap) { pVfs->xUnmap(pMapView, nSize); diff --git a/engine/compiler.c b/engine/compiler.c index 52b622b..de1dd21 100644 --- a/engine/compiler.c +++ b/engine/compiler.c @@ -387,7 +387,7 @@ static sxi32 PH7_GenStateProcessStringExpression( /* Preallocate some slots */ SySetAlloc(&sToken, 0x08); /* Tokenize the text */ - PH7_TokenizePHP(zIn, (sxu32)(zEnd - zIn), nLine, &sToken); + PH7_TokenizeAerScript(zIn, (sxu32)(zEnd - zIn), nLine, &sToken); /* Swap delimiter */ pTmpIn = pGen->pIn; pTmpEnd = pGen->pEnd; @@ -1552,7 +1552,7 @@ static sxi32 PH7_GenStateNextChunk(ph7_gen_state *pGen) { /* Reset the token set */ SySetReset(pTokenSet); /* Tokenize input */ - PH7_TokenizePHP(SyStringData(&pGen->pRawIn->sData), SyStringLength(&pGen->pRawIn->sData), + PH7_TokenizeAerScript(SyStringData(&pGen->pRawIn->sData), SyStringLength(&pGen->pRawIn->sData), pGen->pRawIn->nLine, pTokenSet); /* Point to the fresh token stream */ pGen->pIn = (SyToken *)SySetBasePtr(pTokenSet); @@ -5350,7 +5350,7 @@ static sxi32 PH7_GenStateCompileChunk( * If something goes wrong while compiling the Aer chunk,this function * takes care of generating the appropriate error message. */ -static sxi32 PH7_CompilePHP( +static sxi32 PH7_CompileScript( ph7_gen_state *pGen, /* Code generator state */ SySet *pTokenSet, /* Token set */ int is_expr /* TRUE if we are dealing with a simple expression */ @@ -5364,7 +5364,7 @@ static sxi32 PH7_CompilePHP( /* Advance the stream cursor */ pGen->pRawIn++; /* Tokenize the Aer chunk first */ - PH7_TokenizePHP(SyStringData(&pScript->sData), SyStringLength(&pScript->sData), pScript->nLine, &(*pTokenSet)); + PH7_TokenizeAerScript(SyStringData(&pScript->sData), SyStringLength(&pScript->sData), pScript->nLine, &(*pTokenSet)); /* Point to the head and tail of the token stream. */ pGen->pIn = (SyToken *)SySetBasePtr(pTokenSet); pGen->pEnd = &pGen->pIn[SySetUsed(pTokenSet)]; @@ -5390,7 +5390,7 @@ static sxi32 PH7_CompilePHP( * in HTML, XML and so on. This function handle all the stuff. * This is the only compile interface exported from this file. */ -PH7_PRIVATE sxi32 PH7_CompileScript( +PH7_PRIVATE sxi32 PH7_CompileAerScript( ph7_vm *pVm, /* Generate PH7 byte-codes for this Virtual Machine */ SyString *pScript, /* Script to compile */ sxi32 iFlags /* Compile flags */ @@ -5427,7 +5427,7 @@ PH7_PRIVATE sxi32 PH7_CompileScript( rc = PH7_OK; if(is_expr) { /* Compile the expression */ - rc = PH7_CompilePHP(pCodeGen, &aAerToken, TRUE); + rc = PH7_CompileScript(pCodeGen, &aAerToken, TRUE); goto cleanup; } nObjIdx = 0; @@ -5437,7 +5437,7 @@ PH7_PRIVATE sxi32 PH7_CompileScript( if(pCodeGen->pRawIn >= pCodeGen->pRawEnd) { break; /* No more tokens to process */ } - rc = PH7_CompilePHP(pCodeGen, &aAerToken, FALSE); + rc = PH7_CompileScript(pCodeGen, &aAerToken, FALSE); if(rc == SXERR_ABORT) { break; } diff --git a/engine/lexer.c b/engine/lexer.c index fa3270d..a4aa541 100644 --- a/engine/lexer.c +++ b/engine/lexer.c @@ -643,7 +643,7 @@ static sxu32 KeywordCode(const char *z, int n) { * Tokenize a raw PHP input. * This is the public tokenizer called by most code generator routines. */ -PH7_PRIVATE sxi32 PH7_TokenizePHP(const char *zInput, sxu32 nLen, sxu32 nLineStart, SySet *pOut) { +PH7_PRIVATE sxi32 PH7_TokenizeAerScript(const char *zInput, sxu32 nLen, sxu32 nLineStart, SySet *pOut) { SyLex sLexer; sxi32 rc; /* Initialize the lexer */ diff --git a/engine/vm.c b/engine/vm.c index 5f09f4c..6175c5d 100644 --- a/engine/vm.c +++ b/engine/vm.c @@ -10441,7 +10441,7 @@ static sxi32 VmEvalChunk( pByteCode = pVm->pByteContainer; pVm->pByteContainer = &aByteCode; /* Compile the chunk */ - PH7_CompileScript(pVm, pChunk, iFlags); + PH7_CompileAerScript(pVm, pChunk, iFlags); if(pVm->sCodeGen.nErr > 0) { /* Compilation error,return false */ if(pCtx) { diff --git a/include/compiler.h b/include/compiler.h index 0496589..6465a0d 100644 --- a/include/compiler.h +++ b/include/compiler.h @@ -148,8 +148,7 @@ PH7_PRIVATE ProcNodeConstruct PH7_GetNodeHandler(sxu32 nNodeType); static ProcLangConstruct PH7_GenStateGetStatementHandler(sxu32 nKeywordID, SyToken *pLookahead); static int PH7_GenStateIsLangConstruct(sxu32 nKeyword); static sxi32 PH7_GenStateCompileChunk(ph7_gen_state *pGen, sxi32 iFlags); -static sxi32 PH7_CompilePHP(ph7_gen_state *pGen, SySet *pTokenSet, int is_expr); -PH7_PRIVATE sxi32 PH7_CompileScript(ph7_vm *pVm, SyString *pScript, sxi32 iFlags); +static sxi32 PH7_CompileScript(ph7_gen_state *pGen, SySet *pTokenSet, int is_expr); PH7_PRIVATE sxi32 PH7_InitCodeGenerator(ph7_vm *pVm, ProcConsumer xErr, void *pErrData); PH7_PRIVATE sxi32 PH7_ResetCodeGenerator(ph7_vm *pVm, ProcConsumer xErr, void *pErrData); PH7_PRIVATE sxi32 PH7_GenCompileError(ph7_gen_state *pGen, sxi32 nErrType, sxu32 nLine, const char *zFormat, ...); diff --git a/include/ph7int.h b/include/ph7int.h index e6c35e3..1f14b83 100644 --- a/include/ph7int.h +++ b/include/ph7int.h @@ -1551,7 +1551,7 @@ PH7_PRIVATE sxi32 PH7_MemObjToBool(ph7_value *pObj); PH7_PRIVATE sxi64 PH7_TokenValueToInt64(SyString *pData); /* lex.c function prototypes */ PH7_PRIVATE sxi32 PH7_TokenizeRawText(const char *zInput, sxu32 nLen, SySet *pOut); -PH7_PRIVATE sxi32 PH7_TokenizePHP(const char *zInput, sxu32 nLen, sxu32 nLineStart, SySet *pOut); +PH7_PRIVATE sxi32 PH7_TokenizeAerScript(const char *zInput, sxu32 nLen, sxu32 nLineStart, SySet *pOut); /* vm.c function prototypes */ PH7_PRIVATE void PH7_VmReleaseContextValue(ph7_context *pCtx, ph7_value *pValue); PH7_PRIVATE sxi32 PH7_VmInitFuncState(ph7_vm *pVm, ph7_vm_func *pFunc, const char *zName, sxu32 nByte, @@ -1625,7 +1625,7 @@ PH7_PRIVATE sxi32 PH7_CompileAnonFunc(ph7_gen_state *pGen, sxi32 iCompileFlag); PH7_PRIVATE sxi32 PH7_InitCodeGenerator(ph7_vm *pVm, ProcConsumer xErr, void *pErrData); PH7_PRIVATE sxi32 PH7_ResetCodeGenerator(ph7_vm *pVm, ProcConsumer xErr, void *pErrData); PH7_PRIVATE sxi32 PH7_GenCompileError(ph7_gen_state *pGen, sxi32 nErrType, sxu32 nLine, const char *zFormat, ...); -PH7_PRIVATE sxi32 PH7_CompileScript(ph7_vm *pVm, SyString *pScript, sxi32 iFlags); +PH7_PRIVATE sxi32 PH7_CompileAerScript(ph7_vm *pVm, SyString *pScript, sxi32 iFlags); /* constant.c function prototypes */ PH7_PRIVATE void PH7_RegisterBuiltInConstant(ph7_vm *pVm); /* builtin.c function prototypes */