//--------------------------------------------------- // void TargetNode::WritePDFOptions() { strcpy( gszOptFileName, GetMakeFileName() ); char* pszExt = strrchr( gszOptFileName, '.'); if ( pszExt ) memcpy( pszExt, ".pdf.opt", 9); else strcat( gszOptFileName, ".pdf.opt"); if ( GetSlash() == '\\' ) filePDF = fopen( gszOptFileName, "w+t" ); else filePDF = fopen( gszOptFileName, "w+b" ); if ( !filePDF ) { MessageBox(NULL, "Open file error", "MakePDF", MB_OK); return; } TargetNode *pTarget = GetFirstChildPRJ(); while ( pTarget ) { pTarget->WritePDFFileOptions(); pTarget= pTarget->GetNext(); } fclose( filePDF ); }
//****************************************************************************************** // void TargetNode::WritePDF() { char szFileNamePDF[_MAX_PATH]; strcpy( szFileNamePDF, GetMakeFileName() ); char* pszExt = strrchr( szFileNamePDF, '.'); if ( pszExt ) memcpy( pszExt+1, "pdf", 5); else strcat( szFileNamePDF, ".pdf"); if ( GetSlash() == '\\' ) filePDF = fopen( szFileNamePDF, "w+t" ); else filePDF = fopen( szFileNamePDF, "w+b" ); if ( !filePDF ) { MessageBox(NULL, "Open file error", "MakePDF", MB_OK); return; } char szTimeBuff[40], szDateBuff[40]; char szBuffer[_MAX_PATH+1]; ZeroMemory( (void*)&szBuffer, sizeof(szBuffer) ); memset( szBuffer, '#', 80 ); // _tzset(); _strtime( szTimeBuff ); _strdate( szDateBuff ); fprintf( filePDF, "%s", szBuffer ); fprintf( filePDF, "\n"); fprintf( filePDF, "##\tFile was created by MakePDF %s %s", szDateBuff, szTimeBuff ); fprintf( filePDF, "\n"); fprintf( filePDF, "##\tMakeFile\t: %s", GetMakeFileName() ); fprintf( filePDF, "\n"); fprintf( filePDF, "##\tPlatform\t: %s", GetPlatformTarget() ); fprintf( filePDF, "\n"); fprintf( filePDF, "##\tTargetOS\t: %s", GetTargetOS() ); fprintf( filePDF, "\n"); fprintf( filePDF, "%s", szBuffer ); fprintf( filePDF, "\n"); fprintf( filePDF, "\n"); TargetNode* pTargetPRJ = GetFirstChildPRJ(); while ( pTargetPRJ ) { pTargetPRJ->WritePDFTree(0); pTargetPRJ = pTargetPRJ->GetNext(); } fclose( filePDF ); }
bool GridManager::GetNeighbour(Vector2i p, sep::Axis axis, sep::NeighborType neighbor, sep::CellType&type) { Vector2i slash; slash[axis] = GetSlash(neighbor); p += slash; sep::CellType e_type; try { e_type = grid_->GetInitCell(p)->m_eType; } catch (const char* cStr) { return false; } type = e_type; return true; }
void GridManager::LinkNeighbors(Vector2i p, sep::Axis axis, sep::NeighborType eNeighbor) { Vector2i v_slash; v_slash[axis] = GetSlash(eNeighbor); Vector2i target_pos = p + v_slash; Cell* target = grid_->GetInitCell(target_pos)->m_pCell; Cell* cell = grid_->GetInitCell(p)->m_pCell; switch (eNeighbor) { case sep::PREV: if (cell->m_pPrev[axis] != nullptr) throw("Prev is already not emty"); cell->m_pPrev[axis] = target; break; case sep::NEXT: if (cell->m_pNext[axis] != nullptr) throw("Next is already not emty"); cell->m_pNext[axis] = target; break; } }
//--------------------------------------------------- // void TargetNode::WritePDFTree(int nTabs) { char* pszTabs; int nTabsNew; char szOptFileName[_MAX_PATH+1], szCmdPath[_MAX_PATH+1]; if ( GetType() == TARGET_PROJECT ) { pszTabs = new char [ nTabs +PDF_FILE_INDENT+1]; memset( pszTabs,' ', nTabs ); *(pszTabs+nTabs) = '\0'; fprintf( filePDF, "\n"); if ( GetParentPRJ() == GetMakeFileTarget() ) fprintf( filePDF, "%s%s\t: %s\t<->\t/%s {", pszTabs, GetProjectName(), GetFilePath(), GetProjectName() ); else fprintf( filePDF, "%s%s\t: %s\t<->\t%s {", pszTabs, GetProjectName(), GetFileName(), GetProjectName() ); fprintf( filePDF, "\n"); GetDisRegistryStr("DiscoverDir", szOptFileName, sizeof(szOptFileName), "c:\\"); InternalConvertFileName( szOptFileName, szCmdPath ); InternalConvertFileName( gszOptFileName, szOptFileName ); if ( GetSlash() == '\\' ) { fprintf( filePDF, "%s : (**)/(*).(c*) /%%/.make", pszTabs ); fprintf( filePDF, " => \"PDFOpt %s %s (1)/(2).(3)\" ", szOptFileName, GetProjectName() ); } else { fprintf( filePDF, "%s : /(**)/(*).(c*) /%%/.make", pszTabs ); fprintf( filePDF, " => \"PDFOpt %s %s /(1)/(2).(3)\" ", szOptFileName, GetProjectName() ); } fprintf( filePDF, "\n"); delete [] pszTabs; GetNodeFILE()->WritePDFTree(nTabs+PDF_FILE_INDENT); TargetNode* pTargetPRJ = GetFirstChildPRJ(); while ( pTargetPRJ ) { pTargetPRJ->WritePDFTree( nTabs+PDF_FILE_INDENT ); pTargetPRJ = pTargetPRJ->GetNext(); } pszTabs = new char [ nTabs +PDF_FILE_INDENT+1]; memset( pszTabs,' ', nTabs ); *(pszTabs+nTabs) = '\0'; fprintf( filePDF, "%s}", pszTabs); fprintf( filePDF, "\n"); delete [] pszTabs; } //--------------------------------------------------------- else if ( GetType() == NODE_FILE || GetType() == NODE_FILE_C || GetType() == NODE_FILE_H ) { if ( GetFileName() ) { pszTabs = new char [ nTabs +PDF_FILE_INDENT+1]; memset( pszTabs,' ', nTabs ); *(pszTabs+nTabs) = '\0'; fprintf ( filePDF, "%s%s\n%s{", pszTabs, GetFileName(), pszTabs ); fprintf( filePDF, "\n"); nTabsNew = nTabs + 2; delete [] pszTabs; } else nTabsNew = nTabs; if ( GetType() == NODE_FILE ) { GetNodeH()->WritePDFTree(nTabsNew); GetNodeC()->WritePDFTree(nTabsNew); } else { pszTabs = new char [ nTabs +PDF_FILE_INDENT+1]; memset( pszTabs,' ', nTabs ); *(pszTabs+nTabs) = '\0'; TargetNode* pTarget = GetFirstChildTarget(); while ( pTarget ) { if ( pTarget->GetExclusionFlag() ) { fprintf( filePDF, "%s ^ %s", pszTabs, pTarget->GetFileName()); fprintf( filePDF, "\n"); } pTarget= pTarget->GetNext(); } pTarget = GetFirstChildTarget(); while ( pTarget ) { if ( !pTarget->GetExclusionFlag() ) { fprintf( filePDF, "%s %s", pszTabs, pTarget->GetFileName()); fprintf( filePDF, "\n"); } pTarget= pTarget->GetNext(); } } if ( GetFileName() ) { pszTabs = new char [ nTabs +PDF_FILE_INDENT+1]; memset( pszTabs,' ', nTabs ); *(pszTabs+nTabs) = '\0'; fprintf ( filePDF, "%s}\n", pszTabs ); delete [] pszTabs; } } }