From 41000a8f9aabc0fe8d5e0dc76c7add9ae95bc599 Mon Sep 17 00:00:00 2001 From: Nicolas Hake Date: Fri, 29 Apr 2016 12:29:37 +0200 Subject: [PATCH] C4AulCompiler: Rename pLoopStack to active_loops --- src/script/C4AulCompiler.cpp | 18 +++++++++--------- src/script/C4AulCompiler.h | 4 ++-- src/script/C4AulParse.cpp | 6 +++--- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/script/C4AulCompiler.cpp b/src/script/C4AulCompiler.cpp index 729b11105..6977feb0c 100644 --- a/src/script/C4AulCompiler.cpp +++ b/src/script/C4AulCompiler.cpp @@ -375,20 +375,20 @@ void C4AulCompiler::PushLoop() Loop *pNew = new Loop(); pNew->StackSize = iStack; pNew->Controls = NULL; - pNew->Next = pLoopStack; - pLoopStack = pNew; + pNew->Next = active_loops; + active_loops = pNew; } void C4AulCompiler::PopLoop(int ContinueJump) { // Set targets for break/continue - for (Loop::Control *pCtrl = pLoopStack->Controls; pCtrl; pCtrl = pCtrl->Next) + for (Loop::Control *pCtrl = active_loops->Controls; pCtrl; pCtrl = pCtrl->Next) if (pCtrl->Break) SetJumpHere(pCtrl->Pos); else SetJump(pCtrl->Pos, ContinueJump); // Delete loop controls - Loop *pLoop = pLoopStack; + Loop *pLoop = active_loops; while (pLoop->Controls) { // Unlink @@ -398,20 +398,20 @@ void C4AulCompiler::PopLoop(int ContinueJump) delete pCtrl; } // Unlink & delete - pLoopStack = pLoop->Next; + active_loops = pLoop->Next; delete pLoop; } void C4AulCompiler::AddLoopControl(const char * SPos, bool fBreak) { // Insert code - if (pLoopStack->StackSize != iStack) - AddBCC(SPos, AB_STACK, pLoopStack->StackSize - iStack); + if (active_loops->StackSize != iStack) + AddBCC(SPos, AB_STACK, active_loops->StackSize - iStack); Loop::Control *pNew = new Loop::Control(); pNew->Break = fBreak; pNew->Pos = Fn->GetCodePos(); - pNew->Next = pLoopStack->Controls; - pLoopStack->Controls = pNew; + pNew->Next = active_loops->Controls; + active_loops->Controls = pNew; AddBCC(SPos, AB_JUMP); } diff --git a/src/script/C4AulCompiler.h b/src/script/C4AulCompiler.h index b5c86c79c..40f9bdf59 100644 --- a/src/script/C4AulCompiler.h +++ b/src/script/C4AulCompiler.h @@ -54,14 +54,14 @@ public: int StackSize; Loop *Next; }; - Loop *pLoopStack = NULL; + Loop *active_loops = NULL; void PushLoop(); void PopLoop(int ContinueJump); void AddLoopControl(const char * SPos, bool fBreak); ~C4AulCompiler() { - while (pLoopStack) PopLoop(0); + while (active_loops) PopLoop(0); } }; diff --git a/src/script/C4AulParse.cpp b/src/script/C4AulParse.cpp index e40ab1f1c..dfcc6afd7 100644 --- a/src/script/C4AulParse.cpp +++ b/src/script/C4AulParse.cpp @@ -1201,7 +1201,7 @@ void C4AulParse::Parse_Statement() if (Type == PARSER) { // Must be inside a loop - if (!codegen.pLoopStack) + if (!codegen.active_loops) { Error("'break' is only allowed inside loops"); } @@ -1217,7 +1217,7 @@ void C4AulParse::Parse_Statement() if (Type == PARSER) { // Must be inside a loop - if (!codegen.pLoopStack) + if (!codegen.active_loops) { Error("'continue' is only allowed inside loops"); } @@ -1474,7 +1474,7 @@ void C4AulParse::Parse_DoWhile() Parse_Statement(); int BeforeCond = -1; if (Type == PARSER) - for (C4AulCompiler::Loop::Control *pCtrl2 = codegen.pLoopStack->Controls; pCtrl2; pCtrl2 = pCtrl2->Next) + for (C4AulCompiler::Loop::Control *pCtrl2 = codegen.active_loops->Controls; pCtrl2; pCtrl2 = pCtrl2->Next) if (!pCtrl2->Break) BeforeCond = codegen.JumpHere(); // Execute condition