BOOL type replaced

This commit is contained in:
alexeevdv
2015-02-15 16:59:52 +03:00
parent 81a28ee4da
commit 316a9798e6
10 changed files with 98 additions and 102 deletions
+16 -12
View File
@@ -1,7 +1,11 @@
// C++ standard includes
#include <iostream>
// int2ssl includes
#include "stdafx.h"
#include "FalloutScript.h"
#include <iostream>
// Third party includes
CFalloutScript::CFalloutScript()
{
@@ -14,21 +18,21 @@ CFalloutScript::~CFalloutScript()
void CFalloutScript::Serialize(CArchive& ar)
{
printf(" Read strtup code\n");
std::cout << " Read strtup code" << std::endl;
m_StartupCode.Serialize(ar);
printf(" Read procedures table\n");
std::cout << " Read procedures table" << std::endl;
m_ProcTable.Serialize(ar);
printf(" Read namespace\n");
std::cout << " Read namespace" << std::endl;
m_Namespace.Serialize(ar);
printf(" Read stringspace\n");
std::cout << " Read stringspace" << std::endl;
m_Stringspace.Serialize(ar);
COpcode opcode;
printf(" Read tail of startup code\n");
std::cout << " Read tail of startup code" << std::endl;
opcode.Expect(ar, COpcode::O_SET_GLOBAL);
// Sections with variable sizes
@@ -51,7 +55,7 @@ void CFalloutScript::Serialize(CArchive& ar)
}
// Jump to 'start' procedure
printf(" Check \"Jump to \'start\' procedure\" / \"Jump to end of statup code\"\n");
std::cout << " Check \"Jump to \'start\' procedure\" / \"Jump to end of statup code\"" << std::endl;
if (!HeaderTail.IsEmpty())
{
@@ -207,7 +211,7 @@ void CFalloutScript::Serialize(CArchive& ar)
}
}
void CFalloutScript::ExtractCodeElements(COpcodeArray& Source, COpcodeArray& Destination, WORD wDelimeter, int nSizeOfCodeItem, LPCTSTR lpszErrorMessage, BOOL (CFalloutScript::*pCheckFunc)(WORD, INT_PTR))
void CFalloutScript::ExtractCodeElements(COpcodeArray& Source, COpcodeArray& Destination, WORD wDelimeter, int nSizeOfCodeItem, const char* lpszErrorMessage, bool (CFalloutScript::*pCheckFunc)(WORD, INT_PTR))
{
INT_PTR i = 0;
@@ -255,12 +259,12 @@ void CFalloutScript::ExtractCodeElements(COpcodeArray& Source, COpcodeArray& Des
}
}
BOOL CFalloutScript::CheckExportVarCode(WORD wOperator, INT_PTR nIndex)
bool CFalloutScript::CheckExportVarCode(WORD wOperator, INT_PTR nIndex)
{
return (nIndex == 0) && (wOperator == COpcode::O_STRINGOP);
}
BOOL CFalloutScript::CheckSetExportedVarValueCode(WORD wOperator, INT_PTR nIndex)
bool CFalloutScript::CheckSetExportedVarValueCode(WORD wOperator, INT_PTR nIndex)
{
switch(nIndex)
{
@@ -272,11 +276,11 @@ BOOL CFalloutScript::CheckSetExportedVarValueCode(WORD wOperator, INT_PTR nIndex
return (wOperator == COpcode::O_STRINGOP);
default:
return FALSE;
return false;
}
}
BOOL CFalloutScript::CheckExportProcCode(WORD wOperator, INT_PTR nIndex)
bool CFalloutScript::CheckExportProcCode(WORD wOperator, INT_PTR nIndex)
{
return ((nIndex == 0) || (nIndex == 1)) && (wOperator == COpcode::O_INTOP);
}
+9 -9
View File
@@ -37,10 +37,10 @@ private:
};
private:
void ExtractCodeElements(COpcodeArray& Source, COpcodeArray& Destination, WORD wDelimeter, int nSizeOfCodeItem, LPCTSTR lpszErrorMessage, BOOL (CFalloutScript::*pCheckFunc)(WORD, INT_PTR));
BOOL CheckExportVarCode(WORD wOperator, INT_PTR nIndex);
BOOL CheckSetExportedVarValueCode(WORD wOperator, INT_PTR nIndex);
BOOL CheckExportProcCode(WORD wOperator, INT_PTR nIndex);
void ExtractCodeElements(COpcodeArray& Source, COpcodeArray& Destination, WORD wDelimeter, int nSizeOfCodeItem, const char* lpszErrorMessage, bool (CFalloutScript::*pCheckFunc)(WORD, INT_PTR));
bool CheckExportVarCode(WORD wOperator, INT_PTR nIndex);
bool CheckSetExportedVarValueCode(WORD wOperator, INT_PTR nIndex);
bool CheckExportProcCode(WORD wOperator, INT_PTR nIndex);
INT_PTR GetIndexOfProc(const char* lpszName);
INT_PTR GetIndexOfProc(ULONG ulNameOffset);
@@ -51,8 +51,8 @@ private:
void TryRenameImportedVariables();
INT_PTR NextNodeIndex( CNodeArray& NodeArray, INT_PTR nCurrentIndex, INT_PTR nSteep);
BOOL CheckSequenceOfNodes(CNodeArray& NodeArray, INT_PTR nStartIndex, const WORD wSequence[], INT_PTR nSequenceLen);
BOOL RemoveSequenceOfNodes(CNodeArray& NodeArray,INT_PTR nStartIndex, INT_PTR nCount, const WORD wSequence[], INT_PTR nSequenceLen);
bool CheckSequenceOfNodes(CNodeArray& NodeArray, INT_PTR nStartIndex, const WORD wSequence[], INT_PTR nSequenceLen);
bool RemoveSequenceOfNodes(CNodeArray& NodeArray,INT_PTR nStartIndex, INT_PTR nCount, const WORD wSequence[], INT_PTR nSequenceLen);
void InitialReduce();
void BuildTree(CNodeArray& NodeArray);
@@ -60,13 +60,13 @@ private:
void SetBordersOfBlocks(CNodeArray& NodeArray);
ULONG BuildTreeBranch(CNodeArray& NodeArray, ULONG nStartIndex, ULONG ulEndOffset);
void ReduceConditionalExpressions(CNodeArray& NodeArray);
BOOL IsOmittetArgsAllowed(WORD wOpcode);
bool IsOmittetArgsAllowed(WORD wOpcode);
void StoreDefinitions(CArchive& ar);
void StoreDeclarations(CArchive& ar);
std::string GetSource( CNode& node, BOOL bLabel, ULONG ulNumArgs);
std::string GetSource( CNode& node, BOOL bLabel, ULONG ulNumArgs, ULONG aulProcArg[], ULONG ulProcArgCount);
std::string GetSource( CNode& node, bool bLabel, ULONG ulNumArgs);
std::string GetSource( CNode& node, bool bLabel, ULONG ulNumArgs, ULONG aulProcArg[], ULONG ulProcArgCount);
bool ArgNeedParens(const CNode& node, const CNode& argument, CFalloutScript::Assoc assoc = CFalloutScript::NON_ASSOC);
std::string GetIndentString(INT_PTR nLevel);
+9 -9
View File
@@ -7,8 +7,8 @@
#include <algorithm>
// Globals
extern BOOL g_bIgnoreWrongNumOfArgs;
extern BOOL g_bInsOmittedArgsBackward;
extern bool g_bIgnoreWrongNumOfArgs;
extern bool g_bInsOmittedArgsBackward;
void CFalloutScript::InitDefinitions()
{
@@ -235,12 +235,12 @@ INT_PTR CFalloutScript::NextNodeIndex( CNodeArray& NodeArray, INT_PTR nCurrentIn
return nResult;
}
BOOL CFalloutScript::CheckSequenceOfNodes(CNodeArray& NodeArray, INT_PTR nStartIndex, const WORD wSequence[], INT_PTR nSequenceLen)
bool CFalloutScript::CheckSequenceOfNodes(CNodeArray& NodeArray, INT_PTR nStartIndex, const WORD wSequence[], INT_PTR nSequenceLen)
{
return RemoveSequenceOfNodes(NodeArray, nStartIndex, 0, wSequence, nSequenceLen);
}
BOOL CFalloutScript::RemoveSequenceOfNodes(CNodeArray& NodeArray, INT_PTR nStartIndex, INT_PTR nCount, const WORD wSequence[], INT_PTR nSequenceLen)
bool CFalloutScript::RemoveSequenceOfNodes(CNodeArray& NodeArray, INT_PTR nStartIndex, INT_PTR nCount, const WORD wSequence[], INT_PTR nSequenceLen)
{
INT_PTR nCurrentNodeIndex = nStartIndex - 1;
@@ -250,13 +250,13 @@ BOOL CFalloutScript::RemoveSequenceOfNodes(CNodeArray& NodeArray, INT_PTR nStart
if (NodeArray[nCurrentNodeIndex].m_Opcode.GetOperator() != wSequence[nCurrentNodeIndex - nStartIndex])
{
return FALSE;
return false;
}
}
NodeArray.RemoveAt(nStartIndex, nCount);
return TRUE;
return true;
}
void CFalloutScript::InitialReduce()
@@ -866,15 +866,15 @@ void CFalloutScript::ReduceConditionalExpressions(CNodeArray& NodeArray)
*/
}
BOOL CFalloutScript::IsOmittetArgsAllowed(WORD wOpcode)
bool CFalloutScript::IsOmittetArgsAllowed(WORD wOpcode)
{
if (((wOpcode >= COpcode::O_END_CORE) && (wOpcode < COpcode::O_END_OP)) ||
(wOpcode == COpcode::O_POP_RETURN))
{
return TRUE;
return true;
}
else
{
return FALSE;
return false;
}
}
+40 -40
View File
@@ -385,12 +385,12 @@ void CFalloutScript::StoreDeclarations(CArchive& ar)
}
else if (procDescriptor.m_ulType & P_CONDITIONAL)
{
strOutLine = format(strOutLine + " when (%s)", GetSource(m_Conditions[i][0], FALSE, procDescriptor.m_ulNumArgs).c_str());
strOutLine = format(strOutLine + " when (%s)", GetSource(m_Conditions[i][0], false, procDescriptor.m_ulNumArgs).c_str());
}
ar.WriteString(strOutLine + "\n");
BOOL bLocalVar = TRUE;
bool bLocalVar = true;
ULONG ulLocalVarIndex = procDescriptor.m_ulNumArgs;
INT_PTR nIndentLevel = 0;
CNode::Type prevNodeType = CNode::TYPE_NORMAL;
@@ -443,12 +443,12 @@ void CFalloutScript::StoreDeclarations(CArchive& ar)
str += c_strLocalVarTemplate + " := ";
strOutLine = format(str.c_str(), ulLocalVarIndex);
ar.WriteString(GetIndentString(nIndentLevel) + strOutLine + GetSource(m_ProcBodies[i][nNodeIndex], FALSE, procDescriptor.m_ulNumArgs) + ";\n");
ar.WriteString(GetIndentString(nIndentLevel) + strOutLine + GetSource(m_ProcBodies[i][nNodeIndex], false, procDescriptor.m_ulNumArgs) + ";\n");
ulLocalVarIndex++;
break;
}
case COpcode::O_IF:
ar.WriteString(GetIndentString(nIndentLevel) + GetSource(m_ProcBodies[i][nNodeIndex], FALSE, procDescriptor.m_ulNumArgs) + " then ");
ar.WriteString(GetIndentString(nIndentLevel) + GetSource(m_ProcBodies[i][nNodeIndex], false, procDescriptor.m_ulNumArgs) + " then ");
break;
case COpcode::O_WHILE:
@@ -461,24 +461,24 @@ void CFalloutScript::StoreDeclarations(CArchive& ar)
{
str += "; ";
}
str += GetSource(m_ProcBodies[i][nNodeIndex].m_Arguments[j], FALSE, procDescriptor.m_ulNumArgs);
str += GetSource(m_ProcBodies[i][nNodeIndex].m_Arguments[j], false, procDescriptor.m_ulNumArgs);
}
str += ") ";
ar.WriteString(str);
}
else
{
ar.WriteString(GetIndentString(nIndentLevel) + GetSource(m_ProcBodies[i][nNodeIndex], FALSE, procDescriptor.m_ulNumArgs) + " do ");
ar.WriteString(GetIndentString(nIndentLevel) + GetSource(m_ProcBodies[i][nNodeIndex], false, procDescriptor.m_ulNumArgs) + " do ");
}
break;
default:
ar.WriteString(GetIndentString(nIndentLevel) + GetSource(m_ProcBodies[i][nNodeIndex], FALSE, procDescriptor.m_ulNumArgs) + ";\n");
ar.WriteString(GetIndentString(nIndentLevel) + GetSource(m_ProcBodies[i][nNodeIndex], false, procDescriptor.m_ulNumArgs) + ";\n");
if ((m_ProcBodies[i][nNodeIndex].m_Type != CNode::TYPE_BEGIN_OF_BLOCK) &&
(m_ProcBodies[i][nNodeIndex].m_Type != CNode::TYPE_END_OF_BLOCK))
{
bLocalVar = FALSE;
bLocalVar = false;
}
}
}
@@ -488,7 +488,7 @@ void CFalloutScript::StoreDeclarations(CArchive& ar)
}
}
std::string CFalloutScript::GetSource(CNode& node, BOOL bLabel, ULONG ulNumArgs)
std::string CFalloutScript::GetSource(CNode& node, bool bLabel, ULONG ulNumArgs)
{
std::string c_strArgumentTemplate("arg%u");
std::string c_strLocalVarTemplate("LVar%u");
@@ -565,11 +565,11 @@ std::string CFalloutScript::GetSource(CNode& node, BOOL bLabel, ULONG ulNumArgs)
case COpcode::O_POP_RETURN:
strResult = "return ";
strResult += GetSource(node.m_Arguments[0], FALSE, ulNumArgs);
strResult += GetSource(node.m_Arguments[0], false, ulNumArgs);
break;
case COpcode::O_LOOKUP_STRING_PROC:
strResult = GetSource(node.m_Arguments[0], FALSE, ulNumArgs);
strResult = GetSource(node.m_Arguments[0], false, ulNumArgs);
break;
case COpcode::O_FETCH_GLOBAL:
@@ -603,7 +603,7 @@ std::string CFalloutScript::GetSource(CNode& node, BOOL bLabel, ULONG ulNumArgs)
strResult = m_GlobalVarsNames[node.m_Arguments[1].m_Opcode.GetArgument()];
strResult += " := ";
strResult += GetSource(node.m_Arguments[0], FALSE, ulNumArgs);
strResult += GetSource(node.m_Arguments[0], false, ulNumArgs);
break;
case COpcode::O_FETCH_EXTERNAL:
@@ -617,7 +617,7 @@ std::string CFalloutScript::GetSource(CNode& node, BOOL bLabel, ULONG ulNumArgs)
}
}
strResult = GetSource(node.m_Arguments[0], TRUE, ulNumArgs);
strResult = GetSource(node.m_Arguments[0], true, ulNumArgs);
break;
case COpcode::O_STORE_EXTERNAL:
@@ -631,9 +631,9 @@ std::string CFalloutScript::GetSource(CNode& node, BOOL bLabel, ULONG ulNumArgs)
}
}
strResult = GetSource(node.m_Arguments[1], TRUE, ulNumArgs);
strResult = GetSource(node.m_Arguments[1], true, ulNumArgs);
strResult += " := ";
strResult += GetSource(node.m_Arguments[0], FALSE, ulNumArgs);
strResult += GetSource(node.m_Arguments[0], false, ulNumArgs);
break;
case COpcode::O_FETCH:
@@ -676,13 +676,13 @@ std::string CFalloutScript::GetSource(CNode& node, BOOL bLabel, ULONG ulNumArgs)
strResult = format(c_strLocalVarTemplate.c_str(), ulVarNum);
}
strResult += " := ";
strResult += GetSource(node.m_Arguments[0], FALSE, ulNumArgs);
strResult += GetSource(node.m_Arguments[0], false, ulNumArgs);
}
break;
case COpcode::O_POP:
strResult = GetSource(node.m_Arguments[0], FALSE, ulNumArgs);
strResult = GetSource(node.m_Arguments[0], false, ulNumArgs);
if (node.m_Arguments[0].m_Opcode.GetOperator() == COpcode::O_CALL)
{
@@ -698,7 +698,7 @@ std::string CFalloutScript::GetSource(CNode& node, BOOL bLabel, ULONG ulNumArgs)
}
else
{
strResult = GetSource(node.m_Arguments[node.m_Arguments.GetUpperBound()], FALSE, ulNumArgs);
strResult = GetSource(node.m_Arguments[node.m_Arguments.GetUpperBound()], false, ulNumArgs);
}
strResult += "(";
@@ -707,12 +707,12 @@ std::string CFalloutScript::GetSource(CNode& node, BOOL bLabel, ULONG ulNumArgs)
{
if (nArgIndex == 0)
{
strResult += GetSource(node.m_Arguments[nArgIndex], FALSE, ulNumArgs);
strResult += GetSource(node.m_Arguments[nArgIndex], false, ulNumArgs);
}
else
{
strResult += ", ";
strResult += GetSource(node.m_Arguments[nArgIndex], FALSE, ulNumArgs);
strResult += GetSource(node.m_Arguments[nArgIndex], false, ulNumArgs);
}
}
@@ -729,11 +729,11 @@ std::string CFalloutScript::GetSource(CNode& node, BOOL bLabel, ULONG ulNumArgs)
}
else
{
strResult += GetSource(node.m_Arguments[1], FALSE, ulNumArgs);
strResult += GetSource(node.m_Arguments[1], false, ulNumArgs);
}
strResult += " in (";
strResult += GetSource(node.m_Arguments[0], FALSE, ulNumArgs) + ")";
strResult += GetSource(node.m_Arguments[0], false, ulNumArgs) + ")";
break;
case COpcode::O_CALL_CONDITION:
@@ -745,27 +745,27 @@ std::string CFalloutScript::GetSource(CNode& node, BOOL bLabel, ULONG ulNumArgs)
}
else
{
strResult += GetSource(node.m_Arguments[1], FALSE, ulNumArgs);
strResult += GetSource(node.m_Arguments[1], false, ulNumArgs);
}
strResult += " when (";
strResult += GetSource(node.m_Arguments[0], FALSE, ulNumArgs) + ")";
strResult += GetSource(node.m_Arguments[0], false, ulNumArgs) + ")";
break;
case COpcode::O_ADDREGION:
strResult = "addRegion ";
strResult += GetSource(node.m_Arguments[0], FALSE, ulNumArgs) + " { ";
strResult += GetSource(node.m_Arguments[0], false, ulNumArgs) + " { ";
for(INT_PTR nArgIndex = 1; nArgIndex < node.m_Arguments.GetUpperBound(); nArgIndex++)
{
if (nArgIndex == 1)
{
strResult += GetSource(node.m_Arguments[nArgIndex], FALSE, ulNumArgs);
strResult += GetSource(node.m_Arguments[nArgIndex], false, ulNumArgs);
}
else
{
strResult += ", ";
strResult += GetSource(node.m_Arguments[nArgIndex], FALSE, ulNumArgs);
strResult += GetSource(node.m_Arguments[nArgIndex], false, ulNumArgs);
}
}
@@ -806,7 +806,7 @@ std::string CFalloutScript::GetSource(CNode& node, BOOL bLabel, ULONG ulNumArgs)
else
{
strResult = "sayOption(";
strResult += GetSource(node.m_Arguments[0], FALSE, ulNumArgs) + ", " + GetSource(node.m_Arguments[1], FALSE, ulNumArgs) + ")";
strResult += GetSource(node.m_Arguments[0], false, ulNumArgs) + ", " + GetSource(node.m_Arguments[1], false, ulNumArgs) + ")";
}
}
@@ -924,11 +924,11 @@ std::string CFalloutScript::GetSource(CNode& node, BOOL bLabel, ULONG ulNumArgs)
if (ArgNeedParens(node, node.m_Arguments[0], CFalloutScript::LEFT_ASSOC))
{
strResult = "(";
strResult += GetSource(node.m_Arguments[0], FALSE, ulNumArgs) + ")";
strResult += GetSource(node.m_Arguments[0], false, ulNumArgs) + ")";
}
else
{
strResult = GetSource(node.m_Arguments[0], FALSE, ulNumArgs);
strResult = GetSource(node.m_Arguments[0], false, ulNumArgs);
}
strResult += " ";
@@ -938,11 +938,11 @@ std::string CFalloutScript::GetSource(CNode& node, BOOL bLabel, ULONG ulNumArgs)
if (ArgNeedParens(node, node.m_Arguments[1], CFalloutScript::RIGHT_ASSOC))
{
strResult += "(";
strResult += GetSource(node.m_Arguments[1], FALSE, ulNumArgs) + ")";
strResult += GetSource(node.m_Arguments[1], false, ulNumArgs) + ")";
}
else
{
strResult += GetSource(node.m_Arguments[1], FALSE, ulNumArgs);
strResult += GetSource(node.m_Arguments[1], false, ulNumArgs);
}
break;
@@ -963,12 +963,12 @@ std::string CFalloutScript::GetSource(CNode& node, BOOL bLabel, ULONG ulNumArgs)
{
if (i == 0)
{
strResult += GetSource(node.m_Arguments[i], FALSE, ulNumArgs);
strResult += GetSource(node.m_Arguments[i], false, ulNumArgs);
}
else
{
strResult += ", ";
strResult += GetSource(node.m_Arguments[i], FALSE, ulNumArgs);
strResult += GetSource(node.m_Arguments[i], false, ulNumArgs);
}
}
@@ -982,22 +982,22 @@ std::string CFalloutScript::GetSource(CNode& node, BOOL bLabel, ULONG ulNumArgs)
return strResult;
}
std::string CFalloutScript::GetSource( CNode& node, BOOL bLabel, ULONG ulNumArgs, ULONG aulProcArg[], ULONG ulProcArgCount)
std::string CFalloutScript::GetSource( CNode& node, bool bLabel, ULONG ulNumArgs, ULONG aulProcArg[], ULONG ulProcArgCount)
{
COpcode::COpcodeAttributes attributes = node.m_Opcode.GetAttributes();
std::string strResult = attributes.m_strName + "(";
std::string strArgument;
BOOL bIsProcArg;
bool bIsProcArg;
for(INT_PTR nArgIndex = 0; nArgIndex < node.m_Arguments.GetSize(); nArgIndex++)
{
bIsProcArg = FALSE;
bIsProcArg = false;
for(ULONG ulProcArgIndex = 0; ulProcArgIndex < ulProcArgCount; ulProcArgIndex++)
{
if (nArgIndex == aulProcArg[ulProcArgIndex] - 1)
{
bIsProcArg = TRUE;
bIsProcArg = true;
break;
}
}
@@ -1020,12 +1020,12 @@ std::string CFalloutScript::GetSource( CNode& node, BOOL bLabel, ULONG ulNumArgs
}
else
{
strArgument = GetSource(node.m_Arguments[nArgIndex], FALSE, ulNumArgs);
strArgument = GetSource(node.m_Arguments[nArgIndex], false, ulNumArgs);
}
}
else
{
strArgument = GetSource(node.m_Arguments[nArgIndex], FALSE, ulNumArgs);
strArgument = GetSource(node.m_Arguments[nArgIndex], false, ulNumArgs);
}
if (nArgIndex == 0)
-8
View File
@@ -9,18 +9,10 @@
// Third party includes
typedef int BOOL;
typedef unsigned char BYTE;
typedef const char* LPCSTR;
typedef LPCSTR LPCTSTR;
typedef char* LPSTR;
typedef LPSTR LPTSTR;
typedef unsigned short WORD;
typedef unsigned long DWORD;
typedef unsigned int UINT;
typedef char TCHAR;
#define TRUE 1
#define FALSE 0
typedef int INT_PTR;
typedef unsigned int ULONG;
+1 -1
View File
@@ -29,7 +29,7 @@ public:
std::string operator [] (ULONG ulOffset) const;
private:
typedef CMap<DWORD, DWORD, std::string, LPCTSTR> CMapDWordToString;
typedef CMap<DWORD, DWORD, std::string, const char*> CMapDWordToString;
CMapDWordToString m_Map;
CDWordArray m_Order;
+4 -4
View File
@@ -61,7 +61,7 @@ void COpcode::Serialize(CArchive& ar)
}
}
void COpcode::Expect(CArchive& ar, WORD wOperator, BOOL bArgumentFound, ULONG ulArgument)
void COpcode::Expect(CArchive& ar, WORD wOperator, bool bArgumentFound, ULONG ulArgument)
{
Serialize(ar);
@@ -84,13 +84,13 @@ void COpcode::Expect(CArchive& ar, WORD wOperator, BOOL bArgumentFound, ULONG ul
void COpcode::Expect(CArchive& ar, int nCount, WORD pwOperators[])
{
Serialize(ar);
BOOL bFound = FALSE;
bool bFound = false;
for(int i = 0; i < nCount; i++)
{
if (m_wOperator == pwOperators[i])
{
bFound = TRUE;
bFound = true;
break;
}
}
@@ -114,7 +114,7 @@ void COpcode::Expect(CArchive& ar, int nCount, WORD pwOperators[])
}
}
BOOL COpcode::HasArgument() const
bool COpcode::HasArgument() const
{
return ((m_wOperator == O_STRINGOP) || (m_wOperator == O_FLOATOP) || (m_wOperator == O_INTOP));
}
+2 -2
View File
@@ -824,10 +824,10 @@ public:
public:
virtual void Serialize(CArchive& ar);
void Expect(CArchive& ar, WORD wOperator, BOOL bArgumentFound = FALSE, ULONG ulArgument = 0);
void Expect(CArchive& ar, WORD wOperator, bool bArgumentFound = false, ULONG ulArgument = 0);
void Expect(CArchive& ar, int nCount, WORD pwOperators[]);
BOOL HasArgument() const;
bool HasArgument() const;
int GetSize() const;
WORD GetOperator() const;
+1 -1
View File
@@ -35,7 +35,7 @@ void CStartupCode::Serialize(CArchive& ar)
{
if (i == 1)
{
m_Code[i].Expect(ar, wExpectOpcodes[i], TRUE, 18);
m_Code[i].Expect(ar, wExpectOpcodes[i], true, 18);
}
else
{
+16 -16
View File
@@ -12,12 +12,12 @@
using namespace std;
// Globals
BOOL g_bDump = FALSE;
bool g_bDump = false;
int g_nFalloutVersion = 2;
std::string g_strIndentFill("\t");
BOOL g_bIgnoreWrongNumOfArgs = FALSE;
BOOL g_bInsOmittedArgsBackward = FALSE;
BOOL g_bStopOnError = FALSE;
bool g_bIgnoreWrongNumOfArgs = false;
bool g_bInsOmittedArgsBackward = false;
bool g_bStopOnError = false;
std::string g_inputFileName;
std::string g_outputFileName;
@@ -25,7 +25,7 @@ std::string g_outputFileName;
// Functions
void PrintUsage(std::string filename);
BOOL ProcessCommandLine(int argc, char* argv[]);
bool ProcessCommandLine(int argc, char* argv[]);
int main(int argc, char* argv[])
{
@@ -48,7 +48,7 @@ int main(int argc, char* argv[])
if (!fileInput.Open(g_inputFileName, CFile::modeRead | CFile::shareDenyWrite))
{
printf("Error: Unable open input file %s.\n", g_inputFileName.c_str());
if (g_bStopOnError == TRUE)
if (g_bStopOnError == true)
{
printf("Press ENTER to continue.\n");
cin.get();
@@ -59,7 +59,7 @@ int main(int argc, char* argv[])
if (!fileOutput.Open(g_outputFileName, CFile::modeCreate | CFile::modeWrite | CFile::typeText | CFile::shareDenyWrite))
{
std::cout << format("Error: Unable open output file %s", g_outputFileName) << std::endl;
if (g_bStopOnError == TRUE)
if (g_bStopOnError == true)
{
std::cout << "Press ENTER to continue." << std::endl;
cin.get();
@@ -106,7 +106,7 @@ int main(int argc, char* argv[])
catch (const UserException& e)
{
// Error message already displayed
if (g_bStopOnError == TRUE)
if (g_bStopOnError == true)
{
printf("Press ENTER to continue.\n");
cin.get();
@@ -148,7 +148,7 @@ void PrintUsage(std::string filename)
<< " --: end of options" << std::endl;
}
BOOL ProcessCommandLine(int argc, char* argv[])
bool ProcessCommandLine(int argc, char* argv[])
{
int c;
int nIndentWidth;
@@ -158,7 +158,7 @@ BOOL ProcessCommandLine(int argc, char* argv[])
switch (c)
{
case 'd':
g_bDump = TRUE;
g_bDump = true;
printf("dump file is on.\n");
break;
@@ -168,17 +168,17 @@ BOOL ProcessCommandLine(int argc, char* argv[])
break;
case 'a':
g_bIgnoreWrongNumOfArgs = TRUE;
g_bIgnoreWrongNumOfArgs = true;
printf("ignore wrong number of arguments is on.\n");
break;
case 'b':
g_bInsOmittedArgsBackward = TRUE;
g_bInsOmittedArgsBackward = true;
printf("insert omitted arguments backward is on.\n");
break;
case 'e':
g_bStopOnError = TRUE;
g_bStopOnError = true;
printf("stop decompiling on error is on.\n");
break;
@@ -204,12 +204,12 @@ BOOL ProcessCommandLine(int argc, char* argv[])
if (optind == argc)
{
printf("Error: Input file name omitted\n");
if (g_bStopOnError == TRUE)
if (g_bStopOnError == true)
{
printf("Press ENTER to continue.\n");
cin.get();
}
return FALSE;
return false;
}
g_inputFileName = argv[optind];
@@ -239,5 +239,5 @@ BOOL ProcessCommandLine(int argc, char* argv[])
g_outputFileName += ".ssl";
}
}
return TRUE;
return true;
}