This is an automated email from the git hooks/post-receive script. odyx pushed a commit to branch debian/master in repository colobot.
commit ef4e2f08a36d5eb5e9ece4b03a758b133e27ae8b Author: Grunaka <d...@romainbreton.fr> Date: Mon Nov 16 22:00:01 2015 +0100 Moving CBotInstr class in its own header and source files. --- src/CBot/CBot.cpp | 336 ------------------------- src/CBot/CBot.h | 90 ------- src/CBot/CBotDefines.h | 2 + src/CBot/CBotInstr/CBotBlock.h | 2 + src/CBot/CBotInstr/CBotBoolExpr.h | 2 + src/CBot/CBotInstr/CBotBoolean.h | 2 + src/CBot/CBotInstr/CBotBreak.h | 2 + src/CBot/CBotInstr/CBotCase.h | 2 + src/CBot/CBotInstr/CBotCatch.h | 2 + src/CBot/CBotInstr/CBotClassInst.h | 2 + src/CBot/CBotInstr/CBotCondition.h | 2 + src/CBot/CBotInstr/CBotDo.h | 2 + src/CBot/CBotInstr/CBotEmpty.h | 2 + src/CBot/CBotInstr/CBotExprAlpha.h | 2 + src/CBot/CBotInstr/CBotExprBool.h | 2 + src/CBot/CBotInstr/CBotExprNan.h | 2 + src/CBot/CBotInstr/CBotExprNull.h | 2 + src/CBot/CBotInstr/CBotExprNum.h | 2 + src/CBot/CBotInstr/CBotExprUnaire.h | 2 + src/CBot/CBotInstr/CBotExprVar.h | 2 + src/CBot/CBotInstr/CBotExpression.h | 3 + src/CBot/CBotInstr/CBotFieldExpr.h | 2 + src/CBot/CBotInstr/CBotFloat.h | 2 + src/CBot/CBotInstr/CBotFor.h | 2 + src/CBot/CBotInstr/CBotFunction.h | 2 + src/CBot/CBotInstr/CBotIString.h | 2 + src/CBot/CBotInstr/CBotIf.h | 2 + src/CBot/CBotInstr/CBotIndexExpr.h | 2 + src/CBot/CBotInstr/CBotInstArray.h | 2 + src/CBot/{CBot.cpp => CBotInstr/CBotInstr.cpp} | 306 +++------------------- src/CBot/CBotInstr/CBotInstr.h | 266 ++++++++++++++++++++ src/CBot/CBotInstr/CBotInstrCall.h | 2 + src/CBot/CBotInstr/CBotInstrMethode.h | 2 + src/CBot/CBotInstr/CBotInt.h | 2 + src/CBot/CBotInstr/CBotLeftExpr.h | 2 + src/CBot/CBotInstr/CBotLeftExprVar.h | 2 + src/CBot/CBotInstr/CBotListArray.h | 2 + src/CBot/CBotInstr/CBotListExpression.h | 2 + src/CBot/CBotInstr/CBotListInstr.h | 2 + src/CBot/CBotInstr/CBotLogicExpr.h | 2 + src/CBot/CBotInstr/CBotNew.h | 2 + src/CBot/CBotInstr/CBotParExpr.h | 2 +- src/CBot/CBotInstr/CBotPostIncExpr.h | 2 + src/CBot/CBotInstr/CBotPreIncExpr.h | 2 + src/CBot/CBotInstr/CBotReturn.h | 2 + src/CBot/CBotInstr/CBotSwitch.h | 2 + src/CBot/CBotInstr/CBotThrow.h | 2 + src/CBot/CBotInstr/CBotTry.h | 2 + src/CBot/CBotInstr/CBotTwoOpExpr.h | 2 + src/CBot/CBotInstr/CBotWhile.h | 2 + src/CBot/CBotVar/CBotVarClass.cpp | 4 +- src/CBot/CMakeLists.txt | 1 + 52 files changed, 401 insertions(+), 695 deletions(-) diff --git a/src/CBot/CBot.cpp b/src/CBot/CBot.cpp index 1c8b437..1822df7 100644 --- a/src/CBot/CBot.cpp +++ b/src/CBot/CBot.cpp @@ -83,342 +83,6 @@ // Global include #include <cassert> - -CBotInstr::CBotInstr() -{ - name = "CBotInstr"; - m_next = nullptr; - m_next2b = nullptr; - m_next3 = nullptr; - m_next3b = nullptr; -} - -CBotInstr::~CBotInstr() -{ - delete m_next; - delete m_next2b; - delete m_next3; - delete m_next3b; -} - -// counter of nested loops, -// to determine the break and continue valid -// list of labels used - - -int CBotInstr::m_LoopLvl = 0; -CBotStringArray CBotInstr::m_labelLvl = CBotStringArray(); - -// adds a level with a label -void CBotInstr::IncLvl(CBotString& label) -{ - m_labelLvl.SetSize(m_LoopLvl+1); - m_labelLvl[m_LoopLvl] = label; - m_LoopLvl++; -} - -// adds a level (switch statement) -void CBotInstr::IncLvl() -{ - m_labelLvl.SetSize(m_LoopLvl+1); - m_labelLvl[m_LoopLvl] = "#SWITCH"; - m_LoopLvl++; -} - -// free a level -void CBotInstr::DecLvl() -{ - m_LoopLvl--; - m_labelLvl[m_LoopLvl].Empty(); -} - -// control validity of break and continue -bool CBotInstr::ChkLvl(const CBotString& label, int type) -{ - int i = m_LoopLvl; - while (--i>=0) - { - if ( type == ID_CONTINUE && m_labelLvl[i] == "#SWITCH") continue; - if (label.IsEmpty()) return true; - if (m_labelLvl[i] == label) return true; - } - return false; -} - -bool CBotInstr::IsOfClass(CBotString n) -{ - return name == n; -} - - -//////////////////////////////////////////////////////////////////////////// -// database management class CBotInstr - -// set the token corresponding to the instruction - -void CBotInstr::SetToken(CBotToken* p) -{ - m_token = *p; -} - -// return the type of the token assicated with the instruction - -int CBotInstr::GetTokenType() -{ - return m_token.GetType(); -} - -// return associated token - -CBotToken* CBotInstr::GetToken() -{ - return &m_token; -} - -// adds the statement following the other - -void CBotInstr::AddNext(CBotInstr* n) -{ - CBotInstr* p = this; - while (p->m_next != nullptr) p = p->m_next; - p->m_next = n; -} - -void CBotInstr::AddNext3(CBotInstr* n) -{ - CBotInstr* p = this; - while (p->m_next3 != nullptr) p = p->m_next3; - p->m_next3 = n; -} - -void CBotInstr::AddNext3b(CBotInstr* n) -{ - CBotInstr* p = this; - while (p->m_next3b != nullptr) p = p->m_next3b; - p->m_next3b = n; -} - -// returns next statement - -CBotInstr* CBotInstr::GetNext() -{ - return m_next; -} - -CBotInstr* CBotInstr::GetNext3() -{ - return m_next3; -} - -CBotInstr* CBotInstr::GetNext3b() -{ - return m_next3b; -} - -/////////////////////////////////////////////////////////////////////////// -// compile an instruction which can be -// while, do, try, throw, if, for, switch, break, continue, return -// int, float, boolean, string, -// declaration of an instance of a class -// arbitrary expression - - -CBotInstr* CBotInstr::Compile(CBotToken* &p, CBotCStack* pStack) -{ - CBotToken* pp = p; - - if (p == nullptr) return nullptr; - - int type = p->GetType(); // what is the next token - - // is it a lable? - if (IsOfType(pp, TokenTypVar) && - IsOfType(pp, ID_DOTS)) - { - type = pp->GetType(); - // these instructions accept only lable - if (!IsOfTypeList(pp, ID_WHILE, ID_FOR, ID_DO, 0)) - { - pStack->SetError(TX_LABEL, pp->GetStart()); - return nullptr; - } - } - - // call routine corresponding to the compilation token found - switch (type) - { - case ID_WHILE: - return CBotWhile::Compile(p, pStack); - - case ID_FOR: - return CBotFor::Compile(p, pStack); - - case ID_DO: - return CBotDo::Compile(p, pStack); - - case ID_BREAK: - case ID_CONTINUE: - return CBotBreak::Compile(p, pStack); - - case ID_SWITCH: - return CBotSwitch::Compile(p, pStack); - - case ID_TRY: - return CBotTry::Compile(p, pStack); - - case ID_THROW: - return CBotThrow::Compile(p, pStack); - - case ID_INT: - return CBotInt::Compile(p, pStack); - - case ID_FLOAT: - return CBotFloat::Compile(p, pStack); - - case ID_STRING: - return CBotIString::Compile(p, pStack); - - case ID_BOOLEAN: - case ID_BOOL: - return CBotBoolean::Compile(p, pStack); - - case ID_IF: - return CBotIf::Compile(p, pStack); - - case ID_RETURN: - return CBotReturn::Compile(p, pStack); - - case ID_ELSE: - pStack->SetStartError(p->GetStart()); - pStack->SetError(TX_ELSEWITHOUTIF, p->GetEnd()); - return nullptr; - - case ID_CASE: - pStack->SetStartError(p->GetStart()); - pStack->SetError(TX_OUTCASE, p->GetEnd()); - return nullptr; - } - - pStack->SetStartError(p->GetStart()); - - // should not be a reserved word DefineNum - if (p->GetType() == TokenTypDef) - { - pStack->SetError(TX_RESERVED, p); - return nullptr; - } - - // this might be an instance of class definnition - CBotToken* ppp = p; - if (IsOfType(ppp, TokenTypVar)) - { - if (CBotClass::Find(p) != nullptr) - { - // yes, compiles the declaration of the instance - return CBotClassInst::Compile(p, pStack); - } - } - - // this can be an arythmetic instruction - CBotInstr* inst = CBotExpression::Compile(p, pStack); - if (IsOfType(p, ID_SEP)) - { - return inst; - } - pStack->SetError(TX_ENDOF, p->GetStart()); - delete inst; - return nullptr; -} - -bool CBotInstr::Execute(CBotStack* &pj) -{ - CBotString ClassManquante = name; - assert(0); // should never go through this routine - // but use the routines of the subclasses - return false; -} - -bool CBotInstr::Execute(CBotStack* &pj, CBotVar* pVar) -{ - if (!Execute(pj)) return false; - pVar->SetVal(pj->GetVar()); - return true; -} - -void CBotInstr::RestoreState(CBotStack* &pj, bool bMain) -{ - CBotString ClassManquante = name; - assert(0); // should never go through this routine - // but use the routines of the subclasses -} - - -bool CBotInstr::ExecuteVar(CBotVar* &pVar, CBotCStack* &pile) -{ - assert(0); // dad do not know, see the girls - return false; -} - -bool CBotInstr::ExecuteVar(CBotVar* &pVar, CBotStack* &pile, CBotToken* prevToken, bool bStep, bool bExtend) -{ - assert(0); // dad do not know, see the girls - return false; -} - -void CBotInstr::RestoreStateVar(CBotStack* &pile, bool bMain) -{ - assert(0); // dad do not know, see the girls -} - -// this routine is defined only for the subclass CBotCase -// this allows to make the call on all instructions CompCase -// to see if it's a case to the desired value. - -bool CBotInstr::CompCase(CBotStack* &pj, int val) -{ - return false; -} - -CBotInstr* CBotInstr::CompileArray(CBotToken* &p, CBotCStack* pStack, CBotTypResult type, bool first) -{ - if (IsOfType(p, ID_OPBRK)) - { - if (!IsOfType(p, ID_CLBRK)) - { - pStack->SetError(TX_CLBRK, p->GetStart()); - return nullptr; - } - - CBotInstr* inst = CompileArray(p, pStack, CBotTypResult(CBotTypArrayPointer, type), false); - if (inst != nullptr || !pStack->IsOk()) return inst; - } - - // compiles an array declaration - if (first) return nullptr ; - - CBotInstr* inst = CBotInstArray::Compile(p, pStack, type); - if (inst == nullptr) return nullptr; - - if (IsOfType(p, ID_COMMA)) // several definitions - { - if (nullptr != ( inst->m_next2b = CBotInstArray::CompileArray(p, pStack, type, false))) // compiles next one - { - return inst; - } - delete inst; - return nullptr; - } - - if (IsOfType(p, ID_SEP)) // end of instruction - { - return inst; - } - - delete inst; - pStack->SetError(TX_ENDOF, p->GetStart()); - return nullptr; -} - ////////////////////////////////////////////////////////////////////////////////////////// // compile a list of parameters diff --git a/src/CBot/CBot.h b/src/CBot/CBot.h index e42d185..71c2279 100644 --- a/src/CBot/CBot.h +++ b/src/CBot/CBot.h @@ -54,96 +54,6 @@ class CBotDefParam; // paramerer list of a function extern bool SaveVar(FILE* pf, CBotVar* pVar); - -///////////////////////////////////////////////////////////////////// -// class defining an instruction -class CBotInstr -{ -private: - static - CBotStringArray - m_labelLvl; -protected: - CBotToken m_token; // keeps the token - CBotString name; // debug - CBotInstr* m_next; // linked command - CBotInstr* m_next2b; // second list definition chain - CBotInstr* m_next3; // third list for indices and fields - CBotInstr* m_next3b; // necessary for reporting tables -/* - for example, the following program - int x[]; x[1] = 4; - int y[x[1]][10], z; - is generated - CBotInstrArray - m_next3b-> CBotEmpty - m_next-> - CBotExpression .... - m_next-> - CBotInstrArray - m_next3b-> CBotExpression ('x') ( m_next3-> CBotIndexExpr ('1') ) - m_next3b-> CBotExpression ('10') - m_next2-> 'z' - m_next->... - -*/ - - static - int m_LoopLvl; - friend class CBotClassInst; - friend class CBotInt; - friend class CBotListArray; - -public: - CBotInstr(); - virtual - ~CBotInstr(); - - static - CBotInstr* Compile(CBotToken* &p, CBotCStack* pStack); - static - CBotInstr* CompileArray(CBotToken* &p, CBotCStack* pStack, CBotTypResult type, bool first = true); - - virtual - bool Execute(CBotStack* &pj); - virtual - bool Execute(CBotStack* &pj, CBotVar* pVar); - virtual - void RestoreState(CBotStack* &pj, bool bMain); - - virtual - bool ExecuteVar(CBotVar* &pVar, CBotCStack* &pile); - virtual - bool ExecuteVar(CBotVar* &pVar, CBotStack* &pile, CBotToken* prevToken, bool bStep, bool bExtend); - virtual - void RestoreStateVar(CBotStack* &pile, bool bMain); - - virtual - bool CompCase(CBotStack* &pj, int val); - - void SetToken(CBotToken* p); - int GetTokenType(); - CBotToken* GetToken(); - - void AddNext(CBotInstr* n); - CBotInstr* GetNext(); - void AddNext3(CBotInstr* n); - CBotInstr* GetNext3(); - void AddNext3b(CBotInstr* n); - CBotInstr* GetNext3b(); - - static - void IncLvl(CBotString& label); - static - void IncLvl(); - static - void DecLvl(); - static - bool ChkLvl(const CBotString& label, int type); - - bool IsOfClass(CBotString name); -}; - #define MAX(a,b) ((a>b) ? a : b) extern CBotInstr* CompileParams(CBotToken* &p, CBotCStack* pStack, CBotVar** ppVars); diff --git a/src/CBot/CBotDefines.h b/src/CBot/CBotDefines.h index d09e3ca..ae72dbb 100644 --- a/src/CBot/CBotDefines.h +++ b/src/CBot/CBotDefines.h @@ -21,6 +21,8 @@ // Modules inlcude +#include "CBotInstr.h" + // Local include // Global include diff --git a/src/CBot/CBotInstr/CBotBlock.h b/src/CBot/CBotInstr/CBotBlock.h index f413e75..6c7c633 100644 --- a/src/CBot/CBotInstr/CBotBlock.h +++ b/src/CBot/CBotInstr/CBotBlock.h @@ -22,6 +22,8 @@ // Modules inlcude #include "CBot.h" +#include "CBotInstr.h" + // Local include // Global include diff --git a/src/CBot/CBotInstr/CBotBoolExpr.h b/src/CBot/CBotInstr/CBotBoolExpr.h index df7354e..e50d8a6 100644 --- a/src/CBot/CBotInstr/CBotBoolExpr.h +++ b/src/CBot/CBotInstr/CBotBoolExpr.h @@ -22,6 +22,8 @@ // Modules inlcude #include "CBot.h" +#include "CBotInstr.h" + // Local include // Global include diff --git a/src/CBot/CBotInstr/CBotBoolean.h b/src/CBot/CBotInstr/CBotBoolean.h index 5767420..217daad 100644 --- a/src/CBot/CBotInstr/CBotBoolean.h +++ b/src/CBot/CBotInstr/CBotBoolean.h @@ -22,6 +22,8 @@ // Modules inlcude #include "CBot.h" +#include "CBotInstr.h" + // Local include // Global include diff --git a/src/CBot/CBotInstr/CBotBreak.h b/src/CBot/CBotInstr/CBotBreak.h index 0ad3940..ae35a70 100644 --- a/src/CBot/CBotInstr/CBotBreak.h +++ b/src/CBot/CBotInstr/CBotBreak.h @@ -22,6 +22,8 @@ // Modules inlcude #include "CBot.h" +#include "CBotInstr.h" + // Local include // Global include diff --git a/src/CBot/CBotInstr/CBotCase.h b/src/CBot/CBotInstr/CBotCase.h index 9ba1b86..e504333 100644 --- a/src/CBot/CBotInstr/CBotCase.h +++ b/src/CBot/CBotInstr/CBotCase.h @@ -22,6 +22,8 @@ // Modules inlcude #include "CBot.h" +#include "CBotInstr.h" + // Local include // Global include diff --git a/src/CBot/CBotInstr/CBotCatch.h b/src/CBot/CBotInstr/CBotCatch.h index 9756c8b..d4450ec 100644 --- a/src/CBot/CBotInstr/CBotCatch.h +++ b/src/CBot/CBotInstr/CBotCatch.h @@ -22,6 +22,8 @@ // Modules inlcude #include "CBot.h" +#include "CBotInstr.h" + // Local include // Global include diff --git a/src/CBot/CBotInstr/CBotClassInst.h b/src/CBot/CBotInstr/CBotClassInst.h index 370a46c..3ee791f 100644 --- a/src/CBot/CBotInstr/CBotClassInst.h +++ b/src/CBot/CBotInstr/CBotClassInst.h @@ -22,6 +22,8 @@ // Modules inlcude #include "CBot.h" +#include "CBotInstr.h" + // Local include // Global include diff --git a/src/CBot/CBotInstr/CBotCondition.h b/src/CBot/CBotInstr/CBotCondition.h index 08996db..3958cad 100644 --- a/src/CBot/CBotInstr/CBotCondition.h +++ b/src/CBot/CBotInstr/CBotCondition.h @@ -22,6 +22,8 @@ // Modules inlcude #include "CBot.h" +#include "CBotInstr.h" + // Local include // Global include diff --git a/src/CBot/CBotInstr/CBotDo.h b/src/CBot/CBotInstr/CBotDo.h index 670a070..11fe40f 100644 --- a/src/CBot/CBotInstr/CBotDo.h +++ b/src/CBot/CBotInstr/CBotDo.h @@ -22,6 +22,8 @@ // Modules inlcude #include "CBot.h" +#include "CBotInstr.h" + // Local include // Global include diff --git a/src/CBot/CBotInstr/CBotEmpty.h b/src/CBot/CBotInstr/CBotEmpty.h index 04f9faf..dc50b49 100644 --- a/src/CBot/CBotInstr/CBotEmpty.h +++ b/src/CBot/CBotInstr/CBotEmpty.h @@ -22,6 +22,8 @@ // Modules inlcude #include "CBot.h" +#include "CBotInstr.h" + // Local include // Global include diff --git a/src/CBot/CBotInstr/CBotExprAlpha.h b/src/CBot/CBotInstr/CBotExprAlpha.h index 3f82060..3cadc32 100644 --- a/src/CBot/CBotInstr/CBotExprAlpha.h +++ b/src/CBot/CBotInstr/CBotExprAlpha.h @@ -22,6 +22,8 @@ // Modules inlcude #include "CBot.h" +#include "CBotInstr.h" + // Local include // Global include diff --git a/src/CBot/CBotInstr/CBotExprBool.h b/src/CBot/CBotInstr/CBotExprBool.h index a2609e2..90f53da 100644 --- a/src/CBot/CBotInstr/CBotExprBool.h +++ b/src/CBot/CBotInstr/CBotExprBool.h @@ -22,6 +22,8 @@ // Modules inlcude #include "CBot.h" +#include "CBotInstr.h" + // Local include // Global include diff --git a/src/CBot/CBotInstr/CBotExprNan.h b/src/CBot/CBotInstr/CBotExprNan.h index 0d6bbf6..1f0d58d 100644 --- a/src/CBot/CBotInstr/CBotExprNan.h +++ b/src/CBot/CBotInstr/CBotExprNan.h @@ -22,6 +22,8 @@ // Modules inlcude #include "CBot.h" +#include "CBotInstr.h" + // Local include // Global include diff --git a/src/CBot/CBotInstr/CBotExprNull.h b/src/CBot/CBotInstr/CBotExprNull.h index 187cb26..90b3f89 100644 --- a/src/CBot/CBotInstr/CBotExprNull.h +++ b/src/CBot/CBotInstr/CBotExprNull.h @@ -22,6 +22,8 @@ // Modules inlcude #include "CBot.h" +#include "CBotInstr.h" + // Local include // Global include diff --git a/src/CBot/CBotInstr/CBotExprNum.h b/src/CBot/CBotInstr/CBotExprNum.h index dc21331..07fca7e 100644 --- a/src/CBot/CBotInstr/CBotExprNum.h +++ b/src/CBot/CBotInstr/CBotExprNum.h @@ -22,6 +22,8 @@ // Modules inlcude #include "CBot.h" +#include "CBotInstr.h" + // Local include // Global include diff --git a/src/CBot/CBotInstr/CBotExprUnaire.h b/src/CBot/CBotInstr/CBotExprUnaire.h index 25d2125..75b30a9 100644 --- a/src/CBot/CBotInstr/CBotExprUnaire.h +++ b/src/CBot/CBotInstr/CBotExprUnaire.h @@ -22,6 +22,8 @@ // Modules inlcude #include "CBot.h" +#include "CBotInstr.h" + // Local include // Global include diff --git a/src/CBot/CBotInstr/CBotExprVar.h b/src/CBot/CBotInstr/CBotExprVar.h index a453565..638cf8f 100644 --- a/src/CBot/CBotInstr/CBotExprVar.h +++ b/src/CBot/CBotInstr/CBotExprVar.h @@ -24,6 +24,8 @@ #include "CBotDefines.h" +#include "CBotInstr.h" + // Local include // Global include diff --git a/src/CBot/CBotInstr/CBotExpression.h b/src/CBot/CBotInstr/CBotExpression.h index d25fd39..ddf2e25 100644 --- a/src/CBot/CBotInstr/CBotExpression.h +++ b/src/CBot/CBotInstr/CBotExpression.h @@ -21,8 +21,11 @@ // Modules inlcude #include "CBot.h" + #include "CBotLeftExpr.h" +#include "CBotInstr.h" + // Local include // Global include diff --git a/src/CBot/CBotInstr/CBotFieldExpr.h b/src/CBot/CBotInstr/CBotFieldExpr.h index 13f9fc3..41e828b 100644 --- a/src/CBot/CBotInstr/CBotFieldExpr.h +++ b/src/CBot/CBotInstr/CBotFieldExpr.h @@ -22,6 +22,8 @@ // Modules inlcude #include "CBot.h" +#include "CBotInstr.h" + // Local include // Global include diff --git a/src/CBot/CBotInstr/CBotFloat.h b/src/CBot/CBotInstr/CBotFloat.h index 6223071..309697b 100644 --- a/src/CBot/CBotInstr/CBotFloat.h +++ b/src/CBot/CBotInstr/CBotFloat.h @@ -22,6 +22,8 @@ // Modules inlcude #include "CBot.h" +#include "CBotInstr.h" + // Local include // Global include diff --git a/src/CBot/CBotInstr/CBotFor.h b/src/CBot/CBotInstr/CBotFor.h index 01edc66..d7d4256 100644 --- a/src/CBot/CBotInstr/CBotFor.h +++ b/src/CBot/CBotInstr/CBotFor.h @@ -22,6 +22,8 @@ // Modules inlcude #include "CBot.h" +#include "CBotInstr.h" + // Local include // Global include diff --git a/src/CBot/CBotInstr/CBotFunction.h b/src/CBot/CBotInstr/CBotFunction.h index 486ffff..f1fc3c8 100644 --- a/src/CBot/CBotInstr/CBotFunction.h +++ b/src/CBot/CBotInstr/CBotFunction.h @@ -22,6 +22,8 @@ // Modules inlcude #include "CBot.h" +#include "CBotInstr.h" + // Local include // Global include diff --git a/src/CBot/CBotInstr/CBotIString.h b/src/CBot/CBotInstr/CBotIString.h index 1d91ea2..2ea8e4e 100644 --- a/src/CBot/CBotInstr/CBotIString.h +++ b/src/CBot/CBotInstr/CBotIString.h @@ -22,6 +22,8 @@ // Modules inlcude #include "CBot.h" +#include "CBotInstr.h" + // Local include // Global include diff --git a/src/CBot/CBotInstr/CBotIf.h b/src/CBot/CBotInstr/CBotIf.h index 6ea6ee9..e39e522 100644 --- a/src/CBot/CBotInstr/CBotIf.h +++ b/src/CBot/CBotInstr/CBotIf.h @@ -22,6 +22,8 @@ // Modules inlcude #include "CBot.h" +#include "CBotInstr.h" + // Local include // Global include diff --git a/src/CBot/CBotInstr/CBotIndexExpr.h b/src/CBot/CBotInstr/CBotIndexExpr.h index 730a4de..a8e7e07 100644 --- a/src/CBot/CBotInstr/CBotIndexExpr.h +++ b/src/CBot/CBotInstr/CBotIndexExpr.h @@ -22,6 +22,8 @@ // Modules inlcude #include "CBot.h" +#include "CBotInstr.h" + // Local include // Global include diff --git a/src/CBot/CBotInstr/CBotInstArray.h b/src/CBot/CBotInstr/CBotInstArray.h index ca2cbe0..4ad025d 100644 --- a/src/CBot/CBotInstr/CBotInstArray.h +++ b/src/CBot/CBotInstr/CBotInstArray.h @@ -22,6 +22,8 @@ // Modules inlcude #include "CBot.h" +#include "CBotInstr.h" + // Local include // Global include diff --git a/src/CBot/CBot.cpp b/src/CBot/CBotInstr/CBotInstr.cpp similarity index 53% copy from src/CBot/CBot.cpp copy to src/CBot/CBotInstr/CBotInstr.cpp index 1c8b437..7d376f7 100644 --- a/src/CBot/CBot.cpp +++ b/src/CBot/CBotInstr/CBotInstr.cpp @@ -17,73 +17,42 @@ * along with this program. If not, see http://gnu.org/licenses */ -/////////////////////////////////////////////////////////////////////// - -// compilation of various instructions -// compile all routines as static -// and return an object according to what was found as instruction - -// compiler principle: -// compile the routines return an object of the class corresponding to the operation found -// this is always a subclass of CBotInstr. -// (CBotInstr objects are never used directly) - - -// compiles if the routine returns nullptr is that the statement is false -// or misunderstood. -// the error is then on the stack CBotCStack :: Isok () is false - - // Modules inlcude -#include "CBot.h" -#include "CBotInstr/CBotDo.h" +#include "CBotInstr.h" + #include "CBotInstr/CBotFor.h" -#include "CBotInstr/CBotSwitch.h" +#include "CBotInstr/CBotDo.h" #include "CBotInstr/CBotBreak.h" +#include "CBotInstr/CBotSwitch.h" #include "CBotInstr/CBotTry.h" #include "CBotInstr/CBotThrow.h" +#include "CBotInstr/CBotInt.h" +#include "CBotInstr/CBotFloat.h" #include "CBotInstr/CBotWhile.h" -#include "CBotInstr/CBotExprAlpha.h" -#include "CBotInstr/CBotExprNum.h" -#include "CBotInstr/CBotNew.h" -#include "CBotInstr/CBotExprNan.h" -#include "CBotInstr/CBotExprNull.h" -#include "CBotInstr/CBotExprBool.h" -#include "CBotInstr/CBotLeftExprVar.h" -#include "CBotInstr/CBotPreIncExpr.h" -#include "CBotInstr/CBotPostIncExpr.h" -#include "CBotInstr/CBotExprVar.h" -#include "CBotInstr/CBotInstrCall.h" -#include "CBotInstr/CBotListInstr.h" -#include "CBotInstr/CBotExprUnaire.h" -#include "CBotInstr/CBotBoolExpr.h" -#include "CBotInstr/CBotTwoOpExpr.h" -#include "CBotInstr/CBotExpression.h" -#include "CBotInstr/CBotIndexExpr.h" -#include "CBotInstr/CBotFieldExpr.h" -#include "CBotInstr/CBotClassInst.h" #include "CBotInstr/CBotIString.h" -#include "CBotInstr/CBotFloat.h" #include "CBotInstr/CBotBoolean.h" -#include "CBotInstr/CBotEmpty.h" -#include "CBotInstr/CBotReturn.h" #include "CBotInstr/CBotIf.h" -#include "CBotInstr/CBotListArray.h" +#include "CBotInstr/CBotReturn.h" +#include "CBotInstr/CBotClassInst.h" +#include "CBotInstr/CBotExpression.h" #include "CBotInstr/CBotInstArray.h" -#include "CBotInstr/CBotInt.h" -#include "CBotStack.h" -#include "CBotCStack.h" +#include "CBotVar/CBotVar.h" + #include "CBotClass.h" +#include "CBotStack.h" -#include "CBotVar/CBotVar.h" // Local include // Global include #include <cassert> +//////////////////////////////////////////////////////////////////////////////// +int CBotInstr::m_LoopLvl = 0; +CBotStringArray CBotInstr::m_labelLvl = CBotStringArray(); +//////////////////////////////////////////////////////////////////////////////// CBotInstr::CBotInstr() { name = "CBotInstr"; @@ -93,6 +62,7 @@ CBotInstr::CBotInstr() m_next3b = nullptr; } +//////////////////////////////////////////////////////////////////////////////// CBotInstr::~CBotInstr() { delete m_next; @@ -101,15 +71,7 @@ CBotInstr::~CBotInstr() delete m_next3b; } -// counter of nested loops, -// to determine the break and continue valid -// list of labels used - - -int CBotInstr::m_LoopLvl = 0; -CBotStringArray CBotInstr::m_labelLvl = CBotStringArray(); - -// adds a level with a label +//////////////////////////////////////////////////////////////////////////////// void CBotInstr::IncLvl(CBotString& label) { m_labelLvl.SetSize(m_LoopLvl+1); @@ -117,7 +79,7 @@ void CBotInstr::IncLvl(CBotString& label) m_LoopLvl++; } -// adds a level (switch statement) +//////////////////////////////////////////////////////////////////////////////// void CBotInstr::IncLvl() { m_labelLvl.SetSize(m_LoopLvl+1); @@ -125,14 +87,14 @@ void CBotInstr::IncLvl() m_LoopLvl++; } -// free a level +//////////////////////////////////////////////////////////////////////////////// void CBotInstr::DecLvl() { m_LoopLvl--; m_labelLvl[m_LoopLvl].Empty(); } -// control validity of break and continue +//////////////////////////////////////////////////////////////////////////////// bool CBotInstr::ChkLvl(const CBotString& label, int type) { int i = m_LoopLvl; @@ -145,38 +107,31 @@ bool CBotInstr::ChkLvl(const CBotString& label, int type) return false; } +//////////////////////////////////////////////////////////////////////////////// bool CBotInstr::IsOfClass(CBotString n) { return name == n; } - -//////////////////////////////////////////////////////////////////////////// -// database management class CBotInstr - -// set the token corresponding to the instruction - +//////////////////////////////////////////////////////////////////////////////// void CBotInstr::SetToken(CBotToken* p) { m_token = *p; } -// return the type of the token assicated with the instruction - +//////////////////////////////////////////////////////////////////////////////// int CBotInstr::GetTokenType() { return m_token.GetType(); } -// return associated token - +//////////////////////////////////////////////////////////////////////////////// CBotToken* CBotInstr::GetToken() { return &m_token; } -// adds the statement following the other - +//////////////////////////////////////////////////////////////////////////////// void CBotInstr::AddNext(CBotInstr* n) { CBotInstr* p = this; @@ -184,6 +139,7 @@ void CBotInstr::AddNext(CBotInstr* n) p->m_next = n; } +//////////////////////////////////////////////////////////////////////////////// void CBotInstr::AddNext3(CBotInstr* n) { CBotInstr* p = this; @@ -191,6 +147,7 @@ void CBotInstr::AddNext3(CBotInstr* n) p->m_next3 = n; } +//////////////////////////////////////////////////////////////////////////////// void CBotInstr::AddNext3b(CBotInstr* n) { CBotInstr* p = this; @@ -198,31 +155,25 @@ void CBotInstr::AddNext3b(CBotInstr* n) p->m_next3b = n; } -// returns next statement - +//////////////////////////////////////////////////////////////////////////////// CBotInstr* CBotInstr::GetNext() { return m_next; } +//////////////////////////////////////////////////////////////////////////////// CBotInstr* CBotInstr::GetNext3() { return m_next3; } +//////////////////////////////////////////////////////////////////////////////// CBotInstr* CBotInstr::GetNext3b() { return m_next3b; } -/////////////////////////////////////////////////////////////////////////// -// compile an instruction which can be -// while, do, try, throw, if, for, switch, break, continue, return -// int, float, boolean, string, -// declaration of an instance of a class -// arbitrary expression - - +//////////////////////////////////////////////////////////////////////////////// CBotInstr* CBotInstr::Compile(CBotToken* &p, CBotCStack* pStack) { CBotToken* pp = p; @@ -330,6 +281,7 @@ CBotInstr* CBotInstr::Compile(CBotToken* &p, CBotCStack* pStack) return nullptr; } +//////////////////////////////////////////////////////////////////////////////// bool CBotInstr::Execute(CBotStack* &pj) { CBotString ClassManquante = name; @@ -338,6 +290,7 @@ bool CBotInstr::Execute(CBotStack* &pj) return false; } +//////////////////////////////////////////////////////////////////////////////// bool CBotInstr::Execute(CBotStack* &pj, CBotVar* pVar) { if (!Execute(pj)) return false; @@ -345,6 +298,7 @@ bool CBotInstr::Execute(CBotStack* &pj, CBotVar* pVar) return true; } +//////////////////////////////////////////////////////////////////////////////// void CBotInstr::RestoreState(CBotStack* &pj, bool bMain) { CBotString ClassManquante = name; @@ -352,33 +306,33 @@ void CBotInstr::RestoreState(CBotStack* &pj, bool bMain) // but use the routines of the subclasses } - +//////////////////////////////////////////////////////////////////////////////// bool CBotInstr::ExecuteVar(CBotVar* &pVar, CBotCStack* &pile) { assert(0); // dad do not know, see the girls return false; } +//////////////////////////////////////////////////////////////////////////////// bool CBotInstr::ExecuteVar(CBotVar* &pVar, CBotStack* &pile, CBotToken* prevToken, bool bStep, bool bExtend) { assert(0); // dad do not know, see the girls return false; } +//////////////////////////////////////////////////////////////////////////////// void CBotInstr::RestoreStateVar(CBotStack* &pile, bool bMain) { assert(0); // dad do not know, see the girls } -// this routine is defined only for the subclass CBotCase -// this allows to make the call on all instructions CompCase -// to see if it's a case to the desired value. - +//////////////////////////////////////////////////////////////////////////////// bool CBotInstr::CompCase(CBotStack* &pj, int val) { return false; } +//////////////////////////////////////////////////////////////////////////////// CBotInstr* CBotInstr::CompileArray(CBotToken* &p, CBotCStack* pStack, CBotTypResult type, bool first) { if (IsOfType(p, ID_OPBRK)) @@ -418,183 +372,3 @@ CBotInstr* CBotInstr::CompileArray(CBotToken* &p, CBotCStack* pStack, CBotTypRes pStack->SetError(TX_ENDOF, p->GetStart()); return nullptr; } - -////////////////////////////////////////////////////////////////////////////////////////// - -// compile a list of parameters - -CBotInstr* CompileParams(CBotToken* &p, CBotCStack* pStack, CBotVar** ppVars) -{ - bool first = true; - CBotInstr* ret = nullptr; // to return to the list - - CBotCStack* pile = pStack; - int i = 0; - - if (IsOfType(p, ID_OPENPAR)) - { - int start, end; - if (!IsOfType(p, ID_CLOSEPAR)) while (true) - { - start = p->GetStart(); - pile = pile->TokenStack(); // keeps the result on the stack - - if (first) pStack->SetStartError(start); - first = false; - - CBotInstr* param = CBotExpression::Compile(p, pile); - end = p->GetStart(); - - if (!pile->IsOk()) - { - return pStack->Return(nullptr, pile); - } - - if (ret == nullptr) ret = param; - else ret->AddNext(param); // construct the list - - if (param != nullptr) - { - if (pile->GetTypResult().Eq(99)) - { - delete pStack->TokenStack(); - pStack->SetError(TX_VOID, p->GetStart()); - return nullptr; - } - ppVars[i] = pile->GetVar(); - ppVars[i]->GetToken()->SetPos(start, end); - i++; - - if (IsOfType(p, ID_COMMA)) continue; // skips the comma - if (IsOfType(p, ID_CLOSEPAR)) break; - } - - pStack->SetError(TX_CLOSEPAR, p->GetStart()); - delete pStack->TokenStack(); - return nullptr; - } - } - ppVars[i] = nullptr; - return ret; -} - -///////////////////////////////////////////////////////////// -// check if two results are consistent to make an operation - -bool TypeCompatible(CBotTypResult& type1, CBotTypResult& type2, int op) -{ - int t1 = type1.GetType(); - int t2 = type2.GetType(); - - int max = (t1 > t2) ? t1 : t2; - - if (max == 99) return false; // result is void? - - // special case for strin concatenation - if (op == ID_ADD && max >= CBotTypString) return true; - if (op == ID_ASSADD && max >= CBotTypString) return true; - if (op == ID_ASS && t1 == CBotTypString) return true; - - if (max >= CBotTypBoolean) - { - if ( (op == ID_EQ || op == ID_NE) && - (t1 == CBotTypPointer && t2 == CBotTypNullPointer)) return true; - if ( (op == ID_EQ || op == ID_NE || op == ID_ASS) && - (t2 == CBotTypPointer && t1 == CBotTypNullPointer)) return true; - if ( (op == ID_EQ || op == ID_NE) && - (t1 == CBotTypArrayPointer && t2 == CBotTypNullPointer)) return true; - if ( (op == ID_EQ || op == ID_NE || op == ID_ASS) && - (t2 == CBotTypArrayPointer && t1 == CBotTypNullPointer)) return true; - if (t2 != t1) return false; - if (t1 == CBotTypArrayPointer) return type1.Compare(type2); - if (t1 == CBotTypPointer || - t1 == CBotTypClass || - t1 == CBotTypIntrinsic ) - { - CBotClass* c1 = type1.GetClass(); - CBotClass* c2 = type2.GetClass(); - - return c1->IsChildOf(c2) || c2->IsChildOf(c1); - // accept the case in reverse - // the transaction will be denied at runtime if the pointer is not - // compatible - } - - return true; - } - - type1.SetType(max); - type2.SetType(max); - return true; -} - -// check if two variables are compatible for parameter passing - -bool TypesCompatibles(const CBotTypResult& type1, const CBotTypResult& type2) -{ - int t1 = type1.GetType(); - int t2 = type2.GetType(); - - if (t1 == CBotTypIntrinsic) t1 = CBotTypClass; - if (t2 == CBotTypIntrinsic) t2 = CBotTypClass; - - int max = (t1 > t2) ? t1 : t2; - - if (max == 99) return false; // result is void? - - if (max >= CBotTypBoolean) - { - if (t2 != t1) return false; - - if (max == CBotTypArrayPointer) - return TypesCompatibles(type1.GetTypElem(), type2.GetTypElem()); - - if (max == CBotTypClass || max == CBotTypPointer) - return type1.GetClass() == type2.GetClass() ; - - return true ; - } - return true; -} - - -///////////////////////////////////////////////////////////////////////////////////// -// file management - -// necessary because it is not possible to do the fopen in the main program -// fwrite and fread in a dll or using the FILE * returned. - - -FILE* fOpen(const char* name, const char* mode) -{ - return fopen(name, mode); -} - -int fClose(FILE* filehandle) -{ - return fclose(filehandle); -} - -size_t fWrite(const void *buffer, size_t elemsize, size_t length, FILE* filehandle) -{ - return fwrite(buffer, elemsize, length, filehandle); -} - -size_t fRead(void *buffer, size_t elemsize, size_t length, FILE* filehandle) -{ - return fread(buffer, elemsize, length, filehandle); -} - -size_t fWrite(const void *buffer, size_t length, FILE* filehandle) -{ - return fwrite(buffer, 1, length, filehandle); -} - -size_t fRead(void *buffer, size_t length, FILE* filehandle) -{ - return fread(buffer, 1, length, filehandle); -} - - -//////////////////////////////////////// - diff --git a/src/CBot/CBotInstr/CBotInstr.h b/src/CBot/CBotInstr/CBotInstr.h new file mode 100644 index 0000000..1f25115 --- /dev/null +++ b/src/CBot/CBotInstr/CBotInstr.h @@ -0,0 +1,266 @@ +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2015, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsitec.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ + +#pragma once + +// Modules inlcude +#include "CBotToken.h" + +#include "CBotCStack.h" + +// Local include + +// Global include + +/* + for example, the following program + int x[]; x[1] = 4; + int y[x[1]][10], z; + is generated + CBotInstrArray + m_next3b-> CBotEmpty + m_next-> + CBotExpression .... + m_next-> + CBotInstrArray + m_next3b-> CBotExpression ('x') ( m_next3-> CBotIndexExpr ('1') ) + m_next3b-> CBotExpression ('10') + m_next2-> 'z' + m_next->... + +*/ +/*! + * \brief The CBotInstr class Class defining an instruction. + */ +class CBotInstr +{ +public: + + /*! + * \brief CBotInstr + */ + CBotInstr(); + + /*! + * \brief ~CBotInstr + */ + virtual ~CBotInstr(); + + /*! + * \brief Compile Compile an instruction which can be while, do, try, + * throw, if, for, switch, break, continue, return, int, float, boolean, + * string, declaration of an instance of a class, arbitrary expression. + * \param p + * \param pStack + * \return + */ + static CBotInstr* Compile(CBotToken* &p, + CBotCStack* pStack); + + /*! + * \brief CompileArray + * \param p + * \param pStack + * \param type + * \param first + * \return + */ + static CBotInstr* CompileArray(CBotToken* &p, + CBotCStack* pStack, + CBotTypResult type, + bool first = true); + + /*! + * \brief Execute + * \param pj + * \return + */ + virtual bool Execute(CBotStack* &pj); + + /*! + * \brief Execute + * \param pj + * \param pVar + * \return + */ + virtual bool Execute(CBotStack* &pj, + CBotVar* pVar); + + /*! + * \brief RestoreState + * \param pj + * \param bMain + */ + virtual void RestoreState(CBotStack* &pj, + bool bMain); + + /*! + * \brief ExecuteVar + * \param pVar + * \param pile + * \return + */ + virtual bool ExecuteVar(CBotVar* &pVar, + CBotCStack* &pile); + + /*! + * \brief ExecuteVar + * \param pVar + * \param pile + * \param prevToken + * \param bStep + * \param bExtend + * \return + */ + virtual bool ExecuteVar(CBotVar* &pVar, + CBotStack* &pile, + CBotToken* prevToken, + bool bStep, + bool bExtend); + + /*! + * \brief RestoreStateVar + * \param pile + * \param bMain + */ + virtual void RestoreStateVar(CBotStack* &pile, + bool bMain); + + /*! + * \brief CompCase This routine is defined only for the subclass CBotCase + * this allows to make the call on all instructions CompCase to see if it's + * a case to the desired value.. + * \param pj + * \param val + * \return + */ + virtual bool CompCase(CBotStack* &pj, + int val); + + /*! + * \brief SetToken Set the token corresponding to the instruction. + * \param p + */ + void SetToken(CBotToken* p); + + /*! + * \brief GetTokenType Return the type of the token assicated with the + * instruction. + * \return + */ + int GetTokenType(); + + /*! + * \brief GetToken Return associated token. + * \return + */ + CBotToken* GetToken(); + + /*! + * \brief AddNext Adds the statement following the other. + * \param n + */ + void AddNext(CBotInstr* n); + + /*! + * \brief GetNext Returns next statement. + * \return + */ + CBotInstr* GetNext(); + + /*! + * \brief AddNext3 + * \param n + */ + void AddNext3(CBotInstr* n); + + /*! + * \brief GetNext3 + * \return + */ + CBotInstr* GetNext3(); + + /*! + * \brief AddNext3b + * \param n + */ + void AddNext3b(CBotInstr* n); + + /*! + * \brief GetNext3b + * \return + */ + CBotInstr* GetNext3b(); + + /*! + * \brief IncLvl Adds a level with a label. + * \param label + */ + static void IncLvl(CBotString& label); + + /*! + * \brief IncLvl Adds a level (switch statement). + */ + static void IncLvl(); + + /*! + * \brief DecLvl Free a level. + */ + static void DecLvl(); + + /*! + * \brief ChkLvl Control validity of break and continue. + * \param label + * \param type + * \return + */ + static bool ChkLvl(const CBotString& label, int type); + + /*! + * \brief IsOfClass + * \param name + * \return + */ + bool IsOfClass(CBotString name); + +protected: + + //! Keeps the token. + CBotToken m_token; + //! Debug. + CBotString name; + //! Linked command. + CBotInstr* m_next; + //! Second list definition chain. + CBotInstr* m_next2b; + //! Third list for indices and fields. + CBotInstr* m_next3; + //! Necessary for reporting tables. + CBotInstr* m_next3b; + + //! Counter of nested loops, to determine the break and continue valid. + static int m_LoopLvl; + friend class CBotClassInst; + friend class CBotInt; + friend class CBotListArray; + +private: + //! List of labels used. + static CBotStringArray m_labelLvl; +}; diff --git a/src/CBot/CBotInstr/CBotInstrCall.h b/src/CBot/CBotInstr/CBotInstrCall.h index 7e194f8..fa634fe 100644 --- a/src/CBot/CBotInstr/CBotInstrCall.h +++ b/src/CBot/CBotInstr/CBotInstrCall.h @@ -22,6 +22,8 @@ // Modules inlcude #include "CBot.h" +#include "CBotInstr.h" + // Local include // Global include diff --git a/src/CBot/CBotInstr/CBotInstrMethode.h b/src/CBot/CBotInstr/CBotInstrMethode.h index ca4ad90..ea39811 100644 --- a/src/CBot/CBotInstr/CBotInstrMethode.h +++ b/src/CBot/CBotInstr/CBotInstrMethode.h @@ -22,6 +22,8 @@ // Modules inlcude #include "CBot.h" +#include "CBotInstr.h" + // Local include // Global include diff --git a/src/CBot/CBotInstr/CBotInt.h b/src/CBot/CBotInstr/CBotInt.h index 702f529..085e626 100644 --- a/src/CBot/CBotInstr/CBotInt.h +++ b/src/CBot/CBotInstr/CBotInt.h @@ -22,6 +22,8 @@ // Modules inlcude #include "CBot.h" +#include "CBotInstr.h" + // Local include // Global include diff --git a/src/CBot/CBotInstr/CBotLeftExpr.h b/src/CBot/CBotInstr/CBotLeftExpr.h index f0dba0b..aaf9ee4 100644 --- a/src/CBot/CBotInstr/CBotLeftExpr.h +++ b/src/CBot/CBotInstr/CBotLeftExpr.h @@ -22,6 +22,8 @@ // Modules inlcude #include "CBot.h" +#include "CBotInstr.h" + // Local include // Global include diff --git a/src/CBot/CBotInstr/CBotLeftExprVar.h b/src/CBot/CBotInstr/CBotLeftExprVar.h index a264dba..fd69372 100644 --- a/src/CBot/CBotInstr/CBotLeftExprVar.h +++ b/src/CBot/CBotInstr/CBotLeftExprVar.h @@ -22,6 +22,8 @@ // Modules inlcude #include "CBot.h" +#include "CBotInstr.h" + // Local include // Global include diff --git a/src/CBot/CBotInstr/CBotListArray.h b/src/CBot/CBotInstr/CBotListArray.h index 921273d..586cc86 100644 --- a/src/CBot/CBotInstr/CBotListArray.h +++ b/src/CBot/CBotInstr/CBotListArray.h @@ -22,6 +22,8 @@ // Modules inlcude #include "CBot.h" +#include "CBotInstr.h" + // Local include // Global include diff --git a/src/CBot/CBotInstr/CBotListExpression.h b/src/CBot/CBotInstr/CBotListExpression.h index c4e6711..451b218 100644 --- a/src/CBot/CBotInstr/CBotListExpression.h +++ b/src/CBot/CBotInstr/CBotListExpression.h @@ -22,6 +22,8 @@ // Modules inlcude #include "CBot.h" +#include "CBotInstr.h" + // Local include // Global include diff --git a/src/CBot/CBotInstr/CBotListInstr.h b/src/CBot/CBotInstr/CBotListInstr.h index 763c3a8..0aafaf5 100644 --- a/src/CBot/CBotInstr/CBotListInstr.h +++ b/src/CBot/CBotInstr/CBotListInstr.h @@ -22,6 +22,8 @@ // Modules inlcude #include "CBot.h" +#include "CBotInstr.h" + // Local include // Global include diff --git a/src/CBot/CBotInstr/CBotLogicExpr.h b/src/CBot/CBotInstr/CBotLogicExpr.h index 2bffc24..db6c67f 100644 --- a/src/CBot/CBotInstr/CBotLogicExpr.h +++ b/src/CBot/CBotInstr/CBotLogicExpr.h @@ -22,6 +22,8 @@ // Modules inlcude #include "CBot.h" +#include "CBotInstr.h" + // Local include // Global include diff --git a/src/CBot/CBotInstr/CBotNew.h b/src/CBot/CBotInstr/CBotNew.h index 77e2b2c..02598b1 100644 --- a/src/CBot/CBotInstr/CBotNew.h +++ b/src/CBot/CBotInstr/CBotNew.h @@ -22,6 +22,8 @@ // Modules inlcude #include "CBot.h" +#include "CBotInstr.h" + // Local include // Global include diff --git a/src/CBot/CBotInstr/CBotParExpr.h b/src/CBot/CBotInstr/CBotParExpr.h index 60c0993..690d6ef 100644 --- a/src/CBot/CBotInstr/CBotParExpr.h +++ b/src/CBot/CBotInstr/CBotParExpr.h @@ -22,7 +22,7 @@ // Modules inlcude #include "CBot.h" -#include "CBotStack.h" +#include "CBotInstr.h" // Local include diff --git a/src/CBot/CBotInstr/CBotPostIncExpr.h b/src/CBot/CBotInstr/CBotPostIncExpr.h index 5a3240c..3a30fce 100644 --- a/src/CBot/CBotInstr/CBotPostIncExpr.h +++ b/src/CBot/CBotInstr/CBotPostIncExpr.h @@ -22,6 +22,8 @@ // Modules inlcude #include "CBot.h" +#include "CBotInstr.h" + // Local include // Global include diff --git a/src/CBot/CBotInstr/CBotPreIncExpr.h b/src/CBot/CBotInstr/CBotPreIncExpr.h index ede694d..896c0c9 100644 --- a/src/CBot/CBotInstr/CBotPreIncExpr.h +++ b/src/CBot/CBotInstr/CBotPreIncExpr.h @@ -22,6 +22,8 @@ // Modules inlcude #include "CBot.h" +#include "CBotInstr.h" + // Local include // Global include diff --git a/src/CBot/CBotInstr/CBotReturn.h b/src/CBot/CBotInstr/CBotReturn.h index 978c6c1..1816bf2 100644 --- a/src/CBot/CBotInstr/CBotReturn.h +++ b/src/CBot/CBotInstr/CBotReturn.h @@ -22,6 +22,8 @@ // Modules inlcude #include "CBot.h" +#include "CBotInstr.h" + // Local include // Global include diff --git a/src/CBot/CBotInstr/CBotSwitch.h b/src/CBot/CBotInstr/CBotSwitch.h index c3f5e02..b4cff5e 100644 --- a/src/CBot/CBotInstr/CBotSwitch.h +++ b/src/CBot/CBotInstr/CBotSwitch.h @@ -22,6 +22,8 @@ // Modules inlcude #include "CBot.h" +#include "CBotInstr.h" + // Local include // Global include diff --git a/src/CBot/CBotInstr/CBotThrow.h b/src/CBot/CBotInstr/CBotThrow.h index 997550a..b5227ad 100644 --- a/src/CBot/CBotInstr/CBotThrow.h +++ b/src/CBot/CBotInstr/CBotThrow.h @@ -22,6 +22,8 @@ // Modules inlcude #include "CBot.h" +#include "CBotInstr.h" + // Local include // Global include diff --git a/src/CBot/CBotInstr/CBotTry.h b/src/CBot/CBotInstr/CBotTry.h index 0a8d2b9..bdc3d4d 100644 --- a/src/CBot/CBotInstr/CBotTry.h +++ b/src/CBot/CBotInstr/CBotTry.h @@ -21,6 +21,8 @@ #include "CBot.h" #include "CBotCatch.h" +#include "CBotInstr.h" + // Local include // Global include diff --git a/src/CBot/CBotInstr/CBotTwoOpExpr.h b/src/CBot/CBotInstr/CBotTwoOpExpr.h index 1bcc2f8..720755f 100644 --- a/src/CBot/CBotInstr/CBotTwoOpExpr.h +++ b/src/CBot/CBotInstr/CBotTwoOpExpr.h @@ -22,6 +22,8 @@ // Modules inlcude #include "CBot.h" +#include "CBotInstr.h" + // Local include // Global include diff --git a/src/CBot/CBotInstr/CBotWhile.h b/src/CBot/CBotInstr/CBotWhile.h index 5d63909..528fe8f 100644 --- a/src/CBot/CBotInstr/CBotWhile.h +++ b/src/CBot/CBotInstr/CBotWhile.h @@ -22,6 +22,8 @@ // Modules inlcude #include "CBot.h" +#include "CBotInstr.h" + // Local include // Global include diff --git a/src/CBot/CBotVar/CBotVarClass.cpp b/src/CBot/CBotVar/CBotVarClass.cpp index f07fbe9..4d6ee78 100644 --- a/src/CBot/CBotVar/CBotVarClass.cpp +++ b/src/CBot/CBotVar/CBotVarClass.cpp @@ -21,11 +21,11 @@ #include "CBotVarClass.h" #include "CBotClass.h" - #include "CBotStack.h" - #include "CBotDefines.h" +#include "CBotInstr/CBotInstr.h" + // Local include // Global include diff --git a/src/CBot/CMakeLists.txt b/src/CBot/CMakeLists.txt index e69beae..80cb2d0 100644 --- a/src/CBot/CMakeLists.txt +++ b/src/CBot/CMakeLists.txt @@ -10,6 +10,7 @@ set(SOURCES CBotUtils.cpp CBotDefParam.cpp CBotCallMethode.cpp + CBotInstr/CBotInstr.cpp CBotInstr/CBotWhile.cpp CBotInstr/CBotDo.cpp CBotInstr/CBotFor.cpp -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/colobot.git _______________________________________________ Pkg-games-commits mailing list Pkg-games-commits@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-games-commits