From 14b06c252e5d438a1f7129c1fecfe916177e3e84 Mon Sep 17 00:00:00 2001 From: Artur K Date: Tue, 13 Mar 2012 00:28:04 +0100 Subject: [PATCH] Replaced all TRUE/FALSE macro usages with true/false booleans --- include/dcc.h | 5 +++++ include/icode.h | 1 + include/symtab.h | 6 ++++++ src/BasicBlock.cpp | 6 +++--- src/ast.cpp | 14 +++++++------- src/chklib.cpp | 10 +++++----- src/control.cpp | 10 +++++----- src/dataflow.cpp | 4 ++-- src/disassem.cpp | 4 ++-- src/fixwild.cpp | 40 +++++++++++++++++++--------------------- src/graph.cpp | 6 +++--- src/hlicode.cpp | 2 +- src/idioms.cpp | 2 +- src/locident.cpp | 8 ++++---- src/parser.cpp | 36 ++++++++++++++++++------------------ src/procs.cpp | 14 +++++++------- src/proplong.cpp | 2 +- src/reducible.cpp | 14 +++++++------- src/scanner.cpp | 36 ++++++++++++++++++------------------ src/symtab.cpp | 2 +- 20 files changed, 116 insertions(+), 106 deletions(-) diff --git a/include/dcc.h b/include/dcc.h index f2c8407..78c5c2e 100644 --- a/include/dcc.h +++ b/include/dcc.h @@ -3,8 +3,13 @@ * (C) Cristina Cifuentes, Mike van Emmerik ****************************************************************************/ #pragma once +//TODO: Remove boolT + #include +#include +#include #include + #include "Enums.h" #include "types.h" #include "ast.h" diff --git a/include/icode.h b/include/icode.h index c67287d..9b58a26 100644 --- a/include/icode.h +++ b/include/icode.h @@ -12,6 +12,7 @@ #include #include #include +#include #include "Enums.h" #include "state.h" // State depends on INDEXBASE, but later need STATE //enum condId; diff --git a/include/symtab.h b/include/symtab.h index 02816dc..adb2f7b 100644 --- a/include/symtab.h +++ b/include/symtab.h @@ -3,6 +3,12 @@ * (C) Mike van Emmerik */ #pragma once +#include +#include +#include "Enums.h" +#include "types.h" +struct COND_EXPR; +struct TypeContainer; /* * * * * * * * * * * * * * * * * */ /* Symbol table structs and protos */ /* * * * * * * * * * * * * * * * * */ diff --git a/src/BasicBlock.cpp b/src/BasicBlock.cpp index 032ba2e..b94e936 100644 --- a/src/BasicBlock.cpp +++ b/src/BasicBlock.cpp @@ -151,7 +151,7 @@ void BB::writeCode (int indLevel, Function * pProc , int *numLoc,int _latchNode, traversed = DFS_ALPHA; /* Check for start of loop */ - repCond = FALSE; + repCond = false; latch = NULL; _loopType = loopType; if (_loopType) @@ -204,7 +204,7 @@ void BB::writeCode (int indLevel, Function * pProc , int *numLoc,int _latchNode, } /* Write the code for this basic block */ - if (repCond == FALSE) + if (repCond == false) writeBB (indLevel, pProc, numLoc); /* Check for end of path */ @@ -272,7 +272,7 @@ void BB::writeCode (int indLevel, Function * pProc , int *numLoc,int _latchNode, { stats.numHLIcode++; indLevel++; - emptyThen = FALSE; + emptyThen = false; if (ifFollow != MAX) /* there is a follow */ { diff --git a/src/ast.cpp b/src/ast.cpp index 072c7c1..2b772f0 100644 --- a/src/ast.cpp +++ b/src/ast.cpp @@ -647,37 +647,37 @@ string walkCondExpr (const COND_EXPR* expr, Function * pProc, int* numLoc) case NEGATION: if (expr->expr.unaryExp->type == IDENTIFIER) { - needBracket = FALSE; + needBracket = false; outStr << "!"; } else outStr << "! ("; outStr << walkCondExpr (expr->expr.unaryExp, pProc, numLoc); - if (needBracket == TRUE) + if (needBracket == true) outStr << ")"; break; case ADDRESSOF: if (expr->expr.unaryExp->type == IDENTIFIER) { - needBracket = FALSE; + needBracket = false; outStr << "&"; } else outStr << "&("; outStr << walkCondExpr (expr->expr.unaryExp, pProc, numLoc); - if (needBracket == TRUE) + if (needBracket == true) outStr << ")"; break; case DEREFERENCE: outStr << "*"; if (expr->expr.unaryExp->type == IDENTIFIER) - needBracket = FALSE; + needBracket = false; else outStr << "("; outStr << walkCondExpr (expr->expr.unaryExp, pProc, numLoc); - if (needBracket == TRUE) + if (needBracket == true) outStr << ")"; break; @@ -864,7 +864,7 @@ COND_EXPR *COND_EXPR::insertSubTreeReg (COND_EXPR *_expr, eReg regi,LOCAL_ID *lo return _expr; } } - return FALSE; + return false; case BOOLEAN_OP: temp = lhs()->insertSubTreeReg( _expr, regi, locsym); diff --git a/src/chklib.cpp b/src/chklib.cpp index 123755a..4e9653d 100644 --- a/src/chklib.cpp +++ b/src/chklib.cpp @@ -309,7 +309,7 @@ void SetupLibCheck(void) readProtoFile(); - prog.bSigs = FALSE; /* False unless everything goes right */ + prog.bSigs = false; /* False unless everything goes right */ /* Read the parameters */ grab(4, g_file); if (memcmp("dccs", buf, 4) != 0) @@ -419,7 +419,7 @@ void SetupLibCheck(void) } } fclose(g_file); - prog.bSigs = TRUE; + prog.bSigs = true; } @@ -431,7 +431,7 @@ void CleanupLibCheck(void) } -/* Check this function to see if it is a library function. Return TRUE if +/* Check this function to see if it is a library function. Return true if it is, and copy its name to pProc->name */ bool LibCheck(Function & pProc) @@ -441,11 +441,11 @@ bool LibCheck(Function & pProc) int Idx; uint8_t pat[PATLEN]; - if (prog.bSigs == FALSE) + if (prog.bSigs == false) { /* No signatures... can't rely on hash parameters to be initialised so always return false */ - return FALSE; + return false; } fileOffset = pProc.procEntry; /* Offset into the image */ diff --git a/src/control.cpp b/src/control.cpp index 102c994..1ea58e8 100644 --- a/src/control.cpp +++ b/src/control.cpp @@ -494,10 +494,10 @@ void Function::compoundCond() ICODE * picode, * ticode; boolT change; - change = TRUE; + change = true; while (change) { - change = FALSE; + change = false; /* Traverse nodes in postorder, this way, the header node of a * compound condition is analysed first */ @@ -584,7 +584,7 @@ void Function::compoundCond() else i--; /* to repeat this analysis */ - change = TRUE; + change = true; } /* Check (X && Y) case */ @@ -616,7 +616,7 @@ void Function::compoundCond() else i--; /* to repeat this analysis */ - change = TRUE; + change = true; } /* Check (!X || Y) case */ @@ -654,7 +654,7 @@ void Function::compoundCond() else i--; /* to repeat this analysis */ - change = TRUE; + change = true; } } } diff --git a/src/dataflow.cpp b/src/dataflow.cpp index 6b49e8e..aec2e88 100644 --- a/src/dataflow.cpp +++ b/src/dataflow.cpp @@ -636,7 +636,7 @@ bool COND_EXPR::xClear (iICODE f, iICODE t, iICODE lastBBinst, Function * pproc) if(0==rhs()) return false; res = rhs()->xClear ( f, t, lastBBinst, pproc); - if (res == FALSE) + if (res == false) return false; if(0==lhs()) return false; @@ -783,7 +783,7 @@ void Function::processHliCall(COND_EXPR *_exp, iICODE picode) pp->args.adjustForArgType (numArgs,expType (_exp, this)); res = picode->newStkArg (_exp,(llIcode)picode->ll()->getOpcode(), this); } - if (res == FALSE) + if (res == false) k += hlTypeSize (_exp, this); numArgs++; } diff --git a/src/disassem.cpp b/src/disassem.cpp index f4e8e38..2bb8b45 100644 --- a/src/disassem.cpp +++ b/src/disassem.cpp @@ -241,7 +241,7 @@ void Disassembler::disassem(Function * ppProc) destroySymTables(); } /**************************************************************************** - * dis1Line() - disassemble one line to stream fp * * + * dis1Line() - disassemble one line to stream fp * * i is index into Icode for this proc * * It is assumed that icode i is already scanned * ****************************************************************************/ @@ -511,7 +511,7 @@ void Disassembler::dis1Line(LLInst &inst,int loc_ip, int pass) /* Comments */ if (inst.testFlags(SYNTHETIC)) { - fImpure = FALSE; + fImpure = false; } else { diff --git a/src/fixwild.cpp b/src/fixwild.cpp index 66528bf..ec55151 100644 --- a/src/fixwild.cpp +++ b/src/fixwild.cpp @@ -18,8 +18,6 @@ #ifndef bool #define bool unsigned char -#define TRUE 1 -#define FALSE 0 #define uint8_t unsigned char #endif @@ -39,7 +37,7 @@ static bool ModRM(uint8_t pat[]) /* A standard mod/rm uint8_t follows opcode */ op = pat[pc++]; /* The mod/rm uint8_t */ - if (pc >= PATLEN) return TRUE; /* Skip Mod/RM */ + if (pc >= PATLEN) return true; /* Skip Mod/RM */ switch (op & 0xC0) { case 0x00: /* [reg] or [nnnn] */ @@ -47,26 +45,26 @@ static bool ModRM(uint8_t pat[]) { /* Uses [nnnn] address mode */ pat[pc++] = WILD; - if (pc >= PATLEN) return TRUE; + if (pc >= PATLEN) return true; pat[pc++] = WILD; - if (pc >= PATLEN) return TRUE; + if (pc >= PATLEN) return true; } break; case 0x40: /* [reg + nn] */ - if ((pc+=1) >= PATLEN) return TRUE; + if ((pc+=1) >= PATLEN) return true; break; case 0x80: /* [reg + nnnn] */ /* Possibly just a long constant offset from a register, but often will be an index from a variable */ pat[pc++] = WILD; - if (pc >= PATLEN) return TRUE; + if (pc >= PATLEN) return true; pat[pc++] = WILD; - if (pc >= PATLEN) return TRUE; + if (pc >= PATLEN) return true; break; case 0xC0: /* reg */ break; } - return FALSE; + return false; } /* Change the next two bytes to wild cards */ @@ -74,10 +72,10 @@ static bool TwoWild(uint8_t pat[]) { pat[pc++] = WILD; - if (pc >= PATLEN) return TRUE; /* Pattern exhausted */ + if (pc >= PATLEN) return true; /* Pattern exhausted */ pat[pc++] = WILD; - if (pc >= PATLEN) return TRUE; - return FALSE; + if (pc >= PATLEN) return true; + return false; } /* Change the next four bytes to wild cards */ @@ -105,7 +103,7 @@ static bool op0F(uint8_t pat[]) { case 0x00: /* 00 - 0F */ if (op >= 0x06) /* Clts, Invd, Wbinvd */ - return FALSE; + return false; else { /* Grp 6, Grp 7, LAR, LSL */ @@ -116,7 +114,7 @@ static bool op0F(uint8_t pat[]) case 0x80: pc += 2; /* uint16_t displacement cond jumps */ - return FALSE; + return false; case 0x90: /* uint8_t set on condition */ return ModRM(pat); @@ -128,7 +126,7 @@ static bool op0F(uint8_t pat[]) case 0xA1: /* Pop FS */ case 0xA8: /* Push GS */ case 0xA9: /* Pop GS */ - return FALSE; + return false; case 0xA3: /* Bt Ev,Gv */ case 0xAB: /* Bts Ev,Gv */ @@ -136,9 +134,9 @@ static bool op0F(uint8_t pat[]) case 0xA4: /* Shld EvGbIb */ case 0xAC: /* Shrd EvGbIb */ - if (ModRM(pat)) return TRUE; + if (ModRM(pat)) return true; pc++; /* The #num bits to shift */ - return FALSE; + return false; case 0xA5: /* Shld EvGb CL */ case 0xAD: /* Shrd EvGb CL */ @@ -152,9 +150,9 @@ static bool op0F(uint8_t pat[]) if (op == 0xBA) { /* Grp 8: bt/bts/btr/btc Ev,#nn */ - if (ModRM(pat)) return TRUE; + if (ModRM(pat)) return true; pc++; /* The #num bits to shift */ - return FALSE; + return false; } return ModRM(pat); @@ -165,10 +163,10 @@ static bool op0F(uint8_t pat[]) return ModRM(pat); } /* Else BSWAP */ - return FALSE; + return false; default: - return FALSE; /* Treat as double uint8_t opcodes */ + return false; /* Treat as double uint8_t opcodes */ } diff --git a/src/graph.cpp b/src/graph.cpp index 66ee5ed..d4a1247 100644 --- a/src/graph.cpp +++ b/src/graph.cpp @@ -80,7 +80,7 @@ CondJumps: pBB = BB::Create(start, ip, MULTI_BRANCH, ll->caseTbl.numEntries, this); for (i = 0; i < ll->caseTbl.numEntries; i++) pBB->edges[i].ip = ll->caseTbl.entries[i]; - hasCase = TRUE; + hasCase = true; } else if ((ll->getFlag() & (I | NO_LABEL)) == I) //TODO: WHY NO_LABEL TESTIT { @@ -285,7 +285,7 @@ BB *BB::rmJMP(int marker, BB * pBB) else { pBB->front().ll()->setFlags(NO_CODE); - pBB->front().invalidate(); //pProc->Icode.SetLlInvalid(pBB->begin(), TRUE); + pBB->front().invalidate(); //pProc->Icode.SetLlInvalid(pBB->begin(), true); } pBB = pBB->edges[0].BBptr; @@ -304,7 +304,7 @@ BB *BB::rmJMP(int marker, BB * pBB) pBB->front().ll()->setFlags(NO_CODE); pBB->front().invalidate(); // pProc->Icode.setFlags(pBB->start, NO_CODE); - // pProc->Icode.SetLlInvalid(pBB->start, TRUE); + // pProc->Icode.SetLlInvalid(pBB->start, true); } } while (pBB->nodeType != NOWHERE_NODE); diff --git a/src/hlicode.cpp b/src/hlicode.cpp index b7299b6..c41a8fa 100644 --- a/src/hlicode.cpp +++ b/src/hlicode.cpp @@ -74,7 +74,7 @@ void ICODE::setJCond(COND_EXPR *cexp) } -/* Sets the invalid field to TRUE as this low-level icode is no longer valid, +/* Sets the invalid field to true as this low-level icode is no longer valid, * it has been replaced by a high-level icode. */ void ICODE ::invalidate() { diff --git a/src/idioms.cpp b/src/idioms.cpp index 86c5432..f3bd4a4 100644 --- a/src/idioms.cpp +++ b/src/idioms.cpp @@ -18,7 +18,7 @@ #include #include /***************************************************************************** - * JmpInst - Returns TRUE if opcode is a conditional or unconditional jump + * JmpInst - Returns true if opcode is a conditional or unconditional jump ****************************************************************************/ bool LLInst::isJmpInst() { diff --git a/src/locident.cpp b/src/locident.cpp index bc4fbd8..8d05d45 100644 --- a/src/locident.cpp +++ b/src/locident.cpp @@ -432,15 +432,15 @@ void LOCAL_ID::propLongId (uint8_t regL, uint8_t regH, const char *name) { strcpy (_id->name, name); strcpy (_id->macro, "LO"); - _id->hasMacro = TRUE; - _id->illegal = TRUE; + _id->hasMacro = true; + _id->illegal = true; } else if (_id->id.regi == regH) { strcpy (_id->name, name); strcpy (_id->macro, "HI"); - _id->hasMacro = TRUE; - _id->illegal = TRUE; + _id->hasMacro = true; + _id->illegal = true; } } } diff --git a/src/parser.cpp b/src/parser.cpp index e7fe00a..a5f853b 100644 --- a/src/parser.cpp +++ b/src/parser.cpp @@ -122,14 +122,14 @@ void Function::FollowCtrl(CALL_GRAPH * pcallGraph, STATE *pstate) SYM * psym; uint32_t offset; eErrorId err; - boolT done = FALSE; + boolT done = false; if (name.find("chkstk") != string::npos) { // Danger! Dcc will likely fall over in this code. // So we act as though we have done with this proc // pProc->flg &= ~TERMINATES; // Not sure about this - done = TRUE; + done = true; // And mark it as a library function, so structure() won't choke on it flg |= PROC_ISLIB; return; @@ -252,7 +252,7 @@ void Function::FollowCtrl(CALL_GRAPH * pcallGraph, STATE *pstate) { STATE StCopy; int ip = Icode.size()-1; /* Index of this jump */ ICODE &prev(Icode.back()); /* Previous icode */ - boolT fBranch = FALSE; + boolT fBranch = false; pstate->JCond.regi = 0; @@ -286,7 +286,7 @@ void Function::FollowCtrl(CALL_GRAPH * pcallGraph, STATE *pstate) /*** Jumps ***/ case iJMP: - case iJMPF: /* Returns TRUE if we've run into a loop */ + case iJMPF: /* Returns true if we've run into a loop */ done = process_JMP (*pIcode, pstate, pcallGraph); break; @@ -305,7 +305,7 @@ void Function::FollowCtrl(CALL_GRAPH * pcallGraph, STATE *pstate) /* Fall through */ case iIRET: this->flg &= ~TERMINATES; - done = TRUE; + done = true; break; case iINT: @@ -397,7 +397,7 @@ void Function::FollowCtrl(CALL_GRAPH * pcallGraph, STATE *pstate) } -/* process_JMP - Handles JMPs, returns TRUE if we should end recursion */ +/* process_JMP - Handles JMPs, returns true if we should end recursion */ boolT Function::process_JMP (ICODE & pIcode, STATE *pstate, CALL_GRAPH * pcallGraph) { static uint8_t i2r[4] = {rSI, rDI, rBP, rBX}; @@ -416,7 +416,7 @@ boolT Function::process_JMP (ICODE & pIcode, STATE *pstate, CALL_GRAPH * pcallGr exit(1); } - /* Return TRUE if jump target is already parsed */ + /* Return true if jump target is already parsed */ return Icode.labelSrch(i, tmp); } @@ -486,7 +486,7 @@ boolT Function::process_JMP (ICODE & pIcode, STATE *pstate, CALL_GRAPH * pcallGr pIcode.ll()->setFlags(SWITCH); pIcode.ll()->caseTbl.numEntries = (endTable - offTable) / 2; assert(pIcode.ll()->caseTbl.numEntries<512); - psw = (uint32_t*)allocMem(pIcode.ll()->caseTbl.numEntries*sizeof(uint32_t)); + psw = new uint32_t [pIcode.ll()->caseTbl.numEntries]; pIcode.ll()->caseTbl.entries = psw; for (i = offTable, k = 0; i < endTable; i += 2) @@ -503,7 +503,7 @@ boolT Function::process_JMP (ICODE & pIcode, STATE *pstate, CALL_GRAPH * pcallGr *psw++ = last_current_insn->ll()->GetLlLabel(); } - return TRUE; + return true; } } @@ -512,13 +512,13 @@ boolT Function::process_JMP (ICODE & pIcode, STATE *pstate, CALL_GRAPH * pcallGr flg |= PROC_IJMP; flg &= ~TERMINATES; interactDis(this, this->Icode.size()-1); - return TRUE; + return true; } /* Process procedure call. * Note: We assume that CALL's will return unless there is good evidence to - * the contrary - thus we return FALSE unless all paths in the called + * the contrary - thus we return false unless all paths in the called * procedure end in DOS exits. This is reasonable since C procedures * will always include the epilogue after the call anyway and it's to * be assumed that if an assembler program contains a CALL that the @@ -533,7 +533,7 @@ boolT Function::process_CALL (ICODE & pIcode, CALL_GRAPH * pcallGraph, STATE *ps boolT indirect; /* For Indirect Calls, find the function address */ - indirect = FALSE; + indirect = false; //pIcode.ll()->immed.proc.proc=fakeproc; if ( not pIcode.ll()->testFlags(I) ) { @@ -863,19 +863,19 @@ void STATE::setState(uint16_t reg, int16_t value) { value &= 0xFFFF; r[reg] = value; - f[reg] = TRUE; + f[reg] = true; switch (reg) { case rAX: case rCX: case rDX: case rBX: r[reg + rAL - rAX] = value & 0xFF; - f[reg + rAL - rAX] = TRUE; + f[reg + rAL - rAX] = true; r[reg + rAH - rAX] = (value >> 8) & 0xFF; - f[reg + rAH - rAX] = TRUE; + f[reg + rAH - rAX] = true; break; case rAL: case rCL: case rDL: case rBL: if (f[reg - rAL + rAH]) { r[reg - rAL + rAX] =(r[reg - rAL + rAH] << 8) + (value & 0xFF); - f[reg - rAL + rAX] = TRUE; + f[reg - rAL + rAX] = true; } break; @@ -883,7 +883,7 @@ void STATE::setState(uint16_t reg, int16_t value) if (f[reg - rAH + rAL]) { r[reg - rAH + rAX] = r[reg - rAH + rAL] + ((value & 0xFF) << 8); - f[reg - rAH + rAX] = TRUE; + f[reg - rAH + rAX] = true; } break; } @@ -1233,6 +1233,6 @@ void Function::process_operands(ICODE & pIcode, STATE * pstate) for (i = rSP; i <= rBH; i++) /* Kill all defined registers */ if (pIcode.ll()->flagDU.d & (1 << i)) - pstate->f[i] = FALSE; + pstate->f[i] = false; } diff --git a/src/procs.cpp b/src/procs.cpp index 4087d10..5119c96 100644 --- a/src/procs.cpp +++ b/src/procs.cpp @@ -131,7 +131,7 @@ void Function::newRegArg(iICODE picode, iICODE ticode) } /* Check if register argument already on the formal argument list */ - regExist = FALSE; + regExist = false; for (i = 0; i < ts->sym.size(); i++) { if (type == REGISTER) @@ -139,7 +139,7 @@ void Function::newRegArg(iICODE picode, iICODE ticode) if ((ts->sym[i].regs != NULL) && (ts->sym[i].regs->expr.ident.idNode.regiIdx == tidx)) { - regExist = TRUE; + regExist = true; i = ts->sym.size(); } } @@ -148,14 +148,14 @@ void Function::newRegArg(iICODE picode, iICODE ticode) if ((ts->sym[i].regs != NULL) && (ts->sym[i].regs->expr.ident.idNode.longIdx == tidx)) { - regExist = TRUE; + regExist = true; i = ts->sym.size(); } } } /* Do ts (formal arguments) */ - if (regExist == FALSE) + if (regExist == false) { STKSYM newsym; sprintf (newsym.name, "arg%ld", ts->sym.size()); @@ -366,10 +366,10 @@ void STKFRAME::adjustForArgType(int numArg_, hlType actType_) nsym = psym + 1; sprintf (nsym->macro, "HI"); sprintf (psym->macro, "LO"); - nsym->hasMacro = TRUE; - psym->hasMacro = TRUE; + nsym->hasMacro = true; + psym->hasMacro = true; sprintf (nsym->name, "%s", psym->name); - nsym->invalid = TRUE; + nsym->invalid = true; numArgs--; } break; diff --git a/src/proplong.cpp b/src/proplong.cpp index af6f5ef..65c70e6 100644 --- a/src/proplong.cpp +++ b/src/proplong.cpp @@ -248,7 +248,7 @@ void Function::propLongStk (int i, const ID &pLocId) continue; if (pIcode->ll()->getOpcode() == next1->ll()->getOpcode()) { - if (checkLongEq (pLocId.id.longStkId, pIcode, i, this, asgn, next1) == TRUE) + if (checkLongEq (pLocId.id.longStkId, pIcode, i, this, asgn, next1) == true) { switch (pIcode->ll()->getOpcode()) { diff --git a/src/reducible.cpp b/src/reducible.cpp index d718beb..003500f 100644 --- a/src/reducible.cpp +++ b/src/reducible.cpp @@ -105,10 +105,10 @@ void derSeq_Entry::findIntervals (Function *c) *succ; /* Successor basic block */ int i; /* Counter */ queue H; /* Queue of possible header nodes */ - boolT first = TRUE; /* First pass through the loop */ + boolT first = true; /* First pass through the loop */ appendQueue (H, Gi); /* H = {first node of G} */ - Gi->beenOnH = TRUE; + Gi->beenOnH = true; Gi->reachingInt = BB::Create(0,"",c); /* ^ empty BB */ /* Process header nodes list H */ @@ -138,7 +138,7 @@ void derSeq_Entry::findIntervals (Function *c) else if (! succ->beenOnH) /* out edge */ { appendQueue (H, succ); - succ->beenOnH = TRUE; + succ->beenOnH = true; pI->numOutEdges++; } } @@ -250,7 +250,7 @@ bool Function::nextOrderGraph (derSeq &derivedGi) derivedGi.push_back(derSeq_Entry()); derSeq_Entry &new_entry(derivedGi.back()); Ii = prev_entry.Ii; - sameGraph = TRUE; + sameGraph = true; BBnode = 0; std::vector bbs; while (Ii) @@ -263,7 +263,7 @@ bool Function::nextOrderGraph (derSeq &derivedGi) /* Check for more than 1 interval */ if (sameGraph && (listIi.size()>1)) - sameGraph = FALSE; + sameGraph = false; /* Find out edges */ @@ -335,10 +335,10 @@ uint8_t Function::findDerivedSeq (derSeq &derivedGi) derivedGi.erase(iter,derivedGi.end()); /* remove Gi+1 */ // freeDerivedSeq(derivedGi->next); // derivedGi->next = NULL; - return FALSE; + return false; } derivedGi.back().findIntervals (this); - return TRUE; + return true; } /* Converts the irreducible graph G into an equivalent reducible one, by diff --git a/src/scanner.cpp b/src/scanner.cpp index ca178de..c1560ec 100644 --- a/src/scanner.cpp +++ b/src/scanner.cpp @@ -365,7 +365,7 @@ eErrorId scan(uint32_t ip, ICODE &p) /*************************************************************************** - relocItem - returns TRUE if uint16_t pointed at is in relocation table + relocItem - returns true if uint16_t pointed at is in relocation table **************************************************************************/ static boolT relocItem(uint8_t *p) { @@ -374,8 +374,8 @@ static boolT relocItem(uint8_t *p) for (i = 0; i < prog.cReloc; i++) if (prog.relocTable[i] == off) - return TRUE; - return FALSE; + return true; + return false; } @@ -402,8 +402,8 @@ static int signex(uint8_t b) /**************************************************************************** * setAddress - Updates the source or destination field for the current * icode, based on fdst and the TO_REG flag. - * Note: fdst == TRUE is for the r/m part of the field (dest, unless TO_REG) - * fdst == FALSE is for reg part of the field + * Note: fdst == true is for the r/m part of the field (dest, unless TO_REG) + * fdst == false is for reg part of the field ***************************************************************************/ static void setAddress(int i, boolT fdst, uint16_t seg, int16_t reg, uint16_t off) { @@ -458,24 +458,24 @@ static void rm(int i) switch (mod) { case 0: /* No disp unless rm == 6 */ if (rm == 6) { - setAddress(i, TRUE, SegPrefix, 0, getWord()); + setAddress(i, true, SegPrefix, 0, getWord()); pIcode->ll()->setFlags(WORD_OFF); } else - setAddress(i, TRUE, SegPrefix, rm + INDEX_BX_SI, 0); + setAddress(i, true, SegPrefix, rm + INDEX_BX_SI, 0); break; case 1: /* 1 uint8_t disp */ - setAddress(i, TRUE, SegPrefix, rm+INDEX_BX_SI, (uint16_t)signex(*pInst++)); + setAddress(i, true, SegPrefix, rm+INDEX_BX_SI, (uint16_t)signex(*pInst++)); break; case 2: /* 2 uint8_t disp */ - setAddress(i, TRUE, SegPrefix, rm + INDEX_BX_SI, getWord()); + setAddress(i, true, SegPrefix, rm + INDEX_BX_SI, getWord()); pIcode->ll()->setFlags(WORD_OFF); break; case 3: /* reg */ - setAddress(i, TRUE, 0, rm + rAX, 0); + setAddress(i, true, 0, rm + rAX, 0); break; } @@ -490,7 +490,7 @@ static void rm(int i) ***************************************************************************/ static void modrm(int i) { - setAddress(i, FALSE, 0, REG(*pInst) + rAX, 0); + setAddress(i, false, 0, REG(*pInst) + rAX, 0); rm(i); } @@ -505,7 +505,7 @@ static void segrm(int i) if (reg > rDS || (reg == rCS && (stateTable[i].flg & TO_REG))) pIcode->ll()->setOpcode((llIcode)0); // setCBW because it has that index else { - setAddress(i, FALSE, 0, (int16_t)reg, 0); + setAddress(i, false, 0, (int16_t)reg, 0); rm(i); } } @@ -516,7 +516,7 @@ static void segrm(int i) ***************************************************************************/ static void regop(int i) { - setAddress(i, FALSE, 0, ((int16_t)i & 7) + rAX, 0); + setAddress(i, false, 0, ((int16_t)i & 7) + rAX, 0); pIcode->ll()->dst.regi = pIcode->ll()->src.regi; } @@ -526,7 +526,7 @@ static void regop(int i) *****************************************************************************/ static void segop(int i) { - setAddress(i, TRUE, 0, (((int16_t)i & 0x18) >> 3) + rES, 0); + setAddress(i, true, 0, (((int16_t)i & 0x18) >> 3) + rES, 0); } @@ -535,7 +535,7 @@ static void segop(int i) ***************************************************************************/ static void axImp(int i) { - setAddress(i, TRUE, 0, rAX, 0); + setAddress(i, true, 0, rAX, 0); } /* Implied AX source */ @@ -556,7 +556,7 @@ static void alImp (int ) ****************************************************************************/ static void memImp(int i) { - setAddress(i, FALSE, SegPrefix, 0, 0); + setAddress(i, false, SegPrefix, 0, 0); } @@ -674,7 +674,7 @@ static void arith(int i) else if (!(opcode == iNOT || opcode == iNEG)) { pIcode->ll()->src = pIcode->ll()->dst; - setAddress(i, TRUE, 0, rAX, 0); /* dst = AX */ + setAddress(i, true, 0, rAX, 0); /* dst = AX */ } else if (opcode == iNEG || opcode == iNOT) pIcode->ll()->setFlags(NO_SRC); @@ -727,7 +727,7 @@ static void data2(int ) ****************************************************************************/ static void dispM(int i) { - setAddress(i, FALSE, SegPrefix, 0, getWord()); + setAddress(i, false, SegPrefix, 0, getWord()); } diff --git a/src/symtab.cpp b/src/symtab.cpp index e64c5c2..2dcf8e9 100644 --- a/src/symtab.cpp +++ b/src/symtab.cpp @@ -106,7 +106,7 @@ void createSymTables(void) /* Now the string table */ strTabNext = 0; - pStrTab = (char *)allocMem(STRTABSIZE); + pStrTab = new char[STRTABSIZE]; curTableType = Label;