[colobot] 163/377: Unified CBot error naming
Didier Raboud
odyx at moszumanska.debian.org
Wed Mar 30 13:34:11 UTC 2016
This is an automated email from the git hooks/post-receive script.
odyx pushed a commit to branch debian/master
in repository colobot.
commit 5db1254dd8b71a2a5d48dead9cf4e7beb8e21455
Author: krzys-h <krzys_h at interia.pl>
Date: Sun Dec 20 19:01:03 2015 +0100
Unified CBot error naming
---
po/colobot.pot | 3 +
po/de.po | 6 +-
po/fr.po | 6 +-
po/pl.po | 6 +-
po/ru.po | 6 +-
src/CBot/CBotCStack.cpp | 2 +-
src/CBot/CBotCall.cpp | 2 +-
src/CBot/CBotClass.cpp | 26 +++----
src/CBot/CBotDefParam.cpp | 8 +--
src/CBot/CBotDefines.h | 81 ++--------------------
src/CBot/CBotInstr/CBotBlock.cpp | 4 +-
src/CBot/CBotInstr/CBotBoolExpr.cpp | 2 +-
src/CBot/CBotInstr/CBotBoolean.cpp | 8 +--
src/CBot/CBotInstr/CBotBreak.cpp | 6 +-
src/CBot/CBotInstr/CBotCase.cpp | 4 +-
src/CBot/CBotInstr/CBotCatch.cpp | 6 +-
src/CBot/CBotInstr/CBotClassInst.cpp | 18 ++---
src/CBot/CBotInstr/CBotCondition.cpp | 4 +-
src/CBot/CBotInstr/CBotDo.cpp | 4 +-
src/CBot/CBotInstr/CBotExprUnaire.cpp | 2 +-
src/CBot/CBotInstr/CBotExprVar.cpp | 16 ++---
src/CBot/CBotInstr/CBotExpression.cpp | 16 ++---
src/CBot/CBotInstr/CBotFieldExpr.cpp | 8 +--
src/CBot/CBotInstr/CBotFloat.cpp | 8 +--
src/CBot/CBotInstr/CBotFor.cpp | 8 +--
src/CBot/CBotInstr/CBotFunction.cpp | 36 +++++-----
src/CBot/CBotInstr/CBotIString.cpp | 6 +-
src/CBot/CBotInstr/CBotIndexExpr.cpp | 6 +-
src/CBot/CBotInstr/CBotInstArray.cpp | 6 +-
src/CBot/CBotInstr/CBotInstr.cpp | 14 ++--
src/CBot/CBotInstr/CBotInstrCall.cpp | 4 +-
src/CBot/CBotInstr/CBotInstrMethode.cpp | 2 +-
src/CBot/CBotInstr/CBotInstrUtils.cpp | 4 +-
src/CBot/CBotInstr/CBotInt.cpp | 8 +--
src/CBot/CBotInstr/CBotLeftExpr.cpp | 16 ++---
src/CBot/CBotInstr/CBotLeftExprVar.cpp | 2 +-
src/CBot/CBotInstr/CBotListArray.cpp | 6 +-
src/CBot/CBotInstr/CBotListInstr.cpp | 2 +-
src/CBot/CBotInstr/CBotNew.cpp | 6 +-
src/CBot/CBotInstr/CBotParExpr.cpp | 6 +-
src/CBot/CBotInstr/CBotPostIncExpr.cpp | 4 +-
src/CBot/CBotInstr/CBotPreIncExpr.cpp | 4 +-
src/CBot/CBotInstr/CBotReturn.cpp | 6 +-
src/CBot/CBotInstr/CBotSwitch.cpp | 14 ++--
src/CBot/CBotInstr/CBotThrow.cpp | 4 +-
src/CBot/CBotInstr/CBotTwoOpExpr.cpp | 14 ++--
src/CBot/CBotProgram.cpp | 34 ++++-----
src/CBot/CBotStack.cpp | 4 +-
src/CBot/CBotUtils.cpp | 2 +-
src/CBot/CBotVar/CBotVarFloat.cpp | 4 +-
src/CBot/CBotVar/CBotVarInt.cpp | 4 +-
src/CBot/stdlib/Compilation.cpp | 50 +++++++-------
src/CBot/stdlib/StringFunctions.cpp | 66 +++++++++---------
src/common/restext.cpp | 118 ++++++++++++++++----------------
54 files changed, 325 insertions(+), 387 deletions(-)
diff --git a/po/colobot.pot b/po/colobot.pot
index 28315a3..eb7538a 100644
--- a/po/colobot.pot
+++ b/po/colobot.pot
@@ -1622,6 +1622,9 @@ msgstr ""
msgid "Instruction \"case\" outside a block \"switch\""
msgstr ""
+msgid "Instructions after the final closing brace"
+msgstr ""
+
msgid "End of block missing"
msgstr ""
diff --git a/po/de.po b/po/de.po
index ad1ac8c..05f592f 100644
--- a/po/de.po
+++ b/po/de.po
@@ -736,6 +736,9 @@ msgstr "Anweisung \"else\" ohne vorhergehende Anweisung \"if\""
msgid "Instructions (\\key help;)"
msgstr "Anweisungen (\\key help;)"
+msgid "Instructions after the final closing brace"
+msgstr "Hier ist eine Anweisung nach dem Ende des Programms"
+
msgid "Instructions for the mission (\\key help;)"
msgstr "Anweisungen über die Mission(\\key help;)"
@@ -1863,9 +1866,6 @@ msgstr "www.epsitec.com"
#~ msgid "Ground inappropriate"
#~ msgstr "Boden ungeeignet"
-#~ msgid "Instructions after the final closing brace"
-#~ msgstr "Hier ist eine Anweisung nach dem Ende des Programms"
-
#~ msgid "Key word help\\More detailed help about key words"
#~ msgstr "Hilfe über Begriff\\Hilfe über einen Begriff"
diff --git a/po/fr.po b/po/fr.po
index 6ed78e6..df972dc 100644
--- a/po/fr.po
+++ b/po/fr.po
@@ -730,6 +730,9 @@ msgstr "Instruction \"else\" sans \"if\" correspondant"
msgid "Instructions (\\key help;)"
msgstr "Instructions (\\key help;)"
+msgid "Instructions after the final closing brace"
+msgstr "Instructions après la fin"
+
msgid "Instructions for the mission (\\key help;)"
msgstr "Instructions sur la mission (\\key help;)"
@@ -1850,9 +1853,6 @@ msgstr "www.epsitec.com"
#~ msgid "Ground inappropriate"
#~ msgstr "Terrain inadapté"
-#~ msgid "Instructions after the final closing brace"
-#~ msgstr "Instructions après la fin"
-
#~ msgid "Key word help\\More detailed help about key words"
#~ msgstr "Instructions mot-clé\\Explication sur le mot-clé"
diff --git a/po/pl.po b/po/pl.po
index 4180c41..f4cbf2c 100644
--- a/po/pl.po
+++ b/po/pl.po
@@ -737,6 +737,9 @@ msgstr "Polecenie \"else\" bez wystąpienia \"if\" "
msgid "Instructions (\\key help;)"
msgstr "Rozkazy (\\key help;)"
+msgid "Instructions after the final closing brace"
+msgstr "Polecenie po końcowej klamrze zamykającej"
+
msgid "Instructions for the mission (\\key help;)"
msgstr "Rozkazy dotyczące misji (\\key help;)"
@@ -1841,9 +1844,6 @@ msgstr "www.epsitec.com"
#~ msgid "Ground inappropriate"
#~ msgstr "Nieodpowiedni teren"
-#~ msgid "Instructions after the final closing brace"
-#~ msgstr "Polecenie po końcowej klamrze zamykającej"
-
#~ msgid "Key word help\\More detailed help about key words"
#~ msgstr ""
#~ "Pomoc dot. słów kluczowych\\Dokładniejsza pomoc na temat słów kluczowych"
diff --git a/po/ru.po b/po/ru.po
index 2248e64..c29a8bf 100644
--- a/po/ru.po
+++ b/po/ru.po
@@ -729,6 +729,9 @@ msgstr "Инструкция \"else\" без \"if\" "
msgid "Instructions (\\key help;)"
msgstr "Инструкции (\\key help;)"
+msgid "Instructions after the final closing brace"
+msgstr "Инструкция после последней закрывающей фигурной скобки"
+
msgid "Instructions for the mission (\\key help;)"
msgstr "Инструкции для миссии (\\key help;)"
@@ -1854,9 +1857,6 @@ msgstr "www.epsitec.com"
#~ msgid "Ground inappropriate"
#~ msgstr "Земля не подходит"
-#~ msgid "Instructions after the final closing brace"
-#~ msgstr "Инструкция после последней закрывающей фигурной скобки"
-
#~ msgid "Key word help\\More detailed help about key words"
#~ msgstr "Помощь по командам\\Более подробная справку по командам"
diff --git a/src/CBot/CBotCStack.cpp b/src/CBot/CBotCStack.cpp
index df1f563..6d8b027 100644
--- a/src/CBot/CBotCStack.cpp
+++ b/src/CBot/CBotCStack.cpp
@@ -257,7 +257,7 @@ bool CBotCStack::NextToken(CBotToken* &p)
p = p->GetNext();
if (p!=nullptr) return true;
- SetError(TX_ENDOF, pp->GetEnd());
+ SetError(CBotErrNoTerminator, pp->GetEnd());
return false;
}
diff --git a/src/CBot/CBotCall.cpp b/src/CBot/CBotCall.cpp
index f391c3d..8f4cfe5 100644
--- a/src/CBot/CBotCall.cpp
+++ b/src/CBot/CBotCall.cpp
@@ -222,7 +222,7 @@ fund:
if ( rettype.GetType() > 0 && pResult == nullptr )
{
- pStack->SetError(TX_NORETVAL, token);
+ pStack->SetError(CBotErrNoRetVal, token);
}
nIdent = pt->m_nFuncIdent;
return true;
diff --git a/src/CBot/CBotClass.cpp b/src/CBot/CBotClass.cpp
index e7d6719..48e7439 100644
--- a/src/CBot/CBotClass.cpp
+++ b/src/CBot/CBotClass.cpp
@@ -393,7 +393,7 @@ CBotTypResult CBotClass::CompileMethode(const std::string& name,
// find the methods declared by user
r = m_pMethod->CompileCall(name, ppParams, nIdent);
- if ( r.Eq(TX_UNDEFCALL) && m_pParent != nullptr )
+ if ( r.Eq(CBotErrUndefCall) && m_pParent != nullptr )
return m_pParent->m_pMethod->CompileCall(name, ppParams, nIdent);
return r;
}
@@ -535,7 +535,7 @@ CBotClass* CBotClass::Compile1(CBotToken* &p, CBotCStack* pStack)
{
if ( !IsOfType(p, ID_PUBLIC) )
{
- pStack->SetError(TX_NOPUBLIC, p);
+ pStack->SetError(CBotErrNoPublic, p);
return nullptr;
}
@@ -546,7 +546,7 @@ CBotClass* CBotClass::Compile1(CBotToken* &p, CBotCStack* pStack)
CBotClass* pOld = CBotClass::Find(name);
if ( pOld != nullptr && pOld->m_IsDef )
{
- pStack->SetError( TX_REDEFCLASS, p );
+ pStack->SetError( CBotErrRedefClass, p );
return nullptr;
}
@@ -561,7 +561,7 @@ CBotClass* CBotClass::Compile1(CBotToken* &p, CBotCStack* pStack)
if (!IsOfType(p, TokenTypVar) || pPapa == nullptr )
{
- pStack->SetError( TX_NOCLASS, p );
+ pStack->SetError( CBotErrNotClass, p );
return nullptr;
}
}
@@ -571,7 +571,7 @@ CBotClass* CBotClass::Compile1(CBotToken* &p, CBotCStack* pStack)
if ( !IsOfType( p, ID_OPBLK) )
{
- pStack->SetError(TX_OPENBLK, p);
+ pStack->SetError(CBotErrOpenBlock, p);
return nullptr;
}
@@ -582,7 +582,7 @@ CBotClass* CBotClass::Compile1(CBotToken* &p, CBotCStack* pStack)
if (pStack->IsOk()) return classe;
}
- pStack->SetError(TX_ENDOF, p);
+ pStack->SetError(CBotErrNoTerminator, p);
return nullptr;
}
@@ -611,7 +611,7 @@ bool CBotClass::CompileDefItem(CBotToken* &p, CBotCStack* pStack, bool bSecond)
if ( type.Eq(-1) )
{
- pStack->SetError(TX_NOTYP, p);
+ pStack->SetError(CBotErrNoType, p);
return false;
}
@@ -636,14 +636,14 @@ bool CBotClass::CompileDefItem(CBotToken* &p, CBotCStack* pStack, bool bSecond)
if (!pStack->IsOk() || !IsOfType( p, ID_CLBRK ) )
{
- pStack->SetError(TX_CLBRK, p->GetStart());
+ pStack->SetError(CBotErrCloseIndex, p->GetStart());
return false;
}
/* CBotVar* pv = pStack->GetVar();
if ( pv->GetType()>= CBotTypBoolean )
{
- pStack->SetError(TX_BADTYPE, p->GetStart());
+ pStack->SetError(CBotErrBadType1, p->GetStart());
return false;
}*/
@@ -739,7 +739,7 @@ bool CBotClass::CompileDefItem(CBotToken* &p, CBotCStack* pStack, bool bSecond)
// definition of an element
if (type.Eq(0))
{
- pStack->SetError(TX_ENDOF, p);
+ pStack->SetError(CBotErrNoTerminator, p);
return false;
}
@@ -785,7 +785,7 @@ bool CBotClass::CompileDefItem(CBotToken* &p, CBotCStack* pStack, bool bSecond)
if ( IsOfType(p, ID_COMMA) ) continue;
if ( IsOfType(p, ID_SEP) ) break;
}
- pStack->SetError(TX_ENDOF, p);
+ pStack->SetError(CBotErrNoTerminator, p);
}
return pStack->IsOk();
}
@@ -812,7 +812,7 @@ CBotClass* CBotClass::Compile(CBotToken* &p, CBotCStack* pStack)
if (!IsOfType(p, TokenTypVar) || pPapa == nullptr)
{
- pStack->SetError( TX_NOCLASS, p );
+ pStack->SetError( CBotErrNotClass, p );
return nullptr;
}
pOld->m_pParent = pPapa;
@@ -834,6 +834,6 @@ CBotClass* CBotClass::Compile(CBotToken* &p, CBotCStack* pStack)
pOld->m_IsDef = true; // complete definition
if (pStack->IsOk()) return pOld;
}
- pStack->SetError(TX_ENDOF, p);
+ pStack->SetError(CBotErrNoTerminator, p);
return nullptr;
}
diff --git a/src/CBot/CBotDefParam.cpp b/src/CBot/CBotDefParam.cpp
index 2e48c06..df0ff96 100644
--- a/src/CBot/CBotDefParam.cpp
+++ b/src/CBot/CBotDefParam.cpp
@@ -76,7 +76,7 @@ CBotDefParam* CBotDefParam::Compile(CBotToken* &p, CBotCStack* pStack)
// variable already declared?
if (pStack->CheckVarLocal(pp))
{
- pStack->SetError(TX_REDEFVAR, pp);
+ pStack->SetError(CBotErrRedefVar, pp);
break;
}
@@ -91,15 +91,15 @@ CBotDefParam* CBotDefParam::Compile(CBotToken* &p, CBotCStack* pStack)
if (IsOfType(p, ID_COMMA) || p->GetType() == ID_CLOSEPAR)
continue;
}
- pStack->SetError(TX_CLOSEPAR, p->GetStart());
+ pStack->SetError(CBotErrClosePar, p->GetStart());
}
- pStack->SetError(TX_NOTYP, p);
+ pStack->SetError(CBotErrNoType, p);
delete list;
return nullptr;
}
return list;
}
- pStack->SetError(TX_OPENPAR, p->GetStart());
+ pStack->SetError(CBotErrOpenPar, p->GetStart());
return nullptr;
}
diff --git a/src/CBot/CBotDefines.h b/src/CBot/CBotDefines.h
index 514e733..09b11e5 100644
--- a/src/CBot/CBotDefines.h
+++ b/src/CBot/CBotDefines.h
@@ -55,9 +55,7 @@
// TODO: Why are all of those duplicated? This needs to be unified across the source code ~krzys_h
-// Here are the list of errors that can be returned by the module
-// for compilation
-
+// Compile errors
#define CBotErrOpenPar 5000 // missing the opening parenthesis
#define CBotErrClosePar 5001 // missing the closing parenthesis
#define CBotErrNotBoolean 5002 // expression must be a boolean
@@ -65,6 +63,7 @@
#define CBotErrBadLeft 5004 // assignment impossible ( 5 = ... )
#define CBotErrNoTerminator 5005 // semicolon expected
#define CBotErrCaseOut 5006 // case outside a switch
+#define CBotErrNoEnd 5007 // instructions after final closing brace
#define CBotErrCloseBlock 5008 // missing " } "
#define CBotErrElseWhitoutIf 5009 // else without matching if
#define CBotErrOpenBlock 5010 // missing " { "
@@ -73,6 +72,7 @@
#define CBotErrBadType2 5013 // Two operands are incompatible
#define CBotErrUndefCall 5014 // routine undefined
#define CBotErrNoDoubleDots 5015 // " : " expected
+#define CBotErrNoWhile 5016 // "while" expected (in do..while)
#define CBotErrBreakOutside 5017 // break outside of a loop
#define CBotErrUndefLabel 5019 // label udnefined
#define CBotErrLabel 5018 // label ne peut se mettre ici (label can not get here)
@@ -100,9 +100,7 @@
#define CBotErrPrivate 5041 // protected item
#define CBotErrNoPublic 5042 // missing word "public"
-// here is the list of errors that can be returned by the module
-// for the execution
-
+// Runtime errors
#define CBotErrZeroDiv 6000 // division by zero
#define CBotErrNotInit 6001 // uninitialized variable
#define CBotErrBadThrow 6002 // throw a negative value
@@ -120,74 +118,9 @@
#define CBotErrRead 6014 // error while reading
#define CBotErrWrite 6015 // writing error
+// Max errors
+#define TX_MAX 6016
+
// other values may be returned
// for example exceptions returned by external routines
// and " throw " with any number.
-
-// TODO: refactor & change to enum!
-
-// Compile errors
-#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_CLBRK 5035
-#define TX_RESERVED 5036
-#define TX_BADNEW 5037
-#define TX_OPBRK 5038
-#define TX_BADSTRING 5039
-#define TX_BADINDEX 5040
-#define TX_PRIVATE 5041
-#define TX_NOPUBLIC 5042
-
-// Runtime errors
-#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 TX_NOCLASS 6006
-#define TX_NULLPT 6007
-#define TX_OPNAN 6008
-#define TX_OUTARRAY 6009
-#define TX_STACKOVER 6010
-#define TX_DELETEDPT 6011
-#define TX_FILEOPEN 6012
-#define TX_NOTOPEN 6013
-#define TX_ERRREAD 6014
-#define TX_ERRWRITE 6015
-
-// Max errors (NOTE: See above TODO near file errors)
-#define TX_MAX 6016
diff --git a/src/CBot/CBotInstr/CBotBlock.cpp b/src/CBot/CBotInstr/CBotBlock.cpp
index 9e6b253..105b718 100644
--- a/src/CBot/CBotInstr/CBotBlock.cpp
+++ b/src/CBot/CBotInstr/CBotBlock.cpp
@@ -44,12 +44,12 @@ CBotInstr* CBotBlock::Compile(CBotToken* &p, CBotCStack* pStack, bool bLocal)
return inst;
}
- pStack->SetError(TX_CLOSEBLK, p->GetStart()); // missing parenthesis
+ pStack->SetError(CBotErrCloseBlock, p->GetStart()); // missing parenthesis
delete inst;
return nullptr;
}
- pStack->SetError(TX_OPENBLK, p->GetStart());
+ pStack->SetError(CBotErrOpenBlock, p->GetStart());
return nullptr;
}
diff --git a/src/CBot/CBotInstr/CBotBoolExpr.cpp b/src/CBot/CBotInstr/CBotBoolExpr.cpp
index e219d15..a325138 100644
--- a/src/CBot/CBotInstr/CBotBoolExpr.cpp
+++ b/src/CBot/CBotInstr/CBotBoolExpr.cpp
@@ -44,7 +44,7 @@ CBotInstr* CBotBoolExpr::Compile(CBotToken* &p, CBotCStack* pStack)
{
return inst;
}
- pStack->SetError(TX_NOTBOOL, p->GetStart()); // is not a boolean
+ pStack->SetError(CBotErrNotBoolean, p->GetStart()); // is not a boolean
}
delete inst;
diff --git a/src/CBot/CBotInstr/CBotBoolean.cpp b/src/CBot/CBotInstr/CBotBoolean.cpp
index 0b44d71..802727b 100644
--- a/src/CBot/CBotInstr/CBotBoolean.cpp
+++ b/src/CBot/CBotInstr/CBotBoolean.cpp
@@ -73,7 +73,7 @@ CBotInstr* CBotBoolean::Compile(CBotToken* &p, CBotCStack* pStack, bool cont, bo
(static_cast<CBotLeftExprVar*>(inst->m_var))->m_typevar = CBotTypBoolean;
if (pStk->CheckVarLocal(vartoken)) // redefinition of the variable
{
- pStk->SetError(TX_REDEFVAR, vartoken);
+ pStk->SetError(CBotErrRedefVar, vartoken);
goto error;
}
@@ -88,7 +88,7 @@ CBotInstr* CBotBoolean::Compile(CBotToken* &p, CBotCStack* pStack, bool cont, bo
if (!pStk->IsOk() )
{
- pStk->SetError(TX_CLBRK, p->GetStart());
+ pStk->SetError(CBotErrCloseIndex, p->GetStart());
goto error;
}
goto suite; // no assignment, variable already created
@@ -102,7 +102,7 @@ CBotInstr* CBotBoolean::Compile(CBotToken* &p, CBotCStack* pStack, bool cont, bo
}
if (!pStk->GetTypResult().Eq(CBotTypBoolean))
{
- pStk->SetError(TX_BADTYPE, p->GetStart());
+ pStk->SetError(CBotErrBadType1, p->GetStart());
goto error;
}
}
@@ -126,7 +126,7 @@ suite:
return pStack->Return(inst, pStk);
}
- pStk->SetError(TX_ENDOF, p->GetStart());
+ pStk->SetError(CBotErrNoTerminator, p->GetStart());
}
error:
diff --git a/src/CBot/CBotInstr/CBotBreak.cpp b/src/CBot/CBotInstr/CBotBreak.cpp
index b0a308d..d76588b 100644
--- a/src/CBot/CBotInstr/CBotBreak.cpp
+++ b/src/CBot/CBotInstr/CBotBreak.cpp
@@ -48,7 +48,7 @@ CBotInstr* CBotBreak::Compile(CBotToken* &p, CBotCStack* pStack)
if ( !ChkLvl(std::string(), type ) )
{
- pStack->SetError(TX_BREAK, pp);
+ pStack->SetError(CBotErrBreakOutside, pp);
return nullptr; // no object, the error is on the stack
}
@@ -62,7 +62,7 @@ CBotInstr* CBotBreak::Compile(CBotToken* &p, CBotCStack* pStack)
if ( !ChkLvl(inst->m_label, type ) )
{
delete inst;
- pStack->SetError(TX_NOLABEL, pp);
+ pStack->SetError(CBotErrUndefLabel, pp);
return nullptr; // no object, the error is on the stack
}
}
@@ -73,7 +73,7 @@ CBotInstr* CBotBreak::Compile(CBotToken* &p, CBotCStack* pStack)
}
delete inst;
- pStack->SetError(TX_ENDOF, p->GetStart());
+ pStack->SetError(CBotErrNoTerminator, p->GetStart());
return nullptr; // no object, the error is on the stack
}
diff --git a/src/CBot/CBotInstr/CBotCase.cpp b/src/CBot/CBotInstr/CBotCase.cpp
index 9387330..96c22ff 100644
--- a/src/CBot/CBotInstr/CBotCase.cpp
+++ b/src/CBot/CBotInstr/CBotCase.cpp
@@ -56,14 +56,14 @@ CBotInstr* CBotCase::Compile(CBotToken* &p, CBotCStack* pStack)
inst->m_Value = CBotExprNum::Compile(p, pStack);
if ( inst->m_Value == nullptr )
{
- pStack->SetError( TX_BADNUM, pp );
+ pStack->SetError( CBotErrBadNum, pp );
delete inst;
return nullptr;
}
}
if ( !IsOfType( p, ID_DOTS ))
{
- pStack->SetError( TX_MISDOTS, p->GetStart() );
+ pStack->SetError( CBotErrNoDoubleDots, p->GetStart() );
delete inst;
return nullptr;
}
diff --git a/src/CBot/CBotInstr/CBotCatch.cpp b/src/CBot/CBotInstr/CBotCatch.cpp
index f62f662..d187bec 100644
--- a/src/CBot/CBotInstr/CBotCatch.cpp
+++ b/src/CBot/CBotInstr/CBotCatch.cpp
@@ -70,11 +70,11 @@ CBotCatch* CBotCatch::Compile(CBotToken* &p, CBotCStack* pStack)
if ( pStack->IsOk() )
return inst; // return an object to the application
}
- pStack->SetError(TX_CLOSEPAR, p->GetStart());
+ pStack->SetError(CBotErrClosePar, p->GetStart());
}
- pStack->SetError(TX_BADTYPE, p->GetStart());
+ pStack->SetError(CBotErrBadType1, p->GetStart());
}
- pStack->SetError(TX_OPENPAR, p->GetStart());
+ pStack->SetError(CBotErrOpenPar, p->GetStart());
delete inst; // error, frees up
return nullptr; // no object, the error is on the stack
}
diff --git a/src/CBot/CBotInstr/CBotClassInst.cpp b/src/CBot/CBotInstr/CBotClassInst.cpp
index e03fa3d..2570053 100644
--- a/src/CBot/CBotInstr/CBotClassInst.cpp
+++ b/src/CBot/CBotInstr/CBotClassInst.cpp
@@ -67,7 +67,7 @@ CBotInstr* CBotClassInst::Compile(CBotToken* &p, CBotCStack* pStack, CBotClass*
if ( pClass == nullptr )
{
// not found? is bizare
- pStack->SetError(TX_NOCLASS, p);
+ pStack->SetError(CBotErrNotClass, p);
return nullptr;
}
p = p->GetNext();
@@ -92,7 +92,7 @@ CBotInstr* CBotClassInst::Compile(CBotToken* &p, CBotCStack* pStack, CBotClass*
if (pStk->CheckVarLocal(vartoken)) // redefinition of the variable
{
pStk->SetStartError(vartoken->GetStart());
- pStk->SetError(TX_REDEFVAR, vartoken->GetEnd());
+ pStk->SetError(CBotErrRedefVar, vartoken->GetEnd());
goto error;
}
@@ -107,7 +107,7 @@ CBotInstr* CBotClassInst::Compile(CBotToken* &p, CBotCStack* pStack, CBotClass*
if (!pStk->IsOk() )
{
- pStk->SetError(TX_CLBRK, p->GetStart());
+ pStk->SetError(CBotErrCloseIndex, p->GetStart());
goto error;
}
goto suite; // no assignment, variable already created
@@ -142,12 +142,12 @@ CBotInstr* CBotClassInst::Compile(CBotToken* &p, CBotCStack* pStack, CBotClass*
delete pStk->TokenStack(); // releases the supplement stack
int typ = r.GetType();
- if (typ == TX_UNDEFCALL)
+ if (typ == CBotErrUndefCall)
{
// si le constructeur n'existe pas
if (inst->m_Parameters != nullptr) // with parameters
{
- pStk->SetError(TX_NOCONST, vartoken);
+ pStk->SetError(CBotErrNoConstruct, vartoken);
goto error;
}
typ = 0;
@@ -165,7 +165,7 @@ CBotInstr* CBotClassInst::Compile(CBotToken* &p, CBotCStack* pStack, CBotClass*
{
if (inst->m_hasParams)
{
- pStk->SetError(TX_ENDOF, p->GetStart());
+ pStk->SetError(CBotErrNoTerminator, p->GetStart());
goto error;
}
@@ -178,7 +178,7 @@ CBotInstr* CBotClassInst::Compile(CBotToken* &p, CBotCStack* pStack, CBotClass*
( !pStk->GetTypResult(1).Eq(CBotTypPointer) ||
( result != nullptr && !pClass->IsChildOf(result) ))) // type compatible ?
{
- pStk->SetError(TX_BADTYPE, p->GetStart());
+ pStk->SetError(CBotErrBadType1, p->GetStart());
goto error;
}
// if ( !bIntrinsic ) var->SetPointer(pStk->GetVar()->GetPointer());
@@ -217,7 +217,7 @@ suite:
return pStack->Return(inst, pStk);
}
- pStk->SetError(TX_ENDOF, p->GetStart());
+ pStk->SetError(CBotErrNoTerminator, p->GetStart());
}
error:
@@ -275,7 +275,7 @@ bool CBotClassInst::Execute(CBotStack* &pj)
CBotVar* pv = pile->GetVar();
if ( pv == nullptr || pv->GetPointer() == nullptr )
{
- pile->SetError(TX_NULLPT, &m_token);
+ pile->SetError(CBotErrNull, &m_token);
return pj->Return(pile);
}
pThis->Copy(pile->GetVar(), false);
diff --git a/src/CBot/CBotInstr/CBotCondition.cpp b/src/CBot/CBotInstr/CBotCondition.cpp
index 6c88869..72a70b2 100644
--- a/src/CBot/CBotInstr/CBotCondition.cpp
+++ b/src/CBot/CBotInstr/CBotCondition.cpp
@@ -43,12 +43,12 @@ CBotInstr* CBotCondition::Compile(CBotToken* &p, CBotCStack* pStack)
{
return inst;
}
- pStack->SetError(TX_CLOSEPAR, p->GetStart()); // missing parenthesis
+ pStack->SetError(CBotErrClosePar, p->GetStart()); // missing parenthesis
}
delete inst;
}
- pStack->SetError(TX_OPENPAR, p->GetStart()); // missing parenthesis
+ pStack->SetError(CBotErrOpenPar, p->GetStart()); // missing parenthesis
return nullptr;
}
diff --git a/src/CBot/CBotInstr/CBotDo.cpp b/src/CBot/CBotInstr/CBotDo.cpp
index ef682b3..60cb427 100644
--- a/src/CBot/CBotInstr/CBotDo.cpp
+++ b/src/CBot/CBotInstr/CBotDo.cpp
@@ -80,10 +80,10 @@ CBotInstr* CBotDo::Compile(CBotToken* &p, CBotCStack* pStack)
{
return pStack->Return(inst, pStk); // return an object to the application
}
- pStk->SetError(TX_ENDOF, p->GetStart());
+ pStk->SetError(CBotErrNoTerminator, p->GetStart());
}
}
- pStk->SetError(TX_WHILE, p->GetStart());
+ pStk->SetError(CBotErrNoWhile, p->GetStart());
}
delete inst; // error, frees up
diff --git a/src/CBot/CBotInstr/CBotExprUnaire.cpp b/src/CBot/CBotInstr/CBotExprUnaire.cpp
index 50e39a7..656bda9 100644
--- a/src/CBot/CBotInstr/CBotExprUnaire.cpp
+++ b/src/CBot/CBotInstr/CBotExprUnaire.cpp
@@ -69,7 +69,7 @@ CBotInstr* CBotExprUnaire::Compile(CBotToken* &p, CBotCStack* pStack)
if (op == ID_TXT_NOT && pStk->GetTypResult().Eq(CBotTypBoolean))// only with boolean
return pStack->Return(inst, pStk);
- pStk->SetError(TX_BADTYPE, &inst->m_token);
+ pStk->SetError(CBotErrBadType1, &inst->m_token);
}
delete inst;
return pStack->Return(nullptr, pStk);
diff --git a/src/CBot/CBotInstr/CBotExprVar.cpp b/src/CBot/CBotInstr/CBotExprVar.cpp
index 4dc078d..d956d43 100644
--- a/src/CBot/CBotInstr/CBotExprVar.cpp
+++ b/src/CBot/CBotInstr/CBotExprVar.cpp
@@ -72,7 +72,7 @@ CBotInstr* CBotExprVar::Compile(CBotToken* &p, CBotCStack* pStack, int privat)
if ( var->IsPrivate(privat) &&
!pStk->GetBotCall()->m_bCompileClass)
{
- pStk->SetError(TX_PRIVATE, p);
+ pStk->SetError(CBotErrPrivate, p);
goto err;
}
@@ -104,12 +104,12 @@ CBotInstr* CBotExprVar::Compile(CBotToken* &p, CBotCStack* pStack, int privat)
if (i->m_expr == nullptr)
{
- pStk->SetError(TX_BADINDEX, p->GetStart());
+ pStk->SetError(CBotErrBadIndex, p->GetStart());
goto err;
}
if (!pStk->IsOk() || !IsOfType( p, ID_CLBRK ))
{
- pStk->SetError(TX_CLBRK, p->GetStart());
+ pStk->SetError(CBotErrCloseIndex, p->GetStart());
goto err;
}
continue;
@@ -142,7 +142,7 @@ CBotInstr* CBotExprVar::Compile(CBotToken* &p, CBotCStack* pStack, int privat)
if ( var->IsPrivate() &&
!pStk->GetBotCall()->m_bCompileClass)
{
- pStk->SetError(TX_PRIVATE, pp);
+ pStk->SetError(CBotErrPrivate, pp);
goto err;
}
}
@@ -154,10 +154,10 @@ CBotInstr* CBotExprVar::Compile(CBotToken* &p, CBotCStack* pStack, int privat)
p = p->GetNext(); // skips the name
continue;
}
- pStk->SetError(TX_NOITEM, p);
+ pStk->SetError(CBotErrUndefItem, p);
goto err;
}
- pStk->SetError(TX_DOT, p->GetStart());
+ pStk->SetError(CBotErrUndefClass, p->GetStart());
goto err;
}
}
@@ -168,7 +168,7 @@ CBotInstr* CBotExprVar::Compile(CBotToken* &p, CBotCStack* pStack, int privat)
pStk->SetCopyVar(var); // place the copy of the variable on the stack (for type)
if (pStk->IsOk()) return pStack->Return(inst, pStk);
}
- pStk->SetError(TX_UNDEFVAR, p);
+ pStk->SetError(CBotErrUndefVar, p);
err:
delete inst;
return pStack->Return(nullptr, pStk);
@@ -252,7 +252,7 @@ bool CBotExprVar::Execute(CBotStack* &pj)
{
CBotToken* pt = &m_token;
while (pt->GetNext() != nullptr) pt = pt->GetNext();
- pile1->SetError(TX_NOTINIT, pt);
+ pile1->SetError(CBotErrNotInit, pt);
return pj->Return(pile1);
}
return pj->Return(pile1); // operation completed
diff --git a/src/CBot/CBotInstr/CBotExpression.cpp b/src/CBot/CBotInstr/CBotExpression.cpp
index d3821aa..b277fb4 100644
--- a/src/CBot/CBotInstr/CBotExpression.cpp
+++ b/src/CBot/CBotInstr/CBotExpression.cpp
@@ -69,7 +69,7 @@ CBotInstr* CBotExpression::Compile(CBotToken* &p, CBotCStack* pStack)
{
if (inst->m_leftop == nullptr)
{
- pStack->SetError(TX_BADLEFT, p->GetEnd());
+ pStack->SetError(CBotErrBadLeft, p->GetEnd());
delete inst;
return nullptr;
}
@@ -94,7 +94,7 @@ CBotInstr* CBotExpression::Compile(CBotToken* &p, CBotCStack* pStack)
if (OpType != ID_ASS && !var->IsDefined())
{
- pStack->SetError(TX_NOTINIT, pp);
+ pStack->SetError(CBotErrNotInit, pp);
delete inst;
return nullptr;
}
@@ -133,7 +133,7 @@ CBotInstr* CBotExpression::Compile(CBotToken* &p, CBotCStack* pStack)
if (!TypeCompatible(type1, type2, OpType))
{
- pStack->SetError(TX_BADTYPE, &inst->m_token);
+ pStack->SetError(CBotErrBadType1, &inst->m_token);
delete inst;
return nullptr;
}
@@ -148,7 +148,7 @@ CBotInstr* CBotExpression::Compile(CBotToken* &p, CBotCStack* pStack)
pStack->SetError(0,0); // forget the error
CBotInstr* i = CBotTwoOpExpr::Compile(p, pStack); // tries without assignment
- if (i != nullptr && error == TX_PRIVATE && p->GetType() == ID_ASS)
+ if (i != nullptr && error == CBotErrPrivate && p->GetType() == ID_ASS)
pStack->ResetError(error, start, end);
return i;
}
@@ -192,7 +192,7 @@ bool CBotExpression::Execute(CBotStack* &pj)
initKind = pVar->GetInit();
if (initKind == CBotVar::InitType::IS_NAN)
{
- pile2->SetError(TX_OPNAN, m_leftop->GetToken());
+ pile2->SetError(CBotErrNan, m_leftop->GetToken());
return pj->Return(pile2);
}
result = CBotVar::Create("", pVar->GetTypResult(2));
@@ -217,13 +217,13 @@ bool CBotExpression::Execute(CBotStack* &pj)
case ID_ASSDIV:
if (initKind != CBotVar::InitType::UNDEF &&
result->Div(pile1->GetVar(), pile2->GetVar()))
- pile2->SetError(TX_DIVZERO, &m_token);
+ pile2->SetError(CBotErrZeroDiv, &m_token);
pile2->SetVar(result);
break;
case ID_ASSMODULO:
if (initKind != CBotVar::InitType::UNDEF &&
result->Modulo(pile1->GetVar(), pile2->GetVar()))
- pile2->SetError(TX_DIVZERO, &m_token);
+ pile2->SetError(CBotErrZeroDiv, &m_token);
pile2->SetVar(result);
break;
case ID_ASSAND:
@@ -254,7 +254,7 @@ bool CBotExpression::Execute(CBotStack* &pj)
assert(0);
}
if (initKind == CBotVar::InitType::UNDEF)
- pile2->SetError(TX_NOTINIT, m_leftop->GetToken());
+ pile2->SetError(CBotErrNotInit, m_leftop->GetToken());
pile1->IncState();
}
diff --git a/src/CBot/CBotInstr/CBotFieldExpr.cpp b/src/CBot/CBotInstr/CBotFieldExpr.cpp
index c581769..0105455 100644
--- a/src/CBot/CBotInstr/CBotFieldExpr.cpp
+++ b/src/CBot/CBotInstr/CBotFieldExpr.cpp
@@ -58,7 +58,7 @@ bool CBotFieldExpr::ExecuteVar(CBotVar* &pVar, CBotCStack* &pile)
pVar = pVar->GetItemRef(m_nIdent);
if (pVar == nullptr)
{
- pile->SetError(TX_NOITEM, &m_token);
+ pile->SetError(CBotErrUndefItem, &m_token);
return false;
}
@@ -82,12 +82,12 @@ bool CBotFieldExpr::ExecuteVar(CBotVar* &pVar, CBotStack* &pile, CBotToken* prev
CBotVarClass* pItem = pVar->GetPointer();
if (pItem == nullptr)
{
- pile->SetError(TX_NULLPT, prevToken);
+ pile->SetError(CBotErrNull, prevToken);
return pj->Return(pile);
}
if (pItem->GetUserPtr() == OBJECTDELETED)
{
- pile->SetError(TX_DELETEDPT, prevToken);
+ pile->SetError(CBotErrDeletedPtr, prevToken);
return pj->Return(pile);
}
@@ -96,7 +96,7 @@ bool CBotFieldExpr::ExecuteVar(CBotVar* &pVar, CBotStack* &pile, CBotToken* prev
pVar = pVar->GetItemRef(m_nIdent);
if (pVar == nullptr)
{
- pile->SetError(TX_NOITEM, &m_token);
+ pile->SetError(CBotErrUndefItem, &m_token);
return pj->Return(pile);
}
diff --git a/src/CBot/CBotInstr/CBotFloat.cpp b/src/CBot/CBotInstr/CBotFloat.cpp
index f4a8ac3..f7cbfed 100644
--- a/src/CBot/CBotInstr/CBotFloat.cpp
+++ b/src/CBot/CBotInstr/CBotFloat.cpp
@@ -74,7 +74,7 @@ CBotInstr* CBotFloat::Compile(CBotToken* &p, CBotCStack* pStack, bool cont, bool
if (pStk->CheckVarLocal(vartoken)) // redefinition of a variable
{
pStk->SetStartError(vartoken->GetStart());
- pStk->SetError(TX_REDEFVAR, vartoken->GetEnd());
+ pStk->SetError(CBotErrRedefVar, vartoken->GetEnd());
goto error;
}
@@ -86,7 +86,7 @@ CBotInstr* CBotFloat::Compile(CBotToken* &p, CBotCStack* pStack, bool cont, bool
if (!pStk->IsOk() )
{
- pStk->SetError(TX_CLBRK, p->GetStart());
+ pStk->SetError(CBotErrCloseIndex, p->GetStart());
goto error;
}
goto suite; // no assignment, variable already created
@@ -100,7 +100,7 @@ CBotInstr* CBotFloat::Compile(CBotToken* &p, CBotCStack* pStack, bool cont, bool
}
if (pStk->GetType() >= CBotTypBoolean)
{
- pStk->SetError(TX_BADTYPE, p->GetStart());
+ pStk->SetError(CBotErrBadType1, p->GetStart());
goto error;
}
}
@@ -124,7 +124,7 @@ suite:
return pStack->Return(inst, pStk);
}
- pStk->SetError(TX_ENDOF, p->GetStart());
+ pStk->SetError(CBotErrNoTerminator, p->GetStart());
}
error:
diff --git a/src/CBot/CBotInstr/CBotFor.cpp b/src/CBot/CBotInstr/CBotFor.cpp
index 8048832..2b93a17 100644
--- a/src/CBot/CBotInstr/CBotFor.cpp
+++ b/src/CBot/CBotInstr/CBotFor.cpp
@@ -66,7 +66,7 @@ CBotInstr* CBotFor::Compile(CBotToken* &p, CBotCStack* pStack)
if ( !IsOfType(p, ID_OPENPAR)) // missing parenthesis ?
{
- pStack->SetError(TX_OPENPAR, p->GetStart());
+ pStack->SetError(CBotErrOpenPar, p->GetStart());
return nullptr;
}
@@ -78,7 +78,7 @@ CBotInstr* CBotFor::Compile(CBotToken* &p, CBotCStack* pStack)
{
if ( !IsOfType(p, ID_SEP)) // lack the semicolon?
{
- pStack->SetError(TX_OPENPAR, p->GetStart());
+ pStack->SetError(CBotErrOpenPar, p->GetStart());
delete inst;
return pStack->Return(nullptr, pStk); // no object, the error is on the stack
}
@@ -87,7 +87,7 @@ CBotInstr* CBotFor::Compile(CBotToken* &p, CBotCStack* pStack)
{
if ( !IsOfType(p, ID_SEP)) // lack the semicolon?
{
- pStack->SetError(TX_OPENPAR, p->GetStart());
+ pStack->SetError(CBotErrOpenPar, p->GetStart());
delete inst;
return pStack->Return(nullptr, pStk); // no object, the error is on the stack
}
@@ -102,7 +102,7 @@ CBotInstr* CBotFor::Compile(CBotToken* &p, CBotCStack* pStack)
if ( pStk->IsOk() )
return pStack->Return(inst, pStk);;
}
- pStack->SetError(TX_CLOSEPAR, p->GetStart());
+ pStack->SetError(CBotErrClosePar, p->GetStart());
}
}
}
diff --git a/src/CBot/CBotInstr/CBotFunction.cpp b/src/CBot/CBotInstr/CBotFunction.cpp
index 0744f70..f024d7d 100644
--- a/src/CBot/CBotInstr/CBotFunction.cpp
+++ b/src/CBot/CBotInstr/CBotFunction.cpp
@@ -248,9 +248,9 @@ CBotFunction* CBotFunction::Compile(CBotToken* &p, CBotCStack* pStack, CBotFunct
}
}
bad:
- pStk->SetError(TX_NOFONC, p);
+ pStk->SetError(CBotErrNoFunc, p);
}
- pStk->SetError(TX_NOTYP, p);
+ pStk->SetError(CBotErrNoType, p);
if ( finput == nullptr ) delete func;
return pStack->ReturnFunc(nullptr, pStk);
}
@@ -294,7 +294,7 @@ CBotFunction* CBotFunction::Compile1(CBotToken* &p, CBotCStack* pStack, CBotClas
CBotClass* pClass = CBotClass::Find(pp);
if ( pClass == nullptr )
{
- pStk->SetError(TX_NOCLASS, pp);
+ pStk->SetError(CBotErrNotClass, pp);
goto bad;
}
@@ -325,15 +325,15 @@ CBotFunction* CBotFunction::Compile1(CBotToken* &p, CBotCStack* pStack, CBotClas
return pStack->ReturnFunc(func, pStk);
}
- pStk->SetError(TX_OPENBLK, p);
+ pStk->SetError(CBotErrOpenBlock, p);
}
}
- pStk->SetError(TX_REDEF, pp);
+ pStk->SetError(CBotErrRedefFunc, pp);
}
bad:
- pStk->SetError(TX_NOFONC, p);
+ pStk->SetError(CBotErrNoFunc, p);
}
- pStk->SetError(TX_NOTYP, p);
+ pStk->SetError(CBotErrNoType, p);
delete func;
return pStack->ReturnFunc(nullptr, pStk);
}
@@ -445,7 +445,7 @@ CBotTypResult CBotFunction::CompileCall(const std::string& name, CBotVar** ppVar
CBotFunction* CBotFunction::FindLocalOrPublic(long& nIdent, const std::string& name, CBotVar** ppVars,
CBotTypResult& TypeOrError, bool bPublic)
{
- TypeOrError.SetType(TX_UNDEFCALL); // no routine of the name
+ TypeOrError.SetType(CBotErrUndefCall); // no routine of the name
CBotFunction* pt;
if ( nIdent )
@@ -491,7 +491,7 @@ CBotFunction* CBotFunction::FindLocalOrPublic(long& nIdent, const std::string& n
{
if (!TypesCompatibles(pv->GetTypResult(), pw->GetTypResult()))
{
- if ( pFunc == nullptr ) TypeOrError = TX_BADPARAM;
+ if ( pFunc == nullptr ) TypeOrError = CBotErrBadParam;
break;
}
int d = pv->GetType() - pw->GetType(2);
@@ -503,15 +503,15 @@ CBotFunction* CBotFunction::FindLocalOrPublic(long& nIdent, const std::string& n
if ( pw != nullptr )
{
if ( pFunc != nullptr ) continue;
- if ( TypeOrError.Eq(TX_LOWPARAM) ) TypeOrError.SetType(TX_NUMPARAM);
- if ( TypeOrError.Eq(TX_UNDEFCALL)) TypeOrError.SetType(TX_OVERPARAM);
+ if ( TypeOrError.Eq(CBotErrLowParam) ) TypeOrError.SetType(CBotErrNbParam);
+ if ( TypeOrError.Eq(CBotErrUndefCall)) TypeOrError.SetType(CBotErrOverParam);
continue; // too many parameters
}
if ( pv != nullptr )
{
if ( pFunc != nullptr ) continue;
- if ( TypeOrError.Eq(TX_OVERPARAM) ) TypeOrError.SetType(TX_NUMPARAM);
- if ( TypeOrError.Eq(TX_UNDEFCALL) ) TypeOrError.SetType(TX_LOWPARAM);
+ if ( TypeOrError.Eq(CBotErrOverParam) ) TypeOrError.SetType(CBotErrNbParam);
+ if ( TypeOrError.Eq(CBotErrUndefCall) ) TypeOrError.SetType(CBotErrLowParam);
continue; // not enough parameters
}
@@ -546,7 +546,7 @@ CBotFunction* CBotFunction::FindLocalOrPublic(long& nIdent, const std::string& n
{
if (!TypesCompatibles(pv->GetTypResult(), pw->GetTypResult()))
{
- if ( pFunc == nullptr ) TypeOrError = TX_BADPARAM;
+ if ( pFunc == nullptr ) TypeOrError = CBotErrBadParam;
break;
}
int d = pv->GetType() - pw->GetType(2);
@@ -558,15 +558,15 @@ CBotFunction* CBotFunction::FindLocalOrPublic(long& nIdent, const std::string& n
if ( pw != nullptr )
{
if ( pFunc != nullptr ) continue;
- if ( TypeOrError.Eq(TX_LOWPARAM) ) TypeOrError.SetType(TX_NUMPARAM);
- if ( TypeOrError.Eq(TX_UNDEFCALL)) TypeOrError.SetType(TX_OVERPARAM);
+ if ( TypeOrError.Eq(CBotErrLowParam) ) TypeOrError.SetType(CBotErrNbParam);
+ if ( TypeOrError.Eq(CBotErrUndefCall)) TypeOrError.SetType(CBotErrOverParam);
continue; // to many parameters
}
if ( pv != nullptr )
{
if ( pFunc != nullptr ) continue;
- if ( TypeOrError.Eq(TX_OVERPARAM) ) TypeOrError.SetType(TX_NUMPARAM);
- if ( TypeOrError.Eq(TX_UNDEFCALL) ) TypeOrError.SetType(TX_LOWPARAM);
+ if ( TypeOrError.Eq(CBotErrOverParam) ) TypeOrError.SetType(CBotErrNbParam);
+ if ( TypeOrError.Eq(CBotErrUndefCall) ) TypeOrError.SetType(CBotErrLowParam);
continue; // not enough parameters
}
diff --git a/src/CBot/CBotInstr/CBotIString.cpp b/src/CBot/CBotInstr/CBotIString.cpp
index be03c6e..9000188 100644
--- a/src/CBot/CBotInstr/CBotIString.cpp
+++ b/src/CBot/CBotInstr/CBotIString.cpp
@@ -72,7 +72,7 @@ CBotInstr* CBotIString::Compile(CBotToken* &p, CBotCStack* pStack, bool cont, bo
if (pStk->CheckVarLocal(vartoken))
{
pStk->SetStartError(vartoken->GetStart());
- pStk->SetError(TX_REDEFVAR, vartoken->GetEnd());
+ pStk->SetError(CBotErrRedefVar, vartoken->GetEnd());
goto error;
}
@@ -84,7 +84,7 @@ CBotInstr* CBotIString::Compile(CBotToken* &p, CBotCStack* pStack, bool cont, bo
}
/* if (!pStk->GetTypResult().Eq(CBotTypString)) // type compatible ?
{
- pStk->SetError(TX_BADTYPE, p->GetStart());
+ pStk->SetError(CBotErrBadType1, p->GetStart());
goto error;
}*/
}
@@ -108,7 +108,7 @@ CBotInstr* CBotIString::Compile(CBotToken* &p, CBotCStack* pStack, bool cont, bo
return pStack->Return(inst, pStk);
}
- pStk->SetError(TX_ENDOF, p->GetStart());
+ pStk->SetError(CBotErrNoTerminator, p->GetStart());
}
error:
diff --git a/src/CBot/CBotInstr/CBotIndexExpr.cpp b/src/CBot/CBotInstr/CBotIndexExpr.cpp
index 27784c5..e83f561 100644
--- a/src/CBot/CBotInstr/CBotIndexExpr.cpp
+++ b/src/CBot/CBotInstr/CBotIndexExpr.cpp
@@ -52,7 +52,7 @@ bool CBotIndexExpr::ExecuteVar(CBotVar* &pVar, CBotCStack* &pile)
pVar = (static_cast<CBotVarArray*>(pVar))->GetItem(0, false); // at compile time makes the element [0]
if (pVar == nullptr)
{
- pile->SetError(TX_OUTARRAY, m_token.GetEnd());
+ pile->SetError(CBotErrOutArray, m_token.GetEnd());
return false;
}
if (m_next3 != nullptr) return m_next3->ExecuteVar(pVar, pile);
@@ -80,7 +80,7 @@ bool CBotIndexExpr::ExecuteVar(CBotVar* &pVar, CBotStack* &pile, CBotToken* prev
if (p == nullptr || p->GetType() > CBotTypDouble)
{
- pile->SetError(TX_BADINDEX, prevToken);
+ pile->SetError(CBotErrBadIndex, prevToken);
return pj->Return(pile);
}
@@ -89,7 +89,7 @@ bool CBotIndexExpr::ExecuteVar(CBotVar* &pVar, CBotStack* &pile, CBotToken* prev
pVar = (static_cast<CBotVarArray*>(pVar))->GetItem(n, bExtend);
if (pVar == nullptr)
{
- pile->SetError(TX_OUTARRAY, prevToken);
+ pile->SetError(CBotErrOutArray, prevToken);
return pj->Return(pile);
}
diff --git a/src/CBot/CBotInstr/CBotInstArray.cpp b/src/CBot/CBotInstr/CBotInstArray.cpp
index b5497f3..9909a57 100644
--- a/src/CBot/CBotInstr/CBotInstArray.cpp
+++ b/src/CBot/CBotInstr/CBotInstArray.cpp
@@ -67,7 +67,7 @@ CBotInstr* CBotInstArray::Compile(CBotToken* &p, CBotCStack* pStack, CBotTypResu
{
if (pStk->CheckVarLocal(vartoken)) // redefinition of the variable?
{
- pStk->SetError(TX_REDEFVAR, vartoken);
+ pStk->SetError(CBotErrRedefVar, vartoken);
goto error;
}
@@ -84,7 +84,7 @@ CBotInstr* CBotInstArray::Compile(CBotToken* &p, CBotCStack* pStack, CBotTypResu
if (!pStk->IsOk() || !IsOfType(p, ID_CLBRK ))
{
- pStk->SetError(TX_CLBRK, p->GetStart());
+ pStk->SetError(CBotErrCloseIndex, p->GetStart());
goto error;
}
}
@@ -146,7 +146,7 @@ bool CBotInstArray::Execute(CBotStack* &pj)
max[n] = v->GetValInt(); // value
if (max[n]>MAXARRAYSIZE)
{
- pile->SetError(TX_OUTARRAY, &m_token);
+ pile->SetError(CBotErrOutArray, &m_token);
return pj->Return (pile);
}
n++;
diff --git a/src/CBot/CBotInstr/CBotInstr.cpp b/src/CBot/CBotInstr/CBotInstr.cpp
index c08723e..6a93260 100644
--- a/src/CBot/CBotInstr/CBotInstr.cpp
+++ b/src/CBot/CBotInstr/CBotInstr.cpp
@@ -190,7 +190,7 @@ CBotInstr* CBotInstr::Compile(CBotToken* &p, CBotCStack* pStack)
// these instructions accept only lable
if (!IsOfTypeList(pp, ID_WHILE, ID_FOR, ID_DO, 0))
{
- pStack->SetError(TX_LABEL, pp->GetStart());
+ pStack->SetError(CBotErrLabel, pp->GetStart());
return nullptr;
}
}
@@ -241,12 +241,12 @@ CBotInstr* CBotInstr::Compile(CBotToken* &p, CBotCStack* pStack)
case ID_ELSE:
pStack->SetStartError(p->GetStart());
- pStack->SetError(TX_ELSEWITHOUTIF, p->GetEnd());
+ pStack->SetError(CBotErrElseWhitoutIf, p->GetEnd());
return nullptr;
case ID_CASE:
pStack->SetStartError(p->GetStart());
- pStack->SetError(TX_OUTCASE, p->GetEnd());
+ pStack->SetError(CBotErrCaseOut, p->GetEnd());
return nullptr;
}
@@ -255,7 +255,7 @@ CBotInstr* CBotInstr::Compile(CBotToken* &p, CBotCStack* pStack)
// should not be a reserved word DefineNum
if (p->GetType() == TokenTypDef)
{
- pStack->SetError(TX_RESERVED, p);
+ pStack->SetError(CBotErrReserved, p);
return nullptr;
}
@@ -276,7 +276,7 @@ CBotInstr* CBotInstr::Compile(CBotToken* &p, CBotCStack* pStack)
{
return inst;
}
- pStack->SetError(TX_ENDOF, p->GetStart());
+ pStack->SetError(CBotErrNoTerminator, p->GetStart());
delete inst;
return nullptr;
}
@@ -339,7 +339,7 @@ CBotInstr* CBotInstr::CompileArray(CBotToken* &p, CBotCStack* pStack, CBotTypRes
{
if (!IsOfType(p, ID_CLBRK))
{
- pStack->SetError(TX_CLBRK, p->GetStart());
+ pStack->SetError(CBotErrCloseIndex, p->GetStart());
return nullptr;
}
@@ -369,6 +369,6 @@ CBotInstr* CBotInstr::CompileArray(CBotToken* &p, CBotCStack* pStack, CBotTypRes
}
delete inst;
- pStack->SetError(TX_ENDOF, p->GetStart());
+ pStack->SetError(CBotErrNoTerminator, p->GetStart());
return nullptr;
}
diff --git a/src/CBot/CBotInstr/CBotInstrCall.cpp b/src/CBot/CBotInstr/CBotInstrCall.cpp
index d83f2a8..f7ef7cb 100644
--- a/src/CBot/CBotInstr/CBotInstrCall.cpp
+++ b/src/CBot/CBotInstr/CBotInstrCall.cpp
@@ -86,7 +86,7 @@ CBotInstr* CBotInstrCall::Compile(CBotToken* &p, CBotCStack* pStack)
if ( pile->GetTypResult().Eq(99) )
{
delete pStack->TokenStack();
- pStack->SetError(TX_VOID, p->GetStart());
+ pStack->SetError(CBotErrVoid, p->GetStart());
delete inst;
return nullptr;
}
@@ -98,7 +98,7 @@ CBotInstr* CBotInstrCall::Compile(CBotToken* &p, CBotCStack* pStack)
if (IsOfType(p, ID_CLOSEPAR)) break;
}
- pStack->SetError(TX_CLOSEPAR, p->GetStart());
+ pStack->SetError(CBotErrClosePar, p->GetStart());
delete pStack->TokenStack();
delete inst;
return nullptr;
diff --git a/src/CBot/CBotInstr/CBotInstrMethode.cpp b/src/CBot/CBotInstr/CBotInstrMethode.cpp
index 1e5c34a..5a167c8 100644
--- a/src/CBot/CBotInstr/CBotInstrMethode.cpp
+++ b/src/CBot/CBotInstr/CBotInstrMethode.cpp
@@ -110,7 +110,7 @@ bool CBotInstrMethode::ExecuteVar(CBotVar* &pVar, CBotStack* &pj, CBotToken* pre
if (pVar->GetPointer() == nullptr)
{
- pj->SetError(TX_NULLPT, prevToken);
+ pj->SetError(CBotErrNull, prevToken);
}
if (pile1->IfStep()) return false;
diff --git a/src/CBot/CBotInstr/CBotInstrUtils.cpp b/src/CBot/CBotInstr/CBotInstrUtils.cpp
index a7fc8c9..4840883 100644
--- a/src/CBot/CBotInstr/CBotInstrUtils.cpp
+++ b/src/CBot/CBotInstr/CBotInstrUtils.cpp
@@ -68,7 +68,7 @@ CBotInstr* CompileParams(CBotToken* &p, CBotCStack* pStack, CBotVar** ppVars)
if (pile->GetTypResult().Eq(99))
{
delete pStack->TokenStack();
- pStack->SetError(TX_VOID, p->GetStart());
+ pStack->SetError(CBotErrVoid, p->GetStart());
return nullptr;
}
ppVars[i] = pile->GetVar();
@@ -79,7 +79,7 @@ CBotInstr* CompileParams(CBotToken* &p, CBotCStack* pStack, CBotVar** ppVars)
if (IsOfType(p, ID_CLOSEPAR)) break;
}
- pStack->SetError(TX_CLOSEPAR, p->GetStart());
+ pStack->SetError(CBotErrClosePar, p->GetStart());
delete pStack->TokenStack();
return nullptr;
}
diff --git a/src/CBot/CBotInstr/CBotInt.cpp b/src/CBot/CBotInstr/CBotInt.cpp
index 93cc0f6..bafce95 100644
--- a/src/CBot/CBotInstr/CBotInt.cpp
+++ b/src/CBot/CBotInstr/CBotInt.cpp
@@ -75,7 +75,7 @@ CBotInstr* CBotInt::Compile(CBotToken* &p, CBotCStack* pStack, bool cont, bool n
(static_cast<CBotLeftExprVar*>(inst->m_var))->m_typevar = CBotTypInt;
if (pStk->CheckVarLocal(vartoken)) // redefinition of the variable
{
- pStk->SetError(TX_REDEFVAR, vartoken);
+ pStk->SetError(CBotErrRedefVar, vartoken);
goto error;
}
@@ -90,7 +90,7 @@ CBotInstr* CBotInt::Compile(CBotToken* &p, CBotCStack* pStack, bool cont, bool n
if (!pStk->IsOk() )
{
- pStk->SetError(TX_CLBRK, p->GetStart());
+ pStk->SetError(CBotErrCloseIndex, p->GetStart());
goto error;
}
@@ -113,7 +113,7 @@ CBotInstr* CBotInt::Compile(CBotToken* &p, CBotCStack* pStack, bool cont, bool n
}
if (pStk->GetType() >= CBotTypBoolean) // compatible type ?
{
- pStk->SetError(TX_BADTYPE, p->GetStart());
+ pStk->SetError(CBotErrBadType1, p->GetStart());
goto error;
}
}
@@ -139,7 +139,7 @@ suite:
return pStack->Return(inst, pStk);
}
- pStk->SetError(TX_ENDOF, p->GetStart());
+ pStk->SetError(CBotErrNoTerminator, p->GetStart());
}
error:
diff --git a/src/CBot/CBotInstr/CBotLeftExpr.cpp b/src/CBot/CBotInstr/CBotLeftExpr.cpp
index 28badca..9bc5ef9 100644
--- a/src/CBot/CBotInstr/CBotLeftExpr.cpp
+++ b/src/CBot/CBotInstr/CBotLeftExpr.cpp
@@ -70,7 +70,7 @@ CBotLeftExpr* CBotLeftExpr::Compile(CBotToken* &p, CBotCStack* pStack)
if ( var->IsPrivate(PR_READ) &&
!pStk->GetBotCall()->m_bCompileClass)
{
- pStk->SetError(TX_PRIVATE, p);
+ pStk->SetError(CBotErrPrivate, p);
goto err;
}
// this is an element of the current class
@@ -103,13 +103,13 @@ CBotLeftExpr* CBotLeftExpr::Compile(CBotToken* &p, CBotCStack* pStack)
if (i->m_expr == nullptr)
{
- pStk->SetError(TX_BADINDEX, p->GetStart());
+ pStk->SetError(CBotErrBadIndex, p->GetStart());
goto err;
}
if (!pStk->IsOk() || !IsOfType( p, ID_CLBRK ))
{
- pStk->SetError(TX_CLBRK, p->GetStart());
+ pStk->SetError(CBotErrCloseIndex, p->GetStart());
goto err;
}
continue;
@@ -134,7 +134,7 @@ CBotLeftExpr* CBotLeftExpr::Compile(CBotToken* &p, CBotCStack* pStack)
if ( var->IsPrivate(PR_READ) &&
!pStk->GetBotCall()->m_bCompileClass)
{
- pStk->SetError(TX_PRIVATE, pp);
+ pStk->SetError(CBotErrPrivate, pp);
goto err;
}
@@ -142,9 +142,9 @@ CBotLeftExpr* CBotLeftExpr::Compile(CBotToken* &p, CBotCStack* pStack)
p = p->GetNext(); // skips the name
continue;
}
- pStk->SetError(TX_NOITEM, p);
+ pStk->SetError(CBotErrUndefItem, p);
}
- pStk->SetError(TX_DOT, p->GetStart());
+ pStk->SetError(CBotErrUndefClass, p->GetStart());
goto err;
}
}
@@ -154,7 +154,7 @@ CBotLeftExpr* CBotLeftExpr::Compile(CBotToken* &p, CBotCStack* pStack)
if (pStk->IsOk()) return static_cast<CBotLeftExpr*> (pStack->Return(inst, pStk));
}
- pStk->SetError(TX_UNDEFVAR, p);
+ pStk->SetError(CBotErrUndefVar, p);
err:
delete inst;
return static_cast<CBotLeftExpr*> ( pStack->Return(nullptr, pStk));
@@ -189,7 +189,7 @@ bool CBotLeftExpr::Execute(CBotStack* &pj, CBotStack* array)
if ( !c2->IsChildOf(c1))
{
CBotToken* pt = &m_token;
- pile->SetError(TX_BADTYPE, pt);
+ pile->SetError(CBotErrBadType1, pt);
return pj->Return(pile); // operation performed
}
}
diff --git a/src/CBot/CBotInstr/CBotLeftExprVar.cpp b/src/CBot/CBotInstr/CBotLeftExprVar.cpp
index 517d8b7..8115fc9 100644
--- a/src/CBot/CBotInstr/CBotLeftExprVar.cpp
+++ b/src/CBot/CBotInstr/CBotLeftExprVar.cpp
@@ -49,7 +49,7 @@ CBotInstr* CBotLeftExprVar::Compile(CBotToken* &p, CBotCStack* pStack)
// verifies that the token is a variable name
if (p->GetType() != TokenTypVar)
{
- pStack->SetError( TX_NOVAR, p->GetStart());
+ pStack->SetError( CBotErrNoVar, p->GetStart());
return nullptr;
}
diff --git a/src/CBot/CBotInstr/CBotListArray.cpp b/src/CBot/CBotInstr/CBotListArray.cpp
index f19cfa5..a3b16c1 100644
--- a/src/CBot/CBotInstr/CBotListArray.cpp
+++ b/src/CBot/CBotInstr/CBotListArray.cpp
@@ -100,7 +100,7 @@ CBotInstr* CBotListArray::Compile(CBotToken* &p, CBotCStack* pStack, CBotTypResu
if (pv == nullptr || !TypesCompatibles( type, pv->GetTypResult())) // compatible type?
{
- pStk->SetError(TX_BADTYPE, p->GetStart());
+ pStk->SetError(CBotErrBadType1, p->GetStart());
goto error;
}
@@ -118,7 +118,7 @@ CBotInstr* CBotListArray::Compile(CBotToken* &p, CBotCStack* pStack, CBotTypResu
if (pv == nullptr || !TypesCompatibles( type, pv->GetTypResult())) // compatible type?
{
- pStk->SetError(TX_BADTYPE, p->GetStart());
+ pStk->SetError(CBotErrBadType1, p->GetStart());
goto error;
}
inst->m_expr->AddNext3(i);
@@ -127,7 +127,7 @@ CBotInstr* CBotListArray::Compile(CBotToken* &p, CBotCStack* pStack, CBotTypResu
if (!IsOfType(p, ID_CLOSEPAR) )
{
- pStk->SetError(TX_CLOSEPAR, p->GetStart());
+ pStk->SetError(CBotErrClosePar, p->GetStart());
goto error;
}
diff --git a/src/CBot/CBotInstr/CBotListInstr.cpp b/src/CBot/CBotInstr/CBotListInstr.cpp
index 65bdb40..7958dae 100644
--- a/src/CBot/CBotInstr/CBotListInstr.cpp
+++ b/src/CBot/CBotInstr/CBotListInstr.cpp
@@ -57,7 +57,7 @@ CBotInstr* CBotListInstr::Compile(CBotToken* &p, CBotCStack* pStack, bool bLocal
if (IsOfType(p, 0))
{
- pStack->SetError(TX_CLOSEBLK, p->GetStart());
+ pStack->SetError(CBotErrCloseBlock, p->GetStart());
delete inst;
return pStack->Return(nullptr, pStk);
}
diff --git a/src/CBot/CBotInstr/CBotNew.cpp b/src/CBot/CBotInstr/CBotNew.cpp
index 2351835..2baf7a6 100644
--- a/src/CBot/CBotInstr/CBotNew.cpp
+++ b/src/CBot/CBotInstr/CBotNew.cpp
@@ -59,7 +59,7 @@ CBotInstr* CBotNew::Compile(CBotToken* &p, CBotCStack* pStack)
CBotClass* pClass = CBotClass::Find(p);
if (pClass == nullptr)
{
- pStack->SetError(TX_BADNEW, p);
+ pStack->SetError(CBotErrBadNew, p);
return nullptr;
}
@@ -87,7 +87,7 @@ CBotInstr* CBotNew::Compile(CBotToken* &p, CBotCStack* pStack)
int typ = r.GetType();
// if there is no constructor, and no parameters either, it's ok
- if (typ == TX_UNDEFCALL && inst->m_Parameters == nullptr) typ = 0;
+ if (typ == CBotErrUndefCall && inst->m_Parameters == nullptr) typ = 0;
pVar->SetInit(CBotVar::InitType::DEF); // mark the instance as init
if (typ>20)
@@ -99,7 +99,7 @@ CBotInstr* CBotNew::Compile(CBotToken* &p, CBotCStack* pStack)
// if the constructor does not exist, but there are parameters
if (typ<0 && inst->m_Parameters != nullptr)
{
- pStk->SetError(TX_NOCONST, &inst->m_vartoken);
+ pStk->SetError(CBotErrNoConstruct, &inst->m_vartoken);
goto error;
}
diff --git a/src/CBot/CBotInstr/CBotParExpr.cpp b/src/CBot/CBotInstr/CBotParExpr.cpp
index e4e3479..25d530d 100644
--- a/src/CBot/CBotInstr/CBotParExpr.cpp
+++ b/src/CBot/CBotInstr/CBotParExpr.cpp
@@ -59,7 +59,7 @@ CBotInstr* CBotParExpr::Compile(CBotToken* &p, CBotCStack* pStack)
{
return pStack->Return(inst, pStk);
}
- pStk->SetError(TX_CLOSEPAR, p->GetStart());
+ pStk->SetError(CBotErrClosePar, p->GetStart());
}
delete inst;
return pStack->Return(nullptr, pStk);
@@ -94,7 +94,7 @@ CBotInstr* CBotParExpr::Compile(CBotToken* &p, CBotCStack* pStack)
{
if (pStk->GetType() >= CBotTypBoolean)
{
- pStk->SetError(TX_BADTYPE, pp);
+ pStk->SetError(CBotErrBadType1, pp);
delete inst;
return pStack->Return(nullptr, pStk);
}
@@ -126,7 +126,7 @@ CBotInstr* CBotParExpr::Compile(CBotToken* &p, CBotCStack* pStack)
{
if (pStk->GetType() >= CBotTypBoolean)
{
- pStk->SetError(TX_BADTYPE, pp);
+ pStk->SetError(CBotErrBadType1, pp);
delete inst;
return pStack->Return(nullptr, pStk);
}
diff --git a/src/CBot/CBotInstr/CBotPostIncExpr.cpp b/src/CBot/CBotInstr/CBotPostIncExpr.cpp
index 9953102..b5adae5 100644
--- a/src/CBot/CBotInstr/CBotPostIncExpr.cpp
+++ b/src/CBot/CBotInstr/CBotPostIncExpr.cpp
@@ -62,12 +62,12 @@ bool CBotPostIncExpr::Execute(CBotStack* &pj)
if (var1->IsNAN())
{
- pile1->SetError(TX_OPNAN, &m_token);
+ pile1->SetError(CBotErrNan, &m_token);
}
if (!var1->IsDefined())
{
- pile1->SetError(TX_NOTINIT, &m_token);
+ pile1->SetError(CBotErrNotInit, &m_token);
}
if (GetTokenType() == ID_INC) var1->Inc();
diff --git a/src/CBot/CBotInstr/CBotPreIncExpr.cpp b/src/CBot/CBotInstr/CBotPreIncExpr.cpp
index 6e8b744..6f5f909 100644
--- a/src/CBot/CBotInstr/CBotPreIncExpr.cpp
+++ b/src/CBot/CBotInstr/CBotPreIncExpr.cpp
@@ -60,13 +60,13 @@ bool CBotPreIncExpr::Execute(CBotStack* &pj)
if (var1->IsNAN())
{
- pile->SetError(TX_OPNAN, &m_token);
+ pile->SetError(CBotErrNan, &m_token);
return pj->Return(pile); // operation performed
}
if (!var1->IsDefined())
{
- pile->SetError(TX_NOTINIT, &m_token);
+ pile->SetError(CBotErrNotInit, &m_token);
return pj->Return(pile); // operation performed
}
diff --git a/src/CBot/CBotInstr/CBotReturn.cpp b/src/CBot/CBotInstr/CBotReturn.cpp
index aeb6d52..c3915e4 100644
--- a/src/CBot/CBotInstr/CBotReturn.cpp
+++ b/src/CBot/CBotInstr/CBotReturn.cpp
@@ -60,7 +60,7 @@ CBotInstr* CBotReturn::Compile(CBotToken* &p, CBotCStack* pStack)
if ( type.GetType() == 0 ) // returned void ?
{
if ( IsOfType( p, ID_SEP ) ) return inst;
- pStack->SetError( TX_BADTYPE, pp );
+ pStack->SetError( CBotErrBadType1, pp );
return nullptr;
}
@@ -73,9 +73,9 @@ CBotInstr* CBotReturn::Compile(CBotToken* &p, CBotCStack* pStack)
if ( IsOfType( p, ID_SEP ) )
return inst;
- pStack->SetError(TX_ENDOF, p->GetStart());
+ pStack->SetError(CBotErrNoTerminator, p->GetStart());
}
- pStack->SetError(TX_BADTYPE, p->GetStart());
+ pStack->SetError(CBotErrBadType1, p->GetStart());
}
delete inst;
diff --git a/src/CBot/CBotInstr/CBotSwitch.cpp b/src/CBot/CBotInstr/CBotSwitch.cpp
index 0104d5d..5f8f7da 100644
--- a/src/CBot/CBotInstr/CBotSwitch.cpp
+++ b/src/CBot/CBotInstr/CBotSwitch.cpp
@@ -91,7 +91,7 @@ CBotInstr* CBotSwitch::Compile(CBotToken* &p, CBotCStack* pStack)
if ( inst->m_Block == nullptr )
{
- pStk->SetError(TX_NOCASE, p->GetStart());
+ pStk->SetError(CBotErrNoCase, p->GetStart());
delete inst;
return pStack->Return(nullptr, pStk);
}
@@ -106,7 +106,7 @@ CBotInstr* CBotSwitch::Compile(CBotToken* &p, CBotCStack* pStack)
if ( p == nullptr )
{
- pStk->SetError(TX_CLOSEBLK, -1);
+ pStk->SetError(CBotErrCloseBlock, -1);
delete inst;
return pStack->Return(nullptr, pStk);
}
@@ -115,21 +115,21 @@ CBotInstr* CBotSwitch::Compile(CBotToken* &p, CBotCStack* pStack)
if ( inst->m_Block == nullptr )
{
- pStk->SetError(TX_NOCASE, p->GetStart());
+ pStk->SetError(CBotErrNoCase, p->GetStart());
delete inst;
return pStack->Return(nullptr, pStk);
}
// the statement block is ok
return pStack->Return(inst, pStk); // return an object to the application
}
- pStk->SetError( TX_OPENBLK, p->GetStart() );
+ pStk->SetError( CBotErrOpenBlock, p->GetStart() );
}
- pStk->SetError( TX_CLOSEPAR, p->GetStart() );
+ pStk->SetError( CBotErrClosePar, p->GetStart() );
}
- pStk->SetError( TX_BADTYPE, p->GetStart() );
+ pStk->SetError( CBotErrBadType1, p->GetStart() );
}
}
- pStk->SetError( TX_OPENPAR, p->GetStart());
+ pStk->SetError( CBotErrOpenPar, p->GetStart());
delete inst; // error, frees up
return pStack->Return(nullptr, pStk); // no object, the error is on the stack
diff --git a/src/CBot/CBotInstr/CBotThrow.cpp b/src/CBot/CBotInstr/CBotThrow.cpp
index 4525dbb..44c43f0 100644
--- a/src/CBot/CBotInstr/CBotThrow.cpp
+++ b/src/CBot/CBotInstr/CBotThrow.cpp
@@ -61,7 +61,7 @@ CBotInstr* CBotThrow::Compile(CBotToken* &p, CBotCStack* pStack)
{
return inst; // return an object to the application
}
- pStack->SetError(TX_BADTYPE, pp);
+ pStack->SetError(CBotErrBadType1, pp);
delete inst; // error, frees up
return nullptr; // no object, the error is on the stack
@@ -82,7 +82,7 @@ bool CBotThrow::Execute(CBotStack* &pj)
if ( pile->IfStep() ) return false;
int val = pile->GetVal();
- if ( val < 0 ) val = TX_BADTHROW;
+ if ( val < 0 ) val = CBotErrBadThrow;
pile->SetError( val, &m_token );
return pj->Return( pile );
}
diff --git a/src/CBot/CBotInstr/CBotTwoOpExpr.cpp b/src/CBot/CBotInstr/CBotTwoOpExpr.cpp
index 26342f9..bb3375f 100644
--- a/src/CBot/CBotInstr/CBotTwoOpExpr.cpp
+++ b/src/CBot/CBotInstr/CBotTwoOpExpr.cpp
@@ -147,7 +147,7 @@ CBotInstr* CBotTwoOpExpr::Compile(CBotToken* &p, CBotCStack* pStack, int* pOpera
{
if ( !type1.Eq(CBotTypBoolean) )
{
- pStk->SetError( TX_BADTYPE, p);
+ pStk->SetError( CBotErrBadType1, p);
return pStack->Return(nullptr, pStk);
}
CBotLogicExpr* inst = new CBotLogicExpr();
@@ -158,7 +158,7 @@ CBotInstr* CBotTwoOpExpr::Compile(CBotToken* &p, CBotCStack* pStack, int* pOpera
CBotToken* pp = p;
if ( inst->m_op1 == nullptr || !IsOfType( p, ID_DOTS ) )
{
- pStk->SetError( TX_MISDOTS, p->GetStart());
+ pStk->SetError( CBotErrNoDoubleDots, p->GetStart());
delete inst;
return pStack->Return(nullptr, pStk);
}
@@ -167,14 +167,14 @@ CBotInstr* CBotTwoOpExpr::Compile(CBotToken* &p, CBotCStack* pStack, int* pOpera
inst->m_op2 = CBotExpression::Compile(p, pStk);
if ( inst->m_op2 == nullptr )
{
- pStk->SetError( TX_ENDOF, p->GetStart() );
+ pStk->SetError( CBotErrNoTerminator, p->GetStart() );
delete inst;
return pStack->Return(nullptr, pStk);
}
type2 = pStk->GetTypResult();
if (!TypeCompatible(type1, type2))
{
- pStk->SetError( TX_BAD2TYPE, pp );
+ pStk->SetError( CBotErrBadType2, pp );
delete inst;
return pStack->Return(nullptr, pStk);
}
@@ -247,7 +247,7 @@ CBotInstr* CBotTwoOpExpr::Compile(CBotToken* &p, CBotCStack* pStack, int* pOpera
if ( !TypeCompatible (type1, type2, TypeOp) ) // the results are compatible
{
- pStk->SetError(TX_BAD2TYPE, &i->m_token);
+ pStk->SetError(CBotErrBadType2, &i->m_token);
delete i;
return pStack->Return(nullptr, pStk);
}
@@ -265,7 +265,7 @@ CBotInstr* CBotTwoOpExpr::Compile(CBotToken* &p, CBotCStack* pStack, int* pOpera
// and returns the requested object
return pStack->Return(inst, pStk);
}
- pStk->SetError(TX_BAD2TYPE, &inst->m_token);
+ pStk->SetError(CBotErrBadType2, &inst->m_token);
}
// in case of error, releases the elements
@@ -291,7 +291,7 @@ bool IsNan(CBotVar* left, CBotVar* right, int* err = nullptr)
{
if ( VarIsNAN(left) || VarIsNAN(right) )
{
- if ( err != nullptr ) *err = TX_OPNAN ;
+ if ( err != nullptr ) *err = CBotErrNan ;
return true;
}
return false;
diff --git a/src/CBot/CBotProgram.cpp b/src/CBot/CBotProgram.cpp
index 6ac9f43..a02e8e0 100644
--- a/src/CBot/CBotProgram.cpp
+++ b/src/CBot/CBotProgram.cpp
@@ -195,7 +195,7 @@ bool CBotProgram::Start(const std::string& name)
if ( m_pRun == nullptr )
{
- m_ErrorCode = TX_NORUN;
+ m_ErrorCode = CBotErrNoRun;
return false;
}
@@ -277,7 +277,7 @@ bool CBotProgram::Run(void* pUser, int timer)
return ok;
error:
- m_ErrorCode = TX_NORUN;
+ m_ErrorCode = CBotErrNoRun;
return true;
}
@@ -388,7 +388,7 @@ bool CBotProgram::AddFunction(const std::string& name,
////////////////////////////////////////////////////////////////////////////////
bool rSizeOf( CBotVar* pVar, CBotVar* pResult, int& ex, void* pUser )
{
- if ( pVar == nullptr ) return TX_LOWPARAM;
+ if ( pVar == nullptr ) return CBotErrLowParam;
int i = 0;
pVar = pVar->GetItemList();
@@ -406,9 +406,9 @@ bool rSizeOf( CBotVar* pVar, CBotVar* pResult, int& ex, void* pUser )
////////////////////////////////////////////////////////////////////////////////
CBotTypResult cSizeOf( CBotVar* &pVar, void* pUser )
{
- if ( pVar == nullptr ) return CBotTypResult( TX_LOWPARAM );
+ if ( pVar == nullptr ) return CBotTypResult( CBotErrLowParam );
if ( pVar->GetType() != CBotTypArrayPointer )
- return CBotTypResult( TX_BADPARAM );
+ return CBotTypResult( CBotErrBadParam );
return CBotTypResult( CBotTypInt );
}
@@ -480,18 +480,18 @@ int CBotProgram::GetVersion()
////////////////////////////////////////////////////////////////////////////////
void CBotProgram::Init()
{
- CBotToken::DefineNum("CBotErrZeroDiv", TX_DIVZERO); // division by zero
- CBotToken::DefineNum("CBotErrNotInit", TX_NOTINIT); // uninitialized variable
- CBotToken::DefineNum("CBotErrBadThrow", TX_BADTHROW); // throw a negative value
- CBotToken::DefineNum("CBotErrNoRetVal", TX_NORETVAL); // function did not return results
- CBotToken::DefineNum("CBotErrNoRun", TX_NORUN); // active Run () without a function // TODO: Is this actually a runtime error?
- CBotToken::DefineNum("CBotErrUndefFunc", TX_NOCALL); // Calling a function that no longer exists
- CBotToken::DefineNum("CBotErrNotClass", TX_NOCLASS); // Class no longer exists
- CBotToken::DefineNum("CBotErrNull", TX_NULLPT); // Attempted to use a null pointer
- CBotToken::DefineNum("CBotErrNan", TX_OPNAN); // Can't do operations on nan
- CBotToken::DefineNum("CBotErrOutArray", TX_OUTARRAY); // Attempted access out of bounds of an array
- CBotToken::DefineNum("CBotErrStackOver", TX_STACKOVER); // Stack overflow
- CBotToken::DefineNum("CBotErrDeletedPtr", TX_DELETEDPT); // Attempted to use deleted object
+ CBotToken::DefineNum("CBotErrZeroDiv", CBotErrZeroDiv); // division by zero
+ CBotToken::DefineNum("CBotErrNotInit", CBotErrNotInit); // uninitialized variable
+ CBotToken::DefineNum("CBotErrBadThrow", CBotErrBadThrow); // throw a negative value
+ CBotToken::DefineNum("CBotErrNoRetVal", CBotErrNoRetVal); // function did not return results
+ CBotToken::DefineNum("CBotErrNoRun", CBotErrNoRun); // active Run () without a function // TODO: Is this actually a runtime error?
+ CBotToken::DefineNum("CBotErrUndefFunc", CBotErrUndefFunc); // Calling a function that no longer exists
+ CBotToken::DefineNum("CBotErrNotClass", CBotErrNotClass); // Class no longer exists
+ CBotToken::DefineNum("CBotErrNull", CBotErrNull); // Attempted to use a null pointer
+ CBotToken::DefineNum("CBotErrNan", CBotErrNan); // Can't do operations on nan
+ CBotToken::DefineNum("CBotErrOutArray", CBotErrOutArray); // Attempted access out of bounds of an array
+ CBotToken::DefineNum("CBotErrStackOver", CBotErrStackOver); // Stack overflow
+ CBotToken::DefineNum("CBotErrDeletedPtr", CBotErrDeletedPtr); // Attempted to use deleted object
CBotProgram::AddFunction("sizeof", rSizeOf, cSizeOf );
diff --git a/src/CBot/CBotStack.cpp b/src/CBot/CBotStack.cpp
index f77b9f7..fb69c5e 100644
--- a/src/CBot/CBotStack.cpp
+++ b/src/CBot/CBotStack.cpp
@@ -252,7 +252,7 @@ bool CBotStack::ReturnKeep(CBotStack* pfils)
bool CBotStack::StackOver()
{
if (!m_bOver) return false;
- m_error = TX_STACKOVER;
+ m_error = CBotErrStackOver;
return true;
}
@@ -784,7 +784,7 @@ bool CBotStack::ExecuteCall(long& nIdent, CBotToken* token, CBotVar** ppVar, CBo
res = m_prog->GetFunctions()->DoCall(nIdent, token->GetString(), ppVar, this, token );
if (res.GetType() >= 0) return res.GetType();
- SetError(TX_NOCALL, token);
+ SetError(CBotErrUndefFunc, token);
return true;
}
diff --git a/src/CBot/CBotUtils.cpp b/src/CBot/CBotUtils.cpp
index c098e46..fe51f7f 100644
--- a/src/CBot/CBotUtils.cpp
+++ b/src/CBot/CBotUtils.cpp
@@ -101,7 +101,7 @@ CBotTypResult ArrayType(CBotToken* &p, CBotCStack* pile, CBotTypResult type)
{
if ( !IsOfType( p, ID_CLBRK ) )
{
- pile->SetError(TX_CLBRK, p->GetStart());
+ pile->SetError(CBotErrCloseIndex, p->GetStart());
return CBotTypResult( -1 );
}
type = CBotTypResult( CBotTypArrayPointer, type );
diff --git a/src/CBot/CBotVar/CBotVarFloat.cpp b/src/CBot/CBotVar/CBotVarFloat.cpp
index e5b4132..23a1977 100644
--- a/src/CBot/CBotVar/CBotVarFloat.cpp
+++ b/src/CBot/CBotVar/CBotVarFloat.cpp
@@ -136,7 +136,7 @@ int CBotVarFloat::Div(CBotVar* left, CBotVar* right)
m_val = left->GetValFloat() / r;
m_binit = CBotVar::InitType::DEF;
}
- return ( r == 0 ? TX_DIVZERO : 0 );
+ return ( r == 0 ? CBotErrZeroDiv : 0 );
}
////////////////////////////////////////////////////////////////////////////////
@@ -148,7 +148,7 @@ int CBotVarFloat::Modulo(CBotVar* left, CBotVar* right)
m_val = static_cast<float>(fmod( left->GetValFloat() , r ));
m_binit = CBotVar::InitType::DEF;
}
- return ( r == 0 ? TX_DIVZERO : 0 );
+ return ( r == 0 ? CBotErrZeroDiv : 0 );
}
////////////////////////////////////////////////////////////////////////////////
diff --git a/src/CBot/CBotVar/CBotVarInt.cpp b/src/CBot/CBotVar/CBotVarInt.cpp
index 3e3a182..e6ed9d4 100644
--- a/src/CBot/CBotVar/CBotVarInt.cpp
+++ b/src/CBot/CBotVar/CBotVarInt.cpp
@@ -139,7 +139,7 @@ int CBotVarInt::Div(CBotVar* left, CBotVar* right)
m_val = left->GetValInt() / r;
m_binit = CBotVar::InitType::DEF;
}
- return ( r == 0 ? TX_DIVZERO : 0 );
+ return ( r == 0 ? CBotErrZeroDiv : 0 );
}
////////////////////////////////////////////////////////////////////////////////
@@ -151,7 +151,7 @@ int CBotVarInt::Modulo(CBotVar* left, CBotVar* right)
m_val = left->GetValInt() % r;
m_binit = CBotVar::InitType::DEF;
}
- return ( r == 0 ? TX_DIVZERO : 0 );
+ return ( r == 0 ? CBotErrZeroDiv : 0 );
}
////////////////////////////////////////////////////////////////////////////////
diff --git a/src/CBot/stdlib/Compilation.cpp b/src/CBot/stdlib/Compilation.cpp
index a0174a6..fd820bf 100644
--- a/src/CBot/stdlib/Compilation.cpp
+++ b/src/CBot/stdlib/Compilation.cpp
@@ -89,14 +89,14 @@ CBotTypResult cOneIntReturnBool(CBotVar* &var, void* user)
CBotTypResult cStrStr(CBotVar*& var, void* user)
{
// it takes a parameter
- if ( var == nullptr ) return CBotTypResult( TX_LOWPARAM );
+ if ( var == nullptr ) return CBotTypResult( CBotErrLowParam );
// to be a string
if ( var->GetType() != CBotTypString )
- return CBotTypResult( TX_BADSTRING );
+ return CBotTypResult( CBotErrBadString );
// no second parameter
- if ( var->GetNext() != nullptr ) return CBotTypResult( TX_OVERPARAM );
+ if ( var->GetNext() != nullptr ) return CBotTypResult( CBotErrOverParam );
// the end result is a string
return CBotTypResult( CBotTypString );
@@ -105,22 +105,22 @@ CBotTypResult cStrStr(CBotVar*& var, void* user)
CBotTypResult cIntStrStr(CBotVar*& var, void* user)
{
// it takes a parameter
- if ( var == nullptr ) return CBotTypResult( TX_LOWPARAM );
+ if ( var == nullptr ) return CBotTypResult( CBotErrLowParam );
// to be a string
if ( var->GetType() != CBotTypString )
- return CBotTypResult( TX_BADSTRING );
+ return CBotTypResult( CBotErrBadString );
// it takes a second parameter
var = var->GetNext();
- if ( var == nullptr ) return CBotTypResult( TX_LOWPARAM );
+ if ( var == nullptr ) return CBotTypResult( CBotErrLowParam );
// to be a string
if ( var->GetType() != CBotTypString )
- return CBotTypResult( TX_BADSTRING );
+ return CBotTypResult( CBotErrBadString );
// no third parameter
- if ( var->GetNext() != nullptr ) return CBotTypResult( TX_OVERPARAM );
+ if ( var->GetNext() != nullptr ) return CBotTypResult( CBotErrOverParam );
// the end result is a number
return CBotTypResult( CBotTypInt );
@@ -129,14 +129,14 @@ CBotTypResult cIntStrStr(CBotVar*& var, void* user)
CBotTypResult cFloatStr(CBotVar*& var, void* user)
{
// it takes a parameter
- if ( var == nullptr ) return CBotTypResult(TX_LOWPARAM );
+ if ( var == nullptr ) return CBotTypResult(CBotErrLowParam );
// to be a string
if ( var->GetType() != CBotTypString )
- return CBotTypResult( TX_BADSTRING );
+ return CBotTypResult( CBotErrBadString );
// no second parameter
- if ( var->GetNext() != nullptr ) return CBotTypResult( TX_OVERPARAM );
+ if ( var->GetNext() != nullptr ) return CBotTypResult( CBotErrOverParam );
// the end result is a number
return CBotTypResult( CBotTypFloat );
@@ -145,19 +145,19 @@ CBotTypResult cFloatStr(CBotVar*& var, void* user)
CBotTypResult cStrStrIntInt(CBotVar*& var, void* user)
{
// it takes a parameter
- if ( var == nullptr ) return CBotTypResult( TX_LOWPARAM );
+ if ( var == nullptr ) return CBotTypResult( CBotErrLowParam );
// to be a string
if ( var->GetType() != CBotTypString )
- return CBotTypResult( TX_BADSTRING );
+ return CBotTypResult( CBotErrBadString );
// it takes a second parameter
var = var->GetNext();
- if ( var == nullptr ) return CBotTypResult( TX_LOWPARAM );
+ if ( var == nullptr ) return CBotTypResult( CBotErrLowParam );
// which must be a number
if ( var->GetType() > CBotTypDouble )
- return CBotTypResult( TX_BADNUM );
+ return CBotTypResult( CBotErrBadNum );
// third parameter optional
if ( var->GetNext() != nullptr )
@@ -166,10 +166,10 @@ CBotTypResult cStrStrIntInt(CBotVar*& var, void* user)
var = var->GetNext();
// which must be a number
if ( var->GetType() > CBotTypDouble )
- return CBotTypResult( TX_BADNUM );
+ return CBotTypResult( CBotErrBadNum );
// no fourth parameter
- if ( var->GetNext() != nullptr ) return CBotTypResult( TX_OVERPARAM );
+ if ( var->GetNext() != nullptr ) return CBotTypResult( CBotErrOverParam );
}
// the end result is a string
@@ -179,22 +179,22 @@ CBotTypResult cStrStrIntInt(CBotVar*& var, void* user)
CBotTypResult cStrStrInt(CBotVar*& var, void* user)
{
// it takes a parameter
- if ( var == nullptr ) return CBotTypResult( TX_LOWPARAM );
+ if ( var == nullptr ) return CBotTypResult( CBotErrLowParam );
// to be a string
if ( var->GetType() != CBotTypString )
- return CBotTypResult( TX_BADSTRING );
+ return CBotTypResult( CBotErrBadString );
// it takes a second parameter
var = var->GetNext();
- if ( var == nullptr ) return CBotTypResult( TX_LOWPARAM );
+ if ( var == nullptr ) return CBotTypResult( CBotErrLowParam );
// which must be a number
if ( var->GetType() > CBotTypDouble )
- return CBotTypResult( TX_BADNUM );
+ return CBotTypResult( CBotErrBadNum );
// no third parameter
- if ( var->GetNext() != nullptr ) return CBotTypResult( TX_OVERPARAM );
+ if ( var->GetNext() != nullptr ) return CBotTypResult( CBotErrOverParam );
// the end result is a string
return CBotTypResult( CBotTypString );
@@ -203,14 +203,14 @@ CBotTypResult cStrStrInt(CBotVar*& var, void* user)
CBotTypResult cIntStr(CBotVar*& var, void* user)
{
// it takes a parameter
- if ( var == nullptr ) return CBotTypResult( TX_LOWPARAM );
+ if ( var == nullptr ) return CBotTypResult( CBotErrLowParam );
// to be a string
if ( var->GetType() != CBotTypString )
- return CBotTypResult( TX_BADPARAM );
+ return CBotTypResult( CBotErrBadParam );
// no second parameter
- if ( var->GetNext() != nullptr ) return CBotTypResult( TX_OVERPARAM );
+ if ( var->GetNext() != nullptr ) return CBotTypResult( CBotErrOverParam );
// the end result is an integer
return CBotTypResult( CBotTypInt );
diff --git a/src/CBot/stdlib/StringFunctions.cpp b/src/CBot/stdlib/StringFunctions.cpp
index 91c6362..6bcaaf6 100644
--- a/src/CBot/stdlib/StringFunctions.cpp
+++ b/src/CBot/stdlib/StringFunctions.cpp
@@ -34,13 +34,13 @@
bool rStrLen( CBotVar* pVar, CBotVar* pResult, int& ex, void* pUser )
{
// it takes a parameter
- if ( pVar == nullptr ) { ex = TX_LOWPARAM ; return true; }
+ if ( pVar == nullptr ) { ex = CBotErrLowParam ; return true; }
// to be a string
- if ( pVar->GetType() != CBotTypString ) { ex = TX_BADSTRING ; return true; }
+ if ( pVar->GetType() != CBotTypString ) { ex = CBotErrBadString ; return true; }
// no second parameter
- if ( pVar->GetNext() != nullptr ) { ex = TX_OVERPARAM ; return true; }
+ if ( pVar->GetNext() != nullptr ) { ex = CBotErrOverParam ; return true; }
// get the contents of the string
std::string s = pVar->GetValString();
@@ -54,26 +54,26 @@ bool rStrLen( CBotVar* pVar, CBotVar* pResult, int& ex, void* pUser )
bool rStrLeft( CBotVar* pVar, CBotVar* pResult, int& ex, void* pUser )
{
// it takes a parameter
- if ( pVar == nullptr ) { ex = TX_LOWPARAM ; return true; }
+ if ( pVar == nullptr ) { ex = CBotErrLowParam ; return true; }
// to be a string
- if ( pVar->GetType() != CBotTypString ) { ex = TX_BADSTRING ; return true; }
+ if ( pVar->GetType() != CBotTypString ) { ex = CBotErrBadString ; return true; }
// get the contents of the string
std::string s = pVar->GetValString();
// it takes a second parameter
pVar = pVar->GetNext();
- if ( pVar == nullptr ) { ex = TX_LOWPARAM ; return true; }
+ if ( pVar == nullptr ) { ex = CBotErrLowParam ; return true; }
// which must be a number
- if ( pVar->GetType() > CBotTypDouble ) { ex = TX_BADNUM ; return true; }
+ if ( pVar->GetType() > CBotTypDouble ) { ex = CBotErrBadNum ; return true; }
// retrieves this number
int n = pVar->GetValInt();
// no third parameter
- if ( pVar->GetNext() != nullptr ) { ex = TX_OVERPARAM ; return true; }
+ if ( pVar->GetNext() != nullptr ) { ex = CBotErrOverParam ; return true; }
// takes the interesting part
s = s.substr(0, n);
@@ -87,26 +87,26 @@ bool rStrLeft( CBotVar* pVar, CBotVar* pResult, int& ex, void* pUser )
bool rStrRight( CBotVar* pVar, CBotVar* pResult, int& ex, void* pUser )
{
// it takes a parameter
- if ( pVar == nullptr ) { ex = TX_LOWPARAM ; return true; }
+ if ( pVar == nullptr ) { ex = CBotErrLowParam ; return true; }
// to be a string
- if ( pVar->GetType() != CBotTypString ) { ex = TX_BADSTRING ; return true; }
+ if ( pVar->GetType() != CBotTypString ) { ex = CBotErrBadString ; return true; }
// get the contents of the string
std::string s = pVar->GetValString();
// it takes a second parameter
pVar = pVar->GetNext();
- if ( pVar == nullptr ) { ex = TX_LOWPARAM ; return true; }
+ if ( pVar == nullptr ) { ex = CBotErrLowParam ; return true; }
// which must be a number
- if ( pVar->GetType() > CBotTypDouble ) { ex = TX_BADNUM ; return true; }
+ if ( pVar->GetType() > CBotTypDouble ) { ex = CBotErrBadNum ; return true; }
// retrieves this number
int n = pVar->GetValInt();
// no third parameter
- if ( pVar->GetNext() != nullptr ) { ex = TX_OVERPARAM ; return true; }
+ if ( pVar->GetNext() != nullptr ) { ex = CBotErrOverParam ; return true; }
// takes the interesting part
s = s.substr(s.length()-n, std::string::npos);
@@ -120,20 +120,20 @@ bool rStrRight( CBotVar* pVar, CBotVar* pResult, int& ex, void* pUser )
bool rStrMid( CBotVar* pVar, CBotVar* pResult, int& ex, void* pUser )
{
// it takes a parameter
- if ( pVar == nullptr ) { ex = TX_LOWPARAM ; return true; }
+ if ( pVar == nullptr ) { ex = CBotErrLowParam ; return true; }
// to be a string
- if ( pVar->GetType() != CBotTypString ) { ex = TX_BADSTRING ; return true; }
+ if ( pVar->GetType() != CBotTypString ) { ex = CBotErrBadString ; return true; }
// get the contents of the string
std::string s = pVar->GetValString();
// it takes a second parameter
pVar = pVar->GetNext();
- if ( pVar == nullptr ) { ex = TX_LOWPARAM ; return true; }
+ if ( pVar == nullptr ) { ex = CBotErrLowParam ; return true; }
// which must be a number
- if ( pVar->GetType() > CBotTypDouble ) { ex = TX_BADNUM ; return true; }
+ if ( pVar->GetType() > CBotTypDouble ) { ex = CBotErrBadNum ; return true; }
// retrieves this number
int n = pVar->GetValInt();
@@ -144,13 +144,13 @@ bool rStrMid( CBotVar* pVar, CBotVar* pResult, int& ex, void* pUser )
pVar = pVar->GetNext();
// which must be a number
- if ( pVar->GetType() > CBotTypDouble ) { ex = TX_BADNUM ; return true; }
+ if ( pVar->GetType() > CBotTypDouble ) { ex = CBotErrBadNum ; return true; }
// retrieves this number
int l = pVar->GetValInt();
// but no fourth parameter
- if ( pVar->GetNext() != nullptr ){ ex = TX_OVERPARAM ; return true; }
+ if ( pVar->GetNext() != nullptr ){ ex = CBotErrOverParam ; return true; }
// takes the interesting part
s = s.substr(n, l);
@@ -170,16 +170,16 @@ bool rStrMid( CBotVar* pVar, CBotVar* pResult, int& ex, void* pUser )
bool rStrVal( CBotVar* pVar, CBotVar* pResult, int& ex, void* pUser )
{
// it takes a parameter
- if ( pVar == nullptr ) { ex = TX_LOWPARAM ; return true; }
+ if ( pVar == nullptr ) { ex = CBotErrLowParam ; return true; }
// to be a string
- if ( pVar->GetType() != CBotTypString ) { ex = TX_BADSTRING ; return true; }
+ if ( pVar->GetType() != CBotTypString ) { ex = CBotErrBadString ; return true; }
// get the contents of the string
std::string s = pVar->GetValString();
// but no second parameter
- if ( pVar->GetNext() != nullptr ){ ex = TX_OVERPARAM ; return true; }
+ if ( pVar->GetNext() != nullptr ){ ex = CBotErrOverParam ; return true; }
float val = GetNumFloat(s);
@@ -192,26 +192,26 @@ bool rStrVal( CBotVar* pVar, CBotVar* pResult, int& ex, void* pUser )
bool rStrFind( CBotVar* pVar, CBotVar* pResult, int& ex, void* pUser )
{
// it takes a parameter
- if ( pVar == nullptr ) { ex = TX_LOWPARAM ; return true; }
+ if ( pVar == nullptr ) { ex = CBotErrLowParam ; return true; }
// to be a string
- if ( pVar->GetType() != CBotTypString ) { ex = TX_BADSTRING ; return true; }
+ if ( pVar->GetType() != CBotTypString ) { ex = CBotErrBadString ; return true; }
// get the contents of the string
std::string s = pVar->GetValString();
// it takes a second parameter
pVar = pVar->GetNext();
- if ( pVar == nullptr ) { ex = TX_LOWPARAM ; return true; }
+ if ( pVar == nullptr ) { ex = CBotErrLowParam ; return true; }
// to be a string
- if ( pVar->GetType() != CBotTypString ) { ex = TX_BADSTRING ; return true; }
+ if ( pVar->GetType() != CBotTypString ) { ex = CBotErrBadString ; return true; }
// retrieves this number
std::string s2 = pVar->GetValString();
// no third parameter
- if ( pVar->GetNext() != nullptr ) { ex = TX_OVERPARAM ; return true; }
+ if ( pVar->GetNext() != nullptr ) { ex = CBotErrOverParam ; return true; }
// puts the result on the stack
std::size_t res = s.find(s2);
@@ -224,16 +224,16 @@ bool rStrFind( CBotVar* pVar, CBotVar* pResult, int& ex, void* pUser )
bool rStrUpper( CBotVar* pVar, CBotVar* pResult, int& ex, void* pUser )
{
// it takes a parameter
- if ( pVar == nullptr ) { ex = TX_LOWPARAM ; return true; }
+ if ( pVar == nullptr ) { ex = CBotErrLowParam ; return true; }
// to be a string
- if ( pVar->GetType() != CBotTypString ) { ex = TX_BADSTRING ; return true; }
+ if ( pVar->GetType() != CBotTypString ) { ex = CBotErrBadString ; return true; }
// get the contents of the string
std::string s = pVar->GetValString();
// but no second parameter
- if ( pVar->GetNext() != nullptr ){ ex = TX_OVERPARAM ; return true; }
+ if ( pVar->GetNext() != nullptr ){ ex = CBotErrOverParam ; return true; }
boost::to_upper(s);
@@ -247,16 +247,16 @@ bool rStrUpper( CBotVar* pVar, CBotVar* pResult, int& ex, void* pUser )
bool rStrLower( CBotVar* pVar, CBotVar* pResult, int& ex, void* pUser )
{
// it takes a parameter
- if ( pVar == nullptr ) { ex = TX_LOWPARAM ; return true; }
+ if ( pVar == nullptr ) { ex = CBotErrLowParam ; return true; }
// to be a string
- if ( pVar->GetType() != CBotTypString ) { ex = TX_BADSTRING ; return true; }
+ if ( pVar->GetType() != CBotTypString ) { ex = CBotErrBadString ; return true; }
// get the contents of the string
std::string s = pVar->GetValString();
// but no second parameter
- if ( pVar->GetNext() != nullptr ){ ex = TX_OVERPARAM ; return true; }
+ if ( pVar->GetNext() != nullptr ){ ex = CBotErrOverParam ; return true; }
boost::to_lower(s);
diff --git a/src/common/restext.cpp b/src/common/restext.cpp
index db7a6c4..8ef7716 100644
--- a/src/common/restext.cpp
+++ b/src/common/restext.cpp
@@ -670,64 +670,66 @@ void InitializeRestext()
- stringsCbot[TX_OPENPAR] = TR("Opening bracket missing");
- stringsCbot[TX_CLOSEPAR] = TR("Closing bracket missing ");
- stringsCbot[TX_NOTBOOL] = TR("The expression must return a boolean value");
- stringsCbot[TX_UNDEFVAR] = TR("Variable not declared");
- stringsCbot[TX_BADLEFT] = TR("Assignment impossible");
- stringsCbot[TX_ENDOF] = TR("Semicolon terminator missing");
- stringsCbot[TX_OUTCASE] = TR("Instruction \"case\" outside a block \"switch\"");
- stringsCbot[TX_CLOSEBLK] = TR("End of block missing");
- stringsCbot[TX_ELSEWITHOUTIF] = TR("Instruction \"else\" without corresponding \"if\" ");
- stringsCbot[TX_OPENBLK] = TR("Opening brace missing ");
- stringsCbot[TX_BADTYPE] = TR("Wrong type for the assignment");
- stringsCbot[TX_REDEFVAR] = TR("A variable can not be declared twice");
- stringsCbot[TX_BAD2TYPE] = TR("The types of the two operands are incompatible ");
- stringsCbot[TX_UNDEFCALL] = TR("Unknown function");
- stringsCbot[TX_MISDOTS] = TR("Sign \" : \" missing");
- stringsCbot[TX_WHILE] = TR("Keyword \"while\" missing");
- stringsCbot[TX_BREAK] = TR("Instruction \"break\" outside a loop");
- stringsCbot[TX_LABEL] = TR("A label must be followed by \"for\"; \"while\"; \"do\" or \"switch\"");
- stringsCbot[TX_NOLABEL] = TR("This label does not exist");
- stringsCbot[TX_NOCASE] = TR("Instruction \"case\" missing");
- stringsCbot[TX_BADNUM] = TR("Number missing");
- stringsCbot[TX_VOID] = TR("Void parameter");
- stringsCbot[TX_NOTYP] = TR("Type declaration missing");
- stringsCbot[TX_NOVAR] = TR("Variable name missing");
- stringsCbot[TX_NOFONC] = TR("Function name missing");
- stringsCbot[TX_OVERPARAM] = TR("Too many parameters");
- stringsCbot[TX_REDEF] = TR("Function already exists");
- stringsCbot[TX_LOWPARAM] = TR("Parameters missing ");
- stringsCbot[TX_BADPARAM] = TR("No function with this name accepts this kind of parameter");
- stringsCbot[TX_NUMPARAM] = TR("No function with this name accepts this number of parameters");
- stringsCbot[TX_NOITEM] = TR("This is not a member of this class");
- stringsCbot[TX_DOT] = TR("This object is not a member of a class");
- stringsCbot[TX_NOCONST] = TR("Appropriate constructor missing");
- stringsCbot[TX_REDEFCLASS] = TR("This class already exists");
- stringsCbot[TX_CLBRK] = TR("\" ] \" missing");
- stringsCbot[TX_RESERVED] = TR("Reserved keyword of CBOT language");
- stringsCbot[TX_BADNEW] = TR("Bad argument for \"new\"");
- stringsCbot[TX_OPBRK] = TR("\" [ \" expected");
- stringsCbot[TX_BADSTRING] = TR("String missing");
- stringsCbot[TX_BADINDEX] = TR("Incorrect index type");
- stringsCbot[TX_PRIVATE] = TR("Private element");
- stringsCbot[TX_NOPUBLIC] = TR("Public required");
- stringsCbot[TX_DIVZERO] = TR("Dividing by zero");
- stringsCbot[TX_NOTINIT] = TR("Variable not initialized");
- stringsCbot[TX_BADTHROW] = TR("Negative value rejected by \"throw\"");
- stringsCbot[TX_NORETVAL] = TR("The function returned no value ");
- stringsCbot[TX_NORUN] = TR("No function running");
- stringsCbot[TX_NOCALL] = TR("Calling an unknown function");
- stringsCbot[TX_NOCLASS] = TR("This class does not exist");
- stringsCbot[TX_NULLPT] = TR("Unknown Object");
- stringsCbot[TX_OPNAN] = TR("Operation impossible with value \"nan\"");
- stringsCbot[TX_OUTARRAY] = TR("Access beyond array limit");
- stringsCbot[TX_STACKOVER] = TR("Stack overflow");
- stringsCbot[TX_DELETEDPT] = TR("Illegal object");
- stringsCbot[TX_FILEOPEN] = TR("Can't open file");
- stringsCbot[TX_NOTOPEN] = TR("File not open");
- stringsCbot[TX_ERRREAD] = TR("Read error");
- stringsCbot[TX_ERRWRITE] = TR("Write error");
+ stringsCbot[CBotErrOpenPar] = TR("Opening bracket missing");
+ stringsCbot[CBotErrClosePar] = TR("Closing bracket missing ");
+ stringsCbot[CBotErrNotBoolean] = TR("The expression must return a boolean value");
+ stringsCbot[CBotErrUndefVar] = TR("Variable not declared");
+ stringsCbot[CBotErrBadLeft] = TR("Assignment impossible");
+ stringsCbot[CBotErrNoTerminator] = TR("Semicolon terminator missing");
+ stringsCbot[CBotErrCaseOut] = TR("Instruction \"case\" outside a block \"switch\"");
+ stringsCbot[CBotErrNoEnd] = TR("Instructions after the final closing brace");
+ stringsCbot[CBotErrCloseBlock] = TR("End of block missing");
+ stringsCbot[CBotErrElseWhitoutIf] = TR("Instruction \"else\" without corresponding \"if\" ");
+ stringsCbot[CBotErrOpenBlock] = TR("Opening brace missing ");
+ stringsCbot[CBotErrBadType1] = TR("Wrong type for the assignment");
+ stringsCbot[CBotErrRedefVar] = TR("A variable can not be declared twice");
+ stringsCbot[CBotErrBadType2] = TR("The types of the two operands are incompatible ");
+ stringsCbot[CBotErrUndefCall] = TR("Unknown function");
+ stringsCbot[CBotErrNoDoubleDots] = TR("Sign \" : \" missing");
+ stringsCbot[CBotErrNoWhile] = TR("Keyword \"while\" missing");
+ stringsCbot[CBotErrBreakOutside] = TR("Instruction \"break\" outside a loop");
+ stringsCbot[CBotErrLabel] = TR("A label must be followed by \"for\"; \"while\"; \"do\" or \"switch\"");
+ stringsCbot[CBotErrUndefLabel] = TR("This label does not exist");
+ stringsCbot[CBotErrNoCase] = TR("Instruction \"case\" missing");
+ stringsCbot[CBotErrBadNum] = TR("Number missing");
+ stringsCbot[CBotErrVoid] = TR("Void parameter");
+ stringsCbot[CBotErrNoType] = TR("Type declaration missing");
+ stringsCbot[CBotErrNoVar] = TR("Variable name missing");
+ stringsCbot[CBotErrNoFunc] = TR("Function name missing");
+ stringsCbot[CBotErrOverParam] = TR("Too many parameters");
+ stringsCbot[CBotErrRedefFunc] = TR("Function already exists");
+ stringsCbot[CBotErrLowParam] = TR("Parameters missing ");
+ stringsCbot[CBotErrBadParam] = TR("No function with this name accepts this kind of parameter");
+ stringsCbot[CBotErrNbParam] = TR("No function with this name accepts this number of parameters");
+ stringsCbot[CBotErrUndefItem] = TR("This is not a member of this class");
+ stringsCbot[CBotErrUndefClass] = TR("This object is not a member of a class");
+ stringsCbot[CBotErrNoConstruct] = TR("Appropriate constructor missing");
+ stringsCbot[CBotErrRedefClass] = TR("This class already exists");
+ stringsCbot[CBotErrCloseIndex] = TR("\" ] \" missing");
+ stringsCbot[CBotErrReserved] = TR("Reserved keyword of CBOT language");
+ stringsCbot[CBotErrBadNew] = TR("Bad argument for \"new\"");
+ stringsCbot[CBotErrOpenIndex] = TR("\" [ \" expected");
+ stringsCbot[CBotErrBadString] = TR("String missing");
+ stringsCbot[CBotErrBadIndex] = TR("Incorrect index type");
+ stringsCbot[CBotErrPrivate] = TR("Private element");
+ stringsCbot[CBotErrNoPublic] = TR("Public required");
+
+ stringsCbot[CBotErrZeroDiv] = TR("Dividing by zero");
+ stringsCbot[CBotErrNotInit] = TR("Variable not initialized");
+ stringsCbot[CBotErrBadThrow] = TR("Negative value rejected by \"throw\"");
+ stringsCbot[CBotErrNoRetVal] = TR("The function returned no value ");
+ stringsCbot[CBotErrNoRun] = TR("No function running");
+ stringsCbot[CBotErrUndefFunc] = TR("Calling an unknown function");
+ stringsCbot[CBotErrNotClass] = TR("This class does not exist");
+ stringsCbot[CBotErrNull] = TR("Unknown Object");
+ stringsCbot[CBotErrNan] = TR("Operation impossible with value \"nan\"");
+ stringsCbot[CBotErrOutArray] = TR("Access beyond array limit");
+ stringsCbot[CBotErrStackOver] = TR("Stack overflow");
+ stringsCbot[CBotErrDeletedPtr] = TR("Illegal object");
+ stringsCbot[CBotErrFileOpen] = TR("Can't open file");
+ stringsCbot[CBotErrNotOpen] = TR("File not open");
+ stringsCbot[CBotErrRead] = TR("Read error");
+ stringsCbot[CBotErrWrite] = TR("Write error");
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/colobot.git
More information about the Pkg-games-commits
mailing list