unsigned long do_rel(struct _dl_handle * tmp_dl, unsigned long off) { Elf_Rel *tmp = ((void*)tmp_dl->plt_rel)+off; int sym=ELF_R_SYM(tmp->r_info); register unsigned long sym_val; #ifdef DEBUG pf(__func__": "); ph((unsigned long)tmp_dl); pf(" "); ph(off); pf(" on "); ph((long)tmp_dl->plt_rel); pf("\n"); pf(__func__": @ "); ph((long)tmp->r_offset); pf(" with type "); ph(ELF_R_TYPE(tmp->r_info)); pf(" and sym "); ph(sym); pf(" symval "); ph(tmp_dl->dyn_sym_tab[sym].st_value); pf("\n"); #endif /* modify GOT for REAL symbol */ //sym_val=((unsigned long)(tmp_dl->mem_base+tmp_dl->dyn_sym_tab[sym].st_value)); sym_val=(unsigned long)_dl_sym(tmp_dl,sym); *((unsigned long*)(tmp_dl->mem_base+tmp->r_offset))=sym_val; #ifdef DEBUG pf(__func__": sym "); ph(sym_val); pf("\n"); #endif /* JUMP (arg sysdep...) */ if (sym_val) return sym_val; /* can't find symbol -> die now */ return (unsigned long)exit_now; }
KDLRobotModel::KDLRobotModel() : ik_solver_(NULL), ik_vel_solver_(NULL), fk_solver_(NULL) { ros::NodeHandle ph("~"); ph.param<std::string>("robot_model/chain_root_link", chain_root_name_, " "); ph.param<std::string>("robot_model/chain_tip_link", chain_tip_name_, " "); ph.param("robot_model/free_angle", free_angle_, 2); }
void PollableConditionPrivate::poke() { // monitorHandle will queue a completion for the IOCP; when it's handled, a // poller thread will call back to dispatch() below. PollerHandle ph(*this); poller->monitorHandle(ph, Poller::INPUT); }
std::string ClangCompilerSupport::compileCppModule(const Pothos::Util::CompilerArgs &compilerArgs) { //create args Poco::Process::Args args; //add libraries for (const auto &library : compilerArgs.libraries) { args.push_back(library); } //add compiler flags args.push_back("-std=c++11"); args.push_back("-stdlib=libc++"); args.push_back("-shared"); args.push_back("-fPIC"); for (const auto &flag : compilerArgs.flags) { args.push_back(flag); } //add include paths for (const auto &include : compilerArgs.includes) { args.push_back("-I"); args.push_back(include); } //add compiler sources args.push_back("-x"); args.push_back("c++"); for (const auto &source : compilerArgs.sources) { args.push_back(source); } //create temp out file const auto outPath = this->createTempFile(Poco::SharedLibrary::suffix()); args.push_back("-o"); args.push_back(outPath); //launch Poco::Pipe inPipe, outPipe; Poco::Process::Env env; Poco::ProcessHandle ph(Poco::Process::launch( "clang++", args, &inPipe, &outPipe, &outPipe, env)); //handle error case if (ph.wait() != 0) { Poco::PipeInputStream errStream(outPipe); const std::string errMsgBuff = std::string( std::istreambuf_iterator<char>(errStream), std::istreambuf_iterator<char>()); throw Pothos::Exception("ClangCompilerSupport::compileCppModule", errMsgBuff); } //return output file path return outPath; }
void KNewStuff2Test::providerTest() { kDebug() << "-- test kns2 provider class"; QDomDocument doc; QFile f(QString("%1/testdata/provider.xml").arg(KNSSRCDIR)); if (!f.open(QIODevice::ReadOnly)) { kDebug() << "Error loading provider file."; quitTest(); } if (!doc.setContent(&f)) { kDebug() << "Error parsing provider file."; f.close(); quitTest(); } f.close(); KNS::ProviderHandler ph(doc.documentElement()); KNS::Provider p = ph.provider(); kDebug() << "-- xml->provider test result: " << ph.isValid(); KNS::ProviderHandler ph2(p); QDomElement pxml = ph2.providerXML(); kDebug() << "-- provider->xml test result: " << ph.isValid(); if (!ph.isValid()) { quitTest(); } else { QTextStream out(stdout); out << pxml; } }
void CmdHelper::GeneratePore32() { int coal_id = -1; if(RTNORM != acedGetInt(NULL, &coal_id)) return; if(coal_id == -1) return; int tech_id = -1; if(RTNORM != acedGetInt(NULL, &tech_id)) return; if(tech_id == -1) return; cbm::Coal coal; SQLClientHelper::GetCoalById(coal, coal_id); if( coal.id < 0 ) return; cbm::DesignGoafTechnology goaf_tech; SQLClientHelper::GetDesignGoafTechnologyById(goaf_tech, tech_id); if(goaf_tech.id < 0 ) return; std::vector<cbm::DesignGoafPore> close_pores; SQLClientHelper::GetDesignGoafPoreListByForeignKey(close_pores, "design_goaf_technology_id", goaf_tech.id); if(close_pores.empty()) return; // 生成钻孔坐标数据文件(测试用) P32::PoreHelper ph(coal, goaf_tech, close_pores); ph.cacl(); AfxMessageBox(_T("\n生成钻孔数据成功!")); }
///\deprecated int main(int argc, char* argv[]) { ros::init(argc,argv,"static_transform_publisher"); ros::NodeHandle ph("~"); tf2_ros::StaticTransformBroadcaster broadcast; Eigen::Vector3d origin, orientation; labust::tools::getMatrixParam(ph, "origin", origin); labust::tools::getMatrixParam(ph, "orientation", orientation); //Broadcast the position of the device. enum {x=0,y,z}; enum {roll=0,pitch,yaw}; geometry_msgs::TransformStamped transform; transform.transform.translation.x = origin(x); transform.transform.translation.y = origin(y); transform.transform.translation.z = origin(z); labust::tools::quaternionFromEulerZYX( orientation(roll), orientation(pitch), orientation(yaw), transform.transform.rotation); ph.getParam("child_frame", transform.child_frame_id); ph.getParam("base_frame", transform.header.frame_id); transform.header.stamp = ros::Time::now(); broadcast.sendTransform(transform); ros::spin(); }
/*********************************************************************** * module safe load implementation **********************************************************************/ Pothos::PluginModule Pothos::PluginModule::safeLoad(const std::string &path) { if (previousLoadWasSuccessful(path)) return PluginModule(path); const int success = 200; //create args Poco::Process::Args args; args.push_back("--load-module"); args.push_back("\""+path+"\""); //add quotes for paths with spaces args.push_back("--success-code"); args.push_back(std::to_string(success)); //launch Poco::Pipe outPipe, errPipe; Poco::Process::Env env; Poco::ProcessHandle ph(Poco::Process::launch( Pothos::System::getPothosUtilExecutablePath(), args, nullptr, &outPipe, &errPipe, env)); //close pipes to not overfill and backup outPipe.close(); errPipe.close(); //wait, check error condition, and throw if (ph.wait() != success) { throw Pothos::PluginModuleError("Pothos::PluginModule("+path+")", "failed safe load"); } //it was safe, load into this process now markCurrentLoadSuccessful(path); return PluginModule(path); }
void NczPlayerManager::ClientActive ( SourceSdk::edict_t* pEntity ) { const int index ( Helpers::IndexOfEdict ( pEntity ) ); LoggerAssert ( index ); PlayerHandler& ph ( FullHandlersList[ index ] ); if( ph.status == SlotStatus::INVALID ) // Bots don't call ClientConnect { ph.playerClass = new NczPlayer ( index ); __assume ( ph.playerClass != nullptr ); ph.playerClass->m_playerinfo = ( SourceSdk::IPlayerInfo * )SourceSdk::InterfacesProxy::Call_GetPlayerInfo ( ph.playerClass->m_edict ); LoggerAssert ( ph.playerClass->m_playerinfo ); #undef GetClassName if( strcmp ( pEntity->GetClassName (), "player" ) == 0 ) ph.status = SlotStatus::TV; else ph.status = SlotStatus::BOT; } else { LoggerAssert ( ph.status == SlotStatus::PLAYER_CONNECTING ); ph.status = SlotStatus::PLAYER_CONNECTED; ph.playerClass->m_playerinfo = ( SourceSdk::IPlayerInfo * )SourceSdk::InterfacesProxy::Call_GetPlayerInfo ( ph.playerClass->m_edict ); LoggerAssert ( ph.playerClass->m_playerinfo ); } if( index > m_max_index ) m_max_index = index; PlayerHandler::first = ( &FullHandlersList[ 1 ] ); PlayerHandler::last = ( &FullHandlersList[ m_max_index ] ); BaseSystem::ManageSystems (); }
int main(){ printf("Entre com os parâmetros\n\n"); oxigenio(); coliformesfecais(); ph(); dbo(); totalnitrato(); totalfosfato(); temperatura(); turbidez(); residuostotais(); somatorio(); return 0; }
Server::Server(Settings& settings) : _settings(settings), _admMessageQueue(new Tools::SimpleMessageQueue(1)) { Tools::debug << "Server::Server()\n"; this->_rcon = new Rcon::Rcon(*this); this->_resourceManager = new Database::ResourceManager(*this); this->_clientManager = new ClientManagement::ClientManager(*this, *this->_admMessageQueue); this->_game = new Game::Game(*this, *this->_admMessageQueue); Network::Network::NewConnectionHandler nch(std::bind(&ClientManagement::ClientManager::HandleNewClient, this->_clientManager, std::placeholders::_1, std::placeholders::_2)); Network::Network::PacketHandler ph(std::bind(&ClientManagement::ClientManager::HandlePacket, this->_clientManager, std::placeholders::_1, std::placeholders::_2)); Network::Network::ErrorHandler eh(std::bind(&ClientManagement::ClientManager::HandleClientError, this->_clientManager, std::placeholders::_1)); this->_network = new Network::Network(*this, nch, ph, eh); }
static bool spawnSelfTestOneProcess(const std::string &path) { std::cout << "Testing " << path << "... " << std::flush; const int success = 200; //create args Poco::Process::Args args; args.push_back("--self-test1"); args.push_back(path); args.push_back("--success-code"); args.push_back(std::to_string(success)); //launch Poco::Process::Env env; Poco::Pipe outPipe; //no fwd stdio Poco::ProcessHandle ph(Poco::Process::launch( Pothos::System::getPothosUtilExecutablePath(), args, nullptr, &outPipe, &outPipe, env)); std::future<std::string> verboseFuture(std::async(std::launch::async, &collectVerbose, outPipe)); const bool ok = (ph.wait() == success); std::cout << ((ok)? "success!" : "FAIL!") << std::endl; outPipe.close(); verboseFuture.wait(); if (not ok) std::cout << verboseFuture.get(); return ok; }
///\todo Edit the class loading to be loaded from the rosparam server. int main(int argc, char* argv[]) { ros::init(argc,argv,"caddy_ge"); ros::NodeHandle nh,ph("~"); labust::gearth::CaddyKML kml; ros::Subscriber platform = nh.subscribe<auv_msgs::NavSts>("platform", 1, &labust::gearth::CaddyKML::addShipPosition, &kml); ros::Subscriber diver = nh.subscribe<auv_msgs::NavSts>("diver", 1, &labust::gearth::CaddyKML::addVehiclePosition, &kml); ros::Subscriber diver_origin = nh.subscribe<geometry_msgs::Point>("diver_origin", 1, &labust::gearth::CaddyKML::setDiverOrigin, &kml); double freq(2); ph.param("rate",freq,freq); ros::Rate rate(freq); while (ros::ok()) { ros::spinOnce(); rate.sleep(); } ros::spin(); return 0; }
double ItemDafeTF::operator()(const Vector &b)const{ PcrBetaHolder ph(b, mod, tmpbeta); if( mod->a() <=0) return BOOM::negative_infinity(); const SubjectSet & subjects(mod->subjects()); ans=0.0; for_each(subjects.begin(), subjects.end(), boost::bind(&ItemDafeTF::logp_sub, this, _1)); return ans; }
void GraphEditor::handleShowFlattenedDialog(void) { if (not this->isVisible()) return; std::string errorMsg; try { //temp file auto tempFile = Poco::TemporaryFile::tempName(); Poco::TemporaryFile::registerForDeletion(tempFile); //create args Poco::Process::Args args; args.push_back("-Tpng"); //yes png args.push_back("-o"); //output to file args.push_back(tempFile); //launch Poco::Pipe inPipe, outPipe, errPipe; Poco::Process::Env env; Poco::ProcessHandle ph(Poco::Process::launch( Poco::Environment::get("DOT_EXECUTABLE", "dot"), args, &inPipe, &outPipe, &errPipe, env)); //write the markup into dot Poco::PipeOutputStream os(inPipe); os << _topologyEngine->getTopology().toDotMarkup(); os.close(); outPipe.close(); //check for errors if (ph.wait() != 0 or not QFile(QString::fromStdString(tempFile)).exists()) { Poco::PipeInputStream es(errPipe); std::string errMsg; es >> errMsg; throw Pothos::Exception("PothosGui.GraphEditor.showFlattenedGraphDialog()", "png failed: " + errMsg); } //create the image from file QImage image(QString::fromStdString(tempFile), "png"); //create the dialog auto dialog = new QDialog(this); dialog->setWindowTitle(tr("Flattened graph")); dialog->setMinimumSize(800, 600); auto layout = new QVBoxLayout(dialog); dialog->setLayout(layout); auto scroll = new QScrollArea(dialog); layout->addWidget(scroll); auto label = new QLabel(scroll); scroll->setWidget(label); scroll->setWidgetResizable(true); label->setPixmap(QPixmap::fromImage(image)); dialog->exec(); delete dialog; }
bool test(void) { Poco::Process::Args args; args.push_back("--version"); Poco::Process::Env env; Poco::Pipe outPipe; Poco::ProcessHandle ph(Poco::Process::launch( "clang++", args, nullptr, &outPipe, &outPipe, env)); return ph.wait() == 0; }
void StatementBlock::parseInitClosure(UserVariantBase* uvb, const QoreTypeInfo* classTypeInfo, lvar_set_t* vlist) { QORE_TRACE("StatementBlock::parseInitClosure"); ClosureParseEnvironment cenv(vlist); UserParamListLocalVarHelper ph(uvb, classTypeInfo); // initialize code block parseInitImpl(uvb->getUserSignature()->selfid); parseCheckReturn(); }
/** set X, Y, W, and H to the bounding box of point /p/ in screen coords */ void Panner::point_bbox ( const Point *p, int *X, int *Y, int *W, int *H ) const { int tx, ty, tw, th; bbox( tx, ty, tw, th ); tw -= pw(); th -= ph(); float px, py; p->axes( &px, &py ); *X = tx + ((tw / 2) * px + (tw / 2)); *Y = ty + ((th / 2) * py + (th / 2)); *W = pw(); *H = ph(); }
void RBM::sampleHgivenV() { const int N = v.rows(); h.conservativeResize(N, Eigen::NoChange); ph = v * W.transpose(); ph.rowwise() += bh.transpose(); activationFunction(LOGISTIC, ph, ph); for(int n = 0; n < N; n++) for(int j = 0; j < H; j++) h(n, j) = (double)(ph(n, j) > rng->generate<double>(0.0, 1.0)); }
int adhoc_main() { std::auto_ptr<Animal> pd(new Dog); std::auto_ptr<Animal> ph(new Horse); std::auto_ptr<Animal> psh(new SmallHorse); Loki::FlexAdHocVisitor<Loki::Seq<SmallHorse, Horse, Dog>::Type, Effector > v; v.StartVisit(ph.get()); v.StartVisit(psh.get()); v.StartVisit(pd.get()); return 0; }
void StatementBlock::parseInitMethod(const QoreTypeInfo* typeInfo, UserVariantBase* uvb) { QORE_TRACE("StatementBlock::parseInitMethod"); VariableBlockHelper vbh; UserParamListLocalVarHelper ph(uvb, typeInfo); // initialize code block parseInitImpl(uvb->getUserSignature()->selfid); parseCheckReturn(); }
int send_req() { static char str[] = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"; short r = rand() % (sizeof(str) - 1) + 1; proto_head ph(this->seq_++, 100001, 0, sizeof(proto_head) + r + 2); socket::send(this->get_handle(), (char *)&ph, sizeof(ph)); socket::send(this->get_handle(), (char *)&r, sizeof(short)); int ret = socket::send(this->get_handle(), str, r); if (ret <= 0) fprintf(stderr, "long conn send req failed![%s]\n", strerror(errno)); return ret > 0 ? 0 : -1; }
void StatementBlock::parseInit(UserVariantBase* uvb) { QORE_TRACE("StatementBlock::parseInit"); VariableBlockHelper vbh; UserParamListLocalVarHelper ph(uvb); // initialize code block parseInitImpl(0); parseCheckReturn(); }
int main(int argc, char** argv) try { if(!setup(argc, argv)) { usage(); exit(-2); } std::cerr << "parsed channels: "; std::copy(channel_list.begin(), channel_list.end(), std::ostream_iterator<int> (std::cerr, " ")); std::cerr << std::endl; std::cerr << "nflogd starting..." << std::endl; PacketHandler ph(pcap_filename); NFmain nf(channel_list, [ph = std::ref(ph)](struct nflog_data *nfa){ ph(nfa); }); // setup signal SETSIG(SIGTERM, term_handler, SA_RESTART); SETSIG(SIGINT, term_handler, SA_RESTART); SETSIG(SIGHUP, hup_handler, SA_RESTART); std::cerr << "going into main loop" << std::endl; switch_user(); set_dumpable(); nf.loop(term_flag); std::cerr << "terminating..." << std::endl; return 0; } catch (const std::exception& e) { std::cerr << e.what() << std::endl; return -1; }
void textlist_print_html(textlist_s *in){ if (!print_fns) print_fns = g_hash_table_new(g_direct_hash, g_direct_equal); print_fn_type ph = g_hash_table_lookup(print_fns, in->print); if (ph) { ph(in); return; } printf("<title>%s</title>\n<ul>", in->title); for (int i=0; i < in->len; i++) printf("<li>%s</li>\n", in->items[i]); printf("</ul>\n"); }
void AbstractReflectSession :: SetPolicyAux(AbstractSessionIOPolicyRef & myRef, uint32 & chunk, const AbstractSessionIOPolicyRef & newRef, bool isInput) { TCHECKPOINT; if (newRef != myRef) { PolicyHolder ph(this, isInput); if (myRef()) myRef()->PolicyHolderRemoved(ph); myRef = newRef; chunk = myRef() ? 0 : MUSCLE_NO_LIMIT; // sensible default to use until my policy gets its say about what we should do if (myRef()) myRef()->PolicyHolderAdded(ph); } }
Color ph2(int x, int y){ int r=phms/25; if(x>=phms-r) x=phms-r; if(x<r) x=r; if(y>=phms-r) y=phms-r; if(y<r) y=r; Color sum; for(int i=-r;i<r+1;i++){ for(int j=-r;j<r+1;j++){ sum=sum+ph(x+i,y+j)*max(0,r-sqrt(i*i+j*j)); } } return sum*(1./r/r); }
void CViewSelWnd::OnPaint(HDC hDC) { for (int i = 0; i < m_pUI->GetNumViews(); i++) { CBitmap *pbm = m_pUI->GetViewThumbnail(i, i == m_nOver); if (pbm != NULL) pbm->Draw(hDC, i * g_sizeThumb.cx + 1, 1); } CPaintHelper ph(m_pUI->m_uig, hDC); ph.SetPen(UIP_VIEWSELGRID); RECT rect; GetClientRect(&rect); ph.Rectangle(rect, UIR_OUTLINE); }
HAMIGAKI_BJAM_DECL string_list check_if_file(context& ctx) { frame& f = ctx.current_frame(); const list_of_list& args = f.arguments(); const std::string& file = args[0][0]; fs::path ph(file); fs::path work(ctx.working_directory()); ph = fs::complete(ph, work); if (fs::is_regular(ph)) return string_list(std::string("true")); else return string_list(); }
ListNode* deleteDuplicates(ListNode* head) { ListNode ph(0), *pre = &ph; pre->next = head; while (pre->next) { ListNode *cur = pre->next; if (cur->next && cur->val == cur->next->val) { pre->next = cur->next; delete cur; } else pre = cur; } return ph.next; }