void compile_only() { const int N = 3; concurrency::index<N> idx1(10, 11, 12); // Create a new index using copy contructor concurrency::index<N+1> idx2(idx1); }
/*---------------- Test on Host ------------------ */ bool CopyConstructWithIndexOnHost() { Log()<< "Testing copy construct index with another index on host" << std::endl; index<RANK> idx1(0, 1, 2); index<RANK> idx2(idx1); // copy construct return IsIndexSetToSequence<RANK>(idx2); }
void LOCA::MultiContinuation::ConstrainedGroup::fillB( NOX::Abstract::MultiVector& B) const { std::string callingFunction = "LOCA::MultiContinuation::ConstrainedGroup::fillB"; bool isZeroB = constraintsPtr->isDXZero(); Teuchos::RCP<const NOX::Abstract::MultiVector> my_B; if (!isZeroB) { Teuchos::RCP<const LOCA::MultiContinuation::ConstraintInterfaceMVDX> constraints_mvdx = Teuchos::rcp_dynamic_cast<const LOCA::MultiContinuation::ConstraintInterfaceMVDX>(constraintsPtr); if (constraints_mvdx == Teuchos::null) globalData->locaErrorCheck->throwError( callingFunction, std::string("Constraints object must be of type") + std::string("ConstraintInterfaceMVDX")); my_B = Teuchos::rcp(constraints_mvdx->getDX(),false); } // If the underlying system isn't bordered, we're done if (!isBordered) { if (isZeroB) B.init(0.0); else B = *my_B; return; } // Create views for underlying group int w = bordered_grp->getBorderedWidth(); std::vector<int> idx1(w); for (int i=0; i<w; i++) idx1[i] = i; Teuchos::RCP<NOX::Abstract::MultiVector> underlyingB = B.subView(idx1); // Combine blocks in underlying group bordered_grp->fillB(*underlyingB); // Create views for my blocks std::vector<int> idx2(numParams); for (int i=0; i<numParams; i++) idx2[i] = w+i; Teuchos::RCP<NOX::Abstract::MultiVector> my_B_x = B.subView(idx2); // Extract solution component from my_B and store in B if (isZeroB) my_B_x->init(0.0); else bordered_grp->extractSolutionComponent(*my_B, *my_B_x); }
/*---------------- Test on Host ------------------ */ runall_result TestOnHost() { runall_result result; Log() << "Testing constructor that takes individual co-ordinates on host" << std::endl; index<1> idx1(0); index<2> idx2(0, 1); index<3> idx3(0, 1, 2); result &= REPORT_RESULT(IsIndexSetToSequence<1>(idx1)); result &= REPORT_RESULT(IsIndexSetToSequence<2>(idx2)); result &= REPORT_RESULT(IsIndexSetToSequence<3>(idx3)); return result; }
void Polygon::splitPolygonAtPoint (const std::list<GeoLib::Polygon*>::iterator& polygon_it) { std::size_t n((*polygon_it)->getNumberOfPoints() - 1), idx0(0), idx1(0); std::vector<std::size_t> id_vec(n); std::vector<std::size_t> perm(n); for (std::size_t k(0); k < n; k++) { id_vec[k] = (*polygon_it)->getPointID (k); perm[k] = k; } BaseLib::quicksort (id_vec, 0, n, perm); for (std::size_t k(0); k < n - 1; k++) if (id_vec[k] == id_vec[k + 1]) { idx0 = perm[k]; idx1 = perm[k + 1]; if (idx0 > idx1) std::swap (idx0, idx1); // create two closed polylines GeoLib::Polyline polyline0{*(*polygon_it)}; for (std::size_t j(0); j <= idx0; j++) polyline0.addPoint((*polygon_it)->getPointID(j)); for (std::size_t j(idx1 + 1); j < (*polygon_it)->getNumberOfPoints(); j++) polyline0.addPoint((*polygon_it)->getPointID(j)); GeoLib::Polyline polyline1{*(*polygon_it)}; for (std::size_t j(idx0); j <= idx1; j++) polyline1.addPoint((*polygon_it)->getPointID(j)); // remove the polygon except the first if (*polygon_it != this) delete *polygon_it; // erase polygon_it and add two new polygons auto polygon1_it = _simple_polygon_list.insert( _simple_polygon_list.erase(polygon_it), new Polygon(polyline1)); auto polygon0_it = _simple_polygon_list.insert( polygon1_it, new Polygon(polyline0)); splitPolygonAtPoint(polygon0_it); splitPolygonAtPoint(polygon1_it); return; } }
runall_result TestOnHost() { runall_result result; Log() << "Testing Index-assignment operator on host" << std::endl; index<RANK> idx(START, START + 1, START + 2); index<RANK> idx1(idx); // copy construct index<RANK> idx2; idx2 = idx; // assign result &= REPORT_RESULT(IsIndexSetToSequence<RANK>(idx1, START)); result &= REPORT_RESULT(IsIndexSetToSequence<RANK>(idx2, START)); return result; }
void Polygon::splitPolygonAtIntersection( const std::list<Polygon*>::const_iterator& polygon_it) #endif { GeoLib::Polyline::SegmentIterator seg_it0((*polygon_it)->begin()); GeoLib::Polyline::SegmentIterator seg_it1((*polygon_it)->begin()); GeoLib::Point intersection_pnt; if (!GeoLib::lineSegmentsIntersect(*polygon_it, seg_it0, seg_it1, intersection_pnt)) return; std::size_t idx0(seg_it0.getSegmentNumber()); std::size_t idx1(seg_it1.getSegmentNumber()); // adding intersection point to pnt_vec std::size_t const intersection_pnt_id (_ply_pnts.size()); const_cast<std::vector<Point*>&>(_ply_pnts) .push_back(new GeoLib::Point(intersection_pnt)); // split Polygon if (idx0 > idx1) std::swap (idx0, idx1); GeoLib::Polyline polyline0{(*polygon_it)->getPointsVec()}; for (std::size_t k(0); k <= idx0; k++) polyline0.addPoint((*polygon_it)->getPointID(k)); polyline0.addPoint(intersection_pnt_id); for (std::size_t k(idx1 + 1); k < (*polygon_it)->getNumberOfPoints(); k++) polyline0.addPoint((*polygon_it)->getPointID(k)); GeoLib::Polyline polyline1{(*polygon_it)->getPointsVec()}; polyline1.addPoint(intersection_pnt_id); for (std::size_t k(idx0 + 1); k <= idx1; k++) polyline1.addPoint((*polygon_it)->getPointID(k)); polyline1.addPoint(intersection_pnt_id); // remove the polygon except the first if (*polygon_it != this) delete *polygon_it; // erase polygon_it and add two new polylines auto polygon1_it = _simple_polygon_list.insert( _simple_polygon_list.erase(polygon_it), new GeoLib::Polygon(polyline1)); auto polygon0_it = _simple_polygon_list.insert( polygon1_it, new GeoLib::Polygon(polyline0)); splitPolygonAtIntersection(polygon0_it); splitPolygonAtIntersection(polygon1_it); }
Lexer::Token I1::parseAttributes( Lexer* lexer ) { Lexer::Token tok( document->getNextToken() ); while( tok != Lexer::TAGEND ) { if( tok == Lexer::ATTRIBUTE ) { std::wstring key; std::wstring value; splitAttribute( lexer->text(), key, value ); if( key == L"id" ) { id = value; try { document->addIndexId( id, this ); } catch( Class3Error& e ) { document->printError( e.code ); } } else if( key == L"roots" ) { std::wstring::size_type idx1( 0 ); std::wstring::size_type idx2( value.find( L' ' ) ); while( idx1 != std::wstring::npos ) { //split value on ' ' synRoots.push_back( value.substr( idx1, idx2 - idx1 ) ); idx1 = idx2 == std::wstring::npos ? std::wstring::npos : idx2 + 1; idx2 = value.find( L' ', idx1 ); } } else if( key == L"sortkey" ) primary->setSortKey( value ); else document->printError( ERR1_ATTRNOTDEF ); } else if( tok == Lexer::FLAG ) { if( lexer->text() == L"global" ) primary->setGlobal(); else document->printError( ERR1_ATTRNOTDEF ); } else if( tok == Lexer::ERROR_TAG ) throw FatalError( ERR_SYNTAX ); else if( tok == Lexer::END ) throw FatalError( ERR_EOF ); else document->printError( ERR1_TAGSYNTAX ); tok = document->getNextToken(); } return document->getNextToken(); //consume TAGEND }
std::string canonicalPath( char* arg ) { std::auto_ptr< char > cwd( ::getcwd( 0, 0 ) ); std::string fullpath( cwd.get() ); std::string inFile( arg ); #if defined( __UNIX__ ) || defined( __APPLE__ ) const char* srchstr = "../"; char sep = '/'; #else const char* srchstr = "..\\"; char sep = '\\'; #endif std::string::size_type idx1( inFile.find( srchstr ) ); if( idx1 == 0 ) { while( idx1 == 0 ) { //must be at start of line std::string::size_type idx2( fullpath.rfind( sep ) ); if( idx2 != std::string::npos ) { fullpath.erase( idx2 ); inFile.erase( idx1, 3 ); } else if( !fullpath.empty() ) { #if defined( __UNIX__ ) || defined( __APPLE__ ) idx2 = 0; #else idx2 = fullpath.find( ':' ); //don't kill drive if( idx2 != std::string::npos ) ++idx2; #endif fullpath.erase( idx2 ); inFile.erase( 0, 3 ); break; } idx1 = inFile.find( srchstr ); } fullpath += sep; fullpath += inFile; } else fullpath = inFile; #if !defined( __UNIX__ ) && !defined( __APPLE__ ) if( fullpath.size() > PATH_MAX ) throw FatalError( ERR_PATH_MAX ); #endif return fullpath; }
void LOCA::Homotopy::DeflatedGroup:: fillB(NOX::Abstract::MultiVector& B) const { string callingFunction = "LOCA::Homotopy::DeflatedGroup::fillB"; Teuchos::RCP<const NOX::Abstract::MultiVector> my_B = totalDistMultiVec; // If the underlying system isn't bordered, we're done if (!isBordered) { B = *my_B; return; } // Create views for underlying group int w = bordered_grp->getBorderedWidth(); std::vector<int> idx1(w); for (int i=0; i<w; i++) idx1[i] = i; Teuchos::RCP<NOX::Abstract::MultiVector> underlyingB = B.subView(idx1); // Combine blocks in underlying group bordered_grp->fillB(*underlyingB); // Create views for my blocks std::vector<int> idx2(2); for (int i=0; i<1; i++) idx2[i] = w+i; Teuchos::RCP<NOX::Abstract::MultiVector> my_B_x = B.subView(idx2); // Extract solution component from my_B and store in B bordered_grp->extractSolutionComponent(*my_B, *my_B_x); }
void LOCA::Homotopy::DeflatedGroup:: fillA(NOX::Abstract::MultiVector& A) const { string callingFunction = "LOCA::Homotopy::DeflatedGroup::fillA"; Teuchos::RCP<const NOX::Abstract::MultiVector> my_A = underlyingF; // If the underlying system isn't bordered, we're done if (!isBordered) { A = *my_A; return; } // Create views for underlying group int w = bordered_grp->getBorderedWidth(); std::vector<int> idx1(w); for (int i=0; i<w; i++) idx1[i] = i; Teuchos::RCP<NOX::Abstract::MultiVector> underlyingA = A.subView(idx1); // Fill A block in underlying group bordered_grp->fillA(*underlyingA); // Create views for my blocks std::vector<int> idx2(1); for (int i=0; i<1; i++) idx2[i] = w+i; Teuchos::RCP<NOX::Abstract::MultiVector> my_A_x = A.subView(idx2); // Extract solution component from my_A and store in A bordered_grp->extractSolutionComponent(*my_A, *my_A_x); }
void LOCA::BorderedSolver::Nested::setMatrixBlocks( const Teuchos::RCP<const LOCA::BorderedSolver::AbstractOperator>& oper, const Teuchos::RCP<const NOX::Abstract::MultiVector>& blockA, const Teuchos::RCP<const LOCA::MultiContinuation::ConstraintInterface>& blockB, const Teuchos::RCP<const NOX::Abstract::MultiVector::DenseMatrix>& blockC) { string callingFunction = "LOCA::BorderedSolver::Nested::setMatrixBlocks()"; // Cast oper to a bordered operator Teuchos::RCP<const LOCA::BorderedSolver::JacobianOperator> op = Teuchos::rcp_dynamic_cast<const LOCA::BorderedSolver::JacobianOperator>(oper); if (op == Teuchos::null) globalData->locaErrorCheck->throwError( callingFunction, string("Operaror must be of type LOCA::BorderedSolver::JacobianOperator") + string(" in order to use nested bordered solver strategy.")); // Get bordered group grp = Teuchos::rcp_dynamic_cast<const LOCA::BorderedSystem::AbstractGroup>(op->getGroup()); if (grp == Teuchos::null) globalData->locaErrorCheck->throwError( callingFunction, string("Group must be of type LOCA::BorderedSystem::AbstractGroup") + string(" in order to use nested bordered solver strategy.")); Teuchos::RCP<const LOCA::MultiContinuation::ConstraintInterfaceMVDX> con_mvdx = Teuchos::rcp_dynamic_cast<const LOCA::MultiContinuation::ConstraintInterfaceMVDX>(blockB); if (con_mvdx == Teuchos::null) globalData->locaErrorCheck->throwError( callingFunction, "Constraints object must be of type ConstraintInterfaceMVDX"); bool isZeroA = (blockA.get() == NULL); bool isZeroB = con_mvdx->isDXZero(); bool isZeroC = (blockC.get() == NULL); Teuchos::RCP<const NOX::Abstract::MultiVector> blockB_dx; if (!isZeroB) blockB_dx = Teuchos::rcp(con_mvdx->getDX(), false); // ensure blocks B and C are not both zero if (isZeroB && isZeroC) globalData->locaErrorCheck->throwError( callingFunction, "Blocks B and C cannot both be zero"); // ensure blocks A and C are not both zero if (isZeroA && isZeroC) globalData->locaErrorCheck->throwError( callingFunction, "Blocks A and C cannot both be zero"); // Get unbordered group unbordered_grp = grp->getUnborderedGroup(); // get number of outer constraints if (isZeroB) numConstraints = blockC->numRows(); else numConstraints = blockB_dx->numVectors(); // Get total bordered width underlyingWidth = grp->getBorderedWidth(); myWidth = underlyingWidth + numConstraints; // combine blocks bool isCombinedAZero = grp->isCombinedAZero(); bool isCombinedBZero = grp->isCombinedBZero(); bool isCombinedCZero = grp->isCombinedCZero(); Teuchos::RCP<NOX::Abstract::MultiVector> A; Teuchos::RCP<NOX::Abstract::MultiVector> B; Teuchos::RCP<NOX::Abstract::MultiVector::DenseMatrix> C; if (!isCombinedAZero || !isZeroA) { A = unbordered_grp->getX().createMultiVector(myWidth); A->init(0.0); } if (!isCombinedBZero || !isZeroB) { B = unbordered_grp->getX().createMultiVector(myWidth); B->init(0.0); } if (!isCombinedCZero || !isZeroC) { C = Teuchos::rcp(new NOX::Abstract::MultiVector::DenseMatrix(myWidth, myWidth)); C->putScalar(0.0); } std::vector<int> idx1(underlyingWidth); for (int i=0; i<underlyingWidth; i++) idx1[i] = i; if (!isCombinedAZero) { Teuchos::RCP<NOX::Abstract::MultiVector> underlyingA = A->subView(idx1); grp->fillA(*underlyingA); } if (!isCombinedBZero) { Teuchos::RCP<NOX::Abstract::MultiVector> underlyingB = B->subView(idx1); grp->fillB(*underlyingB); } if (!isCombinedCZero) { NOX::Abstract::MultiVector::DenseMatrix underlyingC(Teuchos::View, *C, underlyingWidth, underlyingWidth, 0, 0); grp->fillC(underlyingC); } std::vector<int> idx2(numConstraints); for (int i=0; i<numConstraints; i++) idx2[i] = underlyingWidth+i; if (!isZeroA) { Teuchos::RCP<NOX::Abstract::MultiVector> my_A_x = A->subView(idx2); NOX::Abstract::MultiVector::DenseMatrix my_A_p(Teuchos::View, *C, underlyingWidth, numConstraints, 0, underlyingWidth); grp->extractSolutionComponent(*blockA, *my_A_x); grp->extractParameterComponent(false, *blockA, my_A_p); } if (!isZeroB) { Teuchos::RCP<NOX::Abstract::MultiVector> my_B_x = B->subView(idx2); NOX::Abstract::MultiVector::DenseMatrix my_B_p(Teuchos::View, *C, numConstraints, underlyingWidth, underlyingWidth, 0); grp->extractSolutionComponent(*blockB_dx, *my_B_x); grp->extractParameterComponent(true, *blockB_dx, my_B_p); } if (!isZeroC) { NOX::Abstract::MultiVector::DenseMatrix my_CC(Teuchos::View, *C, numConstraints, numConstraints, underlyingWidth, underlyingWidth); my_CC.assign(*blockC); } // Create unbordered operator Teuchos::RCP<LOCA::BorderedSolver::AbstractOperator> unbordered_op = Teuchos::rcp(new LOCA::BorderedSolver::JacobianOperator(unbordered_grp)); // set blocks in solver solver->setMatrixBlocksMultiVecConstraint(unbordered_op, A, B, C); }
/** * wxTreeCtrlのインスタンスを受け取って共通の設定を行う * * @param wxTreeCtrl* treeCtrl 設定対象のツリー * @param const wxWindowID id 設定対象のGUIの部位を表すID */ void JaneCloneUiUtil::SetTreeCtrlCommonSetting(wxTreeCtrl* treeCtrl, const wxWindowID id) { // プロパティファイルにフォント設定/背景色があれば使用する wxString widgetsName = wxT("ID_TreeFontButton"); wxString widgetsInfo = wxEmptyString; JaneCloneUtil::GetJaneCloneProperties(widgetsName, &widgetsInfo); if (widgetsInfo != wxEmptyString) { wxFont font; bool ret = font.SetNativeFontInfoUserDesc(widgetsInfo); if(ret) treeCtrl->SetFont(font); } widgetsName = wxT("ID_BoardListBGColorButton"); widgetsInfo.Clear(); JaneCloneUtil::GetJaneCloneProperties(widgetsName, &widgetsInfo); if (widgetsInfo != wxEmptyString) { wxColour bgColor; bool ret = bgColor.Set(widgetsInfo); if(ret) treeCtrl->SetBackgroundColour(bgColor); } wxTreeItemData treeData; wxTreeItemId m_rootId; // イメージリストにアイコンを登録する #ifndef __WXMAC__ wxImageList* treeImage = new wxImageList(16, 16); wxBitmap idx1(wxT("rc/folder.png"), wxBITMAP_TYPE_PNG); treeImage->Add(idx1); wxBitmap idx2(wxT("rc/text-html.png"), wxBITMAP_TYPE_PNG); treeImage->Add(idx2); #else // Macの場合画像ファイル読み込みの場所が異なる wxImageList* treeImage = new wxImageList(16, 16); wxBitmap idx1(wxT("JaneClone.app/Contents/MacOS/rc/folder.png"), wxBITMAP_TYPE_PNG); treeImage->Add(idx1); wxBitmap idx2(wxT("JaneClone.app/Contents/MacOS/rc/text-html.png") , wxBITMAP_TYPE_PNG); treeImage->Add(idx2); #endif treeCtrl->AssignImageList(treeImage); // ツリー部分へのカーソル合わせが起きた場合のイベント通知 treeCtrl->Connect(id, wxEVT_ENTER_WINDOW, wxMouseEventHandler(JaneClone::OnEnterWindow), NULL, wxWindow::FindWindowById(ID_WxJaneClone)); switch (id) { case ID_BoardTreectrl: { treeCtrl->SetLabel(BOARD_TREE); wxTreeItemId rootTemp = treeCtrl->AddRoot(wxT("2ch板一覧")); treeCtrl->SetItemImage(rootTemp, 0, wxTreeItemIcon_Normal); } break; case ID_FavsTreectrl: { treeCtrl->SetLabel(FAVS_TREE); wxTreeItemId rootTemp = treeCtrl->AddRoot(wxT("お気に入り一覧")); treeCtrl->SetItemImage(rootTemp, 0, wxTreeItemIcon_Normal); } break; case ID_NowReadingTreectrl: { treeCtrl->SetLabel(NOW_READ_TREE); wxTreeItemId rootTemp = treeCtrl->AddRoot(wxT("閲覧中一覧")); treeCtrl->SetItemImage(rootTemp, 0, wxTreeItemIcon_Normal); } break; } };
/***************************************************************************** * First character of command id should be second char of line * Lexer returns a full line of data, needs to be parsed if .ce * In version 1.0, valid commands are: * .* (comment) followed by text to '\n' * .br (new line), nothing else allowed on line * .im (include file) 'filename' * .nameit (define text macro) symbol=[a-zA-Z0-9]+ (10 max) text='text string' * text may contain entity references, nameit references and tags * .ce (center) no tags, but text and both entity types * Version 2.0 only supports .*, .br, .im */ Lexer::Token Document::processCommand( Lexer* lexer, Tag* parent ) { if( lexer->cmdId() == Lexer::COMMENT ) ;//do nothing else if( lexer->cmdId() == Lexer::BREAK ) parent->appendChild( new BrCmd( this, parent, dataName(), dataLine(), dataCol() ) ); else if( lexer->cmdId() == Lexer::CENTER ) { CeCmd* cecmd( new CeCmd( this, parent, dataName(), dataLine(), dataCol() ) ); parent->appendChild( cecmd ); return cecmd->parse( lexer ); } else if( lexer->cmdId() == Lexer::IMBED ) { std::string env( Environment.value( "IPFCIMBED" ) ); std::vector< std::wstring > paths; std::wstring cwd; //empty string for current directory paths.push_back( cwd ); #ifdef __UNIX__ std::string separators( ":;" ); char slash( '/' ); #else std::string separators( ";" ); char slash( '\\' ); #endif std::string::size_type idx1( 0 ); std::string::size_type idx2( env.find_first_of( separators, idx1 ) ); std::wstring fbuffer; mbtowstring( env.substr( idx1, idx2 - idx1 ), fbuffer ); paths.push_back( fbuffer ); while( idx2 != std::string::npos ) { idx1 = idx2 + 1; idx2 = env.find_first_of( separators, idx1 ); fbuffer.clear(); mbtowstring( env.substr( idx1, idx2 - idx1 ), fbuffer ); paths.push_back( fbuffer ); } for( size_t count = 0; count < paths.size(); ++count ) { std::wstring* fname( new std::wstring( paths[ count ] ) ); if( !fname->empty() ) *fname += slash; *fname += lexer->text(); #ifndef __UNIX__ if( fname->size() > PATH_MAX ) { throw FatalError( ERR_PATH_MAX ); } #endif try { IpfFile* ipff( new IpfFile( fname ) ); fname = addFileName( fname ); pushInput( ipff ); break; } catch( FatalError& e ) { delete fname; if( count == paths.size() - 1 ) throw e; } catch( FatalIOError& e ) { delete fname; if( count == paths.size() - 1 ) throw e; } } } else if( lexer->cmdId() == Lexer::NAMEIT ) { std::wstring::size_type idx1( lexer->text().find( L"symbol=" ) ); std::wstring::size_type idx2( lexer->text().find( L' ', idx1 ) ); std::wstring sym( lexer->text().substr( idx1 + 7, idx2 - idx1 - 7 ) ); killQuotes( sym ); sym.insert( sym.begin(), L'&' ); sym += L'.'; std::wstring::size_type idx3( lexer->text().find( L"text=" ) ); //check for single quotes std::wstring::size_type idx4( lexer->text()[ idx3 + 5 ] == L'\'' ? \ lexer->text().find( L'\'', idx3 + 6 ) : \ lexer->text().find( L' ', idx3 + 5 ) ); std::wstring txt( lexer->text().substr( idx3 + 5, idx4 - idx3 - 5 ) ); killQuotes( txt ); if( !nls->isEntity( sym ) && nameIts.find( sym ) == nameIts.end() ) //add it to the list nameIts.insert( std::map< std::wstring, std::wstring >::value_type( sym, txt ) ); else printError( ERR3_DUPSYMBOL ); } else printError( ERR1_CMDNOTDEF ); return getNextToken(); }
void Document::makeBitmaps() { if( !bitmapNames.empty() ) { //could use tmpfile... tmpName = Environment.value( "TMP" ); tmpName += std::tmpnam( NULL ); std::FILE* tmp( std::fopen( tmpName.c_str(), "wb" ) ); if( !tmp ) throw FatalIOError( ERR_OPEN, L"(temporary file for bitmaps)" ); //get IPFCARTWORK from env std::string env( Environment.value( "IPFCARTWORK" ) ); std::vector< std::string > paths; std::string cwd; //empty string for current directory paths.push_back( cwd ); #ifdef __UNIX__ std::string separators( ":;" ); char slash( '/' ); #else std::string separators( ";" ); char slash( '\\' ); #endif std::string::size_type idx1( 0 ); std::string::size_type idx2( env.find_first_of( separators, idx1 ) ); paths.push_back( env.substr( idx1, idx2 - idx1 ) ); while( idx2 != std::string::npos ) { idx1 = idx2 + 1; idx2 = env.find_first_of( separators, idx1 ); paths.push_back( env.substr( idx1, idx2 - idx1 ) ); } try { for( BitmapNameIter itr = bitmapNames.begin(); itr != bitmapNames.end(); ++itr ) { std::string fname; wtombstring( itr->first, fname ); for( size_t count = 0; count < paths.size(); ++count ) { std::string fullname( paths[ count ] ); if( !fullname.empty() ) fullname += slash; fullname += fname; #ifndef __UNIX__ if( fullname.size() > PATH_MAX ) { throw FatalError( ERR_PATH_MAX ); } #endif try { #ifdef CHECKCOMP std::printf( "Processing bitmap %s\n", fullname.c_str() ); #endif Bitmap bm( fullname ); itr->second = bm.write( tmp ); break; } catch( FatalError& e ) { if( count == paths.size() - 1 ) throw FatalIOError( e.code, itr->first ); } catch( Class1Error& e ) { printError( e.code, itr->first ); } } } } catch( FatalError& e ) { std::fclose( tmp ); std::remove( tmpName.c_str() ); throw e; } catch( FatalIOError& e ) { std::fclose( tmp ); std::remove( tmpName.c_str() ); throw e; } std::fclose( tmp ); } }