diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/CBot/CBot.cpp | 721 | ||||
-rw-r--r-- | src/CBot/CBot.h | 146 | ||||
-rw-r--r-- | src/CBot/CBotClass.cpp | 144 | ||||
-rw-r--r-- | src/CBot/CBotDll.h | 133 | ||||
-rw-r--r-- | src/CBot/CBotFunction.cpp | 283 | ||||
-rw-r--r-- | src/CBot/CBotIf.cpp | 8 | ||||
-rw-r--r-- | src/CBot/CBotProgram.cpp | 111 | ||||
-rw-r--r-- | src/CBot/CBotStack.cpp | 168 | ||||
-rw-r--r-- | src/CBot/CBotString.cpp | 51 | ||||
-rw-r--r-- | src/CBot/CBotToken.cpp | 68 | ||||
-rw-r--r-- | src/CBot/CBotTwoOpExpr.cpp | 90 | ||||
-rw-r--r-- | src/CBot/CBotVar.cpp | 472 | ||||
-rw-r--r-- | src/CBot/CBotWhile.cpp | 170 | ||||
-rw-r--r-- | src/CBot/ClassFILE.cpp | 92 | ||||
-rw-r--r-- | src/CBot/StringFunctions.cpp | 126 | ||||
-rw-r--r-- | src/CBot/tests/CBot_console/CMakeLists.txt | 15 | ||||
l--------- | src/CBot/tests/CBot_console/src/CBot | 1 | ||||
-rw-r--r-- | src/CBot/tests/CBot_console/src/CMakeLists.txt | 32 | ||||
-rw-r--r-- | src/CBot/tests/CBot_console/src/app/CBotConsole.cpp | 175 | ||||
-rw-r--r-- | src/CBot/tests/CBot_console/src/app/CBotConsole.h | 44 | ||||
-rw-r--r-- | src/CBot/tests/CBot_console/src/app/CBotDoc.cpp | 122 | ||||
-rw-r--r-- | src/CBot/tests/CBot_console/src/app/CBotDoc.h | 39 | ||||
-rw-r--r-- | src/CBot/tests/CBot_console/src/app/CClass.cpp | 97 | ||||
-rw-r--r-- | src/CBot/tests/CBot_console/src/app/CClass.h | 18 | ||||
-rw-r--r-- | src/CBot/tests/CBot_console/src/app/main.cpp | 45 | ||||
-rw-r--r-- | src/CBot/tests/CBot_console/src/app/routines.cpp | 141 | ||||
-rw-r--r-- | src/CBot/tests/old TstCBot/BotConsoleDlg.cpp | 164 | ||||
-rw-r--r-- | src/CBot/tests/old TstCBot/BotConsoleDlg.h | 65 | ||||
-rw-r--r-- | src/CBot/tests/old TstCBot/BotErrorDlg.cpp | 56 | ||||
-rw-r--r-- | src/CBot/tests/old TstCBot/BotErrorDlg.h | 51 | ||||
-rw-r--r-- | src/CBot/tests/old TstCBot/CBotTest.txt | 36 | ||||
-rw-r--r-- | src/CBot/tests/old TstCBot/CMyThread.cpp | 107 | ||||
-rw-r--r-- | src/CBot/tests/old TstCBot/CMyThread.h | 44 | ||||
-rw-r--r-- | src/CBot/tests/old TstCBot/MainFrm.cpp | 91 | ||||
-rw-r--r-- | src/CBot/tests/old TstCBot/MainFrm.h | 55 | ||||
-rw-r--r-- | src/CBot/tests/old TstCBot/ReadMe.txt | 93 | ||||
-rw-r--r-- | src/CBot/tests/old TstCBot/Resource.h | 68 | ||||
-rw-r--r-- | src/CBot/tests/old TstCBot/StdAfx.cpp | 6 | ||||
-rw-r--r-- | src/CBot/tests/old TstCBot/StdAfx.h | 26 | ||||
-rw-r--r-- | src/CBot/tests/old TstCBot/TstCBot.clw | 189 | ||||
-rw-r--r-- | src/CBot/tests/old TstCBot/TstCBot.cpp | 412 | ||||
-rw-r--r-- | src/CBot/tests/old TstCBot/TstCBot.dsp | 180 | ||||
-rw-r--r-- | src/CBot/tests/old TstCBot/TstCBot.h | 62 | ||||
-rw-r--r-- | src/CBot/tests/old TstCBot/TstCBot.rc | 471 | ||||
-rw-r--r-- | src/CBot/tests/old TstCBot/TstCBotDoc.cpp | 83 | ||||
-rw-r--r-- | src/CBot/tests/old TstCBot/TstCBotDoc.h | 55 | ||||
-rw-r--r-- | src/CBot/tests/old TstCBot/TstCBotView.cpp | 291 | ||||
-rw-r--r-- | src/CBot/tests/old TstCBot/TstCBotView.h | 81 | ||||
-rw-r--r-- | src/CBot/tests/old TstCBot/res/TstCBot.ico | bin | 1078 -> 0 bytes | |||
-rw-r--r-- | src/CBot/tests/old TstCBot/res/TstCBot.rc2 | 13 | ||||
-rw-r--r-- | src/CBot/tests/old TstCBot/res/TstCBotDoc.ico | bin | 1078 -> 0 bytes | |||
-rw-r--r-- | src/CBot/tests/old TstCBot/test complet 1.txt | 213 | ||||
-rw-r--r-- | src/CBot/tests/old TstCBot/x.txt | 43 | ||||
-rw-r--r-- | src/CBot/tests/scenarios/B.txt (renamed from src/CBot/tests/TestCBot/scenarios/B.txt) | 0 | ||||
-rw-r--r-- | src/CBot/tests/scenarios/BUG2.txt (renamed from src/CBot/tests/TestCBot/scenarios/BUG2.txt) | 0 | ||||
-rw-r--r-- | src/CBot/tests/scenarios/Deleted.txt (renamed from src/CBot/tests/TestCBot/scenarios/Deleted.txt) | 0 | ||||
-rw-r--r-- | src/CBot/tests/scenarios/MaClass.txt (renamed from src/CBot/tests/TestCBot/scenarios/MaClass.txt) | 0 | ||||
-rw-r--r-- | src/CBot/tests/scenarios/Mc2.txt (renamed from src/CBot/tests/TestCBot/scenarios/Mc2.txt) | 0 | ||||
-rw-r--r-- | src/CBot/tests/scenarios/Mon fichier.txt (renamed from src/CBot/tests/TestCBot/scenarios/Mon fichier.txt) | 0 | ||||
-rw-r--r-- | src/CBot/tests/scenarios/Nop.txt (renamed from src/CBot/tests/TestCBot/scenarios/Nop.txt) | 0 | ||||
-rw-r--r-- | src/CBot/tests/scenarios/POS.txt (renamed from src/CBot/tests/TestCBot/scenarios/POS.txt) | 0 | ||||
-rw-r--r-- | src/CBot/tests/scenarios/T.txt (renamed from src/CBot/tests/TestCBot/scenarios/T.txt) | 0 | ||||
-rw-r--r-- | src/CBot/tests/scenarios/TESTALL.txt (renamed from src/CBot/tests/TestCBot/scenarios/TESTALL.txt) | 0 | ||||
-rw-r--r-- | src/CBot/tests/scenarios/TestCB1.txt (renamed from src/CBot/tests/TestCBot/scenarios/TestCB1.txt) | 0 | ||||
-rw-r--r-- | src/CBot/tests/scenarios/TestCBot1.txt (renamed from src/CBot/tests/TestCBot/scenarios/TestCBot1.txt) | 0 | ||||
-rw-r--r-- | src/CBot/tests/scenarios/TestCBot3.txt (renamed from src/CBot/tests/TestCBot/scenarios/TestCBot3.txt) | 0 | ||||
-rw-r--r-- | src/CBot/tests/scenarios/TestNull.txt (renamed from src/CBot/tests/TestCBot/scenarios/TestNull.txt) | 0 | ||||
-rw-r--r-- | src/CBot/tests/scenarios/TestRestoreState.txt (renamed from src/CBot/tests/TestCBot/scenarios/TestRestoreState.txt) | 0 | ||||
-rw-r--r-- | src/CBot/tests/scenarios/TestStatic.txt (renamed from src/CBot/tests/TestCBot/scenarios/TestStatic.txt) | 0 | ||||
-rw-r--r-- | src/CBot/tests/scenarios/TestStr.txt (renamed from src/CBot/tests/TestCBot/scenarios/TestStr.txt) | 0 | ||||
-rw-r--r-- | src/CBot/tests/scenarios/Z.txt (renamed from src/CBot/tests/TestCBot/scenarios/Z.txt) | 0 | ||||
-rw-r--r-- | src/CBot/tests/scenarios/a1.txt (renamed from src/CBot/tests/TestCBot/scenarios/a1.txt) | 0 | ||||
-rw-r--r-- | src/CBot/tests/scenarios/array.txt (renamed from src/CBot/tests/TestCBot/scenarios/array.txt) | 0 | ||||
-rw-r--r-- | src/CBot/tests/scenarios/až1.txt (renamed from src/CBot/tests/TestCBot/scenarios/až1.txt) | 0 | ||||
-rw-r--r-- | src/CBot/tests/scenarios/a§1.txt (renamed from src/CBot/tests/TestCBot/scenarios/a§1.txt) | 0 | ||||
-rw-r--r-- | src/CBot/tests/scenarios/bug.txt (renamed from src/CBot/tests/TestCBot/scenarios/bug.txt) | 0 | ||||
-rw-r--r-- | src/CBot/tests/scenarios/bugmw.txt (renamed from src/CBot/tests/TestCBot/scenarios/bugmw.txt) | 0 | ||||
-rw-r--r-- | src/CBot/tests/scenarios/ccc.txt (renamed from src/CBot/tests/TestCBot/scenarios/ccc.txt) | 0 | ||||
-rw-r--r-- | src/CBot/tests/scenarios/enum.txt (renamed from src/CBot/tests/TestCBot/scenarios/enum.txt) | 0 | ||||
-rw-r--r-- | src/CBot/tests/scenarios/fibo.txt (renamed from src/CBot/tests/TestCBot/scenarios/fibo.txt) | 0 | ||||
-rw-r--r-- | src/CBot/tests/scenarios/file.txt (renamed from src/CBot/tests/TestCBot/scenarios/file.txt) | 0 | ||||
-rw-r--r-- | src/CBot/tests/scenarios/h.txt (renamed from src/CBot/tests/TestCBot/scenarios/h.txt) | 0 | ||||
-rw-r--r-- | src/CBot/tests/scenarios/include.txt (renamed from src/CBot/tests/TestCBot/scenarios/include.txt) | 0 | ||||
-rw-r--r-- | src/CBot/tests/scenarios/intrinsic.txt (renamed from src/CBot/tests/TestCBot/scenarios/intrinsic.txt) | 0 | ||||
-rw-r--r-- | src/CBot/tests/scenarios/methode1.txt (renamed from src/CBot/tests/TestCBot/scenarios/methode1.txt) | 0 | ||||
-rw-r--r-- | src/CBot/tests/scenarios/methode2.txt (renamed from src/CBot/tests/TestCBot/scenarios/methode2.txt) | 0 | ||||
-rw-r--r-- | src/CBot/tests/scenarios/mp1.txt (renamed from src/CBot/tests/TestCBot/scenarios/mp1.txt) | 0 | ||||
-rw-r--r-- | src/CBot/tests/scenarios/mp2.txt (renamed from src/CBot/tests/TestCBot/scenarios/mp2.txt) | 0 | ||||
-rw-r--r-- | src/CBot/tests/scenarios/mw.txt (renamed from src/CBot/tests/TestCBot/scenarios/mw.txt) | 0 | ||||
-rw-r--r-- | src/CBot/tests/scenarios/null.txt (renamed from src/CBot/tests/TestCBot/scenarios/null.txt) | 0 | ||||
-rw-r--r-- | src/CBot/tests/scenarios/opnew.txt (renamed from src/CBot/tests/TestCBot/scenarios/opnew.txt) | 0 | ||||
-rw-r--r-- | src/CBot/tests/scenarios/plante.txt (renamed from src/CBot/tests/TestCBot/scenarios/plante.txt) | 0 | ||||
-rw-r--r-- | src/CBot/tests/scenarios/pointer.txt (renamed from src/CBot/tests/TestCBot/scenarios/pointer.txt) | 0 | ||||
-rw-r--r-- | src/CBot/tests/scenarios/postinc.txt (renamed from src/CBot/tests/TestCBot/scenarios/postinc.txt) | 0 | ||||
-rw-r--r-- | src/CBot/tests/scenarios/radar.txt (renamed from src/CBot/tests/TestCBot/scenarios/radar.txt) | 0 | ||||
-rw-r--r-- | src/CBot/tests/scenarios/solution.txt (renamed from src/CBot/tests/TestCBot/scenarios/solution.txt) | 0 | ||||
-rw-r--r-- | src/CBot/tests/scenarios/test.txt (renamed from src/CBot/tests/TestCBot/scenarios/test.txt) | 6 | ||||
-rw-r--r-- | src/CBot/tests/scenarios/test23.txt (renamed from src/CBot/tests/TestCBot/scenarios/test23.txt) | 0 | ||||
-rw-r--r-- | src/CBot/tests/scenarios/testmw.txt (renamed from src/CBot/tests/TestCBot/scenarios/testmw.txt) | 0 | ||||
-rw-r--r-- | src/CBot/tests/scenarios/this.txt (renamed from src/CBot/tests/TestCBot/scenarios/this.txt) | 0 | ||||
-rw-r--r-- | src/CBot/tests/scenarios/tt.txt (renamed from src/CBot/tests/TestCBot/scenarios/tt.txt) | 0 | ||||
-rw-r--r-- | src/CBot/tests/scenarios/tt2.txt (renamed from src/CBot/tests/TestCBot/scenarios/tt2.txt) | 0 | ||||
-rw-r--r-- | src/CBot/tests/scenarios/vide.txt (renamed from src/CBot/tests/TestCBot/scenarios/vide.txt) | 0 | ||||
-rw-r--r-- | src/CBot/tests/scenarios/zz.txt (renamed from src/CBot/tests/TestCBot/scenarios/zz.txt) | 0 | ||||
-rw-r--r-- | src/object/auto/auto.cpp | 6 | ||||
-rw-r--r-- | src/object/auto/autoegg.cpp | 6 | ||||
-rw-r--r-- | src/object/motion/motion.cpp | 6 | ||||
-rw-r--r-- | src/object/motion/motiontoto.cpp | 2 | ||||
-rw-r--r-- | src/object/object.cpp | 60 | ||||
-rw-r--r-- | src/object/robotmain.cpp | 132 |
110 files changed, 2232 insertions, 4453 deletions
diff --git a/src/CBot/CBot.cpp b/src/CBot/CBot.cpp index 62d9fb7..3a7c828 100644 --- a/src/CBot/CBot.cpp +++ b/src/CBot/CBot.cpp @@ -112,14 +112,14 @@ void CBotInstr::SetToken(CBotToken* p) // return the type of the token assicated with the instruction -int CBotInstr::GivTokenType() +int CBotInstr::GetTokenType() { - return m_token.GivType(); + return m_token.GetType(); } // return associated token -CBotToken* CBotInstr::GivToken() +CBotToken* CBotInstr::GetToken() { return &m_token; } @@ -149,17 +149,17 @@ void CBotInstr::AddNext3b(CBotInstr* n) // returns next statement -CBotInstr* CBotInstr::GivNext() +CBotInstr* CBotInstr::GetNext() { return m_next; } -CBotInstr* CBotInstr::GivNext3() +CBotInstr* CBotInstr::GetNext3() { return m_next3; } -CBotInstr* CBotInstr::GivNext3b() +CBotInstr* CBotInstr::GetNext3b() { return m_next3b; } @@ -178,17 +178,17 @@ CBotInstr* CBotInstr::Compile(CBotToken* &p, CBotCStack* pStack) if (p == NULL) return NULL; - int type = p->GivType(); // what is the next token + int type = p->GetType(); // what is the next token // is it a lable? if (IsOfType(pp, TokenTypVar) && IsOfType(pp, ID_DOTS)) { - type = pp->GivType(); + type = pp->GetType(); // these instructions accept only lable if (!IsOfTypeList(pp, ID_WHILE, ID_FOR, ID_DO, ID_REPEAT, 0)) { - pStack->SetError(TX_LABEL, pp->GivStart()); + pStack->SetError(TX_LABEL, pp->GetStart()); return NULL; } } @@ -244,20 +244,20 @@ CBotInstr* CBotInstr::Compile(CBotToken* &p, CBotCStack* pStack) return CBotReturn::Compile(p, pStack); case ID_ELSE: - pStack->SetStartError(p->GivStart()); - pStack->SetError(TX_ELSEWITHOUTIF, p->GivEnd()); + pStack->SetStartError(p->GetStart()); + pStack->SetError(TX_ELSEWITHOUTIF, p->GetEnd()); return NULL; case ID_CASE: - pStack->SetStartError(p->GivStart()); - pStack->SetError(TX_OUTCASE, p->GivEnd()); + pStack->SetStartError(p->GetStart()); + pStack->SetError(TX_OUTCASE, p->GetEnd()); return NULL; } - pStack->SetStartError(p->GivStart()); + pStack->SetStartError(p->GetStart()); // should not be a reserved word DefineNum - if (p->GivType() == TokenTypDef) + if (p->GetType() == TokenTypDef) { pStack->SetError(TX_RESERVED, p); return NULL; @@ -280,7 +280,7 @@ CBotInstr* CBotInstr::Compile(CBotToken* &p, CBotCStack* pStack) { return inst; } - pStack->SetError(TX_ENDOF, p->GivStart()); + pStack->SetError(TX_ENDOF, p->GetStart()); delete inst; return NULL; } @@ -296,7 +296,7 @@ bool CBotInstr::Execute(CBotStack* &pj) bool CBotInstr::Execute(CBotStack* &pj, CBotVar* pVar) { if (!Execute(pj)) return false; - pVar->SetVal(pj->GivVar()); + pVar->SetVal(pj->GetVar()); return true; } @@ -347,7 +347,7 @@ bool CBotInstr::CompCase(CBotStack* &pj, int val) CBotInstr* CBotBlock::Compile(CBotToken* &p, CBotCStack* pStack, bool bLocal) { - pStack->SetStartError(p->GivStart()); + pStack->SetStartError(p->GetStart()); if (IsOfType(p, ID_OPBLK)) { @@ -358,19 +358,19 @@ CBotInstr* CBotBlock::Compile(CBotToken* &p, CBotCStack* pStack, bool bLocal) return inst; } - pStack->SetError(TX_CLOSEBLK, p->GivStart()); // missing parenthesis + pStack->SetError(TX_CLOSEBLK, p->GetStart()); // missing parenthesis delete inst; return NULL; } - pStack->SetError(TX_OPENBLK, p->GivStart()); + pStack->SetError(TX_OPENBLK, p->GetStart()); return NULL; } CBotInstr* CBotBlock::CompileBlkOrInst(CBotToken* &p, CBotCStack* pStack, bool bLocal) { // is this a new block - if (p->GivType() == ID_OPBLK) return CBotBlock::Compile(p, pStack); + if (p->GetType() == ID_OPBLK) return CBotBlock::Compile(p, pStack); // otherwise, look for a single statement instead @@ -414,11 +414,11 @@ CBotInstr* CBotListInstr::Compile(CBotToken* &p, CBotCStack* pStack, bool bLocal if (p == NULL) break; if (IsOfType(p, ID_SEP)) continue; // empty statement ignored - if (p->GivType() == ID_CLBLK) break; + if (p->GetType() == ID_CLBLK) break; if (IsOfType(p, 0)) { - pStack->SetError(TX_CLOSEBLK, p->GivStart()); + pStack->SetError(TX_CLOSEBLK, p->GetStart()); delete inst; return pStack->Return(NULL, pStk); } @@ -448,13 +448,13 @@ bool CBotListInstr::Execute(CBotStack* &pj) CBotInstr* p = m_Instr; // the first expression - int state = pile->GivState(); - while (state-->0) p = p->GivNext(); // returns to the interrupted operation + int state = pile->GetState(); + while (state-->0) p = p->GetNext(); // returns to the interrupted operation if (p != NULL) while (true) { if (!p->Execute(pile)) return false; - p = p->GivNext(); + p = p->GetNext(); if (p == NULL) break; if (!pile->IncState()) ;//return false; // ready for next } @@ -471,11 +471,11 @@ void CBotListInstr::RestoreState(CBotStack* &pj, bool bMain) CBotInstr* p = m_Instr; // the first expression - int state = pile->GivState(); + int state = pile->GetState(); while ( p != NULL && state-- > 0) { p->RestoreState(pile, false); - p = p->GivNext(); // returns to the interrupted operation + p = p->GetNext(); // returns to the interrupted operation } if (p != NULL) p->RestoreState(pile, true); @@ -500,15 +500,15 @@ CBotLeftExprVar::~CBotLeftExprVar() CBotInstr* CBotLeftExprVar::Compile(CBotToken* &p, CBotCStack* pStack) { // verifies that the token is a variable name - if (p->GivType() != TokenTypVar) + if (p->GetType() != TokenTypVar) { - pStack->SetError( TX_NOVAR, p->GivStart()); + pStack->SetError( TX_NOVAR, p->GetStart()); return NULL; } CBotLeftExprVar* inst = new CBotLeftExprVar(); inst->SetToken(p); - p = p->GivNext(); + p = p->GetNext(); return inst; } @@ -519,11 +519,11 @@ bool CBotLeftExprVar::Execute(CBotStack* &pj) CBotVar* var1; CBotVar* var2; - var1 = CBotVar::Create(m_token.GivString(), m_typevar); + var1 = CBotVar::Create(m_token.GetString(), m_typevar); var1->SetUniqNum(m_nIdent); // with the unique identifier pj->AddVar(var1); // place it on the stack - var2 = pj->GivVar(); // result on the stack + var2 = pj->GetVar(); // result on the stack if (var2) var1->SetVal(var2); // do the assignment return true; @@ -533,7 +533,7 @@ void CBotLeftExprVar::RestoreState(CBotStack* &pj, bool bMain) { CBotVar* var1; - var1 = pj->FindVar(m_token.GivString()); + var1 = pj->FindVar(m_token.GetString()); if (var1 == NULL) ASM_TRAP(); var1->SetUniqNum(m_nIdent); // with the unique identifier @@ -583,7 +583,7 @@ CBotInstr* CBotInstArray::Compile(CBotToken* &p, CBotCStack* pStack, CBotTypResu CBotInstr* i; while (IsOfType(p, ID_OPBRK)) { - if (p->GivType() != ID_CLBRK) + if (p->GetType() != ID_CLBRK) i = CBotExpression::Compile(p, pStk); // expression for the value else i = new CBotEmpty(); // if no special formula @@ -593,7 +593,7 @@ CBotInstr* CBotInstArray::Compile(CBotToken* &p, CBotCStack* pStack, CBotTypResu if (!pStk->IsOk() || !IsOfType(p, ID_CLBRK )) { - pStk->SetError(TX_CLBRK, p->GivStart()); + pStk->SetError(TX_CLBRK, p->GetStart()); goto error; } } @@ -602,12 +602,12 @@ CBotInstr* CBotInstArray::Compile(CBotToken* &p, CBotCStack* pStack, CBotTypResu inst->m_typevar = type; var->SetUniqNum( - ((CBotLeftExprVar*)inst->m_var)->m_nIdent = CBotVar::NextUniqNum()); + (static_cast<CBotLeftExprVar*>(inst->m_var))->m_nIdent = CBotVar::NextUniqNum()); pStack->AddVar(var); // place it on the stack if (IsOfType(p, ID_ASS)) // with an assignment { - inst->m_listass = CBotListArray::Compile(p, pStk, type.GivTypElem()); + inst->m_listass = CBotListArray::Compile(p, pStk, type.GetTypElem()); } if (pStk->IsOk()) return pStack->Return(inst, pStk); @@ -627,25 +627,25 @@ bool CBotInstArray::Execute(CBotStack* &pj) CBotStack* pile = pile1; - if (pile1->GivState() == 0) + if (pile1->GetState() == 0) { // seek the maximum dimension of the table - CBotInstr* p = GivNext3b(); // the different formulas + CBotInstr* p = GetNext3b(); // the different formulas int nb = 0; while (p != NULL) { pile = pile->AddStack(); // little room to work nb++; - if (pile->GivState() == 0) + if (pile->GetState() == 0) { if (!p->Execute(pile)) return false; // size calculation //interrupted? pile->IncState(); } - p = p->GivNext3b(); + p = p->GetNext3b(); } - p = GivNext3b(); + p = GetNext3b(); pile = pile1; // returns to the stack int n = 0; int max[100]; @@ -653,24 +653,24 @@ bool CBotInstArray::Execute(CBotStack* &pj) while (p != NULL) { pile = pile->AddStack(); - CBotVar* v = pile->GivVar(); // result - max[n] = v->GivValInt(); // value + CBotVar* v = pile->GetVar(); // result + max[n] = v->GetValInt(); // value if (max[n]>MAXARRAYSIZE) { pile->SetError(TX_OUTARRAY, &m_token); return pj->Return (pile); } n++; - p = p->GivNext3b(); + p = p->GetNext3b(); } while (n<100) max[n++] = 0; m_typevar.SetArray(max); // store the limitations // create simply a NULL pointer - CBotVar* var = CBotVar::Create(m_var->GivToken(), m_typevar); + CBotVar* var = CBotVar::Create(m_var->GetToken(), m_typevar); var->SetPointer(NULL); - var->SetUniqNum(((CBotLeftExprVar*)m_var)->m_nIdent); + var->SetUniqNum((static_cast<CBotLeftExprVar*>(m_var))->m_nIdent); pj->AddVar(var); #if STACKMEM @@ -681,11 +681,11 @@ bool CBotInstArray::Execute(CBotStack* &pj) pile1->IncState(); } - if (pile1->GivState() == 1) + if (pile1->GetState() == 1) { if (m_listass != NULL) // there is the assignment for this table { - CBotVar* pVar = pj->FindVar(((CBotLeftExprVar*)m_var)->m_nIdent); + CBotVar* pVar = pj->FindVar((static_cast<CBotLeftExprVar*>(m_var))->m_nIdent); if (!m_listass->Execute(pile1, pVar)) return false; } @@ -704,8 +704,8 @@ void CBotInstArray::RestoreState(CBotStack* &pj, bool bMain) { CBotStack* pile1 = pj; - CBotVar* var = pj->FindVar(m_var->GivToken()->GivString()); - if (var != NULL) var->SetUniqNum(((CBotLeftExprVar*)m_var)->m_nIdent); + CBotVar* var = pj->FindVar(m_var->GetToken()->GetString()); + if (var != NULL) var->SetUniqNum((static_cast<CBotLeftExprVar*>(m_var))->m_nIdent); if (bMain) { @@ -713,24 +713,24 @@ void CBotInstArray::RestoreState(CBotStack* &pj, bool bMain) CBotStack* pile = pile1; if (pile == NULL) return; - if (pile1->GivState() == 0) + if (pile1->GetState() == 0) { // seek the maximum dimension of the table - CBotInstr* p = GivNext3b(); + CBotInstr* p = GetNext3b(); while (p != NULL) { pile = pile->RestoreStack(); if (pile == NULL) return; - if (pile->GivState() == 0) + if (pile->GetState() == 0) { p->RestoreState(pile, bMain); return; } - p = p->GivNext3b(); + p = p->GetNext3b(); } } - if (pile1->GivState() == 1 && m_listass != NULL) + if (pile1->GetState() == 1 && m_listass != NULL) { m_listass->RestoreState(pile1, bMain); } @@ -790,9 +790,9 @@ CBotInstr* CBotListArray::Compile(CBotToken* &p, CBotCStack* pStack, CBotTypResu // each element takes the one after the other if (type.Eq( CBotTypArrayPointer )) { - type = type.GivTypElem(); + type = type.GetTypElem(); - pStk->SetStartError(p->GivStart()); + pStk->SetStartError(p->GetStart()); if (NULL == ( inst->m_expr = CBotListArray::Compile( p, pStk, type ) )) { goto error; @@ -800,7 +800,7 @@ CBotInstr* CBotListArray::Compile(CBotToken* &p, CBotCStack* pStack, CBotTypResu while (IsOfType( p, ID_COMMA )) // other elements? { - pStk->SetStartError(p->GivStart()); + pStk->SetStartError(p->GetStart()); CBotInstr* i = CBotListArray::Compile(p, pStk, type); if (NULL == i) @@ -813,22 +813,22 @@ CBotInstr* CBotListArray::Compile(CBotToken* &p, CBotCStack* pStack, CBotTypResu } else { - pStk->SetStartError(p->GivStart()); + pStk->SetStartError(p->GetStart()); if (NULL == ( inst->m_expr = CBotTwoOpExpr::Compile( p, pStk ))) { goto error; } - CBotVar* pv = pStk->GivVar(); // result of the expression + CBotVar* pv = pStk->GetVar(); // result of the expression - if (pv == NULL || !TypesCompatibles( type, pv->GivTypResult())) // compatible type? + if (pv == NULL || !TypesCompatibles( type, pv->GetTypResult())) // compatible type? { - pStk->SetError(TX_BADTYPE, p->GivStart()); + pStk->SetError(TX_BADTYPE, p->GetStart()); goto error; } while (IsOfType( p, ID_COMMA )) // other elements? { - pStk->SetStartError(p->GivStart()); + pStk->SetStartError(p->GetStart()); CBotInstr* i = CBotTwoOpExpr::Compile(p, pStk) ; if (NULL == i) @@ -836,11 +836,11 @@ CBotInstr* CBotListArray::Compile(CBotToken* &p, CBotCStack* pStack, CBotTypResu goto error; } - CBotVar* pv = pStk->GivVar(); // result of the expression + CBotVar* pv = pStk->GetVar(); // result of the expression - if (pv == NULL || !TypesCompatibles( type, pv->GivTypResult())) // compatible type? + if (pv == NULL || !TypesCompatibles( type, pv->GetTypResult())) // compatible type? { - pStk->SetError(TX_BADTYPE, p->GivStart()); + pStk->SetError(TX_BADTYPE, p->GetStart()); goto error; } inst->m_expr->AddNext3(i); @@ -849,7 +849,7 @@ CBotInstr* CBotListArray::Compile(CBotToken* &p, CBotCStack* pStack, CBotTypResu if (!IsOfType(p, ID_CLOSEPAR) ) { - pStk->SetError(TX_CLOSEPAR, p->GivStart()); + pStk->SetError(TX_CLOSEPAR, p->GetStart()); goto error; } @@ -873,11 +873,11 @@ bool CBotListArray::Execute(CBotStack* &pj, CBotVar* pVar) int n = 0; - for (; p != NULL ; n++, p = p->GivNext3()) + for (; p != NULL ; n++, p = p->GetNext3()) { - if (pile1->GivState() > n) continue; + if (pile1->GetState() > n) continue; - pVar2 = pVar->GivItem(n, true); + pVar2 = pVar->GetItem(n, true); if (!p->Execute(pile1, pVar2)) return false; // evaluate expression @@ -896,9 +896,9 @@ void CBotListArray::RestoreState(CBotStack* &pj, bool bMain) CBotInstr* p = m_expr; - int state = pile->GivState(); + int state = pile->GetState(); - while(state-- > 0) p = p->GivNext3() ; + while(state-- > 0) p = p->GetNext3() ; p->RestoreState(pile, bMain); // size calculation //interrupted! } @@ -930,7 +930,7 @@ CBotInstr* CBotInstr::CompileArray(CBotToken* &p, CBotCStack* pStack, CBotTypRes { if (!IsOfType(p, ID_CLBRK)) { - pStack->SetError(TX_CLBRK, p->GivStart()); + pStack->SetError(TX_CLBRK, p->GetStart()); return NULL; } @@ -960,7 +960,7 @@ CBotInstr* CBotInstr::CompileArray(CBotToken* &p, CBotCStack* pStack, CBotTypRes } delete inst; - pStack->SetError(TX_ENDOF, p->GivStart()); + pStack->SetError(TX_ENDOF, p->GetStart()); return NULL; } @@ -970,7 +970,7 @@ CBotInstr* CBotInt::Compile(CBotToken* &p, CBotCStack* pStack, bool cont, bool n if (!cont && !IsOfType(p, ID_INT)) return NULL; - CBotInt* inst = (CBotInt*)CompileArray(p, pStack, CBotTypInt); + CBotInt* inst = static_cast<CBotInt*>(CompileArray(p, pStack, CBotTypInt)); if (inst != NULL || !pStack->IsOk()) return inst; CBotCStack* pStk = pStack->TokenStack(pp); @@ -985,7 +985,7 @@ CBotInstr* CBotInt::Compile(CBotToken* &p, CBotCStack* pStack, bool cont, bool n // determines the expression is valid for the item on the left side if (NULL != (inst->m_var = CBotLeftExprVar::Compile( p, pStk ))) { - ((CBotLeftExprVar*)inst->m_var)->m_typevar = CBotTypInt; + (static_cast<CBotLeftExprVar*>(inst->m_var))->m_typevar = CBotTypInt; if (pStk->CheckVarLocal(vartoken)) // redefinition of the variable { pStk->SetError(TX_REDEFVAR, vartoken); @@ -1003,7 +1003,7 @@ CBotInstr* CBotInt::Compile(CBotToken* &p, CBotCStack* pStack, bool cont, bool n if (!pStk->IsOk() ) { - pStk->SetError(TX_CLBRK, p->GivStart()); + pStk->SetError(TX_CLBRK, p->GetStart()); goto error; } @@ -1014,7 +1014,7 @@ CBotInstr* CBotInt::Compile(CBotToken* &p, CBotCStack* pStack, bool cont, bool n return pStack->Return(inst2, pStk); } } - inst = (CBotInt*)inst2; + inst = static_cast<CBotInt*>(inst2); goto suite; // no assignment, variable already created } @@ -1024,9 +1024,9 @@ CBotInstr* CBotInt::Compile(CBotToken* &p, CBotCStack* pStack, bool cont, bool n { goto error; } - if (pStk->GivType() >= CBotTypBoolean) // compatible type ? + if (pStk->GetType() >= CBotTypBoolean) // compatible type ? { - pStk->SetError(TX_BADTYPE, p->GivStart()); + pStk->SetError(TX_BADTYPE, p->GetStart()); goto error; } } @@ -1035,7 +1035,7 @@ CBotInstr* CBotInt::Compile(CBotToken* &p, CBotCStack* pStack, bool cont, bool n CBotVar* var = CBotVar::Create(vartoken, CBotTypInt);// create the variable (evaluated after the assignment) var->SetInit(inst->m_expr != NULL); // if initialized with assignment var->SetUniqNum( //set it with a unique number - ((CBotLeftExprVar*)inst->m_var)->m_nIdent = CBotVar::NextUniqNum()); + (static_cast<CBotLeftExprVar*>(inst->m_var))->m_nIdent = CBotVar::NextUniqNum()); pStack->AddVar(var); // place it on the stack } @@ -1052,7 +1052,7 @@ suite: return pStack->Return(inst, pStk); } - pStk->SetError(TX_ENDOF, p->GivStart()); + pStk->SetError(TX_ENDOF, p->GetStart()); } error: @@ -1066,7 +1066,7 @@ bool CBotInt::Execute(CBotStack* &pj) { CBotStack* pile = pj->AddStack(this); // essential for SetState() - if ( pile->GivState()==0) + if ( pile->GetState()==0) { if (m_expr && !m_expr->Execute(pile)) return false; // initial value // interrupted? m_var->Execute(pile); // creates and assign the result @@ -1090,7 +1090,7 @@ void CBotInt::RestoreState(CBotStack* &pj, bool bMain) pile = pj->RestoreStack(this); if (pile == NULL) return; - if ( pile->GivState()==0) + if ( pile->GetState()==0) { if (m_expr) m_expr->RestoreState(pile, bMain); // initial value // interrupted? return; @@ -1128,7 +1128,7 @@ CBotInstr* CBotBoolean::Compile(CBotToken* &p, CBotCStack* pStack, bool cont, bo if (!cont && !IsOfType(p, ID_BOOLEAN, ID_BOOL)) return NULL; - CBotBoolean* inst = (CBotBoolean*)CompileArray(p, pStack, CBotTypBoolean); + CBotBoolean* inst = static_cast<CBotBoolean*>(CompileArray(p, pStack, CBotTypBoolean)); if (inst != NULL || !pStack->IsOk()) return inst; CBotCStack* pStk = pStack->TokenStack(pp); @@ -1143,7 +1143,7 @@ CBotInstr* CBotBoolean::Compile(CBotToken* &p, CBotCStack* pStack, bool cont, bo if (NULL != (inst->m_var = CBotLeftExprVar::Compile( p, pStk ))) { - ((CBotLeftExprVar*)inst->m_var)->m_typevar = CBotTypBoolean; + (static_cast<CBotLeftExprVar*>(inst->m_var))->m_typevar = CBotTypBoolean; if (pStk->CheckVarLocal(vartoken)) // redefinition of the variable { pStk->SetError(TX_REDEFVAR, vartoken); @@ -1157,11 +1157,11 @@ CBotInstr* CBotBoolean::Compile(CBotToken* &p, CBotCStack* pStack, bool cont, bo // compiles an array declaration - inst = (CBotBoolean*)CBotInstArray::Compile(p, pStk, CBotTypBoolean); + inst = static_cast<CBotBoolean*>(CBotInstArray::Compile(p, pStk, CBotTypBoolean)); if (!pStk->IsOk() ) { - pStk->SetError(TX_CLBRK, p->GivStart()); + pStk->SetError(TX_CLBRK, p->GetStart()); goto error; } goto suite; // no assignment, variable already created @@ -1173,9 +1173,9 @@ CBotInstr* CBotBoolean::Compile(CBotToken* &p, CBotCStack* pStack, bool cont, bo { goto error; } - if (!pStk->GivTypResult().Eq(CBotTypBoolean)) + if (!pStk->GetTypResult().Eq(CBotTypBoolean)) { - pStk->SetError(TX_BADTYPE, p->GivStart()); + pStk->SetError(TX_BADTYPE, p->GetStart()); goto error; } } @@ -1183,7 +1183,7 @@ CBotInstr* CBotBoolean::Compile(CBotToken* &p, CBotCStack* pStack, bool cont, bo var = CBotVar::Create(vartoken, CBotTypBoolean);// create the variable (evaluated after the assignment) var->SetInit(inst->m_expr != NULL); var->SetUniqNum( - ((CBotLeftExprVar*)inst->m_var)->m_nIdent = CBotVar::NextUniqNum()); + (static_cast<CBotLeftExprVar*>(inst->m_var))->m_nIdent = CBotVar::NextUniqNum()); pStack->AddVar(var); suite: if (IsOfType(p, ID_COMMA)) @@ -1199,7 +1199,7 @@ suite: return pStack->Return(inst, pStk); } - pStk->SetError(TX_ENDOF, p->GivStart()); + pStk->SetError(TX_ENDOF, p->GetStart()); } error: @@ -1213,7 +1213,7 @@ bool CBotBoolean::Execute(CBotStack* &pj) { CBotStack* pile = pj->AddStack(this);//essential for SetState() - if ( pile->GivState()==0) + if ( pile->GetState()==0) { if (m_expr && !m_expr->Execute(pile)) return false; m_var->Execute(pile); @@ -1237,7 +1237,7 @@ void CBotBoolean::RestoreState(CBotStack* &pj, bool bMain) pile = pj->RestoreStack(this); if (pile == NULL) return; - if ( pile->GivState()==0) + if ( pile->GetState()==0) { if (m_expr) m_expr->RestoreState(pile, bMain); // initial value interrupted? return; @@ -1276,7 +1276,7 @@ CBotInstr* CBotFloat::Compile(CBotToken* &p, CBotCStack* pStack, bool cont, bool if (!cont && !IsOfType(p, ID_FLOAT)) return NULL; - CBotFloat* inst = (CBotFloat*)CompileArray(p, pStack, CBotTypFloat); + CBotFloat* inst = static_cast<CBotFloat*>(CompileArray(p, pStack, CBotTypFloat)); if (inst != NULL || !pStack->IsOk()) return inst; CBotCStack* pStk = pStack->TokenStack(pp); @@ -1291,11 +1291,11 @@ CBotInstr* CBotFloat::Compile(CBotToken* &p, CBotCStack* pStack, bool cont, bool if (NULL != (inst->m_var = CBotLeftExprVar::Compile( p, pStk ))) { - ((CBotLeftExprVar*)inst->m_var)->m_typevar = CBotTypFloat; + (static_cast<CBotLeftExprVar*>(inst->m_var))->m_typevar = CBotTypFloat; if (pStk->CheckVarLocal(vartoken)) // redefinition of a variable { - pStk->SetStartError(vartoken->GivStart()); - pStk->SetError(TX_REDEFVAR, vartoken->GivEnd()); + pStk->SetStartError(vartoken->GetStart()); + pStk->SetError(TX_REDEFVAR, vartoken->GetEnd()); goto error; } @@ -1303,11 +1303,11 @@ CBotInstr* CBotFloat::Compile(CBotToken* &p, CBotCStack* pStack, bool cont, bool { delete inst; p = vartoken; - inst = (CBotFloat*)CBotInstArray::Compile(p, pStk, CBotTypFloat); + inst = static_cast<CBotFloat*>(CBotInstArray::Compile(p, pStk, CBotTypFloat)); if (!pStk->IsOk() ) { - pStk->SetError(TX_CLBRK, p->GivStart()); + pStk->SetError(TX_CLBRK, p->GetStart()); goto error; } goto suite; // no assignment, variable already created @@ -1319,9 +1319,9 @@ CBotInstr* CBotFloat::Compile(CBotToken* &p, CBotCStack* pStack, bool cont, bool { goto error; } - if (pStk->GivType() >= CBotTypBoolean) + if (pStk->GetType() >= CBotTypBoolean) { - pStk->SetError(TX_BADTYPE, p->GivStart()); + pStk->SetError(TX_BADTYPE, p->GetStart()); goto error; } } @@ -1329,7 +1329,7 @@ CBotInstr* CBotFloat::Compile(CBotToken* &p, CBotCStack* pStack, bool cont, bool var = CBotVar::Create(vartoken, CBotTypFloat); var->SetInit(inst->m_expr != NULL); var->SetUniqNum( - ((CBotLeftExprVar*)inst->m_var)->m_nIdent = CBotVar::NextUniqNum()); + (static_cast<CBotLeftExprVar*>(inst->m_var))->m_nIdent = CBotVar::NextUniqNum()); pStack->AddVar(var); suite: if (IsOfType(p, ID_COMMA)) @@ -1345,7 +1345,7 @@ suite: return pStack->Return(inst, pStk); } - pStk->SetError(TX_ENDOF, p->GivStart()); + pStk->SetError(TX_ENDOF, p->GetStart()); } error: @@ -1359,7 +1359,7 @@ bool CBotFloat::Execute(CBotStack* &pj) { CBotStack* pile = pj->AddStack(this); - if ( pile->GivState()==0) + if ( pile->GetState()==0) { if (m_expr && !m_expr->Execute(pile)) return false; m_var->Execute(pile); @@ -1383,7 +1383,7 @@ void CBotFloat::RestoreState(CBotStack* &pj, bool bMain) pile = pj->RestoreStack(this); if (pile == NULL) return; - if ( pile->GivState()==0) + if ( pile->GetState()==0) { if (m_expr) m_expr->RestoreState(pile, bMain); return; @@ -1422,7 +1422,7 @@ CBotInstr* CBotIString::Compile(CBotToken* &p, CBotCStack* pStack, bool cont, bo if (!cont && !IsOfType(p, ID_STRING)) return NULL; - CBotIString* inst = (CBotIString*)CompileArray(p, pStack, CBotTypString); + CBotIString* inst = static_cast<CBotIString*>(CompileArray(p, pStack, CBotTypString)); if (inst != NULL || !pStack->IsOk()) return inst; CBotCStack* pStk = pStack->TokenStack(pp); @@ -1436,11 +1436,11 @@ CBotInstr* CBotIString::Compile(CBotToken* &p, CBotCStack* pStack, bool cont, bo if (NULL != (inst->m_var = CBotLeftExprVar::Compile( p, pStk ))) { - ((CBotLeftExprVar*)inst->m_var)->m_typevar = CBotTypString; + (static_cast<CBotLeftExprVar*>(inst->m_var))->m_typevar = CBotTypString; if (pStk->CheckVarLocal(vartoken)) { - pStk->SetStartError(vartoken->GivStart()); - pStk->SetError(TX_REDEFVAR, vartoken->GivEnd()); + pStk->SetStartError(vartoken->GetStart()); + pStk->SetError(TX_REDEFVAR, vartoken->GetEnd()); goto error; } @@ -1450,9 +1450,9 @@ CBotInstr* CBotIString::Compile(CBotToken* &p, CBotCStack* pStack, bool cont, bo { goto error; } -/* if (!pStk->GivTypResult().Eq(CBotTypString)) // type compatible ? +/* if (!pStk->GetTypResult().Eq(CBotTypString)) // type compatible ? { - pStk->SetError(TX_BADTYPE, p->GivStart()); + pStk->SetError(TX_BADTYPE, p->GetStart()); goto error; }*/ } @@ -1460,7 +1460,7 @@ CBotInstr* CBotIString::Compile(CBotToken* &p, CBotCStack* pStack, bool cont, bo CBotVar* var = CBotVar::Create(vartoken, CBotTypString); var->SetInit(inst->m_expr != NULL); var->SetUniqNum( - ((CBotLeftExprVar*)inst->m_var)->m_nIdent = CBotVar::NextUniqNum()); + (static_cast<CBotLeftExprVar*>(inst->m_var))->m_nIdent = CBotVar::NextUniqNum()); pStack->AddVar(var); if (IsOfType(p, ID_COMMA)) @@ -1476,7 +1476,7 @@ CBotInstr* CBotIString::Compile(CBotToken* &p, CBotCStack* pStack, bool cont, bo return pStack->Return(inst, pStk); } - pStk->SetError(TX_ENDOF, p->GivStart()); + pStk->SetError(TX_ENDOF, p->GetStart()); } error: @@ -1490,7 +1490,7 @@ bool CBotIString::Execute(CBotStack* &pj) { CBotStack* pile = pj->AddStack(this); - if ( pile->GivState()==0) + if ( pile->GetState()==0) { if (m_expr && !m_expr->Execute(pile)) return false; m_var->Execute(pile); @@ -1515,7 +1515,7 @@ void CBotIString::RestoreState(CBotStack* &pj, bool bMain) pile = pj->RestoreStack(this); if (pile == NULL) return; - if ( pile->GivState()==0) + if ( pile->GetState()==0) { if (m_expr) m_expr->RestoreState(pile, bMain); return; @@ -1558,7 +1558,7 @@ CBotInstr* CBotExpression::Compile(CBotToken* &p, CBotCStack* pStack) inst->m_leftop = CBotLeftExpr::Compile(p, pStack); inst->SetToken(p); - int OpType = p->GivType(); + int OpType = p->GetType(); if ( pStack->IsOk() && IsOfTypeList(p, ID_ASS, ID_ASSADD, ID_ASSSUB, ID_ASSMUL, ID_ASSDIV, ID_ASSMODULO, @@ -1567,7 +1567,7 @@ CBotInstr* CBotExpression::Compile(CBotToken* &p, CBotCStack* pStack) { if (inst->m_leftop == NULL) { - pStack->SetError(TX_BADLEFT, p->GivEnd()); + pStack->SetError(TX_BADLEFT, p->GetEnd()); delete inst; return NULL; } @@ -1579,7 +1579,7 @@ CBotInstr* CBotExpression::Compile(CBotToken* &p, CBotCStack* pStack) return NULL; } - CBotTypResult type1 = pStack->GivTypResult(); + CBotTypResult type1 = pStack->GetTypResult(); // get the variable assigned to mark CBotVar* var = NULL; @@ -1590,14 +1590,14 @@ CBotInstr* CBotExpression::Compile(CBotToken* &p, CBotCStack* pStack) return NULL; } - if (OpType != ID_ASS && var->GivInit() != IS_DEF) + if (OpType != ID_ASS && var->GetInit() != IS_DEF) { pStack->SetError(TX_NOTINIT, pp); delete inst; return NULL; } - CBotTypResult type2 = var->GivTypResult(); + CBotTypResult type2 = var->GetTypResult(); // what types are acceptable? switch (OpType) @@ -1607,10 +1607,10 @@ CBotInstr* CBotExpression::Compile(CBotToken* &p, CBotCStack* pStack) if ((type1.Eq(CBotTypPointer) && type2.Eq(CBotTypPointer)) || (type1.Eq(CBotTypClass) && type2.Eq(CBotTypClass) ) ) { -/* CBotClass* c1 = type1.GivClass(); - CBotClass* c2 = type2.GivClass(); +/* CBotClass* c1 = type1.GetClass(); + CBotClass* c2 = type2.GetClass(); if (!c1->IsChildOf(c2)) type2.SetType(-1); -//- if (!type1.Eq(CBotTypClass)) var->SetPointer(pStack->GivVar()->GivPointer());*/ +//- if (!type1.Eq(CBotTypClass)) var->SetPointer(pStack->GetVar()->GetPointer());*/ var->SetInit(2); } else @@ -1625,7 +1625,7 @@ CBotInstr* CBotExpression::Compile(CBotToken* &p, CBotCStack* pStack) case ID_ASSMUL: case ID_ASSDIV: case ID_ASSMODULO: - if (type2.GivType() >= CBotTypBoolean) type2 = -1; // numbers only + if (type2.GetType() >= CBotTypBoolean) type2 = -1; // numbers only break; } @@ -1640,13 +1640,13 @@ CBotInstr* CBotExpression::Compile(CBotToken* &p, CBotCStack* pStack) } delete inst; - int start, end, error = pStack->GivError(start, end); + int start, end, error = pStack->GetError(start, end); p = pp; // returns to the top pStack->SetError(0,0); // forget the error CBotInstr* i = CBotTwoOpExpr::Compile(p, pStack); // tries without assignment - if (i != NULL && error == TX_PRIVATE && p->GivType() == ID_ASS) + if (i != NULL && error == TX_PRIVATE && p->GetType() == ID_ASS) pStack->ResetError(error, start, end); return i; } @@ -1657,7 +1657,8 @@ bool CBotExpression::Execute(CBotStack* &pj) { CBotStack* pile = pj->AddStack(this); - CBotToken* pToken = m_leftop->GivToken(); +// CBotToken* pToken = m_leftop->GetToken(); + CBotVar* pVar = NULL; CBotStack* pile1 = pile; @@ -1668,7 +1669,7 @@ bool CBotExpression::Execute(CBotStack* &pj) // must be done before any indexes (stack can be changed) if (!m_leftop->ExecuteVar(pVar, pile, NULL, false)) return false; // variable before accessing the value on the right - if ( pile1->GivState()==0) + if ( pile1->GetState()==0) { pile1->SetCopyVar(pVar); // keeps the copy on the stack (if interrupted) pile1->IncState(); @@ -1676,83 +1677,83 @@ bool CBotExpression::Execute(CBotStack* &pj) CBotStack* pile2 = pile->AddStack(); - if ( pile2->GivState()==0) + if ( pile2->GetState()==0) { if (m_rightop && !m_rightop->Execute(pile2)) return false; // initial value // interrupted? pile2->IncState(); } - if (pile1->GivState() == 1) + if (pile1->GetState() == 1) { - if (m_token.GivType() != ID_ASS) + if (m_token.GetType() != ID_ASS) { - pVar = pile1->GivVar(); // recovers if interrupted - IsInit = pVar->GivInit(); + pVar = pile1->GetVar(); // recovers if interrupted + IsInit = pVar->GetInit(); if (IsInit == IS_NAN) { - pile2->SetError(TX_OPNAN, m_leftop->GivToken()); + pile2->SetError(TX_OPNAN, m_leftop->GetToken()); return pj->Return(pile2); } - result = CBotVar::Create("", pVar->GivTypResult(2)); + result = CBotVar::Create("", pVar->GetTypResult(2)); } - switch (m_token.GivType()) + switch (m_token.GetType()) { case ID_ASS: break; case ID_ASSADD: - result->Add(pile1->GivVar(), pile2->GivVar()); + result->Add(pile1->GetVar(), pile2->GetVar()); pile2->SetVar(result); break; case ID_ASSSUB: - result->Sub(pile1->GivVar(), pile2->GivVar()); + result->Sub(pile1->GetVar(), pile2->GetVar()); pile2->SetVar(result); break; case ID_ASSMUL: - result->Mul(pile1->GivVar(), pile2->GivVar()); + result->Mul(pile1->GetVar(), pile2->GetVar()); pile2->SetVar(result); break; case ID_ASSDIV: if (IsInit && - result->Div(pile1->GivVar(), pile2->GivVar())) + result->Div(pile1->GetVar(), pile2->GetVar())) pile2->SetError(TX_DIVZERO, &m_token); pile2->SetVar(result); break; case ID_ASSMODULO: if (IsInit && - result->Modulo(pile1->GivVar(), pile2->GivVar())) + result->Modulo(pile1->GetVar(), pile2->GetVar())) pile2->SetError(TX_DIVZERO, &m_token); pile2->SetVar(result); break; case ID_ASSAND: - result->And(pile1->GivVar(), pile2->GivVar()); + result->And(pile1->GetVar(), pile2->GetVar()); pile2->SetVar(result); break; case ID_ASSXOR: - result->XOr(pile1->GivVar(), pile2->GivVar()); + result->XOr(pile1->GetVar(), pile2->GetVar()); pile2->SetVar(result); break; case ID_ASSOR: - result->Or(pile1->GivVar(), pile2->GivVar()); + result->Or(pile1->GetVar(), pile2->GetVar()); pile2->SetVar(result); break; case ID_ASSSL: - result->SL(pile1->GivVar(), pile2->GivVar()); + result->SL(pile1->GetVar(), pile2->GetVar()); pile2->SetVar(result); break; case ID_ASSSR: - result->SR(pile1->GivVar(), pile2->GivVar()); + result->SR(pile1->GetVar(), pile2->GetVar()); pile2->SetVar(result); break; case ID_ASSASR: - result->ASR(pile1->GivVar(), pile2->GivVar()); + result->ASR(pile1->GetVar(), pile2->GetVar()); pile2->SetVar(result); break; default: ASM_TRAP(); } if (!IsInit) - pile2->SetError(TX_NOTINIT, m_leftop->GivToken()); + pile2->SetError(TX_NOTINIT, m_leftop->GetToken()); pile1->IncState(); } @@ -1768,15 +1769,15 @@ void CBotExpression::RestoreState(CBotStack* &pj, bool bMain) { if (bMain) { - CBotToken* pToken = m_leftop->GivToken(); - CBotVar* pVar = NULL; +// CBotToken* pToken = m_leftop->GetToken(); +// CBotVar* pVar = NULL; CBotStack* pile = pj->RestoreStack(this); if (pile == NULL) return; CBotStack* pile1 = pile; - if ( pile1->GivState()==0) + if ( pile1->GetState()==0) { m_leftop->RestoreStateVar(pile, true); return; @@ -1787,7 +1788,7 @@ void CBotExpression::RestoreState(CBotStack* &pj, bool bMain) CBotStack* pile2 = pile->RestoreStack(); if (pile2 == NULL) return; - if ( pile2->GivState()==0) + if ( pile2->GetState()==0) { if (m_rightop) m_rightop->RestoreState(pile2, bMain); return; @@ -1808,7 +1809,7 @@ void CBotExpression::RestoreState(CBotStack* &pj, bool bMain) CBotInstr* CBotCondition::Compile(CBotToken* &p, CBotCStack* pStack) { - pStack->SetStartError(p->GivStart()); + pStack->SetStartError(p->GetStart()); if (IsOfType(p, ID_OPENPAR)) { CBotInstr* inst = CBotBoolExpr::Compile(p, pStack); @@ -1818,12 +1819,12 @@ CBotInstr* CBotCondition::Compile(CBotToken* &p, CBotCStack* pStack) { return inst; } - pStack->SetError(TX_CLOSEPAR, p->GivStart()); // missing parenthesis + pStack->SetError(TX_CLOSEPAR, p->GetStart()); // missing parenthesis } delete inst; } - pStack->SetError(TX_OPENPAR, p->GivStart()); // missing parenthesis + pStack->SetError(TX_OPENPAR, p->GetStart()); // missing parenthesis return NULL; } @@ -1840,17 +1841,17 @@ CBotInstr* CBotCondition::Compile(CBotToken* &p, CBotCStack* pStack) CBotInstr* CBotBoolExpr::Compile(CBotToken* &p, CBotCStack* pStack) { - pStack->SetStartError(p->GivStart()); + pStack->SetStartError(p->GetStart()); CBotInstr* inst = CBotTwoOpExpr::Compile(p, pStack); if (NULL != inst) { - if (pStack->GivTypResult().Eq(CBotTypBoolean)) + if (pStack->GetTypResult().Eq(CBotTypBoolean)) { return inst; } - pStack->SetError(TX_NOTBOOL, p->GivStart()); // is not a boolean + pStack->SetError(TX_NOTBOOL, p->GetStart()); // is not a boolean } delete inst; @@ -1879,7 +1880,7 @@ CBotInstr* CBotParExpr::Compile(CBotToken* &p, CBotCStack* pStack) { CBotCStack* pStk = pStack->TokenStack(); - pStk->SetStartError(p->GivStart()); + pStk->SetStartError(p->GetStart()); // is it an expression in parentheses? if (IsOfType(p, ID_OPENPAR)) @@ -1892,7 +1893,7 @@ CBotInstr* CBotParExpr::Compile(CBotToken* &p, CBotCStack* pStack) { return pStack->Return(inst, pStk); } - pStk->SetError(TX_CLOSEPAR, p->GivStart()); + pStk->SetError(TX_CLOSEPAR, p->GetStart()); } delete inst; return pStack->Return(NULL, pStk); @@ -1904,7 +1905,7 @@ CBotInstr* CBotParExpr::Compile(CBotToken* &p, CBotCStack* pStack) return pStack->Return(inst, pStk); // is it a variable name? - if (p->GivType() == TokenTypVar) + if (p->GetType() == TokenTypVar) { // this may be a method call without the "this." before inst = CBotExprVar::CompileMethode(p, pStk); @@ -1925,7 +1926,7 @@ CBotInstr* CBotParExpr::Compile(CBotToken* &p, CBotCStack* pStack) // post incremented or decremented? if (IsOfType(p, ID_INC, ID_DEC)) { - if (pStk->GivType() >= CBotTypBoolean) + if (pStk->GetType() >= CBotTypBoolean) { pStk->SetError(TX_BADTYPE, pp); delete inst; @@ -1936,7 +1937,7 @@ CBotInstr* CBotParExpr::Compile(CBotToken* &p, CBotCStack* pStack) delete inst; p = pvar; inst = CBotExprVar::Compile(p, pStk, PR_READ); - p = p->GivNext(); + p = p->GetNext(); CBotPostIncExpr* i = new CBotPostIncExpr(); i->SetToken(pp); @@ -1953,11 +1954,11 @@ CBotInstr* CBotParExpr::Compile(CBotToken* &p, CBotCStack* pStack) CBotPreIncExpr* i = new CBotPreIncExpr(); i->SetToken(pp); - if (p->GivType() == TokenTypVar) + if (p->GetType() == TokenTypVar) { if (NULL != (i->m_Instr = CBotExprVar::Compile(p, pStk, PR_READ))) { - if (pStk->GivType() >= CBotTypBoolean) + if (pStk->GetType() >= CBotTypBoolean) { pStk->SetError(TX_BADTYPE, pp); delete inst; @@ -1971,30 +1972,30 @@ CBotInstr* CBotParExpr::Compile(CBotToken* &p, CBotCStack* pStack) } // is it a number or DefineNum? - if (p->GivType() == TokenTypNum || - p->GivType() == TokenTypDef ) + if (p->GetType() == TokenTypNum || + p->GetType() == TokenTypDef ) { CBotInstr* inst = CBotExprNum::Compile(p, pStk); return pStack->Return(inst, pStk); } // is this a chaine? - if (p->GivType() == TokenTypString) + if (p->GetType() == TokenTypString) { CBotInstr* inst = CBotExprAlpha::Compile(p, pStk); return pStack->Return(inst, pStk); } // is a "true" or "false" - if (p->GivType() == ID_TRUE || - p->GivType() == ID_FALSE ) + if (p->GetType() == ID_TRUE || + p->GetType() == ID_FALSE ) { CBotInstr* inst = CBotExprBool::Compile(p, pStk); return pStack->Return(inst, pStk); } // is an object to be created with new - if (p->GivType() == ID_NEW) + if (p->GetType() == ID_NEW) { CBotInstr* inst = CBotNew::Compile(p, pStk); return pStack->Return(inst, pStk); @@ -2063,7 +2064,7 @@ bool CBotPostIncExpr::Execute(CBotStack* &pj) CBotVar* var1 = NULL; // retrieves the variable fields and indexes according - if (!((CBotExprVar*)m_Instr)->ExecuteVar(var1, pile2, NULL, true)) return false; + if (!(static_cast<CBotExprVar*>(m_Instr))->ExecuteVar(var1, pile2, NULL, true)) return false; pile1->SetState(1); pile1->SetCopyVar(var1); // places the result (before incrementation); @@ -2071,17 +2072,17 @@ bool CBotPostIncExpr::Execute(CBotStack* &pj) CBotStack* pile3 = pile2->AddStack(this); if (pile3->IfStep()) return false; - if (var1->GivInit() == IS_NAN) + if (var1->GetInit() == IS_NAN) { pile1->SetError(TX_OPNAN, &m_token); } - if (var1->GivInit() != IS_DEF) + if (var1->GetInit() != IS_DEF) { pile1->SetError(TX_NOTINIT, &m_token); } - if (GivTokenType() == ID_INC) var1->Inc(); + if (GetTokenType() == ID_INC) var1->Inc(); else var1->Dec(); return pj->Return(pile1); // operation done, result on pile2 @@ -2094,7 +2095,7 @@ void CBotPostIncExpr::RestoreState(CBotStack* &pj, bool bMain) CBotStack* pile1 = pj->RestoreStack(this); if (pile1 == NULL) return; - ((CBotExprVar*)m_Instr)->RestoreStateVar(pile1, bMain); + (static_cast<CBotExprVar*>(m_Instr))->RestoreStateVar(pile1, bMain); if (pile1 != NULL) pile1->RestoreStack(this); } @@ -2107,26 +2108,26 @@ bool CBotPreIncExpr::Execute(CBotStack* &pj) CBotVar* var1; - if (pile->GivState() == 0) + if (pile->GetState() == 0) { CBotStack* pile2 = pile; // retrieves the variable fields and indexes according // pile2 is modified on return - if (!((CBotExprVar*)m_Instr)->ExecuteVar(var1, pile2, NULL, true)) return false; + if (!(static_cast<CBotExprVar*>(m_Instr))->ExecuteVar(var1, pile2, NULL, true)) return false; - if (var1->GivInit() == IS_NAN) + if (var1->GetInit() == IS_NAN) { pile->SetError(TX_OPNAN, &m_token); return pj->Return(pile); // operation performed } - if (var1->GivInit() != IS_DEF) + if (var1->GetInit() != IS_DEF) { pile->SetError(TX_NOTINIT, &m_token); return pj->Return(pile); // operation performed } - if (GivTokenType() == ID_INC) var1->Inc(); + if (GetTokenType() == ID_INC) var1->Inc(); else var1->Dec(); // ((CBotVarInt*)var1)->m_val pile->IncState(); @@ -2144,7 +2145,7 @@ void CBotPreIncExpr::RestoreState(CBotStack* &pj, bool bMain) CBotStack* pile = pj->RestoreStack(this); if (pile == NULL) return; - if (pile->GivState() == 0) + if (pile->GetState() == 0) { return; } @@ -2174,7 +2175,7 @@ CBotExprUnaire::~CBotExprUnaire() CBotInstr* CBotExprUnaire::Compile(CBotToken* &p, CBotCStack* pStack) { - int op = p->GivType(); + int op = p->GetType(); CBotToken* pp = p; if (!IsOfTypeList( p, ID_ADD, ID_SUB, ID_LOG_NOT, ID_TXT_NOT, ID_NOT, 0 )) return NULL; @@ -2185,15 +2186,15 @@ CBotInstr* CBotExprUnaire::Compile(CBotToken* &p, CBotCStack* pStack) if (NULL != (inst->m_Expr = CBotParExpr::Compile( p, pStk ))) { - if (op == ID_ADD && pStk->GivType() < CBotTypBoolean) // only with the number + if (op == ID_ADD && pStk->GetType() < CBotTypBoolean) // only with the number return pStack->Return(inst, pStk); - if (op == ID_SUB && pStk->GivType() < CBotTypBoolean) // only with the numer + if (op == ID_SUB && pStk->GetType() < CBotTypBoolean) // only with the numer return pStack->Return(inst, pStk); - if (op == ID_NOT && pStk->GivType() < CBotTypFloat) // only with an integer + if (op == ID_NOT && pStk->GetType() < CBotTypFloat) // only with an integer return pStack->Return(inst, pStk); - if (op == ID_LOG_NOT && pStk->GivTypResult().Eq(CBotTypBoolean))// only with boolean + if (op == ID_LOG_NOT && pStk->GetTypResult().Eq(CBotTypBoolean))// only with boolean return pStack->Return(inst, pStk); - if (op == ID_TXT_NOT && pStk->GivTypResult().Eq(CBotTypBoolean))// only with boolean + if (op == ID_TXT_NOT && pStk->GetTypResult().Eq(CBotTypBoolean))// only with boolean return pStack->Return(inst, pStk); pStk->SetError(TX_BADTYPE, &inst->m_token); @@ -2208,7 +2209,7 @@ bool CBotExprUnaire::Execute(CBotStack* &pj) { CBotStack* pile = pj->AddStack(this); - if (pile->GivState() == 0) + if (pile->GetState() == 0) { if (!m_Expr->Execute(pile)) return false; // interrupted ? pile->IncState(); @@ -2217,9 +2218,9 @@ bool CBotExprUnaire::Execute(CBotStack* &pj) CBotStack* pile2 = pile->AddStack(); if (pile2->IfStep()) return false; - CBotVar* var = pile->GivVar(); // get the result on the stack + CBotVar* var = pile->GetVar(); // get the result on the stack - switch (GivTokenType()) + switch (GetTokenType()) { case ID_ADD: break; @@ -2242,7 +2243,7 @@ void CBotExprUnaire::RestoreState(CBotStack* &pj, bool bMain) CBotStack* pile = pj->RestoreStack(this); if ( pile == NULL) return; - if (pile->GivState() == 0) + if (pile->GetState() == 0) { m_Expr->RestoreState(pile, bMain); // interrupted here! return; @@ -2271,13 +2272,13 @@ CBotIndexExpr::~CBotIndexExpr() bool CBotIndexExpr::ExecuteVar(CBotVar* &pVar, CBotCStack* &pile) { - if (pVar->GivType(1) != CBotTypArrayPointer) + if (pVar->GetType(1) != CBotTypArrayPointer) ASM_TRAP(); - pVar = ((CBotVarArray*)pVar)->GivItem(0, false); // at compile time makes the element [0] + pVar = (static_cast<CBotVarArray*>(pVar))->GetItem(0, false); // at compile time makes the element [0] if (pVar == NULL) { - pile->SetError(TX_OUTARRAY, m_token.GivEnd()); + pile->SetError(TX_OUTARRAY, m_token.GetEnd()); return false; } if (m_next3 != NULL) return m_next3->ExecuteVar(pVar, pile); @@ -2292,36 +2293,36 @@ bool CBotIndexExpr::ExecuteVar(CBotVar* &pVar, CBotStack* &pile, CBotToken* prev { CBotStack* pj = pile; - if (pVar->GivType(1) != CBotTypArrayPointer) + if (pVar->GetType(1) != CBotTypArrayPointer) ASM_TRAP(); pile = pile->AddStack(); - if (pile->GivState() == 0) + if (pile->GetState() == 0) { if (!m_expr->Execute(pile)) return false; pile->IncState(); } // handles array - CBotVar* p = pile->GivVar(); // result on the stack + CBotVar* p = pile->GetVar(); // result on the stack - if (p == NULL || p->GivType() > CBotTypDouble) + if (p == NULL || p->GetType() > CBotTypDouble) { pile->SetError(TX_BADINDEX, prevToken); return pj->Return(pile); } - int n = p->GivValInt(); // position in the table + int n = p->GetValInt(); // position in the table - pVar = ((CBotVarArray*)pVar)->GivItem(n, bExtend); + pVar = (static_cast<CBotVarArray*>(pVar))->GetItem(n, bExtend); if (pVar == NULL) { pile->SetError(TX_OUTARRAY, prevToken); return pj->Return(pile); } - pVar->Maj(pile->GivPUser(), true); + pVar->Maj(pile->GetPUser(), true); if ( m_next3 != NULL && !m_next3->ExecuteVar(pVar, pile, prevToken, bStep, bExtend) ) return false; @@ -2336,7 +2337,7 @@ void CBotIndexExpr::RestoreStateVar(CBotStack* &pile, bool bMain) pile = pile->RestoreStack(); if (pile == NULL) return; - if (bMain && pile->GivState() == 0) + if (bMain && pile->GetState() == 0) { m_expr->RestoreState(pile, true); return; @@ -2373,10 +2374,10 @@ void CBotFieldExpr::SetUniqNum(int num) bool CBotFieldExpr::ExecuteVar(CBotVar* &pVar, CBotCStack* &pile) { - if (pVar->GivType(1) != CBotTypPointer) + if (pVar->GetType(1) != CBotTypPointer) ASM_TRAP(); - pVar = pVar->GivItemRef(m_nIdent); + pVar = pVar->GetItemRef(m_nIdent); if (pVar == NULL) { pile->SetError(TX_NOITEM, &m_token); @@ -2396,16 +2397,16 @@ bool CBotFieldExpr::ExecuteVar(CBotVar* &pVar, CBotStack* &pile, CBotToken* prev if (pile == EOX) return true; - if (pVar->GivType(1) != CBotTypPointer) + if (pVar->GetType(1) != CBotTypPointer) ASM_TRAP(); - CBotVarClass* pItem = pVar->GivPointer(); + CBotVarClass* pItem = pVar->GetPointer(); if (pItem == NULL) { pile->SetError(TX_NULLPT, prevToken); return pj->Return(pile); } - if (pItem->GivUserPtr() == OBJECTDELETED) + if (pItem->GetUserPtr() == OBJECTDELETED) { pile->SetError(TX_DELETEDPT, prevToken); return pj->Return(pile); @@ -2413,7 +2414,7 @@ bool CBotFieldExpr::ExecuteVar(CBotVar* &pVar, CBotStack* &pile, CBotToken* prev if (bStep && pile->IfStep()) return false; - pVar = pVar->GivItemRef(m_nIdent); + pVar = pVar->GetItemRef(m_nIdent); if (pVar == NULL) { pile->SetError(TX_NOITEM, &m_token); @@ -2423,12 +2424,12 @@ bool CBotFieldExpr::ExecuteVar(CBotVar* &pVar, CBotStack* &pile, CBotToken* prev if (pVar->IsStatic()) { // for a static variable, takes it in the class itself - CBotClass* pClass = pItem->GivClass(); - pVar = pClass->GivItem(m_token.GivString()); + CBotClass* pClass = pItem->GetClass(); + pVar = pClass->GetItem(m_token.GetString()); } // request the update of the element, if applicable - pVar->Maj(pile->GivPUser(), true); + pVar->Maj(pile->GetPUser(), true); if ( m_next3 != NULL && !m_next3->ExecuteVar(pVar, pile, &m_token, bStep, bExtend) ) return false; @@ -2476,10 +2477,10 @@ CBotLeftExpr* CBotLeftExpr::Compile(CBotToken* &p, CBotCStack* pStack) { CBotCStack* pStk = pStack->TokenStack(); - pStk->SetStartError(p->GivStart()); + pStk->SetStartError(p->GetStart()); // is it a variable name? - if (p->GivType() == TokenTypVar) + if (p->GetType() == TokenTypVar) { CBotLeftExpr* inst = new CBotLeftExpr(); // creates the object @@ -2489,11 +2490,11 @@ CBotLeftExpr* CBotLeftExpr::Compile(CBotToken* &p, CBotCStack* pStack) if (NULL != (var = pStk->FindVar(p))) // seek if known variable { - inst->m_nIdent = var->GivUniqNum(); + inst->m_nIdent = var->GetUniqNum(); if (inst->m_nIdent > 0 && inst->m_nIdent < 9000) { if ( var->IsPrivate(PR_READ) && - !pStk->GivBotCall()->m_bCompileClass) + !pStk->GetBotCall()->m_bCompileClass) { pStk->SetError(TX_PRIVATE, p); goto err; @@ -2509,14 +2510,14 @@ CBotLeftExpr* CBotLeftExpr::Compile(CBotToken* &p, CBotCStack* pStack) inst->AddNext3(i); // add after var = pStk->FindVar(pthis); - var = var->GivItem(p->GivString()); - i->SetUniqNum(var->GivUniqNum()); + var = var->GetItem(p->GetString()); + i->SetUniqNum(var->GetUniqNum()); } - p = p->GivNext(); // next token + p = p->GetNext(); // next token while (true) { - if (var->GivType() == CBotTypArrayPointer) + if (var->GetType() == CBotTypArrayPointer) { if (IsOfType( p, ID_OPBRK )) { @@ -2524,24 +2525,24 @@ CBotLeftExpr* CBotLeftExpr::Compile(CBotToken* &p, CBotCStack* pStack) i->m_expr = CBotExpression::Compile(p, pStk); inst->AddNext3(i); // add to the chain - var = ((CBotVarArray*)var)->GivItem(0,true); // gets the component [0] + var = (static_cast<CBotVarArray*>(var))->GetItem(0,true); // gets the component [0] if (i->m_expr == NULL) { - pStk->SetError(TX_BADINDEX, p->GivStart()); + pStk->SetError(TX_BADINDEX, p->GetStart()); goto err; } if (!pStk->IsOk() || !IsOfType( p, ID_CLBRK )) { - pStk->SetError(TX_CLBRK, p->GivStart()); + pStk->SetError(TX_CLBRK, p->GetStart()); goto err; } continue; } } - if (var->GivType(1) == CBotTypPointer) // for classes + if (var->GetType(1) == CBotTypPointer) // for classes { if (IsOfType(p, ID_DOT)) { @@ -2551,25 +2552,25 @@ CBotLeftExpr* CBotLeftExpr::Compile(CBotToken* &p, CBotCStack* pStack) i->SetToken(pp); // keeps the name of the token inst->AddNext3(i); // adds after - if (p->GivType() == TokenTypVar) // must be a name + if (p->GetType() == TokenTypVar) // must be a name { - var = var->GivItem(p->GivString()); // get item correspondent + var = var->GetItem(p->GetString()); // get item correspondent if (var != NULL) { if ( var->IsPrivate(PR_READ) && - !pStk->GivBotCall()->m_bCompileClass) + !pStk->GetBotCall()->m_bCompileClass) { pStk->SetError(TX_PRIVATE, pp); goto err; } - i->SetUniqNum(var->GivUniqNum()); - p = p->GivNext(); // skips the name + i->SetUniqNum(var->GetUniqNum()); + p = p->GetNext(); // skips the name continue; } pStk->SetError(TX_NOITEM, p); } - pStk->SetError(TX_DOT, p->GivStart()); + pStk->SetError(TX_DOT, p->GetStart()); goto err; } } @@ -2577,15 +2578,15 @@ CBotLeftExpr* CBotLeftExpr::Compile(CBotToken* &p, CBotCStack* pStack) } - if (pStk->IsOk()) return (CBotLeftExpr*) pStack->Return(inst, pStk); + if (pStk->IsOk()) return static_cast<CBotLeftExpr*> (pStack->Return(inst, pStk)); } pStk->SetError(TX_UNDEFVAR, p); err: delete inst; - return (CBotLeftExpr*) pStack->Return(NULL, pStk); + return static_cast<CBotLeftExpr*> ( pStack->Return(NULL, pStk)); } - return (CBotLeftExpr*) pStack->Return(NULL, pStk); + return static_cast<CBotLeftExpr*> ( pStack->Return(NULL, pStk)); } // runs, is a variable and assigns the result to the stack @@ -2602,15 +2603,15 @@ bool CBotLeftExpr::Execute(CBotStack* &pj, CBotStack* array) if (var1) { - var2 = pj->GivVar(); // result on the input stack + var2 = pj->GetVar(); // result on the input stack if (var2) { - CBotTypResult t1 = var1->GivTypResult(); - CBotTypResult t2 = var2->GivTypResult(); + CBotTypResult t1 = var1->GetTypResult(); + CBotTypResult t2 = var2->GetTypResult(); if (t2.Eq(CBotTypPointer)) { - CBotClass* c1 = t1.GivClass(); - CBotClass* c2 = t2.GivClass(); + CBotClass* c1 = t1.GetClass(); + CBotClass* c2 = t2.GetClass(); if ( !c2->IsChildOf(c1)) { CBotToken* pt = &m_token; @@ -2678,7 +2679,7 @@ void CBotLeftExpr::RestoreStateVar(CBotStack* &pile, bool bMain) // converts a string into integer // may be of the form 0xabc123 -long GivNumInt(const char* p) +long GetNumInt(const char* p) { long num = 0; while (*p >= '0' && *p <= '9') @@ -2712,7 +2713,7 @@ long GivNumInt(const char* p) } // converts a string into a float number -extern float GivNumFloat(const char* p) +extern float GetNumFloat(const char* p) { double num = 0; double div = 10; @@ -2768,7 +2769,7 @@ extern float GivNumFloat(const char* p) } if (bNeg) num = -num; - return (float)num; + return static_cast<float>(num); } ////////////////////////////////////////////////////////////////////////////////////////// @@ -2792,29 +2793,29 @@ CBotInstr* CBotExprNum::Compile(CBotToken* &p, CBotCStack* pStack) CBotExprNum* inst = new CBotExprNum(); inst->SetToken(p); - CBotString s = p->GivString(); + CBotString s = p->GetString(); inst->m_numtype = CBotTypInt; - if (p->GivType() == TokenTypDef) + if (p->GetType() == TokenTypDef) { - inst->m_valint = p->GivIdKey(); + inst->m_valint = p->GetIdKey(); } else { if (s.Find('.') >= 0 || ( s.Find('x') < 0 && ( s.Find('e') >= 0 || s.Find('E') >= 0 ) )) { inst->m_numtype = CBotTypFloat; - inst->m_valfloat = GivNumFloat(s); + inst->m_valfloat = GetNumFloat(s); } else { - inst->m_valint = GivNumInt(s); + inst->m_valint = GetNumInt(s); } } if (pStk->NextToken(p)) { - CBotVar* var = CBotVar::Create((CBotToken*)NULL, inst->m_numtype); + CBotVar* var = CBotVar::Create(static_cast<CBotToken*>(NULL), inst->m_numtype); pStk->SetVar(var); return pStack->Return(inst, pStk); @@ -2831,12 +2832,12 @@ bool CBotExprNum::Execute(CBotStack* &pj) if (pile->IfStep()) return false; - CBotVar* var = CBotVar::Create((CBotToken*)NULL, m_numtype); + CBotVar* var = CBotVar::Create(static_cast<CBotToken*>(NULL), m_numtype); CBotString nombre ; - if (m_token.GivType() == TokenTypDef) + if (m_token.GetType() == TokenTypDef) { - nombre = m_token.GivString(); + nombre = m_token.GetString(); } switch (m_numtype) @@ -2881,9 +2882,9 @@ CBotInstr* CBotExprAlpha::Compile(CBotToken* &p, CBotCStack* pStack) CBotExprAlpha* inst = new CBotExprAlpha(); inst->SetToken(p); - p = p->GivNext(); + p = p->GetNext(); - CBotVar* var = CBotVar::Create((CBotToken*)NULL, CBotTypString); + CBotVar* var = CBotVar::Create(static_cast<CBotToken*>(NULL), CBotTypString); pStk->SetVar(var); return pStack->Return(inst, pStk); @@ -2897,10 +2898,10 @@ bool CBotExprAlpha::Execute(CBotStack* &pj) if (pile->IfStep()) return false; - CBotVar* var = CBotVar::Create((CBotToken*)NULL, CBotTypString); + CBotVar* var = CBotVar::Create(static_cast<CBotToken*>(NULL), CBotTypString); - CBotString chaine = m_token.GivString(); - chaine = chaine.Mid(1, chaine.GivLength()-2); // removes the quotes + CBotString chaine = m_token.GetString(); + chaine = chaine.Mid(1, chaine.GetLength()-2); // removes the quotes var->SetValString(chaine); // value of the number @@ -2934,14 +2935,14 @@ CBotInstr* CBotExprBool::Compile(CBotToken* &p, CBotCStack* pStack) CBotCStack* pStk = pStack->TokenStack(); CBotExprBool* inst = NULL; - if ( p->GivType() == ID_TRUE || - p->GivType() == ID_FALSE ) + if ( p->GetType() == ID_TRUE || + p->GetType() == ID_FALSE ) { inst = new CBotExprBool(); inst->SetToken(p); // stores the operation false or true - p = p->GivNext(); + p = p->GetNext(); - CBotVar* var = CBotVar::Create((CBotToken*)NULL, CBotTypBoolean); + CBotVar* var = CBotVar::Create(static_cast<CBotToken*>(NULL), CBotTypBoolean); pStk->SetVar(var); } @@ -2956,9 +2957,9 @@ bool CBotExprBool::Execute(CBotStack* &pj) if (pile->IfStep()) return false; - CBotVar* var = CBotVar::Create((CBotToken*)NULL, CBotTypBoolean); + CBotVar* var = CBotVar::Create(static_cast<CBotToken*>(NULL), CBotTypBoolean); - if (GivTokenType() == ID_TRUE) var->SetValInt(1); + if (GetTokenType() == ID_TRUE) var->SetValInt(1); else var->SetValInt(0); pile->SetVar(var); // put on the stack @@ -2990,7 +2991,7 @@ bool CBotExprNull::Execute(CBotStack* &pj) CBotStack* pile = pj->AddStack(this); if (pile->IfStep()) return false; - CBotVar* var = CBotVar::Create((CBotToken*)NULL, CBotTypNullPointer); + CBotVar* var = CBotVar::Create(static_cast<CBotToken*>(NULL), CBotTypNullPointer); var->SetInit(true); // null pointer valid pile->SetVar(var); // place on the stack @@ -3022,7 +3023,7 @@ bool CBotExprNan::Execute(CBotStack* &pj) CBotStack* pile = pj->AddStack(this); if (pile->IfStep()) return false; - CBotVar* var = CBotVar::Create((CBotToken*)NULL, CBotTypInt); + CBotVar* var = CBotVar::Create(static_cast<CBotToken*>(NULL), CBotTypInt); var->SetInit(IS_NAN); // nan pile->SetVar(var); // put on the stack @@ -3051,13 +3052,13 @@ CBotExprVar::~CBotExprVar() CBotInstr* CBotExprVar::Compile(CBotToken* &p, CBotCStack* pStack, int privat) { - CBotToken* pDebut = p; +// CBotToken* pDebut = p; CBotCStack* pStk = pStack->TokenStack(); - pStk->SetStartError(p->GivStart()); + pStk->SetStartError(p->GetStart()); // is it a variable? - if (p->GivType() == TokenTypVar) + if (p->GetType() == TokenTypVar) { CBotInstr* inst = new CBotExprVar(); // create the object @@ -3067,13 +3068,13 @@ CBotInstr* CBotExprVar::Compile(CBotToken* &p, CBotCStack* pStack, int privat) if (NULL != (var = pStk->FindVar(p))) // seek if known variable { - int ident = var->GivUniqNum(); - ((CBotExprVar*)inst)->m_nIdent = ident; // identifies variable by its number + int ident = var->GetUniqNum(); + (static_cast<CBotExprVar*>(inst))->m_nIdent = ident; // identifies variable by its number if (ident > 0 && ident < 9000) { if ( var->IsPrivate(privat) && - !pStk->GivBotCall()->m_bCompileClass) + !pStk->GetBotCall()->m_bCompileClass) { pStk->SetError(TX_PRIVATE, p); goto err; @@ -3085,7 +3086,7 @@ CBotInstr* CBotExprVar::Compile(CBotToken* &p, CBotCStack* pStack, int privat) ///tests CBotToken token("this"); inst->SetToken(&token); - ((CBotExprVar*)inst)->m_nIdent = -2; // identificator for this + (static_cast<CBotExprVar*>(inst))->m_nIdent = -2; // identificator for this CBotFieldExpr* i = new CBotFieldExpr(); // new element i->SetToken(p); // keeps the name of the token @@ -3093,11 +3094,11 @@ CBotInstr* CBotExprVar::Compile(CBotToken* &p, CBotCStack* pStack, int privat) inst->AddNext3(i); // added after } - p = p->GivNext(); // next token + p = p->GetNext(); // next token while (true) { - if (var->GivType() == CBotTypArrayPointer) + if (var->GetType() == CBotTypArrayPointer) { if (IsOfType( p, ID_OPBRK )) // check if there is an aindex { @@ -3105,30 +3106,30 @@ CBotInstr* CBotExprVar::Compile(CBotToken* &p, CBotCStack* pStack, int privat) i->m_expr = CBotExpression::Compile(p, pStk); // compile the formula inst->AddNext3(i); // add to the chain - var = ((CBotVarArray*)var)->GivItem(0,true); // gets the component [0] + var = (static_cast<CBotVarArray*>(var))->GetItem(0,true); // gets the component [0] if (i->m_expr == NULL) { - pStk->SetError(TX_BADINDEX, p->GivStart()); + pStk->SetError(TX_BADINDEX, p->GetStart()); goto err; } if (!pStk->IsOk() || !IsOfType( p, ID_CLBRK )) { - pStk->SetError(TX_CLBRK, p->GivStart()); + pStk->SetError(TX_CLBRK, p->GetStart()); goto err; } continue; } } - if (var->GivType(1) == CBotTypPointer) // for classes + if (var->GetType(1) == CBotTypPointer) // for classes { if (IsOfType(p, ID_DOT)) { CBotToken* pp = p; - if (p->GivType() == TokenTypVar) // must be a name + if (p->GetType() == TokenTypVar) // must be a name { - if (p->GivNext()->GivType() == ID_OPENPAR) // a method call? + if (p->GetNext()->GetType() == ID_OPENPAR) // a method call? { CBotInstr* i = CBotInstrMethode::Compile(p, pStk, var); if (!pStk->IsOk()) goto err; @@ -3140,12 +3141,12 @@ CBotInstr* CBotExprVar::Compile(CBotToken* &p, CBotCStack* pStack, int privat) CBotFieldExpr* i = new CBotFieldExpr(); // new element i->SetToken(pp); // keeps the name of the token inst->AddNext3(i); // add after - var = var->GivItem(p->GivString()); // get item correspondent + var = var->GetItem(p->GetString()); // get item correspondent if (var != NULL) { - i->SetUniqNum(var->GivUniqNum()); + i->SetUniqNum(var->GetUniqNum()); if ( var->IsPrivate() && - !pStk->GivBotCall()->m_bCompileClass) + !pStk->GetBotCall()->m_bCompileClass) { pStk->SetError(TX_PRIVATE, pp); goto err; @@ -3156,13 +3157,13 @@ CBotInstr* CBotExprVar::Compile(CBotToken* &p, CBotCStack* pStack, int privat) if (var != NULL) { - p = p->GivNext(); // skips the name + p = p->GetNext(); // skips the name continue; } pStk->SetError(TX_NOITEM, p); goto err; } - pStk->SetError(TX_DOT, p->GivStart()); + pStk->SetError(TX_DOT, p->GetStart()); goto err; } } @@ -3187,10 +3188,10 @@ CBotInstr* CBotExprVar::CompileMethode(CBotToken* &p, CBotCStack* pStack) CBotToken* pp = p; CBotCStack* pStk = pStack->TokenStack(); - pStk->SetStartError(pp->GivStart()); + pStk->SetStartError(pp->GetStart()); // is it a variable ? - if (pp->GivType() == TokenTypVar) + if (pp->GetType() == TokenTypVar) { CBotToken pthis("this"); CBotVar* var = pStk->FindVar(pthis); @@ -3202,13 +3203,13 @@ CBotInstr* CBotExprVar::CompileMethode(CBotToken* &p, CBotCStack* pStack) // adds the equivalent of this. before inst->SetToken(&pthis); - ((CBotExprVar*)inst)->m_nIdent = -2; // ident for this + (static_cast<CBotExprVar*>(inst))->m_nIdent = -2; // ident for this CBotToken* pp = p; - if (pp->GivType() == TokenTypVar) + if (pp->GetType() == TokenTypVar) { - if (pp->GivNext()->GivType() == ID_OPENPAR) // a method call? + if (pp->GetNext()->GetType() == ID_OPENPAR) // a method call? { CBotInstr* i = CBotInstrMethode::Compile(pp, pStk, var); if (pStk->IsOk()) @@ -3235,7 +3236,7 @@ bool CBotExprVar::Execute(CBotStack* &pj) CBotStack* pile1 = pile; - if (pile1->GivState() == 0) + if (pile1->GetState() == 0) { if (!ExecuteVar(pVar, pile, NULL, true)) return false; // Get the variable fields and indexes according @@ -3247,17 +3248,17 @@ bool CBotExprVar::Execute(CBotStack* &pj) pile1->IncState(); } - pVar = pile1->GivVar(); + pVar = pile1->GetVar(); if (pVar == NULL) { return pj->Return(pile1); } - if (pVar->GivInit() == IS_UNDEF) + if (pVar->GetInit() == IS_UNDEF) { CBotToken* pt = &m_token; - while (pt->GivNext() != NULL) pt = pt->GivNext(); + while (pt->GetNext() != NULL) pt = pt->GetNext(); pile1->SetError(TX_NOTINIT, pt); return pj->Return(pile1); } @@ -3273,7 +3274,7 @@ void CBotExprVar::RestoreState(CBotStack* &pj, bool bMain) CBotStack* pile1 = pile; - if (pile1->GivState() == 0) + if (pile1->GetState() == 0) { RestoreStateVar(pile, bMain); // retrieves the variable fields and indexes according return; @@ -3334,14 +3335,14 @@ CBotInstr* CompileParams(CBotToken* &p, CBotCStack* pStack, CBotVar** ppVars) int start, end; if (!IsOfType(p, ID_CLOSEPAR)) while (true) { - start = p->GivStart(); + 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->GivStart(); + end = p->GetStart(); if (!pile->IsOk()) { @@ -3353,21 +3354,21 @@ CBotInstr* CompileParams(CBotToken* &p, CBotCStack* pStack, CBotVar** ppVars) if (param != NULL) { - if (pile->GivTypResult().Eq(99)) + if (pile->GetTypResult().Eq(99)) { delete pStack->TokenStack(); - pStack->SetError(TX_VOID, p->GivStart()); + pStack->SetError(TX_VOID, p->GetStart()); return NULL; } - ppVars[i] = pile->GivVar(); - ppVars[i]->GivToken()->SetPos(start, end); + 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->GivStart()); + pStack->SetError(TX_CLOSEPAR, p->GetStart()); delete pStack->TokenStack(); return NULL; } @@ -3402,11 +3403,11 @@ CBotInstr* CBotInstrMethode::Compile(CBotToken* &p, CBotCStack* pStack, CBotVar* if (NULL != var) { CBotToken* pp = p; - p = p->GivNext(); + p = p->GetNext(); - if (p->GivType() == ID_OPENPAR) + if (p->GetType() == ID_OPENPAR) { - inst->m_NomMethod = pp->GivString(); + inst->m_NomMethod = pp->GetString(); // compiles the list of parameters CBotVar* ppVars[1000]; @@ -3414,26 +3415,26 @@ CBotInstr* CBotInstrMethode::Compile(CBotToken* &p, CBotCStack* pStack, CBotVar* if (pStack->IsOk()) { - CBotClass* pClass = var->GivClass(); // pointer to the class - inst->m_ClassName = pClass->GivName(); // name of the class + CBotClass* pClass = var->GetClass(); // pointer to the class + inst->m_ClassName = pClass->GetName(); // name of the class CBotTypResult r = pClass->CompileMethode(inst->m_NomMethod, var, ppVars, pStack, inst->m_MethodeIdent); delete pStack->TokenStack(); // release parameters on the stack inst->m_typRes = r; - if (inst->m_typRes.GivType() > 20) + if (inst->m_typRes.GetType() > 20) { - pStack->SetError(inst->m_typRes.GivType(), pp); + pStack->SetError(inst->m_typRes.GetType(), pp); delete inst; return NULL; } // put the result on the stack to have something - if (inst->m_typRes.GivType() > 0) + if (inst->m_typRes.GetType() > 0) { CBotVar* pResult = CBotVar::Create("", inst->m_typRes); if (inst->m_typRes.Eq(CBotTypClass)) { - pResult->SetClass(inst->m_typRes.GivClass()); + pResult->SetClass(inst->m_typRes.GetClass()); } pStack->SetVar(pResult); } @@ -3455,7 +3456,7 @@ bool CBotInstrMethode::ExecuteVar(CBotVar* &pVar, CBotStack* &pj, CBotToken* pre CBotVar* ppVars[1000]; CBotStack* pile1 = pj->AddStack(this, true); // a place for the copy of This - if (pVar->GivPointer() == NULL) + if (pVar->GetPointer() == NULL) { pj->SetError(TX_NULLPT, prevToken); } @@ -3464,7 +3465,7 @@ bool CBotInstrMethode::ExecuteVar(CBotVar* &pVar, CBotStack* &pj, CBotToken* pre CBotStack* pile2 = pile1->AddStack(); // for the next parameters - if ( pile1->GivState() == 0) + if ( pile1->GetState() == 0) { CBotVar* pThis = CBotVar::Create(pVar); pThis->Copy(pVar); @@ -3486,14 +3487,14 @@ bool CBotInstrMethode::ExecuteVar(CBotVar* &pVar, CBotStack* &pj, CBotToken* pre if (p != NULL) while ( true) { - if (pile2->GivState() == 0) + if (pile2->GetState() == 0) { if (!p->Execute(pile2)) return false; // interrupted here? if (!pile2->SetState(1)) return false; // special mark to recognize parameters } - ppVars[i++] = pile2->GivVar(); // construct the list of pointers + ppVars[i++] = pile2->GetVar(); // construct the list of pointers pile2 = pile2->AddStack(); // space on the stack for the result - p = p->GivNext(); + p = p->GetNext(); if ( p == NULL) break; } ppVars[i] = NULL; @@ -3501,16 +3502,16 @@ bool CBotInstrMethode::ExecuteVar(CBotVar* &pVar, CBotStack* &pj, CBotToken* pre CBotClass* pClass = CBotClass::Find(m_ClassName); CBotVar* pThis = pile1->FindVar(-2); CBotVar* pResult = NULL; - if (m_typRes.GivType() > 0) pResult = CBotVar::Create("", m_typRes); + if (m_typRes.GetType() > 0) pResult = CBotVar::Create("", m_typRes); if (m_typRes.Eq(CBotTypClass)) { - pResult->SetClass(m_typRes.GivClass()); + pResult->SetClass(m_typRes.GetClass()); } CBotVar* pRes = pResult; if ( !pClass->ExecuteMethode(m_MethodeIdent, m_NomMethod, pThis, ppVars, - pResult, pile2, GivToken())) return false; + pResult, pile2, GetToken())) return false; if (pRes != pResult) delete pRes; pVar = NULL; // does not return value for this @@ -3540,24 +3541,24 @@ void CBotInstrMethode::RestoreStateVar(CBotStack* &pile, bool bMain) if (p != NULL) while ( true) { - if (pile2->GivState() == 0) + if (pile2->GetState() == 0) { p->RestoreState(pile2, true); // interrupted here! return; } - ppVars[i++] = pile2->GivVar(); // construct the list of pointers + ppVars[i++] = pile2->GetVar(); // construct the list of pointers pile2 = pile2->RestoreStack(); if (pile2 == NULL) return; - p = p->GivNext(); + p = p->GetNext(); if ( p == NULL) break; } ppVars[i] = NULL; CBotClass* pClass = CBotClass::Find(m_ClassName); - CBotVar* pResult = NULL; +// CBotVar* pResult = NULL; - CBotVar* pRes = pResult; +// CBotVar* pRes = pResult; pClass->RestoreMethode(m_MethodeIdent, m_NomMethod, pThis, ppVars, pile2); @@ -3573,7 +3574,7 @@ bool CBotInstrMethode::Execute(CBotStack* &pj) CBotStack* pile2 = pile1->AddStack(); // and for the parameters coming - if ( pile1->GivState() == 0) + if ( pile1->GetState() == 0) { CBotVar* pThis = pile1->CopyVar(m_token); // this value should be taken before the evaluation parameters @@ -3591,14 +3592,14 @@ bool CBotInstrMethode::Execute(CBotStack* &pj) // to be interrupted at any time if (p != NULL) while ( true) { - if (pile2->GivState() == 0) + if (pile2->GetState() == 0) { if (!p->Execute(pile2)) return false; // interrupted here? if (!pile2->SetState(1)) return false; // special mark to recognize parameters } - ppVars[i++] = pile2->GivVar(); // construct the list of pointers + ppVars[i++] = pile2->GetVar(); // construct the list of pointers pile2 = pile2->AddStack(); // space on the stack for the results - p = p->GivNext(); + p = p->GetNext(); if ( p == NULL) break; } ppVars[i] = NULL; @@ -3606,16 +3607,16 @@ bool CBotInstrMethode::Execute(CBotStack* &pj) CBotClass* pClass = CBotClass::Find(m_ClassName); CBotVar* pThis = pile1->FindVar("this"); CBotVar* pResult = NULL; - if (m_typRes.GivType()>0) pResult = CBotVar::Create("", m_typRes); + if (m_typRes.GetType()>0) pResult = CBotVar::Create("", m_typRes); if (m_typRes.Eq(CBotTypClass)) { - pResult->SetClass(m_typRes.GivClass()); + pResult->SetClass(m_typRes.GetClass()); } CBotVar* pRes = pResult; if ( !pClass->ExecuteMethode(m_MethodeIdent, m_NomMethod, pThis, ppVars, - pResult, pile2, GivToken())) return false; // interupted + pResult, pile2, GetToken())) return false; // interupted // set the new value of this in place of the old variable CBotVar* old = pile1->FindVar(m_token); @@ -3648,7 +3649,7 @@ CBotInstr* CBotNew::Compile(CBotToken* &p, CBotCStack* pStack) if (!IsOfType(p, ID_NEW)) return NULL; // verifies that the token is a class name - if (p->GivType() != TokenTypVar) return NULL; + if (p->GetType() != TokenTypVar) return NULL; CBotClass* pClass = CBotClass::Find(p); if (pClass == NULL) @@ -3661,7 +3662,7 @@ CBotInstr* CBotNew::Compile(CBotToken* &p, CBotCStack* pStack) inst->SetToken(pp); inst->m_vartoken = p; - p = p->GivNext(); + p = p->GetNext(); // creates the object on the "job" // with a pointer to the object @@ -3676,9 +3677,9 @@ CBotInstr* CBotNew::Compile(CBotToken* &p, CBotCStack* pStack) if (!pStk->IsOk()) goto error; // constructor exist? - CBotTypResult r = pClass->CompileMethode(pClass->GivName(), pVar, ppVars, pStk, inst->m_nMethodeIdent); + CBotTypResult r = pClass->CompileMethode(pClass->GetName(), pVar, ppVars, pStk, inst->m_nMethodeIdent); delete pStk->TokenStack(); // release extra stack - int typ = r.GivType(); + int typ = r.GetType(); // if there is no constructor, and no parameters either, it's ok if (typ == TX_UNDEFCALL && inst->m_Parameters == NULL) typ = 0; @@ -3686,7 +3687,7 @@ CBotInstr* CBotNew::Compile(CBotToken* &p, CBotCStack* pStack) if (typ>20) { - pStk->SetError(typ, inst->m_vartoken.GivEnd()); + pStk->SetError(typ, inst->m_vartoken.GetEnd()); goto error; } @@ -3723,7 +3724,7 @@ bool CBotNew::Execute(CBotStack* &pj) // create the variable "this" pointer type to the stack - if ( pile->GivState()==0) + if ( pile->GetState()==0) { // create an instance of the requested class // and initialize the pointer to that object @@ -3739,11 +3740,11 @@ bool CBotNew::Execute(CBotStack* &pj) // fetch the this pointer if it was interrupted if ( pThis == NULL) { - pThis = pile1->GivVar(); // find the pointer + pThis = pile1->GetVar(); // find the pointer } // is there an assignment or parameters (constructor) - if ( pile->GivState()==1) + if ( pile->GetState()==1) { // evaluates the constructor of the instance @@ -3760,13 +3761,13 @@ bool CBotNew::Execute(CBotStack* &pj) if (p != NULL) while ( true) { pile2 = pile2->AddStack(); // space on the stack for the result - if (pile2->GivState() == 0) + if (pile2->GetState() == 0) { if (!p->Execute(pile2)) return false; // interrupted here? pile2->SetState(1); } - ppVars[i++] = pile2->GivVar(); - p = p->GivNext(); + ppVars[i++] = pile2->GetVar(); + p = p->GetNext(); if ( p == NULL) break; } ppVars[i] = NULL; @@ -3774,9 +3775,9 @@ bool CBotNew::Execute(CBotStack* &pj) // create a variable for the result CBotVar* pResult = NULL; // constructos still void - if ( !pClass->ExecuteMethode(m_nMethodeIdent, pClass->GivName(), + if ( !pClass->ExecuteMethode(m_nMethodeIdent, pClass->GetName(), pThis, ppVars, - pResult, pile2, GivToken())) return false; // interrupt + pResult, pile2, GetToken())) return false; // interrupt pThis->ConstructorSet(); // indicates that the constructor has been called } @@ -3798,16 +3799,16 @@ void CBotNew::RestoreState(CBotStack* &pj, bool bMain) // create the variable "this" pointer type to the object - if ( pile->GivState()==0) + if ( pile->GetState()==0) { return; } - CBotVar* pThis = pile1->GivVar(); // find the pointer + CBotVar* pThis = pile1->GetVar(); // find the pointer pThis->SetUniqNum(-2); // is ther an assignment or parameters (constructor) - if ( pile->GivState()==1) + if ( pile->GetState()==1) { // evaluates the constructor of the instance @@ -3826,18 +3827,18 @@ void CBotNew::RestoreState(CBotStack* &pj, bool bMain) pile2 = pile2->RestoreStack(); // space on the stack for the result if (pile2 == NULL) return; - if (pile2->GivState() == 0) + if (pile2->GetState() == 0) { p->RestoreState(pile2, bMain); // interrupt here! return; } - ppVars[i++] = pile2->GivVar(); - p = p->GivNext(); + ppVars[i++] = pile2->GetVar(); + p = p->GetNext(); if ( p == NULL) break; } ppVars[i] = NULL; - pClass->RestoreMethode(m_nMethodeIdent, m_vartoken.GivString(), pThis, + pClass->RestoreMethode(m_nMethodeIdent, m_vartoken.GetString(), pThis, ppVars, pile2) ; // interrupt here! } } @@ -3847,8 +3848,8 @@ void CBotNew::RestoreState(CBotStack* &pj, bool bMain) bool TypeCompatible(CBotTypResult& type1, CBotTypResult& type2, int op) { - int t1 = type1.GivType(); - int t2 = type2.GivType(); + int t1 = type1.GetType(); + int t2 = type2.GetType(); int max = (t1 > t2) ? t1 : t2; @@ -3875,8 +3876,8 @@ bool TypeCompatible(CBotTypResult& type1, CBotTypResult& type2, int op) t1 == CBotTypClass || t1 == CBotTypIntrinsic ) { - CBotClass* c1 = type1.GivClass(); - CBotClass* c2 = type2.GivClass(); + CBotClass* c1 = type1.GetClass(); + CBotClass* c2 = type2.GetClass(); return c1->IsChildOf(c2) || c2->IsChildOf(c1); // accept the case in reverse @@ -3896,8 +3897,8 @@ bool TypeCompatible(CBotTypResult& type1, CBotTypResult& type2, int op) bool TypesCompatibles(const CBotTypResult& type1, const CBotTypResult& type2) { - int t1 = type1.GivType(); - int t2 = type2.GivType(); + int t1 = type1.GetType(); + int t2 = type2.GetType(); if (t1 == CBotTypIntrinsic) t1 = CBotTypClass; if (t2 == CBotTypIntrinsic) t2 = CBotTypClass; @@ -3911,10 +3912,10 @@ bool TypesCompatibles(const CBotTypResult& type1, const CBotTypResult& type2) if (t2 != t1) return false; if (max == CBotTypArrayPointer) - return TypesCompatibles(type1.GivTypElem(), type2.GivTypElem()); + return TypesCompatibles(type1.GetTypElem(), type2.GetTypElem()); if (max == CBotTypClass || max == CBotTypPointer) - return type1.GivClass() == type2.GivClass() ; + return type1.GetClass() == type2.GetClass() ; return true ; } diff --git a/src/CBot/CBot.h b/src/CBot/CBot.h index ebc8e52..53a5633 100644 --- a/src/CBot/CBot.h +++ b/src/CBot/CBot.h @@ -29,7 +29,7 @@ #define STACKMEM true /// \def preserve memory for the execution stack #define MAXSTACK 990 /// \def stack size reserved -#define EOX (CBotStack*)-1 /// \def tag special condition +#define EOX (reinterpret_cast<CBotStack*>(-1)) /// \def tag special condition // fix for MSVC instruction __asm int 3 (setting a trap) @@ -105,18 +105,18 @@ public: bool StackOver(); /** - * \brief GivError Get error number of the stack + * \brief GetError Get error number of the stack * \param [out] start beginning of the stack * \param [out] end end of stack * \return error number */ - int GivError(int& start, int& end); + int GetError(int& start, int& end); /** - * \brief GivError Get error number + * \brief GetError Get error number * \return eror number */ - int GivError();// rend le numéro d'erreur retourné + int GetError();// rend le numéro d'erreur retourné /** * \brief Reset Reset error at and set user @@ -131,18 +131,18 @@ public: void SetType(CBotTypResult& type); /** - * \brief GivType Get the type of value on the stack. + * \brief GetType Get the type of value on the stack. * \param [in] mode Used when getting class type (1 gives pointer, 2 gives intrinsic). * \return Type number. */ - int GivType(int mode = 0); + int GetType(int mode = 0); /** - * \brief Gives the type of complete value on the stack. + * \brief Getes the type of complete value on the stack. * \param [in] mode Used when getting class type (1 gives pointer, 2 gives intrinsic). * \return Type of an element. */ - CBotTypResult GivTypResult(int mode = 0); + CBotTypResult GetTypResult(int mode = 0); /** * \brief Adds a local variable. @@ -215,18 +215,18 @@ public: bool IsOk(); bool SetState(int n, int lim = -10); // select a state - int GivState(); // in what state am I? + int GetState(); // in what state am I? bool IncState(int lim = -10); // passes to the next state bool IfStep(); // do step by step bool Execute(); void SetVar( CBotVar* var ); void SetCopyVar( CBotVar* var ); - CBotVar* GivVar(); - CBotVar* GivCopyVar(); - CBotVar* GivPtVar(); - bool GivRetVar(bool bRet); - long GivVal(); + CBotVar* GetVar(); + CBotVar* GetCopyVar(); + CBotVar* GetPtVar(); + bool GetRetVar(bool bRet); + long GetVal(); void SetStartError(int pos); void SetError(int n, CBotToken* token = NULL); @@ -235,9 +235,9 @@ public: void SetBreak(int val, const char* name); void SetBotCall(CBotProgram* p); - CBotProgram* GivBotCall(bool bFirst = false); - void* GivPUser(); - bool GivBlock(); + CBotProgram* GetBotCall(bool bFirst = false); + void* GetPUser(); + bool GetBlock(); bool ExecuteCall(long& nIdent, CBotToken* token, CBotVar** ppVar, CBotTypResult& rettype); @@ -250,7 +250,7 @@ public: void SetTimer(int n); void GetRunPos(const char* &FunctionName, int &start, int &end); - CBotVar* GivStackVars(const char* &FunctionName, int level); + CBotVar* GetStackVars(const char* &FunctionName, int level); int m_temp; @@ -301,12 +301,12 @@ inline bool CBotStack::IsOk() return (m_error == 0); } -inline int CBotStack::GivState() +inline int CBotStack::GetState() { return m_state; } -inline int CBotStack::GivError() +inline int CBotStack::GetError() { return m_error; } @@ -343,14 +343,14 @@ public: ~CBotCStack(); bool IsOk(); - int GivError(); - int GivError(int& start, int& end); + int GetError(); + int GetError(int& start, int& end); // gives error number void SetType(CBotTypResult& type);// determines the type - CBotTypResult GivTypResult(int mode = 0); // gives the type of value on the stack - int GivType(int mode = 0); // gives the type of value on the stack - CBotClass* GivClass(); // gives the class of the value on the stack + CBotTypResult GetTypResult(int mode = 0); // gives the type of value on the stack + int GetType(int mode = 0); // gives the type of value on the stack + CBotClass* GetClass(); // gives the class of the value on the stack void AddVar(CBotVar* p); // adds a local variable CBotVar* FindVar(CBotToken* &p); // finds a variable @@ -364,7 +364,7 @@ public: void SetVar( CBotVar* var ); void SetCopyVar( CBotVar* var ); - CBotVar* GivVar(); + CBotVar* GetVar(); void SetStartError(int pos); void SetError(int n, int pos); @@ -372,11 +372,11 @@ public: void ResetError(int n, int start, int end); void SetRetType(CBotTypResult& type); - CBotTypResult GivRetType(); + CBotTypResult GetRetType(); // void SetBotCall(CBotFunction* &pFunc); void SetBotCall(CBotProgram* p); - CBotProgram* GivBotCall(); + CBotProgram* GetBotCall(); CBotTypResult CompileCall(CBotToken* &p, CBotVar** ppVars, long& nIdent); bool CheckCall(CBotToken* &pToken, CBotDefParam* pParam); @@ -454,15 +454,15 @@ public: bool CompCase(CBotStack* &pj, int val); void SetToken(CBotToken* p); - int GivTokenType(); - CBotToken* GivToken(); + int GetTokenType(); + CBotToken* GetToken(); void AddNext(CBotInstr* n); - CBotInstr* GivNext(); + CBotInstr* GetNext(); void AddNext3(CBotInstr* n); - CBotInstr* GivNext3(); + CBotInstr* GetNext3(); void AddNext3b(CBotInstr* n); - CBotInstr* GivNext3b(); + CBotInstr* GetNext3b(); static void IncLvl(CBotString& label); @@ -1263,9 +1263,9 @@ public: void SetValInt(int val, const char* s = NULL); void SetValFloat(float val); - int GivValInt(); - float GivValFloat(); - CBotString GivValString(); + int GetValInt(); + float GetValFloat(); + CBotString GetValString(); void Copy(CBotVar* pSrc, bool bName=true); @@ -1314,9 +1314,9 @@ public: void SetValInt(int val, const char* s = NULL); void SetValFloat(float val); - int GivValInt(); - float GivValFloat(); - CBotString GivValString(); + int GetValInt(); + float GetValFloat(); + CBotString GetValString(); void Copy(CBotVar* pSrc, bool bName=true); @@ -1354,7 +1354,7 @@ public: // ~CBotVarString(); void SetValString(const char* p); - CBotString GivValString(); + CBotString GetValString(); void Copy(CBotVar* pSrc, bool bName=true); @@ -1382,9 +1382,9 @@ public: void SetValInt(int val, const char* s = NULL); void SetValFloat(float val); - int GivValInt(); - float GivValFloat(); - CBotString GivValString(); + int GetValInt(); + float GetValFloat(); + CBotString GetValString(); void Copy(CBotVar* pSrc, bool bName=true); @@ -1426,14 +1426,14 @@ public: void Copy(CBotVar* pSrc, bool bName=true); void SetClass(CBotClass* pClass); //, int &nIdent); - CBotClass* GivClass(); - CBotVar* GivItem(const char* name); // return an element of a class according to its name (*) - CBotVar* GivItemRef(int nIdent); + CBotClass* GetClass(); + CBotVar* GetItem(const char* name); // return an element of a class according to its name (*) + CBotVar* GetItemRef(int nIdent); - CBotVar* GivItem(int n, bool bExtend); - CBotVar* GivItemList(); + CBotVar* GetItem(int n, bool bExtend); + CBotVar* GetItemList(); - CBotString GivValString(); + CBotString GetValString(); bool Save1State(FILE* pf); void Maj(void* pUser, bool bContinue); @@ -1442,7 +1442,7 @@ public: void DecrementUse(); // a reference to decrementation CBotVarClass* - GivPointer(); + GetPointer(); void SetItemList(CBotVar* pVar); void SetIdent(long n); @@ -1450,7 +1450,7 @@ public: static CBotVarClass* Find(long id); -// CBotVar* GivMyThis(); +// CBotVar* GetMyThis(); bool Eq(CBotVar* left, CBotVar* right); bool Ne(CBotVar* left, CBotVar* right); @@ -1474,18 +1474,18 @@ public: void Copy(CBotVar* pSrc, bool bName=true); void SetClass(CBotClass* pClass); - CBotClass* GivClass(); - CBotVar* GivItem(const char* name); // return an element of a class according to its name (*) - CBotVar* GivItemRef(int nIdent); - CBotVar* GivItemList(); + CBotClass* GetClass(); + CBotVar* GetItem(const char* name); // return an element of a class according to its name (*) + CBotVar* GetItemRef(int nIdent); + CBotVar* GetItemList(); - CBotString GivValString(); + CBotString GetValString(); void SetPointer(CBotVar* p); CBotVarClass* - GivPointer(); + GetPointer(); void SetIdent(long n); // associates an identification number (unique) - long GivIdent(); // gives the identification number associated with + long GetIdent(); // gives the identification number associated with void ConstructorSet(); bool Save1State(FILE* pf); @@ -1514,15 +1514,15 @@ public: void SetPointer(CBotVar* p); CBotVarClass* - GivPointer(); + GetPointer(); void Copy(CBotVar* pSrc, bool bName=true); - CBotVar* GivItem(int n, bool bGrow=false); // makes an element according to its numeric index + CBotVar* GetItem(int n, bool bGrow=false); // makes an element according to its numeric index // enlarged the table if necessary if bExtend -// CBotVar* GivItem(const char* name); // makes a element by literal index - CBotVar* GivItemList(); // gives the first item in the list +// CBotVar* GetItem(const char* name); // makes a element by literal index + CBotVar* GetItemList(); // gives the first item in the list - CBotString GivValString(); // gets the contents of the array into a string + CBotString GetValString(); // gets the contents of the array into a string bool Save1State(FILE* pf); }; @@ -1544,7 +1544,7 @@ extern bool ReadString(FILE* pf, CBotString& s); extern bool WriteType(FILE* pf, CBotTypResult type); extern bool ReadType(FILE* pf, CBotTypResult& type); -extern float GivNumFloat( const char* p ); +extern float GetNumFloat( const char* p ); #if false extern void DEBUG( const char* text, int val, CBotStack* pile ); @@ -1596,7 +1596,7 @@ public: bool RestoreCall(long& nIdent, CBotToken* token, CBotVar** ppVar, CBotStack* pStack); #endif - CBotString GivName(); + CBotString GetName(); CBotCall* Next(); static void SetPUser(void* pUser); @@ -1629,7 +1629,7 @@ public: int DoCall(long& nIdent, const char* name, CBotVar* pThis, CBotVar** ppVars, CBotVar* &pResult, CBotStack* pStack, CBotToken* pFunc); - CBotString GivName(); + CBotString GetName(); CBotCallMethode* Next(); void AddNext(CBotCallMethode* p); @@ -1655,11 +1655,11 @@ public: void RestoreState(CBotStack* &pj, bool bMain); void AddNext(CBotDefParam* p); - int GivType(); - CBotTypResult GivTypResult(); - CBotDefParam* GivNext(); + int GetType(); + CBotTypResult GetTypResult(); + CBotDefParam* GetNext(); - CBotString GivParamString(); + CBotString GetParamString(); }; @@ -1720,8 +1720,8 @@ public: static void AddPublic(CBotFunction* pfunc); - CBotString GivName(); - CBotString GivParams(); + CBotString GetName(); + CBotString GetParams(); bool IsPublic(); bool IsExtern(); CBotFunction* Next(); diff --git a/src/CBot/CBotClass.cpp b/src/CBot/CBotClass.cpp index a524a8e..a1c3fd4 100644 --- a/src/CBot/CBotClass.cpp +++ b/src/CBot/CBotClass.cpp @@ -175,7 +175,7 @@ void CBotClass::FreeLock(CBotProgram* p) bool CBotClass::AddItem(CBotString name, CBotTypResult type, int mPrivate) { CBotToken token(name, CBotString()); - CBotClass* pClass = type.GivClass(); + CBotClass* pClass = type.GetClass(); CBotVar* pVar = CBotVar::Create( name, type ); /// pVar->SetUniqNum(CBotVar::NextUniqNum()); @@ -188,7 +188,7 @@ bool CBotClass::AddItem(CBotString name, CBotTypResult type, int mPrivate) { // adds a new statement for the object initialization pVar->m_InitExpr = new CBotNew() ; - CBotToken nom( pClass->GivName() ); + CBotToken nom( pClass->GetName() ); pVar->m_InitExpr->SetToken(&nom); } } @@ -214,12 +214,12 @@ void CBotClass::AddNext(CBotClass* pClass) p->m_next = pClass; } -CBotString CBotClass::GivName() +CBotString CBotClass::GetName() { return m_name; } -CBotClass* CBotClass::GivParent() +CBotClass* CBotClass::GetParent() { if ( this == NULL ) return NULL; return m_pParent; @@ -237,34 +237,34 @@ bool CBotClass::IsChildOf(CBotClass* pClass) } -CBotVar* CBotClass::GivVar() +CBotVar* CBotClass::GetVar() { return m_pVar; } -CBotVar* CBotClass::GivItem(const char* name) +CBotVar* CBotClass::GetItem(const char* name) { CBotVar* p = m_pVar; while ( p != NULL ) { - if ( p->GivName() == name ) return p; - p = p->GivNext(); + if ( p->GetName() == name ) return p; + p = p->GetNext(); } - if ( m_pParent != NULL ) return m_pParent->GivItem(name); + if ( m_pParent != NULL ) return m_pParent->GetItem(name); return NULL; } -CBotVar* CBotClass::GivItemRef(int nIdent) +CBotVar* CBotClass::GetItemRef(int nIdent) { CBotVar* p = m_pVar; while ( p != NULL ) { - if ( p->GivUniqNum() == nIdent ) return p; - p = p->GivNext(); + if ( p->GetUniqNum() == nIdent ) return p; + p = p->GetNext(); } - if ( m_pParent != NULL ) return m_pParent->GivItemRef(nIdent); + if ( m_pParent != NULL ) return m_pParent->GetItemRef(nIdent); return NULL; } @@ -275,7 +275,7 @@ bool CBotClass::IsIntrinsic() CBotClass* CBotClass::Find(CBotToken* &pToken) { - return Find(pToken->GivString()); + return Find(pToken->GetString()); } CBotClass* CBotClass::Find(const char* name) @@ -284,7 +284,7 @@ CBotClass* CBotClass::Find(const char* name) while ( p != NULL ) { - if ( p->GivName() == name ) return p; + if ( p->GetName() == name ) return p; p = p->m_ExNext; } @@ -301,7 +301,7 @@ bool CBotClass::AddFunction(const char* name, while ( p != NULL ) { - if ( name == p->GivName() ) + if ( name == p->GetName() ) { if ( pp == NULL ) m_pCalls = p->m_next; else pp->m_next = p->m_next; @@ -338,7 +338,7 @@ CBotTypResult CBotClass::CompileMethode(const char* name, // find the methods declared by AddFunction CBotTypResult r = m_pCalls->CompileCall(name, pThis, ppParams, pStack, nIdent); - if ( r.GivType() >= 0) return r; + if ( r.GetType() >= 0) return r; // find the methods declared by user @@ -384,21 +384,21 @@ bool CBotClass::SaveStaticState(FILE* pf) { if (!WriteWord( pf, 1)) return false; // save the name of the class - if (!WriteString( pf, p->GivName() )) return false; + if (!WriteString( pf, p->GetName() )) return false; - CBotVar* pv = p->GivVar(); + CBotVar* pv = p->GetVar(); while( pv != NULL ) { if ( pv->IsStatic() ) { if (!WriteWord( pf, 1)) return false; - if (!WriteString( pf, pv->GivName() )) return false; + if (!WriteString( pf, pv->GetName() )) return false; if ( !pv->Save0State(pf)) return false; // common header if ( !pv->Save1State(pf) ) return false; // saves as the child class if ( !WriteWord( pf, 0)) return false; } - pv = pv->GivNext(); + pv = pv->GetNext(); } if (!WriteWord( pf, 0)) return false; @@ -435,7 +435,7 @@ bool CBotClass::RestoreStaticState(FILE* pf) CBotVar* pv = NULL; if (!ReadString( pf, VarName )) return false; - if ( pClass != NULL ) pVar = pClass->GivItem(VarName); + if ( pClass != NULL ) pVar = pClass->GetItem(VarName); if (!CBotVar::RestoreState(pf, pv)) return false; // the temp variable @@ -475,7 +475,7 @@ CBotInstr* CBotClassInst::Compile(CBotToken* &p, CBotCStack* pStack, CBotClass* // seeks the corresponding classes if ( pClass == NULL ) { - pStack->SetStartError(p->GivStart()); + pStack->SetStartError(p->GetStart()); pClass = CBotClass::Find(p); if ( pClass == NULL ) { @@ -483,29 +483,29 @@ CBotInstr* CBotClassInst::Compile(CBotToken* &p, CBotCStack* pStack, CBotClass* pStack->SetError(TX_NOCLASS, p); return NULL; } - p = p->GivNext(); + p = p->GetNext(); } bool bIntrinsic = pClass->IsIntrinsic(); CBotTypResult type = CBotTypResult( bIntrinsic ? CBotTypIntrinsic : CBotTypPointer, pClass ); - CBotClassInst* inst = (CBotClassInst*)CompileArray(p, pStack, type); + CBotClassInst* inst = static_cast<CBotClassInst*>(CompileArray(p, pStack, type)); if ( inst != NULL || !pStack->IsOk() ) return inst; CBotCStack* pStk = pStack->TokenStack(); inst = new CBotClassInst(); /// \TODO Need to be revised and fixed after adding unit tests - CBotToken token(pClass->GivName(), CBotString(), p->GivStart(), p->GivEnd()); + CBotToken token(pClass->GetName(), CBotString(), p->GetStart(), p->GetEnd()); inst->SetToken(&token); CBotToken* vartoken = p; if ( NULL != (inst->m_var = CBotLeftExprVar::Compile( p, pStk )) ) { - ((CBotLeftExprVar*)inst->m_var)->m_typevar = type; + (static_cast<CBotLeftExprVar*>(inst->m_var))->m_typevar = type; if (pStk->CheckVarLocal(vartoken)) // redefinition of the variable { - pStk->SetStartError(vartoken->GivStart()); - pStk->SetError(TX_REDEFVAR, vartoken->GivEnd()); + pStk->SetStartError(vartoken->GetStart()); + pStk->SetError(TX_REDEFVAR, vartoken->GetEnd()); goto error; } @@ -516,11 +516,11 @@ CBotInstr* CBotClassInst::Compile(CBotToken* &p, CBotCStack* pStack, CBotClass* // compiles declaration an array - inst = (CBotClassInst*)CBotInstArray::Compile( p, pStk, type ); + inst = static_cast<CBotClassInst*>(CBotInstArray::Compile( p, pStk, type )); if (!pStk->IsOk() ) { - pStk->SetError(TX_CLBRK, p->GivStart()); + pStk->SetError(TX_CLBRK, p->GetStart()); goto error; } goto suite; // no assignment, variable already created @@ -528,15 +528,15 @@ CBotInstr* CBotClassInst::Compile(CBotToken* &p, CBotCStack* pStack, CBotClass* CBotVar* var; - var = CBotVar::Create(vartoken->GivString(), type); // creates the instance + var = CBotVar::Create(vartoken->GetString(), type); // creates the instance // var->SetClass(pClass); var->SetUniqNum( - ((CBotLeftExprVar*)inst->m_var)->m_nIdent = CBotVar::NextUniqNum()); + (static_cast<CBotLeftExprVar*>(inst->m_var))->m_nIdent = CBotVar::NextUniqNum()); // its attribute a unique number pStack->AddVar(var); // placed on the stack // look if there are parameters - inst->m_hasParams = (p->GivType() == ID_OPENPAR); + inst->m_hasParams = (p->GetType() == ID_OPENPAR); CBotVar* ppVars[1000]; inst->m_Parameters = CompileParams(p, pStk, ppVars); @@ -551,9 +551,9 @@ CBotInstr* CBotClassInst::Compile(CBotToken* &p, CBotCStack* pStack, CBotClass* { // the constructor is there? // CBotString noname; - CBotTypResult r = pClass->CompileMethode(pClass->GivName(), var, ppVars, pStk, inst->m_nMethodeIdent); + CBotTypResult r = pClass->CompileMethode(pClass->GetName(), var, ppVars, pStk, inst->m_nMethodeIdent); delete pStk->TokenStack(); // releases the supplement stack - int typ = r.GivType(); + int typ = r.GetType(); if (typ == TX_UNDEFCALL) { @@ -568,7 +568,7 @@ CBotInstr* CBotClassInst::Compile(CBotToken* &p, CBotCStack* pStack, CBotClass* if (typ>20) { - pStk->SetError(typ, vartoken->GivEnd()); + pStk->SetError(typ, vartoken->GetEnd()); goto error; } @@ -578,7 +578,7 @@ CBotInstr* CBotClassInst::Compile(CBotToken* &p, CBotCStack* pStack, CBotClass* { if (inst->m_hasParams) { - pStk->SetError(TX_ENDOF, p->GivStart()); + pStk->SetError(TX_ENDOF, p->GetStart()); goto error; } @@ -586,15 +586,15 @@ CBotInstr* CBotClassInst::Compile(CBotToken* &p, CBotCStack* pStack, CBotClass* { goto error; } - CBotClass* result = pStk->GivClass(); - if ( !pStk->GivTypResult(1).Eq(CBotTypNullPointer) && - ( !pStk->GivTypResult(1).Eq(CBotTypPointer) || + CBotClass* result = pStk->GetClass(); + if ( !pStk->GetTypResult(1).Eq(CBotTypNullPointer) && + ( !pStk->GetTypResult(1).Eq(CBotTypPointer) || ( result != NULL && !pClass->IsChildOf(result) ))) // type compatible ? { - pStk->SetError(TX_BADTYPE, p->GivStart()); + pStk->SetError(TX_BADTYPE, p->GetStart()); goto error; } -// if ( !bIntrinsic ) var->SetPointer(pStk->GivVar()->GivPointer()); +// if ( !bIntrinsic ) var->SetPointer(pStk->GetVar()->GetPointer()); if ( !bIntrinsic ) { // does not use the result on the stack, to impose the class @@ -630,7 +630,7 @@ suite: return pStack->Return(inst, pStk); } - pStk->SetError(TX_ENDOF, p->GivStart()); + pStk->SetError(TX_ENDOF, p->GetStart()); } error: @@ -655,9 +655,9 @@ bool CBotClassInst::Execute(CBotStack* &pj) // creates the variable of type pointer to the object - if ( pile->GivState()==0) + if ( pile->GetState()==0) { - CBotString name = m_var->m_token.GivString(); + CBotString name = m_var->m_token.GetString(); if ( bIntrincic ) { pThis = CBotVar::Create(name, CBotTypResult( CBotTypIntrinsic, pClass )); @@ -667,14 +667,14 @@ bool CBotClassInst::Execute(CBotStack* &pj) pThis = CBotVar::Create(name, CBotTypResult( CBotTypPointer, pClass )); } - pThis->SetUniqNum(((CBotLeftExprVar*)m_var)->m_nIdent); // its attribute as unique number + pThis->SetUniqNum((static_cast<CBotLeftExprVar*>(m_var))->m_nIdent); // its attribute as unique number pile->AddVar(pThis); // place on the stack pile->IncState(); } - if ( pThis == NULL ) pThis = pile->FindVar(((CBotLeftExprVar*)m_var)->m_nIdent); + if ( pThis == NULL ) pThis = pile->FindVar((static_cast<CBotLeftExprVar*>(m_var))->m_nIdent); - if ( pile->GivState()<3) + if ( pile->GetState()<3) { // ss there an assignment or parameters (contructor) @@ -687,18 +687,18 @@ bool CBotClassInst::Execute(CBotStack* &pj) if ( bIntrincic ) { - CBotVar* pv = pile->GivVar(); - if ( pv == NULL || pv->GivPointer() == NULL ) + CBotVar* pv = pile->GetVar(); + if ( pv == NULL || pv->GetPointer() == NULL ) { pile->SetError(TX_NULLPT, &m_token); return pj->Return(pile); } - pThis->Copy(pile->GivVar(), false); + pThis->Copy(pile->GetVar(), false); } else { CBotVarClass* pInstance; - pInstance = ((CBotVarPointer*)pile->GivVar())->GivPointer(); // value for the assignment + pInstance = (static_cast<CBotVarPointer*>(pile->GetVar()))->GetPointer(); // value for the assignment pThis->SetPointer(pInstance); } pThis->SetInit(true); @@ -708,7 +708,7 @@ bool CBotClassInst::Execute(CBotStack* &pj) { // evaluates the constructor of an instance - if ( !bIntrincic && pile->GivState() == 1) + if ( !bIntrincic && pile->GetState() == 1) { CBotToken* pt = &m_token; CBotClass* pClass = CBotClass::Find(pt); @@ -716,7 +716,7 @@ bool CBotClassInst::Execute(CBotStack* &pj) // creates an instance of the requested class CBotVarClass* pInstance; - pInstance = (CBotVarClass*)CBotVar::Create("", pClass); + pInstance = static_cast<CBotVarClass*>(CBotVar::Create("", pClass)); pThis->SetPointer(pInstance); delete pInstance; @@ -736,13 +736,13 @@ bool CBotClassInst::Execute(CBotStack* &pj) if ( p != NULL) while ( true ) { pile2 = pile2->AddStack(); // place on the stack for the results - if ( pile2->GivState() == 0 ) + if ( pile2->GetState() == 0 ) { if (!p->Execute(pile2)) return false; // interrupted here? pile2->SetState(1); } - ppVars[i++] = pile2->GivVar(); - p = p->GivNext(); + ppVars[i++] = pile2->GetVar(); + p = p->GetNext(); if ( p == NULL) break; } ppVars[i] = NULL; @@ -750,15 +750,15 @@ bool CBotClassInst::Execute(CBotStack* &pj) // creates a variable for the result CBotVar* pResult = NULL; // constructor still void - if ( !pClass->ExecuteMethode(m_nMethodeIdent, pClass->GivName(), + if ( !pClass->ExecuteMethode(m_nMethodeIdent, pClass->GetName(), pThis, ppVars, - pResult, pile2, GivToken())) return false; // interrupt + pResult, pile2, GetToken())) return false; // interrupt pThis->SetInit(true); pThis->ConstructorSet(); // indicates that the constructor has been called pile->Return(pile2); // releases a piece of stack -// pInstance = pThis->GivPointer(); +// pInstance = pThis->GetPointer(); } @@ -787,16 +787,16 @@ void CBotClassInst::RestoreState(CBotStack* &pj, bool bMain) // creates the variable of type pointer to the object { - CBotString name = m_var->m_token.GivString(); + CBotString name = m_var->m_token.GetString(); pThis = pile->FindVar(name); - pThis->SetUniqNum(((CBotLeftExprVar*)m_var)->m_nIdent); // its attribute a unique number + pThis->SetUniqNum((static_cast<CBotLeftExprVar*>(m_var))->m_nIdent); // its attribute a unique number } CBotToken* pt = &m_token; CBotClass* pClass = CBotClass::Find(pt); bool bIntrincic = pClass->IsIntrinsic(); - if ( bMain && pile->GivState()<3) + if ( bMain && pile->GetState()<3) { // is there an assignment or parameters (constructor) @@ -813,7 +813,7 @@ void CBotClassInst::RestoreState(CBotStack* &pj, bool bMain) { // evaluates the constructor of an instance - if ( !bIntrincic && pile->GivState() == 1) + if ( !bIntrincic && pile->GetState() == 1) { return; } @@ -833,21 +833,21 @@ void CBotClassInst::RestoreState(CBotStack* &pj, bool bMain) pile2 = pile2->RestoreStack(); // place on the stack for the results if ( pile2 == NULL ) return; - if ( pile2->GivState() == 0 ) + if ( pile2->GetState() == 0 ) { p->RestoreState(pile2, bMain); // interrupted here? return; } - ppVars[i++] = pile2->GivVar(); - p = p->GivNext(); + ppVars[i++] = pile2->GetVar(); + p = p->GetNext(); if ( p == NULL) break; } ppVars[i] = NULL; // creates a variable for the result - CBotVar* pResult = NULL; // constructor still void +// CBotVar* pResult = NULL; // constructor still void - pClass->RestoreMethode(m_nMethodeIdent, pClass->GivName(), pThis, ppVars, pile2); + pClass->RestoreMethode(m_nMethodeIdent, pClass->GetName(), pThis, ppVars, pile2); return; } } @@ -861,14 +861,14 @@ void CBotClassInst::RestoreState(CBotStack* &pj, bool bMain) bool CBotClass::CheckCall(CBotToken* &pToken, CBotDefParam* pParam) { - CBotString name = pToken->GivString(); + CBotString name = pToken->GetString(); if ( CBotCall::CheckCall(name) ) return true; CBotFunction* pp = m_pMethod; while ( pp != NULL ) { - if ( pToken->GivString() == pp->GivName() ) + if ( pToken->GetString() == pp->GetName() ) { // are their parameters exactly the same? if ( pp->CheckParam( pParam ) ) diff --git a/src/CBot/CBotDll.h b/src/CBot/CBotDll.h index 269ef94..7af63ca 100644 --- a/src/CBot/CBotDll.h +++ b/src/CBot/CBotDll.h @@ -77,9 +77,10 @@ enum CBotType //n = not implemented yet // for SetUserPtr when deleting an object -#define OBJECTDELETED ((void*)-1) +// \TODO define own types to distinct between different states of objects +#define OBJECTDELETED (reinterpret_cast<void*>(-1)) // value set before initialization -#define OBJECTCREATED ((void*)-2) +#define OBJECTCREATED (reinterpret_cast<void*>(-2)) /** \brief CBotTypResult class to define the complete type of a result*/ @@ -111,16 +112,16 @@ public: ~CBotTypResult(); - int GivType(int mode = 0) const; + int GetType(int mode = 0) const; // returns type CBotType* as a result void SetType(int n); // modifies a type - CBotClass* GivClass() const; + CBotClass* GetClass() const; // makes the pointer to the class (for CBotTypClass, CBotTypPointer) - int GivLimite() const; + int GetLimite() const; // returns limit size of table (CBotTypArray) void SetLimite(int n); @@ -129,7 +130,7 @@ public: void SetArray(int* max ); // set limits for a list of dimensions (arrays of arrays) - CBotTypResult& GivTypElem() const; + CBotTypResult& GetTypElem() const; // returns type of array elements (CBotTypArray) // rend le type des éléments du tableau (CBotTypArray) @@ -262,7 +263,7 @@ public: void Empty(); bool IsEmpty() const; - int GivLength(); + int GetLength(); int Find(const char c); int Find(const char* lpsz); int ReverseFind(const char c); @@ -314,7 +315,7 @@ private: int m_lg; /** \brief Keeps the string corresponding to keyword ID */ - static const std::map<EID, char *> s_keywordString; + static const std::map<EID,const char *> s_keywordString; /** * \brief MapIdToString maps given ID to its string equivalent @@ -338,7 +339,7 @@ public: CBotStringArray(); ~CBotStringArray(); void SetSize(int nb); - int GivSize(); + int GetSize(); void Add(const CBotString& str); CBotString& operator[](int nIndex); @@ -388,7 +389,7 @@ public: // frees the static memory areas static - int GivVersion(); + int GetVersion(); // gives the version of the library CBOT @@ -406,10 +407,10 @@ public: void SetIdent(long n); // associates an identifier with the instance CBotProgram - long GivIdent(); + long GetIdent(); // gives the identifier - int GivError(); + int GetError(); bool GetError(int& code, int& start, int& end); bool GetError(int& code, int& start, int& end, CBotProgram* &pProg); // if true @@ -417,7 +418,7 @@ public: // or execution // delimits the start and end block where the error // pProg lets you know what "module" has produced runtime error - static CBotString GivErrorText(int code); + static CBotString GetErrorText(int code); bool Start(const char* name); @@ -437,7 +438,7 @@ public: // FunctionName is a pointer made to the name of the function // start and end position in the text of the token processing - CBotVar* GivStackVars(const char* &FunctionName, int level); + CBotVar* GetStackVars(const char* &FunctionName, int level); // provides the pointer to the variables on the execution stack // level is an input parameter, 0 for the last level, -1, -2, etc. for the other levels // the return value (CBotVar *) is a variable list (or NULL) @@ -480,7 +481,7 @@ public: // see the above modes in CBotGet - CBotFunction* GivFunctions(); + CBotFunction* GetFunctions(); }; @@ -513,8 +514,8 @@ int cMean(CBotVar* &pVar, CBotString& ClassName) while ( pVar != NULL ) { - if ( pVar->GivType() > CBotTypDouble ) return 6002; // this is not a number - pVar = pVar -> GivNext(); + if ( pVar->GetType() > CBotTypDouble ) return 6002; // this is not a number + pVar = pVar -> GetNext(); } return CBotTypFloat; // the type of the result may depend on the parameters! @@ -527,8 +528,8 @@ bool rMean(CBotVar* pVar, CBotVar* pResult, int& Exception) int nb = 0; while (pVar != NULL) { - total += pVar->GivValFloat(); - pVar = pVar->GivNext(); + total += pVar->GetValFloat(); + pVar = pVar->GetNext(); nb++; } pResult->SetValFloat(total/nb); // returns the mean value @@ -544,7 +545,7 @@ bool rMean(CBotVar* pVar, CBotVar* pResult, int& Exception) // may be useful to the outside of the module // ( it is currently not expected to be able to create these objects in outer ) -// results of GivInit() +// results of GetInit() #define IS_UNDEF 0 // undefined variable #define IS_DEF 1 // variable defined #define IS_NAN 999 // variable defined as not a number @@ -615,33 +616,33 @@ virtual ~CBotVar( ); // destructor // associates a unique identifier to an instance // ( it is used to ensure that the id is unique) - void* GivUserPtr(); + void* GetUserPtr(); // makes the pointer associated with the variable - CBotString GivName(); // the name of the variable, if known + CBotString GetName(); // the name of the variable, if known //////////////////////////////////////////////////////////////////////////////////// void SetName(const char* name); // changes the name of the variable - int GivType(int mode = 0); // returns the base type (int) of the variable + int GetType(int mode = 0); // returns the base type (int) of the variable // TODO check it //////////////////////////////////////////////////////////////////////////////////////// - CBotTypResult GivTypResult(int mode = 0); // returns the complete type of the variable + CBotTypResult GetTypResult(int mode = 0); // returns the complete type of the variable - CBotToken* GivToken(); + CBotToken* GetToken(); void SetType(CBotTypResult& type); void SetInit(int bInit); // is the variable in the state IS_UNDEF, IS_DEF, IS_NAN - int GivInit(); // gives the state of the variable + int GetInit(); // gives the state of the variable void SetStatic(bool bStatic); bool IsStatic(); void SetPrivate(int mPrivate); bool IsPrivate(int mode = PR_PROTECT); - int GivPrivate(); + int GetPrivate(); virtual void ConstructorSet(); @@ -649,23 +650,23 @@ virtual ~CBotVar( ); // destructor void SetVal(CBotVar* var); // remprend une valeur // TODO remprend value virtual - CBotVar* GivItem(const char* name); // returns an element of a class according to its name (*) + CBotVar* GetItem(const char* name); // returns an element of a class according to its name (*) virtual - CBotVar* GivItemRef(int nIdent); // idem à partir du n° ref + CBotVar* GetItemRef(int nIdent); // idem à partir du n° ref // TODO ditto from ref no. virtual - CBotVar* GivItem(int row, bool bGrow = false); + CBotVar* GetItem(int row, bool bGrow = false); virtual - CBotVar* GivItemList(); // lists the elements + CBotVar* GetItemList(); // lists the elements - CBotVar* GivStaticVar(); // makes the pointer to the variable if it is static + CBotVar* GetStaticVar(); // makes the pointer to the variable if it is static bool IsElemOfClass(const char* name); // said if the element belongs to the class "name" // makes true if the object is a subclass - CBotVar* GivNext(); // next variable in the list (parameters) + CBotVar* GetNext(); // next variable in the list (parameters) //////////////////////////////////////////////////////////////////////////////////////////// void AddNext(CBotVar* pVar); // added to a list @@ -683,23 +684,23 @@ virtual ~CBotVar( ); // destructor virtual void SetValString(const char* p);// initialized with a string value (#) //////////////////////////////////////////////////////////////////////////////// - virtual int GivValInt(); // request the full value (#) + virtual int GetValInt(); // request the full value (#) //////////////////////////////////////////////////////////////////////// - virtual float GivValFloat(); // gets real value (#) + virtual float GetValFloat(); // gets real value (#) /////////////////////////////////////////////////////////////////////// virtual - CBotString GivValString(); // request the string value (#) + CBotString GetValString(); // request the string value (#) /////////////////////////////////////////////////////////////////////// virtual void SetClass(CBotClass* pClass); virtual - CBotClass* GivClass(); + CBotClass* GetClass(); virtual void SetPointer(CBotVar* p); virtual - CBotVarClass* GivPointer(); + CBotVarClass* GetPointer(); // virtual void SetIndirection(CBotVar* pVar); virtual void Add(CBotVar* left, CBotVar* right); // addition @@ -736,13 +737,13 @@ virtual ~CBotVar( ); // destructor void debug(); // virtual -// CBotVar* GivMyThis(); +// CBotVar* GetMyThis(); virtual void Maj(void* pUser = NULL, bool bContinue = true); void SetUniqNum(long n); - long GivUniqNum(); + long GetUniqNum(); static long NextUniqNum(); }; @@ -751,12 +752,12 @@ virtual ~CBotVar( ); // destructor can be called with objects which are respectively integer, real or string Always be sure of the type of the variable before calling these methods - if ( pVar->GivType() == CBotInt() ) pVar->SetValFloat( 3.3 ); // plante !! + if ( pVar->GetType() == CBotInt() ) pVar->SetValFloat( 3.3 ); // plante !! - methods GivValInt(), GivValFloat() et GivValString() + methods GetValInt(), GetValFloat() et GetValString() use value conversions, - GivValString() works on numbers (makes the corresponding string) - but do not make GivValInt () with a string variable! + GetValString() works on numbers (makes the corresponding string) + but do not make GetValInt () with a string variable! */ @@ -824,8 +825,8 @@ public: // adds an element by giving an element of type CBotVar void AddNext(CBotClass* pClass); - CBotString GivName(); // gives the name of the class - CBotClass* GivParent(); // gives the parent class (or NULL) + CBotString GetName(); // gives the name of the class + CBotClass* GetParent(); // gives the parent class (or NULL) // true if a class is derived (Extends) of another // return true also if the classes are identical @@ -837,9 +838,9 @@ public: static CBotClass* Find(const char* name); - CBotVar* GivVar(); // return the list of variables - CBotVar* GivItem(const char* name); // one of the variables according to its name - CBotVar* GivItemRef(int nIdent); + CBotVar* GetVar(); // return the list of variables + CBotVar* GetItem(const char* name); // one of the variables according to its name + CBotVar* GetItemRef(int nIdent); CBotTypResult CompileMethode(const char* name, CBotVar* pThis, CBotVar** ppParams, CBotCStack* pStack, long& nIdent); @@ -922,9 +923,9 @@ private: * \brief Check whether given parameter is a keyword */ static - int GivKeyWords(const char* w); // is it a keyword? + int GetKeyWords(const char* w); // is it a keyword? static - bool GivKeyDefNum(const char* w, CBotToken* &token); + bool GetKeyDefNum(const char* w, CBotToken* &token); /** * \brief Loads the list of keywords @@ -948,35 +949,35 @@ public: /** * \brief Returns the type of token */ - int GivType(); + int GetType(); /** * \brief makes the string corresponding to this token */ - CBotString& GivString(); + CBotString& GetString(); /** * \brief makes the following separator token */ - CBotString& GivSep(); + CBotString& GetSep(); /** * \brief position of the beginning in the text */ - int GivStart(); + int GetStart(); /** * \brief end position in the text */ - int GivEnd(); + int GetEnd(); /** * \brief gives the next token in the list */ - CBotToken* GivNext(); + CBotToken* GetNext(); /** * \brief gives the previous token in a list */ - CBotToken* GivPrev(); + CBotToken* GetPrev(); /** * \brief transforms the entire program @@ -997,7 +998,7 @@ public: void SetString(const char* name); void SetPos(int start, int end); - long GivIdKey(); + long GetIdKey(); /** * \brief adds a token (a copy) */ @@ -1091,7 +1092,7 @@ public: // routine that implements the GOTO (CPoint pos) bool rDoGoto( CBotVar* pVar, CBotVar* pResult, int& exception ) { - if (pVar->GivType() != CBotTypeClass || + if (pVar->GetType() != CBotTypeClass || pVar->IsElemOfClas("CPoint") ) { exception = 6522; return false; ) // the parameter is not the right class? // in fact the control is done to the routine of compilation @@ -1100,13 +1101,13 @@ bool rDoGoto( CBotVar* pVar, CBotVar* pResult, int& exception ) // or so CBotVar* temp; - temp = pVar->GivItem("x"); // is necessary for the object of type CPoint - ASSERT (temp != NULL && temp->GivType() == CBotTypFloat); - m_PosToGo.x = temp->GivValFloat(); + temp = pVar->GetItem("x"); // is necessary for the object of type CPoint + ASSERT (temp != NULL && temp->GetType() == CBotTypFloat); + m_PosToGo.x = temp->GetValFloat(); - temp = pVar->GivItem("y"); // is necessary for the object of type CPoint - ASSERT (temp != NULL && temp->GivType() == CBotTypFloat); - m_PosToGo.y = temp->GivValFloat(); + temp = pVar->GetItem("y"); // is necessary for the object of type CPoint + ASSERT (temp != NULL && temp->GetType() == CBotTypFloat); + m_PosToGo.y = temp->GetValFloat(); return (m_CurentPos == m_PosToGo); // makes true if the position is reached // returns false if one had wait yet diff --git a/src/CBot/CBotFunction.cpp b/src/CBot/CBotFunction.cpp index 1c94c1b..28db24e 100644 --- a/src/CBot/CBotFunction.cpp +++ b/src/CBot/CBotFunction.cpp @@ -77,40 +77,40 @@ bool CBotFunction::IsExtern() bool CBotFunction::GetPosition(int& start, int& stop, CBotGet modestart, CBotGet modestop) { - start = m_extern.GivStart(); - stop = m_closeblk.GivEnd(); + start = m_extern.GetStart(); + stop = m_closeblk.GetEnd(); if (modestart == GetPosExtern) { - start = m_extern.GivStart(); + start = m_extern.GetStart(); } if (modestop == GetPosExtern) { - stop = m_extern.GivEnd(); + stop = m_extern.GetEnd(); } if (modestart == GetPosNom) { - start = m_token.GivStart(); + start = m_token.GetStart(); } if (modestop == GetPosNom) { - stop = m_token.GivEnd(); + stop = m_token.GetEnd(); } if (modestart == GetPosParam) { - start = m_openpar.GivStart(); + start = m_openpar.GetStart(); } if (modestop == GetPosParam) { - stop = m_closepar.GivEnd(); + stop = m_closepar.GetEnd(); } if (modestart == GetPosBloc) { - start = m_openblk.GivStart(); + start = m_openblk.GetStart(); } if (modestop == GetPosBloc) { - stop = m_closeblk.GivEnd(); + stop = m_closeblk.GetEnd(); } return true; @@ -123,7 +123,7 @@ CBotTypResult ArrayType(CBotToken* &p, CBotCStack* pile, CBotTypResult type) { if ( !IsOfType( p, ID_CLBRK ) ) { - pile->SetError(TX_CLBRK, p->GivStart()); + pile->SetError(TX_CLBRK, p->GetStart()); return CBotTypResult( -1 ); } type = CBotTypResult( CBotTypArrayPointer, type ); @@ -135,30 +135,30 @@ CBotTypResult TypeParam(CBotToken* &p, CBotCStack* pile) { CBotClass* pClass = NULL; - switch (p->GivType()) + switch (p->GetType()) { case ID_INT: - p = p->GivNext(); + p = p->GetNext(); return ArrayType(p, pile, CBotTypResult( CBotTypInt )); case ID_FLOAT: - p = p->GivNext(); + p = p->GetNext(); return ArrayType(p, pile, CBotTypResult( CBotTypFloat )); case ID_BOOLEAN: case ID_BOOL: - p = p->GivNext(); + p = p->GetNext(); return ArrayType(p, pile, CBotTypResult( CBotTypBoolean )); case ID_STRING: - p = p->GivNext(); + p = p->GetNext(); return ArrayType(p, pile, CBotTypResult( CBotTypString )); case ID_VOID: - p = p->GivNext(); + p = p->GetNext(); return CBotTypResult( 0 ); case TokenTypVar: pClass = CBotClass::Find(p); if ( pClass != NULL) { - p = p->GivNext(); + p = p->GetNext(); return ArrayType(p, pile, pClass->IsIntrinsic() ? CBotTypResult( CBotTypIntrinsic, pClass ) : @@ -203,14 +203,14 @@ CBotFunction* CBotFunction::Compile(CBotToken* &p, CBotCStack* pStack, CBotFunct // CBotClass* pClass; func->m_retTyp = TypeParam(p, pStk); // type of the result - if (func->m_retTyp.GivType() >= 0) + if (func->m_retTyp.GetType() >= 0) { CBotToken* pp = p; func->m_token = *p; if ( IsOfType(p, ID_NOT) ) { - CBotToken d("~" + p->GivString()); + CBotToken d("~" + p->GetString()); func->m_token = d; } @@ -219,7 +219,7 @@ CBotFunction* CBotFunction::Compile(CBotToken* &p, CBotCStack* pStack, CBotFunct { if ( IsOfType( p, ID_DBLDOTS ) ) // method for a class { - func->m_MasterClass = pp->GivString(); + func->m_MasterClass = pp->GetString(); CBotClass* pClass = CBotClass::Find(pp); if ( pClass == NULL ) goto bad; @@ -230,7 +230,7 @@ CBotFunction* CBotFunction::Compile(CBotToken* &p, CBotCStack* pStack, CBotFunct } func->m_openpar = p; func->m_Param = CBotDefParam::Compile( p, pStk ); - func->m_closepar = p->GivPrev(); + func->m_closepar = p->GetPrev(); if (pStk->IsOk()) { pStk->SetRetType(func->m_retTyp); // for knowledge what type returns @@ -247,24 +247,24 @@ CBotFunction* CBotFunction::Compile(CBotToken* &p, CBotCStack* pStack, CBotFunct // initialize variables acording to This // only saves the pointer to the first, // the rest is chained - CBotVar* pv = pThis->GivItemList(); + CBotVar* pv = pThis->GetItemList(); // int num = 1; while (pv != NULL) { CBotVar* pcopy = CBotVar::Create(pv); // pcopy->SetInit(2); pcopy->Copy(pv); - pcopy->SetPrivate(pv->GivPrivate()); -// pcopy->SetUniqNum(pv->GivUniqNum()); //num++); + pcopy->SetPrivate(pv->GetPrivate()); +// pcopy->SetUniqNum(pv->GetUniqNum()); //num++); pStk->AddVar(pcopy); - pv = pv->GivNext(); + pv = pv->GetNext(); } } // and compiles the following instruction block func->m_openblk = p; func->m_Block = CBotBlock::Compile(p, pStk, false); - func->m_closeblk = p->GivPrev(); + func->m_closeblk = p->GetPrev(); if ( pStk->IsOk() ) { if ( func->m_bPublic ) // public function, return known for all @@ -309,7 +309,7 @@ CBotFunction* CBotFunction::Compile1(CBotToken* &p, CBotCStack* pStack, CBotClas func->m_retToken = *p; func->m_retTyp = TypeParam(p, pStack); // type of the result - if (func->m_retTyp.GivType() >= 0) + if (func->m_retTyp.GetType() >= 0) { CBotToken* pp = p; func->m_token = *p; @@ -318,7 +318,7 @@ CBotFunction* CBotFunction::Compile1(CBotToken* &p, CBotCStack* pStack, CBotClas { if ( IsOfType( p, ID_DBLDOTS ) ) // method for a class { - func->m_MasterClass = pp->GivString(); + func->m_MasterClass = pp->GetString(); CBotClass* pClass = CBotClass::Find(pp); if ( pClass == NULL ) { @@ -344,8 +344,8 @@ CBotFunction* CBotFunction::Compile1(CBotToken* &p, CBotCStack* pStack, CBotClas // and skips the following instruction block do { - int type = p->GivType(); - p = p->GivNext(); + int type = p->GetType(); + p = p->GetNext(); if (type == ID_OPBLK) level++; if (type == ID_CLBLK) level--; } @@ -377,13 +377,13 @@ bool CBotFunction::Execute(CBotVar** ppVars, CBotStack* &pj, CBotVar* pInstance) pile->SetBotCall(m_pProg); // bases for routines - if ( pile->GivState() == 0 ) + if ( pile->GetState() == 0 ) { if ( !m_Param->Execute(ppVars, pile) ) return false; // define parameters pile->IncState(); } - if ( pile->GivState() == 1 && !m_MasterClass.IsEmpty() ) + if ( pile->GetState() == 1 && !m_MasterClass.IsEmpty() ) { // makes "this" known CBotVar* pThis ; @@ -410,7 +410,7 @@ bool CBotFunction::Execute(CBotVar** ppVars, CBotStack* &pj, CBotVar* pInstance) if ( !m_Block->Execute(pile) ) { - if ( pile->GivError() < 0 ) + if ( pile->GetError() < 0 ) pile->SetError( 0 ); else return false; @@ -428,11 +428,11 @@ void CBotFunction::RestoreState(CBotVar** ppVars, CBotStack* &pj, CBotVar* pInst pile->SetBotCall(m_pProg); // bases for routines - if ( pile->GivBlock() < 2 ) + if ( pile->GetBlock() < 2 ) { CBotStack* pile2 = pile->RestoreStack(NULL); // one end of stack local to this function if ( pile2 == NULL ) return; - pile->SetState(pile->GivState() + pile2->GivState()); + pile->SetState(pile->GetState() + pile2->GetState()); pile2->Delete(); } @@ -462,7 +462,8 @@ CBotTypResult CBotFunction::CompileCall(const char* name, CBotVar** ppVars, long nIdent = 0; CBotTypResult type; - CBotFunction* pt = FindLocalOrPublic(nIdent, name, ppVars, type); +// CBotFunction* pt = FindLocalOrPublic(nIdent, name, ppVars, type); + FindLocalOrPublic(nIdent, name, ppVars, type); return type; } @@ -507,7 +508,7 @@ CBotFunction* CBotFunction::FindLocalOrPublic(long& nIdent, const char* name, CB { for ( pt = this ; pt != NULL ; pt = pt->m_next ) { - if ( pt->m_token.GivString() == name ) + if ( pt->m_token.GetString() == name ) { int i = 0; int alpha = 0; // signature of parameters @@ -516,15 +517,15 @@ CBotFunction* CBotFunction::FindLocalOrPublic(long& nIdent, const char* name, CB CBotVar* pw = ppVars[i++]; // provided list parameter while ( pv != NULL && pw != NULL) { - if (!TypesCompatibles(pv->GivTypResult(), pw->GivTypResult())) + if (!TypesCompatibles(pv->GetTypResult(), pw->GetTypResult())) { if ( pFunc == NULL ) TypeOrError = TX_BADPARAM; break; } - int d = pv->GivType() - pw->GivType(2); + int d = pv->GetType() - pw->GetType(2); alpha += d>0 ? d : -10*d; // quality loss, 10 times more expensive! - pv = pv->GivNext(); + pv = pv->GetNext(); pw = ppVars[i++]; } if ( pw != NULL ) @@ -562,7 +563,7 @@ CBotFunction* CBotFunction::FindLocalOrPublic(long& nIdent, const char* name, CB { for ( pt = m_listPublic ; pt != NULL ; pt = pt->m_nextpublic ) { - if ( pt->m_token.GivString() == name ) + if ( pt->m_token.GetString() == name ) { int i = 0; int alpha = 0; // signature of parameters @@ -571,15 +572,15 @@ CBotFunction* CBotFunction::FindLocalOrPublic(long& nIdent, const char* name, CB CBotVar* pw = ppVars[i++]; // list of provided parameters while ( pv != NULL && pw != NULL) { - if (!TypesCompatibles(pv->GivTypResult(), pw->GivTypResult())) + if (!TypesCompatibles(pv->GetTypResult(), pw->GetTypResult())) { if ( pFunc == NULL ) TypeOrError = TX_BADPARAM; break; } - int d = pv->GivType() - pw->GivType(2); + int d = pv->GetType() - pw->GetType(2); alpha += d>0 ? d : -10*d; // quality loss, 10 times more expensive! - pv = pv->GivNext(); + pv = pv->GetNext(); pw = ppVars[i++]; } if ( pw != NULL ) @@ -645,7 +646,7 @@ int CBotFunction::DoCall(long& nIdent, const char* name, CBotVar** ppVars, CBotS // preparing parameters on the stack - if ( pStk1->GivState() == 0 ) + if ( pStk1->GetState() == 0 ) { if ( !pt->m_MasterClass.IsEmpty() ) { @@ -677,13 +678,13 @@ int CBotFunction::DoCall(long& nIdent, const char* name, CBotVar** ppVars, CBotS // finally execution of the found function - if ( !pStk3->GivRetVar( // puts the result on the stack - pt->m_Block->Execute(pStk3) )) // GivRetVar said if it is interrupted + if ( !pStk3->GetRetVar( // puts the result on the stack + pt->m_Block->Execute(pStk3) )) // GetRetVar said if it is interrupted { if ( !pStk3->IsOk() && pt->m_pProg != m_pProg ) { #ifdef _DEBUG - if ( m_pProg->GivFunctions()->GivName() == "LaCommande" ) return false; + if ( m_pProg->GetFunctions()->GetName() == "LaCommande" ) return false; #endif pStk3->SetPosError(pToken); // indicates the error on the procedure call } @@ -713,7 +714,7 @@ void CBotFunction::RestoreCall(long& nIdent, const char* name, CBotVar** ppVars, pStk1->SetBotCall(pt->m_pProg); // it may have changed module - if ( pStk1->GivBlock() < 2 ) + if ( pStk1->GetBlock() < 2 ) { CBotStack* pStk2 = pStk1->RestoreStack(NULL); // used more if ( pStk2 == NULL ) return; @@ -731,7 +732,7 @@ void CBotFunction::RestoreCall(long& nIdent, const char* name, CBotVar** ppVars, { if ( !pt->m_MasterClass.IsEmpty() ) { - CBotVar* pInstance = m_pProg->m_pInstance; +// CBotVar* pInstance = m_pProg->m_pInstance; // make "this" known CBotVar* pThis = pStk1->FindVar("this"); pThis->SetInit(2); @@ -739,7 +740,7 @@ void CBotFunction::RestoreCall(long& nIdent, const char* name, CBotVar** ppVars, } } - if ( pStk1->GivState() == 0 ) + if ( pStk1->GetState() == 0 ) { pt->m_Param->RestoreState(pStk3, true); return; @@ -759,13 +760,13 @@ void CBotFunction::RestoreCall(long& nIdent, const char* name, CBotVar** ppVars, int CBotFunction::DoCall(long& nIdent, const char* name, CBotVar* pThis, CBotVar** ppVars, CBotStack* pStack, CBotToken* pToken, CBotClass* pClass) { CBotTypResult type; - CBotProgram* pProgCurrent = pStack->GivBotCall(); + CBotProgram* pProgCurrent = pStack->GetBotCall(); CBotFunction* pt = FindLocalOrPublic(nIdent, name, ppVars, type, false); if ( pt != NULL ) { -// DEBUG( "CBotFunction::DoCall" + pt->GivName(), 0, pStack); +// DEBUG( "CBotFunction::DoCall" + pt->GetName(), 0, pStack); CBotStack* pStk = pStack->AddStack(pt, 2); // if ( pStk == EOX ) return true; @@ -775,7 +776,7 @@ int CBotFunction::DoCall(long& nIdent, const char* name, CBotVar* pThis, CBotVar // preparing parameters on the stack - if ( pStk->GivState() == 0 ) + if ( pStk->GetState() == 0 ) { // sets the variable "this" on the stack CBotVar* pthis = CBotVar::Create("this", CBotTypNullPointer); @@ -783,7 +784,7 @@ int CBotFunction::DoCall(long& nIdent, const char* name, CBotVar* pThis, CBotVar pthis->SetUniqNum(-2); // special value pStk->AddVar(pthis); - CBotClass* pClass = pThis->GivClass()->GivParent(); + CBotClass* pClass = pThis->GetClass()->GetParent(); if ( pClass ) { // sets the variable "super" on the stack @@ -797,19 +798,19 @@ int CBotFunction::DoCall(long& nIdent, const char* name, CBotVar* pThis, CBotVar pStk->IncState(); } - if ( pStk->GivState() == 1 ) + if ( pStk->GetState() == 1 ) { if ( pt->m_bSynchro ) { - CBotProgram* pProgBase = pStk->GivBotCall(true); + CBotProgram* pProgBase = pStk->GetBotCall(true); if ( !pClass->Lock(pProgBase) ) return false; // expected to power \TODO attend de pouvoir } pStk->IncState(); } // finally calls the found function - if ( !pStk3->GivRetVar( // puts the result on the stack - pt->m_Block->Execute(pStk3) )) // GivRetVar said if it is interrupted + if ( !pStk3->GetRetVar( // puts the result on the stack + pt->m_Block->Execute(pStk3) )) // GetRetVar said if it is interrupted { if ( !pStk3->IsOk() ) { @@ -855,10 +856,10 @@ void CBotFunction::RestoreCall(long& nIdent, const char* name, CBotVar* pThis, C pt->m_Param->RestoreState(pStk3, true); // parameters - if ( pStk->GivState() > 1 && // latching is effective? + if ( pStk->GetState() > 1 && // latching is effective? pt->m_bSynchro ) { - CBotProgram* pProgBase = pStk->GivBotCall(true); + CBotProgram* pProgBase = pStk->GetBotCall(true); pClass->Lock(pProgBase); // locks the class } @@ -874,21 +875,21 @@ bool CBotFunction::CheckParam(CBotDefParam* pParam) CBotDefParam* pp = m_Param; while ( pp != NULL && pParam != NULL ) { - CBotTypResult type1 = pp->GivType(); - CBotTypResult type2 = pParam->GivType(); + CBotTypResult type1 = pp->GetType(); + CBotTypResult type2 = pParam->GetType(); if ( !type1.Compare(type2) ) return false; - pp = pp->GivNext(); - pParam = pParam->GivNext(); + pp = pp->GetNext(); + pParam = pParam->GetNext(); } return ( pp == NULL && pParam == NULL ); } -CBotString CBotFunction::GivName() +CBotString CBotFunction::GetName() { - return m_token.GivString(); + return m_token.GetString(); } -CBotString CBotFunction::GivParams() +CBotString CBotFunction::GetParams() { if ( m_Param == NULL ) return CBotString("()"); @@ -897,8 +898,8 @@ CBotString CBotFunction::GivParams() while (p != NULL) { - params += p->GivParamString(); - p = p->GivNext(); + params += p->GetParamString(); + p = p->GetNext(); if ( p != NULL ) params += ", "; } @@ -945,7 +946,7 @@ CBotDefParam* CBotDefParam::Compile(CBotToken* &p, CBotCStack* pStack) // mainly not pStack->TokenStack here // declared variables must remain visible thereafter - pStack->SetStartError(p->GivStart()); + pStack->SetStartError(p->GetStart()); if (IsOfType(p, ID_OPENPAR)) { @@ -957,12 +958,12 @@ CBotDefParam* CBotDefParam::Compile(CBotToken* &p, CBotCStack* pStack) if (list == NULL) list = param; else list->AddNext(param); // added to the list - CBotClass* pClass = NULL;//= CBotClass::Find(p); - param->m_typename = p->GivString(); +// CBotClass* pClass = NULL;//= CBotClass::Find(p); + param->m_typename = p->GetString(); CBotTypResult type = param->m_type = TypeParam(p, pStack); // if ( type == CBotTypPointer ) type = CBotTypClass; // we must create a new object - if (param->m_type.GivType() > 0) + if (param->m_type.GetType() > 0) { CBotToken* pp = p; param->m_token = *p; @@ -977,17 +978,17 @@ CBotDefParam* CBotDefParam::Compile(CBotToken* &p, CBotCStack* pStack) } if ( type.Eq(CBotTypArrayPointer) ) type.SetType(CBotTypArrayBody); - CBotVar* var = CBotVar::Create(pp->GivString(), type); // creates the variable + CBotVar* var = CBotVar::Create(pp->GetString(), type); // creates the variable // if ( pClass ) var->SetClass(pClass); var->SetInit(2); // mark initialized param->m_nIdent = CBotVar::NextUniqNum(); var->SetUniqNum(param->m_nIdent); pStack->AddVar(var); // place on the stack - if (IsOfType(p, ID_COMMA) || p->GivType() == ID_CLOSEPAR) + if (IsOfType(p, ID_COMMA) || p->GetType() == ID_CLOSEPAR) continue; } - pStack->SetError(TX_CLOSEPAR, p->GivStart()); + pStack->SetError(TX_CLOSEPAR, p->GetStart()); } pStack->SetError(TX_NOTYP, p); delete list; @@ -995,7 +996,7 @@ CBotDefParam* CBotDefParam::Compile(CBotToken* &p, CBotCStack* pStack) } return list; } - pStack->SetError(TX_OPENPAR, p->GivStart()); + pStack->SetError(TX_OPENPAR, p->GetStart()); return NULL; } @@ -1016,32 +1017,32 @@ bool CBotDefParam::Execute(CBotVar** ppVars, CBotStack* &pj) while ( p != NULL ) { // creates a local variable on the stack - CBotVar* newvar = CBotVar::Create(p->m_token.GivString(), p->m_type); + CBotVar* newvar = CBotVar::Create(p->m_token.GetString(), p->m_type); // serves to make the transformation of types: if ( ppVars != NULL && ppVars[i] != NULL ) { - switch (p->m_type.GivType()) + switch (p->m_type.GetType()) { case CBotTypInt: - newvar->SetValInt(ppVars[i]->GivValInt()); + newvar->SetValInt(ppVars[i]->GetValInt()); break; case CBotTypFloat: - newvar->SetValFloat(ppVars[i]->GivValFloat()); + newvar->SetValFloat(ppVars[i]->GetValFloat()); break; case CBotTypString: - newvar->SetValString(ppVars[i]->GivValString()); + newvar->SetValString(ppVars[i]->GetValString()); break; case CBotTypBoolean: - newvar->SetValInt(ppVars[i]->GivValInt()); + newvar->SetValInt(ppVars[i]->GetValInt()); break; case CBotTypIntrinsic: - ((CBotVarClass*)newvar)->Copy(ppVars[i], false); + (static_cast<CBotVarClass*>(newvar))->Copy(ppVars[i], false); break; case CBotTypPointer: case CBotTypArrayPointer: { - newvar->SetPointer(ppVars[i]->GivPointer()); + newvar->SetPointer(ppVars[i]->GetPointer()); } break; default: @@ -1059,41 +1060,41 @@ bool CBotDefParam::Execute(CBotVar** ppVars, CBotStack* &pj) void CBotDefParam::RestoreState(CBotStack* &pj, bool bMain) { - int i = 0; +// int i = 0; CBotDefParam* p = this; while ( p != NULL ) { // creates a local variable on the stack - CBotVar* var = pj->FindVar(p->m_token.GivString()); + CBotVar* var = pj->FindVar(p->m_token.GetString()); var->SetUniqNum(p->m_nIdent); p = p->m_next; } } -int CBotDefParam::GivType() +int CBotDefParam::GetType() { - return m_type.GivType(); + return m_type.GetType(); } -CBotTypResult CBotDefParam::GivTypResult() +CBotTypResult CBotDefParam::GetTypResult() { return m_type; } -CBotDefParam* CBotDefParam::GivNext() +CBotDefParam* CBotDefParam::GetNext() { return m_next; } -CBotString CBotDefParam::GivParamString() +CBotString CBotDefParam::GetParamString() { CBotString param; param = m_typename; param += ' '; - param += m_token.GivString(); + param += m_token.GetString(); return param; } @@ -1122,9 +1123,9 @@ CBotInstr* CBotReturn::Compile(CBotToken* &p, CBotCStack* pStack) CBotReturn* inst = new CBotReturn(); // creates the object inst->SetToken( pp ); - CBotTypResult type = pStack->GivRetType(); + CBotTypResult type = pStack->GetRetType(); - if ( type.GivType() == 0 ) // returned void ? + if ( type.GetType() == 0 ) // returned void ? { if ( IsOfType( p, ID_SEP ) ) return inst; pStack->SetError( TX_BADTYPE, pp ); @@ -1134,15 +1135,15 @@ CBotInstr* CBotReturn::Compile(CBotToken* &p, CBotCStack* pStack) inst->m_Instr = CBotExpression::Compile(p, pStack); if ( pStack->IsOk() ) { - CBotTypResult retType = pStack->GivTypResult(2); + CBotTypResult retType = pStack->GetTypResult(2); if (TypeCompatible(retType, type, ID_ASS)) { if ( IsOfType( p, ID_SEP ) ) return inst; - pStack->SetError(TX_ENDOF, p->GivStart()); + pStack->SetError(TX_ENDOF, p->GetStart()); } - pStack->SetError(TX_BADTYPE, p->GivStart()); + pStack->SetError(TX_BADTYPE, p->GetStart()); } delete inst; @@ -1154,7 +1155,7 @@ bool CBotReturn::Execute(CBotStack* &pj) CBotStack* pile = pj->AddStack(this); // if ( pile == EOX ) return true; - if ( pile->GivState() == 0 ) + if ( pile->GetState() == 0 ) { if ( m_Instr != NULL && !m_Instr->Execute(pile) ) return false; // evaluate the result // the result is on the stack @@ -1173,7 +1174,7 @@ void CBotReturn::RestoreState(CBotStack* &pj, bool bMain) CBotStack* pile = pj->RestoreStack(this); if ( pile == NULL ) return; - if ( pile->GivState() == 0 ) + if ( pile->GetState() == 0 ) { if ( m_Instr != NULL ) m_Instr->RestoreState(pile, bMain); // evaluate the result return; @@ -1202,9 +1203,9 @@ CBotInstr* CBotInstrCall::Compile(CBotToken* &p, CBotCStack* pStack) int i = 0; CBotToken* pp = p; - p = p->GivNext(); + p = p->GetNext(); - pStack->SetStartError(p->GivStart()); + pStack->SetStartError(p->GetStart()); CBotCStack* pile = pStack; if ( IsOfType(p, ID_OPENPAR) ) @@ -1216,11 +1217,11 @@ CBotInstr* CBotInstrCall::Compile(CBotToken* &p, CBotCStack* pStack) // compile la list of parameters if (!IsOfType(p, ID_CLOSEPAR)) while (true) { - start = p->GivStart(); + start = p->GetStart(); pile = pile->TokenStack(); // keeps the results on the stack CBotInstr* param = CBotExpression::Compile(p, pile); - end = p->GivStart(); + end = p->GetStart(); if ( inst->m_Parameters == NULL ) inst->m_Parameters = param; else inst->m_Parameters->AddNext(param); // constructs the list @@ -1232,22 +1233,22 @@ CBotInstr* CBotInstrCall::Compile(CBotToken* &p, CBotCStack* pStack) if ( param != NULL ) { - if ( pile->GivTypResult().Eq(99) ) + if ( pile->GetTypResult().Eq(99) ) { delete pStack->TokenStack(); - pStack->SetError(TX_VOID, p->GivStart()); + pStack->SetError(TX_VOID, p->GetStart()); delete inst; return NULL; } - ppVars[i] = pile->GivVar(); - ppVars[i]->GivToken()->SetPos(start, end); + 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->GivStart()); + pStack->SetError(TX_CLOSEPAR, p->GetStart()); delete pStack->TokenStack(); delete inst; return NULL; @@ -1257,17 +1258,17 @@ CBotInstr* CBotInstrCall::Compile(CBotToken* &p, CBotCStack* pStack) // the routine is known? // CBotClass* pClass = NULL; inst->m_typRes = pStack->CompileCall(pp, ppVars, inst->m_nFuncIdent); - if ( inst->m_typRes.GivType() >= 20 ) + if ( inst->m_typRes.GetType() >= 20 ) { // if (pVar2!=NULL) pp = pVar2->RetToken(); - pStack->SetError( inst->m_typRes.GivType(), pp ); + pStack->SetError( inst->m_typRes.GetType(), pp ); delete pStack->TokenStack(); delete inst; return NULL; } delete pStack->TokenStack(); - if ( inst->m_typRes.GivType() > 0 ) + if ( inst->m_typRes.GetType() > 0 ) { CBotVar* pRes = CBotVar::Create("", inst->m_typRes); pStack->SetVar(pRes); // for knowing the type of the result @@ -1287,7 +1288,7 @@ bool CBotInstrCall::Execute(CBotStack* &pj) CBotStack* pile = pj->AddStack(this); if ( pile->StackOver() ) return pj->Return( pile ); - CBotStack* pile1 = pile; +// CBotStack* pile1 = pile; int i = 0; @@ -1298,13 +1299,13 @@ bool CBotInstrCall::Execute(CBotStack* &pj) if ( p != NULL) while ( true ) { pile = pile->AddStack(); // place on the stack for the results - if ( pile->GivState() == 0 ) + if ( pile->GetState() == 0 ) { if (!p->Execute(pile)) return false; // interrupted here? pile->SetState(1); // mark as special for reknowed parameters \TODO marque spéciale pour reconnaîre parameters } - ppVars[i++] = pile->GivVar(); - p = p->GivNext(); + ppVars[i++] = pile->GetVar(); + p = p->GetNext(); if ( p == NULL) break; } ppVars[i] = NULL; @@ -1312,7 +1313,7 @@ bool CBotInstrCall::Execute(CBotStack* &pj) CBotStack* pile2 = pile->AddStack(); if ( pile2->IfStep() ) return false; - if ( !pile2->ExecuteCall(m_nFuncIdent, GivToken(), ppVars, m_typRes)) return false; // interrupt + if ( !pile2->ExecuteCall(m_nFuncIdent, GetToken(), ppVars, m_typRes)) return false; // interrupt return pj->Return(pile2); // release the entire stack } @@ -1324,7 +1325,7 @@ void CBotInstrCall::RestoreState(CBotStack* &pj, bool bMain) CBotStack* pile = pj->RestoreStack(this); if ( pile == NULL ) return; - CBotStack* pile1 = pile; +// CBotStack* pile1 = pile; int i = 0; CBotVar* ppVars[1000]; @@ -1336,13 +1337,13 @@ void CBotInstrCall::RestoreState(CBotStack* &pj, bool bMain) { pile = pile->RestoreStack(); // place on the stack for the results if ( pile == NULL ) return; - if ( pile->GivState() == 0 ) + if ( pile->GetState() == 0 ) { p->RestoreState(pile, bMain); // interrupt here! return; } - ppVars[i++] = pile->GivVar(); // constructs the list of parameters - p = p->GivNext(); + ppVars[i++] = pile->GetVar(); // constructs the list of parameters + p = p->GetNext(); if ( p == NULL) break; } ppVars[i] = NULL; @@ -1350,7 +1351,7 @@ void CBotInstrCall::RestoreState(CBotStack* &pj, bool bMain) CBotStack* pile2 = pile->RestoreStack(); if ( pile2 == NULL ) return; - pile2->RestoreCall(m_nFuncIdent, GivToken(), ppVars); + pile2->RestoreCall(m_nFuncIdent, GetToken(), ppVars); } ////////////////////////////////////////////////////////////////////////////// @@ -1369,7 +1370,7 @@ CBotClass* CBotClass::Compile1(CBotToken* &p, CBotCStack* pStack) if ( !IsOfType(p, ID_CLASS) ) return NULL; - CBotString name = p->GivString(); + CBotString name = p->GetString(); CBotClass* pOld = CBotClass::Find(name); if ( pOld != NULL && pOld->m_IsDef ) @@ -1384,7 +1385,7 @@ CBotClass* CBotClass::Compile1(CBotToken* &p, CBotCStack* pStack) CBotClass* pPapa = NULL; if ( IsOfType( p, ID_EXTENDS ) ) { - CBotString name = p->GivString(); + CBotString name = p->GetString(); pPapa = CBotClass::Find(name); if (!IsOfType(p, TokenTypVar) || pPapa == NULL ) @@ -1454,7 +1455,7 @@ bool CBotClass::CompileDefItem(CBotToken* &p, CBotCStack* pStack, bool bSecond) { CBotInstr* i = NULL; - if ( p->GivType() != ID_CLBRK ) + if ( p->GetType() != ID_CLBRK ) i = CBotExpression::Compile( p, pStack ); // expression for the value else i = new CBotEmpty(); // special if not a formula @@ -1463,14 +1464,14 @@ bool CBotClass::CompileDefItem(CBotToken* &p, CBotCStack* pStack, bool bSecond) if (!pStack->IsOk() || !IsOfType( p, ID_CLBRK ) ) { - pStack->SetError(TX_CLBRK, p->GivStart()); + pStack->SetError(TX_CLBRK, p->GetStart()); return false; } -/* CBotVar* pv = pStack->GivVar(); - if ( pv->GivType()>= CBotTypBoolean ) +/* CBotVar* pv = pStack->GetVar(); + if ( pv->GetType()>= CBotTypBoolean ) { - pStack->SetError(TX_BADTYPE, p->GivStart()); + pStack->SetError(TX_BADTYPE, p->GetStart()); return false; }*/ @@ -1478,7 +1479,7 @@ bool CBotClass::CompileDefItem(CBotToken* &p, CBotCStack* pStack, bool bSecond) else limites->AddNext3(i); } - if ( p->GivType() == ID_OPENPAR ) + if ( p->GetType() == ID_OPENPAR ) { if ( !bSecond ) { @@ -1498,12 +1499,12 @@ bool CBotClass::CompileDefItem(CBotToken* &p, CBotCStack* pStack, bool bSecond) CBotFunction* prev = NULL; while ( pf != NULL ) { - if (pf->GivName() == pp->GivString()) break; + if (pf->GetName() == pp->GetString()) break; prev = pf; pf = pf->Next(); } - bool bConstructor = (pp->GivString() == GivName()); + bool bConstructor = (pp->GetString() == GetName()); CBotCStack* pile = pStack->TokenStack(NULL, true); // make "this" known @@ -1531,9 +1532,9 @@ bool CBotClass::CompileDefItem(CBotToken* &p, CBotCStack* pStack, bool bSecond) { CBotVar* pcopy = CBotVar::Create(pv); pcopy->SetInit(!bConstructor || pv->IsStatic()); - pcopy->SetUniqNum(pv->GivUniqNum()); + pcopy->SetUniqNum(pv->GetUniqNum()); pile->AddVar(pcopy); - pv = pv->GivNext(); + pv = pv->GetNext(); } my = my->m_pParent; } @@ -1545,7 +1546,7 @@ bool CBotClass::CompileDefItem(CBotToken* &p, CBotCStack* pStack, bool bSecond) if ( f != NULL ) { - f->m_pProg = pStack->GivBotCall(); + f->m_pProg = pStack->GetBotCall(); f->m_bSynchro = bSynchro; // replaces the element in the chain f->m_next = pf->m_next; @@ -1572,7 +1573,7 @@ bool CBotClass::CompileDefItem(CBotToken* &p, CBotCStack* pStack, bool bSecond) { if ( type.Eq(CBotTypArrayPointer) ) { - i = CBotListArray::Compile(p, pStack, type.GivTypElem()); + i = CBotListArray::Compile(p, pStack, type.GetTypElem()); } else { @@ -1585,7 +1586,7 @@ bool CBotClass::CompileDefItem(CBotToken* &p, CBotCStack* pStack, bool bSecond) if ( !bSecond ) { - CBotVar* pv = CBotVar::Create(pp->GivString(), type); + CBotVar* pv = CBotVar::Create(pp->GetString(), type); pv -> SetStatic( bStatic ); pv -> SetPrivate( mProtect ); @@ -1599,7 +1600,7 @@ bool CBotClass::CompileDefItem(CBotToken* &p, CBotCStack* pStack, bool bSecond) { CBotStack* pile = CBotStack::FirstStack(); // independent stack while(pile->IsOk() && !pv->m_InitExpr->Execute(pile)); // evaluates the expression without timer - pv->SetVal( pile->GivVar() ) ; + pv->SetVal( pile->GetVar() ) ; pile->Delete(); } } @@ -1620,7 +1621,7 @@ CBotClass* CBotClass::Compile(CBotToken* &p, CBotCStack* pStack) if ( !IsOfType(p, ID_PUBLIC) ) return NULL; if ( !IsOfType(p, ID_CLASS) ) return NULL; - CBotString name = p->GivString(); + CBotString name = p->GetString(); // a name for the class is there? if (IsOfType(p, TokenTypVar)) diff --git a/src/CBot/CBotIf.cpp b/src/CBot/CBotIf.cpp index 84dbd6a..a5d2693 100644 --- a/src/CBot/CBotIf.cpp +++ b/src/CBot/CBotIf.cpp @@ -95,7 +95,7 @@ bool CBotIf :: Execute(CBotStack* &pj) if ( pile->IfStep() ) return false; // according to recovery, it may be in one of two states - if( pile->GivState() == 0 ) + if( pile->GetState() == 0 ) { // evaluates the condition if ( !m_Condition->Execute(pile) ) return false; // interrupted here? @@ -113,7 +113,7 @@ bool CBotIf :: Execute(CBotStack* &pj) // second state, evaluates the associated instructions // the result of the condition is on the stack - if ( pile->GivVal() == true ) // condition was true? + if ( pile->GetVal() == true ) // condition was true? { if ( m_Block != NULL && // block may be absent !m_Block->Execute(pile) ) return false; // interrupted here? @@ -137,7 +137,7 @@ void CBotIf :: RestoreState(CBotStack* &pj, bool bMain) if ( pile == NULL ) return; // according to recovery, it may be in one of two states - if( pile->GivState() == 0 ) + if( pile->GetState() == 0 ) { // evaluates the condition m_Condition->RestoreState(pile, bMain); // interrupted here! @@ -147,7 +147,7 @@ void CBotIf :: RestoreState(CBotStack* &pj, bool bMain) // second state, evaluates the associated instructions // the result of the condition is on the stack - if ( pile->GivVal() == true ) // condition was true? + if ( pile->GetVal() == true ) // condition was true? { if ( m_Block != NULL ) // block may be absent m_Block->RestoreState(pile, bMain); // interrupted here! diff --git a/src/CBot/CBotProgram.cpp b/src/CBot/CBotProgram.cpp index d9be052..f4987a7 100644 --- a/src/CBot/CBotProgram.cpp +++ b/src/CBot/CBotProgram.cpp @@ -87,18 +87,18 @@ bool CBotProgram::Compile( const char* program, CBotStringArray& ListFonctions, CBotCStack* pStack = new CBotCStack(NULL); - CBotToken* p = pBaseToken->GivNext(); // skips the first token (separator) + CBotToken* p = pBaseToken->GetNext(); // skips the first token (separator) pStack->SetBotCall(this); // defined used routines CBotCall::SetPUser(pUser); // first made a quick pass just to take the headers of routines and classes - while ( pStack->IsOk() && p != NULL && p->GivType() != 0) + while ( pStack->IsOk() && p != NULL && p->GetType() != 0) { if ( IsOfType(p, ID_SEP) ) continue; // semicolons lurking - if ( p->GivType() == ID_CLASS || - ( p->GivType() == ID_PUBLIC && p->GivNext()->GivType() == ID_CLASS )) + if ( p->GetType() == ID_CLASS || + ( p->GetType() == ID_PUBLIC && p->GetNext()->GetType() == ID_CLASS )) { CBotClass* nxt = CBotClass::Compile1(p, pStack); if (m_pClass == NULL ) m_pClass = nxt; @@ -113,7 +113,7 @@ bool CBotProgram::Compile( const char* program, CBotStringArray& ListFonctions, } if ( !pStack->IsOk() ) { - m_ErrorCode = pStack->GivError(m_ErrorStart, m_ErrorEnd); + m_ErrorCode = pStack->GetError(m_ErrorStart, m_ErrorEnd); delete m_Prog; m_Prog = NULL; delete pBaseToken; @@ -123,14 +123,14 @@ bool CBotProgram::Compile( const char* program, CBotStringArray& ListFonctions, // CBotFunction* temp = NULL; CBotFunction* next = m_Prog; // rewind the list - p = pBaseToken->GivNext(); // returns to the beginning + p = pBaseToken->GetNext(); // returns to the beginning - while ( pStack->IsOk() && p != NULL && p->GivType() != 0 ) + while ( pStack->IsOk() && p != NULL && p->GetType() != 0 ) { if ( IsOfType(p, ID_SEP) ) continue; // semicolons lurking - if ( p->GivType() == ID_CLASS || - ( p->GivType() == ID_PUBLIC && p->GivNext()->GivType() == ID_CLASS )) + if ( p->GetType() == ID_CLASS || + ( p->GetType() == ID_PUBLIC && p->GetNext()->GetType() == ID_CLASS )) { m_bCompileClass = true; CBotClass::Compile(p, pStack); // completes the definition of the class @@ -139,7 +139,7 @@ bool CBotProgram::Compile( const char* program, CBotStringArray& ListFonctions, { m_bCompileClass = false; CBotFunction::Compile(p, pStack, next); - if (next->IsExtern()) ListFonctions.Add(next->GivName()/* + next->GivParams()*/); + if (next->IsExtern()) ListFonctions.Add(next->GetName()/* + next->GetParams()*/); next->m_pProg = this; // keeps pointers to the module next = next->Next(); } @@ -150,7 +150,7 @@ bool CBotProgram::Compile( const char* program, CBotStringArray& ListFonctions, if ( !pStack->IsOk() ) { - m_ErrorCode = pStack->GivError(m_ErrorStart, m_ErrorEnd); + m_ErrorCode = pStack->GetError(m_ErrorStart, m_ErrorEnd); delete m_Prog; m_Prog = NULL; } @@ -174,7 +174,7 @@ bool CBotProgram::Start(const char* name) m_pRun = m_Prog; while (m_pRun != NULL) { - if ( m_pRun->GivName() == name ) break; + if ( m_pRun->GetName() == name ) break; m_pRun = m_pRun->m_next; } @@ -200,7 +200,7 @@ bool CBotProgram::GetPosition(const char* name, int& start, int& stop, CBotGet m CBotFunction* p = m_Prog; while (p != NULL) { - if ( p->GivName() == name ) break; + if ( p->GetName() == name ) break; p = p->m_next; } @@ -248,7 +248,7 @@ bool CBotProgram::Run(void* pUser, int timer) // completed on a mistake? if (!ok && !m_pStack->IsOk()) { - m_ErrorCode = m_pStack->GivError(m_ErrorStart, m_ErrorEnd); + m_ErrorCode = m_pStack->GetError(m_ErrorStart, m_ErrorEnd); #if STACKMEM m_pStack->Delete(); #else @@ -289,12 +289,12 @@ bool CBotProgram::GetRunPos(const char* &FunctionName, int &start, int &end) return true; } -CBotVar* CBotProgram::GivStackVars(const char* &FunctionName, int level) +CBotVar* CBotProgram::GetStackVars(const char* &FunctionName, int level) { FunctionName = NULL; if (m_pStack == NULL) return NULL; - return m_pStack->GivStackVars(FunctionName, level); + return m_pStack->GetStackVars(FunctionName, level); } void CBotProgram::SetTimer(int n) @@ -302,7 +302,7 @@ void CBotProgram::SetTimer(int n) CBotStack::SetTimer( n ); } -int CBotProgram::GivError() +int CBotProgram::GetError() { return m_ErrorCode; } @@ -312,7 +312,7 @@ void CBotProgram::SetIdent(long n) m_Ident = n; } -long CBotProgram::GivIdent() +long CBotProgram::GetIdent() { return m_Ident; } @@ -334,7 +334,7 @@ bool CBotProgram::GetError(int& code, int& start, int& end, CBotProgram* &pProg) return code > 0; } -CBotString CBotProgram::GivErrorText(int code) +CBotString CBotProgram::GetErrorText(int code) { CBotString TextError; @@ -349,7 +349,7 @@ CBotString CBotProgram::GivErrorText(int code) } -CBotFunction* CBotProgram::GivFunctions() +CBotFunction* CBotProgram::GetFunctions() { return m_Prog; } @@ -421,7 +421,7 @@ bool WriteString(FILE* pf, CBotString s) { size_t lg1, lg2; - lg1 = s.GivLength(); + lg1 = s.GetLength(); if (!WriteWord(pf, lg1)) return false; lg2 = fwrite(s, 1, lg1, pf ); @@ -445,19 +445,19 @@ bool ReadString(FILE* pf, CBotString& s) bool WriteType(FILE* pf, CBotTypResult type) { - int typ = type.GivType(); + int typ = type.GetType(); if ( typ == CBotTypIntrinsic ) typ = CBotTypClass; if ( !WriteWord(pf, typ) ) return false; if ( typ == CBotTypClass ) { - CBotClass* p = type.GivClass(); - if ( !WriteString(pf, p->GivName()) ) return false; + CBotClass* p = type.GetClass(); + if ( !WriteString(pf, p->GetName()) ) return false; } if ( type.Eq( CBotTypArrayBody ) || type.Eq( CBotTypArrayPointer ) ) { - if ( !WriteWord(pf, type.GivLimite()) ) return false; - if ( !WriteType(pf, type.GivTypElem()) ) return false; + if ( !WriteWord(pf, type.GetLimite()) ) return false; + if ( !WriteType(pf, type.GetTypElem()) ) return false; } return true; } @@ -487,7 +487,7 @@ bool ReadType(FILE* pf, CBotTypResult& type) if ( !ReadWord(pf, ww) ) return false; if ( !ReadType(pf, r) ) return false; type = CBotTypResult( w, r ); - type.SetLimite((short)ww); + type.SetLimite(static_cast<short>(ww)); } return true; } @@ -507,7 +507,7 @@ bool CBotProgram::SaveState(FILE* pf) if ( m_pStack != NULL ) { if (!WriteWord( pf, 1)) return false; - if (!WriteString( pf, m_pRun->GivName() )) return false; + if (!WriteString( pf, m_pRun->GetName() )) return false; if (!m_pStack->SaveState(pf)) return false; } else @@ -551,7 +551,7 @@ bool CBotProgram::RestoreState(FILE* pf) return true; } -int CBotProgram::GivVersion() +int CBotProgram::GetVersion() { return CBOTVERSION; } @@ -592,7 +592,7 @@ bool CBotCall::AddFunction(const char* name, if ( p != NULL ) while ( p->m_next != NULL ) { - if ( p->GivName() == name ) + if ( p->GetName() == name ) { // frees redefined function if ( pp ) pp->m_next = p->m_next; @@ -625,14 +625,14 @@ CBotVar* MakeListVars(CBotVar** ppVars, bool bSetVal=false) while( true ) { - ppVars[i]; +// ppVars[i]; if ( ppVars[i] == NULL ) break; CBotVar* pp = CBotVar::Create(ppVars[i]); if (bSetVal) pp->Copy(ppVars[i]); else - if ( ppVars[i]->GivType() == CBotTypPointer ) - pp->SetClass( ppVars[i]->GivClass()); + if ( ppVars[i]->GetType() == CBotTypPointer ) + pp->SetClass( ppVars[i]->GetClass()); // copy the pointer according to indirections if (pVar == NULL) pVar = pp; else pVar->AddNext(pp); @@ -648,7 +648,7 @@ CBotTypResult CBotCall::CompileCall(CBotToken* &p, CBotVar** ppVar, CBotCStack* { nIdent = 0; CBotCall* pt = m_ListCalls; - CBotString name = p->GivString(); + CBotString name = p->GetString(); while ( pt != NULL ) { @@ -657,14 +657,14 @@ CBotTypResult CBotCall::CompileCall(CBotToken* &p, CBotVar** ppVar, CBotCStack* CBotVar* pVar = MakeListVars(ppVar); CBotVar* pVar2 = pVar; CBotTypResult r = pt->m_rComp(pVar2, m_pUser); - int ret = r.GivType(); + int ret = r.GetType(); // if a class is returned, it is actually a pointer if ( ret == CBotTypClass ) r.SetType( ret = CBotTypPointer ); if ( ret > 20 ) { - if (pVar2) pStack->SetError(ret, p /*pVar2->GivToken()*/ ); + if (pVar2) pStack->SetError(ret, p /*pVar2->GetToken()*/ ); } delete pVar; nIdent = pt->m_nFuncIdent; @@ -688,7 +688,7 @@ bool CBotCall::CheckCall(const char* name) while ( p != NULL ) { - if ( name == p->GivName() ) return true; + if ( name == p->GetName() ) return true; p = p->m_next; } return false; @@ -696,7 +696,7 @@ bool CBotCall::CheckCall(const char* name) -CBotString CBotCall::GivName() +CBotString CBotCall::GetName() { return m_name; } @@ -724,7 +724,7 @@ int CBotCall::DoCall(long& nIdent, CBotToken* token, CBotVar** ppVar, CBotStack* if ( token != NULL ) { - CBotString name = token->GivString(); + CBotString name = token->GetString(); while ( pt != NULL ) { if ( pt->m_name == name ) @@ -750,7 +750,7 @@ fund: CBotVar* pRes = pResult; int Exception = 0; - int res = pt->m_rExec(pVar, pResult, Exception, pStack->GivPUser()); + int res = pt->m_rExec(pVar, pResult, Exception, pStack->GetPUser()); if ( pResult != pRes ) delete pRes; // different result if made delete pVarToDelete; @@ -766,7 +766,7 @@ fund: } pStack->SetVar(pResult); - if ( rettype.GivType() > 0 && pResult == NULL ) + if ( rettype.GetType() > 0 && pResult == NULL ) { pStack->SetError(TX_NORETVAL, token); } @@ -781,7 +781,7 @@ fund: // lists the parameters depending on the contents of the stack (pStackVar) CBotVar* pVar = MakeListVars(ppVar, true); - CBotVar* pVarToDelete = pVar; +// CBotVar* pVarToDelete = pVar; // creates a variable to the result CBotVar* pResult = rettype.Eq(0) ? NULL : CBotVar::Create("", rettype); @@ -805,7 +805,7 @@ bool CBotCall::RestoreCall(long& nIdent, CBotToken* token, CBotVar** ppVar, CBot CBotCall* pt = m_ListCalls; { - CBotString name = token->GivString(); + CBotString name = token->GetString(); while ( pt != NULL ) { if ( pt->m_name == name ) @@ -815,7 +815,8 @@ bool CBotCall::RestoreCall(long& nIdent, CBotToken* token, CBotVar** ppVar, CBot CBotStack* pile = pStack->RestoreStackEOX(pt); if ( pile == NULL ) return true; - CBotStack* pile2 = pile->RestoreStack(); + // CBotStack* pile2 = pile->RestoreStack(); + pile->RestoreStack(); return true; } pt = pt->m_next; @@ -829,14 +830,14 @@ bool CBotCall::Run(CBotStack* pStack) { CBotStack* pile = pStack->AddStackEOX(this); if ( pile == EOX ) return true; - CBotVar* pVar = pile->GivVar(); + CBotVar* pVar = pile->GetVar(); CBotStack* pile2 = pile->AddStack(); - CBotVar* pResult = pile2->GivVar(); + CBotVar* pResult = pile2->GetVar(); CBotVar* pRes = pResult; int Exception = 0; - int res = m_rExec(pVar, pResult, Exception, pStack->GivPUser()); + int res = m_rExec(pVar, pResult, Exception, pStack->GetPUser()); if (res == false) { @@ -892,10 +893,10 @@ CBotTypResult CBotCallMethode::CompileCall(const char* name, CBotVar* pThis, CBotVar* pVar = MakeListVars(ppVar, true); CBotVar* pVar2 = pVar; CBotTypResult r = pt->m_rComp(pThis, pVar2); - int ret = r.GivType(); + int ret = r.GetType(); if ( ret > 20 ) { - if (pVar2) pStack->SetError(ret, pVar2->GivToken()); + if (pVar2) pStack->SetError(ret, pVar2->GetToken()); } delete pVar; nIdent = pt->m_nFuncIdent; @@ -907,7 +908,7 @@ CBotTypResult CBotCallMethode::CompileCall(const char* name, CBotVar* pThis, } -CBotString CBotCallMethode::GivName() +CBotString CBotCallMethode::GetName() { return m_name; } @@ -951,7 +952,7 @@ int CBotCallMethode::DoCall(long& nIdent, const char* name, CBotVar* pThis, CBot { if (Exception!=0) { -// pStack->SetError(Exception, pVar->GivToken()); +// pStack->SetError(Exception, pVar->GetToken()); pStack->SetError(Exception, pToken); } delete pVarToDelete; @@ -982,7 +983,7 @@ int CBotCallMethode::DoCall(long& nIdent, const char* name, CBotVar* pThis, CBot { if (Exception!=0) { -// pStack->SetError(Exception, pVar->GivToken()); +// pStack->SetError(Exception, pVar->GetToken()); pStack->SetError(Exception, pToken); } delete pVarToDelete; @@ -1003,12 +1004,12 @@ bool rSizeOf( CBotVar* pVar, CBotVar* pResult, int& ex, void* pUser ) if ( pVar == NULL ) return TX_LOWPARAM; int i = 0; - pVar = pVar->GivItemList(); + pVar = pVar->GetItemList(); while ( pVar != NULL ) { i++; - pVar = pVar->GivNext(); + pVar = pVar->GetNext(); } pResult->SetValInt(i); @@ -1018,7 +1019,7 @@ bool rSizeOf( CBotVar* pVar, CBotVar* pResult, int& ex, void* pUser ) CBotTypResult cSizeOf( CBotVar* &pVar, void* pUser ) { if ( pVar == NULL ) return CBotTypResult( TX_LOWPARAM ); - if ( pVar->GivType() != CBotTypArrayPointer ) + if ( pVar->GetType() != CBotTypArrayPointer ) return CBotTypResult( TX_BADPARAM ); return CBotTypResult( CBotTypInt ); } diff --git a/src/CBot/CBotStack.cpp b/src/CBot/CBotStack.cpp index ddb26c6..67f2000 100644 --- a/src/CBot/CBotStack.cpp +++ b/src/CBot/CBotStack.cpp @@ -47,7 +47,7 @@ CBotStack* CBotStack::FirstStack() size *= (MAXSTACK+10); // request a slice of memory for the stack - p = (CBotStack*)malloc(size); + p = static_cast<CBotStack*>(malloc(size)); // completely empty memset(p, 0, size); @@ -198,7 +198,7 @@ CBotStack* CBotStack::AddStack2(bool bBlock) return p; } -bool CBotStack::GivBlock() +bool CBotStack::GetBlock() { return m_bBlock; } @@ -428,7 +428,7 @@ void CBotStack::SetBreak(int val, const char* name) // gives on the stack value calculated by the last CBotReturn -bool CBotStack::GivRetVar(bool bRet) +bool CBotStack::GetRetVar(bool bRet) { if (m_error == -3) { @@ -441,7 +441,7 @@ bool CBotStack::GivRetVar(bool bRet) return bRet; // interrupted by something other than return } -int CBotStack::GivError(int& start, int& end) +int CBotStack::GetError(int& start, int& end) { start = m_start; end = m_end; @@ -449,16 +449,16 @@ int CBotStack::GivError(int& start, int& end) } -int CBotStack::GivType(int mode) +int CBotStack::GetType(int mode) { if (m_var == NULL) return -1; - return m_var->GivType(mode); + return m_var->GetType(mode); } -CBotTypResult CBotStack::GivTypResult(int mode) +CBotTypResult CBotStack::GetTypResult(int mode) { if (m_var == NULL) return -1; - return m_var->GivTypResult(mode); + return m_var->GetTypResult(mode); } void CBotStack::SetType(CBotTypResult& type) @@ -471,14 +471,14 @@ void CBotStack::SetType(CBotTypResult& type) CBotVar* CBotStack::FindVar(CBotToken* &pToken, bool bUpdate, bool bModif) { CBotStack* p = this; - CBotString name = pToken->GivString(); + CBotString name = pToken->GetString(); while (p != NULL) { CBotVar* pp = p->m_listVar; while ( pp != NULL) { - if (pp->GivName() == name) + if (pp->GetName() == name) { if ( bUpdate ) pp->Maj(m_pUser, false); @@ -500,7 +500,7 @@ CBotVar* CBotStack::FindVar(const char* name) CBotVar* pp = p->m_listVar; while ( pp != NULL) { - if (pp->GivName() == name) + if (pp->GetName() == name) { return pp; } @@ -519,7 +519,7 @@ CBotVar* CBotStack::FindVar(long ident, bool bUpdate, bool bModif) CBotVar* pp = p->m_listVar; while ( pp != NULL) { - if (pp->GivUniqNum() == ident) + if (pp->GetUniqNum() == ident) { if ( bUpdate ) pp->Maj(m_pUser, false); @@ -576,8 +576,8 @@ void CBotStack::SetError(int n, CBotToken* token) m_error = n; if (token != NULL) { - m_start = token->GivStart(); - m_end = token->GivEnd(); + m_start = token->GetStart(); + m_end = token->GetEnd(); } } @@ -590,8 +590,8 @@ void CBotStack::ResetError(int n, int start, int end) void CBotStack::SetPosError(CBotToken* token) { - m_start = token->GivStart(); - m_end = token->GivEnd(); + m_start = token->GetStart(); + m_end = token->GetEnd(); } void CBotStack::SetTimer(int n) @@ -643,34 +643,34 @@ void CBotStack::SetCopyVar( CBotVar* var ) { if (m_var) delete m_var; // replacement of a variable - m_var = CBotVar::Create("", var->GivTypResult(2)); + m_var = CBotVar::Create("", var->GetTypResult(2)); m_var->Copy( var ); } -CBotVar* CBotStack::GivVar() +CBotVar* CBotStack::GetVar() { return m_var; } -CBotVar* CBotStack::GivPtVar() +CBotVar* CBotStack::GetPtVar() { CBotVar* p = m_var; m_var = NULL; // therefore will not be destroyed return p; } -CBotVar* CBotStack::GivCopyVar() +CBotVar* CBotStack::GetCopyVar() { if (m_var == NULL) return NULL; - CBotVar* v = CBotVar::Create("", m_var->GivType()); + CBotVar* v = CBotVar::Create("", m_var->GetType()); v->Copy( m_var ); return v; } -long CBotStack::GivVal() +long CBotStack::GetVal() { if (m_var == NULL) return 0; - return m_var->GivValInt(); + return m_var->GetValInt(); } @@ -693,7 +693,7 @@ void CBotStack::AddVar(CBotVar* pVar) *pp = pVar; // added after #ifdef _DEBUG - if ( pVar->GivUniqNum() == 0 ) ASM_TRAP(); + if ( pVar->GetUniqNum() == 0 ) ASM_TRAP(); #endif } @@ -710,7 +710,7 @@ void CBotStack::SetBotCall(CBotProgram* p) m_bFunc = true; } -CBotProgram* CBotStack::GivBotCall(bool bFirst) +CBotProgram* CBotStack::GetBotCall(bool bFirst) { if ( ! bFirst ) return m_prog; CBotStack* p = this; @@ -718,7 +718,7 @@ CBotProgram* CBotStack::GivBotCall(bool bFirst) return p->m_prog; } -void* CBotStack::GivPUser() +void* CBotStack::GetPUser() { return m_pUser; } @@ -731,19 +731,19 @@ bool CBotStack::ExecuteCall(long& nIdent, CBotToken* token, CBotVar** ppVar, CBo // first looks by the identifier res = CBotCall::DoCall(nIdent, NULL, ppVar, this, rettype ); - if (res.GivType() >= 0) return res.GivType(); + if (res.GetType() >= 0) return res.GetType(); - res = m_prog->GivFunctions()->DoCall(nIdent, NULL, ppVar, this, token ); - if (res.GivType() >= 0) return res.GivType(); + res = m_prog->GetFunctions()->DoCall(nIdent, NULL, ppVar, this, token ); + if (res.GetType() >= 0) return res.GetType(); // if not found (recompile?) seeks by name nIdent = 0; res = CBotCall::DoCall(nIdent, token, ppVar, this, rettype ); - if (res.GivType() >= 0) return res.GivType(); + if (res.GetType() >= 0) return res.GetType(); - res = m_prog->GivFunctions()->DoCall(nIdent, token->GivString(), ppVar, this, token ); - if (res.GivType() >= 0) return res.GivType(); + res = m_prog->GetFunctions()->DoCall(nIdent, token->GetString(), ppVar, this, token ); + if (res.GetType() >= 0) return res.GetType(); SetError(TX_NOCALL, token); return true; @@ -754,7 +754,7 @@ void CBotStack::RestoreCall(long& nIdent, CBotToken* token, CBotVar** ppVar) if ( m_next == NULL ) return; if ( !CBotCall::RestoreCall(nIdent, token, ppVar, this) ) - m_prog->GivFunctions()->RestoreCall(nIdent, token->GivString(), ppVar, this ); + m_prog->GetFunctions()->RestoreCall(nIdent, token->GetString(), ppVar, this ); } @@ -770,7 +770,7 @@ bool SaveVar(FILE* pf, CBotVar* pVar) if ( !pVar->Save0State(pf)) return false; // common header if ( !pVar->Save1State(pf) ) return false; // saves as the child class - pVar = pVar->GivNext(); + pVar = pVar->GetNext(); } } @@ -798,17 +798,17 @@ void CBotStack::GetRunPos(const char* &FunctionName, int &start, int &end) if ( funct == NULL ) return; - CBotToken* t = funct->GivToken(); - FunctionName = t->GivString(); + CBotToken* t = funct->GetToken(); + FunctionName = t->GetString(); // if ( p->m_instr != NULL ) instr = p->m_instr; - t = instr->GivToken(); - start = t->GivStart(); - end = t->GivEnd(); + t = instr->GetToken(); + start = t->GetStart(); + end = t->GetEnd(); } -CBotVar* CBotStack::GivStackVars(const char* &FunctionName, int level) +CBotVar* CBotStack::GetStackVars(const char* &FunctionName, int level) { CBotProgram* prog = m_prog; // current program FunctionName = NULL; @@ -846,8 +846,8 @@ CBotVar* CBotStack::GivStackVars(const char* &FunctionName, int level) if ( pp == NULL || pp->m_instr == NULL ) return NULL; - CBotToken* t = pp->m_instr->GivToken(); - FunctionName = t->GivString(); + CBotToken* t = pp->m_instr->GetToken(); + FunctionName = t->GetString(); return p->m_listVar; } @@ -905,7 +905,7 @@ bool CBotStack::RestoreState(FILE* pf, CBotStack* &pStack) pStack->m_bBlock = w; if (!ReadWord(pf, w)) return false; // in what state ? - pStack->SetState((short)w); // in a good state + pStack->SetState(static_cast<short>(w)); // in a good state if (!ReadWord(pf, w)) return false; // dont delete? // uses more @@ -924,9 +924,9 @@ bool CBotVar::Save0State(FILE* pf) { if (!WriteWord(pf, 100+m_mPrivate))return false; // private variable? if (!WriteWord(pf, m_bStatic))return false; // static variable? - if (!WriteWord(pf, m_type.GivType()))return false; // saves the type (always non-zero) + if (!WriteWord(pf, m_type.GetType()))return false; // saves the type (always non-zero) if (!WriteWord(pf, m_binit))return false; // variable defined? - return WriteString(pf, m_token->GivString()); // and variable name + return WriteString(pf, m_token->GetString()); // and variable name } bool CBotVarInt::Save0State(FILE* pf) @@ -1016,7 +1016,7 @@ bool CBotVar::RestoreState(FILE* pf, CBotVar* &pVar) case CBotTypBoolean: pNew = CBotVar::Create(&token, w); // creates a variable if (!ReadWord(pf, w)) return false; - pNew->SetValInt((short)w, defnum); + pNew->SetValInt(static_cast<short>(w), defnum); break; case CBotTypFloat: pNew = CBotVar::Create(&token, w); // creates a variable @@ -1045,7 +1045,7 @@ bool CBotVar::RestoreState(FILE* pf, CBotVar* &pVar) pNew = new CBotVarClass(&token, r); // directly creates an instance // attention cptuse = 0 - if ( !RestoreState(pf, ((CBotVarClass*)pNew)->m_pVar)) return false; + if ( !RestoreState(pf, (static_cast<CBotVarClass*>(pNew))->m_pVar)) return false; pNew->SetIdent(id); if ( p != NULL ) @@ -1062,7 +1062,7 @@ bool CBotVar::RestoreState(FILE* pf, CBotVar* &pVar) if (!ReadString(pf, s)) return false; { pNew = CBotVar::Create(&token, CBotTypResult(w, s));// creates a variable - CBotVarClass* p = NULL; +// CBotVarClass* p = NULL; long id; ReadLong(pf, id); // if ( id ) p = CBotVarClass::Find(id); // found the instance (made by RestoreInstance) @@ -1070,9 +1070,9 @@ bool CBotVar::RestoreState(FILE* pf, CBotVar* &pVar) // returns a copy of the original instance CBotVar* pInstance = NULL; if ( !CBotVar::RestoreState( pf, pInstance ) ) return false; - ((CBotVarPointer*)pNew)->SetPointer( pInstance ); // and point over + (static_cast<CBotVarPointer*>(pNew))->SetPointer( pInstance ); // and point over -// if ( p != NULL ) ((CBotVarPointer*)pNew)->SetPointer( p ); // rather this one +// if ( p != NULL ) (static_cast<CBotVarPointer*>(pNew))->SetPointer( p ); // rather this one } break; @@ -1087,7 +1087,7 @@ bool CBotVar::RestoreState(FILE* pf, CBotVar* &pVar) // returns a copy of the original instance CBotVar* pInstance = NULL; if ( !CBotVar::RestoreState( pf, pInstance ) ) return false; - ((CBotVarPointer*)pNew)->SetPointer( pInstance ); // and point over + (static_cast<CBotVarPointer*>(pNew))->SetPointer( pInstance ); // and point over } break; default: @@ -1160,7 +1160,7 @@ CBotCStack* CBotCStack::TokenStack(CBotToken* pToken, bool bBlock) m_next = p; // channel element p->m_bBlock = bBlock; - if (pToken != NULL) p->SetStartError(pToken->GivStart()); + if (pToken != NULL) p->SetStartError(pToken->GetStart()); return p; } @@ -1200,42 +1200,42 @@ CBotFunction* CBotCStack::ReturnFunc(CBotFunction* inst, CBotCStack* pfils) return inst; } -int CBotCStack::GivError(int& start, int& end) +int CBotCStack::GetError(int& start, int& end) { start = m_start; end = m_end; return m_error; } -int CBotCStack::GivError() +int CBotCStack::GetError() { return m_error; } // type of instruction on the stack -CBotTypResult CBotCStack::GivTypResult(int mode) +CBotTypResult CBotCStack::GetTypResult(int mode) { if (m_var == NULL) return CBotTypResult(99); - return m_var->GivTypResult(mode); + return m_var->GetTypResult(mode); } // type of instruction on the stack -int CBotCStack::GivType(int mode) +int CBotCStack::GetType(int mode) { if (m_var == NULL) return 99; - return m_var->GivType(mode); + return m_var->GetType(mode); } // pointer on the stack is in what class? -CBotClass* CBotCStack::GivClass() +CBotClass* CBotCStack::GetClass() { if ( m_var == NULL ) return NULL; - if ( m_var->GivType(1) != CBotTypPointer ) return NULL; + if ( m_var->GetType(1) != CBotTypPointer ) return NULL; - return m_var->GivClass(); + return m_var->GetClass(); } // type of instruction on the stack @@ -1252,14 +1252,14 @@ void CBotCStack::SetType(CBotTypResult& type) CBotVar* CBotCStack::FindVar(CBotToken* &pToken) { CBotCStack* p = this; - CBotString name = pToken->GivString(); + CBotString name = pToken->GetString(); while (p != NULL) { CBotVar* pp = p->m_listVar; while ( pp != NULL) { - if (name == pp->GivName()) + if (name == pp->GetName()) { return pp; } @@ -1282,7 +1282,7 @@ CBotVar* CBotCStack::CopyVar(CBotToken& Token) if ( pVar == NULL) return NULL; - CBotVar* pCopy = CBotVar::Create( "", pVar->GivType() ); + CBotVar* pCopy = CBotVar::Create( "", pVar->GetType() ); pCopy->Copy(pVar); return pCopy; } @@ -1310,8 +1310,8 @@ void CBotCStack::SetError(int n, CBotToken* p) { if (m_error) return; // does not change existing error m_error = n; - m_start = p->GivStart(); - m_end = p->GivEnd(); + m_start = p->GetStart(); + m_end = p->GetEnd(); } void CBotCStack::ResetError(int n, int start, int end) @@ -1325,10 +1325,10 @@ bool CBotCStack::NextToken(CBotToken* &p) { CBotToken* pp = p; - p = p->GivNext(); + p = p->GetNext(); if (p!=NULL) return true; - SetError(TX_ENDOF, pp->GivEnd()); + SetError(TX_ENDOF, pp->GetEnd()); return false; } @@ -1337,7 +1337,7 @@ void CBotCStack::SetBotCall(CBotProgram* p) m_prog = p; } -CBotProgram* CBotCStack::GivBotCall() +CBotProgram* CBotCStack::GetBotCall() { return m_prog; } @@ -1347,7 +1347,7 @@ void CBotCStack::SetRetType(CBotTypResult& type) m_retTyp = type; } -CBotTypResult CBotCStack::GivRetType() +CBotTypResult CBotCStack::GetRetType() { return m_retTyp; } @@ -1364,11 +1364,11 @@ void CBotCStack::SetCopyVar( CBotVar* var ) if (m_var) delete m_var; // replacement of a variable if ( var == NULL ) return; - m_var = CBotVar::Create("", var->GivTypResult(2)); + m_var = CBotVar::Create("", var->GetTypResult(2)); m_var->Copy( var ); } -CBotVar* CBotCStack::GivVar() +CBotVar* CBotCStack::GetVar() { return m_var; } @@ -1388,7 +1388,7 @@ void CBotCStack::AddVar(CBotVar* pVar) *pp = pVar; // added after #ifdef _DEBUG - if ( pVar->GivUniqNum() == 0 ) ASM_TRAP(); + if ( pVar->GetUniqNum() == 0 ) ASM_TRAP(); #endif } @@ -1397,14 +1397,14 @@ void CBotCStack::AddVar(CBotVar* pVar) bool CBotCStack::CheckVarLocal(CBotToken* &pToken) { CBotCStack* p = this; - CBotString name = pToken->GivString(); + CBotString name = pToken->GetString(); while (p != NULL) { CBotVar* pp = p->m_listVar; while ( pp != NULL) { - if (name == pp->GivName()) + if (name == pp->GetName()) return true; pp = pp->m_next; } @@ -1420,14 +1420,14 @@ CBotTypResult CBotCStack::CompileCall(CBotToken* &p, CBotVar** ppVars, long& nId CBotTypResult val(-1); val = CBotCall::CompileCall(p, ppVars, this, nIdent); - if (val.GivType() < 0) + if (val.GetType() < 0) { - val = m_prog->GivFunctions()->CompileCall(p->GivString(), ppVars, nIdent); - if ( val.GivType() < 0 ) + val = m_prog->GetFunctions()->CompileCall(p->GetString(), ppVars, nIdent); + if ( val.GetType() < 0 ) { // pVar = NULL; // the error is not on a particular parameter - SetError( -val.GivType(), p ); - val.SetType(-val.GivType()); + SetError( -val.GetType(), p ); + val.SetType(-val.GetType()); return val; } } @@ -1438,14 +1438,14 @@ CBotTypResult CBotCStack::CompileCall(CBotToken* &p, CBotVar** ppVars, long& nId bool CBotCStack::CheckCall(CBotToken* &pToken, CBotDefParam* pParam) { - CBotString name = pToken->GivString(); + CBotString name = pToken->GetString(); if ( CBotCall::CheckCall(name) ) return true; - CBotFunction* pp = m_prog->GivFunctions(); + CBotFunction* pp = m_prog->GetFunctions(); while ( pp != NULL ) { - if ( pToken->GivString() == pp->GivName() ) + if ( pToken->GetString() == pp->GetName() ) { // are parameters exactly the same? if ( pp->CheckParam( pParam ) ) @@ -1457,7 +1457,7 @@ bool CBotCStack::CheckCall(CBotToken* &pToken, CBotDefParam* pParam) pp = CBotFunction::m_listPublic; while ( pp != NULL ) { - if ( pToken->GivString() == pp->GivName() ) + if ( pToken->GetString() == pp->GetName() ) { // are parameters exactly the same? if ( pp->CheckParam( pParam ) ) diff --git a/src/CBot/CBotString.cpp b/src/CBot/CBotString.cpp index 1b42c23..7223e6f 100644 --- a/src/CBot/CBotString.cpp +++ b/src/CBot/CBotString.cpp @@ -24,7 +24,7 @@ #include <algorithm> //Map is filled with id-string pars that are needed for CBot language parsing -const std::map<EID, char *> CBotString::s_keywordString = +const std::map<EID,const char *> CBotString::s_keywordString = { {ID_IF, "if"}, {ID_ELSE, "else"}, @@ -70,7 +70,7 @@ const std::map<EID, char *> CBotString::s_keywordString = {ID_CLOSEPAR, ")"}, {ID_OPBLK, "{"}, {ID_CLBLK, "}"}, - {ID_SEP, "},"}, + {ID_SEP, ";"}, {ID_COMMA, ","}, {ID_DOTS, ":"}, {ID_DOT, "."}, @@ -138,7 +138,7 @@ CBotString::CBotString(const char* p) m_ptr = NULL; if (m_lg>0) { - m_ptr = (char*)malloc(m_lg+1); + m_ptr = static_cast<char*>(malloc(m_lg+1)); strcpy(m_ptr, p); } } @@ -150,7 +150,7 @@ CBotString::CBotString(const CBotString& srcString) m_ptr = NULL; if (m_lg>0) { - m_ptr = (char*)malloc(m_lg+1); + m_ptr = static_cast<char*>(malloc(m_lg+1)); strcpy(m_ptr, srcString.m_ptr); } } @@ -158,7 +158,7 @@ CBotString::CBotString(const CBotString& srcString) -int CBotString::GivLength() +int CBotString::GetLength() { if (m_ptr == NULL) return 0; return strlen( m_ptr ); @@ -170,7 +170,7 @@ CBotString CBotString::Left(int nCount) const { char chain[2000]; - size_t i; + int i; for (i = 0; i < m_lg && i < nCount && i < 1999; ++i) { chain[i] = m_ptr[i]; @@ -187,8 +187,8 @@ CBotString CBotString::Right(int nCount) const int i = m_lg - nCount; if ( i < 0 ) i = 0; - size_t j; - for (size_t j = 0 ; i < m_lg && i < 1999; ++i) + int j; + for (int j = 0 ; i < m_lg && i < 1999; ++i) { chain[j++] = m_ptr[i]; } @@ -201,7 +201,7 @@ CBotString CBotString::Mid(int nFirst, int nCount) const { char chain[2000]; - size_t i; + int i; for (i = nFirst; i < m_lg && i < 1999 && i <= nFirst + nCount; ++i) { chain[i] = m_ptr[i]; @@ -215,7 +215,7 @@ CBotString CBotString::Mid(int nFirst) const { char chain[2000]; - size_t i; + int i; for (i = nFirst; i < m_lg && i < 1999 ; ++i) { chain[i] = m_ptr[i]; @@ -228,7 +228,7 @@ CBotString CBotString::Mid(int nFirst) const int CBotString::Find(const char c) { - for (size_t i = 0; i < m_lg; ++i) + for (int i = 0; i < m_lg; ++i) { if (m_ptr[i] == c) return i; } @@ -239,9 +239,9 @@ int CBotString::Find(const char * lpsz) { int l = strlen(lpsz); - for (size_t i = 0; i <= m_lg-l; ++i) + for (size_t i = 0; static_cast<int>(i) <= m_lg-l; ++i) { - for (size_t j = 0; j < l; ++j) + for (size_t j = 0; static_cast<int>(j) < l; ++j) { if (m_ptr[i+j] != lpsz[j]) goto bad; } @@ -285,7 +285,7 @@ CBotString CBotString::Mid(int start, int lg) if ( lg < 0 ) lg = m_lg - start; - char* p = (char*)malloc(m_lg+1); + char* p = static_cast<char*>(malloc(m_lg+1)); strcpy(p, m_ptr+start); p[lg] = 0; @@ -296,7 +296,7 @@ CBotString CBotString::Mid(int start, int lg) void CBotString::MakeUpper() { - for (size_t i = 0; i < m_lg && i < 1999 ; ++i) + for (size_t i = 0; static_cast<int>(i) < m_lg && static_cast<int>(i) < 1999 ; ++i) { char c = m_ptr[i]; if ( c >= 'a' && c <= 'z' ) m_ptr[i] = c - 'a' + 'A'; @@ -305,7 +305,7 @@ void CBotString::MakeUpper() void CBotString::MakeLower() { - for (size_t i = 0; i < m_lg && i < 1999 ; ++i) + for (size_t i = 0; static_cast<int>(i) < m_lg && static_cast<int>(i) < 1999 ; ++i) { char c = m_ptr[i]; if ( c >= 'A' && c <= 'Z' ) m_ptr[i] = c - 'A' + 'a'; @@ -315,14 +315,14 @@ void CBotString::MakeLower() bool CBotString::LoadString(unsigned int id) { const char * str = NULL; - str = MapIdToString((EID)id); + str = MapIdToString(static_cast<EID>(id)); if (m_ptr != NULL) free(m_ptr); m_lg = strlen(str); m_ptr = NULL; if (m_lg > 0) { - m_ptr = (char*)malloc(m_lg+1); + m_ptr = static_cast<char*>(malloc(m_lg+1)); strcpy(m_ptr, str); return true; } @@ -339,7 +339,7 @@ const CBotString& CBotString::operator=(const CBotString& stringSrc) if (m_lg > 0) { - m_ptr = (char*)malloc(m_lg+1); + m_ptr = static_cast<char*>(malloc(m_lg+1)); strcpy(m_ptr, stringSrc.m_ptr); } @@ -355,7 +355,7 @@ CBotString operator+(const CBotString& string, const char * lpsz) const CBotString& CBotString::operator+(const CBotString& stringSrc) { - char* p = (char*)malloc(m_lg+stringSrc.m_lg+1); + char* p = static_cast<char*>(malloc(m_lg+stringSrc.m_lg+1)); strcpy(p, m_ptr); char* pp = p + m_lg; @@ -374,7 +374,7 @@ const CBotString& CBotString::operator=(const char ch) m_lg = 1; - m_ptr = (char*)malloc(2); + m_ptr = static_cast<char*>(malloc(2)); m_ptr[0] = ch; m_ptr[1] = 0; @@ -392,7 +392,7 @@ const CBotString& CBotString::operator=(const char* pString) if (m_lg != 0) { - m_ptr = (char*)malloc(m_lg+1); + m_ptr = static_cast<char*>(malloc(m_lg+1)); strcpy(m_ptr, pString); } } @@ -403,7 +403,7 @@ const CBotString& CBotString::operator=(const char* pString) const CBotString& CBotString::operator+=(const char ch) { - char* p = (char*)malloc(m_lg+2); + char* p = static_cast<char*>(malloc(m_lg+2)); if (m_ptr!=NULL) strcpy(p, m_ptr); p[m_lg++] = ch; @@ -418,7 +418,7 @@ const CBotString& CBotString::operator+=(const char ch) const CBotString& CBotString::operator+=(const CBotString& str) { - char* p = (char*)malloc(m_lg+str.m_lg+1); + char* p = static_cast<char*>(malloc(m_lg+str.m_lg+1)); strcpy(p, m_ptr); char* pp = p + m_lg; @@ -549,7 +549,7 @@ CBotStringArray::~CBotStringArray() } -int CBotStringArray::GivSize() +int CBotStringArray::GetSize() { return m_nSize; } @@ -618,6 +618,7 @@ void CBotStringArray::SetSize(int nNewSize) // shrink to nothing DestructElements(m_pData, m_nSize); +// delete[] static_cast<unsigned char *>(m_pData); delete[] (unsigned char *)m_pData; m_pData = NULL; m_nSize = m_nMaxSize = 0; diff --git a/src/CBot/CBotToken.cpp b/src/CBot/CBotToken.cpp index 2c0bfae..c6e65e7 100644 --- a/src/CBot/CBotToken.cpp +++ b/src/CBot/CBotToken.cpp @@ -123,25 +123,25 @@ const CBotToken& CBotToken::operator=(const CBotToken& src) } -int CBotToken::GivType() +int CBotToken::GetType() { if (this == NULL) return 0; if (m_type == TokenTypKeyWord) return m_IdKeyWord; return m_type; } -long CBotToken::GivIdKey() +long CBotToken::GetIdKey() { return m_IdKeyWord; } -CBotToken* CBotToken::GivNext() +CBotToken* CBotToken::GetNext() { if (this == NULL) return NULL; return m_next; } -CBotToken* CBotToken::GivPrev() +CBotToken* CBotToken::GetPrev() { if (this == NULL) return NULL; return m_prev; @@ -159,12 +159,12 @@ void CBotToken::AddNext(CBotToken* p) } -CBotString& CBotToken::GivString() +CBotString& CBotToken::GetString() { return m_Text; } -CBotString& CBotToken::GivSep() +CBotString& CBotToken::GetSep() { return m_Sep; } @@ -175,13 +175,13 @@ void CBotToken::SetString(const char* name) } -int CBotToken::GivStart() +int CBotToken::GetStart() { if (this == NULL) return -1; return m_start; } -int CBotToken::GivEnd() +int CBotToken::GetEnd() { if (this == NULL) return -1; return m_end; @@ -217,12 +217,12 @@ bool Char2InList(const char c, const char cc, const char* list) } } -static char* sep1 = " \r\n\t,:()[]{}-+*/=;><!~^|&%."; -static char* sep2 = " \r\n\t"; // only separators -static char* sep3 = ",:()[]{}-+*/=;<>!~^|&%."; // operational separators -static char* num = "0123456789"; // point (single) is tested separately -static char* hexnum = "0123456789ABCDEFabcdef"; -static char* nch = "\"\r\n\t"; // forbidden in chains +static char sep1[] = " \r\n\t,:()[]{}-+*/=;><!~^|&%."; +static char sep2[] = " \r\n\t"; // only separators +static char sep3[] = ",:()[]{}-+*/=;<>!~^|&%."; // operational separators +static char num[] = "0123456789"; // point (single) is tested separately +static char hexnum[] = "0123456789ABCDEFabcdef"; +static char nch[] = "\"\r\n\t"; // forbidden in chains //static char* duo = "+=-=*=/===!=<=>=++--///**/||&&"; // double operators @@ -309,7 +309,7 @@ cc: mot += c; if (CharInList(mot[0], sep3)) // an operational separator? { CBotString motc = mot; - while (motc += c, c != 0 && GivKeyWords(motc)>0) // operand seeks the longest possible + while (motc += c, c != 0 && GetKeyWords(motc)>0) // operand seeks the longest possible { mot += c; // build the word c = *(program++); // next character @@ -367,9 +367,9 @@ bis: if (mot[0] == '\"') token->m_type = TokenTypString; if (first) token->m_type = 0; - token->m_IdKeyWord = GivKeyWords(mot); + token->m_IdKeyWord = GetKeyWords(mot); if (token->m_IdKeyWord > 0) token->m_type = TokenTypKeyWord; - else GivKeyDefNum(mot, token) ; // treats DefineNum + else GetKeyDefNum(mot, token) ; // treats DefineNum return token; } @@ -382,7 +382,7 @@ bis: CBotToken* CBotToken::CompileTokens(const char* program, int& error) { CBotToken *nxt, *prv, *tokenbase; - char* p = (char*) program; + char* p = const_cast<char*> ( program); int pos = 0; error = 0; @@ -391,9 +391,9 @@ CBotToken* CBotToken::CompileTokens(const char* program, int& error) if (tokenbase == NULL) return NULL; tokenbase->m_start = pos; - pos += tokenbase->m_Text.GivLength(); + pos += tokenbase->m_Text.GetLength(); tokenbase->m_end = pos; - pos += tokenbase->m_Sep.GivLength(); + pos += tokenbase->m_Sep.GetLength(); char* pp = p; while (NULL != (nxt = NextToken(p, error))) @@ -403,11 +403,11 @@ CBotToken* CBotToken::CompileTokens(const char* program, int& error) prv = nxt; // advance nxt->m_start = pos; -/* pos += nxt->m_Text.GivLength(); // chain may be shorter (BOA deleted) +/* pos += nxt->m_Text.GetLength(); // chain may be shorter (BOA deleted) nxt->m_end = pos; - pos += nxt->m_Sep.GivLength();*/ + pos += nxt->m_Sep.GetLength();*/ pos += (p - pp); // total size - nxt->m_end = pos - nxt->m_Sep.GivLength(); + nxt->m_end = pos - nxt->m_Sep.GetLength(); pp = p; } @@ -429,15 +429,15 @@ void CBotToken::Delete(CBotToken* pToken) // search if a word is part of the keywords -int CBotToken::GivKeyWords(const char* w) +int CBotToken::GetKeyWords(const char* w) { int i; - int l = m_ListKeyWords.GivSize(); + int l = m_ListKeyWords.GetSize(); if (l == 0) { LoadKeyWords(); // takes the list for the first time - l = m_ListKeyWords.GivSize(); + l = m_ListKeyWords.GetSize(); } for (i = 0; i < l; i++) @@ -448,10 +448,10 @@ int CBotToken::GivKeyWords(const char* w) return -1; } -bool CBotToken::GivKeyDefNum(const char* w, CBotToken* &token) +bool CBotToken::GetKeyDefNum(const char* w, CBotToken* &token) { int i; - int l = m_ListKeyDefine.GivSize(); + int l = m_ListKeyDefine.GetSize(); for (i = 0; i < l; i++) { @@ -510,7 +510,7 @@ void CBotToken::LoadKeyWords() bool CBotToken::DefineNum(const char* name, long val) { int i; - int l = m_ListKeyDefine.GivSize(); + int l = m_ListKeyDefine.GetSize(); for (i = 0; i < l; i++) { @@ -525,10 +525,10 @@ bool CBotToken::DefineNum(const char* name, long val) bool IsOfType(CBotToken* &p, int type1, int type2) { - if (p->GivType() == type1 || - p->GivType() == type2 ) + if (p->GetType() == type1 || + p->GetType() == type2 ) { - p = p->GivNext(); + p = p->GetNext(); return true; } return false; @@ -539,7 +539,7 @@ bool IsOfTypeList(CBotToken* &p, int type1, ...) { int i = type1; int max = 20; - int type = p->GivType(); + int type = p->GetType(); va_list marker; va_start( marker, type1 ); /* Initialize variable arguments. */ @@ -548,7 +548,7 @@ bool IsOfTypeList(CBotToken* &p, int type1, ...) { if (type == i) { - p = p->GivNext(); + p = p->GetNext(); va_end( marker ); /* Reset variable arguments. */ return true; } diff --git a/src/CBot/CBotTwoOpExpr.cpp b/src/CBot/CBotTwoOpExpr.cpp index 62290da..dfaed9f 100644 --- a/src/CBot/CBotTwoOpExpr.cpp +++ b/src/CBot/CBotTwoOpExpr.cpp @@ -136,11 +136,11 @@ CBotInstr* CBotTwoOpExpr::Compile(CBotToken* &p, CBotCStack* pStack, int* pOpera if (left == NULL) return pStack->Return(NULL, pStk); // if error, transmit // did we expected the operand? - int TypeOp = p->GivType(); + int TypeOp = p->GetType(); if ( IsInList( TypeOp, pOperations, typemasque ) ) { CBotTypResult type1, type2; - type1 = pStk->GivTypResult(); // what kind of the first operand? + type1 = pStk->GetTypResult(); // what kind of the first operand? if ( TypeOp == ID_LOGIC ) // special case provided for: ? op1: op2; { @@ -152,25 +152,25 @@ CBotInstr* CBotTwoOpExpr::Compile(CBotToken* &p, CBotCStack* pStack, int* pOpera CBotLogicExpr* inst = new CBotLogicExpr(); inst->m_condition = left; - p = p->GivNext(); // skip the token of the operation + p = p->GetNext(); // skip the token of the operation inst->m_op1 = CBotExpression::Compile(p, pStk); CBotToken* pp = p; if ( inst->m_op1 == NULL || !IsOfType( p, ID_DOTS ) ) { - pStk->SetError( TX_MISDOTS, p->GivStart()); + pStk->SetError( TX_MISDOTS, p->GetStart()); delete inst; return pStack->Return(NULL, pStk); } - type1 = pStk->GivTypResult(); + type1 = pStk->GetTypResult(); inst->m_op2 = CBotExpression::Compile(p, pStk); if ( inst->m_op2 == NULL ) { - pStk->SetError( TX_ENDOF, p->GivStart() ); + pStk->SetError( TX_ENDOF, p->GetStart() ); delete inst; return pStack->Return(NULL, pStk); } - type2 = pStk->GivTypResult(); + type2 = pStk->GetTypResult(); if (!TypeCompatible(type1, type2)) { pStk->SetError( TX_BAD2TYPE, pp ); @@ -187,7 +187,7 @@ CBotInstr* CBotTwoOpExpr::Compile(CBotToken* &p, CBotCStack* pStack, int* pOpera inst->SetToken(p); // stores the operation - p = p->GivNext(); // skip the token of the operation + p = p->GetNext(); // skip the token of the operation // looking statements that may be suitable for right @@ -196,10 +196,10 @@ CBotInstr* CBotTwoOpExpr::Compile(CBotToken* &p, CBotCStack* pStack, int* pOpera { // there is an second operand acceptable - type2 = pStk->GivTypResult(); // what kind of results? + type2 = pStk->GetTypResult(); // what kind of results? // what kind of result? - int TypeRes = MAX( type1.GivType(3), type2.GivType(3) ); + int TypeRes = MAX( type1.GetType(3), type2.GetType(3) ); if ( TypeOp == ID_ADD && type1.Eq(CBotTypString) ) { TypeRes = CBotTypString; @@ -232,17 +232,17 @@ CBotInstr* CBotTwoOpExpr::Compile(CBotToken* &p, CBotCStack* pStack, int* pOpera inst->m_leftop = left; // special for evaluation of the operations of the same level from left to right - while ( IsInList( p->GivType(), pOperations, typemasque ) ) // same operation(s) follows? + while ( IsInList( p->GetType(), pOperations, typemasque ) ) // same operation(s) follows? { - TypeOp = p->GivType(); + TypeOp = p->GetType(); CBotTwoOpExpr* i = new CBotTwoOpExpr(); // element for operation i->SetToken(p); // stores the operation i->m_leftop = inst; // left operand type1 = TypeRes; - p = p->GivNext(); // advance after + p = p->GetNext(); // advance after i->m_rightop = CBotTwoOpExpr::Compile( p, pStk, pOp ); - type2 = pStk->GivTypResult(); + type2 = pStk->GetTypResult(); if ( !TypeCompatible (type1, type2, TypeOp) ) // the results are compatible { @@ -252,14 +252,14 @@ CBotInstr* CBotTwoOpExpr::Compile(CBotToken* &p, CBotCStack* pStack, int* pOpera } if ( TypeRes != CBotTypString ) - TypeRes = MAX(type1.GivType(), type2.GivType()); + TypeRes = MAX(type1.GetType(), type2.GetType()); inst = i; } CBotTypResult t(type1); t.SetType(TypeRes); // is a variable on the stack for the type of result - pStk->SetVar(CBotVar::Create((CBotToken*)NULL, t)); + pStk->SetVar(CBotVar::Create(static_cast<CBotToken*>(NULL), t)); // and returns the requested object return pStack->Return(inst, pStk); @@ -283,7 +283,7 @@ CBotInstr* CBotTwoOpExpr::Compile(CBotToken* &p, CBotCStack* pStack, int* pOpera bool IsNan(CBotVar* left, CBotVar* right, int* err = NULL) { - if ( left ->GivInit() > IS_DEF || right->GivInit() > IS_DEF ) + if ( left ->GetInit() > IS_DEF || right->GetInit() > IS_DEF ) { if ( err != NULL ) *err = TX_OPNAN ; return true; @@ -302,21 +302,21 @@ bool CBotTwoOpExpr::Execute(CBotStack* &pStack) // according to recovery, it may be in one of two states - if ( pStk1->GivState() == 0 ) // first state, evaluates the left operand + if ( pStk1->GetState() == 0 ) // first state, evaluates the left operand { if (!m_leftop->Execute(pStk1) ) return false; // interrupted here? // for OR and AND logic does not evaluate the second expression if not necessary - if ( (GivTokenType() == ID_LOG_AND || GivTokenType() == ID_TXT_AND ) && pStk1->GivVal() == false ) + if ( (GetTokenType() == ID_LOG_AND || GetTokenType() == ID_TXT_AND ) && pStk1->GetVal() == false ) { - CBotVar* res = CBotVar::Create( (CBotToken*)NULL, CBotTypBoolean); + CBotVar* res = CBotVar::Create( static_cast<CBotToken*>(NULL), CBotTypBoolean); res->SetValInt(false); pStk1->SetVar(res); return pStack->Return(pStk1); // transmits the result } - if ( (GivTokenType() == ID_LOG_OR||GivTokenType() == ID_TXT_OR) && pStk1->GivVal() == true ) + if ( (GetTokenType() == ID_LOG_OR||GetTokenType() == ID_TXT_OR) && pStk1->GetVal() == true ) { - CBotVar* res = CBotVar::Create( (CBotToken*)NULL, CBotTypBoolean); + CBotVar* res = CBotVar::Create( static_cast<CBotToken*>(NULL), CBotTypBoolean); res->SetValInt(true); pStk1->SetVar(res); return pStack->Return(pStk1); // transmits the result @@ -334,28 +334,28 @@ bool CBotTwoOpExpr::Execute(CBotStack* &pStack) // or return in case of recovery // 2e état, évalue l'opérande de droite - if ( pStk2->GivState() == 0 ) + if ( pStk2->GetState() == 0 ) { if ( !m_rightop->Execute(pStk2) ) return false; // interrupted here? pStk2->IncState(); } - CBotTypResult type1 = pStk1->GivTypResult(); // what kind of results? - CBotTypResult type2 = pStk2->GivTypResult(); + CBotTypResult type1 = pStk1->GetTypResult(); // what kind of results? + CBotTypResult type2 = pStk2->GetTypResult(); CBotStack* pStk3 = pStk2->AddStack(this); // adds an item to the stack if ( pStk3->IfStep() ) return false; // shows the operation if step by step // creates a temporary variable to put the result // what kind of result? - int TypeRes = MAX(type1.GivType(), type2.GivType()); + int TypeRes = MAX(type1.GetType(), type2.GetType()); - if ( GivTokenType() == ID_ADD && type1.Eq(CBotTypString) ) + if ( GetTokenType() == ID_ADD && type1.Eq(CBotTypString) ) { TypeRes = CBotTypString; } - switch ( GivTokenType() ) + switch ( GetTokenType() ) { case ID_LOG_OR: case ID_LOG_AND: @@ -374,12 +374,12 @@ bool CBotTwoOpExpr::Execute(CBotStack* &pStack) } // creates a variable for the result - CBotVar* result = CBotVar::Create( (CBotToken*)NULL, TypeRes); + CBotVar* result = CBotVar::Create( static_cast<CBotToken*>(NULL), TypeRes); // creates a variable to perform the calculation in the appropriate type - TypeRes = MAX(type1.GivType(), type2.GivType()); + TypeRes = MAX(type1.GetType(), type2.GetType()); - if ( GivTokenType() == ID_ADD && type1.Eq(CBotTypString) ) + if ( GetTokenType() == ID_ADD && type1.Eq(CBotTypString) ) { TypeRes = CBotTypString; } @@ -387,15 +387,15 @@ bool CBotTwoOpExpr::Execute(CBotStack* &pStack) CBotVar* temp; if ( TypeRes == CBotTypPointer ) TypeRes = CBotTypNullPointer; - if ( TypeRes == CBotTypClass ) temp = CBotVar::Create( (CBotToken*)NULL, CBotTypResult(CBotTypIntrinsic, type1.GivClass() ) ); - else temp = CBotVar::Create( (CBotToken*)NULL, TypeRes ); + if ( TypeRes == CBotTypClass ) temp = CBotVar::Create( static_cast<CBotToken*>(NULL), CBotTypResult(CBotTypIntrinsic, type1.GetClass() ) ); + else temp = CBotVar::Create( static_cast<CBotToken*>(NULL), TypeRes ); int err = 0; // is a operation according to request - CBotVar* left = pStk1->GivVar(); - CBotVar* right = pStk2->GivVar(); + CBotVar* left = pStk1->GetVar(); + CBotVar* right = pStk2->GetVar(); - switch (GivTokenType()) + switch (GetTokenType()) { case ID_ADD: if ( !IsNan(left, right, &err) ) result->Add(left , right); // addition @@ -433,13 +433,13 @@ bool CBotTwoOpExpr::Execute(CBotStack* &pStack) break; case ID_EQ: if ( IsNan(left, right) ) - result->SetValInt(left->GivInit() == right->GivInit()) ; + result->SetValInt(left->GetInit() == right->GetInit()) ; else result->SetValInt(temp->Eq(left , right)); // equal break; case ID_NE: if ( IsNan(left, right) ) - result->SetValInt(left ->GivInit() != right->GivInit()) ; + result->SetValInt(left ->GetInit() != right->GetInit()) ; else result->SetValInt(temp->Ne(left , right)); // different break; @@ -485,7 +485,7 @@ void CBotTwoOpExpr::RestoreState(CBotStack* &pStack, bool bMain) // according to recovery, it may be in one of two states - if ( pStk1->GivState() == 0 ) // first state, evaluates the left operand + if ( pStk1->GetState() == 0 ) // first state, evaluates the left operand { m_leftop->RestoreState(pStk1, bMain); // interrupted here! return; @@ -495,7 +495,7 @@ void CBotTwoOpExpr::RestoreState(CBotStack* &pStack, bool bMain) if ( pStk2 == NULL ) return; // second state, evaluates the right operand - if ( pStk2->GivState() == 0 ) + if ( pStk2->GetState() == 0 ) { m_rightop->RestoreState(pStk2, bMain); // interrupted here! return; @@ -509,13 +509,13 @@ bool CBotLogicExpr::Execute(CBotStack* &pStack) // or return in case of recovery // if ( pStk1 == EOX ) return true; - if ( pStk1->GivState() == 0 ) + if ( pStk1->GetState() == 0 ) { if ( !m_condition->Execute(pStk1) ) return false; if (!pStk1->SetState(1)) return false; } - if ( pStk1->GivVal() == true ) + if ( pStk1->GetVal() == true ) { if ( !m_op1->Execute(pStk1) ) return false; } @@ -534,13 +534,13 @@ void CBotLogicExpr::RestoreState(CBotStack* &pStack, bool bMain) CBotStack* pStk1 = pStack->RestoreStack(this); // adds an item to the stack if ( pStk1 == NULL ) return; - if ( pStk1->GivState() == 0 ) + if ( pStk1->GetState() == 0 ) { m_condition->RestoreState(pStk1, bMain); return; } - if ( pStk1->GivVal() == true ) + if ( pStk1->GetVal() == true ) { m_op1->RestoreState(pStk1, bMain); } @@ -558,7 +558,7 @@ void t() } #endif -#if 01 +#if 0 void t(bool t) { int x; diff --git a/src/CBot/CBotVar.cpp b/src/CBot/CBotVar.cpp index 0d9bfb3..2430d0d 100644 --- a/src/CBot/CBotVar.cpp +++ b/src/CBot/CBotVar.cpp @@ -154,12 +154,12 @@ void CBotVarClass::InitCBotVarClass( const CBotToken* name, CBotTypResult& type m_ExPrev = NULL; m_ExClass = this; - CBotClass* pClass = type.GivClass(); - CBotClass* pClass2 = pClass->GivParent(); + CBotClass* pClass = type.GetClass(); + CBotClass* pClass2 = pClass->GetParent(); if ( pClass2 != NULL ) { // also creates an instance of the parent class - m_pParent = new CBotVarClass(name, CBotTypResult(type.GivType(),pClass2) ); //, nIdent); + m_pParent = new CBotVarClass(name, CBotTypResult(type.GetType(),pClass2) ); //, nIdent); } SetClass( pClass ); //, nIdent ); @@ -203,17 +203,17 @@ CBotVar::~CBotVar( ) void CBotVar::debug() { - const char* p = (const char*) m_token->GivString(); - CBotString s = (const char*) GivValString(); - const char* v = (const char*) s; +// const char* p = static_cast<const char*>( m_token->GetString()); + CBotString s = static_cast<const char*>( GetValString()); +// const char* v = static_cast<const char*> (s); if ( m_type.Eq(CBotTypClass) ) { - CBotVar* pv = ((CBotVarClass*)this)->m_pVar; + CBotVar* pv = (static_cast<CBotVarClass*>(this))->m_pVar; while (pv != NULL) { pv->debug(); - pv = pv->GivNext(); + pv = pv->GetNext(); } } } @@ -227,15 +227,15 @@ void CBotVar::SetUserPtr(void* pUser) { m_pUserPtr = pUser; if (m_type.Eq(CBotTypPointer) && - ((CBotVarPointer*)this)->m_pVarClass != NULL ) - ((CBotVarPointer*)this)->m_pVarClass->SetUserPtr(pUser); + (static_cast<CBotVarPointer*>(this))->m_pVarClass != NULL ) + (static_cast<CBotVarPointer*>(this))->m_pVarClass->SetUserPtr(pUser); } void CBotVar::SetIdent(long n) { if (m_type.Eq(CBotTypPointer) && - ((CBotVarPointer*)this)->m_pVarClass != NULL ) - ((CBotVarPointer*)this)->m_pVarClass->SetIdent(n); + (static_cast<CBotVarPointer*>(this))->m_pVarClass != NULL ) + (static_cast<CBotVarPointer*>(this))->m_pVarClass->SetIdent(n); } void CBotVar::SetUniqNum(long n) @@ -251,13 +251,13 @@ long CBotVar::NextUniqNum() return m_identcpt; } -long CBotVar::GivUniqNum() +long CBotVar::GetUniqNum() { return m_ident; } -void* CBotVar::GivUserPtr() +void* CBotVar::GetUserPtr() { return m_pUserPtr; } @@ -288,7 +288,7 @@ CBotVar* CBotVar::Create(const CBotToken* name, int type ) CBotVar* CBotVar::Create(const CBotToken* name, CBotTypResult type) { - switch (type.GivType()) + switch (type.GetType()) { case CBotTypShort: case CBotTypInt: @@ -327,8 +327,8 @@ CBotVar* CBotVar::Create(const CBotToken* name, CBotTypResult type) CBotVar* pv = array; while (type.Eq(CBotTypArrayBody)) { - type = type.GivTypElem(); - pv = ((CBotVarArray*)pv)->GivItem(0, true); // creates at least the element [0] + type = type.GetTypElem(); + pv = (static_cast<CBotVarArray*>(pv))->GetItem(0, true); // creates at least the element [0] } return array; @@ -341,7 +341,7 @@ CBotVar* CBotVar::Create(const CBotToken* name, CBotTypResult type) CBotVar* CBotVar::Create( CBotVar* pVar ) { - CBotVar* p = Create(pVar->m_token->GivString(), pVar->GivTypResult(2)); + CBotVar* p = Create(pVar->m_token->GetString(), pVar->GetTypResult(2)); return p; } @@ -350,7 +350,7 @@ CBotVar* CBotVar::Create( const char* n, CBotTypResult type) { CBotToken name(n); - switch (type.GivType()) + switch (type.GetType()) { case CBotTypShort: case CBotTypInt: @@ -365,13 +365,13 @@ CBotVar* CBotVar::Create( const char* n, CBotTypResult type) case CBotTypNullPointer: { CBotVarPointer* p = new CBotVarPointer(&name, type); -// p->SetClass(type.GivClass()); +// p->SetClass(type.GetClass()); return p; } case CBotTypIntrinsic: { CBotVarClass* p = new CBotVarClass(&name, type); -// p->SetClass(type.GivClass()); +// p->SetClass(type.GetClass()); return p; } @@ -382,7 +382,7 @@ CBotVar* CBotVar::Create( const char* n, CBotTypResult type) CBotVarClass* instance = new CBotVarClass(&name, type); CBotVarPointer* pointer = new CBotVarPointer(&name, type); pointer->SetPointer( instance ); -// pointer->SetClass( type.GivClass() ); +// pointer->SetClass( type.GetClass() ); return pointer; } @@ -398,8 +398,8 @@ CBotVar* CBotVar::Create( const char* n, CBotTypResult type) CBotVar* pv = array; while (type.Eq(CBotTypArrayBody)) { - type = type.GivTypElem(); - pv = ((CBotVarArray*)pv)->GivItem(0, true); // creates at least the element [0] + type = type.GetTypElem(); + pv = (static_cast<CBotVarArray*>(pv))->GetItem(0, true); // creates at least the element [0] } return array; @@ -439,7 +439,7 @@ CBotVar* CBotVar::Create( const char* name, CBotClass* pClass) return pVar; } -CBotTypResult CBotVar::GivTypResult(int mode) +CBotTypResult CBotVar::GetTypResult(int mode) { CBotTypResult r = m_type; @@ -451,13 +451,13 @@ CBotTypResult CBotVar::GivTypResult(int mode) return r; } -int CBotVar::GivType(int mode) +int CBotVar::GetType(int mode) { if ( mode == 1 && m_type.Eq(CBotTypClass) ) return CBotTypPointer; if ( mode == 2 && m_type.Eq(CBotTypClass) ) return CBotTypIntrinsic; - return m_type.GivType(); + return m_type.GetType(); } void CBotVar::SetType(CBotTypResult& type) @@ -466,7 +466,7 @@ void CBotVar::SetType(CBotTypResult& type) } -int CBotVar::GivInit() +int CBotVar::GetInit() { if ( m_type.Eq(CBotTypClass) ) return IS_DEF; // always set! @@ -480,11 +480,11 @@ void CBotVar::SetInit(int bInit) if ( m_type.Eq(CBotTypPointer) && bInit == 2 ) { - CBotVarClass* instance = GivPointer(); + CBotVarClass* instance = GetPointer(); if ( instance == NULL ) { instance = new CBotVarClass(NULL, m_type); -// instance->SetClass(((CBotVarPointer*)this)->m_pClass); +// instance->SetClass((static_cast<CBotVarPointer*>(this))->m_pClass); SetPointer(instance); } instance->SetInit(1); @@ -492,19 +492,19 @@ void CBotVar::SetInit(int bInit) if ( m_type.Eq(CBotTypClass) || m_type.Eq(CBotTypIntrinsic) ) { - CBotVar* p = ((CBotVarClass*)this)->m_pVar; + CBotVar* p = (static_cast<CBotVarClass*>(this))->m_pVar; while( p != NULL ) { p->SetInit( bInit ); - p->m_pMyThis = (CBotVarClass*)this; - p = p->GivNext(); + p->m_pMyThis = static_cast<CBotVarClass*>(this); + p = p->GetNext(); } } } -CBotString CBotVar::GivName() +CBotString CBotVar::GetName() { - return m_token->GivString(); + return m_token->GetString(); } void CBotVar::SetName(const char* name) @@ -512,30 +512,30 @@ void CBotVar::SetName(const char* name) m_token->SetString(name); } -CBotToken* CBotVar::GivToken() +CBotToken* CBotVar::GetToken() { return m_token; } -CBotVar* CBotVar::GivItem(const char* name) +CBotVar* CBotVar::GetItem(const char* name) { ASM_TRAP(); return NULL; } -CBotVar* CBotVar::GivItemRef(int nIdent) +CBotVar* CBotVar::GetItemRef(int nIdent) { ASM_TRAP(); return NULL; } -CBotVar* CBotVar::GivItemList() +CBotVar* CBotVar::GetItemList() { ASM_TRAP(); return NULL; } -CBotVar* CBotVar::GivItem(int row, bool bGrow) +CBotVar* CBotVar::GetItem(int row, bool bGrow) { ASM_TRAP(); return NULL; @@ -548,34 +548,34 @@ bool CBotVar::IsElemOfClass(const char* name) if ( m_type.Eq(CBotTypPointer) ) { - pc = ((CBotVarPointer*)this)->m_pClass; + pc = (static_cast<CBotVarPointer*>(this))->m_pClass; } if ( m_type.Eq(CBotTypClass) ) { - pc = ((CBotVarClass*)this)->m_pClass; + pc = (static_cast<CBotVarClass*>(this))->m_pClass; } while ( pc != NULL ) { - if ( pc->GivName() == name ) return true; - pc = pc->GivParent(); + if ( pc->GetName() == name ) return true; + pc = pc->GetParent(); } return false; } -CBotVar* CBotVar::GivStaticVar() +CBotVar* CBotVar::GetStaticVar() { // makes the pointer to the variable if it is static if ( m_bStatic == 0 || m_pMyThis == NULL ) return this; - CBotClass* pClass = m_pMyThis->GivClass(); - return pClass->GivItem( m_token->GivString() ); + CBotClass* pClass = m_pMyThis->GetClass(); + return pClass->GetItem( m_token->GetString() ); } -CBotVar* CBotVar::GivNext() +CBotVar* CBotVar::GetNext() { return m_next; } @@ -590,29 +590,29 @@ void CBotVar::AddNext(CBotVar* pVar) void CBotVar::SetVal(CBotVar* var) { - switch (/*var->*/GivType()) + switch (/*var->*/GetType()) { case CBotTypBoolean: - SetValInt(var->GivValInt()); + SetValInt(var->GetValInt()); break; case CBotTypInt: - SetValInt(var->GivValInt(), ((CBotVarInt*)var)->m_defnum); + SetValInt(var->GetValInt(), (static_cast<CBotVarInt*>(var))->m_defnum); break; case CBotTypFloat: - SetValFloat(var->GivValFloat()); + SetValFloat(var->GetValFloat()); break; case CBotTypString: - SetValString(var->GivValString()); + SetValString(var->GetValString()); break; case CBotTypPointer: case CBotTypNullPointer: case CBotTypArrayPointer: - SetPointer(var->GivPointer()); + SetPointer(var->GetPointer()); break; case CBotTypClass: { - delete ((CBotVarClass*)this)->m_pVar; - ((CBotVarClass*)this)->m_pVar = NULL; + delete (static_cast<CBotVarClass*>(this))->m_pVar; + (static_cast<CBotVarClass*>(this))->m_pVar = NULL; Copy(var, false); } break; @@ -643,7 +643,7 @@ bool CBotVar::IsPrivate(int mode) return m_mPrivate >= mode; } -int CBotVar::GivPrivate() +int CBotVar::GetPrivate() { return m_mPrivate; } @@ -654,7 +654,7 @@ void CBotVar::SetPointer(CBotVar* pVarClass) ASM_TRAP(); } -CBotVarClass* CBotVar::GivPointer() +CBotVarClass* CBotVar::GetPointer() { ASM_TRAP(); return NULL; @@ -663,13 +663,13 @@ CBotVarClass* CBotVar::GivPointer() // All these functions must be defined in the subclasses // derived from class CBotVar -int CBotVar::GivValInt() +int CBotVar::GetValInt() { ASM_TRAP(); return 0; } -float CBotVar::GivValFloat() +float CBotVar::GetValFloat() { ASM_TRAP(); return 0; @@ -812,7 +812,7 @@ void CBotVar::SetValString(const char* p) ASM_TRAP(); } -CBotString CBotVar::GivValString() +CBotString CBotVar::GetValString() { ASM_TRAP(); return CBotString(); @@ -823,7 +823,7 @@ void CBotVar::SetClass(CBotClass* pClass) ASM_TRAP(); } -CBotClass* CBotVar::GivClass() +CBotClass* CBotVar::GetClass() { ASM_TRAP(); return NULL; @@ -841,7 +841,7 @@ void CBotVar::SetIndirection(CBotVar* pVar) // copy a variable in to another void CBotVarInt::Copy(CBotVar* pSrc, bool bName) { - CBotVarInt* p = (CBotVarInt*)pSrc; + CBotVarInt* p = static_cast<CBotVarInt*>(pSrc); if ( bName) *m_token = *p->m_token; m_type = p->m_type; @@ -870,21 +870,21 @@ void CBotVarInt::SetValInt(int val, const char* defnum) void CBotVarInt::SetValFloat(float val) { - m_val = (int)val; + m_val = static_cast<int>(val); m_binit = true; } -int CBotVarInt::GivValInt() +int CBotVarInt::GetValInt() { return m_val; } -float CBotVarInt::GivValFloat() +float CBotVarInt::GetValFloat() { - return (float)m_val; + return static_cast<float>(m_val); } -CBotString CBotVarInt::GivValString() +CBotString CBotVarInt::GetValString() { if ( !m_defnum.IsEmpty() ) return m_defnum; @@ -911,22 +911,22 @@ CBotString CBotVarInt::GivValString() void CBotVarInt::Mul(CBotVar* left, CBotVar* right) { - m_val = left->GivValInt() * right->GivValInt(); + m_val = left->GetValInt() * right->GetValInt(); m_binit = true; } void CBotVarInt::Power(CBotVar* left, CBotVar* right) { - m_val = (int) pow( (double) left->GivValInt() , (double) right->GivValInt() ); + m_val = static_cast<int>( pow( static_cast<double>( left->GetValInt()) , static_cast<double>( left->GetValInt()) )); m_binit = true; } int CBotVarInt::Div(CBotVar* left, CBotVar* right) { - int r = right->GivValInt(); + int r = right->GetValInt(); if ( r != 0 ) { - m_val = left->GivValInt() / r; + m_val = left->GetValInt() / r; m_binit = true; } return ( r == 0 ? TX_DIVZERO : 0 ); @@ -934,10 +934,10 @@ int CBotVarInt::Div(CBotVar* left, CBotVar* right) int CBotVarInt::Modulo(CBotVar* left, CBotVar* right) { - int r = right->GivValInt(); + int r = right->GetValInt(); if ( r != 0 ) { - m_val = left->GivValInt() % r; + m_val = left->GetValInt() % r; m_binit = true; } return ( r == 0 ? TX_DIVZERO : 0 ); @@ -945,50 +945,50 @@ int CBotVarInt::Modulo(CBotVar* left, CBotVar* right) void CBotVarInt::Add(CBotVar* left, CBotVar* right) { - m_val = left->GivValInt() + right->GivValInt(); + m_val = left->GetValInt() + right->GetValInt(); m_binit = true; } void CBotVarInt::Sub(CBotVar* left, CBotVar* right) { - m_val = left->GivValInt() - right->GivValInt(); + m_val = left->GetValInt() - right->GetValInt(); m_binit = true; } void CBotVarInt::XOr(CBotVar* left, CBotVar* right) { - m_val = left->GivValInt() ^ right->GivValInt(); + m_val = left->GetValInt() ^ right->GetValInt(); m_binit = true; } void CBotVarInt::And(CBotVar* left, CBotVar* right) { - m_val = left->GivValInt() & right->GivValInt(); + m_val = left->GetValInt() & right->GetValInt(); m_binit = true; } void CBotVarInt::Or(CBotVar* left, CBotVar* right) { - m_val = left->GivValInt() | right->GivValInt(); + m_val = left->GetValInt() | right->GetValInt(); m_binit = true; } void CBotVarInt::SL(CBotVar* left, CBotVar* right) { - m_val = left->GivValInt() << right->GivValInt(); + m_val = left->GetValInt() << right->GetValInt(); m_binit = true; } void CBotVarInt::ASR(CBotVar* left, CBotVar* right) { - m_val = left->GivValInt() >> right->GivValInt(); + m_val = left->GetValInt() >> right->GetValInt(); m_binit = true; } void CBotVarInt::SR(CBotVar* left, CBotVar* right) { - int source = left->GivValInt(); - int shift = right->GivValInt(); + int source = left->GetValInt(); + int shift = right->GetValInt(); if (shift>=1) source &= 0x7fffffff; m_val = source >> shift; m_binit = true; @@ -1018,32 +1018,32 @@ void CBotVarInt::Dec() bool CBotVarInt::Lo(CBotVar* left, CBotVar* right) { - return left->GivValInt() < right->GivValInt(); + return left->GetValInt() < right->GetValInt(); } bool CBotVarInt::Hi(CBotVar* left, CBotVar* right) { - return left->GivValInt() > right->GivValInt(); + return left->GetValInt() > right->GetValInt(); } bool CBotVarInt::Ls(CBotVar* left, CBotVar* right) { - return left->GivValInt() <= right->GivValInt(); + return left->GetValInt() <= right->GetValInt(); } bool CBotVarInt::Hs(CBotVar* left, CBotVar* right) { - return left->GivValInt() >= right->GivValInt(); + return left->GetValInt() >= right->GetValInt(); } bool CBotVarInt::Eq(CBotVar* left, CBotVar* right) { - return left->GivValInt() == right->GivValInt(); + return left->GetValInt() == right->GetValInt(); } bool CBotVarInt::Ne(CBotVar* left, CBotVar* right) { - return left->GivValInt() != right->GivValInt(); + return left->GetValInt() != right->GetValInt(); } @@ -1052,7 +1052,7 @@ bool CBotVarInt::Ne(CBotVar* left, CBotVar* right) // copy a variable into another void CBotVarFloat::Copy(CBotVar* pSrc, bool bName) { - CBotVarFloat* p = (CBotVarFloat*)pSrc; + CBotVarFloat* p = static_cast<CBotVarFloat*>(pSrc); if (bName) *m_token = *p->m_token; m_type = p->m_type; @@ -1072,7 +1072,7 @@ void CBotVarFloat::Copy(CBotVar* pSrc, bool bName) void CBotVarFloat::SetValInt(int val, const char* s) { - m_val = (float)val; + m_val = static_cast<float>(val); m_binit = true; } @@ -1082,17 +1082,17 @@ void CBotVarFloat::SetValFloat(float val) m_binit = true; } -int CBotVarFloat::GivValInt() +int CBotVarFloat::GetValInt() { - return (int)m_val; + return static_cast<int>(m_val); } -float CBotVarFloat::GivValFloat() +float CBotVarFloat::GetValFloat() { return m_val; } -CBotString CBotVarFloat::GivValString() +CBotString CBotVarFloat::GetValString() { CBotString res; @@ -1117,22 +1117,22 @@ CBotString CBotVarFloat::GivValString() void CBotVarFloat::Mul(CBotVar* left, CBotVar* right) { - m_val = left->GivValFloat() * right->GivValFloat(); + m_val = left->GetValFloat() * right->GetValFloat(); m_binit = true; } void CBotVarFloat::Power(CBotVar* left, CBotVar* right) { - m_val = (float)pow( left->GivValFloat() , right->GivValFloat() ); + m_val = static_cast<float>(pow( left->GetValFloat() , right->GetValFloat() )); m_binit = true; } int CBotVarFloat::Div(CBotVar* left, CBotVar* right) { - float r = right->GivValFloat(); + float r = right->GetValFloat(); if ( r != 0 ) { - m_val = left->GivValFloat() / r; + m_val = left->GetValFloat() / r; m_binit = true; } return ( r == 0 ? TX_DIVZERO : 0 ); @@ -1140,10 +1140,10 @@ int CBotVarFloat::Div(CBotVar* left, CBotVar* right) int CBotVarFloat::Modulo(CBotVar* left, CBotVar* right) { - float r = right->GivValFloat(); + float r = right->GetValFloat(); if ( r != 0 ) { - m_val = (float)fmod( left->GivValFloat() , r ); + m_val = static_cast<float>(fmod( left->GetValFloat() , r )); m_binit = true; } return ( r == 0 ? TX_DIVZERO : 0 ); @@ -1151,13 +1151,13 @@ int CBotVarFloat::Modulo(CBotVar* left, CBotVar* right) void CBotVarFloat::Add(CBotVar* left, CBotVar* right) { - m_val = left->GivValFloat() + right->GivValFloat(); + m_val = left->GetValFloat() + right->GetValFloat(); m_binit = true; } void CBotVarFloat::Sub(CBotVar* left, CBotVar* right) { - m_val = left->GivValFloat() - right->GivValFloat(); + m_val = left->GetValFloat() - right->GetValFloat(); m_binit = true; } @@ -1179,32 +1179,32 @@ void CBotVarFloat::Dec() bool CBotVarFloat::Lo(CBotVar* left, CBotVar* right) { - return left->GivValFloat() < right->GivValFloat(); + return left->GetValFloat() < right->GetValFloat(); } bool CBotVarFloat::Hi(CBotVar* left, CBotVar* right) { - return left->GivValFloat() > right->GivValFloat(); + return left->GetValFloat() > right->GetValFloat(); } bool CBotVarFloat::Ls(CBotVar* left, CBotVar* right) { - return left->GivValFloat() <= right->GivValFloat(); + return left->GetValFloat() <= right->GetValFloat(); } bool CBotVarFloat::Hs(CBotVar* left, CBotVar* right) { - return left->GivValFloat() >= right->GivValFloat(); + return left->GetValFloat() >= right->GetValFloat(); } bool CBotVarFloat::Eq(CBotVar* left, CBotVar* right) { - return left->GivValFloat() == right->GivValFloat(); + return left->GetValFloat() == right->GetValFloat(); } bool CBotVarFloat::Ne(CBotVar* left, CBotVar* right) { - return left->GivValFloat() != right->GivValFloat(); + return left->GetValFloat() != right->GetValFloat(); } @@ -1213,7 +1213,7 @@ bool CBotVarFloat::Ne(CBotVar* left, CBotVar* right) // copy a variable into another void CBotVarBoolean::Copy(CBotVar* pSrc, bool bName) { - CBotVarBoolean* p = (CBotVarBoolean*)pSrc; + CBotVarBoolean* p = static_cast<CBotVarBoolean*>(pSrc); if (bName) *m_token = *p->m_token; m_type = p->m_type; @@ -1233,27 +1233,27 @@ void CBotVarBoolean::Copy(CBotVar* pSrc, bool bName) void CBotVarBoolean::SetValInt(int val, const char* s) { - m_val = (bool)val; + m_val = static_cast<bool>(val); m_binit = true; } void CBotVarBoolean::SetValFloat(float val) { - m_val = (bool)val; + m_val = static_cast<bool>(val); m_binit = true; } -int CBotVarBoolean::GivValInt() +int CBotVarBoolean::GetValInt() { return m_val; } -float CBotVarBoolean::GivValFloat() +float CBotVarBoolean::GetValFloat() { - return (float)m_val; + return static_cast<float>(m_val); } -CBotString CBotVarBoolean::GivValString() +CBotString CBotVarBoolean::GetValString() { CBotString ret; @@ -1276,18 +1276,18 @@ CBotString CBotVarBoolean::GivValString() void CBotVarBoolean::And(CBotVar* left, CBotVar* right) { - m_val = left->GivValInt() && right->GivValInt(); + m_val = left->GetValInt() && right->GetValInt(); m_binit = true; } void CBotVarBoolean::Or(CBotVar* left, CBotVar* right) { - m_val = left->GivValInt() || right->GivValInt(); + m_val = left->GetValInt() || right->GetValInt(); m_binit = true; } void CBotVarBoolean::XOr(CBotVar* left, CBotVar* right) { - m_val = left->GivValInt() ^ right->GivValInt(); + m_val = left->GetValInt() ^ right->GetValInt(); m_binit = true; } @@ -1298,12 +1298,12 @@ void CBotVarBoolean::Not() bool CBotVarBoolean::Eq(CBotVar* left, CBotVar* right) { - return left->GivValInt() == right->GivValInt(); + return left->GetValInt() == right->GetValInt(); } bool CBotVarBoolean::Ne(CBotVar* left, CBotVar* right) { - return left->GivValInt() != right->GivValInt(); + return left->GetValInt() != right->GetValInt(); } ////////////////////////////////////////////////////////////////////////////////////// @@ -1311,7 +1311,7 @@ bool CBotVarBoolean::Ne(CBotVar* left, CBotVar* right) // copy a variable into another void CBotVarString::Copy(CBotVar* pSrc, bool bName) { - CBotVarString* p = (CBotVarString*)pSrc; + CBotVarString* p = static_cast<CBotVarString*>(pSrc); if (bName) *m_token = *p->m_token; m_type = p->m_type; @@ -1333,7 +1333,7 @@ void CBotVarString::SetValString(const char* p) m_binit = true; } -CBotString CBotVarString::GivValString() +CBotString CBotVarString::GetValString() { if ( !m_binit ) { @@ -1354,39 +1354,39 @@ CBotString CBotVarString::GivValString() void CBotVarString::Add(CBotVar* left, CBotVar* right) { - m_val = left->GivValString() + right->GivValString(); + m_val = left->GetValString() + right->GetValString(); m_binit = true; } bool CBotVarString::Eq(CBotVar* left, CBotVar* right) { - return (left->GivValString() == right->GivValString()); + return (left->GetValString() == right->GetValString()); } bool CBotVarString::Ne(CBotVar* left, CBotVar* right) { - return (left->GivValString() != right->GivValString()); + return (left->GetValString() != right->GetValString()); } bool CBotVarString::Lo(CBotVar* left, CBotVar* right) { - return (left->GivValString() == right->GivValString()); + return (left->GetValString() == right->GetValString()); } bool CBotVarString::Hi(CBotVar* left, CBotVar* right) { - return (left->GivValString() == right->GivValString()); + return (left->GetValString() == right->GetValString()); } bool CBotVarString::Ls(CBotVar* left, CBotVar* right) { - return (left->GivValString() == right->GivValString()); + return (left->GetValString() == right->GetValString()); } bool CBotVarString::Hs(CBotVar* left, CBotVar* right) { - return (left->GivValString() == right->GivValString()); + return (left->GetValString() == right->GetValString()); } @@ -1395,12 +1395,12 @@ bool CBotVarString::Hs(CBotVar* left, CBotVar* right) // copy a variable into another void CBotVarClass::Copy(CBotVar* pSrc, bool bName) { - pSrc = pSrc->GivPointer(); // if source given by a pointer + pSrc = pSrc->GetPointer(); // if source given by a pointer - if ( pSrc->GivType() != CBotTypClass ) + if ( pSrc->GetType() != CBotTypClass ) ASM_TRAP(); - CBotVarClass* p = (CBotVarClass*)pSrc; + CBotVarClass* p = static_cast<CBotVarClass*>(pSrc); if (bName) *m_token = *p->m_token; @@ -1410,7 +1410,7 @@ void CBotVarClass::Copy(CBotVar* pSrc, bool bName) m_pClass = p->m_pClass; if ( p->m_pParent ) { - ASM_TRAP(); "que faire du pParent"; + ASM_TRAP(); // "que faire du pParent"; } // m_next = NULL; @@ -1432,7 +1432,7 @@ void CBotVarClass::Copy(CBotVar* pSrc, bool bName) if ( m_pVar == NULL ) m_pVar = pn; else m_pVar->AddNext(pn); - pv = pv->GivNext(); + pv = pv->GetNext(); } } @@ -1461,7 +1461,7 @@ void CBotVarClass::SetClass(CBotClass* pClass)//, int &nIdent) if (pClass == NULL) return; - CBotVar* pv = pClass->GivVar(); // first on a list + CBotVar* pv = pClass->GetVar(); // first on a list while ( pv != NULL ) { // seeks the maximum dimensions of the table @@ -1475,10 +1475,10 @@ void CBotVarClass::SetClass(CBotClass* pClass)//, int &nIdent) while (p != NULL) { while( pile->IsOk() && !p->Execute(pile) ) ; // calculate size without interruptions - CBotVar* v = pile->GivVar(); // result - max[n] = v->GivValInt(); // value + CBotVar* v = pile->GetVar(); // result + max[n] = v->GetValInt(); // value n++; - p = p->GivNext3(); + p = p->GetNext3(); } while (n<100) max[n++] = 0; @@ -1488,7 +1488,7 @@ void CBotVarClass::SetClass(CBotClass* pClass)//, int &nIdent) CBotVar* pn = CBotVar::Create( pv ); // a copy pn->SetStatic(pv->IsStatic()); - pn->SetPrivate(pv->GivPrivate()); + pn->SetPrivate(pv->GetPrivate()); if ( pv->m_InitExpr != NULL ) // expression for initialization? { @@ -1501,22 +1501,22 @@ void CBotVarClass::SetClass(CBotClass* pClass)//, int &nIdent) #else CBotStack* pile = new CBotStack(NULL); // an independent stack while(!pv->m_InitExpr->Execute(pile)); // evaluates the expression without timer - pn->SetVal( pile->GivVar() ) ; + pn->SetVal( pile->GetVar() ) ; delete pile; #endif } // pn->SetUniqNum(CBotVar::NextUniqNum()); // enumerate elements - pn->SetUniqNum(pv->GivUniqNum()); //++nIdent + pn->SetUniqNum(pv->GetUniqNum()); //++nIdent pn->m_pMyThis = this; if ( m_pVar == NULL) m_pVar = pn; else m_pVar->AddNext( pn ); - pv = pv->GivNext(); + pv = pv->GetNext(); } } -CBotClass* CBotVarClass::GivClass() +CBotClass* CBotVarClass::GetClass() { return m_pClass; } @@ -1540,49 +1540,49 @@ void CBotVarClass::Maj(void* pUser, bool bContinu) m_pClass->m_rMaj( this, pUser ); } -CBotVar* CBotVarClass::GivItem(const char* name) +CBotVar* CBotVarClass::GetItem(const char* name) { CBotVar* p = m_pVar; while ( p != NULL ) { - if ( p->GivName() == name ) return p; - p = p->GivNext(); + if ( p->GetName() == name ) return p; + p = p->GetNext(); } - if ( m_pParent != NULL ) return m_pParent->GivItem(name); + if ( m_pParent != NULL ) return m_pParent->GetItem(name); return NULL; } -CBotVar* CBotVarClass::GivItemRef(int nIdent) +CBotVar* CBotVarClass::GetItemRef(int nIdent) { CBotVar* p = m_pVar; while ( p != NULL ) { - if ( p->GivUniqNum() == nIdent ) return p; - p = p->GivNext(); + if ( p->GetUniqNum() == nIdent ) return p; + p = p->GetNext(); } - if ( m_pParent != NULL ) return m_pParent->GivItemRef(nIdent); + if ( m_pParent != NULL ) return m_pParent->GetItemRef(nIdent); return NULL; } // for the management of an array // bExtend can enlarge the table, but not beyond the threshold size of SetArray () -CBotVar* CBotVarClass::GivItem(int n, bool bExtend) +CBotVar* CBotVarClass::GetItem(int n, bool bExtend) { CBotVar* p = m_pVar; if ( n < 0 ) return NULL; if ( n > MAXARRAYSIZE ) return NULL; - if ( m_type.GivLimite() >= 0 && n >= m_type.GivLimite() ) return NULL; + if ( m_type.GetLimite() >= 0 && n >= m_type.GetLimite() ) return NULL; if ( p == NULL && bExtend ) { - p = CBotVar::Create("", m_type.GivTypElem()); + p = CBotVar::Create("", m_type.GetTypElem()); m_pVar = p; } @@ -1592,7 +1592,7 @@ CBotVar* CBotVarClass::GivItem(int n, bool bExtend) { if ( p->m_next == NULL ) { - if ( bExtend ) p->m_next = CBotVar::Create("", m_type.GivTypElem()); + if ( bExtend ) p->m_next = CBotVar::Create("", m_type.GetTypElem()); if ( p->m_next == NULL ) return NULL; } p = p->m_next; @@ -1601,21 +1601,21 @@ CBotVar* CBotVarClass::GivItem(int n, bool bExtend) return p; } -CBotVar* CBotVarClass::GivItemList() +CBotVar* CBotVarClass::GetItemList() { return m_pVar; } -CBotString CBotVarClass::GivValString() +CBotString CBotVarClass::GetValString() { -// if ( m_Indirect != NULL) return m_Indirect->GivValString(); +// if ( m_Indirect != NULL) return m_Indirect->GetValString(); CBotString res; if ( m_pClass != NULL ) // not used for an array { - res = m_pClass->GivName() + CBotString("( "); + res = m_pClass->GetName() + CBotString("( "); CBotVarClass* my = this; while ( my != NULL ) @@ -1623,25 +1623,25 @@ CBotString CBotVarClass::GivValString() CBotVar* pv = my->m_pVar; while ( pv != NULL ) { - res += pv->GivName() + CBotString("="); + res += pv->GetName() + CBotString("="); if ( pv->IsStatic() ) { - CBotVar* pvv = my->m_pClass->GivItem(pv->GivName()); - res += pvv->GivValString(); + CBotVar* pvv = my->m_pClass->GetItem(pv->GetName()); + res += pvv->GetValString(); } else { - res += pv->GivValString(); + res += pv->GetValString(); } - pv = pv->GivNext(); + pv = pv->GetNext(); if ( pv != NULL ) res += ", "; } my = my->m_pParent; if ( my != NULL ) { res += ") extends "; - res += my->m_pClass->GivName(); + res += my->m_pClass->GetName(); res += " ("; } } @@ -1653,9 +1653,9 @@ CBotString CBotVarClass::GivValString() CBotVar* pv = m_pVar; while ( pv != NULL ) { - res += pv->GivValString(); - if ( pv->GivNext() != NULL ) res += ", "; - pv = pv->GivNext(); + res += pv->GetValString(); + if ( pv->GetNext() != NULL ) res += ", "; + pv = pv->GetNext(); } } @@ -1683,7 +1683,7 @@ void CBotVarClass::DecrementUse() // saves the value for return int err, start, end; CBotStack* pile = NULL; - err = pile->GivError(start,end); // stack == NULL it does not bother! + err = pile->GetError(start,end); // stack == NULL it does not bother! pile = CBotStack::FirstStack(); // clears the error CBotVar* ppVars[1]; @@ -1693,7 +1693,7 @@ void CBotVarClass::DecrementUse() pThis->SetPointer(this); CBotVar* pResult = NULL; - CBotString nom = "~" + m_pClass->GivName(); + CBotString nom = "~" + m_pClass->GetName(); long ident = 0; while ( pile->IsOk() && !m_pClass->ExecuteMethode(ident, nom, pThis, ppVars, pResult, pile, NULL)) ; // waits for the end @@ -1709,7 +1709,7 @@ void CBotVarClass::DecrementUse() } } -CBotVarClass* CBotVarClass::GivPointer() +CBotVarClass* CBotVarClass::GetPointer() { return this; } @@ -1732,14 +1732,14 @@ CBotVarClass* CBotVarClass::Find(long id) bool CBotVarClass::Eq(CBotVar* left, CBotVar* right) { - CBotVar* l = left->GivItemList(); - CBotVar* r = right->GivItemList(); + CBotVar* l = left->GetItemList(); + CBotVar* r = right->GetItemList(); while ( l != NULL && r != NULL ) { if ( l->Ne(l, r) ) return false; - l = l->GivNext(); - r = r->GivNext(); + l = l->GetNext(); + r = r->GetNext(); } // should always arrived simultaneously at the end (same classes) @@ -1748,14 +1748,14 @@ bool CBotVarClass::Eq(CBotVar* left, CBotVar* right) bool CBotVarClass::Ne(CBotVar* left, CBotVar* right) { - CBotVar* l = left->GivItemList(); - CBotVar* r = right->GivItemList(); + CBotVar* l = left->GetItemList(); + CBotVar* r = right->GetItemList(); while ( l != NULL && r != NULL ) { if ( l->Ne(l, r) ) return true; - l = l->GivNext(); - r = r->GivNext(); + l = l->GetNext(); + r = r->GetNext(); } // should always arrived simultaneously at the end (same classes) @@ -1790,14 +1790,14 @@ CBotVarArray::~CBotVarArray() // copy a variable into another void CBotVarArray::Copy(CBotVar* pSrc, bool bName) { - if ( pSrc->GivType() != CBotTypArrayPointer ) + if ( pSrc->GetType() != CBotTypArrayPointer ) ASM_TRAP(); - CBotVarArray* p = (CBotVarArray*)pSrc; + CBotVarArray* p = static_cast<CBotVarArray*>(pSrc); if ( bName) *m_token = *p->m_token; m_type = p->m_type; - m_pInstance = p->GivPointer(); + m_pInstance = p->GetPointer(); if ( m_pInstance != NULL ) m_pInstance->IncrementUse(); // a reference increase @@ -1820,28 +1820,28 @@ void CBotVarArray::SetPointer(CBotVar* pVarClass) if ( pVarClass != NULL ) { - if ( pVarClass->GivType() == CBotTypArrayPointer ) - pVarClass = pVarClass->GivPointer(); // the real pointer to the object + if ( pVarClass->GetType() == CBotTypArrayPointer ) + pVarClass = pVarClass->GetPointer(); // the real pointer to the object if ( !pVarClass->m_type.Eq(CBotTypClass) && !pVarClass->m_type.Eq(CBotTypArrayBody)) ASM_TRAP(); - ((CBotVarClass*)pVarClass)->IncrementUse(); // incement the reference + (static_cast<CBotVarClass*>(pVarClass))->IncrementUse(); // incement the reference } if ( m_pInstance != NULL ) m_pInstance->DecrementUse(); - m_pInstance = (CBotVarClass*)pVarClass; + m_pInstance = static_cast<CBotVarClass*>(pVarClass); } -CBotVarClass* CBotVarArray::GivPointer() +CBotVarClass* CBotVarArray::GetPointer() { if ( m_pInstance == NULL ) return NULL; - return m_pInstance->GivPointer(); + return m_pInstance->GetPointer(); } -CBotVar* CBotVarArray::GivItem(int n, bool bExtend) +CBotVar* CBotVarArray::GetItem(int n, bool bExtend) { if ( m_pInstance == NULL ) { @@ -1851,19 +1851,19 @@ CBotVar* CBotVarArray::GivItem(int n, bool bExtend) CBotVarClass* instance = new CBotVarClass(NULL, m_type); SetPointer( instance ); } - return m_pInstance->GivItem(n, bExtend); + return m_pInstance->GetItem(n, bExtend); } -CBotVar* CBotVarArray::GivItemList() +CBotVar* CBotVarArray::GetItemList() { if ( m_pInstance == NULL) return NULL; - return m_pInstance->GivItemList(); + return m_pInstance->GetItemList(); } -CBotString CBotVarArray::GivValString() +CBotString CBotVarArray::GetValString() { if ( m_pInstance == NULL ) return ( CBotString( "Null pointer" ) ) ; - return m_pInstance->GivValString(); + return m_pInstance->GetValString(); } bool CBotVarArray::Save1State(FILE* pf) @@ -1896,7 +1896,7 @@ CBotVarPointer::CBotVarPointer(const CBotToken* name, CBotTypResult& type ) m_pClass = NULL; m_pVarClass = NULL; // will be defined by a SetPointer() - SetClass(type.GivClass() ); + SetClass(type.GetClass() ); } CBotVarPointer::~CBotVarPointer() @@ -1913,33 +1913,33 @@ void CBotVarPointer::Maj(void* pUser, bool bContinu) if ( m_pVarClass != NULL) m_pVarClass->Maj(pUser, false); } -CBotVar* CBotVarPointer::GivItem(const char* name) +CBotVar* CBotVarPointer::GetItem(const char* name) { if ( m_pVarClass == NULL) // no existing instance? - return m_pClass->GivItem(name); // makes the pointer in the class itself + return m_pClass->GetItem(name); // makes the pointer in the class itself - return m_pVarClass->GivItem(name); + return m_pVarClass->GetItem(name); } -CBotVar* CBotVarPointer::GivItemRef(int nIdent) +CBotVar* CBotVarPointer::GetItemRef(int nIdent) { if ( m_pVarClass == NULL) // no existing instance? - return m_pClass->GivItemRef(nIdent);// makes the pointer to the class itself + return m_pClass->GetItemRef(nIdent);// makes the pointer to the class itself - return m_pVarClass->GivItemRef(nIdent); + return m_pVarClass->GetItemRef(nIdent); } -CBotVar* CBotVarPointer::GivItemList() +CBotVar* CBotVarPointer::GetItemList() { if ( m_pVarClass == NULL) return NULL; - return m_pVarClass->GivItemList(); + return m_pVarClass->GetItemList(); } -CBotString CBotVarPointer::GivValString() +CBotString CBotVarPointer::GetValString() { CBotString s = "Pointer to "; if ( m_pVarClass == NULL ) s = "Null pointer" ; - else s += m_pVarClass->GivValString(); + else s += m_pVarClass->GetValString(); return s; } @@ -1960,28 +1960,28 @@ void CBotVarPointer::SetPointer(CBotVar* pVarClass) if ( pVarClass != NULL ) { - if ( pVarClass->GivType() == CBotTypPointer ) - pVarClass = pVarClass->GivPointer(); // the real pointer to the object + if ( pVarClass->GetType() == CBotTypPointer ) + pVarClass = pVarClass->GetPointer(); // the real pointer to the object -// if ( pVarClass->GivType() != CBotTypClass ) +// if ( pVarClass->GetType() != CBotTypClass ) if ( !pVarClass->m_type.Eq(CBotTypClass) ) ASM_TRAP(); - ((CBotVarClass*)pVarClass)->IncrementUse(); // increment the reference - m_pClass = ((CBotVarClass*)pVarClass)->m_pClass; + (static_cast<CBotVarClass*>(pVarClass))->IncrementUse(); // increment the reference + m_pClass = (static_cast<CBotVarClass*>(pVarClass))->m_pClass; m_pUserPtr = pVarClass->m_pUserPtr; // not really necessary m_type = CBotTypResult(CBotTypPointer, m_pClass); // what kind of a pointer } if ( m_pVarClass != NULL ) m_pVarClass->DecrementUse(); - m_pVarClass = (CBotVarClass*)pVarClass; + m_pVarClass = static_cast<CBotVarClass*>(pVarClass); } -CBotVarClass* CBotVarPointer::GivPointer() +CBotVarClass* CBotVarPointer::GetPointer() { if ( m_pVarClass == NULL ) return NULL; - return m_pVarClass->GivPointer(); + return m_pVarClass->GetPointer(); } void CBotVarPointer::SetIdent(long n) @@ -1990,7 +1990,7 @@ void CBotVarPointer::SetIdent(long n) m_pVarClass->SetIdent( n ); } -long CBotVarPointer::GivIdent() +long CBotVarPointer::GetIdent() { if ( m_pVarClass == NULL ) return 0; return m_pVarClass->m_ItemIdent; @@ -2004,9 +2004,9 @@ void CBotVarPointer::SetClass(CBotClass* pClass) if ( m_pVarClass != NULL ) m_pVarClass->SetClass(pClass); //, nIdent); } -CBotClass* CBotVarPointer::GivClass() +CBotClass* CBotVarPointer::GetClass() { - if ( m_pVarClass != NULL ) return m_pVarClass->GivClass(); + if ( m_pVarClass != NULL ) return m_pVarClass->GetClass(); return m_pClass; } @@ -2016,32 +2016,32 @@ bool CBotVarPointer::Save1State(FILE* pf) { if ( m_pClass ) { - if (!WriteString(pf, m_pClass->GivName())) return false; // name of the class + if (!WriteString(pf, m_pClass->GetName())) return false; // name of the class } else { if (!WriteString(pf, "")) return false; } - if (!WriteLong(pf, GivIdent())) return false; // the unique reference + if (!WriteLong(pf, GetIdent())) return false; // the unique reference // also saves the proceedings copies - return SaveVar(pf, GivPointer()); + return SaveVar(pf, GetPointer()); } // copy a variable into another void CBotVarPointer::Copy(CBotVar* pSrc, bool bName) { - if ( pSrc->GivType() != CBotTypPointer && - pSrc->GivType() != CBotTypNullPointer) + if ( pSrc->GetType() != CBotTypPointer && + pSrc->GetType() != CBotTypNullPointer) ASM_TRAP(); - CBotVarPointer* p = (CBotVarPointer*)pSrc; + CBotVarPointer* p = static_cast<CBotVarPointer*>(pSrc); if ( bName) *m_token = *p->m_token; m_type = p->m_type; // m_pVarClass = p->m_pVarClass; - m_pVarClass = p->GivPointer(); + m_pVarClass = p->GetPointer(); if ( m_pVarClass != NULL ) m_pVarClass->IncrementUse(); // incerement the reference @@ -2059,23 +2059,23 @@ void CBotVarPointer::Copy(CBotVar* pSrc, bool bName) bool CBotVarPointer::Eq(CBotVar* left, CBotVar* right) { - CBotVarClass* l = left->GivPointer(); - CBotVarClass* r = right->GivPointer(); + CBotVarClass* l = left->GetPointer(); + CBotVarClass* r = right->GetPointer(); if ( l == r ) return true; - if ( l == NULL && r->GivUserPtr() == OBJECTDELETED ) return true; - if ( r == NULL && l->GivUserPtr() == OBJECTDELETED ) return true; + if ( l == NULL && r->GetUserPtr() == OBJECTDELETED ) return true; + if ( r == NULL && l->GetUserPtr() == OBJECTDELETED ) return true; return false; } bool CBotVarPointer::Ne(CBotVar* left, CBotVar* right) { - CBotVarClass* l = left->GivPointer(); - CBotVarClass* r = right->GivPointer(); + CBotVarClass* l = left->GetPointer(); + CBotVarClass* r = right->GetPointer(); if ( l == r ) return false; - if ( l == NULL && r->GivUserPtr() == OBJECTDELETED ) return false; - if ( r == NULL && l->GivUserPtr() == OBJECTDELETED ) return false; + if ( l == NULL && r->GetUserPtr() == OBJECTDELETED ) return false; + if ( r == NULL && l->GetUserPtr() == OBJECTDELETED ) return false; return true; } @@ -2155,7 +2155,7 @@ CBotTypResult::~CBotTypResult() delete m_pNext; } -int CBotTypResult::GivType(int mode) const +int CBotTypResult::GetType(int mode) const { #ifdef _DEBUG if ( m_type == CBotTypPointer || @@ -2177,17 +2177,17 @@ void CBotTypResult::SetType(int n) m_type = n; } -CBotClass* CBotTypResult::GivClass() const +CBotClass* CBotTypResult::GetClass() const { return m_pClass; } -CBotTypResult& CBotTypResult::GivTypElem() const +CBotTypResult& CBotTypResult::GetTypElem() const { return *m_pNext; } -int CBotTypResult::GivLimite() const +int CBotTypResult::GetLimite() const { return m_limite; } diff --git a/src/CBot/CBotWhile.cpp b/src/CBot/CBotWhile.cpp index 51310a9..dfd69bf 100644 --- a/src/CBot/CBotWhile.cpp +++ b/src/CBot/CBotWhile.cpp @@ -55,7 +55,7 @@ CBotInstr* CBotWhile::Compile(CBotToken* &p, CBotCStack* pStack) if ( IsOfType( p, TokenTypVar ) && IsOfType( p, ID_DOTS ) ) { - inst->m_label = pp->GivString(); // records the name of the label + inst->m_label = pp->GetString(); // records the name of the label } inst->SetToken(p); @@ -95,7 +95,7 @@ bool CBotWhile :: Execute(CBotStack* &pj) if ( pile->IfStep() ) return false; - while( true ) switch( pile->GivState() ) // executes the loop + while( true ) switch( pile->GetState() ) // executes the loop { // there are two possible states (depending on recovery) case 0: // evaluates the condition @@ -104,7 +104,7 @@ bool CBotWhile :: Execute(CBotStack* &pj) // the result of the condition is on the stack // terminates if an error or if the condition is false - if ( !pile->IsOk() || pile->GivVal() != true ) + if ( !pile->IsOk() || pile->GetVal() != true ) { return pj->Return(pile); // sends the results and releases the stack } @@ -140,7 +140,7 @@ void CBotWhile :: RestoreState(CBotStack* &pj, bool bMain) CBotStack* pile = pj->RestoreStack(this); // adds an item to the stack if ( pile == NULL ) return; - switch( pile->GivState() ) + switch( pile->GetState() ) { // there are two possible states (depending on recovery) case 0: // evaluates the condition @@ -181,7 +181,7 @@ CBotInstr* CBotRepeat::Compile(CBotToken* &p, CBotCStack* pStack) if ( IsOfType( p, TokenTypVar ) && IsOfType( p, ID_DOTS ) ) { - inst->m_label = pp->GivString(); // register the name of label + inst->m_label = pp->GetString(); // register the name of label } inst->SetToken(p); @@ -194,7 +194,7 @@ CBotInstr* CBotRepeat::Compile(CBotToken* &p, CBotCStack* pStack) CBotToken* ppp = p; // preserves the ^ token (starting position) if ( NULL != (inst->m_NbIter = CBotExpression::Compile( p, pStk )) ) { - if ( pStk->GivType() < CBotTypLong ) + if ( pStk->GetType() < CBotTypLong ) { if ( IsOfType(p, ID_CLOSEPAR ) ) { @@ -210,14 +210,14 @@ CBotInstr* CBotRepeat::Compile(CBotToken* &p, CBotCStack* pStack) return pStack->Return(inst, pStk); // return an object to the application } } - pStack->SetError(TX_CLOSEPAR, p->GivStart()); + pStack->SetError(TX_CLOSEPAR, p->GetStart()); } - pStk->SetStartError(ppp->GivStart()); - pStk->SetError( TX_BADTYPE, p->GivStart() ); + pStk->SetStartError(ppp->GetStart()); + pStk->SetError( TX_BADTYPE, p->GetStart() ); } pStack->SetError(TX_ENDOF, p); } - pStack->SetError(TX_OPENPAR, p->GivStart()); // missing parenthesis + pStack->SetError(TX_OPENPAR, p->GetStart()); // missing parenthesis delete inst; // error, frees up return pStack->Return(NULL, pStk); // no object, the error is on the stack @@ -233,7 +233,7 @@ bool CBotRepeat :: Execute(CBotStack* &pj) if ( pile->IfStep() ) return false; - while( true ) switch( pile->GivState() ) // executes the loop + while( true ) switch( pile->GetState() ) // executes the loop { // there are two possible states (depending on recovery) case 0: // evaluates the number of iterations @@ -243,7 +243,7 @@ bool CBotRepeat :: Execute(CBotStack* &pj) // terminates if an error or if the condition is false int n; - if ( !pile->IsOk() || ( n = pile->GivVal() ) < 1 ) + if ( !pile->IsOk() || ( n = pile->GetVal() ) < 1 ) { return pj->Return(pile); // sends the results and releases the stack } @@ -262,7 +262,7 @@ bool CBotRepeat :: Execute(CBotStack* &pj) if ( m_Block != NULL && !m_Block->Execute(pile) ) { - if (pile->IfContinue(pile->GivState()-1, m_label)) continue; // if continued, will return to test + if (pile->IfContinue(pile->GetState()-1, m_label)) continue; // if continued, will return to test return pj->BreakReturn(pile, m_label); // sends the results and releases the stack } @@ -273,7 +273,7 @@ bool CBotRepeat :: Execute(CBotStack* &pj) } // returns to the test again - if (!pile->SetState(pile->GivState()-1, 0)) return false; + if (!pile->SetState(pile->GetState()-1, 0)) return false; continue; } } @@ -284,7 +284,7 @@ void CBotRepeat :: RestoreState(CBotStack* &pj, bool bMain) CBotStack* pile = pj->RestoreStack(this); // adds an item to the stack if ( pile == NULL ) return; - switch( pile->GivState() ) + switch( pile->GetState() ) { // there are two possible states (depending on recovery) case 0: // evaluates the condition @@ -325,7 +325,7 @@ CBotInstr* CBotDo::Compile(CBotToken* &p, CBotCStack* pStack) if ( IsOfType( p, TokenTypVar ) && IsOfType( p, ID_DOTS ) ) { - inst->m_label = pp->GivString(); // register the name of label + inst->m_label = pp->GetString(); // register the name of label } inst->SetToken(p); @@ -350,10 +350,10 @@ CBotInstr* CBotDo::Compile(CBotToken* &p, CBotCStack* pStack) { return pStack->Return(inst, pStk); // return an object to the application } - pStk->SetError(TX_ENDOF, p->GivStart()); + pStk->SetError(TX_ENDOF, p->GetStart()); } } - pStk->SetError(TX_WHILE, p->GivStart()); + pStk->SetError(TX_WHILE, p->GetStart()); } delete inst; // error, frees up @@ -370,7 +370,7 @@ bool CBotDo :: Execute(CBotStack* &pj) if ( pile->IfStep() ) return false; - while( true ) switch( pile->GivState() ) // executes the loop + while( true ) switch( pile->GetState() ) // executes the loop { // there are two possible states (depending on recovery) case 0: // evaluates the associated statement block @@ -396,7 +396,7 @@ bool CBotDo :: Execute(CBotStack* &pj) // the result of the condition is on the stack // terminates if an error or if the condition is false - if ( !pile->IsOk() || pile->GivVal() != true ) + if ( !pile->IsOk() || pile->GetVal() != true ) { return pj->Return(pile); // sends the results and releases the stack } @@ -414,7 +414,7 @@ void CBotDo :: RestoreState(CBotStack* &pj, bool bMain) CBotStack* pile = pj->RestoreStack(this); // adds an item to the stack if ( pile == NULL ) return; - switch( pile->GivState() ) + switch( pile->GetState() ) { // there are two possible states (depending on recovery) case 0: // restores the assosiated statement's block @@ -459,7 +459,7 @@ CBotInstr* CBotFor::Compile(CBotToken* &p, CBotCStack* pStack) if ( IsOfType( p, TokenTypVar ) && IsOfType( p, ID_DOTS ) ) { - inst->m_label = pp->GivString(); // register the name of label + inst->m_label = pp->GetString(); // register the name of label } inst->SetToken(p); @@ -467,7 +467,7 @@ CBotInstr* CBotFor::Compile(CBotToken* &p, CBotCStack* pStack) if ( !IsOfType(p, ID_OPENPAR)) // missing parenthesis ? { - pStack->SetError(TX_OPENPAR, p->GivStart()); + pStack->SetError(TX_OPENPAR, p->GetStart()); return NULL; } @@ -479,7 +479,7 @@ CBotInstr* CBotFor::Compile(CBotToken* &p, CBotCStack* pStack) { if ( !IsOfType(p, ID_SEP)) // lack the semicolon? { - pStack->SetError(TX_OPENPAR, p->GivStart()); + pStack->SetError(TX_OPENPAR, p->GetStart()); delete inst; return pStack->Return(NULL, pStk); // no object, the error is on the stack } @@ -488,7 +488,7 @@ CBotInstr* CBotFor::Compile(CBotToken* &p, CBotCStack* pStack) { if ( !IsOfType(p, ID_SEP)) // lack the semicolon? { - pStack->SetError(TX_OPENPAR, p->GivStart()); + pStack->SetError(TX_OPENPAR, p->GetStart()); delete inst; return pStack->Return(NULL, pStk); // no object, the error is on the stack } @@ -503,7 +503,7 @@ CBotInstr* CBotFor::Compile(CBotToken* &p, CBotCStack* pStack) if ( pStk->IsOk() ) return pStack->Return(inst, pStk);; } - pStack->SetError(TX_CLOSEPAR, p->GivStart()); + pStack->SetError(TX_CLOSEPAR, p->GetStart()); } } } @@ -522,7 +522,7 @@ bool CBotFor :: Execute(CBotStack* &pj) if ( pile->IfStep() ) return false; - while( true ) switch( pile->GivState() ) // executes the loop + while( true ) switch( pile->GetState() ) // executes the loop { // there are four possible states (depending on recovery) case 0: // initialize @@ -539,7 +539,7 @@ bool CBotFor :: Execute(CBotStack* &pj) // the result of the condition is on the stack // terminates if an error or if the condition is false - if ( !pile->IsOk() || pile->GivVal() != true ) + if ( !pile->IsOk() || pile->GetVal() != true ) { return pj->Return(pile); // sends the results and releases the stack } @@ -583,7 +583,7 @@ void CBotFor :: RestoreState(CBotStack* &pj, bool bMain) CBotStack* pile = pj->RestoreStack(this); // adds an item to the stack (variables locales) if ( pile == NULL ) return; - switch( pile->GivState() ) + switch( pile->GetState() ) { // there are four possible states (depending on recovery) case 0: // initialize @@ -669,13 +669,13 @@ bool CBotListExpression::Execute(CBotStack* &pj) CBotStack* pile = pj->AddStack(); // essential CBotInstr* p = m_Expr; // the first expression - int state = pile->GivState(); - while (state-->0) p = p->GivNext(); // returns to the interrupted operation + int state = pile->GetState(); + while (state-->0) p = p->GetNext(); // returns to the interrupted operation if ( p != NULL ) while (true) { if ( !p->Execute(pile) ) return false; - p = p->GivNext(); + p = p->GetNext(); if ( p == NULL ) break; if (!pile->IncState()) return false; // ready for next } @@ -691,7 +691,7 @@ void CBotListExpression::RestoreState(CBotStack* &pj, bool bMain) { pile = pj->RestoreStack(); if ( pile == NULL ) return; - state = pile->GivState(); + state = pile->GetState(); } CBotInstr* p = m_Expr; // the first expression @@ -699,7 +699,7 @@ void CBotListExpression::RestoreState(CBotStack* &pj, bool bMain) while (p != NULL && state-->0) { p->RestoreState(pile, false); - p = p->GivNext(); // returns to the interrupted operation + p = p->GetNext(); // returns to the interrupted operation } if ( p != NULL ) @@ -741,7 +741,7 @@ CBotInstr* CBotSwitch::Compile(CBotToken* &p, CBotCStack* pStack) { if ( NULL != (inst->m_Value = CBotExpression::Compile( p, pStk )) ) { - if ( pStk->GivType() < CBotTypLong ) + if ( pStk->GetType() < CBotTypLong ) { if ( IsOfType(p, ID_CLOSEPAR ) ) { @@ -751,7 +751,7 @@ CBotInstr* CBotSwitch::Compile(CBotToken* &p, CBotCStack* pStack) while( !IsOfType( p, ID_CLBLK ) ) { - if ( p->GivType() == ID_CASE || p->GivType() == ID_DEFAULT) + if ( p->GetType() == ID_CASE || p->GetType() == ID_DEFAULT) { CBotCStack* pStk2 = pStk->TokenStack(p); // un petit bout de pile svp @@ -769,7 +769,7 @@ CBotInstr* CBotSwitch::Compile(CBotToken* &p, CBotCStack* pStack) if ( inst->m_Block == NULL ) { - pStk->SetError(TX_NOCASE, p->GivStart()); + pStk->SetError(TX_NOCASE, p->GetStart()); delete inst; return pStack->Return(NULL, pStk); } @@ -793,21 +793,21 @@ CBotInstr* CBotSwitch::Compile(CBotToken* &p, CBotCStack* pStack) if ( inst->m_Block == NULL ) { - pStk->SetError(TX_NOCASE, p->GivStart()); + pStk->SetError(TX_NOCASE, p->GetStart()); delete inst; return pStack->Return(NULL, pStk); } // the statement block is ok return pStack->Return(inst, pStk); // return an object to the application } - pStk->SetError( TX_OPENBLK, p->GivStart() ); + pStk->SetError( TX_OPENBLK, p->GetStart() ); } - pStk->SetError( TX_CLOSEPAR, p->GivStart() ); + pStk->SetError( TX_CLOSEPAR, p->GetStart() ); } - pStk->SetError( TX_BADTYPE, p->GivStart() ); + pStk->SetError( TX_BADTYPE, p->GetStart() ); } } - pStk->SetError( TX_OPENPAR, p->GivStart()); + pStk->SetError( TX_OPENPAR, p->GetStart()); delete inst; // error, frees up return pStack->Return(NULL, pStk); // no object, the error is on the stack @@ -822,7 +822,7 @@ bool CBotSwitch :: Execute(CBotStack* &pj) CBotInstr* p = m_Block; // first expression - int state = pile1->GivState(); + int state = pile1->GetState(); if (state == 0) { if ( !m_Value->Execute(pile1) ) return false; @@ -834,14 +834,14 @@ bool CBotSwitch :: Execute(CBotStack* &pj) if ( state == -1 ) { state = 0; - int val = pile1->GivVal(); // result of the value + int val = pile1->GetVal(); // result of the value CBotStack* pile2 = pile1->AddStack(); while ( p != NULL ) // search for the corresponding case in a list { state++; if ( p->CompCase( pile2, val ) ) break; // found the case - p = p->GivNext(); + p = p->GetNext(); } pile2->Delete(); @@ -851,13 +851,13 @@ bool CBotSwitch :: Execute(CBotStack* &pj) } p = m_Block; // returns to the beginning - while (state-->0) p = p->GivNext(); // advance in the list + while (state-->0) p = p->GetNext(); // advance in the list while( p != NULL ) { if ( !p->Execute(pile1) ) return pj->BreakReturn(pile1); if ( !pile1->IncState() ) return false; - p = p->GivNext(); + p = p->GetNext(); } return pj->Return(pile1); } @@ -871,7 +871,7 @@ void CBotSwitch :: RestoreState(CBotStack* &pj, bool bMain) CBotInstr* p = m_Block; // first expression - int state = pile1->GivState(); + int state = pile1->GetState(); if (state == 0) { m_Value->RestoreState(pile1, bMain); @@ -887,7 +887,7 @@ void CBotSwitch :: RestoreState(CBotStack* &pj, bool bMain) while ( p != NULL && state-- > 0 ) { p->RestoreState(pile1, false); - p = p->GivNext(); // advance in the list + p = p->GetNext(); // advance in the list } if( p != NULL ) @@ -923,7 +923,7 @@ CBotInstr* CBotCase::Compile(CBotToken* &p, CBotCStack* pStack) inst->SetToken(p); if (!IsOfType(p, ID_CASE, ID_DEFAULT)) return NULL; // should never happen - if ( pp->GivType() == ID_CASE ) + if ( pp->GetType() == ID_CASE ) { pp = p; inst->m_Value = CBotExprNum::Compile(p, pStack); @@ -936,7 +936,7 @@ CBotInstr* CBotCase::Compile(CBotToken* &p, CBotCStack* pStack) } if ( !IsOfType( p, ID_DOTS )) { - pStack->SetError( TX_MISDOTS, p->GivStart() ); + pStack->SetError( TX_MISDOTS, p->GetStart() ); delete inst; return NULL; } @@ -963,7 +963,7 @@ bool CBotCase::CompCase(CBotStack* &pile, int val) if ( m_Value == NULL ) return true; // "default" case while (!m_Value->Execute(pile)); // puts the value on the correspondent stack (without interruption) - return (pile->GivVal() == val); // compared with the given value + return (pile->GetVal() == val); // compared with the given value } /////////////////////////////////////////////////////////////////////////// @@ -983,7 +983,7 @@ CBotBreak::~CBotBreak() CBotInstr* CBotBreak::Compile(CBotToken* &p, CBotCStack* pStack) { CBotToken* pp = p; // preserves at the ^ token (starting position) - int type = p->GivType(); + int type = p->GetType(); if (!IsOfType(p, ID_BREAK, ID_CONTINUE)) return NULL; // should never happen @@ -999,7 +999,7 @@ CBotInstr* CBotBreak::Compile(CBotToken* &p, CBotCStack* pStack) pp = p; if ( IsOfType( p, TokenTypVar ) ) { - inst->m_label = pp->GivString(); // register the name of label + inst->m_label = pp->GetString(); // register the name of label if ( !ChkLvl(inst->m_label, type ) ) { delete inst; @@ -1014,7 +1014,7 @@ CBotInstr* CBotBreak::Compile(CBotToken* &p, CBotCStack* pStack) } delete inst; - pStack->SetError(TX_ENDOF, p->GivStart()); + pStack->SetError(TX_ENDOF, p->GetStart()); return NULL; // no object, the error is on the stack } @@ -1027,7 +1027,7 @@ bool CBotBreak :: Execute(CBotStack* &pj) if ( pile->IfStep() ) return false; - pile->SetBreak(m_token.GivType()==ID_BREAK ? 1 : 2, m_label); + pile->SetBreak(m_token.GetType()==ID_BREAK ? 1 : 2, m_label); return pj->Return(pile); } @@ -1070,7 +1070,7 @@ CBotInstr* CBotTry::Compile(CBotToken* &p, CBotCStack* pStack) inst->m_Block = CBotBlock::CompileBlkOrInst( p, pStk ); CBotCatch** pn = &inst->m_ListCatch; - while (pStk->IsOk() && p->GivType() == ID_CATCH) + while (pStk->IsOk() && p->GetType() == ID_CATCH) { CBotCatch* i = CBotCatch::Compile(p, pStk); *pn = i; @@ -1108,7 +1108,7 @@ bool CBotTry :: Execute(CBotStack* &pj) CBotStack* pile0 = pj->AddStack2(); // adds an element to the secondary stack CBotStack* pile2 = pile0->AddStack(); - if ( pile1->GivState() == 0 ) + if ( pile1->GetState() == 0 ) { if ( m_Block->Execute(pile1) ) { @@ -1116,7 +1116,7 @@ bool CBotTry :: Execute(CBotStack* &pj) pile1->SetState(-2); // passes final } - val = pile1->GivError(); + val = pile1->GetError(); if ( val == 0 && CBotStack::m_initimer == 0 ) // mode step? return false; // does not make the catch @@ -1132,8 +1132,8 @@ bool CBotTry :: Execute(CBotStack* &pj) // see what it returns CBotCatch* pc = m_ListCatch; - int state = (short)pile1->GivState(); // where were we? - val = pile2->GivState(); // what error? + int state = static_cast<short>(pile1->GetState()); // where were we? + val = pile2->GetState(); // what error? pile0->SetState(1); // marking the GetRunPos if ( val >= 0 && state > 0 ) while ( pc != NULL ) @@ -1147,7 +1147,7 @@ bool CBotTry :: Execute(CBotStack* &pj) } if ( --state <= 0 ) { - if ( pile2->GivVal() == true ) + if ( pile2->GetVal() == true ) { // pile0->SetState(1); @@ -1163,15 +1163,15 @@ bool CBotTry :: Execute(CBotStack* &pj) pc = pc->m_next; } if ( m_FinalInst != NULL && - pile1->GivState() > 0 && val != 0 ) pile1->SetState(-1);// if stop then made the final + pile1->GetState() > 0 && val != 0 ) pile1->SetState(-1);// if stop then made the final - if (pile1->GivState() <= -1) + if (pile1->GetState() <= -1) { // pile0->SetState(1); if (!m_FinalInst->Execute(pile2) && pile2->IsOk()) return false; if (!pile2->IsOk()) return pj->Return(pile2); // keep this exception - pile2->SetError(pile1->GivState()==-1 ? val : 0); // gives the initial error + pile2->SetError(pile1->GetState()==-1 ? val : 0); // gives the initial error return pj->Return(pile2); } @@ -1200,7 +1200,7 @@ void CBotTry :: RestoreState(CBotStack* &pj, bool bMain) if ( pile2 == NULL ) return; m_Block->RestoreState(pile1, bMain); - if ( pile0->GivState() == 0 ) + if ( pile0->GetState() == 0 ) { return; } @@ -1209,8 +1209,8 @@ void CBotTry :: RestoreState(CBotStack* &pj, bool bMain) // see what it returns CBotCatch* pc = m_ListCatch; - int state = pile1->GivState(); // where were we ? - val = pile2->GivState(); // what error ? + int state = pile1->GetState(); // where were we ? + val = pile2->GetState(); // what error ? if ( val >= 0 && state > 0 ) while ( pc != NULL ) { @@ -1223,7 +1223,7 @@ void CBotTry :: RestoreState(CBotStack* &pj, bool bMain) } if ( --state <= 0 ) { - if ( pile2->GivVal() == true ) + if ( pile2->GetVal() == true ) { pc->RestoreState(pile2, bMain); // execute the operation return; @@ -1232,7 +1232,7 @@ void CBotTry :: RestoreState(CBotStack* &pj, bool bMain) pc = pc->m_next; } - if (pile1->GivState() <= -1) + if (pile1->GetState() <= -1) { m_FinalInst->RestoreState(pile2, bMain); return; @@ -1263,7 +1263,7 @@ CBotCatch::~CBotCatch() CBotCatch* CBotCatch::Compile(CBotToken* &p, CBotCStack* pStack) { CBotCatch* inst = new CBotCatch(); // creates the object - pStack->SetStartError(p->GivStart()); + pStack->SetStartError(p->GetStart()); inst->SetToken(p); if (!IsOfType(p, ID_CATCH)) return NULL; // should never happen @@ -1271,8 +1271,8 @@ CBotCatch* CBotCatch::Compile(CBotToken* &p, CBotCStack* pStack) if (IsOfType(p, ID_OPENPAR)) { inst->m_Cond = CBotExpression::Compile(p, pStack); - if (( pStack->GivType() < CBotTypLong || - pStack->GivTypResult().Eq(CBotTypBoolean) )&& pStack->IsOk() ) + if (( pStack->GetType() < CBotTypLong || + pStack->GetTypResult().Eq(CBotTypBoolean) )&& pStack->IsOk() ) { if (IsOfType(p, ID_CLOSEPAR)) { @@ -1280,11 +1280,11 @@ CBotCatch* CBotCatch::Compile(CBotToken* &p, CBotCStack* pStack) if ( pStack->IsOk() ) return inst; // return an object to the application } - pStack->SetError(TX_CLOSEPAR, p->GivStart()); + pStack->SetError(TX_CLOSEPAR, p->GetStart()); } - pStack->SetError(TX_BADTYPE, p->GivStart()); + pStack->SetError(TX_BADTYPE, p->GetStart()); } - pStack->SetError(TX_OPENPAR, p->GivStart()); + pStack->SetError(TX_OPENPAR, p->GetStart()); delete inst; // error, frees up return NULL; // no object, the error is on the stack } @@ -1313,10 +1313,10 @@ bool CBotCatch :: TestCatch(CBotStack* &pile, int val) { if ( !m_Cond->Execute(pile) ) return false; - if ( val > 0 || pile->GivType() != CBotTypBoolean ) + if ( val > 0 || pile->GetType() != CBotTypBoolean ) { - CBotVar* var = CBotVar::Create((CBotToken*)NULL, CBotTypBoolean); - var->SetValInt( pile->GivVal() == val ); + CBotVar* var = CBotVar::Create(static_cast<CBotToken*>(NULL), CBotTypBoolean); + var->SetValInt( pile->GetVal() == val ); pile->SetVar(var); // calls on the stack } @@ -1342,7 +1342,7 @@ CBotThrow::~CBotThrow() CBotInstr* CBotThrow::Compile(CBotToken* &p, CBotCStack* pStack) { - pStack->SetStartError(p->GivStart()); + pStack->SetStartError(p->GetStart()); CBotThrow* inst = new CBotThrow(); // creates the object inst->SetToken(p); @@ -1353,7 +1353,7 @@ CBotInstr* CBotThrow::Compile(CBotToken* &p, CBotCStack* pStack) inst->m_Value = CBotExpression::Compile( p, pStack ); - if (pStack->GivType() < CBotTypLong && pStack->IsOk()) + if (pStack->GetType() < CBotTypLong && pStack->IsOk()) { return inst; // return an object to the application } @@ -1370,7 +1370,7 @@ bool CBotThrow :: Execute(CBotStack* &pj) CBotStack* pile = pj->AddStack(this); // if ( pile == EOX ) return true; - if ( pile->GivState() == 0 ) + if ( pile->GetState() == 0 ) { if ( !m_Value->Execute(pile) ) return false; pile->IncState(); @@ -1378,7 +1378,7 @@ bool CBotThrow :: Execute(CBotStack* &pj) if ( pile->IfStep() ) return false; - int val = pile->GivVal(); + int val = pile->GetVal(); if ( val < 0 ) val = TX_BADTHROW; pile->SetError( val, &m_token ); return pj->Return( pile ); @@ -1391,7 +1391,7 @@ void CBotThrow :: RestoreState(CBotStack* &pj, bool bMain) CBotStack* pile = pj->RestoreStack(this); if ( pile == NULL ) return; - if ( pile->GivState() == 0 ) + if ( pile->GetState() == 0 ) { m_Value->RestoreState(pile, bMain); return; @@ -1425,7 +1425,7 @@ CBotInstr* CBotStartDebugDD::Compile(CBotToken* &p, CBotCStack* pStack) bool CBotStartDebugDD :: Execute(CBotStack* &pj) { - CBotProgram* p = pj->GivBotCall(); + CBotProgram* p = pj->GetBotCall(); p->m_bDebugDD = true; return true; diff --git a/src/CBot/ClassFILE.cpp b/src/CBot/ClassFILE.cpp index f73a1ac..e5bc260 100644 --- a/src/CBot/ClassFILE.cpp +++ b/src/CBot/ClassFILE.cpp @@ -68,25 +68,25 @@ bool rfconstruct (CBotVar* pThis, CBotVar* pVar, CBotVar* pResult, int& Exceptio if ( pVar == NULL ) return true; // must be a string - if ( pVar->GivType() != CBotTypString ) { Exception = CBotErrBadString; return false; } + if ( pVar->GetType() != CBotTypString ) { Exception = CBotErrBadString; return false; } - CBotString filename = pVar->GivValString(); + CBotString filename = pVar->GetValString(); PrepareFilename(filename); //DR // there may be a second parameter - pVar = pVar->GivNext(); + pVar = pVar->GetNext(); if ( pVar != NULL ) { // recovers the mode - mode = pVar->GivValString(); + mode = pVar->GetValString(); if ( mode != "r" && mode != "w" ) { Exception = CBotErrBadParam; return false; } // no third parameter, only two or one possible - if ( pVar->GivNext() != NULL ) { Exception = CBotErrOverParam; return false; } + if ( pVar->GetNext() != NULL ) { Exception = CBotErrOverParam; return false; } } // save the file name - pVar = pThis->GivItem("filename"); + pVar = pThis->GetItem("filename"); pVar->SetValString(filename); if ( ! mode.IsEmpty() ) @@ -98,7 +98,7 @@ bool rfconstruct (CBotVar* pThis, CBotVar* pVar, CBotVar* pResult, int& Exceptio m_CompteurFileOpen ++; // save the handle of file - pVar = pThis->GivItem("handle"); + pVar = pThis->GetItem("handle"); pVar->SetValInt((long)pFile); } @@ -112,18 +112,18 @@ CBotTypResult cfconstruct (CBotVar* pThis, CBotVar* &pVar) if ( pVar == NULL ) return CBotTypResult( 0 ); // must be a string - if ( pVar->GivType() != CBotTypString ) + if ( pVar->GetType() != CBotTypString ) return CBotTypResult( CBotErrBadString ); // there may be a second parameter - pVar = pVar->GivNext(); + pVar = pVar->GetNext(); if ( pVar != NULL ) { // must be a string - if ( pVar->GivType() != CBotTypString ) + if ( pVar->GetType() != CBotTypString ) return CBotTypResult( CBotErrBadString ); // no third parameter - if ( pVar->GivNext() != NULL ) return CBotTypResult( CBotErrOverParam ); + if ( pVar->GetNext() != NULL ) return CBotTypResult( CBotErrOverParam ); } // le r�sultat est de type void (constructeur) @@ -137,12 +137,12 @@ CBotTypResult cfconstruct (CBotVar* pThis, CBotVar* &pVar) bool rfdestruct (CBotVar* pThis, CBotVar* pVar, CBotVar* pResult, int& Exception) { // retrieves the element "handle" - pVar = pThis->GivItem("handle"); + pVar = pThis->GetItem("handle"); // not open? no problem - if ( pVar->GivInit() != IS_DEF) return true; + if ( pVar->GetInit() != IS_DEF) return true; - FILE* pFile= (FILE*)pVar->GivValInt(); + FILE* pFile= (FILE*)pVar->GetValInt(); fclose(pFile); m_CompteurFileOpen --; @@ -162,38 +162,38 @@ bool rfopen (CBotVar* pThis, CBotVar* pVar, CBotVar* pResult, int& Exception) if ( pVar == NULL ) { Exception = CBotErrLowParam; return false; } // must be a string - if ( pVar->GivType() != CBotTypString ) { Exception = CBotErrBadString; return false; } + if ( pVar->GetType() != CBotTypString ) { Exception = CBotErrBadString; return false; } // there may be a second parameter - if ( pVar->GivNext() != NULL ) + if ( pVar->GetNext() != NULL ) { // in this case the first parameter is the file name - CBotString filename = pVar->GivValString(); + CBotString filename = pVar->GetValString(); PrepareFilename(filename); //DR // saves the file name - CBotVar* pVar2 = pThis->GivItem("filename"); + CBotVar* pVar2 = pThis->GetItem("filename"); pVar2->SetValString(filename); // next parameter is the mode - pVar = pVar -> GivNext(); + pVar = pVar -> GetNext(); } - CBotString mode = pVar->GivValString(); + CBotString mode = pVar->GetValString(); if ( mode != "r" && mode != "w" ) { Exception = CBotErrBadParam; return false; } // No third parameter - if ( pVar->GivNext() != NULL ) { Exception = CBotErrOverParam; return false; } + if ( pVar->GetNext() != NULL ) { Exception = CBotErrOverParam; return false; } // retrieves the element "handle" - pVar = pThis->GivItem("handle"); + pVar = pThis->GetItem("handle"); // which must not be initialized - if ( pVar->GivInit() == IS_DEF) { Exception = CBotErrFileOpen; return false; } + if ( pVar->GetInit() == IS_DEF) { Exception = CBotErrFileOpen; return false; } // contains filename - pVar = pThis->GivItem("filename"); - CBotString filename = pVar->GivValString(); + pVar = pThis->GetItem("filename"); + CBotString filename = pVar->GetValString(); PrepareFilename(filename); //DD! (if the name was assigned by h.filename = "..."; @@ -208,7 +208,7 @@ bool rfopen (CBotVar* pThis, CBotVar* pVar, CBotVar* pResult, int& Exception) m_CompteurFileOpen ++; // saves the handle of file - pVar = pThis->GivItem("handle"); + pVar = pThis->GetItem("handle"); pVar->SetValInt((long)pFile); pResult->SetValInt(true); //DR @@ -222,19 +222,19 @@ CBotTypResult cfopen (CBotVar* pThis, CBotVar* &pVar) if ( pVar == NULL ) return CBotTypResult( CBotErrLowParam ); // must be a string - if ( pVar->GivType() != CBotTypString ) + if ( pVar->GetType() != CBotTypString ) return CBotTypResult( CBotErrBadString ); // there may be a second parameter - pVar = pVar->GivNext(); + pVar = pVar->GetNext(); if ( pVar != NULL ) { // must be a string - if ( pVar->GivType() != CBotTypString ) + if ( pVar->GetType() != CBotTypString ) return CBotTypResult( CBotErrBadString ); // no third parameter - if ( pVar->GivNext() != NULL ) return CBotTypResult( CBotErrOverParam ); + if ( pVar->GetNext() != NULL ) return CBotTypResult( CBotErrOverParam ); } // the result is of type bool @@ -251,11 +251,11 @@ bool rfclose (CBotVar* pThis, CBotVar* pVar, CBotVar* pResult, int& Exception) if ( pVar != NULL ) return CBotErrOverParam; // retrieves the element "handle" - pVar = pThis->GivItem("handle"); + pVar = pThis->GetItem("handle"); - if ( pVar->GivInit() != IS_DEF) { Exception = CBotErrNotOpen; return false; } + if ( pVar->GetInit() != IS_DEF) { Exception = CBotErrNotOpen; return false; } - FILE* pFile= (FILE*)pVar->GivValInt(); + FILE* pFile= (FILE*)pVar->GetValInt(); fclose(pFile); m_CompteurFileOpen --; @@ -283,16 +283,16 @@ bool rfwrite (CBotVar* pThis, CBotVar* pVar, CBotVar* pResult, int& Exception) if ( pVar == NULL ) { Exception = CBotErrLowParam; return false; } // must be a string - if ( pVar->GivType() != CBotTypString ) { Exception = CBotErrBadString; return false; } + if ( pVar->GetType() != CBotTypString ) { Exception = CBotErrBadString; return false; } - CBotString param = pVar->GivValString(); + CBotString param = pVar->GetValString(); //retrieves the element "handle" - pVar = pThis->GivItem("handle"); + pVar = pThis->GetItem("handle"); - if ( pVar->GivInit() != IS_DEF) { Exception = CBotErrNotOpen; return false; } + if ( pVar->GetInit() != IS_DEF) { Exception = CBotErrNotOpen; return false; } - FILE* pFile= (FILE*)pVar->GivValInt(); + FILE* pFile= (FILE*)pVar->GetValInt(); int res = fputs(param+CBotString("\n"), pFile); @@ -309,10 +309,10 @@ CBotTypResult cfwrite (CBotVar* pThis, CBotVar* &pVar) if ( pVar == NULL ) return CBotTypResult( CBotErrLowParam ); // must be a string - if ( pVar->GivType() != CBotTypString ) return CBotTypResult( CBotErrBadString ); + if ( pVar->GetType() != CBotTypString ) return CBotTypResult( CBotErrBadString ); // no other parameter - if ( pVar->GivNext() != NULL ) return CBotTypResult( CBotErrOverParam ); + if ( pVar->GetNext() != NULL ) return CBotTypResult( CBotErrOverParam ); // function returns "void" result return CBotTypResult( 0 ); @@ -327,11 +327,11 @@ bool rfread (CBotVar* pThis, CBotVar* pVar, CBotVar* pResult, int& Exception) if ( pVar != NULL ) { Exception = CBotErrOverParam; return false; } //retrieves the element "handle" - pVar = pThis->GivItem("handle"); + pVar = pThis->GetItem("handle"); - if ( pVar->GivInit() != IS_DEF) { Exception = CBotErrNotOpen; return false; } + if ( pVar->GetInit() != IS_DEF) { Exception = CBotErrNotOpen; return false; } - FILE* pFile= (FILE*)pVar->GivValInt(); + FILE* pFile= (FILE*)pVar->GetValInt(); char chaine[2000]; int i; @@ -368,11 +368,11 @@ bool rfeof (CBotVar* pThis, CBotVar* pVar, CBotVar* pResult, int& Exception) if ( pVar != NULL ) { Exception = CBotErrOverParam; return false; } // retrieves the element "handle" - pVar = pThis->GivItem("handle"); + pVar = pThis->GetItem("handle"); - if ( pVar->GivInit() != IS_DEF) { Exception = CBotErrNotOpen; return false; } + if ( pVar->GetInit() != IS_DEF) { Exception = CBotErrNotOpen; return false; } - FILE* pFile= (FILE*)pVar->GivValInt(); + FILE* pFile= (FILE*)pVar->GetValInt(); pResult->SetValInt( feof( pFile ) ); diff --git a/src/CBot/StringFunctions.cpp b/src/CBot/StringFunctions.cpp index 39bafca..d24c942 100644 --- a/src/CBot/StringFunctions.cpp +++ b/src/CBot/StringFunctions.cpp @@ -26,16 +26,16 @@ bool rStrLen( CBotVar* pVar, CBotVar* pResult, int& ex, void* pUser ) if ( pVar == NULL ) { ex = TX_LOWPARAM ; return true; } // to be a string - if ( pVar->GivType() != CBotTypString ) { ex = TX_BADSTRING ; return true; } + if ( pVar->GetType() != CBotTypString ) { ex = TX_BADSTRING ; return true; } // no second parameter - if ( pVar->GivNext() != NULL ) { ex = TX_OVERPARAM ; return true; } + if ( pVar->GetNext() != NULL ) { ex = TX_OVERPARAM ; return true; } // get the contents of the string - CBotString s = pVar->GivValString(); + CBotString s = pVar->GetValString(); // puts the length of the stack - pResult->SetValInt( s.GivLength() ); + pResult->SetValInt( s.GetLength() ); return true; } @@ -48,11 +48,11 @@ CBotTypResult cIntStr( CBotVar* &pVar, void* pUser ) if ( pVar == NULL ) return CBotTypResult( TX_LOWPARAM ); // to be a string - if ( pVar->GivType() != CBotTypString ) + if ( pVar->GetType() != CBotTypString ) return CBotTypResult( TX_BADPARAM ); // no second parameter - if ( pVar->GivNext() != NULL ) return CBotTypResult( TX_OVERPARAM ); + if ( pVar->GetNext() != NULL ) return CBotTypResult( TX_OVERPARAM ); // the end result is an integer return CBotTypResult( CBotTypInt ); @@ -68,23 +68,23 @@ bool rStrLeft( CBotVar* pVar, CBotVar* pResult, int& ex, void* pUser ) if ( pVar == NULL ) { ex = TX_LOWPARAM ; return true; } // to be a string - if ( pVar->GivType() != CBotTypString ) { ex = TX_BADSTRING ; return true; } + if ( pVar->GetType() != CBotTypString ) { ex = TX_BADSTRING ; return true; } // get the contents of the string - CBotString s = pVar->GivValString(); + CBotString s = pVar->GetValString(); // it takes a second parameter - pVar = pVar->GivNext(); + pVar = pVar->GetNext(); if ( pVar == NULL ) { ex = TX_LOWPARAM ; return true; } // which must be a number - if ( pVar->GivType() > CBotTypDouble ) { ex = TX_BADNUM ; return true; } + if ( pVar->GetType() > CBotTypDouble ) { ex = TX_BADNUM ; return true; } // retrieves this number - int n = pVar->GivValInt(); + int n = pVar->GetValInt(); // no third parameter - if ( pVar->GivNext() != NULL ) { ex = TX_OVERPARAM ; return true; } + if ( pVar->GetNext() != NULL ) { ex = TX_OVERPARAM ; return true; } // takes the interesting part s = s.Left( n ); @@ -103,19 +103,19 @@ CBotTypResult cStrStrInt( CBotVar* &pVar, void* pUser ) if ( pVar == NULL ) return CBotTypResult( TX_LOWPARAM ); // to be a string - if ( pVar->GivType() != CBotTypString ) + if ( pVar->GetType() != CBotTypString ) return CBotTypResult( TX_BADSTRING ); // it takes a second parameter - pVar = pVar->GivNext(); + pVar = pVar->GetNext(); if ( pVar == NULL ) return CBotTypResult( TX_LOWPARAM ); // which must be a number - if ( pVar->GivType() > CBotTypDouble ) + if ( pVar->GetType() > CBotTypDouble ) return CBotTypResult( TX_BADNUM ); // no third parameter - if ( pVar->GivNext() != NULL ) return CBotTypResult( TX_OVERPARAM ); + if ( pVar->GetNext() != NULL ) return CBotTypResult( TX_OVERPARAM ); // the end result is a string return CBotTypResult( CBotTypString ); @@ -130,23 +130,23 @@ bool rStrRight( CBotVar* pVar, CBotVar* pResult, int& ex, void* pUser ) if ( pVar == NULL ) { ex = TX_LOWPARAM ; return true; } // to be a string - if ( pVar->GivType() != CBotTypString ) { ex = TX_BADSTRING ; return true; } + if ( pVar->GetType() != CBotTypString ) { ex = TX_BADSTRING ; return true; } // get the contents of the string - CBotString s = pVar->GivValString(); + CBotString s = pVar->GetValString(); // it takes a second parameter - pVar = pVar->GivNext(); + pVar = pVar->GetNext(); if ( pVar == NULL ) { ex = TX_LOWPARAM ; return true; } // which must be a number - if ( pVar->GivType() > CBotTypDouble ) { ex = TX_BADNUM ; return true; } + if ( pVar->GetType() > CBotTypDouble ) { ex = TX_BADNUM ; return true; } // retrieves this number - int n = pVar->GivValInt(); + int n = pVar->GetValInt(); // no third parameter - if ( pVar->GivNext() != NULL ) { ex = TX_OVERPARAM ; return true; } + if ( pVar->GetNext() != NULL ) { ex = TX_OVERPARAM ; return true; } // takes the interesting part s = s.Right( n ); @@ -165,34 +165,34 @@ bool rStrMid( CBotVar* pVar, CBotVar* pResult, int& ex, void* pUser ) if ( pVar == NULL ) { ex = TX_LOWPARAM ; return true; } // to be a string - if ( pVar->GivType() != CBotTypString ) { ex = TX_BADSTRING ; return true; } + if ( pVar->GetType() != CBotTypString ) { ex = TX_BADSTRING ; return true; } // get the contents of the string - CBotString s = pVar->GivValString(); + CBotString s = pVar->GetValString(); // it takes a second parameter - pVar = pVar->GivNext(); + pVar = pVar->GetNext(); if ( pVar == NULL ) { ex = TX_LOWPARAM ; return true; } // which must be a number - if ( pVar->GivType() > CBotTypDouble ) { ex = TX_BADNUM ; return true; } + if ( pVar->GetType() > CBotTypDouble ) { ex = TX_BADNUM ; return true; } // retrieves this number - int n = pVar->GivValInt(); + int n = pVar->GetValInt(); // third parameter optional - if ( pVar->GivNext() != NULL ) + if ( pVar->GetNext() != NULL ) { - pVar = pVar->GivNext(); + pVar = pVar->GetNext(); // which must be a number - if ( pVar->GivType() > CBotTypDouble ) { ex = TX_BADNUM ; return true; } + if ( pVar->GetType() > CBotTypDouble ) { ex = TX_BADNUM ; return true; } // retrieves this number - int l = pVar->GivValInt(); + int l = pVar->GetValInt(); // but no fourth parameter - if ( pVar->GivNext() != NULL ){ ex = TX_OVERPARAM ; return true; } + if ( pVar->GetNext() != NULL ){ ex = TX_OVERPARAM ; return true; } // takes the interesting part s = s.Mid( n, l ); @@ -217,28 +217,28 @@ CBotTypResult cStrStrIntInt( CBotVar* &pVar, void* pUser ) if ( pVar == NULL ) return CBotTypResult( TX_LOWPARAM ); // to be a string - if ( pVar->GivType() != CBotTypString ) + if ( pVar->GetType() != CBotTypString ) return CBotTypResult( TX_BADSTRING ); // it takes a second parameter - pVar = pVar->GivNext(); + pVar = pVar->GetNext(); if ( pVar == NULL ) return CBotTypResult( TX_LOWPARAM ); // which must be a number - if ( pVar->GivType() > CBotTypDouble ) + if ( pVar->GetType() > CBotTypDouble ) return CBotTypResult( TX_BADNUM ); // third parameter optional - if ( pVar->GivNext() != NULL ) + if ( pVar->GetNext() != NULL ) { - pVar = pVar->GivNext(); + pVar = pVar->GetNext(); // which must be a number - if ( pVar->GivType() > CBotTypDouble ) + if ( pVar->GetType() > CBotTypDouble ) return CBotTypResult( TX_BADNUM ); // no fourth parameter - if ( pVar->GivNext() != NULL ) return CBotTypResult( TX_OVERPARAM ); + if ( pVar->GetNext() != NULL ) return CBotTypResult( TX_OVERPARAM ); } // the end result is a string @@ -255,15 +255,15 @@ bool rStrVal( CBotVar* pVar, CBotVar* pResult, int& ex, void* pUser ) if ( pVar == NULL ) { ex = TX_LOWPARAM ; return true; } // to be a string - if ( pVar->GivType() != CBotTypString ) { ex = TX_BADSTRING ; return true; } + if ( pVar->GetType() != CBotTypString ) { ex = TX_BADSTRING ; return true; } // get the contents of the string - CBotString s = pVar->GivValString(); + CBotString s = pVar->GetValString(); // but no second parameter - if ( pVar->GivNext() != NULL ){ ex = TX_OVERPARAM ; return true; } + if ( pVar->GetNext() != NULL ){ ex = TX_OVERPARAM ; return true; } - float val = GivNumFloat(s); + float val = GetNumFloat(s); // puts the value on the stack pResult->SetValFloat( val ); @@ -279,11 +279,11 @@ CBotTypResult cFloatStr( CBotVar* &pVar, void* pUser ) if ( pVar == NULL ) return CBotTypResult( TX_LOWPARAM ); // to be a string - if ( pVar->GivType() != CBotTypString ) + if ( pVar->GetType() != CBotTypString ) return CBotTypResult( TX_BADSTRING ); // no second parameter - if ( pVar->GivNext() != NULL ) return CBotTypResult( TX_OVERPARAM ); + if ( pVar->GetNext() != NULL ) return CBotTypResult( TX_OVERPARAM ); // the end result is a number return CBotTypResult( CBotTypFloat ); @@ -299,23 +299,23 @@ bool rStrFind( CBotVar* pVar, CBotVar* pResult, int& ex, void* pUser ) if ( pVar == NULL ) { ex = TX_LOWPARAM ; return true; } // to be a string - if ( pVar->GivType() != CBotTypString ) { ex = TX_BADSTRING ; return true; } + if ( pVar->GetType() != CBotTypString ) { ex = TX_BADSTRING ; return true; } // get the contents of the string - CBotString s = pVar->GivValString(); + CBotString s = pVar->GetValString(); // it takes a second parameter - pVar = pVar->GivNext(); + pVar = pVar->GetNext(); if ( pVar == NULL ) { ex = TX_LOWPARAM ; return true; } // to be a string - if ( pVar->GivType() != CBotTypString ) { ex = TX_BADSTRING ; return true; } + if ( pVar->GetType() != CBotTypString ) { ex = TX_BADSTRING ; return true; } // retrieves this number - CBotString s2 = pVar->GivValString(); + CBotString s2 = pVar->GetValString(); // no third parameter - if ( pVar->GivNext() != NULL ) { ex = TX_OVERPARAM ; return true; } + if ( pVar->GetNext() != NULL ) { ex = TX_OVERPARAM ; return true; } // puts the result on the stack int res = s.Find(s2); @@ -333,19 +333,19 @@ CBotTypResult cIntStrStr( CBotVar* &pVar, void* pUser ) if ( pVar == NULL ) return CBotTypResult( TX_LOWPARAM ); // to be a string - if ( pVar->GivType() != CBotTypString ) + if ( pVar->GetType() != CBotTypString ) return CBotTypResult( TX_BADSTRING ); // it takes a second parameter - pVar = pVar->GivNext(); + pVar = pVar->GetNext(); if ( pVar == NULL ) return CBotTypResult( TX_LOWPARAM ); // to be a string - if ( pVar->GivType() != CBotTypString ) + if ( pVar->GetType() != CBotTypString ) return CBotTypResult( TX_BADSTRING ); // no third parameter - if ( pVar->GivNext() != NULL ) return CBotTypResult( TX_OVERPARAM ); + if ( pVar->GetNext() != NULL ) return CBotTypResult( TX_OVERPARAM ); // the end result is a number return CBotTypResult( CBotTypInt ); @@ -360,13 +360,13 @@ bool rStrUpper( CBotVar* pVar, CBotVar* pResult, int& ex, void* pUser ) if ( pVar == NULL ) { ex = TX_LOWPARAM ; return true; } // to be a string - if ( pVar->GivType() != CBotTypString ) { ex = TX_BADSTRING ; return true; } + if ( pVar->GetType() != CBotTypString ) { ex = TX_BADSTRING ; return true; } // get the contents of the string - CBotString s = pVar->GivValString(); + CBotString s = pVar->GetValString(); // but no second parameter - if ( pVar->GivNext() != NULL ){ ex = TX_OVERPARAM ; return true; } + if ( pVar->GetNext() != NULL ){ ex = TX_OVERPARAM ; return true; } s.MakeUpper(); @@ -385,13 +385,13 @@ bool rStrLower( CBotVar* pVar, CBotVar* pResult, int& ex, void* pUser ) if ( pVar == NULL ) { ex = TX_LOWPARAM ; return true; } // to be a string - if ( pVar->GivType() != CBotTypString ) { ex = TX_BADSTRING ; return true; } + if ( pVar->GetType() != CBotTypString ) { ex = TX_BADSTRING ; return true; } // get the contents of the string - CBotString s = pVar->GivValString(); + CBotString s = pVar->GetValString(); // but no second parameter - if ( pVar->GivNext() != NULL ){ ex = TX_OVERPARAM ; return true; } + if ( pVar->GetNext() != NULL ){ ex = TX_OVERPARAM ; return true; } s.MakeLower(); @@ -410,11 +410,11 @@ CBotTypResult cStrStr( CBotVar* &pVar, void* pUser ) if ( pVar == NULL ) return CBotTypResult( TX_LOWPARAM ); // to be a string - if ( pVar->GivType() != CBotTypString ) + if ( pVar->GetType() != CBotTypString ) return CBotTypResult( TX_BADSTRING ); // no second parameter - if ( pVar->GivNext() != NULL ) return CBotTypResult( TX_OVERPARAM ); + if ( pVar->GetNext() != NULL ) return CBotTypResult( TX_OVERPARAM ); // the end result is a string return CBotTypResult( CBotTypString ); diff --git a/src/CBot/tests/CBot_console/CMakeLists.txt b/src/CBot/tests/CBot_console/CMakeLists.txt new file mode 100644 index 0000000..7d9f034 --- /dev/null +++ b/src/CBot/tests/CBot_console/CMakeLists.txt @@ -0,0 +1,15 @@ +cmake_minimum_required(VERSION 2.8) + +project(CBot_console C CXX) + +# Build with debugging symbols +set(CMAKE_BUILD_TYPE debug) + +# Global compile flags +set(CMAKE_CXX_FLAGS_RELEASE "-O2 -Wall -Wold-style-cast -std=gnu++0x") +set(CMAKE_CXX_FLAGS_DEBUG "-g -O0 -Wall -Wold-style-cast -std=gnu++0x") + +# Include cmake directory +SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${colobot_SOURCE_DIR}/cmake") + +add_subdirectory(src bin) diff --git a/src/CBot/tests/CBot_console/src/CBot b/src/CBot/tests/CBot_console/src/CBot new file mode 120000 index 0000000..2c91115 --- /dev/null +++ b/src/CBot/tests/CBot_console/src/CBot @@ -0,0 +1 @@ +../../../../CBot/
\ No newline at end of file diff --git a/src/CBot/tests/CBot_console/src/CMakeLists.txt b/src/CBot/tests/CBot_console/src/CMakeLists.txt new file mode 100644 index 0000000..3dbf711 --- /dev/null +++ b/src/CBot/tests/CBot_console/src/CMakeLists.txt @@ -0,0 +1,32 @@ +# CBot shared library is built separately +add_subdirectory(CBot) + + +# Configure options +option(DEBUG "Enable debug output" ON) + +set(PLATFORM_LIBS "") + +# Source files +# Commented out files are still dependent on DirectX or WinAPI + +set(SOURCES +app/CClass.cpp +app/main.cpp +#app/routines.cpp +app/CBotDoc.cpp +app/CBotConsole.cpp +) + +set(LIBS +CBot +) + +include_directories(. ${CMAKE_CURRENT_BINARY_DIR} +) + +link_directories(${CMAKE_CURRENT_SOURCE_DIR}/CBot) + +add_executable(CBot_console ${SOURCES}) + +target_link_libraries(CBot_console ${LIBS}) diff --git a/src/CBot/tests/CBot_console/src/app/CBotConsole.cpp b/src/CBot/tests/CBot_console/src/app/CBotConsole.cpp new file mode 100644 index 0000000..e9209d3 --- /dev/null +++ b/src/CBot/tests/CBot_console/src/app/CBotConsole.cpp @@ -0,0 +1,175 @@ +/* + * CBotConsole.cpp + * + * Created on: 08-08-2012 + * Author: michal + */ + +#include "CBotConsole.h" +#include "CClass.h" +#include <ctime> +#include <iostream> + +CBotConsole::CBotConsole() { + // TODO Auto-generated constructor stub + m_pProg = NULL; + m_threadinfo.m_bRun = false; + m_code = 0; + +} + +CBotConsole::~CBotConsole() { + // TODO Auto-generated destructor stub +} + +uint ThreadProc(ThreadInfo *info) +{ + time_t t0,t1; + time(&t0); + + int Cpt = 0; + + info->m_pProg->Start("LaCommande"); + while ( !info->m_bStop && !info->m_pProg->Run() ) + { +#if 0 + const char* FunctionName; + const char* FN; + int start, end; + + info->m_pProg->GetRunPos(FunctionName, start, end); + + if ( FunctionName != NULL ) + { + info->m_pEditx->SetSel(start, end); + + char buffer[200]; + sprintf( buffer, "step %s, %d, %d",FunctionName, start, end); + AfxMessageBox( buffer ); + + int level = 0; + do + { + CBotVar* t = info->m_pProg->GetStackVars(FN, level--); + if ( FN != FunctionName ) break; + if ( t != NULL ) + { + CString s ; + while ( t != NULL ) + { + if (s.IsEmpty()) s+= "Stack -> "; + else s+= " , "; + s += t->GetValString(); + t = t->GetNext(); + } + AfxMessageBox(s); + } + } while (TRUE); + } +#endif + Cpt++; + if ( Cpt%50 == 0 ) std::cout << "."; + } + + if ( info->m_bStop ) + { + std::cout << "\nInterrupt\n"; + } + else if (info->m_pProg->GetError() == 0) + { + time(&t1); + double prog_time = difftime(t0,t1); + + char buffer[200]; + sprintf( buffer, "\nExecution terminated in %f seconds.\nInterrupted %d time(s).\n", + prog_time, Cpt); + + std::cout << buffer; + } + +// info->m_pWndMessage->SendMessage(WM_ENDPROG, 0, 0) ; + return 0 ; +} + +long CBotConsole::EndProg() +{ + m_threadinfo.m_bRun = false; + + if (m_pProg->GetError(m_code, m_start, m_end)) + { + CBotString TextError; + TextError = CBotProgram::GetErrorText(m_code); + std::cout << TextError; + return 1; + } + delete m_pProg; + m_pProg = NULL; + + return 0 ; +} + + +void CBotConsole::OnOK() +{ + m_code = 0; + + std::string Commande; + std::cin >> Commande; + + std::string s = "void LaCommande() { " + Commande + " ;}"; + m_pProg = new CBotProgram(); + CBotStringArray liste; + m_pProg->Compile(s.c_str(), liste); + + int err, start, end; + if ( m_pProg->GetError(err, start, end) ) + { + CBotString TextError; + TextError = CBotProgram::GetErrorText(err); + std::cout << TextError; + return; + } + + std::cout << "\n" + Commande + " ->\n"; + +// m_Edit2.SetWindowText(""); +// m_Edit1.SetFocus(); +// m_Edit2.EnableWindow(FALSE); +// m_cOK.EnableWindow(FALSE); + + // lance un processus paralèle pour l'exécution +// m_threadinfo.m_pWndMessage = this ; + +// m_threadinfo.m_pEdit1 = &m_Edit1; +// m_threadinfo.m_pEditx = m_pEditx; + m_threadinfo.m_pProg = m_pProg; + m_threadinfo.m_bStop = false; + m_threadinfo.m_bRun = true; + + ThreadProc(&m_threadinfo); + +// here program starts +// AfxBeginThread((AFX_THREADPROC)ThreadProc, &m_threadinfo) ; +} + +void CBotConsole::OnCancel() +{ + m_threadinfo.m_bStop = true ; +} + +bool CBotConsole::OnInitDialog() +{ +// CDialog::OnInitDialog(); + + std::cout << "Following functions are availible:\n"; + for ( int i = 0; i < m_pListe->GetSize(); i++ ) + { + CBotString x = (*m_pListe)[i] + CBotString("\n"); + std::cout << x; + } + std::cout << "Enter a command:\n"; + + + return true; // return TRUE unless you set the focus to a control + // EXCEPTION: OCX Property Pages should return FALSE +} diff --git a/src/CBot/tests/CBot_console/src/app/CBotConsole.h b/src/CBot/tests/CBot_console/src/app/CBotConsole.h new file mode 100644 index 0000000..a155399 --- /dev/null +++ b/src/CBot/tests/CBot_console/src/app/CBotConsole.h @@ -0,0 +1,44 @@ +/* + * CBotConsole.h + * + * Created on: 08-08-2012 + * Author: michal + */ + +#ifndef CBOTCONSOLE_H_ +#define CBOTCONSOLE_H_ +#include "CClass.h" + +struct ThreadInfo +{ +// CEdit* m_pEdit1 ; +// CEdit* m_pEditx ; + CBotProgram* m_pProg; +// CWnd* m_pWndMessage; + bool m_bStop; + bool m_bRun; +}; + +class CBotConsole { + +public: + CBotConsole(); + virtual ~CBotConsole(); + +// CEdit m_Edit1; + + CBotProgram* m_pProg; + ThreadInfo m_threadinfo; + + CBotStringArray* m_pListe; + int m_code, m_start, m_end; +// CEdit* m_pEditx; + + // Implementation + void OnOK(); + void OnCancel(); + bool OnInitDialog(); + long EndProg() ; +}; + +#endif /* CBOTCONSOLE_H_ */ diff --git a/src/CBot/tests/CBot_console/src/app/CBotDoc.cpp b/src/CBot/tests/CBot_console/src/app/CBotDoc.cpp new file mode 100644 index 0000000..1c694c9 --- /dev/null +++ b/src/CBot/tests/CBot_console/src/app/CBotDoc.cpp @@ -0,0 +1,122 @@ +/* + * CBotDoc.cpp + * + * Created on: 08-08-2012 + * Author: michal + */ +#include "CBotDoc.h" +#include "CBotConsole.h" +#include <iostream> + +CBotDoc::CBotDoc(std::string s) { + // TODO Auto-generated constructor stub + // TODO set m_DocText +// m_pEdit = NULL; + m_pProg = NULL; +// m_bModified = FALSE; + m_DocText = s; + std::cout << s << std::endl; +// std::cout << "Enter to continue..." << std::endl; +// getchar(); +} + +CBotDoc::~CBotDoc() { + +// delete m_pEdit; + delete m_pProg; +} + + +//static bool test = false; + +void CBotDoc::OnRun() +{ + +// m_pEdit->GetWindowText(m_DocText); + CBotString s; + + std::string TextError; + int code, start, end; + + if ( m_pProg == NULL ) m_pProg = new CBotProgram(); + + if (!m_pProg->Compile(m_DocText.c_str(), m_Liste, NULL)) + { + m_pProg->GetError(code, start, end); + delete m_pProg; + m_pProg = NULL; + + TextError = CBotProgram::GetErrorText( code ); + std::cout << TextError << std::endl; + return; + } + + if( m_Liste.GetSize() == 0 ) + { + std::cout << "No function marked \"extern\" !\n"; + return; + } + + for ( int i = 0; i < m_Liste.GetSize(); i++ ) + { + int start, stop; + m_pProg->GetPosition(m_Liste[i], start, stop, GetPosNom, GetPosParam); + CBotString s(m_DocText.substr( start, stop-start ).c_str()); + m_Liste[i] = s; + } +// TODO + CBotConsole dlg; + dlg.m_pListe = &m_Liste; +// dlg.m_pEditx = m_pEdit; + + dlg.OnInitDialog(); + dlg.OnOK(); + dlg.EndProg(); +// if ( dlg.m_code>0 ) +// { +// std::string TextError; +// +// TextError = m_pProg->GetErrorText( dlg.m_code ); +// +// std::cout <<TextError; +// } + + return; +} + +bool CBotDoc::Compile() +{ +// m_pEdit->GetWindowText(m_DocText); + + std::string TextError; + int code, start, end; + + if ( m_pProg == NULL ) m_pProg = new CBotProgram(); + + char buffer[100]; + strcpy(buffer, "a pointer move to see"); + + if (!m_pProg->Compile(m_DocText.c_str(), m_Liste, static_cast<void*>(buffer))) + { + m_pProg->GetError(code, start, end); + delete m_pProg; + m_pProg = NULL; + +// m_pEdit->SetSel( start, end ); +// m_pEdit->SetFocus(); // higlights part of problem + + TextError = CBotProgram::GetErrorText( code ); + std::cout << TextError ; + + return false; + } + +// if ( m_pProg->GetPosition( "TheTest", start, end) ) +// { +// m_pEdit->SetSel( start, end ); +// m_pEdit->SetFocus(); // higlights part of problem +// } + +// m_bModified = FALSE; + return true; +} diff --git a/src/CBot/tests/CBot_console/src/app/CBotDoc.h b/src/CBot/tests/CBot_console/src/app/CBotDoc.h new file mode 100644 index 0000000..c0a3e1d --- /dev/null +++ b/src/CBot/tests/CBot_console/src/app/CBotDoc.h @@ -0,0 +1,39 @@ +/* + * CBotDoc.h + * + * Created on: 08-08-2012 + * Author: michal + */ + +#pragma once +#ifndef CBOTDOC_H_ +#define CBOTDOC_H_ + +#include "CClass.h" +#include <string> + +class CBotDoc { + +public: + CBotDoc(std::string); + virtual ~CBotDoc(); + +// CEdit* m_pEdit; // to memorize the text, and display + CBotProgram* m_pProg; // the compiled program + std::string m_DocText; + CBotStringArray m_Liste; + +// Operations + + bool Compile(); + +// virtual bool OnNewDocument(); + + void OnRun(); + void OnChangeEdit1(); + void OnTest(); + +}; + + +#endif /* CBOTDOC_H_ */ diff --git a/src/CBot/tests/CBot_console/src/app/CClass.cpp b/src/CBot/tests/CBot_console/src/app/CClass.cpp new file mode 100644 index 0000000..9b7c842 --- /dev/null +++ b/src/CBot/tests/CBot_console/src/app/CClass.cpp @@ -0,0 +1,97 @@ +#include "CClass.h" + +#include "routines.cpp" + +void rMajObject( CBotVar* pThis, void* pUser ) +{ + if (!pThis->IsElemOfClass("object")) + return ; + CBotVar* pPos = pThis->GetItem("position"); + CBotVar* pX = pPos->GetItem("x"); + CBotVar* pY = pPos->GetItem("y"); + CBotVar* pZ = pPos->GetItem("z"); +// CBotVar* pPt = pThis->GetItem("transport"); + + CBotString p = pX->GetValString(); + +// pX->SetValFloat( pUser == (void*)1 ? (float)12.5 : (float)44.4 ); + pZ->SetValFloat( (float)0 ); + pY->SetValFloat( (float)-3.33 ); + pX->SetValFloat( pX->GetValFloat() + 10 ) ; + +// pX = pThis->GetItem( "xx" ); +// pX->SetValFloat( (float)22 ); + + // crée une instance sur une classe object +// CBotVar* pAutre = CBotVar::Create("autre", CBotTypClass, "object"); +// pAutre->SetUserPtr( (void*)3 ); +// pPt->SetPointer( pAutre ); +// pPt->SetPointer( NULL ); +// delete pAutre; +}; + +CClass::CClass() +{ + m_pClassPoint= NULL; +} + +bool CClass::InitInstance() +{ +////////////////////////////////////////////// +// défini les mots clefs supplémentaires +// ------------------------------------------- + + CBotProgram::Init(); + +////////////////////////////////////////////// +// défini les fonctions "show()" et "print()" +// ------------------------------------------- + + //CBotProgram::AddFunction("show", rShow, cShow); + CBotProgram::AddFunction("print", rPrint, cPrint); + CBotProgram::AddFunction("println", rPrintLn, cPrint); + + +/////////////////////////////////// +// définie la classe globale CPoint +// -------------------------------- + + m_pClassPoint = new CBotClass("CPoint", NULL); + // ajoute le composant ".x" + m_pClassPoint->AddItem("x", CBotTypFloat); + // ajoute le composant ".y" + m_pClassPoint->AddItem("y", CBotTypFloat); + + // ajoute le constructeur pour cette classe + m_pClassPoint->AddFunction("CPoint", rCPoint, cCPoint); + + m_pClassPointIntr = new CBotClass("point", NULL, true); + // ajoute le composant ".x" + m_pClassPointIntr->AddItem("x", CBotTypFloat); + // ajoute le composant ".y" + m_pClassPointIntr->AddItem("y", CBotTypFloat); + // ajoute le composant ".z" + m_pClassPointIntr->AddItem("z", CBotTypFloat); + + // ajoute le constructeur pour cette classe + m_pClassPointIntr->AddFunction("point", rCPoint, cCPoint); + + // défini la classe "object" + CBotClass* pClassObject = new CBotClass( "object", NULL ) ; + pClassObject->AddItem( "xx", CBotTypFloat ); + pClassObject->AddItem( "position", CBotTypResult( CBotTypIntrinsic, "point" ) ); + pClassObject->AddItem( "transport", CBotTypResult( CBotTypPointer, "object" ) ); + pClassObject->AddUpdateFunc( rMajObject ); + + InitClassFILE(); + + return true; +} + +void CClass::ExitInstance() +{ + delete m_pFuncFile; + + CBotProgram::Free(); + +} diff --git a/src/CBot/tests/CBot_console/src/app/CClass.h b/src/CBot/tests/CBot_console/src/app/CClass.h new file mode 100644 index 0000000..da2c46c --- /dev/null +++ b/src/CBot/tests/CBot_console/src/app/CClass.h @@ -0,0 +1,18 @@ +#pragma once + +#include <CBot/CBot.h> +#include <string> + +extern std::string s; + +class CClass +{ +public: + CClass(); + + CBotClass* m_pClassPoint; + CBotClass* m_pClassPointIntr; + + bool InitInstance(); + void ExitInstance(); +}; diff --git a/src/CBot/tests/CBot_console/src/app/main.cpp b/src/CBot/tests/CBot_console/src/app/main.cpp new file mode 100644 index 0000000..a2d3668 --- /dev/null +++ b/src/CBot/tests/CBot_console/src/app/main.cpp @@ -0,0 +1,45 @@ +#include "CClass.h" +#include "CBotDoc.h" +#include <iostream> + + +#include <fstream> + +std::string str; + +// routine to update the instance of the class Bot common + +int main(int argc, char* argv[]) +{ + CClass newclass; + CBotDoc *botdoc; + if (argc != 2) + { + std::cout << "Usage: "<<argv[0] << " <filename>" << std::endl; + return 0; + } + + std::ifstream in(argv[1]); + std::cout << argv[1] << std::endl; + if (!in.good()) + { + std::cout << "Oh no, error!" << std::endl; + return 1; + } + + std::string contents((std::istreambuf_iterator<char>(in)), + std::istreambuf_iterator<char>()); + str = contents; + + if(!newclass.InitInstance()) + { + std::cerr << "Initialization not complete!" << std::endl; + return 1; + } + + botdoc = new CBotDoc(str); +// std::cout << "Hello CBot!" << std::endl << s; + botdoc->OnRun(); + delete botdoc; + newclass.ExitInstance(); +} diff --git a/src/CBot/tests/CBot_console/src/app/routines.cpp b/src/CBot/tests/CBot_console/src/app/routines.cpp new file mode 100644 index 0000000..8b8a1d4 --- /dev/null +++ b/src/CBot/tests/CBot_console/src/app/routines.cpp @@ -0,0 +1,141 @@ +// * This file is part of the COLOBOT source code +// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch +// * +// * 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://www.gnu.org/licenses/. + +//////////////////////////////////////////////////////////////////// +// routine show() +// utilisable depuis le programme écrit en CBot + + +#include <iostream> +#include <string> +#include "CBot/ClassFILE.cpp" +//std::string s; +/* +// execution +bool rShow( CBotVar* pVar, CBotVar* pResult, int& Exception, void* pUser ) +{ + string::string s; + + while ( pVar != NULL ) + { + string::string ss; + + ss.LoadString( TX_TYPENAMES + pVar->GetType() ); + s += ss + " "; + + ss = pVar->GetName(); + if (ss.IsEmpty()) ss = "<sans nom>"; + s += ss + " = "; + + s += pVar->GetValString(); + s += "\n"; + pVar = pVar->GetNext(); + } + + AfxMessageBox(s, MB_OK|MB_ICONINFORMATION); + + return TRUE; // pas d'interruption +} + +CBotTypResult cShow( CBotVar* &pVar, void* pUser) +{ + if ( pVar == NULL ) return CBotTypResult(5028); + return CBotTypResult(0); // tous paramètres acceptés, void en retour +} + +*/ + +//////////////////////////////////////////////////////////////////// +// routine print() +// utilisable depuis le programme écrit en CBot + +// exécution + +bool rPrintLn( CBotVar* pVar, CBotVar* pResult, int& Exception, void* pUser ) +{ + std::string s; + while ( pVar != NULL ) + { + if ( !s.empty() ) s += " "; + s += pVar->GetValString(); + pVar = pVar->GetNext(); + } + s += "\n"; + + std::cout << s; + return true; // pas d'interruption +} + +bool rPrint( CBotVar* pVar, CBotVar* pResult, int& Exception, void* pUser ) +{ + std::string s; + while ( pVar != NULL ) + { + if ( !s.empty() ) s += " "; + s += pVar->GetValString(); + pVar = pVar->GetNext(); + } + s += " "; + std::cout << s; + return true; // pas d'interruption +} + +CBotTypResult cPrint( CBotVar* &pVar, void* pUser) +{ + return CBotTypResult(0); // tous paramètres acceptés, un entier en retour +} + + +////////////////////////////////////////////////////////////////// +// class CPoint pour essayer + +// exécution +bool rCPoint( CBotVar* pThis, CBotVar* pVar, CBotVar* pResult, int& Exception ) +{ + if ( pVar == NULL )return true; // constructor with no parameters is ok + + CBotVar* pX = pThis->GetItem("x"); + pX->SetValFloat( pVar->GetValFloat() ); + pVar = pVar->GetNext(); + + CBotVar* pY = pThis->GetItem("y"); + pY->SetValFloat( pVar->GetValFloat() ); + pVar = pVar->GetNext(); + + return true; // pas d'interruption +} + +CBotTypResult cCPoint( CBotVar* pThis, CBotVar* &pVar) +{ + // ok if no parameters! + if ( pVar == NULL ) return CBotTypResult(0); + + // numeric type of parameter please + if ( pVar->GetType() > CBotTypDouble ) return CBotTypResult(5011); + pVar = pVar->GetNext(); + + // there must be a second parameter + if ( pVar == NULL ) return 5028; + // also numeric + if ( pVar->GetType() > CBotTypDouble )return CBotTypResult(5011); + pVar = pVar->GetNext(); + + // and not more than 2 parameters please + if ( pVar != NULL ) return CBotTypResult(5026); + + return CBotTypResult(0); // This function returns void +} + diff --git a/src/CBot/tests/old TstCBot/BotConsoleDlg.cpp b/src/CBot/tests/old TstCBot/BotConsoleDlg.cpp deleted file mode 100644 index 077f080..0000000 --- a/src/CBot/tests/old TstCBot/BotConsoleDlg.cpp +++ /dev/null @@ -1,164 +0,0 @@ -// BotConsoleDlg.cpp : implementation file
-//
-
-#include "stdafx.h"
-#include "TstCBot.h"
-#include "BotConsoleDlg.h"
-
-#ifdef _DEBUG
-#define new DEBUG_NEW
-#undef THIS_FILE
-static char THIS_FILE[] = __FILE__;
-#endif
-
-/////////////////////////////////////////////////////////////////////////////
-// CBotConsoleDlg dialog
-
-
-CBotConsoleDlg::CBotConsoleDlg(CWnd* pParent /*=NULL*/)
- : CDialog(CBotConsoleDlg::IDD, pParent)
-{
- //{{AFX_DATA_INIT(CBotConsoleDlg)
- // NOTE: the ClassWizard will add member initialization here
- //}}AFX_DATA_INIT
- m_pProg = NULL;
- m_threadinfo.m_bRun = FALSE;
-}
-
-
-void CBotConsoleDlg::DoDataExchange(CDataExchange* pDX)
-{
- CDialog::DoDataExchange(pDX);
- //{{AFX_DATA_MAP(CBotConsoleDlg)
- DDX_Control(pDX, IDOK, m_cOK);
- DDX_Control(pDX, IDC_EDIT2, m_Edit2);
- DDX_Control(pDX, IDC_EDIT1, m_Edit1);
- //}}AFX_DATA_MAP
-}
-
-
-BEGIN_MESSAGE_MAP(CBotConsoleDlg, CDialog)
- //{{AFX_MSG_MAP(CBotConsoleDlg)
- ON_MESSAGE(WM_ENDPROG, EndProg)
- //}}AFX_MSG_MAP
-END_MESSAGE_MAP()
-
-/////////////////////////////////////////////////////////////////////////////
-// CBotConsoleDlg message handlers
-
-UINT ThreadProc(ThreadInfo *info)
-{
- CTime t0 = CTime::GetCurrentTime();
- int Cpt = 0;
-
- info->m_pProg->Start("LaCommande");
- while ( !info->m_bStop && !info->m_pProg->Run() )
- {
- Cpt++;
- if ( Cpt%20 == 0 ) info->m_pEdit1->ReplaceSel(".");
- }
-
- if ( info->m_bStop )
- {
- info->m_pEdit1->ReplaceSel("\r\nInterrompu\r\n");
- }
- else if (info->m_pProg->GivError() == 0)
- {
- CTime t = CTime::GetCurrentTime();
- CTimeSpan ts = t - t0;
-
- char buffer[200];
- sprintf( buffer, "\r\nExécution terminée en %d secondes.\r\nInterrompue %d fois.\r\n",
- ts.GetTotalSeconds(), Cpt);
-
- info->m_pEdit1->ReplaceSel(buffer);
- }
-
- info->m_pWndMessage->SendMessage(WM_ENDPROG, 0, 0) ;
- return 0 ;
-}
-
-LONG CBotConsoleDlg::EndProg(UINT wparam, LONG lparam)
-{
- m_threadinfo.m_bRun = FALSE;
-
- if (m_pProg->GetError(m_code, m_start, m_end))
- {
- AfxMessageBox(m_code);
- CDialog::OnCancel();
- return 1;
- }
- delete m_pProg;
- m_pProg = NULL;
-
- m_Edit2.EnableWindow(TRUE);
- m_cOK.EnableWindow(TRUE);
-
- m_Edit2.SetWindowText("");
- m_Edit2.SetFocus();
- return 0 ;
-}
-
-void CBotConsoleDlg::OnOK()
-{
- CTstCBotApp* pApp = (CTstCBotApp*)AfxGetApp();
- pApp->m_pConsole = &m_Edit1;
-
- CString Commande;
- m_Edit2.GetWindowText(Commande);
-
- CString s = "void LaCommande() { " + Commande + " ;}";
- m_pProg = new CBotProgram();
- CBotStringArray liste;
- m_pProg->Compile(s, liste);
- int err, start, end;
- if ( m_pProg->GetError(err, start, end) )
- {
- AfxMessageBox(err);
- m_Edit2.SetSel(start-20, end-20);
- return;
- }
-
- m_Edit1.ReplaceSel(Commande + " ->\r\n");
-
- m_Edit2.SetWindowText("");
- m_Edit1.SetFocus();
- m_Edit2.EnableWindow(FALSE);
- m_cOK.EnableWindow(FALSE);
-
- // lance un processus paralèle pour l'exécution
- m_threadinfo.m_pWndMessage = this ;
-
- m_threadinfo.m_pEdit1 = &m_Edit1;
- m_threadinfo.m_pProg = m_pProg;
- m_threadinfo.m_bStop = FALSE;
- m_threadinfo.m_bRun = TRUE;
-
- AfxBeginThread((AFX_THREADPROC)ThreadProc, &m_threadinfo) ;
-}
-
-void CBotConsoleDlg::OnCancel()
-{
- if (!m_threadinfo.m_bRun) CDialog::OnCancel();
- m_threadinfo.m_bStop = TRUE ;
-}
-
-
-BOOL CBotConsoleDlg::OnInitDialog()
-{
- CTstCBotApp* pApp = (CTstCBotApp*)AfxGetApp();
-
- CDialog::OnInitDialog();
-
- m_Edit1.ReplaceSel("Les fonctions suivantes sont disponibles:\r\n");
- for ( int i = 0; i < pApp->m_Liste.RetSize(); i++ )
- {
- CBotString x = CString(pApp->m_Liste[i]) + "\r\n";
- m_Edit1.ReplaceSel(x);
- }
- m_Edit1.ReplaceSel("Entrez une commande ci-dessous.\r\n\r\n");
-
-
- return TRUE; // return TRUE unless you set the focus to a control
- // EXCEPTION: OCX Property Pages should return FALSE
-}
diff --git a/src/CBot/tests/old TstCBot/BotConsoleDlg.h b/src/CBot/tests/old TstCBot/BotConsoleDlg.h deleted file mode 100644 index 9b54ff2..0000000 --- a/src/CBot/tests/old TstCBot/BotConsoleDlg.h +++ /dev/null @@ -1,65 +0,0 @@ -#if !defined(AFX_BOTCONSOLEDLG_H__A11450A2_8E09_11D4_A439_00D059085115__INCLUDED_)
-#define AFX_BOTCONSOLEDLG_H__A11450A2_8E09_11D4_A439_00D059085115__INCLUDED_
-
-#if _MSC_VER >= 1000
-#pragma once
-#endif // _MSC_VER >= 1000
-// BotConsoleDlg.h : header file
-//
-
-struct ThreadInfo
-{
- CEdit* m_pEdit1 ;
- CBotProgram* m_pProg;
- CWnd* m_pWndMessage;
- BOOL m_bStop;
- BOOL m_bRun;
-};
-
-
-/////////////////////////////////////////////////////////////////////////////
-// CBotConsoleDlg dialog
-
-class CBotConsoleDlg : public CDialog
-{
-// Construction
-public:
- CBotConsoleDlg(CWnd* pParent = NULL); // standard constructor
-
-// Dialog Data
- //{{AFX_DATA(CBotConsoleDlg)
- enum { IDD = IDD_CONSOLE };
- CButton m_cOK;
- CEdit m_Edit2;
- CEdit m_Edit1;
- //}}AFX_DATA
-
- CBotProgram* m_pProg;
- ThreadInfo m_threadinfo;
-
- int m_code, m_start, m_end;
-
-// Overrides
- // ClassWizard generated virtual function overrides
- //{{AFX_VIRTUAL(CBotConsoleDlg)
- protected:
- virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
- //}}AFX_VIRTUAL
-
-// Implementation
-protected:
-
- // Generated message map functions
- //{{AFX_MSG(CBotConsoleDlg)
- virtual void OnOK();
- virtual void OnCancel();
- virtual BOOL OnInitDialog();
- afx_msg LONG EndProg(UINT wparam, LONG lparam) ;
- //}}AFX_MSG
- DECLARE_MESSAGE_MAP()
-};
-
-//{{AFX_INSERT_LOCATION}}
-// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
-
-#endif // !defined(AFX_BOTCONSOLEDLG_H__A11450A2_8E09_11D4_A439_00D059085115__INCLUDED_)
diff --git a/src/CBot/tests/old TstCBot/BotErrorDlg.cpp b/src/CBot/tests/old TstCBot/BotErrorDlg.cpp deleted file mode 100644 index 87d56f0..0000000 --- a/src/CBot/tests/old TstCBot/BotErrorDlg.cpp +++ /dev/null @@ -1,56 +0,0 @@ -// BotErrorDlg.cpp : implementation file
-//
-
-#include "stdafx.h"
-#include "TstCBot.h"
-#include "BotErrorDlg.h"
-
-#ifdef _DEBUG
-#define new DEBUG_NEW
-#undef THIS_FILE
-static char THIS_FILE[] = __FILE__;
-#endif
-
-/////////////////////////////////////////////////////////////////////////////
-// CBotErrorDlg dialog
-
-
-CBotErrorDlg::CBotErrorDlg(CWnd* pParent /*=NULL*/)
- : CDialog(CBotErrorDlg::IDD, pParent)
-{
- //{{AFX_DATA_INIT(CBotErrorDlg)
- m_TextProgram = _T("");
- //}}AFX_DATA_INIT
-}
-
-
-void CBotErrorDlg::DoDataExchange(CDataExchange* pDX)
-{
- CDialog::DoDataExchange(pDX);
- //{{AFX_DATA_MAP(CBotErrorDlg)
- DDX_Control(pDX, IDC_EDIT1, m_eProgram);
- DDX_Control(pDX, IDC_STATIC1, m_sMessage);
- DDX_Text(pDX, IDC_EDIT1, m_TextProgram);
- //}}AFX_DATA_MAP
-}
-
-
-BEGIN_MESSAGE_MAP(CBotErrorDlg, CDialog)
- //{{AFX_MSG_MAP(CBotErrorDlg)
- //}}AFX_MSG_MAP
-END_MESSAGE_MAP()
-
-/////////////////////////////////////////////////////////////////////////////
-// CBotErrorDlg message handlers
-
-BOOL CBotErrorDlg::OnInitDialog()
-{
- CDialog::OnInitDialog();
-
- m_sMessage.SetWindowText(m_TextError);
- m_eProgram.SetFocus();
- m_eProgram.SetSel(m_start, m_end);
-
- return FALSE; // return TRUE unless you set the focus to a control
- // EXCEPTION: OCX Property Pages should return FALSE
-}
diff --git a/src/CBot/tests/old TstCBot/BotErrorDlg.h b/src/CBot/tests/old TstCBot/BotErrorDlg.h deleted file mode 100644 index 522afad..0000000 --- a/src/CBot/tests/old TstCBot/BotErrorDlg.h +++ /dev/null @@ -1,51 +0,0 @@ -#if !defined(AFX_BOTERRORDLG_H__80E73D20_7454_11D4_A439_00D059085115__INCLUDED_)
-#define AFX_BOTERRORDLG_H__80E73D20_7454_11D4_A439_00D059085115__INCLUDED_
-
-#if _MSC_VER >= 1000
-#pragma once
-#endif // _MSC_VER >= 1000
-// BotErrorDlg.h : header file
-//
-
-/////////////////////////////////////////////////////////////////////////////
-// CBotErrorDlg dialog
-
-class CBotErrorDlg : public CDialog
-{
-// Construction
-public:
- CBotErrorDlg(CWnd* pParent = NULL); // standard constructor
-
-// Dialog Data
- //{{AFX_DATA(CBotErrorDlg)
- enum { IDD = IDD_DIALOG1 };
- CEdit m_eProgram;
- CStatic m_sMessage;
- CString m_TextProgram;
- //}}AFX_DATA
-
-
- CString m_TextError;
- int m_start, m_end;
-
-// Overrides
- // ClassWizard generated virtual function overrides
- //{{AFX_VIRTUAL(CBotErrorDlg)
- protected:
- virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
- //}}AFX_VIRTUAL
-
-// Implementation
-protected:
-
- // Generated message map functions
- //{{AFX_MSG(CBotErrorDlg)
- virtual BOOL OnInitDialog();
- //}}AFX_MSG
- DECLARE_MESSAGE_MAP()
-};
-
-//{{AFX_INSERT_LOCATION}}
-// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
-
-#endif // !defined(AFX_BOTERRORDLG_H__80E73D20_7454_11D4_A439_00D059085115__INCLUDED_)
diff --git a/src/CBot/tests/old TstCBot/CBotTest.txt b/src/CBot/tests/old TstCBot/CBotTest.txt deleted file mode 100644 index ce20e26..0000000 --- a/src/CBot/tests/old TstCBot/CBotTest.txt +++ /dev/null @@ -1,36 +0,0 @@ -
-extern void TheTest()
-{
- for (int x = 130; x>0; x--) print (x);
-}
-
-extern void Test()
-{
- int var = 10000 ;
- while (var > 0) var = var -1;
-}
-// exécuté en 30 secondes
-
-extern void Autre()
-{
- int var = 10000 ;
- while (var > 0) if ( var > 0 ) var = var -1;
-}
-// exécuté en 45 secondes
-
-int Y ( int n )
-{
- if ( n < 2 ) return n;
- int a = Y(n-1) + Y(n-2);
- return a;
-}
-
-extern int X ( int n )
-{
- if ( n < 2 ) { print(n); return n; }
- int a = X(n-1) + Y(n-2);
- print (a);
- return a;
-}
-
-
diff --git a/src/CBot/tests/old TstCBot/CMyThread.cpp b/src/CBot/tests/old TstCBot/CMyThread.cpp deleted file mode 100644 index ca92c77..0000000 --- a/src/CBot/tests/old TstCBot/CMyThread.cpp +++ /dev/null @@ -1,107 +0,0 @@ -// CMyThread.cpp : pour créer un processus pour la console
-//
-
-#include "stdafx.h"
-#include "TstCBot.h"
-#include "CMyThread.h"
-#include "BotConsoleDlg.h"
-
-
-//IMPLEMENT_DYNAMIC (CMyThread, CWinThread)
-IMPLEMENT_DYNCREATE (CMyThread, CWinThread)
-
-/////////////////////////////////////////////////////////////////////////////
-// CMyThread
-
-BEGIN_MESSAGE_MAP(CMyThread, CWinThread)
- //{{AFX_MSG_MAP(CMyThread)
- //}}AFX_MSG_MAP
- // Standard file based document commands
-END_MESSAGE_MAP()
-
-/////////////////////////////////////////////////////////////////////////////
-// CMyThread construction
-
-CMyThread::CMyThread()
-{
- // TODO: add construction code here,
- // Place all significant initialization in InitInstance
-}
-
-
-/////////////////////////////////////////////////////////////////////////////
-// CMyThread initialization
-/*
-BOOL CMyThread::InitInstance()
-{
- AfxEnableControlContainer();
-
- CTstCBotApp* pApp = (CTstCBotApp*)AfxGetApp();
-
- // ouvre une fenêtre pour afficher les sorties
- CRect rect;
- AfxGetMainWnd()->GetClientRect( rect );
- rect += CPoint(30,30);
-
- CWnd* pWnd = new CWnd();
- pWnd->CreateEx( 0,
- AfxRegisterWndClass(0, AfxGetApp()->LoadStandardCursor(IDC_ARROW)),
- "CBot console", WS_POPUPWINDOW|WS_CAPTION|WS_VISIBLE,
- rect,
- AfxGetMainWnd()->GetParent(), NULL, NULL);
- m_pMainWnd = pWnd;
-
- pApp->m_pEdit2 = new CEdit();
-
- m_pMainWnd->GetClientRect( rect );
- rect.bottom -= 40;
- pApp->m_pEdit2->Create( WS_VISIBLE|WS_BORDER|WS_TABSTOP|ES_MULTILINE|ES_WANTRETURN|
- ES_AUTOVSCROLL|ES_READONLY,
- rect, m_pMainWnd, IDC_EDIT2 );
-
- pApp->m_pEdit2->ReplaceSel("Les fonctions suivantes sont disponibles:\n\r");
- for ( int i = 0; i < pApp->m_Liste.RetSize(); i++ )
- {
- pApp->m_pEdit2->ReplaceSel(pApp->m_Liste[i] + "\r\n");
- }
- pApp->m_pEdit2->ReplaceSel("Entrez une commande ci-dessous.\r\r");
-
-
-// pApp->m_pEdit2->SetFocus();
-
- pApp->m_pEdit3 = new CEdit();
- m_pMainWnd->GetClientRect( rect );
- rect.top = rect.bottom-40;
- pApp->m_pEdit3->Create( WS_VISIBLE|WS_BORDER|WS_TABSTOP,
- rect, m_pMainWnd, IDC_EDIT1 );
- pApp->m_pEdit3->SetFocus();
-
- return TRUE;
-}*/
-
-BOOL CMyThread::InitInstance()
-{
- CBotConsoleDlg dlg;
- m_pMainWnd = &dlg; // cela ferme l'application avec la DBOX !
-
- int nResponse = dlg.DoModal();
-
- return TRUE;
-}
-
-
-int CMyThread::ExitInstance()
-{
- return 0;
-}
-
-
-/////////////////////////////////////////////////////////////////////////////
-// CMyThread message handlers
-
-
-void CMyThread::OnReturn()
-{
- // TODO: Add your command handler code here
- __asm int 3;
-}
diff --git a/src/CBot/tests/old TstCBot/CMyThread.h b/src/CBot/tests/old TstCBot/CMyThread.h deleted file mode 100644 index 1134077..0000000 --- a/src/CBot/tests/old TstCBot/CMyThread.h +++ /dev/null @@ -1,44 +0,0 @@ -// CMyThread.h : pour créer un processus pour la console
-//
-/////////////////////////////////////////////////////////////////////////////
-
-#if !defined(AFX_MAINFRM_H__20B3756C_5DFD_11D4_A15E_00E0189013DF__INCLUDED_)
-#define AFX_MAINFRM_H__20B3756C_5DFD_11D4_A15E_00E0189013DF__INCLUDED_
-
-
-#include "stdafx.h"
-#include "TstCBot.h"
-
-class CMyThread : public CWinThread
-{
-// DECLARE_DYNAMIC(CMyThread)
- DECLARE_DYNCREATE(CMyThread)
-
-public:
-
-
-// Constructor
- CMyThread();
- virtual BOOL InitInstance();
- virtual int ExitInstance(); // return app exit code
-
-// Implementation
-
- //{{AFX_MSG(CTstCBotApp)
- afx_msg void OnAppAbout();
- // NOTE - the ClassWizard will add and remove member functions here.
- // DO NOT EDIT what you see in these blocks of generated code !
- //}}AFX_MSG
-
-// Generated message map functions
-protected:
- //{{AFX_MSG(CMainFrame)
- afx_msg void OnReturn();
- //}}AFX_MSG
- DECLARE_MESSAGE_MAP()
-};
-
-//{{AFX_INSERT_LOCATION}}
-// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
-
-#endif // !defined(AFX_MAINFRM_H__20B3756C_5DFD_11D4_A15E_00E0189013DF__INCLUDED_)
diff --git a/src/CBot/tests/old TstCBot/MainFrm.cpp b/src/CBot/tests/old TstCBot/MainFrm.cpp deleted file mode 100644 index 6c0962c..0000000 --- a/src/CBot/tests/old TstCBot/MainFrm.cpp +++ /dev/null @@ -1,91 +0,0 @@ -// MainFrm.cpp : implementation of the CMainFrame class
-//
-
-#include "stdafx.h"
-#include "TstCBot.h"
-
-#include "MainFrm.h"
-#include "BotErrorDlg.h"
-
-#ifdef _DEBUG
-#define new DEBUG_NEW
-#undef THIS_FILE
-static char THIS_FILE[] = __FILE__;
-#endif
-
-/////////////////////////////////////////////////////////////////////////////
-// CMainFrame
-
-IMPLEMENT_DYNCREATE(CMainFrame, CFrameWnd)
-
-BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd)
- //{{AFX_MSG_MAP(CMainFrame)
- ON_WM_CREATE()
- //}}AFX_MSG_MAP
-END_MESSAGE_MAP()
-
-static UINT indicators[] =
-{
- ID_SEPARATOR, // status line indicator
- ID_INDICATOR_CAPS,
- ID_INDICATOR_NUM,
- ID_INDICATOR_SCRL,
-};
-
-/////////////////////////////////////////////////////////////////////////////
-// CMainFrame construction/destruction
-
-CMainFrame::CMainFrame()
-{
- // TODO: add member initialization code here
-
-}
-
-CMainFrame::~CMainFrame()
-{
-}
-
-int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
-{
- if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
- return -1;
-
- if (!m_wndStatusBar.Create(this) ||
- !m_wndStatusBar.SetIndicators(indicators,
- sizeof(indicators)/sizeof(UINT)))
- {
- TRACE0("Failed to create status bar\n");
- return -1; // fail to create
- }
-
- return 0;
-}
-
-BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
-{
- // TODO: Modify the Window class or styles here by modifying
- // the CREATESTRUCT cs
-
- return CFrameWnd::PreCreateWindow(cs);
-}
-
-/////////////////////////////////////////////////////////////////////////////
-// CMainFrame diagnostics
-
-#ifdef _DEBUG
-void CMainFrame::AssertValid() const
-{
- CFrameWnd::AssertValid();
-}
-
-void CMainFrame::Dump(CDumpContext& dc) const
-{
- CFrameWnd::Dump(dc);
-}
-
-#endif //_DEBUG
-
-/////////////////////////////////////////////////////////////////////////////
-// CMainFrame message handlers
-
-
diff --git a/src/CBot/tests/old TstCBot/MainFrm.h b/src/CBot/tests/old TstCBot/MainFrm.h deleted file mode 100644 index 56b9c41..0000000 --- a/src/CBot/tests/old TstCBot/MainFrm.h +++ /dev/null @@ -1,55 +0,0 @@ -// MainFrm.h : interface of the CMainFrame class
-//
-/////////////////////////////////////////////////////////////////////////////
-
-#if !defined(AFX_MAINFRM_H__70B3756C_5DFD_11D4_A15E_00E0189013DF__INCLUDED_)
-#define AFX_MAINFRM_H__70B3756C_5DFD_11D4_A15E_00E0189013DF__INCLUDED_
-
-#if _MSC_VER >= 1000
-#pragma once
-#endif // _MSC_VER >= 1000
-
-class CMainFrame : public CFrameWnd
-{
-protected: // create from serialization only
- CMainFrame();
- DECLARE_DYNCREATE(CMainFrame)
-
-// Attributes
-public:
-
-// Operations
-public:
-
-// Overrides
- // ClassWizard generated virtual function overrides
- //{{AFX_VIRTUAL(CMainFrame)
- virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
- //}}AFX_VIRTUAL
-
-// Implementation
-public:
- virtual ~CMainFrame();
-#ifdef _DEBUG
- virtual void AssertValid() const;
- virtual void Dump(CDumpContext& dc) const;
-#endif
-
-protected: // control bar embedded members
- CStatusBar m_wndStatusBar;
-
-// Generated message map functions
-protected:
- //{{AFX_MSG(CMainFrame)
- afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
- afx_msg void OnCp1();
- //}}AFX_MSG
- DECLARE_MESSAGE_MAP()
-};
-
-/////////////////////////////////////////////////////////////////////////////
-
-//{{AFX_INSERT_LOCATION}}
-// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
-
-#endif // !defined(AFX_MAINFRM_H__70B3756C_5DFD_11D4_A15E_00E0189013DF__INCLUDED_)
diff --git a/src/CBot/tests/old TstCBot/ReadMe.txt b/src/CBot/tests/old TstCBot/ReadMe.txt deleted file mode 100644 index 67dc05b..0000000 --- a/src/CBot/tests/old TstCBot/ReadMe.txt +++ /dev/null @@ -1,93 +0,0 @@ -========================================================================
- MICROSOFT FOUNDATION CLASS LIBRARY : TstCBot
-========================================================================
-
-
-AppWizard has created this TstCBot application for you. This application
-not only demonstrates the basics of using the Microsoft Foundation classes
-but is also a starting point for writing your application.
-
-This file contains a summary of what you will find in each of the files that
-make up your TstCBot application.
-
-TstCBot.h
- This is the main header file for the application. It includes other
- project specific headers (including Resource.h) and declares the
- CTstCBotApp application class.
-
-TstCBot.cpp
- This is the main application source file that contains the application
- class CTstCBotApp.
-
-TstCBot.rc
- This is a listing of all of the Microsoft Windows resources that the
- program uses. It includes the icons, bitmaps, and cursors that are stored
- in the RES subdirectory. This file can be directly edited in Microsoft
- Developer Studio.
-
-res\TstCBot.ico
- This is an icon file, which is used as the application's icon. This
- icon is included by the main resource file TstCBot.rc.
-
-res\TstCBot.rc2
- This file contains resources that are not edited by Microsoft
- Developer Studio. You should place all resources not
- editable by the resource editor in this file.
-
-TstCBot.clw
- This file contains information used by ClassWizard to edit existing
- classes or add new classes. ClassWizard also uses this file to store
- information needed to create and edit message maps and dialog data
- maps and to create prototype member functions.
-
-/////////////////////////////////////////////////////////////////////////////
-
-For the main frame window:
-
-MainFrm.h, MainFrm.cpp
- These files contain the frame class CMainFrame, which is derived from
- CFrameWnd and controls all SDI frame features.
-
-
-/////////////////////////////////////////////////////////////////////////////
-
-AppWizard creates one document type and one view:
-
-TstCBotDoc.h, TstCBotDoc.cpp - the document
- These files contain your CTstCBotDoc class. Edit these files to
- add your special document data and to implement file saving and loading
- (via CTstCBotDoc::Serialize).
-
-TstCBotView.h, TstCBotView.cpp - the view of the document
- These files contain your CTstCBotView class.
- CTstCBotView objects are used to view CTstCBotDoc objects.
-
-
-
-/////////////////////////////////////////////////////////////////////////////
-Other standard files:
-
-StdAfx.h, StdAfx.cpp
- These files are used to build a precompiled header (PCH) file
- named TstCBot.pch and a precompiled types file named StdAfx.obj.
-
-Resource.h
- This is the standard header file, which defines new resource IDs.
- Microsoft Developer Studio reads and updates this file.
-
-/////////////////////////////////////////////////////////////////////////////
-Other notes:
-
-AppWizard uses "TODO:" to indicate parts of the source code you
-should add to or customize.
-
-If your application uses MFC in a shared DLL, and your application is
-in a language other than the operating system's current language, you
-will need to copy the corresponding localized resources MFC40XXX.DLL
-from the Microsoft Visual C++ CD-ROM onto the system or system32 directory,
-and rename it to be MFCLOC.DLL. ("XXX" stands for the language abbreviation.
-For example, MFC40DEU.DLL contains resources translated to German.) If you
-don't do this, some of the UI elements of your application will remain in the
-language of the operating system.
-
-/////////////////////////////////////////////////////////////////////////////
diff --git a/src/CBot/tests/old TstCBot/Resource.h b/src/CBot/tests/old TstCBot/Resource.h deleted file mode 100644 index 6863fd8..0000000 --- a/src/CBot/tests/old TstCBot/Resource.h +++ /dev/null @@ -1,68 +0,0 @@ -//{{NO_DEPENDENCIES}}
-// Microsoft Developer Studio generated include file.
-// Used by TstCBot.rc
-//
-#define IDD_ABOUTBOX 100
-#define IDR_MAINFRAME 128
-#define IDR_TSTCBOTYPE 129
-#define IDD_DIALOG1 130
-#define IDD_CONSOLE 131
-#define IDC_EDIT1 1000
-#define TX_TYPENAMES 1000
-#define IDC_STATIC1 1001
-#define IDC_EDIT2 1002
-#define TX_OPENPAR 5000
-#define TX_CLOSEPAR 5001
-#define TX_NOTBOOL 5002
-#define TX_UNDEFVAR 5003
-#define TX_BADLEFT 5004
-#define TX_ENDOF 5005
-#define TX_OUTCASE 5006
-#define TX_NOTERM 5007
-#define TX_CLOSEBLK 5008
-#define TX_ELSEWITHOUTIF 5009
-#define TX_OPENBLK 5010
-#define TX_BADTYPE 5011
-#define TX_REDEFVAR 5012
-#define TX_BAD2TYPE 5013
-#define TX_UNDEFCALL 5014
-#define TX_MISDOTS 5015
-#define TX_WHILE 5016
-#define TX_BREAK 5017
-#define TX_LABEL 5018
-#define TX_NOLABEL 5019
-#define TX_NOCASE 5020
-#define TX_BADNUM 5021
-#define TX_VOID 5022
-#define TX_NOTYP 5023
-#define TX_NOVAR 5024
-#define TX_NOFONC 5025
-#define TX_OVERPARAM 5026
-#define TX_REDEF 5027
-#define TX_LOWPARAM 5028
-#define TX_BADPARAM 5029
-#define TX_NUMPARAM 5030
-#define TX_NOITEM 5031
-#define TX_DOT 5032
-#define TX_NOCONST 5033
-#define TX_REDEFCLASS 5034
-#define TX_DIVZERO 6000
-#define TX_NOTINIT 6001
-#define TX_BADTHROW 6002
-#define TX_NORETVAL 6003
-#define TX_NORUN 6004
-#define TX_NOCALL 6005
-#define ID_CP1 32771
-#define ID_EXE 32772
-
-// Next default values for new objects
-//
-#ifdef APSTUDIO_INVOKED
-#ifndef APSTUDIO_READONLY_SYMBOLS
-#define _APS_3D_CONTROLS 1
-#define _APS_NEXT_RESOURCE_VALUE 132
-#define _APS_NEXT_COMMAND_VALUE 32775
-#define _APS_NEXT_CONTROL_VALUE 1002
-#define _APS_NEXT_SYMED_VALUE 101
-#endif
-#endif
diff --git a/src/CBot/tests/old TstCBot/StdAfx.cpp b/src/CBot/tests/old TstCBot/StdAfx.cpp deleted file mode 100644 index ae0ec93..0000000 --- a/src/CBot/tests/old TstCBot/StdAfx.cpp +++ /dev/null @@ -1,6 +0,0 @@ -// stdafx.cpp : source file that includes just the standard includes
-// TstCBot.pch will be the pre-compiled header
-// stdafx.obj will contain the pre-compiled type information
-
-#include "stdafx.h"
-
diff --git a/src/CBot/tests/old TstCBot/StdAfx.h b/src/CBot/tests/old TstCBot/StdAfx.h deleted file mode 100644 index 7d46ace..0000000 --- a/src/CBot/tests/old TstCBot/StdAfx.h +++ /dev/null @@ -1,26 +0,0 @@ -// stdafx.h : include file for standard system include files,
-// or project specific include files that are used frequently, but
-// are changed infrequently
-//
-
-#if !defined(AFX_STDAFX_H__70B3756A_5DFD_11D4_A15E_00E0189013DF__INCLUDED_)
-#define AFX_STDAFX_H__70B3756A_5DFD_11D4_A15E_00E0189013DF__INCLUDED_
-
-#if _MSC_VER >= 1000
-#pragma once
-#endif // _MSC_VER >= 1000
-
-#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
-
-#include <afxwin.h> // MFC core and standard components
-#include <afxext.h> // MFC extensions
-#include <afxdisp.h> // MFC OLE automation classes
-#ifndef _AFX_NO_AFXCMN_SUPPORT
-#include <afxcmn.h> // MFC support for Windows Common Controls
-#endif // _AFX_NO_AFXCMN_SUPPORT
-
-
-//{{AFX_INSERT_LOCATION}}
-// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
-
-#endif // !defined(AFX_STDAFX_H__70B3756A_5DFD_11D4_A15E_00E0189013DF__INCLUDED_)
diff --git a/src/CBot/tests/old TstCBot/TstCBot.clw b/src/CBot/tests/old TstCBot/TstCBot.clw deleted file mode 100644 index 4c54168..0000000 --- a/src/CBot/tests/old TstCBot/TstCBot.clw +++ /dev/null @@ -1,189 +0,0 @@ -; CLW file contains information for the MFC ClassWizard
-
-[General Info]
-Version=1
-LastClass=CTstCBotView
-LastTemplate=CDialog
-NewFileInclude1=#include "stdafx.h"
-NewFileInclude2=#include "TstCBot.h"
-LastPage=0
-
-ClassCount=7
-Class1=CTstCBotApp
-Class2=CTstCBotDoc
-Class3=CTstCBotView
-Class4=CMainFrame
-
-ResourceCount=6
-Resource1=IDD_ABOUTBOX
-Resource2=IDR_MAINFRAME
-Class5=CAboutDlg
-Resource3=IDD_ABOUTBOX (French (France))
-Resource4=IDD_CONSOLE
-Class6=CBotErrorDlg
-Resource5=IDD_DIALOG1 (French (Switzerland))
-Class7=CBotConsoleDlg
-Resource6=IDR_MAINFRAME (French (France))
-
-[CLS:CTstCBotApp]
-Type=0
-HeaderFile=TstCBot.h
-ImplementationFile=TstCBot.cpp
-Filter=N
-
-[CLS:CTstCBotDoc]
-Type=0
-HeaderFile=TstCBotDoc.h
-ImplementationFile=TstCBotDoc.cpp
-Filter=N
-BaseClass=CDocument
-VirtualFilter=DC
-LastObject=CTstCBotDoc
-
-[CLS:CTstCBotView]
-Type=0
-HeaderFile=TstCBotView.h
-ImplementationFile=TstCBotView.cpp
-Filter=C
-BaseClass=CView
-VirtualFilter=VWC
-LastObject=CTstCBotView
-
-[CLS:CMainFrame]
-Type=0
-HeaderFile=MainFrm.h
-ImplementationFile=MainFrm.cpp
-Filter=T
-BaseClass=CFrameWnd
-VirtualFilter=fWC
-LastObject=CMainFrame
-
-
-
-[CLS:CAboutDlg]
-Type=0
-HeaderFile=TstCBot.cpp
-ImplementationFile=TstCBot.cpp
-Filter=D
-
-[DLG:IDD_ABOUTBOX]
-Type=1
-Class=CAboutDlg
-ControlCount=4
-Control1=IDC_STATIC,static,1342177283
-Control2=IDC_STATIC,static,1342308480
-Control3=IDC_STATIC,static,1342308352
-Control4=IDOK,button,1342373889
-
-[MNU:IDR_MAINFRAME]
-Type=1
-Class=CMainFrame
-Command1=ID_FILE_NEW
-Command2=ID_FILE_OPEN
-Command3=ID_FILE_SAVE
-Command4=ID_FILE_SAVE_AS
-Command5=ID_FILE_MRU_FILE1
-Command6=ID_APP_EXIT
-Command7=ID_EDIT_UNDO
-Command8=ID_EDIT_CUT
-Command9=ID_EDIT_COPY
-Command10=ID_EDIT_PASTE
-Command11=ID_VIEW_STATUS_BAR
-Command12=ID_CP1
-Command13=ID_EXE
-Command14=ID_APP_ABOUT
-CommandCount=14
-
-[ACL:IDR_MAINFRAME]
-Type=1
-Class=CMainFrame
-Command1=ID_CP1
-Command2=ID_FILE_NEW
-Command3=ID_FILE_OPEN
-Command4=ID_FILE_SAVE
-Command5=ID_EXE
-Command6=ID_EDIT_UNDO
-Command7=ID_EDIT_CUT
-Command8=ID_EXE
-Command9=ID_CP1
-Command10=ID_EXE
-CommandCount=10
-
-[MNU:IDR_MAINFRAME (French (France))]
-Type=1
-Class=?
-Command1=ID_FILE_NEW
-Command2=ID_FILE_OPEN
-Command3=ID_FILE_SAVE
-Command4=ID_FILE_SAVE_AS
-Command5=ID_FILE_MRU_FILE1
-Command6=ID_APP_EXIT
-Command7=ID_EDIT_UNDO
-Command8=ID_EDIT_CUT
-Command9=ID_EDIT_COPY
-Command10=ID_EDIT_PASTE
-Command11=ID_VIEW_STATUS_BAR
-Command12=ID_CP1
-Command13=ID_EXE
-Command14=ID_APP_ABOUT
-CommandCount=14
-
-[ACL:IDR_MAINFRAME (French (France))]
-Type=1
-Class=?
-Command1=ID_CP1
-Command2=ID_FILE_NEW
-Command3=ID_FILE_OPEN
-Command4=ID_FILE_SAVE
-Command5=ID_EXE
-Command6=ID_EDIT_UNDO
-Command7=ID_EDIT_CUT
-Command8=ID_EXE
-Command9=ID_CP1
-Command10=ID_EXE
-CommandCount=10
-
-[DLG:IDD_ABOUTBOX (French (France))]
-Type=1
-Class=CAboutDlg
-ControlCount=4
-Control1=IDC_STATIC,static,1342177283
-Control2=IDC_STATIC,static,1342308480
-Control3=IDC_STATIC,static,1342308352
-Control4=IDOK,button,1342373889
-
-[CLS:CBotErrorDlg]
-Type=0
-HeaderFile=BotErrorDlg.h
-ImplementationFile=BotErrorDlg.cpp
-BaseClass=CDialog
-Filter=D
-VirtualFilter=dWC
-LastObject=CBotErrorDlg
-
-[DLG:IDD_DIALOG1 (French (Switzerland))]
-Type=1
-ControlCount=4
-Control1=IDOK,button,1342242817
-Control2=IDC_EDIT1,edit,1352728708
-Control3=IDC_STATIC,static,1342308352
-Control4=IDC_STATIC1,static,1342308352
-
-[DLG:IDD_CONSOLE]
-Type=1
-Class=CBotConsoleDlg
-ControlCount=4
-Control1=IDC_STATIC,static,1342308352
-Control2=IDC_EDIT2,edit,1350631552
-Control3=IDOK,button,1342242817
-Control4=IDC_EDIT1,edit,1352734724
-
-[CLS:CBotConsoleDlg]
-Type=0
-HeaderFile=BotConsoleDlg.h
-ImplementationFile=BotConsoleDlg.cpp
-BaseClass=CDialog
-Filter=D
-VirtualFilter=dWC
-LastObject=IDOK
-
diff --git a/src/CBot/tests/old TstCBot/TstCBot.cpp b/src/CBot/tests/old TstCBot/TstCBot.cpp deleted file mode 100644 index 8ac4557..0000000 --- a/src/CBot/tests/old TstCBot/TstCBot.cpp +++ /dev/null @@ -1,412 +0,0 @@ -// TstCBot.cpp : Defines the class behaviors for the application.
-//
-
-#include "stdafx.h"
-#include "TstCBot.h"
-
-#include "MainFrm.h"
-#include "TstCBotDoc.h"
-#include "TstCBotView.h"
-#include "CMyThread.h"
-
-
-#ifdef _DEBUG
-#define new DEBUG_NEW
-#undef THIS_FILE
-static char THIS_FILE[] = __FILE__;
-#endif
-
-
-////////////////////////////////////////////////////////////////////
-// routine show()
-// utilisable depuis le programme écrit en CBot
-
-// exécution
-BOOL rShow( CBotVar* pVar, CBotVar* pResult, int& Exception )
-{
- CString s;
-
- if ( pVar == NULL )
- {
- Exception = 22; return FALSE;
- }
-
- while ( pVar != NULL )
- {
- CString ss;
- ss.LoadString( TX_TYPENAMES + pVar->RetType() );
- s += ss + " ";
-
- ss = pVar->RetName();
- if (ss.IsEmpty()) ss = "<sans nom>";
- s += ss + " = ";
-
- s += pVar->RetValString();
- s += "\n";
- pVar = pVar->RetNext();
- }
-
- AfxMessageBox(s, MB_OK|MB_ICONINFORMATION);
-
-// if ( pResult && pResult->RetType() == CBotTypInt) pResult->SetValInt(123);
-
- return TRUE; // pas d'interruption
-}
-
-int cShow( CBotVar* &pVar, CBotString& RetClass)
-{
- if ( pVar == NULL ) return 22;
- return CBotTypInt; // tous paramètres acceptés, un entier en retour
-}
-
-int cErr( CBotVar* &pVar, CBotString& RetClass)
-{
- pVar = pVar->RetNext(); // avance le pointeur sur l'erreur
- return 6666;
-}
-
-////////////////////////////////////////////////////////////////////
-// routine print()
-// utilisable depuis le programme écrit en CBot
-
-// exécution
-BOOL rPrintLn( CBotVar* pVar, CBotVar* pResult, int& Exception )
-{
- CString s;
-
- CTstCBotApp* pApp = (CTstCBotApp*)AfxGetApp();
- CEdit* pEdit = pApp->m_pConsole;
-
- if (pEdit == NULL) return TRUE;
- pEdit->GetWindowText(s);
-
- while ( pVar != NULL )
- {
- if ( !s.IsEmpty() ) s += "\r\n";
- s += pVar->RetValString();
- pVar = pVar->RetNext();
- }
-
- pEdit->SetWindowText(s);
- pEdit->SetSel(s.GetLength(), s.GetLength());
- pEdit->SetFocus();
- return TRUE; // pas d'interruption
-}
-
-BOOL rPrint( CBotVar* pVar, CBotVar* pResult, int& Exception )
-{
- CString s;
-
- CTstCBotApp* pApp = (CTstCBotApp*)AfxGetApp();
- CEdit* pEdit = pApp->m_pConsole;
-
- if (pEdit == NULL) return TRUE;
- pEdit->GetWindowText(s);
-
- while ( pVar != NULL )
- {
- if ( !s.IsEmpty() ) s += " ";
- s += pVar->RetValString();
- pVar = pVar->RetNext();
- }
-
- pEdit->SetWindowText(s);
- pEdit->SetSel(s.GetLength(), s.GetLength());
- pEdit->SetFocus();
- return TRUE; // pas d'interruption
-}
-
-int cPrint( CBotVar* &pVar, CBotString& RetClass)
-{
- return 0; // tous paramètres acceptés, un entier en retour
-}
-
-
-//////////////////////////////////////////////////////////////////
-// class CPoint pour essayer
-
-// exécution
-BOOL rCPoint( CBotVar* pThis, CBotVar* pVar, CBotVar* pResult, int& Exception )
-{
- CString s;
-
- if ( pVar == NULL )return TRUE; // constructeur sans paramètres est ok
-
- if ( pVar->RetType() > CBotTypDouble )
- {
- Exception = 6023; return FALSE;
- }
-
- CBotVar* pX = pThis->RetItem("x");
- if ( pX == NULL )
- {
- Exception = 6024; return FALSE;
- }
-
- pX->SetValFloat( pVar->RetValFloat() );
- pVar = pVar->RetNext();
-
- if ( pVar == NULL )
- {
- Exception = 6022; return FALSE;
- }
-
- if ( pVar->RetType() > CBotTypDouble )
- {
- Exception = 6023; return FALSE;
- }
-
- CBotVar* pY = pThis->RetItem("y");
- if ( pY == NULL )
- {
- Exception = 6024; return FALSE;
- }
-
- pY->SetValFloat( pVar->RetValFloat() );
- pVar = pVar->RetNext();
-
- if ( pVar != NULL )
- {
- Exception = 6025; return FALSE;
- }
-
- return TRUE; // pas d'interruption
-}
-
-int cCPoint( CBotVar* pThis, CBotVar* &pVar, CBotString& RetClass)
-{
- // l'objet doit être de la classe CPoint
- if ( !pThis->IsElemOfClass("CPoint") ) return 6021;
-
- // ok si aucun paramètres !
- if ( pVar == NULL ) return 0;
-
- // paramètre de type numérique svp
- if ( pVar->RetType() > CBotTypDouble ) return 6023;
- pVar = pVar->RetNext();
-
- // il doit y avoir un second paramètre
- if ( pVar == NULL ) return 6022;
- // également de type numérique
- if ( pVar->RetType() > CBotTypDouble )return 6023;
- pVar = pVar->RetNext();
-
- // et pas plus de 2 paramètres svp
- if ( pVar != NULL ) return 6025;
-
- return 0; // cette fonction retourne void
-}
-
-// méthode déterminant l'opposé
-BOOL rOppose( CBotVar* pThis, CBotVar* pVar, CBotVar* pResult, int& Exception )
-{
- CString s;
-
- if ( pVar != NULL ) // pas de paramètre
- {
- Exception = 6025; return FALSE;
- }
-
- CBotVar* pvar = pThis->RetItemList(); // demande la chaîne des items
-
- // tous les paramètres sont des nombres
- while (pvar != NULL)
- {
- pvar->SetValFloat( -pvar->RetValFloat() );
- pvar = pvar->RetNext();
- }
-
- pResult->Copy(pThis);
- return TRUE; // pas d'interruption
-}
-
-int cOppose( CBotVar* pThis, CBotVar* &pVar, CBotString& RetClass)
-{
- // l'objet doit être de la classe CPoint
- if ( !pThis->IsElemOfClass("CPoint") ) return 6021;
-
- RetClass = "CPoint"; // l'objet rendu est de cette class
-
- // ok si aucun paramètres !
- if ( pVar == NULL ) return CBotTypClass; // le paramètre retourné est une instance de la classe
-
- return TX_OVERPARAM; // ça va pas
-}
-
-
-/////////////////////////////////////////////////////////////////////////////
-// CTstCBotApp
-
-BEGIN_MESSAGE_MAP(CTstCBotApp, CWinApp)
- //{{AFX_MSG_MAP(CTstCBotApp)
- ON_COMMAND(ID_APP_ABOUT, OnAppAbout)
- // NOTE - the ClassWizard will add and remove mapping macros here.
- // DO NOT EDIT what you see in these blocks of generated code!
- //}}AFX_MSG_MAP
- // Standard file based document commands
- ON_COMMAND(ID_FILE_NEW, CWinApp::OnFileNew)
- ON_COMMAND(ID_FILE_OPEN, CWinApp::OnFileOpen)
-END_MESSAGE_MAP()
-
-/////////////////////////////////////////////////////////////////////////////
-// CTstCBotApp construction
-
-CTstCBotApp::CTstCBotApp()
-{
- // TODO: add construction code here,
- // Place all significant initialization in InitInstance
-}
-
-/////////////////////////////////////////////////////////////////////////////
-// The one and only CTstCBotApp object
-
-CTstCBotApp theApp;
-
-/////////////////////////////////////////////////////////////////////////////
-// CTstCBotApp initialization
-
-BOOL CTstCBotApp::InitInstance()
-{
- AfxEnableControlContainer();
-
- // Standard initialization
- // If you are not using these features and wish to reduce the size
- // of your final executable, you should remove from the following
- // the specific initialization routines you do not need.
-
-#ifdef _AFXDLL
- Enable3dControls(); // Call this when using MFC in a shared DLL
-#else
- Enable3dControlsStatic(); // Call this when linking to MFC statically
-#endif
-
- // Change the registry key under which our settings are stored.
- // You should modify this string to be something appropriate
- // such as the name of your company or organization.
- SetRegistryKey(_T("Local AppWizard-Generated Applications"));
-
- LoadStdProfileSettings(); // Load standard INI file options (including MRU)
-
- // Register the application's document templates. Document templates
- // serve as the connection between documents, frame windows and views.
-
- CSingleDocTemplate* pDocTemplate;
- pDocTemplate = new CSingleDocTemplate(
- IDR_MAINFRAME,
- RUNTIME_CLASS(CTstCBotDoc),
- RUNTIME_CLASS(CMainFrame), // main SDI frame window
- RUNTIME_CLASS(CTstCBotView));
- AddDocTemplate(pDocTemplate);
-
- // Parse command line for standard shell commands, DDE, file open
- CCommandLineInfo cmdInfo;
- ParseCommandLine(cmdInfo);
-
- // Dispatch commands specified on the command line
- if (!ProcessShellCommand(cmdInfo))
- return FALSE;
-
- // The one and only window has been initialized, so show and update it.
- m_pMainWnd->ShowWindow(SW_SHOW);
- m_pMainWnd->UpdateWindow();
-
-
-
-///////////////////////////////////
-// défini la fonction "show()"
-// --------------------------------
-
- CBotProgram::AddFunction("show", rShow, cShow);
- CBotProgram::AddFunction("err", rShow, cErr);
- CBotProgram::AddFunction("print", rPrint, cPrint);
- CBotProgram::AddFunction("println", rPrintLn, cPrint);
-
-
-///////////////////////////////////
-// définie la classe globale CPoint
-// --------------------------------
-
- CBotClass* m_pClassPoint;
-
- m_pClassPoint = new CBotClass("CPoint", NULL);
- // ajoute le composant ".x"
- m_pClassPoint->AddItem("x", CBotTypFloat);
- // ajoute le composant ".y"
- m_pClassPoint->AddItem("y", CBotTypFloat);
-
- // ajoute le constructeur pour cette classe
- m_pClassPoint->AddFunction("CPoint", rCPoint, cCPoint);
- // ajoute la méthode Opposé
- m_pClassPoint->AddFunction("Opposé", rOppose, cOppose);
-
-
-//////////////////////////////////////////////////////////////////
-// compile un bout de programme pour voir s'il est bien accessible
-// depuis un autre "module"
-
- CBotProgram* p = new CBotProgram;
- CBotStringArray Liste;
- p->Compile(" public void MonProgram( ) { show (\"mon programme\") ;}", Liste );
-
- // l'objet n'est pas détruit et plus référencé
- // je sais c'est pas bien
-
-
- return TRUE;
-}
-
-/////////////////////////////////////////////////////////////////////////////
-// CAboutDlg dialog used for App About
-
-class CAboutDlg : public CDialog
-{
-public:
- CAboutDlg();
-
-// Dialog Data
- //{{AFX_DATA(CAboutDlg)
- enum { IDD = IDD_ABOUTBOX };
- //}}AFX_DATA
-
- // ClassWizard generated virtual function overrides
- //{{AFX_VIRTUAL(CAboutDlg)
- protected:
- virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
- //}}AFX_VIRTUAL
-
-// Implementation
-protected:
- //{{AFX_MSG(CAboutDlg)
- // No message handlers
- //}}AFX_MSG
- DECLARE_MESSAGE_MAP()
-};
-
-CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
-{
- //{{AFX_DATA_INIT(CAboutDlg)
- //}}AFX_DATA_INIT
-}
-
-void CAboutDlg::DoDataExchange(CDataExchange* pDX)
-{
- CDialog::DoDataExchange(pDX);
- //{{AFX_DATA_MAP(CAboutDlg)
- //}}AFX_DATA_MAP
-}
-
-BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
- //{{AFX_MSG_MAP(CAboutDlg)
- // No message handlers
- //}}AFX_MSG_MAP
-END_MESSAGE_MAP()
-
-// App command to run the dialog
-void CTstCBotApp::OnAppAbout()
-{
- CAboutDlg aboutDlg;
- aboutDlg.DoModal();
-}
-
-/////////////////////////////////////////////////////////////////////////////
-// CTstCBotApp commands
diff --git a/src/CBot/tests/old TstCBot/TstCBot.dsp b/src/CBot/tests/old TstCBot/TstCBot.dsp deleted file mode 100644 index 35e5c0b..0000000 --- a/src/CBot/tests/old TstCBot/TstCBot.dsp +++ /dev/null @@ -1,180 +0,0 @@ -# Microsoft Developer Studio Project File - Name="TstCBot" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 5.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Application" 0x0101
-
-CFG=TstCBot - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "TstCBot.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "TstCBot.mak" CFG="TstCBot - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "TstCBot - Win32 Release" (based on "Win32 (x86) Application")
-!MESSAGE "TstCBot - Win32 Debug" (based on "Win32 (x86) Application")
-!MESSAGE
-
-# Begin Project
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "TstCBot - Win32 Release"
-
-# PROP BASE Use_MFC 6
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 6
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_AFXDLL" /Yu"stdafx.h" /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_AFXDLL" /FR /Yu"stdafx.h" /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32
-# ADD BASE RSC /l 0x40c /d "NDEBUG" /d "_AFXDLL"
-# ADD RSC /l 0x40c /d "NDEBUG" /d "_AFXDLL"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 /nologo /subsystem:windows /machine:I386
-# ADD LINK32 /nologo /subsystem:windows /machine:I386
-
-!ELSEIF "$(CFG)" == "TstCBot - Win32 Debug"
-
-# PROP BASE Use_MFC 6
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 6
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_AFXDLL" /Yu"stdafx.h" /FD /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_AFXDLL" /FR /Yu"stdafx.h" /FD /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32
-# ADD BASE RSC /l 0x40c /d "_DEBUG" /d "_AFXDLL"
-# ADD RSC /l 0x40c /d "_DEBUG" /d "_AFXDLL"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
-
-!ENDIF
-
-# Begin Target
-
-# Name "TstCBot - Win32 Release"
-# Name "TstCBot - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\BotConsoleDlg.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\MainFrm.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\StdAfx.cpp
-# ADD CPP /Yc"stdafx.h"
-# End Source File
-# Begin Source File
-
-SOURCE=.\TstCBot.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\TstCBot.rc
-
-!IF "$(CFG)" == "TstCBot - Win32 Release"
-
-!ELSEIF "$(CFG)" == "TstCBot - Win32 Debug"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=.\TstCBotDoc.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\TstCBotView.cpp
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\BotConsoleDlg.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\MainFrm.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\Resource.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\StdAfx.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\TstCBot.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\TstCBotDoc.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\TstCBotView.h
-# End Source File
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;cnt;rtf;gif;jpg;jpeg;jpe"
-# Begin Source File
-
-SOURCE=.\res\TstCBot.ico
-# End Source File
-# Begin Source File
-
-SOURCE=.\res\TstCBot.rc2
-# End Source File
-# Begin Source File
-
-SOURCE=.\res\TstCBotDoc.ico
-# End Source File
-# End Group
-# Begin Source File
-
-SOURCE=.\ReadMe.txt
-# End Source File
-# End Target
-# End Project
diff --git a/src/CBot/tests/old TstCBot/TstCBot.h b/src/CBot/tests/old TstCBot/TstCBot.h deleted file mode 100644 index 616db43..0000000 --- a/src/CBot/tests/old TstCBot/TstCBot.h +++ /dev/null @@ -1,62 +0,0 @@ -// TstCBot.h : main header file for the TSTCBOT application
-//
-
-#if !defined(AFX_TSTCBOT_H__70B37568_5DFD_11D4_A15E_00E0189013DF__INCLUDED_)
-#define AFX_TSTCBOT_H__70B37568_5DFD_11D4_A15E_00E0189013DF__INCLUDED_
-
-#if _MSC_VER >= 1000
-#pragma once
-#endif // _MSC_VER >= 1000
-
-#ifndef __AFXWIN_H__
- #error include 'stdafx.h' before including this file for PCH
-#endif
-
-#include "resource.h" // main symbols
-#include "..\CBotDll.h"
-
-
-class CMyThread;
-
-/////////////////////////////////////////////////////////////////////////////
-// CTstCBotApp:
-// See TstCBot.cpp for the implementation of this class
-//
-
-class CTstCBotApp : public CWinApp
-{
-public:
- CTstCBotApp();
-
- CMyThread* m_pThread;
- CWnd* m_pView;
- CEdit* m_pConsole;
- CBotStringArray m_Liste;
-
-// Overrides
- // ClassWizard generated virtual function overrides
- //{{AFX_VIRTUAL(CTstCBotApp)
- public:
- virtual BOOL InitInstance();
- //}}AFX_VIRTUAL
-
-// Implementation
-
- //{{AFX_MSG(CTstCBotApp)
- afx_msg void OnAppAbout();
- // NOTE - the ClassWizard will add and remove member functions here.
- // DO NOT EDIT what you see in these blocks of generated code !
- //}}AFX_MSG
- DECLARE_MESSAGE_MAP()
-};
-
-
-/////////////////////////////////////////////////////////////////////////////
-
-//{{AFX_INSERT_LOCATION}}
-// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
-
-#endif // !defined(AFX_TSTCBOT_H__70B37568_5DFD_11D4_A15E_00E0189013DF__INCLUDED_)
-
-#define WM_STARTPROG WM_APP + 0
-#define WM_ENDPROG WM_APP + 1
diff --git a/src/CBot/tests/old TstCBot/TstCBot.rc b/src/CBot/tests/old TstCBot/TstCBot.rc deleted file mode 100644 index 9e91c76..0000000 --- a/src/CBot/tests/old TstCBot/TstCBot.rc +++ /dev/null @@ -1,471 +0,0 @@ -//Microsoft Developer Studio generated resource script.
-//
-#include "resource.h"
-
-#define APSTUDIO_READONLY_SYMBOLS
-/////////////////////////////////////////////////////////////////////////////
-//
-// Generated from the TEXTINCLUDE 2 resource.
-//
-#include "afxres.h"
-
-/////////////////////////////////////////////////////////////////////////////
-#undef APSTUDIO_READONLY_SYMBOLS
-
-/////////////////////////////////////////////////////////////////////////////
-// French (France) resources
-
-#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_FRA)
-#ifdef _WIN32
-LANGUAGE LANG_FRENCH, SUBLANG_FRENCH
-#pragma code_page(1252)
-#endif //_WIN32
-
-#ifdef APSTUDIO_INVOKED
-/////////////////////////////////////////////////////////////////////////////
-//
-// TEXTINCLUDE
-//
-
-1 TEXTINCLUDE DISCARDABLE
-BEGIN
- "resource.h\0"
-END
-
-2 TEXTINCLUDE DISCARDABLE
-BEGIN
- "#include ""afxres.h""\r\n"
- "\0"
-END
-
-3 TEXTINCLUDE DISCARDABLE
-BEGIN
- "#define _AFX_NO_SPLITTER_RESOURCES\r\n"
- "#define _AFX_NO_OLE_RESOURCES\r\n"
- "#define _AFX_NO_TRACKER_RESOURCES\r\n"
- "#define _AFX_NO_PROPERTY_RESOURCES\r\n"
- "\r\n"
- "#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_FRA)\r\n"
- "#ifdef _WIN32\r\n"
- "LANGUAGE 12, 1\r\n"
- "#pragma code_page(1252)\r\n"
- "#endif\r\n"
- "#include ""res\\TstCBot.rc2"" // non-Microsoft Visual C++ edited resources\r\n"
- "#include ""l.fra\\afxres.rc"" // Standard components\r\n"
- "#endif\0"
-END
-
-#endif // APSTUDIO_INVOKED
-
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// Icon
-//
-
-// Icon with lowest ID value placed first to ensure application icon
-// remains consistent on all systems.
-IDR_MAINFRAME ICON DISCARDABLE "res\\TstCBot.ico"
-IDR_TSTCBOTYPE ICON DISCARDABLE "res\\TstCBotDoc.ico"
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// Menu
-//
-
-IDR_MAINFRAME MENU PRELOAD DISCARDABLE
-BEGIN
- POPUP "&Fichier"
- BEGIN
- MENUITEM "&Nouveau\tCtrl+N", ID_FILE_NEW
- MENUITEM "&Ouvrir...\tCtrl+O", ID_FILE_OPEN
- MENUITEM "&Enregistrer\tCtrl+S", ID_FILE_SAVE
- MENUITEM "En®istrer sous...", ID_FILE_SAVE_AS
- MENUITEM SEPARATOR
- MENUITEM "Fichier récent", ID_FILE_MRU_FILE1, GRAYED
- MENUITEM SEPARATOR
- MENUITEM "&Quitter", ID_APP_EXIT
- END
- POPUP "&Edition"
- BEGIN
- MENUITEM "&Annuler\tCtrl+Z", ID_EDIT_UNDO
- MENUITEM SEPARATOR
- MENUITEM "&Couper\tCtrl+X", ID_EDIT_CUT
- MENUITEM "&Copier\tCtrl+C", ID_EDIT_COPY
- MENUITEM "C&oller\tCtrl+V", ID_EDIT_PASTE
- END
- POPUP "&Affichage"
- BEGIN
- MENUITEM "Barre d'é&tat", ID_VIEW_STATUS_BAR
- END
- POPUP "&Tests"
- BEGIN
- MENUITEM "&Compile\tAlt+C", ID_CP1
- MENUITEM "&Execute\tAlt+V", ID_EXE
- END
- POPUP "&?"
- BEGIN
- MENUITEM "&A propos de TstCBot...", ID_APP_ABOUT
- END
-END
-
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// Accelerator
-//
-
-IDR_MAINFRAME ACCELERATORS PRELOAD MOVEABLE PURE
-BEGIN
- "C", ID_CP1, VIRTKEY, ALT, NOINVERT
- "N", ID_FILE_NEW, VIRTKEY, CONTROL, NOINVERT
- "O", ID_FILE_OPEN, VIRTKEY, CONTROL, NOINVERT
- "S", ID_FILE_SAVE, VIRTKEY, CONTROL, NOINVERT
- "V", ID_EXE, VIRTKEY, ALT, NOINVERT
- VK_BACK, ID_EDIT_UNDO, VIRTKEY, ALT, NOINVERT
- VK_DELETE, ID_EDIT_CUT, VIRTKEY, SHIFT, NOINVERT
- VK_F5, ID_EXE, VIRTKEY, NOINVERT
- VK_F7, ID_CP1, VIRTKEY, NOINVERT
- "X", ID_EXE, VIRTKEY, ALT, NOINVERT
-END
-
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// Dialog
-//
-
-IDD_ABOUTBOX DIALOG DISCARDABLE 0, 0, 217, 55
-STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
-CAPTION "A propos de TstCBot"
-FONT 8, "MS Sans Serif"
-BEGIN
- ICON IDR_MAINFRAME,IDC_STATIC,11,17,20,20
- LTEXT "TstCBot version 1.0",IDC_STATIC,40,10,119,8,SS_NOPREFIX
- LTEXT "Copyright (C) 1900",IDC_STATIC,40,25,119,8
- DEFPUSHBUTTON "OK",IDOK,178,7,32,14,WS_GROUP
-END
-
-
-#ifndef _MAC
-/////////////////////////////////////////////////////////////////////////////
-//
-// Version
-//
-
-VS_VERSION_INFO VERSIONINFO
- FILEVERSION 1,0,0,1
- PRODUCTVERSION 1,0,0,1
- FILEFLAGSMASK 0x3fL
-#ifdef _DEBUG
- FILEFLAGS 0x1L
-#else
- FILEFLAGS 0x0L
-#endif
- FILEOS 0x4L
- FILETYPE 0x1L
- FILESUBTYPE 0x0L
-BEGIN
- BLOCK "StringFileInfo"
- BEGIN
- BLOCK "040C04B0"
- BEGIN
- VALUE "CompanyName", "\0"
- VALUE "FileDescription", "Application MFC TstCBot\0"
- VALUE "FileVersion", "1, 0, 0, 1\0"
- VALUE "InternalName", "TstCBot\0"
- VALUE "LegalCopyright", "Copyright (C) 1900\0"
- VALUE "LegalTrademarks", "\0"
- VALUE "OriginalFilename", "TstCBot.EXE\0"
- VALUE "ProductName", "Application TstCBot\0"
- VALUE "ProductVersion", "1, 0, 0, 1\0"
- END
- END
- BLOCK "VarFileInfo"
- BEGIN
- VALUE "Traduction", 0x40c, 1200
- END
-END
-
-#endif // !_MAC
-
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// DESIGNINFO
-//
-
-#ifdef APSTUDIO_INVOKED
-GUIDELINES DESIGNINFO DISCARDABLE
-BEGIN
- IDD_ABOUTBOX, DIALOG
- BEGIN
- LEFTMARGIN, 7
- RIGHTMARGIN, 210
- TOPMARGIN, 7
- BOTTOMMARGIN, 48
- END
-END
-#endif // APSTUDIO_INVOKED
-
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// String Table
-//
-
-STRINGTABLE PRELOAD DISCARDABLE
-BEGIN
- IDR_MAINFRAME "TstCBot\n\nTstCBo\n\n\nTstCBot.Document\nTstCBo Document"
-END
-
-STRINGTABLE PRELOAD DISCARDABLE
-BEGIN
- AFX_IDS_APP_TITLE "TstCBot"
- AFX_IDS_IDLEMESSAGE "Prêt"
-END
-
-STRINGTABLE DISCARDABLE
-BEGIN
- ID_INDICATOR_EXT "EXT"
- ID_INDICATOR_CAPS "MAJ"
- ID_INDICATOR_NUM "NUM"
- ID_INDICATOR_SCRL "DEF"
- ID_INDICATOR_OVR "ECR"
- ID_INDICATOR_REC "ENR"
-END
-
-STRINGTABLE DISCARDABLE
-BEGIN
- ID_FILE_NEW "Crée un nouveau document\nNouveau"
- ID_FILE_OPEN "Ouvre un document existant\nOuvrir"
- ID_FILE_CLOSE "Ferme le document actif\nFermer"
- ID_FILE_SAVE "Enregistre le document actif\nEnregistrer"
- ID_FILE_SAVE_AS "Enregistre le document actif sous un nouveau nom\nEnregistrer sous"
-END
-
-STRINGTABLE DISCARDABLE
-BEGIN
- ID_APP_ABOUT "Affiche des informations sur le programme, le numéro de version et le copyright\nA propos de"
- ID_APP_EXIT "Ferme l'application ; propose d'enregistrer les documents\nQuitter"
-END
-
-STRINGTABLE DISCARDABLE
-BEGIN
- ID_FILE_MRU_FILE1 "Ouvre ce document"
- ID_FILE_MRU_FILE2 "Ouvre ce document"
- ID_FILE_MRU_FILE3 "Ouvre ce document"
- ID_FILE_MRU_FILE4 "Ouvre ce document"
- ID_FILE_MRU_FILE5 "Ouvre ce document"
- ID_FILE_MRU_FILE6 "Ouvre ce document"
- ID_FILE_MRU_FILE7 "Ouvre ce document"
- ID_FILE_MRU_FILE8 "Ouvre ce document"
- ID_FILE_MRU_FILE9 "Ouvre ce document"
- ID_FILE_MRU_FILE10 "Ouvre ce document"
- ID_FILE_MRU_FILE11 "Ouvre ce document"
- ID_FILE_MRU_FILE12 "Ouvre ce document"
- ID_FILE_MRU_FILE13 "Ouvre ce document"
- ID_FILE_MRU_FILE14 "Ouvre ce document"
- ID_FILE_MRU_FILE15 "Ouvre ce document"
- ID_FILE_MRU_FILE16 "Ouvre ce document"
-END
-
-STRINGTABLE DISCARDABLE
-BEGIN
- ID_NEXT_PANE "Passe au volet de fenêtre suivant\nVolet suivant"
- ID_PREV_PANE "Revient au volet précédent\nVolet précédent"
-END
-
-STRINGTABLE DISCARDABLE
-BEGIN
- ID_WINDOW_SPLIT "Fractionne la fenêtre active en deux volets\nFractionner"
-END
-
-STRINGTABLE DISCARDABLE
-BEGIN
- ID_EDIT_CLEAR "Efface la sélection\nEffacer"
- ID_EDIT_CLEAR_ALL "Efface tout\nEffacer tout"
- ID_EDIT_COPY "Copie la sélection et la place dans le Presse-papiers\nCopier"
- ID_EDIT_CUT "Supprime la sélection et la place dans le Presse-papiers\nCopier"
- ID_EDIT_FIND "Recherche le texte spécifié\nRechercher"
- ID_EDIT_PASTE "Insère le contenu du Presse-papiers\nColler"
- ID_EDIT_REPEAT "Répète la dernière action\nRépéter"
- ID_EDIT_REPLACE "Remplace le texte spécifique par un texte différent\nRemplacer"
- ID_EDIT_SELECT_ALL "Sélectionne le document entier\nSélectionner tout"
- ID_EDIT_UNDO "Annule la dernière action\nAnnuler"
- ID_EDIT_REDO "Rétablit l'action précédemment annulée\nRétablir"
-END
-
-STRINGTABLE DISCARDABLE
-BEGIN
- ID_VIEW_STATUS_BAR "Affiche ou masque la barre d'état\nBarre d'état"
-END
-
-STRINGTABLE DISCARDABLE
-BEGIN
- AFX_IDS_SCSIZE "Change la taille de la fenêtre"
- AFX_IDS_SCMOVE "Change la position de la fenêtre"
- AFX_IDS_SCMINIMIZE "Réduit la fenêtre en icône"
- AFX_IDS_SCMAXIMIZE "Agrandit la fenêtre au format de l'écran"
- AFX_IDS_SCNEXTWINDOW "Passe à la fenêtre de document suivante"
- AFX_IDS_SCPREVWINDOW "Passe à la fenêtre de document précédente"
- AFX_IDS_SCCLOSE "Ferme la fenêtre active et propose l'enregistrement des documents"
-END
-
-STRINGTABLE DISCARDABLE
-BEGIN
- AFX_IDS_SCRESTORE "Restaure la fenêtre à sa taille d'origine"
- AFX_IDS_SCTASKLIST "Active la liste des tâches"
-END
-
-STRINGTABLE DISCARDABLE
-BEGIN
- TX_TYPENAMES "les différents types"
- 1001 "Byte"
- 1002 "Short"
- 1003 "Char"
- 1004 "Int"
- 1005 "Long"
- 1006 "Real"
- 1007 "Double"
-END
-
-STRINGTABLE DISCARDABLE
-BEGIN
- 1008 "Boolean"
- 1009 "Class"
- 1010 "String"
-END
-
-STRINGTABLE DISCARDABLE
-BEGIN
- TX_OPENPAR "Il manque une parenthèse ouvrante."
- TX_CLOSEPAR "Il manque une parenthèse fermante."
- TX_NOTBOOL "L'expression doit être un boolean."
- TX_UNDEFVAR "Variable non déclarée."
- TX_BADLEFT "Assignation impossible."
- TX_ENDOF "Instruction non terminée."
- TX_OUTCASE "Instruction ""case"" hors d'un bloc ""switch""."
- TX_NOTERM "Instructions après la fin."
-END
-
-STRINGTABLE DISCARDABLE
-BEGIN
- TX_CLOSEBLK "Il manque la fin du bloc."
- TX_ELSEWITHOUTIF "Instruction ""else"" sans ""if"" correspondant."
- TX_OPENBLK "Début d'un bloc attendu."
- TX_BADTYPE "Mauvais type de résultat pour l'assignation."
- TX_REDEFVAR "Redéfinition d'une variable."
- TX_BAD2TYPE "Les deux opérandes ne sont pas de types compatibles."
- TX_UNDEFCALL "Routine inconnue."
- TX_MISDOTS "Séparateur "" : "" attendu."
- TX_WHILE "Manque le mot ""while""."
- TX_BREAK "Instruction ""break"" en dehors d'une boucle."
- TX_LABEL "Un label ne peut se placer que devant un ""for"", un ""while"", un ""do"" ou un ""switch""."
- TX_NOLABEL "Cette étiquette n'existe pas"
- TX_NOCASE "Manque une instruction ""case""."
- TX_BADNUM "Un nombre est attendu."
- TX_VOID "Paramètre void."
- TX_NOTYP "Déclaration de type attendu"
-END
-
-STRINGTABLE DISCARDABLE
-BEGIN
- TX_DIVZERO "Division par zéro."
- TX_NOTINIT "Variable non initialisée."
- TX_BADTHROW "Valeur négative refusée pour ""throw""."
- TX_NORETVAL "La fonction n'a pas retourné de résultat"
- TX_NORUN "Pas de fonction en exécution"
- TX_NOCALL "Appel d'une fonction inexistante"
-END
-
-STRINGTABLE DISCARDABLE
-BEGIN
- TX_NOVAR "Nom d'une variable attendu"
- TX_NOFONC "Nom de la fonction attendu."
- TX_OVERPARAM "Trop de paramètres"
- TX_REDEF "Cette fonction existe déjà."
- TX_LOWPARAM "Pas assez de paramètres"
- TX_BADPARAM "Aucune fonction de ce nom n'accepte ce(s) type(s) de paramètre(s)"
- TX_NUMPARAM "Aucune fonction de ce nom n'accepte ce nombre de paramètres"
- TX_NOITEM "Cet élément n'exite pas dans cette classe."
- TX_DOT "L'objet n'est pas une instance d'une classe."
- TX_NOCONST "Il n'y a pas de constructeur approprié."
- TX_REDEFCLASS "Cette classe existe déjà."
-END
-
-#endif // French (France) resources
-/////////////////////////////////////////////////////////////////////////////
-
-
-/////////////////////////////////////////////////////////////////////////////
-// French (Switzerland) resources
-
-#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_FRS)
-#ifdef _WIN32
-LANGUAGE LANG_FRENCH, SUBLANG_FRENCH_SWISS
-#pragma code_page(1252)
-#endif //_WIN32
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// Dialog
-//
-
-IDD_CONSOLE DIALOG DISCARDABLE 0, 0, 401, 210
-STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
-CAPTION "CBot Console"
-FONT 8, "MS Sans Serif"
-BEGIN
- LTEXT "Commande :",IDC_STATIC,7,177,40,8
- EDITTEXT IDC_EDIT2,7,189,329,14,ES_AUTOHSCROLL
- DEFPUSHBUTTON "Exécute",IDOK,344,189,50,14
- EDITTEXT IDC_EDIT1,7,7,387,167,ES_MULTILINE | ES_READONLY |
- ES_WANTRETURN | WS_VSCROLL
-END
-
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// DESIGNINFO
-//
-
-#ifdef APSTUDIO_INVOKED
-GUIDELINES DESIGNINFO DISCARDABLE
-BEGIN
- IDD_CONSOLE, DIALOG
- BEGIN
- LEFTMARGIN, 7
- RIGHTMARGIN, 394
- TOPMARGIN, 7
- BOTTOMMARGIN, 203
- END
-END
-#endif // APSTUDIO_INVOKED
-
-#endif // French (Switzerland) resources
-/////////////////////////////////////////////////////////////////////////////
-
-
-
-#ifndef APSTUDIO_INVOKED
-/////////////////////////////////////////////////////////////////////////////
-//
-// Generated from the TEXTINCLUDE 3 resource.
-//
-#define _AFX_NO_SPLITTER_RESOURCES
-#define _AFX_NO_OLE_RESOURCES
-#define _AFX_NO_TRACKER_RESOURCES
-#define _AFX_NO_PROPERTY_RESOURCES
-
-#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_FRA)
-#ifdef _WIN32
-LANGUAGE 12, 1
-#pragma code_page(1252)
-#endif
-#include "res\TstCBot.rc2" // non-Microsoft Visual C++ edited resources
-#include "l.fra\afxres.rc" // Standard components
-#endif
-/////////////////////////////////////////////////////////////////////////////
-#endif // not APSTUDIO_INVOKED
-
diff --git a/src/CBot/tests/old TstCBot/TstCBotDoc.cpp b/src/CBot/tests/old TstCBot/TstCBotDoc.cpp deleted file mode 100644 index 7d7e2ef..0000000 --- a/src/CBot/tests/old TstCBot/TstCBotDoc.cpp +++ /dev/null @@ -1,83 +0,0 @@ -// TstCBotDoc.cpp : implementation of the CTstCBotDoc class
-//
-
-#include "stdafx.h"
-#include "TstCBot.h"
-
-#include "TstCBotDoc.h"
-
-#ifdef _DEBUG
-#define new DEBUG_NEW
-#undef THIS_FILE
-static char THIS_FILE[] = __FILE__;
-#endif
-
-/////////////////////////////////////////////////////////////////////////////
-// CTstCBotDoc
-
-IMPLEMENT_DYNCREATE(CTstCBotDoc, CDocument)
-
-BEGIN_MESSAGE_MAP(CTstCBotDoc, CDocument)
- //{{AFX_MSG_MAP(CTstCBotDoc)
- //}}AFX_MSG_MAP
-END_MESSAGE_MAP()
-
-/////////////////////////////////////////////////////////////////////////////
-// CTstCBotDoc construction/destruction
-
-CTstCBotDoc::CTstCBotDoc()
-{
- // TODO: add one-time construction code here
-
-}
-
-CTstCBotDoc::~CTstCBotDoc()
-{
-}
-
-BOOL CTstCBotDoc::OnNewDocument()
-{
- if (!CDocument::OnNewDocument())
- return FALSE;
-
- // TODO: add reinitialization code here
- // (SDI documents will reuse this document)
-
- return TRUE;
-}
-
-
-
-/////////////////////////////////////////////////////////////////////////////
-// CTstCBotDoc serialization
-
-void CTstCBotDoc::Serialize(CArchive& ar)
-{
- if (ar.IsStoring())
- {
- // TODO: add storing code here
- }
- else
- {
- // TODO: add loading code here
- }
-}
-
-/////////////////////////////////////////////////////////////////////////////
-// CTstCBotDoc diagnostics
-
-#ifdef _DEBUG
-void CTstCBotDoc::AssertValid() const
-{
- CDocument::AssertValid();
-}
-
-void CTstCBotDoc::Dump(CDumpContext& dc) const
-{
- CDocument::Dump(dc);
-}
-#endif //_DEBUG
-
-/////////////////////////////////////////////////////////////////////////////
-// CTstCBotDoc commands
-
diff --git a/src/CBot/tests/old TstCBot/TstCBotDoc.h b/src/CBot/tests/old TstCBot/TstCBotDoc.h deleted file mode 100644 index ae1d0f7..0000000 --- a/src/CBot/tests/old TstCBot/TstCBotDoc.h +++ /dev/null @@ -1,55 +0,0 @@ -// TstCBotDoc.h : interface of the CTstCBotDoc class
-//
-/////////////////////////////////////////////////////////////////////////////
-
-#if !defined(AFX_TSTCBOTDOC_H__70B3756E_5DFD_11D4_A15E_00E0189013DF__INCLUDED_)
-#define AFX_TSTCBOTDOC_H__70B3756E_5DFD_11D4_A15E_00E0189013DF__INCLUDED_
-
-#if _MSC_VER >= 1000
-#pragma once
-#endif // _MSC_VER >= 1000
-
-
-class CTstCBotDoc : public CDocument
-{
-protected: // create from serialization only
- CTstCBotDoc();
- DECLARE_DYNCREATE(CTstCBotDoc)
-
-// Attributes
-public:
-
-// Operations
-public:
-
-// Overrides
- // ClassWizard generated virtual function overrides
- //{{AFX_VIRTUAL(CTstCBotDoc)
- public:
- virtual BOOL OnNewDocument();
- virtual void Serialize(CArchive& ar);
- //}}AFX_VIRTUAL
-
-// Implementation
-public:
- virtual ~CTstCBotDoc();
-#ifdef _DEBUG
- virtual void AssertValid() const;
- virtual void Dump(CDumpContext& dc) const;
-#endif
-
-protected:
-
-// Generated message map functions
-protected:
- //{{AFX_MSG(CTstCBotDoc)
- //}}AFX_MSG
- DECLARE_MESSAGE_MAP()
-};
-
-/////////////////////////////////////////////////////////////////////////////
-
-//{{AFX_INSERT_LOCATION}}
-// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
-
-#endif // !defined(AFX_TSTCBOTDOC_H__70B3756E_5DFD_11D4_A15E_00E0189013DF__INCLUDED_)
diff --git a/src/CBot/tests/old TstCBot/TstCBotView.cpp b/src/CBot/tests/old TstCBot/TstCBotView.cpp deleted file mode 100644 index 3ee9094..0000000 --- a/src/CBot/tests/old TstCBot/TstCBotView.cpp +++ /dev/null @@ -1,291 +0,0 @@ -// TstCBotView.cpp : implementation of the CTstCBotView class
-//
-
-#include "stdafx.h"
-#include "TstCBot.h"
-
-#include "TstCBotDoc.h"
-#include "TstCBotView.h"
-#include "BotConsoleDlg.h"
-
-#ifdef _DEBUG
-#define new DEBUG_NEW
-#undef THIS_FILE
-static char THIS_FILE[] = __FILE__;
-#endif
-
-/////////////////////////////////////////////////////////////////////////////
-// CTstCBotView
-
-IMPLEMENT_DYNCREATE(CTstCBotView, CView)
-
-BEGIN_MESSAGE_MAP(CTstCBotView, CView)
- //{{AFX_MSG_MAP(CTstCBotView)
- ON_WM_SIZE()
- ON_COMMAND(ID_CP1, OnCp1)
- ON_COMMAND(ID_EXE, OnExe)
- ON_COMMAND(ID_FILE_SAVE, OnFileSave)
- ON_COMMAND(ID_FILE_SAVE_AS, OnFileSaveAs)
- //}}AFX_MSG_MAP
-END_MESSAGE_MAP()
-
-/////////////////////////////////////////////////////////////////////////////
-// CTstCBotView construction/destruction
-
-CTstCBotView::CTstCBotView()
-{
- // TODO: add construction code here
- m_pEdit = NULL;
- m_pProg = NULL;
-}
-
-CTstCBotView::~CTstCBotView()
-{
-}
-
-BOOL CTstCBotView::PreCreateWindow(CREATESTRUCT& cs)
-{
- // TODO: Modify the Window class or styles here by modifying
- // the CREATESTRUCT cs
-
- return CView::PreCreateWindow(cs);
-}
-
-void CTstCBotView::OnActivateView( BOOL bActivate, CView* pActivateView, CView* pDeactiveView )
-{
- if ( m_pEdit == NULL)
- {
- m_pEdit = new CEdit();
- CRect rect;
- GetClientRect( rect );
-
- m_pEdit->Create( WS_VISIBLE|WS_BORDER|WS_TABSTOP|ES_MULTILINE|ES_WANTRETURN|ES_NOHIDESEL|ES_AUTOVSCROLL,
- rect, this, IDC_EDIT1 );
- m_pEdit->SetTabStops(12);
- LoadEdition("CBotTest.txt");
- m_pEdit->SetFocus();
- }
-}
-
-
-/////////////////////////////////////////////////////////////////////////////
-// CTstCBotView drawing
-
-void CTstCBotView::OnDraw(CDC* pDC)
-{
- CTstCBotDoc* pDoc = GetDocument();
- ASSERT_VALID(pDoc);
-
- // TODO: add draw code for native data here
-}
-
-/////////////////////////////////////////////////////////////////////////////
-// CTstCBotView diagnostics
-
-#ifdef _DEBUG
-void CTstCBotView::AssertValid() const
-{
- CView::AssertValid();
-}
-
-void CTstCBotView::Dump(CDumpContext& dc) const
-{
- CView::Dump(dc);
-}
-
-CTstCBotDoc* CTstCBotView::GetDocument() // non-debug version is inline
-{
- ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CTstCBotDoc)));
- return (CTstCBotDoc*)m_pDocument;
-}
-#endif //_DEBUG
-
-/////////////////////////////////////////////////////////////////////////////
-// CTstCBotView message handlers
-
-void CTstCBotView::OnSize(UINT nType, int cx, int cy)
-{
- CView::OnSize(nType, cx, cy);
-
- if ( m_pEdit != NULL )
- {
- CRect rect;
- GetClientRect( rect );
- m_pEdit->MoveWindow( rect );
- m_pEdit->SetFocus();
- }
-}
-
-void CTstCBotView::SaveEdition(const char* filename)
-{
- CString program;
-
- m_pEdit->GetWindowText(program);
-
- FILE* pf = fopen(filename, "wb");
- if (pf==NULL) return;
-
- fputs (program, pf);
- fclose(pf);
-}
-
-void CTstCBotView::LoadEdition(const char* filename)
-{
- CString program("{ int x = 10000; while (x > 0) x = x-1; }");
-
- FILE* pf = fopen(filename, "r");
- if (pf!=NULL)
- {
- char buffer[10000];
- program.Empty();
-
- while (NULL != fgets (buffer, 100000, pf))
- {
- program += buffer;
- program = program.Left(program.GetLength()-1) + "\r\n";
- }
-
- fclose(pf);
- }
-
- m_pEdit->SetWindowText(program);
-}
-
-
-
-// compile le programme
-#include <stdio.h>
-
-void CTstCBotView::OnCp1()
-{
- CString program;
-
- SaveEdition("CBotTest.txt");
-
- m_pEdit->GetWindowText(program);
-
- CString TextError;
- int code, start, end;
-
- if ( m_pProg == NULL ) m_pProg = new CBotProgram();
-
- CTstCBotApp* pApp = (CTstCBotApp*)AfxGetApp();
-
- if (m_pProg->Compile(program, pApp->m_Liste))
- {
- CString done = "Compilation sans erreur.\nLes fonctions suivantes sont externes:\n";
-
- for ( int i = 0; i < pApp->m_Liste.RetSize(); i++)
- {
- done += CString(pApp->m_Liste[i]) + "\n";
- }
-
- AfxMessageBox( done );
- }
- else
- {
- m_pProg->GetError(code, start, end);
- delete m_pProg;
- m_pProg = NULL;
-
- m_pEdit->SetSel( start, end );
- m_pEdit->SetFocus(); // met en évidence la partie avec problème
-
- TextError.LoadString( code );
- if (TextError.IsEmpty())
- {
- char buf[100];
- sprintf(buf, "Erreur numéro %d.", code);
- TextError = buf;
- }
- AfxMessageBox( TextError );
- }
-
- m_pEdit->SetFocus();
-}
-
-
-//////////////////////////////////////////////////////
-
-
-void CTstCBotView::OnExe()
-{
- CTstCBotApp* pApp = (CTstCBotApp*)AfxGetApp();
-
- if( m_pProg == NULL)
- {
- AfxMessageBox("Pas de programme compilé !");
- return;
- }
-
- if( pApp->m_Liste.RetSize() == 0 )
- {
- AfxMessageBox("Aucune fonction marquée \"extern\" !");
- return;
- }
-
-
-
- CBotConsoleDlg dlg;
- dlg.DoModal(); // dialogue pour faire la console
-
- if ( dlg.m_code>0 )
- {
- CString TextError;
-
- m_pEdit->SetSel( dlg.m_start, dlg.m_end );
- m_pEdit->SetFocus(); // met en évidence la partie avec problème
-
- TextError.LoadString( dlg.m_code );
- if (TextError.IsEmpty())
- {
- char buf[100];
- sprintf(buf, "Erreur numéro %d.", dlg.m_code);
- TextError = buf;
- }
-// AfxMessageBox( TextError );
- }
-
- m_pEdit->SetFocus();
-
- return;
-}
-
-
-
-void CTstCBotView::OnFileSave()
-{
- // TODO: Add your command handler code here
- SaveEdition("CBotTest.txt");
-}
-
-void CTstCBotView::OnFileSaveAs()
-{
- CFileDialog *pDlg;
- CString s;
-
- pDlg = new CFileDialog(FALSE, "TXT", NULL,
- OFN_OVERWRITEPROMPT|OFN_HIDEREADONLY,
- "cboxtest|*.txt", this);
- if ( pDlg == NULL ) return;
-
- if ( pDlg->DoModal() == IDOK ) // choix du fichier ...
- {
- SaveEdition(pDlg->GetPathName());
- }
-
- delete pDlg;
-}
-
-#if 0
-void test()
-{
- int y,z;
-
- for (;;);
- for (x = 0; y = 1; z = 3) int q = 6;
- for (int x = 0; int y = 1; int z = 3) int q = 6;
- // pour voir
-}
-#endif
-
diff --git a/src/CBot/tests/old TstCBot/TstCBotView.h b/src/CBot/tests/old TstCBot/TstCBotView.h deleted file mode 100644 index d5aede5..0000000 --- a/src/CBot/tests/old TstCBot/TstCBotView.h +++ /dev/null @@ -1,81 +0,0 @@ -// TstCBotView.h : interface of the CTstCBotView class
-//
-/////////////////////////////////////////////////////////////////////////////
-
-#if !defined(AFX_TSTCBOTVIEW_H__70B37570_5DFD_11D4_A15E_00E0189013DF__INCLUDED_)
-#define AFX_TSTCBOTVIEW_H__70B37570_5DFD_11D4_A15E_00E0189013DF__INCLUDED_
-
-#if _MSC_VER >= 1000
-#pragma once
-#endif // _MSC_VER >= 1000
-
-
-class CBotProgram;
-class CBotClass;
-
-
-class CTstCBotView : public CView
-{
-protected: // create from serialization only
- CTstCBotView();
- DECLARE_DYNCREATE(CTstCBotView)
-
- CEdit* m_pEdit; // texte en édition
- CWnd* m_pWnd;
- CBotProgram* m_pProg; // programme compilé
-
-// Attributes
-public:
- CTstCBotDoc* GetDocument();
-
-// Operations
-public:
- void LoadEdition(const char* name);
- void SaveEdition(const char* name);
-
-// Overrides
- // ClassWizard generated virtual function overrides
- //{{AFX_VIRTUAL(CTstCBotView)
- public:
- virtual void OnDraw(CDC* pDC); // overridden to draw this view
- virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
- virtual void OnActivateView( BOOL bActivate, CView* pActivateView, CView* pDeactiveView );
- protected:
- //}}AFX_VIRTUAL
-
-// Implementation
-public:
- virtual ~CTstCBotView();
-#ifdef _DEBUG
- virtual void AssertValid() const;
- virtual void Dump(CDumpContext& dc) const;
-#endif
-
-protected:
-
-// Generated message map functions
-protected:
- //{{AFX_MSG(CTstCBotView)
- afx_msg void OnSize(UINT nType, int cx, int cy);
- afx_msg void OnCp1();
- afx_msg void OnExe();
- afx_msg void OnFileSave();
- afx_msg void OnFileSaveAs();
- //}}AFX_MSG
- DECLARE_MESSAGE_MAP()
-};
-
-#ifndef _DEBUG // debug version in TstCBotView.cpp
-inline CTstCBotDoc* CTstCBotView::GetDocument()
- { return (CTstCBotDoc*)m_pDocument; }
-#endif
-
-/////////////////////////////////////////////////////////////////////////////
-
-//{{AFX_INSERT_LOCATION}}
-// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
-
-#endif // !defined(AFX_TSTCBOTVIEW_H__70B37570_5DFD_11D4_A15E_00E0189013DF__INCLUDED_)
-
-
-
diff --git a/src/CBot/tests/old TstCBot/res/TstCBot.ico b/src/CBot/tests/old TstCBot/res/TstCBot.ico Binary files differdeleted file mode 100644 index 7eef0bc..0000000 --- a/src/CBot/tests/old TstCBot/res/TstCBot.ico +++ /dev/null diff --git a/src/CBot/tests/old TstCBot/res/TstCBot.rc2 b/src/CBot/tests/old TstCBot/res/TstCBot.rc2 deleted file mode 100644 index 2186272..0000000 --- a/src/CBot/tests/old TstCBot/res/TstCBot.rc2 +++ /dev/null @@ -1,13 +0,0 @@ -//
-// TSTCBOT.RC2 - resources Microsoft Visual C++ does not edit directly
-//
-
-#ifdef APSTUDIO_INVOKED
- #error this file is not editable by Microsoft Visual C++
-#endif //APSTUDIO_INVOKED
-
-
-/////////////////////////////////////////////////////////////////////////////
-// Add manually edited resources here...
-
-/////////////////////////////////////////////////////////////////////////////
diff --git a/src/CBot/tests/old TstCBot/res/TstCBotDoc.ico b/src/CBot/tests/old TstCBot/res/TstCBotDoc.ico Binary files differdeleted file mode 100644 index 2a1f1ae..0000000 --- a/src/CBot/tests/old TstCBot/res/TstCBotDoc.ico +++ /dev/null diff --git a/src/CBot/tests/old TstCBot/test complet 1.txt b/src/CBot/tests/old TstCBot/test complet 1.txt deleted file mode 100644 index 0fd4fa5..0000000 --- a/src/CBot/tests/old TstCBot/test complet 1.txt +++ /dev/null @@ -1,213 +0,0 @@ -// test de l'interpréteur CBot, (c) D. Dumoulin 2000
-
-Int Somme ( Int x, Int y )
-{
- return x + y;
-}
-
-Real Somme ( Real x, Real y )
-{
- return x + y;
-}
-
-void A_Faire()
-{
- CPoint position; // utilise une classe externe
- position.x = 123.5;
- position.y = -45.1;
-
- show ( position );
-}
-
-/* Les nouveautés sont les suivantes
- __________________________________________________
-
- On peut définir des fonctions, avec la syntaxe habituelle au C
- void MaFonction( Int x, Real y ) { ... }
-
- Les caractéristiques sont pour l'instant les suivantes:
-
- - ce programme TstCBot exécute la dernière fonction définie
-
- - on peut définir deux fonctions du même nom,
- si la liste de paramètres est différente.
- Par exemple
- Int Somme( Int x, Int y )
- Real Somme( Real x, Real y );
- Note: si la seconde n'existait pas, Somme ( 1.3, 4.8 )
- serait fait sur les nombres entier 1 + 4
- La priorité est donnée à la routine qui ne pert pas
- de bits dans la conversion des paramètres.
-
- - il n'y a pas d'erreur de compilation si une routine
- ne retourne pas de valeur alors qu'elle devrait,
- par contre il y a une erreur "correcte" à l'exécution
-
- - il est possible d'utiliser une fonction qui est définie
- plus bas dans le programme.
- __________________________________________________
-
- Tous les blocs d'instructions existent maintenant, à savoir
-
- label :
- while (condition) { instructions; break label; continue label; }
-
- label :
- do { instructions; break label; continue label; } while (condition)
-
- label:
- for (initial; condition; incrément) { instructions; break; continue }
-
- switch ( valeur ) { case 1: instructions; case 2: break ; }
-
- try {instructions; throw exception; } catch (exception) {instructions;}
- catch (testlogique) {instructions;}
- finally {instructions;}
- // le bloc finally est exécuter dans tous les cas
- // qu'il y ait eu exception ou non, et aussi en cas de break, continue ou return
- __________________________________________________
-
- Les "exceptions" sont juste des numéros (31 bits)
- 6000 = division par zéro
- 6001 = variable non initialisée
- 6002 = valeur négative pour un throw
- 6003 = la fonction n'a pas retourné de valeur
-
- les autres numéros sont à disposition
- (COLOBOT aura surement des numéros d'exception propre)
- l'association d'un mot clef pour ces exceptions est à venir.
- __________________________________________________
-
- L'interpréteur a été un peu optimiser, une boucle de un millon de décrément
- ne prend plus que
-*/
-
-void Test ()
-{ // début du bloc d'instructions
-
- Int z = 1000000;
- while ( z>0 ) z--;
-
- return;
- {
- // test la préséance pour les assignations
- Int a = 9;
- a += (a = 3);
- if ( a != 12 ) 1/0; // le résultat correct est 12
-
- Int b = 9;
- b = b + (b = 3);
- if (b != 12) 1/0; // même chose
-
- // la fonction show est une fonction externe
- // définie par TstCBot
- // elle peut prendre un nombre quelconque de paramètres
- show ( a, b );
- }
-
- {
- // petit test sur les chaînes
- String x = "ch." ;
- String y ;
- x += y = x + " de la brume.";
-
- // concaténation de chaînes, accepte des autres types
- String s = 1 + 2 + " test " + 3 + 4 ;
-
- show( x, y, s );
-
- // les tests sur les chaînes ne sont pas standard en Java
- // mais c'est si pratique :
-
- if ( s != "3 test 34" ) 1/0; // le résultat correct est "3 test 34"
- // car 1+2 est évalué en premier entre 2 nombres
- // et ensuite on additionne des chaînes "3" "4"
- }
-
- {
- // teste toutes les opérations avec les entiers (32 bits)
- Int a = 4;
- Int b = 4;
-
- Int c = a++ * --b; // post incrément, pré décrément
- if ( c != 12 ) 1/0;
-
- c = ++a * b--; // pré incrément, post décrément
- if ( c!=18 ) 1/0;
-
- a = a+b-a*b/a%3; // 6 + 2 - ( 6 * 2 / 6 % 3 ) -> 6
- if ( a != 6 ) 1/0;
-
- a += 2; a-=1; a*=3; a/=4; a%=3; // (6+2 -1) *3 /4 modulo 3 = 21 / 4 modulo 3 = 2
- if ( a!= 2) 0/0;
-
- if (-5 << 3 != -40) 0/0; // shift à gauche
- if ( -5 >> 1 != -3) 0/0; // shift arithmétique à droite 11111011 -> 11111101 = -3
- if ( -5 >>> 1 != 0x3ffffffd) 0/0; // shift non signé à droite
-
- a = -10; // fait la même chose en assignation
- a <<= 1; // -20
- a >>= 2; // -5
- a >>>= 1; // pert le signe
- if ( a != 0x3ffffffd) 0/0; //
-
- Int x = 5/3; // division d'entiers
- if ( x != 1 ) 0/0;
- Int xx = 5.0/3.0; // division de réels, assigné à un entier
- if ( xx != 1 ) 0/0;
-
- Int y = 0xF0035678;
- if ( ~y != 0x0FFCA987 ) 0/0; // NOT bit à bit
- if ( (0x3456 ^ 0x54f0) != 0x60A6) // XOR bit à bit
- 0/0;
- if ( (0x23 | 0x83) != 0xA3 ) 0/0; // OR bit à bit
- if ( (0x23 & 0x83) != 0x03 ) 0/0; // AND bit à bit
-
- Int z = 0x0123;
- z |= 0x8010; if ( z != 0x8133) 0/0;
- z &= 0xF018; if ( z != 0x8010) 0/0;
- z ^= 0xFF17; if ( z != 0x7F07) 0/0;
- }
-
- {
- // test pour les booléens
- Boolean a, b= true, c = false;
- a = b | c & b;
- if ( a != b ) 0/0;
- if ( !a ) 0/0;
- if ( b ^ a ) 0/0; // XOR
- if ( true || 0/0<1 ) {};
- if ( false && 0/0<1) {};
- // a ? "vrai" : "faux";
- }
-
- {
- // petit test sur les nombres réels
- Real x = 1. / 3, y = 0;
-
- if ( 3 * x != 1 ) x = x / y; // provoque une division par zéro
- else y = 1.123;
- }
-
-
- // test de durée
- // attention, le programme de test ne stoppe qu'à la fin d'exécution
- // bien que la boucle est interrompue plusieures fois
-
- // la boucle est plus rapide si elle est au début du programme !
- {
- Int z = 10000;
- while ( z > 0 ) z = z - 1;
- }
-
-}
-
-void t()
-{
- A_Faire();
-
- show ( Somme ( 1, 2 ) );
- show ( Somme ( 1., 2 ) );
- show ( Somme ( 4.5, 2.7 ) );
-}
-
diff --git a/src/CBot/tests/old TstCBot/x.txt b/src/CBot/tests/old TstCBot/x.txt deleted file mode 100644 index 95856e0..0000000 --- a/src/CBot/tests/old TstCBot/x.txt +++ /dev/null @@ -1,43 +0,0 @@ -// test de l'interpréteur CBot, (c) D. Dumoulin 2000
-
-// pour l'instant, seule les primitives suivantes sont implémentées
-
-// { ... ; ... ; ... } un bloc d'instructions
-// int x, y = 12, z; // déclaration de nombre entier
-// float a, b= 2/3, c=b+1; // déclaration de nombres réels
-// boolean tst = true; // déclaration d'un booléen
-// String x = "hello"; // déclaration d'une chaînes
-
-// z = x = x * y / ( z + 1 - x ); // assignation en chaîne et les 4 opérations
-
-// while ( x >= 0 ) x = x - 1; // boucle while, et test > >= < <= == !=
-// if ( x < y ) x = x + 1; // test si
-// else y = y + 1; // sinon
-
-/* et les opérations suivantes:
- + plus unaire x = +y;
- - moins unaire x = -y;
-
- || OU logique
- && ET logique
- ! NOT logique
- | OU bit à bit
- & ET bit à bit
- ^ XOR bit à bit
- ~ NON bit à bit
-
-// les commentaires sont acceptés
-/* y compris les commentaires
- sur plusieures lignes */
-
-
-{
-String str ;
-
-str = "abc" ;
-
-show (str) ;
-
-show( str = str + "+++" , ) ;
-
-}
diff --git a/src/CBot/tests/TestCBot/scenarios/B.txt b/src/CBot/tests/scenarios/B.txt index 53715f8..53715f8 100644 --- a/src/CBot/tests/TestCBot/scenarios/B.txt +++ b/src/CBot/tests/scenarios/B.txt diff --git a/src/CBot/tests/TestCBot/scenarios/BUG2.txt b/src/CBot/tests/scenarios/BUG2.txt index 44de05a..44de05a 100644 --- a/src/CBot/tests/TestCBot/scenarios/BUG2.txt +++ b/src/CBot/tests/scenarios/BUG2.txt diff --git a/src/CBot/tests/TestCBot/scenarios/Deleted.txt b/src/CBot/tests/scenarios/Deleted.txt index 469a624..469a624 100644 --- a/src/CBot/tests/TestCBot/scenarios/Deleted.txt +++ b/src/CBot/tests/scenarios/Deleted.txt diff --git a/src/CBot/tests/TestCBot/scenarios/MaClass.txt b/src/CBot/tests/scenarios/MaClass.txt index ac472b4..ac472b4 100644 --- a/src/CBot/tests/TestCBot/scenarios/MaClass.txt +++ b/src/CBot/tests/scenarios/MaClass.txt diff --git a/src/CBot/tests/TestCBot/scenarios/Mc2.txt b/src/CBot/tests/scenarios/Mc2.txt index 172c259..172c259 100644 --- a/src/CBot/tests/TestCBot/scenarios/Mc2.txt +++ b/src/CBot/tests/scenarios/Mc2.txt diff --git a/src/CBot/tests/TestCBot/scenarios/Mon fichier.txt b/src/CBot/tests/scenarios/Mon fichier.txt index 6b35bf8..6b35bf8 100644 --- a/src/CBot/tests/TestCBot/scenarios/Mon fichier.txt +++ b/src/CBot/tests/scenarios/Mon fichier.txt diff --git a/src/CBot/tests/TestCBot/scenarios/Nop.txt b/src/CBot/tests/scenarios/Nop.txt index 6a66f6f..6a66f6f 100644 --- a/src/CBot/tests/TestCBot/scenarios/Nop.txt +++ b/src/CBot/tests/scenarios/Nop.txt diff --git a/src/CBot/tests/TestCBot/scenarios/POS.txt b/src/CBot/tests/scenarios/POS.txt index 688e4fb..688e4fb 100644 --- a/src/CBot/tests/TestCBot/scenarios/POS.txt +++ b/src/CBot/tests/scenarios/POS.txt diff --git a/src/CBot/tests/TestCBot/scenarios/T.txt b/src/CBot/tests/scenarios/T.txt index 50a792b..50a792b 100644 --- a/src/CBot/tests/TestCBot/scenarios/T.txt +++ b/src/CBot/tests/scenarios/T.txt diff --git a/src/CBot/tests/TestCBot/scenarios/TESTALL.txt b/src/CBot/tests/scenarios/TESTALL.txt index 82247a0..82247a0 100644 --- a/src/CBot/tests/TestCBot/scenarios/TESTALL.txt +++ b/src/CBot/tests/scenarios/TESTALL.txt diff --git a/src/CBot/tests/TestCBot/scenarios/TestCB1.txt b/src/CBot/tests/scenarios/TestCB1.txt index 516db47..516db47 100644 --- a/src/CBot/tests/TestCBot/scenarios/TestCB1.txt +++ b/src/CBot/tests/scenarios/TestCB1.txt diff --git a/src/CBot/tests/TestCBot/scenarios/TestCBot1.txt b/src/CBot/tests/scenarios/TestCBot1.txt index d27b4f8..d27b4f8 100644 --- a/src/CBot/tests/TestCBot/scenarios/TestCBot1.txt +++ b/src/CBot/tests/scenarios/TestCBot1.txt diff --git a/src/CBot/tests/TestCBot/scenarios/TestCBot3.txt b/src/CBot/tests/scenarios/TestCBot3.txt index b915f96..b915f96 100644 --- a/src/CBot/tests/TestCBot/scenarios/TestCBot3.txt +++ b/src/CBot/tests/scenarios/TestCBot3.txt diff --git a/src/CBot/tests/TestCBot/scenarios/TestNull.txt b/src/CBot/tests/scenarios/TestNull.txt index f447245..f447245 100644 --- a/src/CBot/tests/TestCBot/scenarios/TestNull.txt +++ b/src/CBot/tests/scenarios/TestNull.txt diff --git a/src/CBot/tests/TestCBot/scenarios/TestRestoreState.txt b/src/CBot/tests/scenarios/TestRestoreState.txt index 1e49e37..1e49e37 100644 --- a/src/CBot/tests/TestCBot/scenarios/TestRestoreState.txt +++ b/src/CBot/tests/scenarios/TestRestoreState.txt diff --git a/src/CBot/tests/TestCBot/scenarios/TestStatic.txt b/src/CBot/tests/scenarios/TestStatic.txt index f501aa5..f501aa5 100644 --- a/src/CBot/tests/TestCBot/scenarios/TestStatic.txt +++ b/src/CBot/tests/scenarios/TestStatic.txt diff --git a/src/CBot/tests/TestCBot/scenarios/TestStr.txt b/src/CBot/tests/scenarios/TestStr.txt index 683ec1b..683ec1b 100644 --- a/src/CBot/tests/TestCBot/scenarios/TestStr.txt +++ b/src/CBot/tests/scenarios/TestStr.txt diff --git a/src/CBot/tests/TestCBot/scenarios/Z.txt b/src/CBot/tests/scenarios/Z.txt index 714119b..714119b 100644 --- a/src/CBot/tests/TestCBot/scenarios/Z.txt +++ b/src/CBot/tests/scenarios/Z.txt diff --git a/src/CBot/tests/TestCBot/scenarios/a1.txt b/src/CBot/tests/scenarios/a1.txt index 165bc95..165bc95 100644 --- a/src/CBot/tests/TestCBot/scenarios/a1.txt +++ b/src/CBot/tests/scenarios/a1.txt diff --git a/src/CBot/tests/TestCBot/scenarios/array.txt b/src/CBot/tests/scenarios/array.txt index 081b60e..081b60e 100644 --- a/src/CBot/tests/TestCBot/scenarios/array.txt +++ b/src/CBot/tests/scenarios/array.txt diff --git a/src/CBot/tests/TestCBot/scenarios/až1.txt b/src/CBot/tests/scenarios/až1.txt index 165bc95..165bc95 100644 --- a/src/CBot/tests/TestCBot/scenarios/až1.txt +++ b/src/CBot/tests/scenarios/až1.txt diff --git a/src/CBot/tests/TestCBot/scenarios/a§1.txt b/src/CBot/tests/scenarios/a§1.txt index 0c57950..0c57950 100644 --- a/src/CBot/tests/TestCBot/scenarios/a§1.txt +++ b/src/CBot/tests/scenarios/a§1.txt diff --git a/src/CBot/tests/TestCBot/scenarios/bug.txt b/src/CBot/tests/scenarios/bug.txt index 4ec6eb3..4ec6eb3 100644 --- a/src/CBot/tests/TestCBot/scenarios/bug.txt +++ b/src/CBot/tests/scenarios/bug.txt diff --git a/src/CBot/tests/TestCBot/scenarios/bugmw.txt b/src/CBot/tests/scenarios/bugmw.txt index 284ee43..284ee43 100644 --- a/src/CBot/tests/TestCBot/scenarios/bugmw.txt +++ b/src/CBot/tests/scenarios/bugmw.txt diff --git a/src/CBot/tests/TestCBot/scenarios/ccc.txt b/src/CBot/tests/scenarios/ccc.txt index dbcd1d5..dbcd1d5 100644 --- a/src/CBot/tests/TestCBot/scenarios/ccc.txt +++ b/src/CBot/tests/scenarios/ccc.txt diff --git a/src/CBot/tests/TestCBot/scenarios/enum.txt b/src/CBot/tests/scenarios/enum.txt index a592a7f..a592a7f 100644 --- a/src/CBot/tests/TestCBot/scenarios/enum.txt +++ b/src/CBot/tests/scenarios/enum.txt diff --git a/src/CBot/tests/TestCBot/scenarios/fibo.txt b/src/CBot/tests/scenarios/fibo.txt index 88f5357..88f5357 100644 --- a/src/CBot/tests/TestCBot/scenarios/fibo.txt +++ b/src/CBot/tests/scenarios/fibo.txt diff --git a/src/CBot/tests/TestCBot/scenarios/file.txt b/src/CBot/tests/scenarios/file.txt index 2a22dd9..2a22dd9 100644 --- a/src/CBot/tests/TestCBot/scenarios/file.txt +++ b/src/CBot/tests/scenarios/file.txt diff --git a/src/CBot/tests/TestCBot/scenarios/h.txt b/src/CBot/tests/scenarios/h.txt index c395319..c395319 100644 --- a/src/CBot/tests/TestCBot/scenarios/h.txt +++ b/src/CBot/tests/scenarios/h.txt diff --git a/src/CBot/tests/TestCBot/scenarios/include.txt b/src/CBot/tests/scenarios/include.txt index e8f8cc9..e8f8cc9 100644 --- a/src/CBot/tests/TestCBot/scenarios/include.txt +++ b/src/CBot/tests/scenarios/include.txt diff --git a/src/CBot/tests/TestCBot/scenarios/intrinsic.txt b/src/CBot/tests/scenarios/intrinsic.txt index f215791..f215791 100644 --- a/src/CBot/tests/TestCBot/scenarios/intrinsic.txt +++ b/src/CBot/tests/scenarios/intrinsic.txt diff --git a/src/CBot/tests/TestCBot/scenarios/methode1.txt b/src/CBot/tests/scenarios/methode1.txt index 080bba2..080bba2 100644 --- a/src/CBot/tests/TestCBot/scenarios/methode1.txt +++ b/src/CBot/tests/scenarios/methode1.txt diff --git a/src/CBot/tests/TestCBot/scenarios/methode2.txt b/src/CBot/tests/scenarios/methode2.txt index 76ce7f4..76ce7f4 100644 --- a/src/CBot/tests/TestCBot/scenarios/methode2.txt +++ b/src/CBot/tests/scenarios/methode2.txt diff --git a/src/CBot/tests/TestCBot/scenarios/mp1.txt b/src/CBot/tests/scenarios/mp1.txt index 599cfc4..599cfc4 100644 --- a/src/CBot/tests/TestCBot/scenarios/mp1.txt +++ b/src/CBot/tests/scenarios/mp1.txt diff --git a/src/CBot/tests/TestCBot/scenarios/mp2.txt b/src/CBot/tests/scenarios/mp2.txt index 1c2972c..1c2972c 100644 --- a/src/CBot/tests/TestCBot/scenarios/mp2.txt +++ b/src/CBot/tests/scenarios/mp2.txt diff --git a/src/CBot/tests/TestCBot/scenarios/mw.txt b/src/CBot/tests/scenarios/mw.txt index c237670..c237670 100644 --- a/src/CBot/tests/TestCBot/scenarios/mw.txt +++ b/src/CBot/tests/scenarios/mw.txt diff --git a/src/CBot/tests/TestCBot/scenarios/null.txt b/src/CBot/tests/scenarios/null.txt index ae76b74..ae76b74 100644 --- a/src/CBot/tests/TestCBot/scenarios/null.txt +++ b/src/CBot/tests/scenarios/null.txt diff --git a/src/CBot/tests/TestCBot/scenarios/opnew.txt b/src/CBot/tests/scenarios/opnew.txt index 7d6838c..7d6838c 100644 --- a/src/CBot/tests/TestCBot/scenarios/opnew.txt +++ b/src/CBot/tests/scenarios/opnew.txt diff --git a/src/CBot/tests/TestCBot/scenarios/plante.txt b/src/CBot/tests/scenarios/plante.txt index 363461b..363461b 100644 --- a/src/CBot/tests/TestCBot/scenarios/plante.txt +++ b/src/CBot/tests/scenarios/plante.txt diff --git a/src/CBot/tests/TestCBot/scenarios/pointer.txt b/src/CBot/tests/scenarios/pointer.txt index 2d4d907..2d4d907 100644 --- a/src/CBot/tests/TestCBot/scenarios/pointer.txt +++ b/src/CBot/tests/scenarios/pointer.txt diff --git a/src/CBot/tests/TestCBot/scenarios/postinc.txt b/src/CBot/tests/scenarios/postinc.txt index cdf6ab5..cdf6ab5 100644 --- a/src/CBot/tests/TestCBot/scenarios/postinc.txt +++ b/src/CBot/tests/scenarios/postinc.txt diff --git a/src/CBot/tests/TestCBot/scenarios/radar.txt b/src/CBot/tests/scenarios/radar.txt index 09d84a2..09d84a2 100644 --- a/src/CBot/tests/TestCBot/scenarios/radar.txt +++ b/src/CBot/tests/scenarios/radar.txt diff --git a/src/CBot/tests/TestCBot/scenarios/solution.txt b/src/CBot/tests/scenarios/solution.txt index f78cf12..f78cf12 100644 --- a/src/CBot/tests/TestCBot/scenarios/solution.txt +++ b/src/CBot/tests/scenarios/solution.txt diff --git a/src/CBot/tests/TestCBot/scenarios/test.txt b/src/CBot/tests/scenarios/test.txt index a912415..0693994 100644 --- a/src/CBot/tests/TestCBot/scenarios/test.txt +++ b/src/CBot/tests/scenarios/test.txt @@ -2,7 +2,7 @@ extern public void x() {
float a= 1, b = 2;
a = b * ( 2 + 2 );
-// print (a);
+ print (a);
a += 4;
-// print (a);
-}
\ No newline at end of file + print (a);
+}
diff --git a/src/CBot/tests/TestCBot/scenarios/test23.txt b/src/CBot/tests/scenarios/test23.txt index d6e1ddd..d6e1ddd 100644 --- a/src/CBot/tests/TestCBot/scenarios/test23.txt +++ b/src/CBot/tests/scenarios/test23.txt diff --git a/src/CBot/tests/TestCBot/scenarios/testmw.txt b/src/CBot/tests/scenarios/testmw.txt index 6570f6d..6570f6d 100644 --- a/src/CBot/tests/TestCBot/scenarios/testmw.txt +++ b/src/CBot/tests/scenarios/testmw.txt diff --git a/src/CBot/tests/TestCBot/scenarios/this.txt b/src/CBot/tests/scenarios/this.txt index b8a9e04..b8a9e04 100644 --- a/src/CBot/tests/TestCBot/scenarios/this.txt +++ b/src/CBot/tests/scenarios/this.txt diff --git a/src/CBot/tests/TestCBot/scenarios/tt.txt b/src/CBot/tests/scenarios/tt.txt index cd13c9d..cd13c9d 100644 --- a/src/CBot/tests/TestCBot/scenarios/tt.txt +++ b/src/CBot/tests/scenarios/tt.txt diff --git a/src/CBot/tests/TestCBot/scenarios/tt2.txt b/src/CBot/tests/scenarios/tt2.txt index ad9dc1d..ad9dc1d 100644 --- a/src/CBot/tests/TestCBot/scenarios/tt2.txt +++ b/src/CBot/tests/scenarios/tt2.txt diff --git a/src/CBot/tests/TestCBot/scenarios/vide.txt b/src/CBot/tests/scenarios/vide.txt index e69de29..e69de29 100644 --- a/src/CBot/tests/TestCBot/scenarios/vide.txt +++ b/src/CBot/tests/scenarios/vide.txt diff --git a/src/CBot/tests/TestCBot/scenarios/zz.txt b/src/CBot/tests/scenarios/zz.txt index da764ac..da764ac 100644 --- a/src/CBot/tests/TestCBot/scenarios/zz.txt +++ b/src/CBot/tests/scenarios/zz.txt diff --git a/src/object/auto/auto.cpp b/src/object/auto/auto.cpp index a376ce7..d112721 100644 --- a/src/object/auto/auto.cpp +++ b/src/object/auto/auto.cpp @@ -91,21 +91,21 @@ void CAuto::Start(int param) } -// Give a type. +// Gete a type. bool CAuto::SetType(ObjectType type) { return false; } -// Gives a value. +// Getes a value. bool CAuto::SetValue(int rank, float value) { return false; } -// Gives the string. +// Getes the string. bool CAuto::SetString(char *string) { diff --git a/src/object/auto/autoegg.cpp b/src/object/auto/autoegg.cpp index b1e1c03..4b999a9 100644 --- a/src/object/auto/autoegg.cpp +++ b/src/object/auto/autoegg.cpp @@ -115,7 +115,7 @@ void CAutoEgg::Init() } -// Gives a value. +// Getes a value. bool CAutoEgg::SetType(ObjectType type) { @@ -123,7 +123,7 @@ bool CAutoEgg::SetType(ObjectType type) return true; } -// Gives a value. +// Getes a value. bool CAutoEgg::SetValue(int rank, float value) { @@ -132,7 +132,7 @@ bool CAutoEgg::SetValue(int rank, float value) return true; } -// Gives the string. +// Getes the string. bool CAutoEgg::SetString(char *string) { diff --git a/src/object/motion/motion.cpp b/src/object/motion/motion.cpp index e0dffc4..6278627 100644 --- a/src/object/motion/motion.cpp +++ b/src/object/motion/motion.cpp @@ -201,7 +201,7 @@ bool CMotion::Read(char *line) } -// Gives the linear vibration. +// Getes the linear vibration. void CMotion::SetLinVibration(Math::Vector dir) { @@ -213,7 +213,7 @@ Math::Vector CMotion::RetLinVibration() return m_linVibration; } -// Gives the circular vibration. +// Getes the circular vibration. void CMotion::SetCirVibration(Math::Vector dir) { @@ -225,7 +225,7 @@ Math::Vector CMotion::RetCirVibration() return m_cirVibration; } -// Gives the tilt. +// Getes the tilt. void CMotion::SetInclinaison(Math::Vector dir) { diff --git a/src/object/motion/motiontoto.cpp b/src/object/motion/motiontoto.cpp index 7654159..6d39b36 100644 --- a/src/object/motion/motiontoto.cpp +++ b/src/object/motion/motiontoto.cpp @@ -219,7 +219,7 @@ void CMotionToto::StopDisplayInfo() m_bQuickPos = true; } -// Gives the position of the mouse. +// Getes the position of the mouse. void CMotionToto::SetMousePos(Math::Point pos) { diff --git a/src/object/object.cpp b/src/object/object.cpp index 18e843b..e2e52e5 100644 --- a/src/object/object.cpp +++ b/src/object/object.cpp @@ -131,83 +131,83 @@ void uObject(CBotVar* botThis, void* user) physics = object->RetPhysics(); // Updates the object's type. - pVar = botThis->GivItemList(); // "category" + pVar = botThis->GetItemList(); // "category" type = object->RetType(); pVar->SetValInt(type, object->RetName()); // Updates the position of the object. - pVar = pVar->GivNext(); // "position" + pVar = pVar->GetNext(); // "position" if ( object->RetTruck() == 0 ) { pos = object->RetPosition(0); pos.y -= object->RetWaterLevel(); // relative to sea level! - pSub = pVar->GivItemList(); // "x" + pSub = pVar->GetItemList(); // "x" pSub->SetValFloat(pos.x/g_unit); - pSub = pSub->GivNext(); // "y" + pSub = pSub->GetNext(); // "y" pSub->SetValFloat(pos.z/g_unit); - pSub = pSub->GivNext(); // "z" + pSub = pSub->GetNext(); // "z" pSub->SetValFloat(pos.y/g_unit); } else // object transported? { - pSub = pVar->GivItemList(); // "x" + pSub = pVar->GetItemList(); // "x" pSub->SetInit(IS_NAN); - pSub = pSub->GivNext(); // "y" + pSub = pSub->GetNext(); // "y" pSub->SetInit(IS_NAN); - pSub = pSub->GivNext(); // "z" + pSub = pSub->GetNext(); // "z" pSub->SetInit(IS_NAN); } // Updates the angle. pos = object->RetAngle(0); pos += object->RetInclinaison(); - pVar = pVar->GivNext(); // "orientation" + pVar = pVar->GetNext(); // "orientation" pVar->SetValFloat(360.0f-Math::Mod(pos.y*180.0f/Math::PI, 360.0f)); - pVar = pVar->GivNext(); // "pitch" + pVar = pVar->GetNext(); // "pitch" pVar->SetValFloat(pos.z*180.0f/Math::PI); - pVar = pVar->GivNext(); // "roll" + pVar = pVar->GetNext(); // "roll" pVar->SetValFloat(pos.x*180.0f/Math::PI); // Updates the energy level of the object. - pVar = pVar->GivNext(); // "energyLevel" + pVar = pVar->GetNext(); // "energyLevel" value = object->RetEnergy(); pVar->SetValFloat(value); // Updates the shield level of the object. - pVar = pVar->GivNext(); // "shieldLevel" + pVar = pVar->GetNext(); // "shieldLevel" value = object->RetShield(); pVar->SetValFloat(value); // Updates the temperature of the reactor. - pVar = pVar->GivNext(); // "temperature" + pVar = pVar->GetNext(); // "temperature" if ( physics == 0 ) value = 0.0f; else value = 1.0f-physics->RetReactorRange(); pVar->SetValFloat(value); // Updates the height above the ground. - pVar = pVar->GivNext(); // "altitude" + pVar = pVar->GetNext(); // "altitude" if ( physics == 0 ) value = 0.0f; else value = physics->RetFloorHeight(); pVar->SetValFloat(value/g_unit); // Updates the lifetime of the object. - pVar = pVar->GivNext(); // "lifeTime" + pVar = pVar->GetNext(); // "lifeTime" value = object->RetAbsTime(); pVar->SetValFloat(value); // Updates the material of the object. - pVar = pVar->GivNext(); // "material" + pVar = pVar->GetNext(); // "material" iValue = object->RetMaterial(); pVar->SetValInt(iValue); // Updates the type of battery. - pVar = pVar->GivNext(); // "energyCell" + pVar = pVar->GetNext(); // "energyCell" power = object->RetPower(); if ( power == 0 ) pVar->SetPointer(0); else pVar->SetPointer(power->RetBotVar()); // Updates the transported object's type. - pVar = pVar->GivNext(); // "load" + pVar = pVar->GetNext(); // "load" fret = object->RetFret(); if ( fret == 0 ) pVar->SetPointer(0); else pVar->SetPointer(fret->RetBotVar()); @@ -1468,7 +1468,7 @@ void CObject::FloorAdjust() } -// Gives the linear vibration. +// Getes the linear vibration. void CObject::SetLinVibration(Math::Vector dir) { @@ -1486,7 +1486,7 @@ Math::Vector CObject::RetLinVibration() return m_linVibration; } -// Gives the circular vibration. +// Getes the circular vibration. void CObject::SetCirVibration(Math::Vector dir) { @@ -1504,7 +1504,7 @@ Math::Vector CObject::RetCirVibration() return m_cirVibration; } -// Gives the inclination. +// Getes the inclination. void CObject::SetInclinaison(Math::Vector dir) { @@ -1523,7 +1523,7 @@ Math::Vector CObject::RetInclinaison() } -// Gives the position of center of the object. +// Getes the position of center of the object. void CObject::SetPosition(int part, const Math::Vector &pos) { @@ -1649,7 +1649,7 @@ Math::Vector CObject::RetPosition(int part) return m_objectPart[part].position; } -// Gives the rotation around three axis. +// Getes the rotation around three axis. void CObject::SetAngle(int part, const Math::Vector &angle) { @@ -1667,7 +1667,7 @@ Math::Vector CObject::RetAngle(int part) return m_objectPart[part].angle; } -// Gives the rotation about the axis Y. +// Getes the rotation about the axis Y. void CObject::SetAngleY(int part, float angle) { @@ -1680,7 +1680,7 @@ void CObject::SetAngleY(int part, float angle) } } -// Gives the rotation about the axis X. +// Getes the rotation about the axis X. void CObject::SetAngleX(int part, float angle) { @@ -1688,7 +1688,7 @@ void CObject::SetAngleX(int part, float angle) m_objectPart[part].bRotate = true; // it will recalculate the matrices } -// Gives the rotation about the axis Z. +// Getes the rotation about the axis Z. void CObject::SetAngleZ(int part, float angle) { @@ -1712,7 +1712,7 @@ float CObject::RetAngleZ(int part) } -// Gives the global zoom. +// Getes the global zoom. void CObject::SetZoom(int part, float zoom) { @@ -7431,7 +7431,7 @@ void CObject::UpdateSelectParticule() } -// Gives the pointer to the current script execution. +// Getes the pointer to the current script execution. void CObject::SetRunScript(CScript* script) { @@ -7498,7 +7498,7 @@ int CObject::RetDefRank() } -// Gives the object name for the tooltip. +// Getes the object name for the tooltip. bool CObject::GetTooltipName(char* name) { diff --git a/src/object/robotmain.cpp b/src/object/robotmain.cpp index 668be87..83eca52 100644 --- a/src/object/robotmain.cpp +++ b/src/object/robotmain.cpp @@ -145,25 +145,25 @@ bool rfconstruct (CBotVar* pThis, CBotVar* pVar, CBotVar* pResult, int& Exceptio if ( pVar == NULL ) return true; // must be a character string - if ( pVar->GivType() != CBotTypString ) { Exception = CBotErrBadString; return false; } + if ( pVar->GetType() != CBotTypString ) { Exception = CBotErrBadString; return false; } - CBotString filename = pVar->GivValString(); + CBotString filename = pVar->GetValString(); PrepareFilename(filename); // there may be a second parameter - pVar = pVar->GivNext(); + pVar = pVar->GetNext(); if ( pVar != NULL ) { // recover mode - mode = pVar->GivValString(); + mode = pVar->GetValString(); if ( mode != "r" && mode != "w" ) { Exception = CBotErrBadParam; return false; } // no third parameter - if ( pVar->GivNext() != NULL ) { Exception = CBotErrOverParam; return false; } + if ( pVar->GetNext() != NULL ) { Exception = CBotErrOverParam; return false; } } // saves the file name - pVar = pThis->GivItem("filename"); + pVar = pThis->GetItem("filename"); pVar->SetValString(filename); if ( ! mode.IsEmpty() ) @@ -175,7 +175,7 @@ bool rfconstruct (CBotVar* pThis, CBotVar* pVar, CBotVar* pResult, int& Exceptio m_CompteurFileOpen ++; // save the channel file - pVar = pThis->GivItem("handle"); + pVar = pThis->GetItem("handle"); pVar->SetValInt((long)pFile); } @@ -189,18 +189,18 @@ CBotTypResult cfconstruct (CBotVar* pThis, CBotVar* &pVar) if ( pVar == NULL ) return CBotTypResult( 0 ); // must be a character string - if ( pVar->GivType() != CBotTypString ) + if ( pVar->GetType() != CBotTypString ) return CBotTypResult( CBotErrBadString ); // there may be a second parameter - pVar = pVar->GivNext(); + pVar = pVar->GetNext(); if ( pVar != NULL ) { // which must be a string - if ( pVar->GivType() != CBotTypString ) + if ( pVar->GetType() != CBotTypString ) return CBotTypResult( CBotErrBadString ); // no third parameter - if ( pVar->GivNext() != NULL ) return CBotTypResult( CBotErrOverParam ); + if ( pVar->GetNext() != NULL ) return CBotTypResult( CBotErrOverParam ); } // the result is void (constructor) @@ -214,12 +214,12 @@ CBotTypResult cfconstruct (CBotVar* pThis, CBotVar* &pVar) bool rfdestruct (CBotVar* pThis, CBotVar* pVar, CBotVar* pResult, int& Exception) { // retrieve the item "handle" - pVar = pThis->GivItem("handle"); + pVar = pThis->GetItem("handle"); // don't open? no problem :) - if ( pVar->GivInit() != IS_DEF) return true; + if ( pVar->GetInit() != IS_DEF) return true; - FILE* pFile= (FILE*)pVar->GivValInt(); + FILE* pFile= (FILE*)pVar->GetValInt(); fclose(pFile); m_CompteurFileOpen --; @@ -239,38 +239,38 @@ bool rfopen (CBotVar* pThis, CBotVar* pVar, CBotVar* pResult, int& Exception) if ( pVar == NULL ) { Exception = CBotErrLowParam; return false; } // which must be a character string - if ( pVar->GivType() != CBotTypString ) { Exception = CBotErrBadString; return false; } + if ( pVar->GetType() != CBotTypString ) { Exception = CBotErrBadString; return false; } // There may be a second parameter - if ( pVar->GivNext() != NULL ) + if ( pVar->GetNext() != NULL ) { // if the first parameter is the file name - CBotString filename = pVar->GivValString(); + CBotString filename = pVar->GetValString(); PrepareFilename(filename); // saves the file name - CBotVar* pVar2 = pThis->GivItem("filename"); + CBotVar* pVar2 = pThis->GetItem("filename"); pVar2->SetValString(filename); // next parameter is the mode - pVar = pVar -> GivNext(); + pVar = pVar -> GetNext(); } - CBotString mode = pVar->GivValString(); + CBotString mode = pVar->GetValString(); if ( mode != "r" && mode != "w" ) { Exception = CBotErrBadParam; return false; } // no third parameter - if ( pVar->GivNext() != NULL ) { Exception = CBotErrOverParam; return false; } + if ( pVar->GetNext() != NULL ) { Exception = CBotErrOverParam; return false; } // retrieve the item "handle" - pVar = pThis->GivItem("handle"); + pVar = pThis->GetItem("handle"); // which must not be initialized - if ( pVar->GivInit() == IS_DEF) { Exception = CBotErrFileOpen; return false; } + if ( pVar->GetInit() == IS_DEF) { Exception = CBotErrFileOpen; return false; } // file contains the name - pVar = pThis->GivItem("filename"); - CBotString filename = pVar->GivValString(); + pVar = pThis->GetItem("filename"); + CBotString filename = pVar->GetValString(); PrepareFilename(filename); // if the name was h.filename attribute = "..."; @@ -285,7 +285,7 @@ bool rfopen (CBotVar* pThis, CBotVar* pVar, CBotVar* pResult, int& Exception) m_CompteurFileOpen ++; // Registered the channel file - pVar = pThis->GivItem("handle"); + pVar = pThis->GetItem("handle"); pVar->SetValInt((long)pFile); pResult->SetValInt(true); @@ -299,19 +299,19 @@ CBotTypResult cfopen (CBotVar* pThis, CBotVar* &pVar) if ( pVar == NULL ) return CBotTypResult( CBotErrLowParam ); // which must be a string - if ( pVar->GivType() != CBotTypString ) + if ( pVar->GetType() != CBotTypString ) return CBotTypResult( CBotErrBadString ); // there may be a second parameter - pVar = pVar->GivNext(); + pVar = pVar->GetNext(); if ( pVar != NULL ) { // which must be a string - if ( pVar->GivType() != CBotTypString ) + if ( pVar->GetType() != CBotTypString ) return CBotTypResult( CBotErrBadString ); // no third parameter - if ( pVar->GivNext() != NULL ) return CBotTypResult( CBotErrOverParam ); + if ( pVar->GetNext() != NULL ) return CBotTypResult( CBotErrOverParam ); } // the result is bool @@ -328,11 +328,11 @@ bool rfclose (CBotVar* pThis, CBotVar* pVar, CBotVar* pResult, int& Exception) if ( pVar != NULL ) return CBotErrOverParam; // retrieve the item "handle" - pVar = pThis->GivItem("handle"); + pVar = pThis->GetItem("handle"); - if ( pVar->GivInit() != IS_DEF) { Exception = CBotErrNotOpen; return false; } + if ( pVar->GetInit() != IS_DEF) { Exception = CBotErrNotOpen; return false; } - FILE* pFile= (FILE*)pVar->GivValInt(); + FILE* pFile= (FILE*)pVar->GetValInt(); fclose(pFile); m_CompteurFileOpen --; @@ -360,16 +360,16 @@ bool rfwrite (CBotVar* pThis, CBotVar* pVar, CBotVar* pResult, int& Exception) if ( pVar == NULL ) { Exception = CBotErrLowParam; return false; } // which must be a character string - if ( pVar->GivType() != CBotTypString ) { Exception = CBotErrBadString; return false; } + if ( pVar->GetType() != CBotTypString ) { Exception = CBotErrBadString; return false; } - CBotString param = pVar->GivValString(); + CBotString param = pVar->GetValString(); // retrieve the item "handle" - pVar = pThis->GivItem("handle"); + pVar = pThis->GetItem("handle"); - if ( pVar->GivInit() != IS_DEF) { Exception = CBotErrNotOpen; return false; } + if ( pVar->GetInit() != IS_DEF) { Exception = CBotErrNotOpen; return false; } - FILE* pFile= (FILE*)pVar->GivValInt(); + FILE* pFile= (FILE*)pVar->GetValInt(); int res = fputs(param+CBotString("\n"), pFile); @@ -386,10 +386,10 @@ CBotTypResult cfwrite (CBotVar* pThis, CBotVar* &pVar) if ( pVar == NULL ) return CBotTypResult( CBotErrLowParam ); // which must be a character string - if ( pVar->GivType() != CBotTypString ) return CBotTypResult( CBotErrBadString ); + if ( pVar->GetType() != CBotTypString ) return CBotTypResult( CBotErrBadString ); // no other parameter - if ( pVar->GivNext() != NULL ) return CBotTypResult( CBotErrOverParam ); + if ( pVar->GetNext() != NULL ) return CBotTypResult( CBotErrOverParam ); // the function returns a void result return CBotTypResult( 0 ); @@ -404,11 +404,11 @@ bool rfread (CBotVar* pThis, CBotVar* pVar, CBotVar* pResult, int& Exception) if ( pVar != NULL ) { Exception = CBotErrOverParam; return false; } // retrieve the item "handle" - pVar = pThis->GivItem("handle"); + pVar = pThis->GetItem("handle"); - if ( pVar->GivInit() != IS_DEF) { Exception = CBotErrNotOpen; return false; } + if ( pVar->GetInit() != IS_DEF) { Exception = CBotErrNotOpen; return false; } - FILE* pFile= (FILE*)pVar->GivValInt(); + FILE* pFile= (FILE*)pVar->GetValInt(); char chaine[2000]; int i; @@ -445,11 +445,11 @@ bool rfeof (CBotVar* pThis, CBotVar* pVar, CBotVar* pResult, int& Exception) if ( pVar != NULL ) { Exception = CBotErrOverParam; return false; } // retrieve the item "handle" - pVar = pThis->GivItem("handle"); + pVar = pThis->GetItem("handle"); - if ( pVar->GivInit() != IS_DEF) { Exception = CBotErrNotOpen; return false; } + if ( pVar->GetInit() != IS_DEF) { Exception = CBotErrNotOpen; return false; } - FILE* pFile= (FILE*)pVar->GivValInt(); + FILE* pFile= (FILE*)pVar->GetValInt(); pResult->SetValInt( feof( pFile ) ); @@ -516,13 +516,13 @@ CBotTypResult cPoint(CBotVar* pThis, CBotVar* &var) if ( var == NULL ) return CBotTypResult(0); // ok if no parameter // First parameter (x): - if ( var->GivType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum); - var = var->GivNext(); + if ( var->GetType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum); + var = var->GetNext(); // Second parameter (y): if ( var == NULL ) return CBotTypResult(CBotErrLowParam); - if ( var->GivType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum); - var = var->GivNext(); + if ( var->GetType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum); + var = var->GetNext(); // Third parameter (z): if ( var == NULL ) // only 2 parameters? @@ -530,8 +530,8 @@ CBotTypResult cPoint(CBotVar* pThis, CBotVar* &var) return CBotTypResult(0); // this function returns void } - if ( var->GivType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum); - var = var->GivNext(); + if ( var->GetType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum); + var = var->GetNext(); if ( var != NULL ) return CBotTypResult(CBotErrOverParam); return CBotTypResult(0); // this function returns void @@ -545,49 +545,49 @@ bool rPoint(CBotVar* pThis, CBotVar* var, CBotVar* pResult, int& Exception) if ( var == NULL ) return true; // constructor with no parameters is ok - if ( var->GivType() > CBotTypDouble ) + if ( var->GetType() > CBotTypDouble ) { Exception = CBotErrBadNum; return false; } - pX = pThis->GivItem("x"); + pX = pThis->GetItem("x"); if ( pX == NULL ) { Exception = CBotErrUndefItem; return false; } - pX->SetValFloat( var->GivValFloat() ); - var = var->GivNext(); + pX->SetValFloat( var->GetValFloat() ); + var = var->GetNext(); if ( var == NULL ) { Exception = CBotErrLowParam; return false; } - if ( var->GivType() > CBotTypDouble ) + if ( var->GetType() > CBotTypDouble ) { Exception = CBotErrBadNum; return false; } - pY = pThis->GivItem("y"); + pY = pThis->GetItem("y"); if ( pY == NULL ) { Exception = CBotErrUndefItem; return false; } - pY->SetValFloat( var->GivValFloat() ); - var = var->GivNext(); + pY->SetValFloat( var->GetValFloat() ); + var = var->GetNext(); if ( var == NULL ) { return true; // ok with only two parameters } - pZ = pThis->GivItem("z"); + pZ = pThis->GetItem("z"); if ( pZ == NULL ) { Exception = CBotErrUndefItem; return false; } - pZ->SetValFloat( var->GivValFloat() ); - var = var->GivNext(); + pZ->SetValFloat( var->GetValFloat() ); + var = var->GetNext(); if ( var != NULL ) { @@ -6451,7 +6451,7 @@ bool CRobotMain::IOWriteScene(char *filename, char *filecbot, char *info) version = 1; fWrite(&version, sizeof(long), 1, file); // version of COLOBOT - version = CBotProgram::GivVersion(); + version = CBotProgram::GetVersion(); fWrite(&version, sizeof(long), 1, file); // version of CBOT objRank = 0; @@ -6687,7 +6687,7 @@ CObject* CRobotMain::IOReadScene(char *filename, char *filecbot) if ( version == 1 ) { fRead(&version, sizeof(long), 1, file); // version of CBOT - if ( version == CBotProgram::GivVersion() ) + if ( version == CBotProgram::GetVersion() ) { objRank = 0; for ( i=0 ; i<1000000 ; i++ ) @@ -7200,7 +7200,7 @@ void CRobotMain::SetGamerName(char *name) ReadFreeParam(); } -// Gives the player's name. +// Getes the player's name. char* CRobotMain::RetGamerName() { |