utils::Path TestSuite::getParityExecutable(std::string const& x) { #ifdef _WIN32 char buffer[1024]; GetModuleFileName(GetModuleHandle(0), buffer, 1024); utils::Path pth(buffer); #else // // argv[0] needs to be relative or absolute. // don't start from PATH. // utils::Path pth(arguments_[0]); #endif pth = pth.base(); pth.append(x + ".exe"); if(!pth.exists()) { pth = pth.base(); pth.append(x); // // TODO: search in PATH. // if(!pth.exists()) throw utils::Exception("cannot find %s (for non-win32 don't start from PATH)!", x.c_str()); } return pth; }
CookiePath *CookiePath::GetNextPrefix() { OpStringC8 pth( PathPart()); if(pth.IsEmpty()) return NULL; CookiePath *cp = Pred(); int len1 = pth.Length(); int clen; int test = 1; while(cp && test!=0) { clen = cp->PathPart().Length(); if(clen < len1 && UriUnescape::isstrprefix(cp->PathPart().CStr(), pth.CStr(), UriUnescape::All)) test = 0; else test = UriUnescape::strcmp(cp->PathPart().CStr(), pth.CStr(), UriUnescape::Safe); if (test != 0) cp = cp->Pred(); } return (test == 0 ? cp : NULL); }
void drawingTools::add_shape(QStringList *toadd) { int i=1,point_count=toadd->size(); QGraphicsPathItem *Qpath=new QGraphicsPathItem(); QLocale cl(QLocale::C); QStringList list1 = toadd->at(0).split(":", QString::SkipEmptyParts); QPainterPath pth(QPointF(cl.toDouble( list1.at(0).toUtf8()),cl.toDouble( list1.at(1).toUtf8()))); QStringList list2 = toadd->at(i+1).split(":", QString::SkipEmptyParts); for (i;i < point_count; ++i) { list1 = toadd->at(i).split(":", QString::SkipEmptyParts); //!\//pseudo worked: added multiple ligne with a very rounded value :p // pth.lineTo(cl.toDouble( list1.at(0)),cl.toDouble( list1.at(1))); pth.lineTo(list1.at(0).toFloat(),list1.at(1).toFloat()); } //this one!!! QPen pen(Qt::blue, 1, Qt::SolidLine, Qt::FlatCap, Qt::BevelJoin); Qpath->setPen(pen); Qpath->setPath(pth); emit item_ready(Qpath); }
void trellis::stochastic_traceback(multiTraceback& paths, size_t reps){ for(size_t i=0;i<reps;i++){ traceback_path pth(hmm); stochastic_table->traceback(pth); paths.assign(pth); } return; }
void drawingTools::action_on(QGraphicsItem *toadd) { QPainterPath pth(toadd->shape()); pth.moveTo (0,0); QGraphicsPathItem *Qpath=new QGraphicsPathItem(); QPen pen(Qt::red, 10, Qt::SolidLine, Qt::FlatCap, Qt::BevelJoin); Qpath->setPen(pen); Qpath->setPath(pth); emit item_ready(Qpath); }
static bool addFile(const char* option, const char* OPT_UNUSED(argument), bool& OPT_UNUSED(used)) { utils::Path pth(option); pth.toNative(); if(pth.exists()) gFilesToProcess.push_back(pth); else { utils::Log::verbose("cannot find file or unknown option: %s (rejecting)\n", pth.get().c_str()); return false; } return true; }
void Bchart:: makepUgT(ECString path) { int i; int nm = Term::lastTagInt()+1; ECString pth(path); for(int f = 0 ; f < 20 ; f++) { ECString pUString(pth); pUString += "pUgT.txt"; ifstream pUstream(pUString.c_str()); if(!pUstream) { cerr << "Could not find " << pUString << endl; assert(pUstream); } for( i = 0 ; i < nm ; i++ ) { int t; pUstream >> t; float p; if(f == 0) { pUstream >> p; pHugt(t) = p; //cerr << "set pHugt " << t << " = " << p << endl; pUstream >> p; pHcapgt(t) = p; pUstream >> p; pHhypgt(t) = p; } else { pUstream >> p; pHugt(t) += p; //cerr << "set pHugt " << t << " = " << p << endl; pUstream >> p; pHcapgt(t) += p; pUstream >> p; pHhypgt(t) += p; } }
void draw_scene::draw_ziguigui(bool nada) { QGraphicsPathItem *Qpath=new QGraphicsPathItem(); QPen pen(Qt::blue, 5, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin); QPainterPath pth(QPointF(1.1,1.1)); //pth.setElementPositionAt(0,5,-4); //pth.setElementPositionAt(1,2,5); pth.lineTo(2,5); pth.lineTo(2,6); pth.lineTo(5,1); pth.lineTo(-3,-2); pth.lineTo(2,5); pth.lineTo(5,2); pth.lineTo(-9,7); pth.lineTo(-3,4); Qpath->setPath(pth); // this->sceneConteneur->addItem(Qpath); emit item_ready(Qpath); // this->autoscale(); }
bool setOutputFile(const char* option, const char* argument, bool& used) { utils::Context& ctx = utils::Context::getContext(); const char* arg = 0; if (option[0] && (option[1] == 'F' || _strnicmp(&option[1], "OUT:", 4) == 0)) { arg = option + 1; // // Handle Microsoft output options // if(arg[1] == 'e' || arg[1] == 'o') { arg += 2; } else if(strlen(arg) > 3 && arg[3] == ':') { arg += 4; } else { // not handled here return false; } } else if (strncmp(option, "-o", 2) == 0) { arg = option + 2; } else if (strncmp(option, "--output", 8) == 0) { arg = option + 8; if (*arg == '=' || *arg == ':') { ++arg; } } if(!arg || !*arg){ used = true; arg = argument; } utils::Path pth(arg); utils::Statistics::instance().addInformation("file-output", pth.get()); ctx.setOutputFile(pth); return true; }
// // CONFIX:EXENAME('parity.statistics') // int main(int argc, char** argv) { for(int i = 1; i < argc; ++i) { if(std::string(argv[i]) == "--verbose") { parity::utils::Log::setLevel(parity::utils::Log::Verbose); continue; } if(std::string(argv[i]) == "--short") { } parity::utils::Path pth(argv[i]); pth.toNative(); if(!pth.exists()) { parity::utils::Log::error("cannot find statistics file: %s\n", pth.get().c_str()); exit(1); } // // set-up mappings // parity::statistics::StatisticHandlerMapping timing_mapping = { "Timing", parity::statistics::HandleTiming }; parity::statistics::StatisticHandlerMapping depend_mapping = { "dependencies", parity::statistics::HandleDependency }; parity::statistics::available_mappings.push_back(timing_mapping); parity::statistics::available_mappings.push_back(depend_mapping); parity::statistics::ProcessFile(pth); for(parity::statistics::StatisticPrinterVector::iterator it = parity::statistics::available_stats.begin(); it != parity::statistics::available_stats.end(); ++it) { it->second(); } } }
bool setOutputFile(const char* option, const char* argument, bool& used) { utils::Context& ctx = utils::Context::getContext(); const char* arg = 0; if((arg = ::strchr(option, 'F')) || (arg = ::strstr(option, "OUT:")) || (arg = ::strstr(option, "out:"))) { // // Handle Microsoft output options // if(arg[1] == 'e' || arg[1] == 'o') { arg += 2; } else if(strlen(arg) > 3 && arg[3] == ':') { arg += 4; } else { // not handled here return false; } } else { arg = ::strchr(option, 'o'); ++arg; } if(!arg || !*arg){ used = true; arg = argument; } utils::Path pth(arg); utils::Statistics::instance().addInformation("file-output", pth.get()); ctx.setOutputFile(pth); return true; }
GlobalSemaphore::GlobalSemaphore( unsigned initial, const std::wstring &name, enum Cleanup cleanup) : openExclusive(false), givenName(name) { std::wcout << "at top of global semaphore constructror" << std::endl; boost::filesystem::path pth("/"); pth /= StringConversion::toUTF8(name); std::wcout << "after pth: " << name << std::endl; TRACE_SETUP(L"utils"); TRACE(TraceData::info, StringConversion::toUTF16(pth.native_file_string())); sem_t *handle = 0; switch(cleanup) { case GlobalSemaphore::always: openExclusive = true; handle = sem_open(pth.native_file_string().c_str(), O_CREAT | O_EXCL, 0666, initial); if (handle == SEM_FAILED) { sem_unlink(pth.native_file_string().c_str()); handle = sem_open(pth.native_file_string().c_str(), O_CREAT | O_EXCL, 0666, initial); } break; case GlobalSemaphore::never: openExclusive = false; handle = sem_open(pth.native_file_string().c_str(), 0, 0666, initial); break; case GlobalSemaphore::iffirst: handle = sem_open(pth.native_file_string().c_str(), O_CREAT | O_EXCL, 0666, initial); if (handle == SEM_FAILED) { openExclusive = false; handle = sem_open(pth.native_file_string().c_str(), O_CREAT, 0666, initial); } else { openExclusive = true; } break; } if (handle != SEM_FAILED) { TRACE(TraceData::info, L"Semaphore create success"); void *lookup = static_cast<void *>(handle); { boost::mutex::scoped_lock lk(mtx, true); std::map<void *, int>::iterator itor; itor = globalMap.find(lookup); if (itor != globalMap.end()) { TRACE(TraceData::info, L"Semaphore updated map"); (*itor).second++; } else { TRACE(TraceData::info, L"Semaphore added to map"); globalMap[lookup] = 1; } } initialCount = initial; semHandle = lookup; globalName = StringConversion::toUTF16(pth.native_file_string()); } else { TRACE(TraceData::info, StringConversion::syserr()); throw GlobalSemaphoreException(StringConversion::syserr()); } }