void PrivateTestStatistics(void) { CChars sz; sz.Init(); if (giTestsRun > 0) { sz.Append("Tests Run: "); sz.Append(giTestsRun); sz.AppendNewLine(); sz.Append("Passed: "); sz.Append(giTestsPassed); sz.AppendNewLine(); sz.Append("Failed: "); sz.Append(giTestsFailed); } else { sz.Append("No Tests Run!"); } sz.AppendNewLine(); sz.AppendNewLine(); gcLogger.Add(sz.Text()); sz.Kill(); }
void CNamedIndexesBlock::Dump(CArrayBlock* pavFakeBlock) { int i; CNamedIndexedBlock* pvcBlock; CChars szText; szText.Init("--- Block("); szText.Append(pavFakeBlock->NumElements()); szText.Append(") ---\n"); szText.Append("("); szText.Append(mszFirst.Text()); szText.Append(") -> ("); szText.Append(mszLast.Text()); szText.Append(")\n"); for (i = 0; i < pavFakeBlock->NumElements(); i++) { pvcBlock = (CNamedIndexedBlock*)pavFakeBlock->Get(i); szText.Append(pvcBlock->Name()); szText.AppendNewLine(); } szText.AppendNewLine(); szText.Dump(); szText.Kill(); }
int TestTotalStatistics(void) { CChars sz; clock_t time; time = clock() - gClock; sz.Init(); sz.Append("------------------------------ Total Results ------------------------------\n"); if (giTotalTestsRun > 0) { sz.Append("Total Tests Run: "); sz.Append(giTotalTestsRun); sz.AppendNewLine(); sz.Append("Total Passed: "); sz.Append(giTotalTestsPassed); sz.AppendNewLine(); sz.Append("Total Failed: "); sz.Append(giTotalTestsFailed); sz.AppendNewLine(); sz.AppendNewLine(); sz.Append("Time Taken: "); sz.Append((float)time / ((float)CLOCKS_PER_SEC)); sz.Append("s"); sz.AppendNewLine(); sz.AppendNewLine(); gcLogger.Add(sz.Text()); sz.Kill(); } gcLogger.Kill(); return giTotalTestsFailed; }
BOOL Fail(char* szExpected, char* szActual, int iLine, char* szFile) { char szLine[1024]; CChars szError; Fail(); IToA(iLine, szLine, 10); szError.Init("Failed: "); szError.Append(szFile); szError.Append(" line "); szError.Append(szLine); szError.AppendNewLine(); szError.Append("Expected: "); szError.Append(szExpected); szError.AppendNewLine(); szError.Append("Actual: "); szError.Append(szActual); szError.AppendNewLine(); szError.AppendNewLine(); gcLogger.Add(szError.Text()); szError.Kill(); return FALSE; }
void CIndexedFile::Dump(void) { CChars sz; int i; filePos iSizeOnDisk; filePos iPos; BOOL bDurable; char pvData[80]; int iReadSize; iSizeOnDisk = mcFile.SizeFromFile(); bDurable = mcFile.mbDurable; mcFile.mbDurable = FALSE; sz.Init(); sz.Append("File Descriptor ("); sz.Append(miFileIndex); sz.Append(")\n------------------\n"); sz.Append("Primary Name: "); sz.Append(mszFileName); sz.AppendNewLine(); sz.Append("Rewrite Name: "); sz.Append(mszRewriteName); sz.AppendNewLine(); sz.Append("Durable: "); sz.AppendBool(bDurable); sz.AppendNewLine(); sz.Append("Datas (A:"); sz.Append(miNumDatas); sz.Append(", D:"); sz.Append(mcFile.miLength/miDataSize); sz.Append(", F:"); sz.Append(iSizeOnDisk/miDataSize); sz.Append(")\n\n"); sz.Append("Data on Disk\n------------\n"); iReadSize = 80; if (miDataSize < iReadSize) { iReadSize = miDataSize; } iPos = mcFile.Tell(); for (i = 0; i < iSizeOnDisk/miDataSize; i++) { mcFile.Read(i*miDataSize, pvData, iReadSize, 1); sz.AppendData(pvData, iReadSize); sz.AppendNewLine(); } sz.AppendNewLine(); mcFile.Seek(EFSO_SET, iPos); sz.Dump(); sz.Kill(); mcFile.Dump(); mcFile.mbDurable = bDurable; }
void CUnknowns::DumpAddDetail(CUnknown* pcUnknown) { SMemoryAllocation* psAlloc; CChars sz; psAlloc = MEMORY_GET_ALLOCATION(pcUnknown); if (!IsFreed(pcUnknown)) { sz.Init("Size: "); sz.Append(psAlloc->uiSize); sz.AppendNewLine(); sz.Append("AllocCount: "); sz.Append(psAlloc->uiAllocCount); sz.AppendNewLine(); sz.Append("DebugName: "); sz.Append(psAlloc->szDebug, 4); sz.AppendNewLine(); sz.Dump(); sz.Kill(); } else { sz.Init("Freed CUnknown.\n"); sz.Append("AllocCount: "); sz.Append(psAlloc->uiAllocCount); sz.AppendNewLine(); sz.Dump(); sz.Kill(); } }
void CLogFile::Dump(void) { CChars sz; int i; char* pvData; CLogFileCommandWrite* psWrite; filePos iLen; sz.Init(); sz.Append("Log File (?"); sz.Append(")\n------------------\n"); sz.Append("Commands: "); sz.Append(macCommands.NumElements()); sz.AppendNewLine(); for (i = 0; i < macCommands.NumElements(); i++) { macCommands.Get(i, (void**)&pvData); sz.Append(" "); sz.Append("Write: ("); psWrite = (CLogFileCommandWrite*)pvData; sz.Append(psWrite->iPosition); sz.Append(", "); sz.Append(psWrite->iSize); sz.Append(") "); pvData = (char*)RemapSinglePointer(psWrite, sizeof(CLogFileCommandWrite)); iLen = psWrite->iSize; sz.AppendData(pvData, 80); sz.AppendNewLine(); } sz.AppendNewLine(); sz.Dump(); sz.Kill(); }
void CBaseObject::DumpFroms(void) { CChars sz; int i; int iNumEmbedded; CEmbeddedObject* pcEmbedded; int j; int iNumHeapFroms; CBaseObject* pcFromObject; int iLength; CChars szLine; sz.Init(); sz.Append("-- "); PrintObject(&sz); sz.Append(" --\n"); iLength = sz.Length()-1; szLine.Init('-', iLength); szLine.AppendNewLine(); sz.Insert(0, &szLine); sz.Append("Total Heap Froms ["); sz.Append(NumHeapFroms()); sz.Append("], "); sz.Append("Stack Froms ["); sz.Append(NumStackFroms()); sz.Append("]\n"); iNumEmbedded = GetNumEmbedded(); for (i = 0; i < iNumEmbedded; i++) { pcEmbedded = GetEmbeddedObject(i); iNumHeapFroms = pcEmbedded->CEmbeddedObject::NumHeapFroms(); sz.Append("Embedded "); sz.Append(i); sz.Append(" Heap Froms ["); sz.Append(iNumHeapFroms); sz.Append("], "); sz.Append("Stack Froms ["); sz.Append(pcEmbedded->CEmbeddedObject::NumStackFroms()); sz.Append("]\n"); for (j = 0; j < iNumHeapFroms; j++) { pcFromObject = pcEmbedded->GetHeapFrom(j); sz.Append(" "); pcFromObject->PrintObject(&sz); sz.AppendNewLine(); } } sz.Append(&szLine); szLine.Kill(); sz.Dump(); sz.Kill(); }
void CChannels::Dump(int iLineLength) { int i; CChannel* psChannel; char* szTypeName; CChars c; int iRemain; c.Init(); for (i = 0; i < masChannelOffsets.NumElements(); i++) { psChannel = masChannelOffsets.Get(i); szTypeName = gcTypeNames.GetPrettyName(psChannel->eType); c.Append("Channel["); c.Append(psChannel->iChannel); c.Append("]: Type["); c.Append(szTypeName); c.Append("], ByteOffset["); c.Append(psChannel->miByteOffset); c.Append("], BitOffset["); c.Append(psChannel->miBitOffset); c.Append("]\n"); } c.Append("Number of elements["); c.Append(miSize); c.Append("], Data array size["); c.Append(mabData.NumElements()); c.Append("]\n"); c.Append("ByteStride["); c.Append(miByteStride); c.Append("]\n"); c.Append("BitStride["); c.Append(miBitStride); c.Append("]\n"); if (iLineLength != 0) { for (i = 0; i <= mabData.NumElements()/iLineLength; i++) { if (mabData.NumElements() - iLineLength*i < iLineLength) { iRemain = mabData.NumElements() - iLineLength*i; } else { iRemain = iLineLength; } c.AppendHexLoHi(mabData.Get(i*iLineLength), iRemain); c.AppendNewLine(); } } c.Dump(); c.Kill(); }
void CExternalString::Dump(void) { CChars sz; sz.Init(msz, 0, miLen); sz.AppendNewLine(); sz.Dump(); sz.Kill(); }
////////////////////////////////////////////////////////////////////////// // // // // ////////////////////////////////////////////////////////////////////////// void SFloat4::Dump(void) { CChars sz; sz.Init(); ToString(&sz, 4); sz.AppendNewLine(); sz.Dump(); sz.Kill(); }
void CPPAbstractHolder::Dump(void) { CChars sz; sz.Init(); Append(&sz); sz.AppendNewLine(); sz.Dump(); sz.Kill(); }
void CDirectInputDetail::Dump(void) { CChars sz; sz.Init(); sz.Append("Joystick "); sz.Append(": "); sz.Append(szID); sz.AppendNewLine(); sz.Dump(); sz.Kill(); }
void CWindow::EndingWinloop(char* szReason) { CChars szShutdown; mcLoopTimer.Update(); szShutdown.Init("Shutdown winloop ["); szShutdown.Append(szReason); szShutdown.Append("] - "); mcLoopTimer.HumanReadable(&szShutdown); mcLoopTimer.Kill(); szShutdown.AppendNewLine(); gcLogger.Add(szShutdown.Text()); }
////////////////////////////////////////////////////////////////////////// // // // // ////////////////////////////////////////////////////////////////////////// void CArrayString::Dump(void) { int i; CChars* psz; CChars sz; sz.Init(1024); for (i = 0; i < mcArray.NumElements(); i++) { psz = mcArray.Get(i); sz.Append(psz); sz.AppendNewLine(); } sz.Dump(); sz.Kill(); }
////////////////////////////////////////////////////////////////////////// // // // // ////////////////////////////////////////////////////////////////////////// void CPreprocessor::ProcessHashError(CPreprocessorTokenParser* pcParser) { CChars szError; CPPToken* pcToken; pcParser->SkipWhiteSpace(); szError.Init("Error ("); szError.Append(mpcCurrentFile->ShortName()); szError.Append("):"); while (pcParser->HasToken()) { pcToken = pcParser->GetToken(); pcToken->Append(&szError); pcParser->NextToken(); } szError.AppendNewLine(); szError.Dump(); szError.Kill(); }
////////////////////////////////////////////////////////////////////////// // // // // ////////////////////////////////////////////////////////////////////////// void CPreprocessor::LogBlocks(CCFile* pcFile, SCTokenBlock sResult) { CChars szLine; CCBlockSet* pcBlocksSet; if (mbLogBlocks) { szLine.Init(); szLine.Append(mpcCurrentFile->ShortName()); if (mcConditionalStack.IsParsing()) { szLine.Append(" (Parsing): "); } else { szLine.Append(" : "); } sResult.Append(&szLine); pcBlocksSet = pcFile->macBlockSets.SafeGet(sResult.iBlockIndex); if (!pcBlocksSet) { szLine.AppendNewLine(); } else { szLine.Append(" ("); szLine.Append(pcBlocksSet->miLine); szLine.Append(")\n"); } if (mbDumpLogs) { szLine.Dump(); } mpszBlocksLog->Append(szLine); szLine.Kill(); } }
void CIndexedMemory::Dump(void) { int iNumElements; int i; SIndexedMemory* psIndexedMemory; void* pvDest; CChars sz; sz.Init(); iNumElements = mcDatas.NumElements(); sz.Append("Transaction Data ("); sz.Append(iNumElements); sz.Append(") (Memory)\n-----------------\n"); for (i = 0; i < iNumElements; i++) { mcDatas.Get(i, (void**)&psIndexedMemory); pvDest = RemapSinglePointer(psIndexedMemory, sizeof(SIndexedMemory)); sz.Append("Index["); sz.Append((int)psIndexedMemory->oi); sz.Append("] Size["); sz.Append((int)psIndexedMemory->uiSize); sz.Append("] "); if (psIndexedMemory->uiSize > 0) { sz.Append("\""); sz.AppendData((char*)pvDest, 80); sz.Append("\" "); } if (psIndexedMemory->IsRemoved()) { sz.Append("(Removed)"); } sz.Append("\n"); } sz.AppendNewLine(); sz.Dump(); sz.Kill(); }
void CTransientIndexedFile::Dump(void) { int iNumElements; int i; SIndexedMemory* psIndexedMemory; void* pvDest; CChars sz; sz.Init(); iNumElements = NumDatas(); sz.Append("Transaction Data ("); sz.Append(iNumElements); sz.Append(") (Huge)\n-----------------\n"); for (i = 0; i < iNumElements; i++) { psIndexedMemory = GetIndexedData(i); pvDest = GetData(psIndexedMemory); sz.Append("Index["); sz.Append((int)psIndexedMemory->oi); sz.Append("] Size["); sz.Append((int)psIndexedMemory->uiSize); sz.Append("] "); if (psIndexedMemory->uiSize > 0) { sz.Append("\""); sz.AppendData((char*)pvDest, 80); sz.Append("\" "); } if (psIndexedMemory->IsRemoved()) { sz.Append("(Removed)"); } sz.Append("\n"); } sz.AppendNewLine(); sz.Dump(); sz.Kill(); }
void CPlainTextEditor::Duplicate(void) { int iStart; int iEnd; CChars szTemp; BOOL bNewLine; if (!IsSelected()) { iStart = FindStartOfLine(miEditPos); iEnd = FindEndOfLine(miEditPos); bNewLine = TRUE; } else { if (miSelectionAnchor < miSelectionFloating) { iStart = miSelectionAnchor; iEnd = miSelectionFloating; } else { iStart = miSelectionFloating; iEnd = miSelectionAnchor; } bNewLine = FALSE; } szTemp.Init(); szTemp.AppendSubString(mszText, iStart, iEnd); if (bNewLine) { szTemp.AppendNewLine(); } mszText.Insert(iStart, &szTemp); szTemp.Kill(); ResetUpDown(); }
void* CMemory::Add(unsigned int uiSize, int iAlignment, int iOffset) { CFreeList* pcFreeList; void* pv; if ((mbBreakOnAlloc) && (muiAllocCount == muiBreakAlloc)) { CChars sz; sz.Init("CMemory::Add: muiAllocCount == "); sz.Append(muiBreakAlloc); sz.AppendNewLine(); sz.Dump(); sz.Kill(); Break(); } if (uiSize == 0) { muiAllocCount++; return NULL; } if (uiSize <= (muiFreeListSizeLimit - sizeof(SMemoryAllocation))) { pcFreeList = GetOrAddFreeList(uiSize, iAlignment, iOffset); pv = AllocateInFreeList(pcFreeList, uiSize); muiAllocCount++; return pv; } else { pv = AllocateInLargeList(uiSize, iAlignment, iOffset); muiAllocCount++; return pv; } }
void CDistCalculatorParameters::Dump(void) { CChars sz; sz.Init("--------- DistCalculatorParameters ---------"); sz.AppendNewLine(); sz.Append(" Touched ["); sz.Append(mapcTouched.NumElements()); sz.Append("]: "); PrintArray(&sz, &mapcTouched); sz.AppendNewLine(); sz.Append("ExpectedDists ["); sz.Append(macExpectedDists.NumElements()); sz.Append("]: "); PrintArray(&sz, &macExpectedDists); sz.AppendNewLine(); sz.Append(" Detached ["); sz.Append(mapcDetachedFromRoot.NumElements()); sz.Append("]: "); PrintArray(&sz, &mapcDetachedFromRoot); sz.AppendNewLine(); sz.AppendNewLine(); sz.Append(" C. Detached ["); sz.Append(mapcCompletelyDetached.NumElements()); sz.Append("]: "); PrintArray(&sz, &mapcCompletelyDetached); sz.AppendNewLine(); sz.Append("--------------------------------------------"); sz.AppendNewLine(); sz.Dump(); sz.Kill(); }
void CBaseObject::DumpPointerTos(void) { CChars sz; int i; int iNumEmbedded; CEmbeddedObject* pcEmbedded; int j; int iNumTos; CEmbeddedObject** ppcToObject; int iLength; CChars szLine; CArrayTemplateEmbeddedObjectPtr acTos; CBaseObject* pcToObject; int iTotalTos; sz.Init(); sz.Append("-- "); PrintObject(&sz); sz.Append(" --\n"); iLength = sz.Length()-1; szLine.Init('-', iLength); szLine.AppendNewLine(); iTotalTos = 0; iNumEmbedded = GetNumEmbedded(); for (i = 0; i < iNumEmbedded; i++) { pcEmbedded = GetEmbeddedObject(i); iTotalTos += pcEmbedded->NumPointerTos(); } sz.Insert(0, &szLine); sz.Append("Total Tos ["); sz.Append(iTotalTos); sz.Append("]\n"); for (i = 0; i < iNumEmbedded; i++) { pcEmbedded = GetEmbeddedObject(i); acTos.Init(1); pcEmbedded->BaseGetPointerTos(&acTos); iNumTos = acTos.NumElements(); sz.Append("Embedded "); sz.Append(i); sz.Append(" Tos ["); sz.Append(iNumTos); sz.Append("]\n"); for (j = 0; j < iNumTos; j++) { ppcToObject = acTos.Get(j); //A pointed to never comes back NULL. sz.Append(" "); if ((*ppcToObject)->IsBaseObject()) { pcToObject = (CBaseObject*)*ppcToObject; pcToObject->PrintObject(&sz); } else { sz.Append("HollwEmbeddedObject"); } sz.AppendNewLine(); } acTos.Kill(); } sz.Append(&szLine); szLine.Kill(); sz.Dump(); sz.Kill(); }