- refactored enums, macros split from Main.h to Macros.h

Wed, 12 Feb 2014 06:15:11 +0200

author
Teemu Piippo <crimsondusk64@gmail.com>
date
Wed, 12 Feb 2014 06:15:11 +0200
changeset 108
6409ece8297c
parent 107
55c2bcd8ed5c
child 109
6572803cd0ca

- refactored enums, macros split from Main.h to Macros.h

src/BotStuff.h file | annotate | diff | comparison | revisions
src/Commands.cc file | annotate | diff | comparison | revisions
src/Commands.h file | annotate | diff | comparison | revisions
src/DataBuffer.cc file | annotate | diff | comparison | revisions
src/DataBuffer.h file | annotate | diff | comparison | revisions
src/Expression.cc file | annotate | diff | comparison | revisions
src/Expression.h file | annotate | diff | comparison | revisions
src/Format.cc file | annotate | diff | comparison | revisions
src/Lexer.cc file | annotate | diff | comparison | revisions
src/Lexer.h file | annotate | diff | comparison | revisions
src/LexerScanner.cc file | annotate | diff | comparison | revisions
src/Macros.h file | annotate | diff | comparison | revisions
src/Main.cc file | annotate | diff | comparison | revisions
src/Main.h file | annotate | diff | comparison | revisions
src/Parser.cc file | annotate | diff | comparison | revisions
src/Parser.h file | annotate | diff | comparison | revisions
src/Property.h file | annotate | diff | comparison | revisions
src/Tokens.h file | annotate | diff | comparison | revisions
src/Types.h file | annotate | diff | comparison | revisions
--- a/src/BotStuff.h	Tue Feb 11 03:29:03 2014 +0200
+++ b/src/BotStuff.h	Wed Feb 12 06:15:11 2014 +0200
@@ -32,6 +32,8 @@
 #ifndef BOTC_BOTSTUFF_H
 #define BOTC_BOTSTUFF_H
 
+#include "Main.h"
+
 static const int gMaxStates			= 256;
 static const int gMaxEvents			= 32;
 static const int gMaxGlobalEvents	= 32;
@@ -44,153 +46,80 @@
 static const int gMaxReactionTime	= 52;
 static const int gMaxStoredEvents	= 64;
 
-enum EDataHeader
+named_enum DataHeader
 {
-	dhCommand,
-	dhStateIndex,
-	dhStateName,
-	dhOnEnter,
-	dhMainLoop,
-	dhOnExit,
-	dhEvent,
-	dhEndOnEnter,
-	dhEndMainLoop,
-	dhEndOnExit,
-	dhEndEvent,
-	dhIfGoto,
-	dhIfNotGoto,
-	dhGoto,
-	dhOrLogical,
-	dhAndLogical,
-	dhOrBitwise,
-	dhEorBitwise,
-	dhAndBitwise,
-	dhEquals,
-	dhNotEquals,
-	dhLessThan,
-	dhAtMost,
-	dhGreaterThan,
-	dhAtLeast,
-	dhNegateLogical,
-	dhLeftShift,
-	dhRightShift,
-	dhAdd,
-	dhSubtract,
-	dhUnaryMinus,
-	dhMultiply,
-	dhDivide,
-	dhModulus,
-	dhPushNumber,
-	dhPushStringIndex,
-	dhPushGlobalVar,
-	dhPushLocalVar,
-	dhDropStackPosition,
-	dhScriptVarList,
-	dhStringList,
-	dhIncreaseGlobalVar,
-	dhDecreaseGlobalVar,
-	dhAssignGlobalVar,
-	dhAddGlobalVar,
-	dhSubtractGlobalVar,
-	dhMultiplyGlobalVar,
-	dhDivideGlobalVar,
-	dhModGlobalVar,
-	dhIncreaseLocalVar,
-	dhDecreaseLocalVar,
-	dhAssignLocalVar,
-	dhAddLocalVar,
-	dhSubtractLocalVar,
-	dhMultiplyLocalVar,
-	dhDivideLocalVar,
-	dhModLocalVar,
-	dhCaseGoto,
-	dhDrop,
-	dhIncreaseGlobalArray,
-	dhDecreaseGlobalArray,
-	dhAssignGlobalArray,
-	dhAddGlobalArray,
-	dhSubtractGlobalArray,
-	dhMultiplyGlobalArray,
-	dhDivideGlobalArray,
-	dhModGlobalArray,
-	dhPushGlobalArray,
-	dhSwap,
-	dhDup,
-	dhArraySet,
+	DH_Command,
+	DH_StateIndex,
+	DH_StateName,
+	DH_OnEnter,
+	DH_MainLoop,
+	DH_OnExit,
+	DH_Event,
+	DH_EndOnEnter,
+	DH_EndMainLoop,
+	DH_EndOnExit,
+	DH_EndEvent,
+	DH_IfGoto,
+	DH_IfNotGoto,
+	DH_Goto,
+	DH_OrLogical,
+	DH_AndLogical,
+	DH_OrBitwise,
+	DH_EorBitwise,
+	DH_AndBitwise,
+	DH_Equals,
+	DH_NotEquals,
+	DH_LessThan,
+	DH_AtMost,
+	DH_GreaterThan,
+	DH_AtLeast,
+	DH_NegateLogical,
+	DH_LeftShift,
+	DH_RightShift,
+	DH_Add,
+	DH_Subtract,
+	DH_UnaryMinus,
+	DH_Multiply,
+	DH_Divide,
+	DH_Modulus,
+	DH_PushNumber,
+	DH_PushStringIndex,
+	DH_PushGlobalVar,
+	DH_PushLocalVar,
+	DH_DropStackPosition,
+	DH_ScriptVarList,
+	DH_StringList,
+	DH_IncreaseGlobalVar,
+	DH_DecreaseGlobalVar,
+	DH_AssignGlobalVar,
+	DH_AddGlobalVar,
+	DH_SubtractGlobalVar,
+	DH_MultiplyGlobalVar,
+	DH_DivideGlobalVar,
+	DH_ModGlobalVar,
+	DH_IncreaseLocalVar,
+	DH_DecreaseLocalVar,
+	DH_AssignLocalVar,
+	DH_AddLocalVar,
+	DH_SubtractLocalVar,
+	DH_MultiplyLocalVar,
+	DH_DivideLocalVar,
+	DH_ModLocalVar,
+	DH_CaseGoto,
+	DH_Drop,
+	DH_IncreaseGlobalArray,
+	DH_DecreaseGlobalArray,
+	DH_AssignGlobalArray,
+	DH_AddGlobalArray,
+	DH_SubtractGlobalArray,
+	DH_MultiplyGlobalArray,
+	DH_DivideGlobalArray,
+	DH_ModGlobalArray,
+	DH_PushGlobalArray,
+	DH_Swap,
+	DH_Dup,
+	DH_ArraySet,
 	numDataHeaders
 };
 
-//*****************************************************************************
-//	These are the different bot events that can be posted to a bot's state.
-enum eEvent
-{
-	evKilledByEnemy,
-	evKilledByPlayer,
-	evKilledBySelf,
-	evKilledByEnvironment,
-	evReachedGoal,
-	evGoalRemoved,
-	evDamagedByPlayer,
-	evPlayerSay,
-	evEnemyKilled,
-	evRespawned,
-	evIntermission,
-	evNewMaps,
-	evEnemyUsedFist,
-	evEnemyUsedChainsaw,
-	evEnemyFiredPistol,
-	evEnemyFiredShotgun,
-	evEnemyFiredSsg,
-	evEnemyFiredChaingun,
-	evEnemyFiredMinigun,
-	evEnemyFiredRocket,
-	evEnemyFiredGrenade,
-	evEnemyFiredRailgun,
-	evEnemyFiredPlasma,
-	evEnemyFiredBfg,
-	evEnemyFiredBfg10k,
-	evPlayerUsedFist,
-	evPlayerUsedChainsaw,
-	evPlayerFiredPistol,
-	evPlayerFiredShotgun,
-	evPlayerFiredSsg,
-	evPlayerFiredChaingun,
-	evPlayerFiredMinigun,
-	evPlayerFiredRocket,
-	evPlayerFiredGrenade,
-	evPlayerFiredRailgun,
-	evPlayerFiredPlasma,
-	evPlayerFiredBfg,
-	evPlayerFiredBfg10k,
-	evUsedFist,
-	evUsedChainsaw,
-	evFiredPistol,
-	evFiredShotgun,
-	evFiredSsg,
-	evFiredChaingun,
-	evFiredMinigun,
-	evFiredRocket,
-	evFiredGrenade,
-	evFiredRailgun,
-	evFiredPlasma,
-	evFiredBfg,
-	evFiredBfg10k,
-	evPlayerJoinedGame,
-	evJoinedGame,
-	evDuelStartingCountdown,
-	evDuelFight,
-	evDuelWinSequence,
-	evSpectating,
-	evLmsStartingCountdown,
-	evLmsFight,
-	evLmsWinSequence,
-	evWeaponChange,
-	evEnemyBfgExplode,
-	evPlayerBfgExplode,
-	evBfgExplode,
-	evRecievedMedal,
-
-	numBotEvents
-};
-
 #endif	// BOTC_BOTSTUFF_H
--- a/src/Commands.cc	Tue Feb 11 03:29:03 2014 +0200
+++ b/src/Commands.cc	Wed Feb 12 06:15:11 2014 +0200
@@ -99,7 +99,7 @@
 		{
 			text += " = ";
 
-			bool is_string = args[i].type == EStringType;
+			bool is_string = args[i].type == TYPE_String;
 
 			if (is_string)
 				text += '"';
--- a/src/Commands.h	Tue Feb 11 03:29:03 2014 +0200
+++ b/src/Commands.h	Wed Feb 12 06:15:11 2014 +0200
@@ -34,7 +34,7 @@
 
 struct CommandArgument
 {
-	EType					type;
+	DataType				type;
 	String					name;
 	int						defvalue;
 };
@@ -44,7 +44,7 @@
 	String					name;
 	int						number;
 	int						minargs;
-	EType					returnvalue;
+	DataType				returnvalue;
 	List<CommandArgument>	args;
 	String					origin;
 
--- a/src/DataBuffer.cc	Tue Feb 11 03:29:03 2014 +0200
+++ b/src/DataBuffer.cc	Wed Feb 12 06:15:11 2014 +0200
@@ -32,7 +32,7 @@
 //
 DataBuffer::DataBuffer (int size)
 {
-	SetBuffer (new byte[size]);
+	SetBuffer (new char[size]);
 	SetPosition (&GetBuffer()[0]);
 	SetAllocatedSize (size);
 }
@@ -146,21 +146,9 @@
 
 // ============================================================================
 //
-void DataBuffer::WriteFloat (float a)
-{
-	// TODO: Find a way to store the number without decimal loss.
-	WriteDWord (dhPushNumber);
-	WriteDWord (abs (a));
-
-	if (a < 0)
-		WriteDWord (dhUnaryMinus);
-}
-
-// ============================================================================
-//
 void DataBuffer::WriteStringIndex (const String& a)
 {
-	WriteDWord (dhPushStringIndex);
+	WriteDWord (DH_PushStringIndex);
 	WriteDWord (GetStringTableIndex (a));
 }
 
@@ -193,7 +181,7 @@
 	int newsize = GetAllocatedSize() + bytes + 512;
 
 	delete GetBuffer();
-	SetBuffer (new byte[newsize]);
+	SetBuffer (new char[newsize]);
 	SetAllocatedSize (newsize);
 
 	// Now, copy the stuff back.
@@ -251,4 +239,4 @@
 			return mark;
 
 	return null;
-}
\ No newline at end of file
+}
--- a/src/DataBuffer.h	Tue Feb 11 03:29:03 2014 +0200
+++ b/src/DataBuffer.h	Wed Feb 12 06:15:11 2014 +0200
@@ -51,9 +51,9 @@
 //
 class DataBuffer
 {
-	PROPERTY (private, byte*,					Buffer,			NO_OPS,		STOCK_WRITE)
+	PROPERTY (private, char*,					Buffer,			NO_OPS,		STOCK_WRITE)
 	PROPERTY (private, int,						AllocatedSize,	NUM_OPS,	STOCK_WRITE)
-	PROPERTY (private, byte*,					Position,		NO_OPS,		STOCK_WRITE)
+	PROPERTY (private, char*,					Position,		NO_OPS,		STOCK_WRITE)
 	PROPERTY (private, List<ByteMark*>,			Marks,			LIST_OPS,	STOCK_WRITE)
 	PROPERTY (private, List<MarkReference*>,	References,		LIST_OPS,	STOCK_WRITE)
 
@@ -76,7 +76,6 @@
 		ByteMark*		FindMarkByName (const String& target);
 		void			Dump();
 		void			TransferMarks (DataBuffer* other);
-		void			WriteFloat (float a);
 		void			WriteStringIndex (const String& a);
 		void			WriteString (const String& a);
 		void			WriteByte (int8_t data);
--- a/src/Expression.cc	Tue Feb 11 03:29:03 2014 +0200
+++ b/src/Expression.cc	Wed Feb 12 06:15:11 2014 +0200
@@ -7,37 +7,37 @@
 	EToken		token;
 	int			priority;
 	int			numoperands;
-	EDataHeader	header;
+	DataHeader	header;
 };
 
 static const OperatorInfo gOperators[] =
 {
-	{ tkExclamationMark,	0,		1,	dhNegateLogical,	},
-	{ tkMinus,				0,		1,	dhUnaryMinus,		},
-	{ tkMultiply,			10,		2,	dhMultiply,			},
-	{ tkDivide,				10,		2,	dhDivide,			},
-	{ tkModulus,			10,		2,	dhModulus,			},
-	{ tkPlus,				20,		2,	dhAdd,				},
-	{ tkMinus,				20,		2,	dhSubtract,			},
-	{ tkLeftShift,			30,		2,	dhLeftShift,		},
-	{ tkRightShift,			30,		2,	dhRightShift,		},
-	{ tkLesser,				40,		2,	dhLessThan,			},
-	{ tkGreater,			40,		2,	dhGreaterThan,		},
-	{ tkAtLeast,			40,		2,	dhAtLeast,			},
-	{ tkAtMost,				40,		2,	dhAtMost,			},
-	{ tkEquals,				50,		2,	dhEquals			},
-	{ tkNotEquals,			50,		2,	dhNotEquals			},
-	{ tkAmperstand,			60,		2,	dhAndBitwise		},
-	{ tkCaret,				70,		2,	dhEorBitwise		},
-	{ tkBar,				80,		2,	dhOrBitwise			},
-	{ tkDoubleAmperstand,	90,		2,	dhAndLogical		},
-	{ tkDoubleBar,			100,	2,	dhOrLogical			},
-	{ tkQuestionMark,		110,	3,	(EDataHeader) 0		},
+	{ tkExclamationMark,	0,		1,	DH_NegateLogical,	},
+	{ tkMinus,				0,		1,	DH_UnaryMinus,		},
+	{ tkMultiply,			10,		2,	DH_Multiply,		},
+	{ tkDivide,				10,		2,	DH_Divide,			},
+	{ tkModulus,			10,		2,	DH_Modulus,			},
+	{ tkPlus,				20,		2,	DH_Add,				},
+	{ tkMinus,				20,		2,	DH_Subtract,		},
+	{ tkLeftShift,			30,		2,	DH_LeftShift,		},
+	{ tkRightShift,			30,		2,	DH_RightShift,		},
+	{ tkLesser,				40,		2,	DH_LessThan,		},
+	{ tkGreater,			40,		2,	DH_GreaterThan,		},
+	{ tkAtLeast,			40,		2,	DH_AtLeast,			},
+	{ tkAtMost,				40,		2,	DH_AtMost,			},
+	{ tkEquals,				50,		2,	DH_Equals			},
+	{ tkNotEquals,			50,		2,	DH_NotEquals		},
+	{ tkAmperstand,			60,		2,	DH_AndBitwise		},
+	{ tkCaret,				70,		2,	DH_EorBitwise		},
+	{ tkBar,				80,		2,	DH_OrBitwise		},
+	{ tkDoubleAmperstand,	90,		2,	DH_AndLogical		},
+	{ tkDoubleBar,			100,	2,	DH_OrLogical		},
+	{ tkQuMARK_stion,		110,	3,	(DataHeader) 0		},
 };
 
 // =============================================================================
 //
-Expression::Expression (BotscriptParser* parser, Lexer* lx, EType reqtype) :
+Expression::Expression (BotscriptParser* parser, Lexer* lx, DataType reqtype) :
 	mParser (parser),
 	mLexer (lx),
 	mType (reqtype)
@@ -68,7 +68,7 @@
 
 // =============================================================================
 //
-// Try to parse an expression symbol (i.e. an operator or operand or a colon)
+// Try to parse an expression symbol (i.e. an OPER_erator or OPER_erand or a colon)
 // from the lexer.
 //
 ExpressionSymbol* Expression::ParseSymbol()
@@ -79,10 +79,10 @@
 	if (mLexer->GetNext (tkColon))
 		return new ExpressionColon;
 
-	// Check for operator
+	// Check for OPER_erator
 	for (const OperatorInfo& op : gOperators)
 		if (mLexer->GetNext (op.token))
-			return new ExpressionOperator ((EOperator) (&op - &gOperators[0]));
+			return new ExpressionOperator ((ExpressionOperatorType) (&op - &gOperators[0]));
 
 	// Check sub-expression
 	if (mLexer->GetNext (tkParenStart))
@@ -99,7 +99,7 @@
 	{
 		mLexer->Skip();
 
-		if (mType != EUnknownType && comm->returnvalue != mType)
+		if (mType != TYPE_Unknown && comm->returnvalue != mType)
 			Error ("%1 returns an incompatible data type", comm->name);
 
 		op->SetBuffer (mParser->ParseCommand (comm));
@@ -122,24 +122,24 @@
 		if (var->isarray)
 		{
 			mLexer->MustGetNext (tkBracketStart);
-			Expression expr (mParser, mLexer, EIntType);
+			Expression expr (mParser, mLexer, TYPE_Int);
 			expr.GetResult()->ConvertToBuffer();
 			DataBuffer* buf = expr.GetResult()->GetBuffer()->Clone();
-			buf->WriteDWord (dhPushGlobalArray);
+			buf->WriteDWord (DH_PushGlobalArray);
 			buf->WriteDWord (var->index);
 			op->SetBuffer (buf);
 			mLexer->MustGetNext (tkBracketEnd);
 		}
-		elif (var->writelevel == Variable::WRITE_Constexpr)
+		elif (var->writelevel == WRITE_Constexpr)
 			op->SetValue (var->value);
 		else
 		{
 			DataBuffer* buf = new DataBuffer (8);
 
 			if (var->IsGlobal())
-				buf->WriteDWord (dhPushGlobalVar);
+				buf->WriteDWord (DH_PushGlobalVar);
 			else
-				buf->WriteDWord (dhPushLocalVar);
+				buf->WriteDWord (DH_PushLocalVar);
 
 			buf->WriteDWord (var->index);
 			op->SetBuffer (buf);
@@ -151,14 +151,14 @@
 	// Check for literal
 	switch (mType)
 	{
-		case EVoidType:
-		case EUnknownType:
+		case TYPE_Void:
+		case TYPE_Unknown:
 		{
 			Error ("unknown identifier `%1` (expected keyword, function or variable)", GetTokenString());
 			break;
 		}
 
-		case EBoolType:
+		case TYPE_Bool:
 		{
 			if (mLexer->GetNext (tkTrue) || mLexer->GetNext (tkFalse))
 			{
@@ -168,7 +168,7 @@
 			}
 		}
 
-		case EIntType:
+		case TYPE_Int:
 		{
 			if (mLexer->GetNext (tkNumber))
 			{
@@ -177,7 +177,7 @@
 			}
 		}
 
-		case EStringType:
+		case TYPE_String:
 		{
 			if (mLexer->GetNext (tkString))
 			{
@@ -195,25 +195,25 @@
 
 // =============================================================================
 //
-// The symbol parsing process only does token-based checking for operators. Thus
-// ALL minus operators are actually unary minuses simply because both have
+// The symbol parsing process only does token-based checking for OPER_erators. Thus
+// ALL minus OPER_erators are actually unary minuses simply because both have
 // tkMinus as their token and the unary minus is prior to the binary minus in
-// the operator table. Now that we have all symbols present, we can correct
+// the OPER_erator table. Now that we have all symbols present, we can correct
 // cases like this.
 //
 void Expression::AdjustOperators()
 {
 	for (auto it = mSymbols.begin() + 1; it != mSymbols.end(); ++it)
 	{
-		if ((*it)->GetType() != eOperatorSymbol)
+		if ((*it)->GetType() != EXPRSYM_Operator)
 			continue;
 
 		ExpressionOperator* op = static_cast<ExpressionOperator*> (*it);
 
 		// Unary minus with a value as the previous symbol cannot really be
 		// unary; replace with binary minus.
-		if (op->GetID() == opUnaryMinus && (*(it - 1))->GetType() == eValueSymbol)
-			op->SetID (opSubtraction);
+		if (op->GetID() == OPER_UnaryMinus && (*(it - 1))->GetType() == EXPRSYM_Value)
+			op->SetID (OPER_Subtraction);
 	}
 }
 
@@ -223,9 +223,9 @@
 //
 void Expression::TryVerifyValue (bool* verified, SymbolList::Iterator it)
 {
-	// If it's an unary operator we skip to its value. The actual operator will
+	// If it's an unary OPER_erator we skip to its value. The actual OPER_erator will
 	// be verified separately.
-	if ((*it)->GetType() == eOperatorSymbol &&
+	if ((*it)->GetType() == EXPRSYM_Operator &&
 		gOperators[static_cast<ExpressionOperator*> (*it)->GetID()].numoperands == 1)
 	{
 		++it;
@@ -234,7 +234,7 @@
 	int i = it - mSymbols.begin();
 
 	// Ensure it's an actual value
-	if ((*it)->GetType() != eValueSymbol)
+	if ((*it)->GetType() != EXPRSYM_Value)
 		Error ("malformed expression (symbol #%1 is not a value)", i);
 
 	verified[i] = true;
@@ -249,14 +249,14 @@
 {
 	if (mSymbols.Size() == 1)
 	{
-		if (mSymbols[0]->GetType() != eValueSymbol)
+		if (mSymbols[0]->GetType() != EXPRSYM_Value)
 			Error ("bad expression");
 
 		return;
 	}
 
-	if (mType == EStringType)
-		Error ("Cannot perform operations on strings");
+	if (mType == TYPE_String)
+		Error ("Cannot perform OPER_erations on strings");
 
 	bool* verified = new bool[mSymbols.Size()];
 	memset (verified, 0, mSymbols.Size() * sizeof (decltype (*verified)));
@@ -267,7 +267,7 @@
 	{
 		int i = (it - first);
 
-		if ((*it)->GetType() != eOperatorSymbol)
+		if ((*it)->GetType() != EXPRSYM_Operator)
 			continue;
 
 		ExpressionOperator* op = static_cast<ExpressionOperator*> (*it);
@@ -278,8 +278,8 @@
 			case 1:
 			{
 				// Ensure that:
-				// -	unary operator is not the last symbol
-				// -	unary operator is succeeded by a value symbol
+				// -	unary OPER_erator is not the last symbol
+				// -	unary OPER_erator is succeeded by a value symbol
 				// -	neither symbol overlaps with something already verified
 				TryVerifyValue (verified, it + 1);
 
@@ -293,7 +293,7 @@
 			case 2:
 			{
 				// Ensure that:
-				// -	binary operator is not the first or last symbol
+				// -	binary OPER_erator is not the first or last symbol
 				// -	is preceded and succeeded by values
 				// -	none of the three tokens are already verified
 				//
@@ -309,7 +309,7 @@
 
 			case 3:
 			{
-				// Ternary operator case. This goes a bit nuts.
+				// Ternary OPER_erator case. This goes a bit nuts.
 				// This time we have the following:
 				//
 				// (VALUE) ? (VALUE) : (VALUE)
@@ -317,9 +317,9 @@
 				// --------/ we are here
 				//
 				// Check that the:
-				// -	questionmark operator is not misplaced (first or last)
-				// -	the value behind the operator (-1) is valid
-				// -	the value after the operator (+1) is valid
+				// -	questionmark OPER_erator is not misplaced (first or last)
+				// -	the value behind the OPER_erator (-1) is valid
+				// -	the value after the OPER_erator (+1) is valid
 				// -	the value after the colon (+3) is valid
 				// -	none of the five tokens are verified
 				//
@@ -331,7 +331,7 @@
 					it >= mSymbols.end() - 3 ||
 					verified[i] == true ||
 					verified[i + 2] == true ||
-					(*(it + 2))->GetType() != eColonSymbol)
+					(*(it + 2))->GetType() != EXPRSYM_Colon)
 				{
 					Error ("malformed expression");
 				}
@@ -342,7 +342,7 @@
 			}
 
 			default:
-				Error ("WTF operator with %1 operands", numoperands);
+				Error ("WTF OPER_erator with %1 OPER_erands", numoperands);
 		}
 	}
 
@@ -356,7 +356,7 @@
 
 // =============================================================================
 //
-// Which operator to evaluate?
+// Which OPER_erator to evaluate?
 //
 Expression::SymbolList::Iterator Expression::FindPrioritizedOperator()
 {
@@ -365,7 +365,7 @@
 
 	for (SymbolList::Iterator it = mSymbols.begin(); it != mSymbols.end(); ++it)
 	{
-		if ((*it)->GetType() != eOperatorSymbol)
+		if ((*it)->GetType() != EXPRSYM_Operator)
 			continue;
 
 		ExpressionOperator* op = static_cast<ExpressionOperator*> (*it);
@@ -383,7 +383,7 @@
 
 // =============================================================================
 //
-// Process the given operator and values into a new value.
+// Process the given OPER_erator and values into a new value.
 //
 ExpressionValue* Expression::EvaluateOperator (const ExpressionOperator* op,
 											   const List<ExpressionValue*>& values)
@@ -415,9 +415,9 @@
 		// until Zandronum processes it at run-time.
 		newval->SetBuffer (new DataBuffer);
 
-		if (op->GetID() == opTernary)
+		if (op->GetID() == OPER_Ternary)
 		{
-			// There isn't a dataheader for ternary operator. Instead, we use dhIfNotGoto
+			// There isn't a dataheader for ternary OPER_erator. Instead, we use DH_IfNotGoto
 			// to create an "if-block" inside an expression.
 			// Behold, big block of writing madness! :P
 			//
@@ -428,13 +428,13 @@
 			ByteMark* mark1 = buf->AddMark (""); // start of "else" case
 			ByteMark* mark2 = buf->AddMark (""); // end of expression
 			buf->MergeAndDestroy (b0);
-			buf->WriteDWord (dhIfNotGoto); // if the first operand (condition)
+			buf->WriteDWord (DH_IfNotGoto); // if the first OPER_erand (condition)
 			buf->AddReference (mark1); // didn't eval true, jump into mark1
-			buf->MergeAndDestroy (b1); // otherwise, perform second operand (true case)
-			buf->WriteDWord (dhGoto); // afterwards, jump to the end, which is
+			buf->MergeAndDestroy (b1); // otherwise, perform second OPER_erand (true case)
+			buf->WriteDWord (DH_Goto); // afterwards, jump to the end, which is
 			buf->AddReference (mark2); // marked by mark2.
 			buf->AdjustMark (mark1); // move mark1 at the end of the true case
-			buf->MergeAndDestroy (b2); // perform third operand (false case)
+			buf->MergeAndDestroy (b2); // perform third OPER_erand (false case)
 			buf->AdjustMark (mark2); // move the ending mark2 here
 
 			for (int i = 0; i < 3; ++i)
@@ -442,7 +442,7 @@
 		}
 		else
 		{
-			// Generic case: write all arguments and apply the operator's
+			// Generic case: write all arguments and apply the OPER_erator's
 			// data header.
 			for (ExpressionValue* val : values)
 			{
@@ -468,27 +468,27 @@
 
 		switch (op->GetID())
 		{
-			case opAddition:			a = nums[0] + nums[1];					break;
-			case opSubtraction:			a = nums[0] - nums[1];					break;
-			case opMultiplication:		a = nums[0] * nums[1];					break;
-			case opUnaryMinus:			a = -nums[0];							break;
-			case opNegateLogical:		a = !nums[0];							break;
-			case opLeftShift:			a = nums[0] << nums[1];					break;
-			case opRightShift:			a = nums[0] >> nums[1];					break;
-			case opCompareLesser:		a = (nums[0] < nums[1]) ? 1 : 0;		break;
-			case opCompareGreater:		a = (nums[0] > nums[1]) ? 1 : 0;		break;
-			case opCompareAtLeast:		a = (nums[0] <= nums[1]) ? 1 : 0;		break;
-			case opCompareAtMost:		a = (nums[0] >= nums[1]) ? 1 : 0;		break;
-			case opCompareEquals:		a = (nums[0] == nums[1]) ? 1 : 0;		break;
-			case opCompareNotEquals:	a = (nums[0] != nums[1]) ? 1 : 0;		break;
-			case opBitwiseAnd:			a = nums[0] & nums[1];					break;
-			case opBitwiseOr:			a = nums[0] | nums[1];					break;
-			case opBitwiseXOr:			a = nums[0] ^ nums[1];					break;
-			case opLogicalAnd:			a = (nums[0] && nums[1]) ? 1 : 0;		break;
-			case opLogicalOr:			a = (nums[0] || nums[1]) ? 1 : 0;		break;
-			case opTernary:				a = (nums[0] != 0) ? nums[1] : nums[2];	break;
+			case OPER_Addition:			a = nums[0] + nums[1];					break;
+			case OPER_Subtraction:			a = nums[0] - nums[1];					break;
+			case OPER_Multiplication:		a = nums[0] * nums[1];					break;
+			case OPER_UnaryMinus:			a = -nums[0];							break;
+			case OPER_NegateLogical:		a = !nums[0];							break;
+			case OPER_LeftShift:			a = nums[0] << nums[1];					break;
+			case OPER_RightShift:			a = nums[0] >> nums[1];					break;
+			case OPER_CompareLesser:		a = (nums[0] < nums[1]) ? 1 : 0;		break;
+			case OPER_CompareGreater:		a = (nums[0] > nums[1]) ? 1 : 0;		break;
+			case OPER_CompareAtLeast:		a = (nums[0] <= nums[1]) ? 1 : 0;		break;
+			case OPER_CompareAtMost:		a = (nums[0] >= nums[1]) ? 1 : 0;		break;
+			case OPER_CompareEquals:		a = (nums[0] == nums[1]) ? 1 : 0;		break;
+			case OPER_CompareNotEquals:	a = (nums[0] != nums[1]) ? 1 : 0;		break;
+			case OPER_BitwiseAnd:			a = nums[0] & nums[1];					break;
+			case OPER_BitwiseOr:			a = nums[0] | nums[1];					break;
+			case OPER_BitwiseXOr:			a = nums[0] ^ nums[1];					break;
+			case OPER_LogicalAnd:			a = (nums[0] && nums[1]) ? 1 : 0;		break;
+			case OPER_LogicalOr:			a = (nums[0] || nums[1]) ? 1 : 0;		break;
+			case OPER_Ternary:				a = (nums[0] != 0) ? nums[1] : nums[2];	break;
 
-			case opDivision:
+			case OPER_Division:
 			{
 				if (nums[1] == 0)
 					Error ("division by zero in constant expression");
@@ -497,7 +497,7 @@
 				break;
 			}
 
-			case opModulus:
+			case OPER_Modulus:
 			{
 				if (nums[1] == 0)
 					Error ("modulus by zero in constant expression");
@@ -527,7 +527,7 @@
 	while ((it = FindPrioritizedOperator()) != mSymbols.end())
 	{
 		int i = it - mSymbols.begin();
-		List<SymbolList::Iterator> operands;
+		List<SymbolList::Iterator> OPER_erands;
 		ExpressionOperator* op = static_cast<ExpressionOperator*> (*it);
 		const OperatorInfo* info = &gOperators[op->GetID()];
 		int lower, upper; // Boundaries of area to replace
@@ -538,7 +538,7 @@
 			{
 				lower = i;
 				upper = i + 1;
-				operands << it + 1;
+				OPER_erands << it + 1;
 				break;
 			}
 
@@ -546,7 +546,7 @@
 			{
 				lower = i - 1;
 				upper = i + 1;
-				operands << it - 1
+				OPER_erands << it - 1
 				         << it + 1;
 				break;
 			}
@@ -555,7 +555,7 @@
 			{
 				lower = i - 1;
 				upper = i + 3;
-				operands << it - 1
+				OPER_erands << it - 1
 				         << it + 1
 				         << it + 3;
 				break;
@@ -567,7 +567,7 @@
 
 		List<ExpressionValue*> values;
 
-		for (auto it : operands)
+		for (auto it : OPER_erands)
 			values << static_cast<ExpressionValue*> (*it);
 
 		// Note: @op and all of @values are invalid after this call.
@@ -579,7 +579,7 @@
 		mSymbols.Insert (lower, newvalue);
 	}
 
-	assert (mSymbols.Size() == 1 && mSymbols.First()->GetType() == eValueSymbol);
+	assert (mSymbols.Size() == 1 && mSymbols.First()->GetType() == EXPRSYM_Value);
 	ExpressionValue* val = static_cast<ExpressionValue*> (mSymbols.First());
 	return val;
 }
@@ -600,14 +600,14 @@
 
 // =============================================================================
 //
-ExpressionOperator::ExpressionOperator (EOperator id) :
-	ExpressionSymbol (Expression::eOperatorSymbol),
+ExpressionOperator::ExpressionOperator (ExpressionOperatorType id) :
+	ExpressionSymbol (EXPRSYM_Operator),
 	mID (id) {}
 
 // =============================================================================
 //
-ExpressionValue::ExpressionValue (EType valuetype) :
-	ExpressionSymbol (Expression::eValueSymbol),
+ExpressionValue::ExpressionValue (DataType valuetype) :
+	ExpressionSymbol (EXPRSYM_Value),
 	mBuffer (null),
 	mValueType (valuetype) {}
 
@@ -629,23 +629,23 @@
 
 	switch (mValueType)
 	{
-		case EBoolType:
-		case EIntType:
-			GetBuffer()->WriteDWord (dhPushNumber);
+		case TYPE_Bool:
+		case TYPE_Int:
+			GetBuffer()->WriteDWord (DH_PushNumber);
 			GetBuffer()->WriteDWord (abs (mValue));
 
 			if (mValue < 0)
-				GetBuffer()->WriteDWord (dhUnaryMinus);
+				GetBuffer()->WriteDWord (DH_UnaryMinus);
 			break;
 
-		case EStringType:
-			GetBuffer()->WriteDWord (dhPushStringIndex);
+		case TYPE_String:
+			GetBuffer()->WriteDWord (DH_PushStringIndex);
 			GetBuffer()->WriteDWord (mValue);
 			break;
 
-		case EVoidType:
-		case EUnknownType:
+		case TYPE_Void:
+		case TYPE_Unknown:
 			assert (false);
 			break;
 	}
-}
\ No newline at end of file
+}
--- a/src/Expression.h	Tue Feb 11 03:29:03 2014 +0200
+++ b/src/Expression.h	Wed Feb 12 06:15:11 2014 +0200
@@ -9,46 +9,46 @@
 
 // =============================================================================
 //
-enum EOperator
+named_enum ExpressionOperatorType
 {
-	opNegateLogical,
-	opUnaryMinus,
-	opMultiplication,
-	opDivision,
-	opModulus,
-	opAddition,
-	opSubtraction,
-	opLeftShift,
-	opRightShift,
-	opCompareLesser,
-	opCompareGreater,
-	opCompareAtLeast,
-	opCompareAtMost,
-	opCompareEquals,
-	opCompareNotEquals,
-	opBitwiseAnd,
-	opBitwiseXOr,
-	opBitwiseOr,
-	opLogicalAnd,
-	opLogicalOr,
-	opTernary,
+	OPER_NegateLogical,
+	OPER_UnaryMinus,
+	OPER_Multiplication,
+	OPER_Division,
+	OPER_Modulus,
+	OPER_Addition,
+	OPER_Subtraction,
+	OPER_LeftShift,
+	OPER_RightShift,
+	OPER_CompareLesser,
+	OPER_CompareGreater,
+	OPER_CompareAtLeast,
+	OPER_CompareAtMost,
+	OPER_CompareEquals,
+	OPER_CompareNotEquals,
+	OPER_BitwiseAnd,
+	OPER_BitwiseXOr,
+	OPER_BitwiseOr,
+	OPER_LogicalAnd,
+	OPER_LogicalOr,
+	OPER_Ternary,
 };
 
 // =============================================================================
 //
+enum ExpressionSymbolType
+{
+	EXPRSYM_Operator,
+	EXPRSYM_Value,
+	EXPRSYM_Colon,
+};
+
 class Expression final
 {
 	public:
-		enum ESymbolType
-		{
-			eOperatorSymbol,
-			eValueSymbol,
-			eColonSymbol,
-		};
-
 		using SymbolList = List<ExpressionSymbol*>;
 
-		Expression (BotscriptParser* parser, Lexer* lx, EType reqtype);
+		Expression (BotscriptParser* parser, Lexer* lx, DataType reqtype);
 		~Expression();
 		ExpressionValue*		GetResult();
 
@@ -56,7 +56,7 @@
 		BotscriptParser*		mParser;
 		Lexer*					mLexer;
 		SymbolList				mSymbols;
-		EType					mType;
+		DataType				mType;
 		String					mBadTokenText;
 
 		ExpressionValue*		Evaluate(); // Process the expression and yield a result
@@ -75,20 +75,20 @@
 class ExpressionSymbol
 {
 	public:
-		ExpressionSymbol (Expression::ESymbolType type) :
+		ExpressionSymbol (ExpressionSymbolType type) :
 			mType (type) {}
 
-	PROPERTY (private, Expression::ESymbolType, Type, NO_OPS, STOCK_WRITE)
+	PROPERTY (private, ExpressionSymbolType, Type, NO_OPS, STOCK_WRITE)
 };
 
 // =============================================================================
 //
 class ExpressionOperator final : public ExpressionSymbol
 {
-	PROPERTY (public, EOperator, ID, NO_OPS, STOCK_WRITE)
+	PROPERTY (public, ExpressionOperatorType, ID, NO_OPS, STOCK_WRITE)
 
 	public:
-		ExpressionOperator (EOperator id);
+		ExpressionOperator (ExpressionOperatorType id);
 };
 
 // =============================================================================
@@ -97,10 +97,10 @@
 {
 	PROPERTY (public, int,			Value,		NUM_OPS,	STOCK_WRITE)
 	PROPERTY (public, DataBuffer*,	Buffer,		NO_OPS,		STOCK_WRITE)
-	PROPERTY (public, EType,		ValueType,	NO_OPS,		STOCK_WRITE)
+	PROPERTY (public, DataType,		ValueType,	NO_OPS,		STOCK_WRITE)
 
 	public:
-		ExpressionValue (EType valuetype);
+		ExpressionValue (DataType valuetype);
 		~ExpressionValue();
 
 		void				ConvertToBuffer();
@@ -119,14 +119,14 @@
 // =============================================================================
 //
 // This class represents a ":" in the expression. It serves as the colon for the
-// ternary ?: operator. It's not an operand nor is an operator, nor can we just
+// ternary ?: OPER_erator. It's not an OPER_erand nor is an OPER_erator, nor can we just
 // skip it so it is its own thing here.
 //
 class ExpressionColon final : public ExpressionSymbol
 {
 	public:
 		ExpressionColon() :
-			ExpressionSymbol (Expression::eColonSymbol) {}
+			ExpressionSymbol (EXPRSYM_Colon) {}
 };
 
-#endif // BOTC_EXPRESSION_H
\ No newline at end of file
+#endif // BOTC_EXPRESSION_H
--- a/src/Format.cc	Tue Feb 11 03:29:03 2014 +0200
+++ b/src/Format.cc	Wed Feb 12 06:15:11 2014 +0200
@@ -135,4 +135,4 @@
 	}
 
 	throw ScriptError (fileinfo + msg);
-}
\ No newline at end of file
+}
--- a/src/Lexer.cc	Tue Feb 11 03:29:03 2014 +0200
+++ b/src/Lexer.cc	Wed Feb 12 06:15:11 2014 +0200
@@ -129,7 +129,7 @@
 
 	if (VERSION_NUMBER < MAKE_VERSION_NUMBER (major, minor, patch))
 		Error ("The script file requires " APPNAME " v%1, this is v%2",
-			MakeVersionString (major, minor, patch), GetVersionString (EShortForm));
+			MakeVersionString (major, minor, patch), GetVersionString (false));
 
 	return true;
 }
@@ -224,7 +224,7 @@
 
 // =============================================================================
 //
-int Lexer::GetOneSymbol (const StringList& syms)
+int Lexer::GEXPRSYM_tOne (const StringList& syms)
 {
 	if (!GetNext())
 		Error ("unexpected EOF");
@@ -331,4 +331,4 @@
 String Lexer::DescribeTokenPosition()
 {
 	return Format ("%1 / %2", mTokenPosition - mTokens.begin(), mTokens.Size());
-}
\ No newline at end of file
+}
--- a/src/Lexer.h	Tue Feb 11 03:29:03 2014 +0200
+++ b/src/Lexer.h	Wed Feb 12 06:15:11 2014 +0200
@@ -55,7 +55,7 @@
 	bool	GetNext (EToken req = tkAny);
 	void	MustGetNext (EToken tok);
 	void	MustGetAnyOf (const List<EToken>& toks);
-	int		GetOneSymbol (const StringList& syms);
+	int		GEXPRSYM_tOne (const StringList& syms);
 	void	TokenMustBe (EToken tok);
 	bool	PeekNext (Token* tk = null);
 	bool	PeekNextType (EToken req);
--- a/src/LexerScanner.cc	Tue Feb 11 03:29:03 2014 +0200
+++ b/src/LexerScanner.cc	Wed Feb 12 06:15:11 2014 +0200
@@ -304,4 +304,4 @@
 		line += *(mPosition++);
 
 	return line;
-}
\ No newline at end of file
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/Macros.h	Wed Feb 12 06:15:11 2014 +0200
@@ -0,0 +1,58 @@
+/*
+	Copyright 2012-2014 Santeri Piippo
+	All rights reserved.
+
+	Redistribution and use in source and binary forms, with or without
+	modification, are permitted provided that the following conditions
+	are met:
+
+	1. Redistributions of source code must retain the above copyright
+	   notice, this list of conditions and the following disclaimer.
+	2. Redistributions in binary form must reproduce the above copyright
+	   notice, this list of conditions and the following disclaimer in the
+	   documentation and/or other materials provided with the distribution.
+	3. The name of the author may not be used to endorse or promote products
+	   derived from this software without specific prior written permission.
+
+	THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+	IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+	OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+	IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+	INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+	NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+	DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+	THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+	(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+	THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#pragma once
+
+#if !defined (__cplusplus) || __cplusplus < 201103L
+# error botc requires a C++11-compliant compiler to be built
+#endif
+
+// Application name and version
+#define APPNAME "botc"
+#define VERSION_MAJOR	1
+#define VERSION_MINOR	0
+#define VERSION_PATCH 	0
+
+#define MAKE_VERSION_NUMBER(MAJ, MIN, PAT) ((MAJ * 10000) + (MIN * 100) + PAT)
+#define VERSION_NUMBER MAKE_VERSION_NUMBER (VERSION_MAJOR, VERSION_MINOR, VERSION_PATCH)
+
+// On Windows, files are case-insensitive
+#if (defined(WIN32) || defined(_WIN32) || defined(__WIN32)) && !defined(__CYGWIN__)
+#define FILE_CASEINSENSITIVE
+#endif
+
+#define named_enum enum
+#define elif else if
+#define types public
+#define countof(A) ((int) (sizeof A / sizeof *A))
+
+#ifndef __GNUC__
+# define __attribute__(X)
+#endif
+
+#define deprecated __attribute__ ((deprecated))
\ No newline at end of file
--- a/src/Main.cc	Tue Feb 11 03:29:03 2014 +0200
+++ b/src/Main.cc	Wed Feb 12 06:15:11 2014 +0200
@@ -62,7 +62,7 @@
 		// Print header
 		String header;
 		String headerline;
-		header = Format (APPNAME " version %1", GetVersionString (ELongForm));
+		header = Format (APPNAME " version %1", GetVersionString (true));
 
 #ifdef DEBUG
 		header += " (debug build)";
@@ -135,14 +135,14 @@
 
 // ============================================================================
 //
-EType GetTypeByName (String t)
+DataType GetTypeByName (String t)
 {
 	t = t.ToLowercase();
-	return	(t == "int") ? EIntType :
-			(t == "str") ? EStringType :
-			(t == "void") ? EVoidType :
-			(t == "bool") ? EBoolType :
-			EUnknownType;
+	return	(t == "int") ? TYPE_Int :
+			(t == "str") ? TYPE_String :
+			(t == "void") ? TYPE_Void :
+			(t == "bool") ? TYPE_Bool :
+			TYPE_Unknown;
 }
 
 
@@ -150,15 +150,15 @@
 //
 // Inverse operation - type name by value
 //
-String GetTypeName (EType type)
+String GetTypeName (DataType type)
 {
 	switch (type)
 	{
-		case EIntType: return "int"; break;
-		case EStringType: return "str"; break;
-		case EVoidType: return "void"; break;
-		case EBoolType: return "bool"; break;
-		case EUnknownType: return "???"; break;
+		case TYPE_Int: return "int"; break;
+		case TYPE_String: return "str"; break;
+		case TYPE_Void: return "void"; break;
+		case TYPE_Bool: return "bool"; break;
+		case TYPE_Unknown: return "???"; break;
 	}
 
 	return "";
@@ -181,13 +181,13 @@
 
 // =============================================================================
 //
-String GetVersionString (EFormLength len)
+String GetVersionString (bool longform)
 {
 	String tag (GIT_DESCRIPTION);
 	String version = tag;
 
-	if (len == ELongForm && tag.EndsWith ("-pre"))
+	if (longform && tag.EndsWith ("-pre"))
 		version += "-" + String (GIT_HASH).Mid (0, 8);
 
 	return version;
-}
\ No newline at end of file
+}
--- a/src/Main.h	Tue Feb 11 03:29:03 2014 +0200
+++ b/src/Main.h	Wed Feb 12 06:15:11 2014 +0200
@@ -29,13 +29,10 @@
 #ifndef BOTC_MAIN_H
 #define BOTC_MAIN_H
 
-#if !defined (__cplusplus) || __cplusplus < 201103L
-# error botc requires a C++11-compliant compiler to be built
-#endif
-
 #include <cstdio>
 #include <cstdarg>
 #include <cstdint>
+#include "Macros.h"
 #include "Property.h"
 #include "Types.h"
 #include "Containers.h"
@@ -44,38 +41,10 @@
 #include "BotStuff.h"
 #include "Tokens.h"
 
-// Application name and version
-#define APPNAME "botc"
-#define VERSION_MAJOR	1
-#define VERSION_MINOR	0
-#define VERSION_PATCH 	0
-
-#define MAKE_VERSION_NUMBER(MAJ, MIN, PAT) ((MAJ * 10000) + (MIN * 100) + PAT)
-#define VERSION_NUMBER MAKE_VERSION_NUMBER (VERSION_MAJOR, VERSION_MINOR, VERSION_PATCH)
-
-// On Windows, files are case-insensitive
-#if (defined(WIN32) || defined(_WIN32) || defined(__WIN32)) && !defined(__CYGWIN__)
-#define FILE_CASEINSENSITIVE
-#endif
-
-#define elif else if
-
-#define types public
-#define countof(A) ((int) (sizeof A / sizeof *A))
-
-// Shortcut for zeroing something
-#define ZERO(obj) memset (&obj, 0, sizeof (obj));
-
-enum EFormLength
-{
-	ELongForm,
-	EShortForm
-};
-
 String MakeObjectFileName (String s);
-EType GetTypeByName (String token);
-String GetTypeName (EType type);
-String GetVersionString (EFormLength len);
+DataType GetTypeByName (String token);
+String GetTypeName (DataType type);
+String GetVersionString (bool longform);
 String MakeVersionString (int major, int minor, int patch);
 
 template<typename T>
@@ -90,9 +59,4 @@
 	return a < b ? a : b;
 }
 
-#ifndef __GNUC__
-#define __attribute__(X)
-#endif
-#define deprecated __attribute__ ((deprecated))
-
 #endif // BOTC_MAIN_H
--- a/src/Parser.cc	Tue Feb 11 03:29:03 2014 +0200
+++ b/src/Parser.cc	Wed Feb 12 06:15:11 2014 +0200
@@ -47,7 +47,7 @@
 	mLexer (new Lexer),
 	mNumStates (0),
 	mNumEvents (0),
-	mCurrentMode (ETopLevelMode),
+	mCurrentMode (PARSERMODE_TopLevel),
 	mStateSpawnDefined (false),
 	mGotMainLoop (false),
 	mScopeCursor (-1),
@@ -66,7 +66,7 @@
 //
 void BotscriptParser::CheckToplevel()
 {
-	if (mCurrentMode != ETopLevelMode)
+	if (mCurrentMode != PARSERMODE_TopLevel)
 		Error ("%1-statements may only be defined at top level!", GetTokenString());
 }
 
@@ -74,7 +74,7 @@
 //
 void BotscriptParser::CheckNotToplevel()
 {
-	if (mCurrentMode == ETopLevelMode)
+	if (mCurrentMode == PARSERMODE_TopLevel)
 		Error ("%1-statements must not be defined at top level!", GetTokenString());
 }
 
@@ -223,7 +223,7 @@
 
 	// ===============================================================================
 	// Script file ended. Do some last checks and write the last things to main buffer
-	if (mCurrentMode != ETopLevelMode)
+	if (mCurrentMode != PARSERMODE_TopLevel)
 		Error ("script did not end at top level; a `}` is missing somewhere");
 
 	if (IsReadOnly() == false)
@@ -276,9 +276,9 @@
 	if (mCurrentState.IsEmpty() == false)
 		writeMemberBuffers();
 
-	buffer()->WriteDWord (dhStateName);
+	buffer()->WriteDWord (DH_StateName);
 	buffer()->WriteString (statename);
-	buffer()->WriteDWord (dhStateIndex);
+	buffer()->WriteDWord (DH_StateIndex);
 	buffer()->WriteDWord (mNumStates);
 
 	mNumStates++;
@@ -299,8 +299,8 @@
 		Error ("bad event, got `%1`\n", GetTokenString());
 
 	mLexer->MustGetNext (tkBraceStart);
-	mCurrentMode = EEventMode;
-	buffer()->WriteDWord (dhEvent);
+	mCurrentMode = PARSERMODE_Event;
+	buffer()->WriteDWord (DH_Event);
 	buffer()->WriteDWord (e->number);
 	mNumEvents++;
 }
@@ -312,8 +312,8 @@
 	CheckToplevel();
 	mLexer->MustGetNext (tkBraceStart);
 
-	mCurrentMode = EMainLoopMode;
-	mMainLoopBuffer->WriteDWord (dhMainLoop);
+	mCurrentMode = PARSERMODE_MainLoop;
+	mMainLoopBuffer->WriteDWord (DH_MainLoop);
 }
 
 // ============================================================================
@@ -324,8 +324,8 @@
 	bool onenter = (TokenIs (tkOnenter));
 	mLexer->MustGetNext (tkBraceStart);
 
-	mCurrentMode = onenter ? EOnenterMode : EOnexitMode;
-	buffer()->WriteDWord (onenter ? dhOnEnter : dhOnExit);
+	mCurrentMode = onenter ? PARSERMODE_Onenter : PARSERMODE_Onexit;
+	buffer()->WriteDWord (onenter ? DH_OnEnter : DH_OnExit);
 }
 
 // ============================================================================
@@ -338,9 +338,9 @@
 	const bool isconst = mLexer->GetNext (tkConst);
 	mLexer->MustGetAnyOf ({tkInt, tkStr, tkVoid});
 
-	EType vartype =	(TokenIs (tkInt)) ? EIntType :
-					(TokenIs (tkStr)) ? EStringType :
-					EBoolType;
+	DataType vartype =	(TokenIs (tkInt)) ? TYPE_Int :
+					(TokenIs (tkStr)) ? TYPE_String :
+					TYPE_Bool;
 
 	mLexer->MustGetNext (tkSymbol);
 	String name = GetTokenString();
@@ -367,7 +367,7 @@
 
 	if (isconst == false)
 	{
-		var->writelevel = Variable::WRITE_Mutable;
+		var->writelevel = WRITE_Mutable;
 	}
 	else
 	{
@@ -378,7 +378,7 @@
 		// can store it in the variable.
 		if (expr.GetResult()->IsConstexpr())
 		{
-			var->writelevel = Variable::WRITE_Constexpr;
+			var->writelevel = WRITE_Constexpr;
 			var->value = expr.GetResult()->GetValue();
 		}
 		else
@@ -391,7 +391,7 @@
 	// Assign an index for the variable if it is not constexpr. Constexpr
 	// variables can simply be substituted out for their value when used
 	// so they need no index.
-	if (var->writelevel != Variable::WRITE_Constexpr)
+	if (var->writelevel != WRITE_Constexpr)
 	{
 		bool isglobal = IsInGlobalState();
 		var->index = isglobal ? SCOPE(0).globalVarIndexBase++ : SCOPE(0).localVarIndexBase++;
@@ -436,7 +436,7 @@
 	}
 
 	// Add a reference to the mark.
-	buffer()->WriteDWord (dhGoto);
+	buffer()->WriteDWord (DH_Goto);
 	buffer()->AddReference (mark);
 	mLexer->MustGetNext (tkSemicolon);
 }
@@ -452,7 +452,7 @@
 	mLexer->MustGetNext (tkParenStart);
 
 	// Read the expression and write it.
-	DataBuffer* c = ParseExpression (EIntType);
+	DataBuffer* c = ParseExpression (TYPE_Int);
 	buffer()->MergeAndDestroy (c);
 
 	mLexer->MustGetNext (tkParenEnd);
@@ -462,14 +462,14 @@
 	// Upon a closing brace, the mark will be adjusted.
 	ByteMark* mark = buffer()->AddMark ("");
 
-	// Use dhIfNotGoto - if the expression is not true, we goto the mark
+	// Use DH_IfNotGoto - if the expression is not true, we goto the mark
 	// we just defined - and this mark will be at the end of the scope block.
-	buffer()->WriteDWord (dhIfNotGoto);
+	buffer()->WriteDWord (DH_IfNotGoto);
 	buffer()->AddReference (mark);
 
 	// Store it
 	SCOPE (0).mark1 = mark;
-	SCOPE (0).type = eIfScope;
+	SCOPE (0).type = SCOPE_If;
 }
 
 // ============================================================================
@@ -480,7 +480,7 @@
 	mLexer->MustGetNext (tkBraceStart);
 	PushScope (eNoReset);
 
-	if (SCOPE (0).type != eIfScope)
+	if (SCOPE (0).type != SCOPE_If)
 		Error ("else without preceding if");
 
 	// write down to jump to the end of the else statement
@@ -488,12 +488,12 @@
 	SCOPE (0).mark2 = buffer()->AddMark ("");
 
 	// Instruction to jump to the end after if block is complete
-	buffer()->WriteDWord (dhGoto);
+	buffer()->WriteDWord (DH_Goto);
 	buffer()->AddReference (SCOPE (0).mark2);
 
 	// Move the ifnot mark here and set type to else
 	buffer()->AdjustMark (SCOPE (0).mark1);
-	SCOPE (0).type = eElseScope;
+	SCOPE (0).type = SCOPE_Else;
 }
 
 // ============================================================================
@@ -512,7 +512,7 @@
 
 	// Condition
 	mLexer->MustGetNext (tkParenStart);
-	DataBuffer* expr = ParseExpression (EIntType);
+	DataBuffer* expr = ParseExpression (TYPE_Int);
 	mLexer->MustGetNext (tkParenEnd);
 	mLexer->MustGetNext (tkBraceStart);
 
@@ -520,13 +520,13 @@
 	buffer()->MergeAndDestroy (expr);
 
 	// Instruction to go to the end if it fails
-	buffer()->WriteDWord (dhIfNotGoto);
+	buffer()->WriteDWord (DH_IfNotGoto);
 	buffer()->AddReference (mark2);
 
 	// Store the needed stuff
 	SCOPE (0).mark1 = mark1;
 	SCOPE (0).mark2 = mark2;
-	SCOPE (0).type = eWhileScope;
+	SCOPE (0).type = SCOPE_While;
 }
 
 // ============================================================================
@@ -546,7 +546,7 @@
 	mLexer->MustGetNext (tkSemicolon);
 
 	// Condition
-	DataBuffer* cond = ParseExpression (EIntType);
+	DataBuffer* cond = ParseExpression (TYPE_Int);
 
 	if (cond == null)
 		Error ("bad statement for condition of for");
@@ -571,14 +571,14 @@
 
 	// Add the condition
 	buffer()->MergeAndDestroy (cond);
-	buffer()->WriteDWord (dhIfNotGoto);
+	buffer()->WriteDWord (DH_IfNotGoto);
 	buffer()->AddReference (mark2);
 
 	// Store the marks and incrementor
 	SCOPE (0).mark1 = mark1;
 	SCOPE (0).mark2 = mark2;
 	SCOPE (0).buffer1 = incr;
-	SCOPE (0).type = eForScope;
+	SCOPE (0).type = SCOPE_For;
 }
 
 // ============================================================================
@@ -589,7 +589,7 @@
 	PushScope();
 	mLexer->MustGetNext (tkBraceStart);
 	SCOPE (0).mark1 = buffer()->AddMark ("");
-	SCOPE (0).type = eDoScope;
+	SCOPE (0).type = SCOPE_Do;
 }
 
 // ============================================================================
@@ -612,10 +612,10 @@
 	CheckNotToplevel();
 	PushScope();
 	mLexer->MustGetNext (tkParenStart);
-	buffer()->MergeAndDestroy (ParseExpression (EIntType));
+	buffer()->MergeAndDestroy (ParseExpression (TYPE_Int));
 	mLexer->MustGetNext (tkParenEnd);
 	mLexer->MustGetNext (tkBraceStart);
-	SCOPE (0).type = eSwitchScope;
+	SCOPE (0).type = SCOPE_Switch;
 	SCOPE (0).mark1 = buffer()->AddMark (""); // end mark
 	SCOPE (0).buffer1 = null; // default header
 }
@@ -625,7 +625,7 @@
 void BotscriptParser::ParseSwitchCase()
 {
 	// case is only allowed inside switch
-	if (SCOPE (0).type != eSwitchScope)
+	if (SCOPE (0).type != SCOPE_Switch)
 		Error ("case label outside switch");
 
 	// Get a literal value for the case block. Zandronum does not support
@@ -649,7 +649,7 @@
 	// We null the switch buffer for the case-go-to statement as
 	// we want it all under the switch, not into the case-buffers.
 	mSwitchBuffer = null;
-	buffer()->WriteDWord (dhCaseGoto);
+	buffer()->WriteDWord (DH_CaseGoto);
 	buffer()->WriteDWord (num);
 	AddSwitchCase (null);
 	SCOPE (0).casecursor->number = num;
@@ -659,7 +659,7 @@
 //
 void BotscriptParser::ParseSwitchDefault()
 {
-	if (SCOPE (0).type != eSwitchScope)
+	if (SCOPE (0).type != SCOPE_Switch)
 		Error ("default label outside switch");
 
 	if (SCOPE (0).buffer1 != null)
@@ -672,12 +672,12 @@
 	//
 	// Since the expression is pushed into the switch
 	// and is only popped when case succeeds, we have
-	// to pop it with dhDrop manually if we end up in
+	// to pop it with DH_Drop manually if we end up in
 	// a default.
 	DataBuffer* buf = new DataBuffer;
 	SCOPE (0).buffer1 = buf;
-	buf->WriteDWord (dhDrop);
-	buf->WriteDWord (dhGoto);
+	buf->WriteDWord (DH_Drop);
+	buf->WriteDWord (DH_Goto);
 	AddSwitchCase (buf);
 }
 
@@ -688,20 +688,20 @@
 	if (mScopeCursor == 0)
 		Error ("unexpected `break`");
 
-	buffer()->WriteDWord (dhGoto);
+	buffer()->WriteDWord (DH_Goto);
 
 	// switch and if use mark1 for the closing point,
 	// for and while use mark2.
 	switch (SCOPE (0).type)
 	{
-		case eIfScope:
-		case eSwitchScope:
+		case SCOPE_If:
+		case SCOPE_Switch:
 		{
 			buffer()->AddReference (SCOPE (0).mark1);
 		} break;
 
-		case eForScope:
-		case eWhileScope:
+		case SCOPE_For:
+		case SCOPE_While:
 		{
 			buffer()->AddReference (SCOPE (0).mark2);
 		} break;
@@ -729,11 +729,11 @@
 	{
 		switch (mScopeStack[curs].type)
 		{
-			case eForScope:
-			case eWhileScope:
-			case eDoScope:
+			case SCOPE_For:
+			case SCOPE_While:
+			case SCOPE_Do:
 			{
-				buffer()->WriteDWord (dhGoto);
+				buffer()->WriteDWord (DH_Goto);
 				buffer()->AddReference (mScopeStack[curs].mark1);
 				found = true;
 			} break;
@@ -758,7 +758,7 @@
 	{
 		switch (SCOPE (0).type)
 		{
-			case eIfScope:
+			case SCOPE_If:
 			{
 				// Adjust the closing mark.
 				buffer()->AdjustMark (SCOPE (0).mark1);
@@ -768,7 +768,7 @@
 				break;
 			}
 
-			case eElseScope:
+			case SCOPE_Else:
 			{
 				// else instead uses mark1 for itself (so if expression
 				// fails, jump to else), mark2 means end of else
@@ -776,13 +776,13 @@
 				break;
 			}
 
-			case eForScope:
+			case SCOPE_For:
 			{	// write the incrementor at the end of the loop block
 				buffer()->MergeAndDestroy (SCOPE (0).buffer1);
 			}
-			case eWhileScope:
+			case SCOPE_While:
 			{	// write down the instruction to go back to the start of the loop
-				buffer()->WriteDWord (dhGoto);
+				buffer()->WriteDWord (DH_Goto);
 				buffer()->AddReference (SCOPE (0).mark1);
 
 				// Move the closing mark here since we're at the end of the while loop
@@ -790,22 +790,22 @@
 				break;
 			}
 
-			case eDoScope:
+			case SCOPE_Do:
 			{
 				mLexer->MustGetNext (tkWhile);
 				mLexer->MustGetNext (tkParenStart);
-				DataBuffer* expr = ParseExpression (EIntType);
+				DataBuffer* expr = ParseExpression (TYPE_Int);
 				mLexer->MustGetNext (tkParenEnd);
 				mLexer->MustGetNext (tkSemicolon);
 
 				// If the condition runs true, go back to the start.
 				buffer()->MergeAndDestroy (expr);
-				buffer()->WriteDWord (dhIfGoto);
+				buffer()->WriteDWord (DH_IfGoto);
 				buffer()->AddReference (SCOPE (0).mark1);
 				break;
 			}
 
-			case eSwitchScope:
+			case SCOPE_Switch:
 			{
 				// Switch closes. Move down to the record buffer of
 				// the lower block.
@@ -821,8 +821,8 @@
 					buffer()->MergeAndDestroy (SCOPE (0).buffer1);
 				else
 				{
-					buffer()->WriteDWord (dhDrop);
-					buffer()->WriteDWord (dhGoto);
+					buffer()->WriteDWord (DH_Drop);
+					buffer()->WriteDWord (DH_Goto);
 					buffer()->AddReference (SCOPE (0).mark1);
 				}
 
@@ -839,7 +839,7 @@
 				break;
 			}
 
-			case eUnknownScope:
+			case SCOPE_Unknown:
 				break;
 		}
 
@@ -848,10 +848,10 @@
 		return;
 	}
 
-	int dataheader =	(mCurrentMode == EEventMode) ? dhEndEvent :
-						(mCurrentMode == EMainLoopMode) ? dhEndMainLoop :
-						(mCurrentMode == EOnenterMode) ? dhEndOnEnter :
-						(mCurrentMode == EOnexitMode) ? dhEndOnExit : -1;
+	int dataheader =	(mCurrentMode == PARSERMODE_Event) ? DH_EndEvent :
+						(mCurrentMode == PARSERMODE_MainLoop) ? DH_EndMainLoop :
+						(mCurrentMode == PARSERMODE_Onenter) ? DH_EndOnEnter :
+						(mCurrentMode == PARSERMODE_Onexit) ? DH_EndOnExit : -1;
 
 	if (dataheader == -1)
 		Error ("unexpected `}`");
@@ -860,7 +860,7 @@
 	// onenter and mainloop go into special buffers, and we want
 	// the closing data headers into said buffers too.
 	buffer()->WriteDWord (dataheader);
-	mCurrentMode = ETopLevelMode;
+	mCurrentMode = PARSERMODE_TopLevel;
 	mLexer->GetNext (tkSemicolon);
 }
 
@@ -942,8 +942,8 @@
 
 		CommandArgument arg;
 		mLexer->MustGetAnyOf ({tkInt, tkBool, tkStr});
-		EType type = GetTypeByName (mLexer->GetToken()->text); // TODO
-		assert (type != -1 && type != EVoidType);
+		DataType type = GetTypeByName (mLexer->GetToken()->text); // TODO
+		assert (type != -1 && type != TYPE_Void);
 		arg.type = type;
 
 		mLexer->MustGetNext (tkSymbol);
@@ -956,16 +956,16 @@
 
 			switch (type)
 			{
-				case EIntType:
-				case EBoolType:
+				case TYPE_Int:
+				case TYPE_Bool:
 					mLexer->MustGetNext (tkNumber);
 					break;
 
-				case EStringType:
+				case TYPE_String:
 					Error ("string arguments cannot have default values");
 
-				case EUnknownType:
-				case EVoidType:
+				case TYPE_Unknown:
+				case TYPE_Void:
 					break;
 			}
 
@@ -988,7 +988,7 @@
 {
 	DataBuffer* r = new DataBuffer (64);
 
-	if (mCurrentMode == ETopLevelMode && comm->returnvalue == EVoidType)
+	if (mCurrentMode == PARSERMODE_TopLevel && comm->returnvalue == TYPE_Void)
 		Error ("command call at top level");
 
 	mLexer->MustGetNext (tkParenStart);
@@ -1040,12 +1040,12 @@
 	// If the script skipped any optional arguments, fill in defaults.
 	while (curarg < comm->args.Size())
 	{
-		r->WriteDWord (dhPushNumber);
+		r->WriteDWord (DH_PushNumber);
 		r->WriteDWord (comm->args[curarg].defvalue);
 		curarg++;
 	}
 
-	r->WriteDWord (dhCommand);
+	r->WriteDWord (DH_Command);
 	r->WriteDWord (comm->number);
 	r->WriteDWord (comm->args.Size());
 
@@ -1076,7 +1076,7 @@
 //
 // Parses an assignment operator.
 //
-EAssignmentOperator BotscriptParser::ParseAssignmentOperator()
+AssignmentOperator BotscriptParser::ParseAssignmentOperator()
 {
 	const List<EToken> tokens =
 	{
@@ -1094,44 +1094,44 @@
 
 	switch (mLexer->GetTokenType())
 	{
-		case tkAssign:			return EAssign;
-		case tkAddAssign:		return EAssignAdd;
-		case tkSubAssign:		return EAssignSub;
-		case tkMultiplyAssign:	return EAssignMul;
-		case tkDivideAssign:	return EAssignDiv;
-		case tkModulusAssign:	return EAssignMod;
-		case tkDoublePlus:		return EAssignIncrement;
-		case tkDoubleMinus:		return EAssignDecrement;
+		case tkAssign:			return ASSIGNOP_Assign;
+		case tkAddAssign:		return ASSIGNOP_Add;
+		case tkSubAssign:		return ASSIGNOP_Subtract;
+		case tkMultiplyAssign:	return ASSIGNOP_Multiply;
+		case tkDivideAssign:	return ASSIGNOP_Divide;
+		case tkModulusAssign:	return ASSIGNOP_Modulus;
+		case tkDoublePlus:		return ASSIGNOP_Increase;
+		case tkDoubleMinus:		return ASSIGNOP_Decrease;
 		default: break;
 	}
 
 	assert (false);
-	return (EAssignmentOperator) 0;
+	return (AssignmentOperator) 0;
 }
 
 // ============================================================================
 //
 struct AssignmentDataHeaderInfo
 {
-	EAssignmentOperator	op;
-	EDataHeader			local;
-	EDataHeader			global;
-	EDataHeader			array;
+	AssignmentOperator	op;
+	DataHeader			local;
+	DataHeader			global;
+	DataHeader			array;
 };
 
 const AssignmentDataHeaderInfo gAssignmentDataHeaders[] =
 {
-	{ EAssign,			dhAssignLocalVar,	dhAssignGlobalVar,		dhAssignGlobalArray },
-	{ EAssignAdd,		dhAddLocalVar,		dhAddGlobalVar,			dhAddGlobalArray },
-	{ EAssignSub,		dhSubtractLocalVar,	dhSubtractGlobalVar,	dhSubtractGlobalArray },
-	{ EAssignMul,		dhMultiplyLocalVar,	dhMultiplyGlobalVar,	dhMultiplyGlobalArray },
-	{ EAssignDiv,		dhDivideLocalVar,	dhDivideGlobalVar,		dhDivideGlobalArray },
-	{ EAssignMod,		dhModLocalVar,		dhModGlobalVar,			dhModGlobalArray },
-	{ EAssignIncrement,	dhIncreaseLocalVar,	dhIncreaseGlobalVar,	dhIncreaseGlobalArray },
-	{ EAssignDecrement,	dhDecreaseLocalVar,	dhDecreaseGlobalVar,	dhDecreaseGlobalArray },
+	{ ASSIGNOP_Assign,		DH_AssignLocalVar,		DH_AssignGlobalVar,		DH_AssignGlobalArray },
+	{ ASSIGNOP_Add,			DH_AddLocalVar,			DH_AddGlobalVar,		DH_AddGlobalArray },
+	{ ASSIGNOP_Subtract,	DH_SubtractLocalVar,	DH_SubtractGlobalVar,	DH_SubtractGlobalArray },
+	{ ASSIGNOP_Multiply,	DH_MultiplyLocalVar,	DH_MultiplyGlobalVar,	DH_MultiplyGlobalArray },
+	{ ASSIGNOP_Divide,		DH_DivideLocalVar,		DH_DivideGlobalVar,		DH_DivideGlobalArray },
+	{ ASSIGNOP_Modulus,		DH_ModLocalVar,			DH_ModGlobalVar,		DH_ModGlobalArray },
+	{ ASSIGNOP_Increase,	DH_IncreaseLocalVar,	DH_IncreaseGlobalVar,	DH_IncreaseGlobalArray },
+	{ ASSIGNOP_Decrease,	DH_DecreaseLocalVar,	DH_DecreaseGlobalVar,	DH_DecreaseGlobalArray },
 };
 
-EDataHeader BotscriptParser::GetAssigmentDataHeader (EAssignmentOperator op, Variable* var)
+DataHeader BotscriptParser::GetAssigmentDataHeader (AssignmentOperator op, Variable* var)
 {
 	for (const auto& a : gAssignmentDataHeaders)
 	{
@@ -1148,7 +1148,7 @@
 	}
 
 	Error ("WTF: couldn't find data header for operator #%1", op);
-	return (EDataHeader) 0;
+	return (DataHeader) 0;
 }
 
 // ============================================================================
@@ -1162,26 +1162,26 @@
 	DataBuffer* retbuf = new DataBuffer;
 	DataBuffer* arrayindex = null;
 
-	if (var->writelevel != Variable::WRITE_Mutable)
+	if (var->writelevel != WRITE_Mutable)
 		Error ("cannot alter read-only variable $%1", var->name);
 
 	if (var->isarray)
 	{
 		mLexer->MustGetNext (tkBracketStart);
-		Expression expr (this, mLexer, EIntType);
+		Expression expr (this, mLexer, TYPE_Int);
 		expr.GetResult()->ConvertToBuffer();
 		arrayindex = expr.GetResult()->GetBuffer()->Clone();
 		mLexer->MustGetNext (tkBracketEnd);
 	}
 
 	// Get an operator
-	EAssignmentOperator oper = ParseAssignmentOperator();
+	AssignmentOperator oper = ParseAssignmentOperator();
 
-	if (mCurrentMode == ETopLevelMode)
+	if (mCurrentMode == PARSERMODE_TopLevel)
 		Error ("can't alter variables at top level");
 
 	// Parse the right operand
-	if (oper != EAssignIncrement && oper != EAssignDecrement)
+	if (oper != ASSIGNOP_Increase && oper != ASSIGNOP_Decrease)
 	{
 		DataBuffer* expr = ParseExpression (var->type);
 		retbuf->MergeAndDestroy (expr);
@@ -1194,15 +1194,15 @@
 	// <<= and >>= do not have data headers. Solution: expand them.
 	// a <<= b -> a = a << b
 	// a >>= b -> a = a >> b
-	retbuf->WriteDWord (var->IsGlobal() ? dhPushGlobalVar : dhPushLocalVar);
+	retbuf->WriteDWord (var->IsGlobal() ? DH_PushGlobalVar : DH_PushLocalVar);
 	retbuf->WriteDWord (var->index);
 	retbuf->MergeAndDestroy (expr);
-	retbuf->WriteDWord ((oper == OPER_ASSIGNLEFTSHIFT) ? dhLeftShift : dhRightShift);
-	retbuf->WriteDWord (var->IsGlobal() ? dhAssignGlobalVar : dhAssignLocalVar);
+	retbuf->WriteDWord ((oper == OPER_ASSIGNLEFTSHIFT) ? DH_LeftShift : DH_RightShift);
+	retbuf->WriteDWord (var->IsGlobal() ? DH_AssignGlobalVar : DH_AssignLocalVar);
 	retbuf->WriteDWord (var->index);
 #endif
 
-	EDataHeader dh = GetAssigmentDataHeader (oper, var);
+	DataHeader dh = GetAssigmentDataHeader (oper, var);
 	retbuf->WriteDWord (dh);
 	retbuf->WriteDWord (var->index);
 	return retbuf;
@@ -1218,13 +1218,13 @@
 	{
 		ScopeInfo newscope;
 		mScopeStack << newscope;
-		reset = eResetScope;
+		reset = SCOPE_Reset;
 	}
 
-	if (reset == eResetScope)
+	if (reset == SCOPE_Reset)
 	{
 		ScopeInfo* info = &SCOPE (0);
-		info->type = eUnknownScope;
+		info->type = SCOPE_Unknown;
 		info->mark1 = null;
 		info->mark2 = null;
 		info->buffer1 = null;
@@ -1245,7 +1245,7 @@
 
 // ============================================================================
 //
-DataBuffer* BotscriptParser::ParseExpression (EType reqtype, bool fromhere)
+DataBuffer* BotscriptParser::ParseExpression (DataType reqtype, bool fromhere)
 {
 	// hehe
 	if (fromhere == true)
@@ -1332,10 +1332,10 @@
 	if (mSwitchBuffer != null)
 		return mSwitchBuffer;
 
-	if (mCurrentMode == EMainLoopMode)
+	if (mCurrentMode == PARSERMODE_MainLoop)
 		return mMainLoopBuffer;
 
-	if (mCurrentMode == EOnenterMode)
+	if (mCurrentMode == PARSERMODE_Onenter)
 		return mOnEnterBuffer;
 
 	return mMainBuffer;
@@ -1348,8 +1348,8 @@
 	// If there was no mainloop defined, write a dummy one now.
 	if (mGotMainLoop == false)
 	{
-		mMainLoopBuffer->WriteDWord (dhMainLoop);
-		mMainLoopBuffer->WriteDWord (dhEndMainLoop);
+		mMainLoopBuffer->WriteDWord (DH_MainLoop);
+		mMainLoopBuffer->WriteDWord (DH_EndMainLoop);
 	}
 
 	// Write the onenter and mainloop buffers, in that order in particular.
@@ -1377,7 +1377,7 @@
 		return;
 
 	// Write header
-	mMainBuffer->WriteDWord (dhStringList);
+	mMainBuffer->WriteDWord (DH_StringList);
 	mMainBuffer->WriteDWord (stringcount);
 
 	// Write all strings
@@ -1453,4 +1453,4 @@
 		return mHighestGlobalVarIndex;
 
 	return mHighestStateVarIndex;
-}
\ No newline at end of file
+}
--- a/src/Parser.h	Tue Feb 11 03:29:03 2014 +0200
+++ b/src/Parser.h	Wed Feb 12 06:15:11 2014 +0200
@@ -56,55 +56,68 @@
 // ============================================================================
 // Mark types
 //
-enum eMarkType
+named_enum MarkType
 {
-	eLabelMark,
-	eIfMark,
-	eInternalMark, // internal structures
+	MARK_Label,
+	MARK_If,
+	MARK_Internal, // internal structures
 };
 
 // ============================================================================
 // Scope types
 //
-enum EScopeType
+named_enum ScopeType
 {
-	eUnknownScope,
-	eIfScope,
-	eWhileScope,
-	eForScope,
-	eDoScope,
-	eSwitchScope,
-	eElseScope,
+	SCOPE_Unknown,
+	SCOPE_If,
+	SCOPE_While,
+	SCOPE_For,
+	SCOPE_Do,
+	SCOPE_Switch,
+	SCOPE_Else,
 };
 
-enum EAssignmentOperator
+named_enum AssignmentOperator
+{
+	ASSIGNOP_Assign,
+	ASSIGNOP_Add,
+	ASSIGNOP_Subtract,
+	ASSIGNOP_Multiply,
+	ASSIGNOP_Divide,
+	ASSIGNOP_Modulus,
+	ASSIGNOP_Increase,
+	ASSIGNOP_Decrease,
+};
+
+named_enum Writability
 {
-	EAssign,
-	EAssignAdd,
-	EAssignSub,
-	EAssignMul,
-	EAssignDiv,
-	EAssignMod,
-	EAssignIncrement,
-	EAssignDecrement,
+	WRITE_Mutable,		// normal read-many-write-many variable
+	WRITE_Const,		// write-once const variable
+	WRITE_Constexpr,	// const variable whose value is known to compiler
+};
+
+// =============================================================================
+//
+// Parser mode: where is the parser at?
+//
+named_enum ParserMode
+{
+	PARSERMODE_TopLevel,	// at top level
+	PARSERMODE_Event,		// inside event definition
+	PARSERMODE_MainLoop,	// inside mainloop
+	PARSERMODE_Onenter,		// inside onenter
+	PARSERMODE_Onexit,		// inside onexit
 };
 
 // ============================================================================
 //
 struct Variable
 {
-	enum EWritability
-	{
-		WRITE_Mutable,		// normal read-many-write-many variable
-		WRITE_Const,		// write-once const variable
-		WRITE_Constexpr,	// const variable whose value is known to compiler
-	};
-
 	String			name;
 	String			statename;
-	EType			type;
+	DataType		type;
 	int				index;
-	EWritability	writelevel;
+	Writability		writelevel;
 	int				value;
 	String			origin;
 	bool			isarray;
@@ -132,7 +145,7 @@
 {
 	ByteMark*					mark1;
 	ByteMark*					mark2;
-	EScopeType					type;
+	ScopeType					type;
 	DataBuffer*					buffer1;
 	int							globalVarIndexBase;
 	int							globalArrayIndexBase;
@@ -156,7 +169,7 @@
 		enum EReset
 		{
 			eNoReset,
-			eResetScope,
+			SCOPE_Reset,
 		};
 
 		BotscriptParser();
@@ -164,9 +177,9 @@
 		void					ParseBotscript (String fileName);
 		DataBuffer*				ParseCommand (CommandInfo* comm);
 		DataBuffer*				ParseAssignment (Variable* var);
-		EAssignmentOperator		ParseAssignmentOperator ();
+		AssignmentOperator		ParseAssignmentOperator();
 		String					ParseFloat();
-		void					PushScope (EReset reset = eResetScope);
+		void					PushScope (EReset reset = SCOPE_Reset);
 		DataBuffer*				ParseStatement();
 		void					AddSwitchCase (DataBuffer* b);
 		void					CheckToplevel();
@@ -180,7 +193,7 @@
 		void					SuggestHighestVarIndex (bool global, int index);
 		int						GetHighestVarIndex (bool global);
 
-		inline ScopeInfo& GetScope (int offset)
+		inline ScopeInfo& GSCOPE_t (int offset)
 		{
 			return mScopeStack[mScopeCursor - offset];
 		}
@@ -215,7 +228,7 @@
 		Lexer*					mLexer;
 		int						mNumStates;
 		int						mNumEvents;
-		EParserMode				mCurrentMode;
+		ParserMode				mCurrentMode;
 		String					mCurrentState;
 		bool					mStateSpawnDefined;
 		bool					mGotMainLoop;
@@ -254,8 +267,8 @@
 		void			ParseFuncdef();
 		void			writeMemberBuffers();
 		void			WriteStringTable();
-		DataBuffer*		ParseExpression (EType reqtype, bool fromhere = false);
-		EDataHeader		GetAssigmentDataHeader (EAssignmentOperator op, Variable* var);
+		DataBuffer*		ParseExpression (DataType reqtype, bool fromhere = false);
+		DataHeader		GetAssigmentDataHeader (AssignmentOperator op, Variable* var);
 };
 
 #endif // BOTC_PARSER_H
--- a/src/Property.h	Tue Feb 11 03:29:03 2014 +0200
+++ b/src/Property.h	Wed Feb 12 06:15:11 2014 +0200
@@ -210,4 +210,4 @@
 			return PROPERTY_GET_ACCESSOR (NAME)().Size();						\
 		}
 
-#endif // BOTC_PROPERTY_H
\ No newline at end of file
+#endif // BOTC_PROPERTY_H
--- a/src/Tokens.h	Tue Feb 11 03:29:03 2014 +0200
+++ b/src/Tokens.h	Wed Feb 12 06:15:11 2014 +0200
@@ -77,7 +77,7 @@
 	tkAmperstand,
 	tkBar,
 	tkCaret,
-	tkQuestionMark,
+	tkQuMARK_stion,
 	tkArrow,
 
 	// --------------
@@ -126,4 +126,4 @@
 	tkAny					= INT_MAX
 };
 
-#endif
\ No newline at end of file
+#endif
--- a/src/Types.h	Tue Feb 11 03:29:03 2014 +0200
+++ b/src/Types.h	Wed Feb 12 06:15:11 2014 +0200
@@ -31,39 +31,20 @@
 
 #include <cstdlib>
 #include <stdexcept>
+#include "Macros.h"
 #include "String.h"
 
 static const std::nullptr_t null = nullptr;
 
 // =============================================================================
 //
-// Byte datatype
-//
-typedef int32_t word;
-typedef unsigned char byte;
-
-// =============================================================================
-//
-// Parser mode: where is the parser at?
-//
-enum EParserMode
+named_enum DataType
 {
-	ETopLevelMode,		// at top level
-	EEventMode,			// inside event definition
-	EMainLoopMode,		// inside mainloop
-	EOnenterMode,		// inside onenter
-	EOnexitMode,		// inside onexit
-};
-
-// =============================================================================
-//
-enum EType
-{
-	EUnknownType = 0,
-	EVoidType,
-	EIntType,
-	EStringType,
-	EBoolType,
+	TYPE_Unknown = 0,
+	TYPE_Void,
+	TYPE_Int,
+	TYPE_String,
+	TYPE_Bool,
 };
 
 // =============================================================================
@@ -112,4 +93,4 @@
 using FILE = void;
 #endif
 
-#endif // BOTC_TYPES_H
\ No newline at end of file
+#endif // BOTC_TYPES_H

mercurial