int clsDump::DumpLocation(clsLocation Location, int onlyCalculateSize) { int iSize = 0; iSize += DumpLine("- - - LOCATION BEG - - -\n", onlyCalculateSize); iSize += DumpString("\tFile\n", Location.m_sFile, onlyCalculateSize); iSize += DumpLine("\tLine %u\n", Location.m_iLine, onlyCalculateSize); iSize += DumpLine("- - - LOCATION END - - -\n", onlyCalculateSize); return iSize; }
int clsDump::DumpDataType(clsDataType * pDataType, int onlyCalculateSize) { int iSize = 0; iSize += DumpLine("- - - DATATYPE BEG - - -\n", onlyCalculateSize); iSize += DumpLine("\tUID = %u\n", pDataType->m_UID, onlyCalculateSize); iSize += DumpLine("\tWidth = %u\n", pDataType->m_iWidth, onlyCalculateSize); iSize += DumpLine("\tIsSigned = %u\n", pDataType->m_IsSigned, onlyCalculateSize); iSize += DumpLine("- - - DATATYPE END - - -\n", onlyCalculateSize); return iSize; }
static void dump(void* generalAddress, int length) { int curr = 0; char* address = (char*) generalAddress; while (&address[curr] < &address[length-BYTES_PER_LINE]) { DumpLine(&address[curr], BYTES_PER_LINE); curr += BYTES_PER_LINE; } if (curr < length) { DumpLine(&address[curr], length-curr); } fflush(stderr); }
int clsDump::DumpConst(clsConst * pConst, int onlyCalculateSize) { int iSize = 0; unsigned int iIndex; iSize += DumpLine("----- CONST BEG -----\n", onlyCalculateSize); iSize += DumpLine("\tUID %u\n", pConst->m_UID, onlyCalculateSize); iSize += DumpLine("\tData Type UID %u\n", pConst->m_pDataType->m_UID, onlyCalculateSize); iSize += DumpLine("\tConst Width: %u\n", pConst->m_pDataType->m_iWidth, onlyCalculateSize); for (iIndex = 0; iIndex < pConst->m_pDataType->m_iWidth; ++iIndex) { iSize += DumpByte("\tBits: %u\n", pConst->m_sBits[iIndex], onlyCalculateSize); } iSize += DumpByte("\tBits End: %u\n", '\0', onlyCalculateSize); iSize += DumpLine("----- CONST END -----\n", onlyCalculateSize); return iSize; }
void KMemViewer::DumpPage(void) { TCHAR buffer[1024]; buffer[0] = 0; unsigned char * p = m_current; for (unsigned row=0; row<m_pagesize/16; row++, p+=16) { DumpLine(p, 0, UnitSize()); strcat(buffer, m_line); } SetDlgItemText(m_hWnd, IDC_DUMP, buffer); }
int clsDump::DumpScopeType(clsScopeType * pScopeType, int onlyCalculateSize) { int iSize = 0; unsigned int iIndex; iSize += DumpLine("----- SCOPE TYPE BEG -----\n", onlyCalculateSize); iSize += DumpLine("\tUID %u\n", pScopeType->m_UID, onlyCalculateSize); iSize += DumpLine("\tNumber of Friend Scopes %u\n", pScopeType->m_pFriendScopes.size(), onlyCalculateSize); for (iIndex = 0; iIndex < pScopeType->m_pFriendScopes.size(); ++iIndex) { iSize += DumpLine("\tFriend Scope UID %u\n", pScopeType->m_pFriendScopes[iIndex]->m_UID, onlyCalculateSize); } iSize += DumpString("\tScope Type Name\n", pScopeType->m_sName, onlyCalculateSize); iSize += DumpLine("\tScope Type Type = %u\n", pScopeType->m_Type, onlyCalculateSize); iSize += DumpLine("\tPrototype Scope UID %u\n", pScopeType->m_pPrototypeScope->m_UID, onlyCalculateSize); iSize += DumpLine("----- SCOPE TYPE END -----\n", onlyCalculateSize); return iSize; }
int clsDump::DumpCondition(clsCondition * pCondition, int onlyCalculateSize) { int iSize = 0; unsigned int iIndex; iSize += DumpLine("----- CONDITION BEG -----\n", onlyCalculateSize); iSize += DumpLine("\tUID %u\n", pCondition->m_UID, onlyCalculateSize); iSize += DumpLine("\tNumber of Sensitive Events %u\n", pCondition->m_pSensitiveEvents.size(), onlyCalculateSize); for (iIndex = 0; iIndex < pCondition->m_pSensitiveEvents.size(); ++iIndex) { iSize += DumpLine("\tSensitive Event UID %u\n", pCondition->m_pSensitiveEvents[iIndex]->m_UID, onlyCalculateSize); } iSize += DumpLine("\tCondition Type = %u\n", pCondition->m_Type, onlyCalculateSize); _Assert(pCondition->m_pNexus && "Frontend Error: Each condition should have a nexus."); iSize += DumpLine("\tNexus UID %u\n", pCondition->m_pNexus->m_UID, onlyCalculateSize); iSize += DumpLine("----- CONDITION END -----\n", onlyCalculateSize); return iSize; }
void KMemDump::Dump(unsigned char * start, unsigned offset, int size, int unitsize) { if ( offset==0 ) { HANDLE hHeaps[10]; int no = GetProcessHeaps(10, hHeaps); // walk the heap if it is a heap for (int i=0; i<no; i++) if ( start == hHeaps[i] ) { PROCESS_HEAP_ENTRY entry; entry.lpData = NULL; while ( HeapWalk(start, & entry) ) { wsprintf(m_line, "%x %d+%d bytes %x\r\n", entry.lpData, entry.cbData, entry.cbOverhead, entry.iRegionIndex); * m_stream << m_line; } * m_stream << "\r\n"; break; } } * m_stream << size; * m_stream << " bytes\n"; while (size>0) { DumpLine(start, offset, unitsize); start += 16; size -= 16; * m_stream << m_line; } }
void otDump(otLogLevel aLogLevel, otLogRegion aLogRegion, const char *aId, const void *aBuf, const size_t aLength) { size_t idlen = strlen(aId); const size_t width = 72; char buf[80]; char *cur = buf; for (size_t i = 0; i < (width - idlen) / 2 - 5; i++) { snprintf(cur, sizeof(buf) - static_cast<size_t>(cur - buf), "="); cur += strlen(cur); } snprintf(cur, sizeof(buf) - static_cast<size_t>(cur - buf), "[%s len=%03u]", aId, static_cast<uint16_t>(aLength)); cur += strlen(cur); for (size_t i = 0; i < (width - idlen) / 2 - 4; i++) { snprintf(cur, sizeof(buf) - static_cast<size_t>(cur - buf), "="); cur += strlen(cur); } otLogDump("%s", buf); for (size_t i = 0; i < aLength; i += 16) { DumpLine(aLogLevel, aLogRegion, (uint8_t *)(aBuf) + i, (aLength - i) < 16 ? (aLength - i) : 16); } cur = buf; for (size_t i = 0; i < width; i++) { snprintf(cur, sizeof(buf) - static_cast<size_t>(cur - buf), "-"); cur += strlen(cur); } otLogDump("%s", buf); }
void zreadhb_dist(int iam, FILE *fp, int_t *nrow, int_t *ncol, int_t *nonz, doublecomplex **nzval, int_t **rowind, int_t **colptr) { register int_t i, numer_lines, rhscrd = 0; int_t tmp, colnum, colsize, rownum, rowsize, valnum, valsize; char buf[100], type[4]; #if ( DEBUGlevel>=1 ) CHECK_MALLOC(0, "Enter zreadhb_dist()"); #endif /* Line 1 */ fgets(buf, 100, fp); /* Line 2 */ for (i=0; i<5; i++) { fscanf(fp, "%14c", buf); buf[14] = 0; tmp = atoi(buf); /*sscanf(buf, "%d", &tmp);*/ if (i == 3) numer_lines = tmp; if (i == 4 && tmp) rhscrd = tmp; } DumpLine(fp); /* Line 3 */ fscanf(fp, "%3c", type); fscanf(fp, "%11c", buf); /* pad */ type[3] = 0; #if ( DEBUGlevel>=1 ) if ( !iam ) printf("Matrix type %s\n", type); #endif fscanf(fp, "%14c", buf); *nrow = atoi(buf); fscanf(fp, "%14c", buf); *ncol = atoi(buf); fscanf(fp, "%14c", buf); *nonz = atoi(buf); fscanf(fp, "%14c", buf); tmp = atoi(buf); if (tmp != 0) if ( !iam ) printf("This is not an assembled matrix!\n"); if (*nrow != *ncol) if ( !iam ) printf("Matrix is not square.\n"); DumpLine(fp); /* Allocate storage for the three arrays ( nzval, rowind, colptr ) */ zallocateA_dist(*ncol, *nonz, nzval, rowind, colptr); /* Line 4: format statement */ fscanf(fp, "%16c", buf); ParseIntFormat(buf, &colnum, &colsize); fscanf(fp, "%16c", buf); ParseIntFormat(buf, &rownum, &rowsize); fscanf(fp, "%20c", buf); ParseFloatFormat(buf, &valnum, &valsize); fscanf(fp, "%20c", buf); DumpLine(fp); /* Line 5: right-hand side */ if ( rhscrd ) DumpLine(fp); /* skip RHSFMT */ #if ( DEBUGlevel>=1 ) if ( !iam ) { printf(IFMT " rows, " IFMT " nonzeros\n", *nrow, *nonz); printf("colnum " IFMT ", colsize " IFMT "\n", colnum, colsize); printf("rownum " IFMT ", rowsize " IFMT "\n", rownum, rowsize); printf("valnum " IFMT ", valsize " IFMT "\n", valnum, valsize); } #endif ReadVector(fp, *ncol+1, *colptr, colnum, colsize); #if ( DEBUGlevel>=1 ) if ( !iam ) printf("read colptr[" IFMT "] = " IFMT "\n", *ncol, (*colptr)[*ncol]); #endif ReadVector(fp, *nonz, *rowind, rownum, rowsize); #if ( DEBUGlevel>=1 ) if ( !iam ) printf("read rowind[" IFMT "] = " IFMT "\n", *nonz-1, (*rowind)[*nonz-1]); #endif if ( numer_lines ) { zReadValues(fp, *nonz, *nzval, valnum, valsize); } fclose(fp); #if ( DEBUGlevel>=1 ) CHECK_MALLOC(0, "Exit zreadhb_dist()"); #endif }
std::string mitk::TestDICOMLoading::DumpImageInformation( const Image* image ) { std::stringstream result; if (image == nullptr) return result.str(); SetDefaultLocale(); // basic image data DumpLine( "Pixeltype", ComponentTypeToString(image->GetPixelType().GetComponentType()) ); DumpLine( "BitsPerPixel", image->GetPixelType().GetBpe() ); DumpLine( "Dimension", image->GetDimension() ); result << "Dimensions: "; for (unsigned int dim = 0; dim < image->GetDimension(); ++dim) result << image->GetDimension(dim) << " "; result << "\n"; // geometry data result << "Geometry: \n"; const TimeGeometry* timeGeometry = image->GetTimeGeometry(); BaseGeometry* geometry = timeGeometry->GetGeometryForTimeStep(0); if (geometry) { AffineTransform3D* transform = geometry->GetIndexToWorldTransform(); if (transform) { result << " " << "Matrix: "; const AffineTransform3D::MatrixType& matrix = transform->GetMatrix(); for (unsigned int i = 0; i < 3; ++i) for (unsigned int j = 0; j < 3; ++j) result << matrix[i][j] << " "; result << "\n"; result << " " << "Offset: "; const AffineTransform3D::OutputVectorType& offset = transform->GetOffset(); for (unsigned int i = 0; i < 3; ++i) result << offset[i] << " "; result << "\n"; result << " " << "Center: "; const AffineTransform3D::InputPointType& center = transform->GetCenter(); for (unsigned int i = 0; i < 3; ++i) result << center[i] << " "; result << "\n"; result << " " << "Translation: "; const AffineTransform3D::OutputVectorType& translation = transform->GetTranslation(); for (unsigned int i = 0; i < 3; ++i) result << translation[i] << " "; result << "\n"; result << " " << "Scale: "; const double* scale = transform->GetScale(); for (unsigned int i = 0; i < 3; ++i) result << scale[i] << " "; result << "\n"; result << " " << "Origin: "; const Point3D& origin = geometry->GetOrigin(); for (unsigned int i = 0; i < 3; ++i) result << origin[i] << " "; result << "\n"; result << " " << "Spacing: "; const Vector3D& spacing = geometry->GetSpacing(); for (unsigned int i = 0; i < 3; ++i) result << spacing[i] << " "; result << "\n"; result << " " << "TimeBounds: "; const TimeBounds timeBounds = timeGeometry->GetTimeBounds(); for (unsigned int i = 0; i < 2; ++i) result << timeBounds[i] << " "; result << "\n"; } } ResetUserLocale(); return result.str(); }
void dreadrb_dist(int iam, FILE *fp, int_t *nrow, int_t *ncol, int_t *nonz, double **nzval, int_t **rowind, int_t **colptr) { register int_t i, numer_lines = 0; int_t tmp, colnum, colsize, rownum, rowsize, valnum, valsize; char buf[100], type[4]; int sym; /* Line 1 */ fgets(buf, 100, fp); fputs(buf, stdout); /* Line 2 */ for (i=0; i<4; i++) { fscanf(fp, "%14c", buf); buf[14] = 0; tmp = atoi(buf); /*sscanf(buf, "%d", &tmp);*/ if (i == 3) numer_lines = tmp; } DumpLine(fp); /* Line 3 */ fscanf(fp, "%3c", type); fscanf(fp, "%11c", buf); /* pad */ type[3] = 0; #if (DEBUGlevel >= 1) if ( !iam ) printf("Matrix type %s\n", type); #endif fscanf(fp, "%14c", buf); *nrow = atoi(buf); fscanf(fp, "%14c", buf); *ncol = atoi(buf); fscanf(fp, "%14c", buf); *nonz = atoi(buf); fscanf(fp, "%14c", buf); tmp = atoi(buf); if (tmp != 0) if ( !iam ) printf("This is not an assembled matrix!\n"); if (*nrow != *ncol) if ( !iam ) printf("Matrix is not square.\n"); DumpLine(fp); /* Allocate storage for the three arrays ( nzval, rowind, colptr ) */ dallocateA_dist(*ncol, *nonz, nzval, rowind, colptr); /* Line 4: format statement */ fscanf(fp, "%16c", buf); ParseIntFormat(buf, &colnum, &colsize); fscanf(fp, "%16c", buf); ParseIntFormat(buf, &rownum, &rowsize); fscanf(fp, "%20c", buf); ParseFloatFormat(buf, &valnum, &valsize); DumpLine(fp); #if (DEBUGlevel >= 1) if ( !iam ) { printf(IFMT " rows, " IFMT " nonzeros\n", *nrow, *nonz); printf("colnum " IFMT ", colsize " IFMT "\n", colnum, colsize); printf("rownum " IFMT ", rowsize " IFMT "\n", rownum, rowsize); printf("valnum " IFMT ", valsize " IFMT "\n", valnum, valsize); } #endif ReadVector(fp, *ncol+1, *colptr, colnum, colsize); ReadVector(fp, *nonz, *rowind, rownum, rowsize); if ( numer_lines ) { dReadValues(fp, *nonz, *nzval, valnum, valsize); } sym = (type[1] == 'S' || type[1] == 's'); if ( sym ) { FormFullA(*ncol, nonz, nzval, rowind, colptr); } fclose(fp); }
SMatrix ReadSparse(char *name, char *probName) { FILE *fp; long n, m, i, j; long n_rows, tmp; long numer_lines; long colnum, colsize, rownum, rowsize; char buf[100], type[4]; SMatrix M, F; if (!name || name[0] == 0) { fp = stdin; } else { fp = fopen(name, "r"); } if (!fp) { Error("Error opening file\n"); } fscanf(fp, "%72c", buf); fscanf(fp, "%8c", probName); probName[8] = 0; DumpLine(fp); for (i=0; i<5; i++) { fscanf(fp, "%14c", buf); sscanf(buf, "%ld", &tmp); if (i == 3) numer_lines = tmp; } DumpLine(fp); fscanf(fp, "%3c", type); type[3] = 0; if (!(type[0] != 'C' && type[1] == 'S' && type[2] == 'A')) { fprintf(stderr, "Wrong type: %s\n", type); exit(0); } fscanf(fp, "%11c", buf); /* pad */ fscanf(fp, "%14c", buf); sscanf(buf, "%ld", &n_rows); fscanf(fp, "%14c", buf); sscanf(buf, "%ld", &n); fscanf(fp, "%14c", buf); sscanf(buf, "%ld", &m); fscanf(fp, "%14c", buf); sscanf(buf, "%ld", &tmp); if (tmp != 0) printf("This is not an assembled matrix!\n"); if (n_rows != n) printf("Matrix is not symmetric\n"); DumpLine(fp); fscanf(fp, "%16c", buf); ParseIntFormat(buf, &colnum, &colsize); fscanf(fp, "%16c", buf); ParseIntFormat(buf, &rownum, &rowsize); fscanf(fp, "%20c", buf); fscanf(fp, "%20c", buf); DumpLine(fp); /* format statement */ M = NewMatrix(n, m, 0); ReadVector(fp, n+1, M.col, colnum, colsize); ReadVector(fp, m, M.row, rownum, rowsize); for (i=0; i<numer_lines; i++) /* dump numeric values */ DumpLine(fp); for (i=0; i<n; i++) ISort(M, i); for (i=0; i<=n; i++) M.startrow[i] = M.col[i]; fclose(fp); F = LowerToFull(M); maxm = 0; for (i=0; i<n; i++) if (F.col[i+1]-F.col[i] > maxm) maxm = F.col[i+1]-F.col[i]; if (F.nz) { for (j=0; j<n; j++) for (i=F.col[j]; i<F.col[j+1]; i++) F.nz[i] = Value(F.row[i], j); } FreeMatrix(M); return(F); }
int clsDump::DumpScope(clsScope * pScope, int onlyCalculateSize) { int iSize = 0; unsigned int iIndex; iSize += DumpLine("----- SCOPE BEG -----\n", onlyCalculateSize); iSize += DumpLine("\tUID %u\n", pScope->m_UID, onlyCalculateSize); iSize += DumpLocation(pScope->m_Location, onlyCalculateSize); _Assert(pScope->m_pParentScope && "Frontend Error: All scopes should have a parent."); iSize += DumpLine("\tParent Scope UID %u\n", pScope->m_pParentScope->m_UID, onlyCalculateSize); _Assert(pScope->m_pRootScope && "Frontend Error: All scopes should have a root."); iSize += DumpLine("\tRoot Scope UID %u\n", pScope->m_pRootScope->m_UID, onlyCalculateSize); iSize += DumpLine("\tNumber of Children Scopes %u\n", pScope->m_pChildrenScopes.size(), onlyCalculateSize); for (iIndex = 0; iIndex < pScope->m_pChildrenScopes.size(); ++iIndex) { iSize += DumpLine("\tChild Scope UID %u\n", pScope->m_pChildrenScopes[iIndex]->m_UID, onlyCalculateSize); } iSize += DumpLine("\tNumber of Signals %u\n", pScope->m_pSignals.size(), onlyCalculateSize); for (iIndex = 0; iIndex < pScope->m_pSignals.size(); ++iIndex) { iSize += DumpLine("\tSignal UID %u\n", pScope->m_pSignals[iIndex]->m_UID, onlyCalculateSize); } iSize += DumpLine("\tNumber of Arguments %u\n", pScope->m_pArguments.size(), onlyCalculateSize); for (iIndex = 0; iIndex < pScope->m_pArguments.size(); ++iIndex) { iSize += DumpLine("\tArgument UID %u\n", pScope->m_pArguments[iIndex]->m_UID, onlyCalculateSize); } iSize += DumpLine("\tNumber of Parameters %u\n", pScope->m_pParameters.size(), onlyCalculateSize); for (iIndex = 0; iIndex < pScope->m_pParameters.size(); ++iIndex) { iSize += DumpLine("\tParameter UID %u\n", pScope->m_pParameters[iIndex]->m_UID, onlyCalculateSize); } iSize += DumpLine("\tNumber of Conditions %u\n", pScope->m_pConditions.size(), onlyCalculateSize); for (iIndex = 0; iIndex < pScope->m_pConditions.size(); ++iIndex) { iSize += DumpLine("\tCondition UID %u\n", pScope->m_pConditions[iIndex]->m_UID, onlyCalculateSize); } iSize += DumpLine("\tNumber of Events %u\n", pScope->m_pEvents.size(), onlyCalculateSize); for (iIndex = 0; iIndex < pScope->m_pEvents.size(); ++iIndex) { iSize += DumpLine("\tEvent UID %u\n", pScope->m_pEvents[iIndex]->m_UID, onlyCalculateSize); } if (pScope->m_pBasicBlock) { iSize += DumpLine("\tHas Basicblock %u\n", true, onlyCalculateSize); iSize += DumpLine("\tBasicblock UID %u\n", pScope->m_pBasicBlock->m_UID, onlyCalculateSize); } else { iSize += DumpLine("\tHas No Basicblock %u\n", false, onlyCalculateSize); } iSize += DumpString("\tScope Name\n", pScope->m_sScopeName, onlyCalculateSize); iSize += DumpLine("\tScope Type UID %u\n", pScope->m_pScopeType->m_UID, onlyCalculateSize); iSize += DumpLine("\tScope is Root = %u\n", pScope->m_IsRoot, onlyCalculateSize); iSize += DumpLine("\tScope is Automatic = %u\n", pScope->m_IsAutomatic, onlyCalculateSize); iSize += DumpLine("----- SCOPE END -----\n", onlyCalculateSize); return iSize; }