Exemplo n.º 1
0
Blob CCanPWMActor::setAllPWM(SDeviceDescription device, Blob params) {
    Params values = params[BLOB_ACTION_PARAMETER].get<Params>();
    Blob b;
    string response;
    CCanBuffer buffer;
    if (values.size() == 0) {
        response = "PWMActor->setAllPWM->Incorrect params";
        log->error(response);
        b[BLOB_TXT_RESPONSE_RESULT].put<string>(response);
        return b;
    }
    buffer.insertCommand(CMD_SET_PWM_ALL);
    buffer.insertId((unsigned char) getDeviceCategory());
    buffer << (unsigned char) getAddress(device);
    for (unsigned char val : values) {
        buffer << (unsigned char) (val);
    }
    buffer.buildBuffer();
    response = (getProtocol()->send(buffer)) ? "OK" : "PWMActor->setAllPWM->Sending CAN frame failed";

    b[BLOB_TXT_RESPONSE_RESULT].put<string>(response);

    return b;
}
Exemplo n.º 2
0
void SetInkTypeCommand::onLoadParams(const Params& params)
{
  std::string typeStr = params.get("type");
  if (typeStr == "simple")
    m_type = tools::InkType::SIMPLE;
  else if (typeStr == "alpha-compositing")
    m_type = tools::InkType::ALPHA_COMPOSITING;
  else if (typeStr == "copy-color")
    m_type = tools::InkType::COPY_COLOR;
  else if (typeStr == "lock-alpha")
    m_type = tools::InkType::LOCK_ALPHA;
  else if (typeStr == "shading")
    m_type = tools::InkType::SHADING;
  else
    m_type = tools::InkType::DEFAULT;
}
Exemplo n.º 3
0
int
main(int argc, char *argv[])
{
  if (argc==1) {
    usage(argv[0]);
    return 1;
  }

  ECArgs args( argc, argv );
  params.init( args );
  int numThreads=DEFAULT_NTHREAD;
  if(args.isset('t')) 
    numThreads = atoi(args.value('t').c_str());

  TimeIt timeIt;
  ECString  path( args.arg( 0 ) );
  generalInit(path);

  ECString flnm = "dummy";
  if(args.nargs()==2) flnm = args.arg(1);
  if(Bchart::tokenize)
    {
      if (args.nargs() == 1) {
        tokStream = new ewDciTokStrm(cin);
      }
      else {
        ifstream* stream = new ifstream(flnm.c_str());
        tokStream = new ewDciTokStrm(*stream);
      }
    }
  if(args.nargs()==2) nontokStream = new ifstream(args.arg(1).c_str());
  else nontokStream = &cin;

  pthread_t thread[MAXNUMTHREADS];
  int id[MAXNUMTHREADS];
  int i;
  for(i = 0 ; i < numThreads  ; i++){
    id[i]=i;
    pthread_create(&thread[i],0,mainLoop, &id[i]);
  }
  for(i=0; i<numThreads; i++){
    pthread_join(thread[i],0);
  }
  pthread_exit(0);
  return 0;
}
Exemplo n.º 4
0
  void drawConfidenceEllipse(const double &cx, const double &cy,
                             const double &sxx, const double &sxy, const double &syy,
                             const double &K, Params params)
  {
	  Vec2d vc = {cx, cy};
	  Vec4d vcov = { sxx, sxy, sxy, syy };
      Params msg;
      msg["action"] = "draw";
      msg["figure"] = params.pop("figure",current_fig);
      msg["shape"] = (params, "type", "ellipse",
                              "center", vc,
                              "covariance", vcov,
                              "sigma", K);

      fputs(Value(msg).toJSONString().append("\n\n").c_str(), channel);
      fflush(channel);
  }
Exemplo n.º 5
0
/** Handle /MODULES
 */
CmdResult CommandModules::Handle(User* user, const Params& parameters)
{
	// Don't ask remote servers about their modules unless the local user asking is an oper
	// 2.0 asks anyway, so let's handle that the same way
	bool for_us = (parameters.empty() || irc::equals(parameters[0], ServerInstance->Config->ServerName));
	if ((!for_us) || (!IS_LOCAL(user)))
	{
		if (!user->IsOper())
		{
			user->WriteNotice("*** You cannot check what modules other servers have loaded.");
			return CMD_FAILURE;
		}

		// From an oper and not for us, forward
		if (!for_us)
			return CMD_SUCCESS;
	}

	const ModuleManager::ModuleMap& mods = ServerInstance->Modules.GetModules();

  	for (ModuleManager::ModuleMap::const_iterator i = mods.begin(); i != mods.end(); ++i)
	{
		Module* m = i->second;
		Version V = m->GetVersion();

		if (IS_LOCAL(user) && user->HasPrivPermission("servers/auspex"))
		{
			std::string flags("VCO");
			size_t pos = 0;
			for (int mult = 2; mult <= VF_OPTCOMMON; mult *= 2, ++pos)
				if (!(V.Flags & mult))
					flags[pos] = '-';

			std::string srcrev = m->ModuleDLLManager->GetVersion();
			user->WriteRemoteNumeric(RPL_MODLIST, m->ModuleSourceFile, srcrev.empty() ? "*" : srcrev, flags, V.description);
		}
		else
		{
			user->WriteRemoteNumeric(RPL_MODLIST, m->ModuleSourceFile, '*', '*', V.description);
		}
	}
	user->WriteRemoteNumeric(RPL_ENDOFMODLIST, "End of MODULES list");

	return CMD_SUCCESS;
}
Exemplo n.º 6
0
  void drawPie(const double &cx, const double &cy, const double &r_min, const double &r_max, 
                  const double &theta_min, const double &theta_max, Params params)
  {
      // Angle need to be in degree
      Params msg;
      Vec2d cxy = { cx, cy };
      Vec2d rMinMax = { r_min, r_max };
      Vec2d thetaMinMax = { theta_min, theta_max };
      msg["action"] = "draw";
      msg["figure"] = params.pop("figure",current_fig);
      msg["shape"] = (params, "type", "pie",
                              "center", cxy,
                              "rho", rMinMax,
                              "theta", thetaMinMax);

      fputs(Value(msg).toJSONString().append("\n\n").c_str(), channel);
      fflush(channel);
  }  
Exemplo n.º 7
0
void JsonApiHandlerHttp::sendJson(const Json &json)
{
    string data = json.dump();

    Params headers;
    headers.Add("Connection", "Close");
    headers.Add("Cache-Control", "no-cache, must-revalidate");
    headers.Add("Expires", "Mon, 26 Jul 1997 05:00:00 GMT");
    headers.Add("Content-Type", "application/json");
    headers.Add("Content-Length", Utils::to_string(data.size()));
    string res = httpClient->buildHttpResponse(HTTP_200, headers, data);
    sendData.emit(res);
}
Exemplo n.º 8
0
  void drawSector(const double &cx, const double &cy, const double &a, const double &b, 
                  const double &startAngle, const double &endAngle, Params params)
  {
      // Angle need to be in degree
      Params msg;
      Vec2d cxy={ cx, cy };
      Vec2d cab = { a, b };
      Vec2d startEnd = { startAngle, endAngle };
      msg["action"] = "draw";
      msg["figure"] = params.pop("figure",current_fig);      
      msg["shape"] = (params, "type", "ellipse",
                              "center", cxy,
                              "axis", cab,
                              "orientation", 0,
                              "angles", startEnd);

      fputs(Value(msg).toJSONString().append("\n\n").c_str(), channel);
      fflush(channel);
  }
Exemplo n.º 9
0
//--------------------------------------------------------------
//----------------------  ofApp  -----------------------------
//--------------------------------------------------------------
void ofApp::setup(){
	ofSetFrameRate( 60 );	//Set screen frame rate

	//Allocate drawing buffer
	int w = ofGetWidth();
	int h = ofGetHeight();
	fbo.allocate( w, h, GL_RGB32F_ARB );

	//Fill buffer with white color
	fbo.begin();
	ofBackground(255, 255, 255);
	fbo.end();

	//Set up parameters
	param.setup();		//Global parameters
	history = 0.995;

	time0 = ofGetElapsedTimef();
}
Exemplo n.º 10
0
void pbrtShape(std::string const& name, Params const& params) {
    if (name == "plymesh") {
        auto filename = params.getString("string filename");
        auto cached = PBRTState::cachedShapes.find(pbrtPath + filename);
        std::shared_ptr<Shape const> shape;
        if (cached != PBRTState::cachedShapes.end()) {
            shape = cached->second;
        } else {
            shape = readply(pbrtPath + filename);
            PBRTState::cachedShapes[pbrtPath + filename] = shape;
        }

        PBRTState::objectStack.top().second.instances.push_back(
            Instance{shape, PBRTState::materialStack.top(),
                     PBRTState::transforms.top().start});
    } else {
        std::cout << "Unrecognized Shape: " << name << std::endl;
    }
}
Exemplo n.º 11
0
bool CGUIIncludes::GetParameters(const TiXmlElement *include, const char *valueAttribute, Params& params)
{
  bool foundAny = false;

  // collect parameters from include tag
  // <include name="MyControl">
  //   <param name="posx" value="225" /> <!-- comments and other tags are ignored here -->
  //   <param name="posy">150</param>
  //   ...
  // </include>

  if (include)
  {
    const TiXmlElement *param = include->FirstChildElement("param");
    foundAny = param != NULL;  // doesn't matter if param isn't entirely valid
    while (param)
    {
      std::string paramName = XMLUtils::GetAttribute(param, "name");
      if (!paramName.empty())
      {
        std::string paramValue;

        // <param name="posx" value="120" />
        const char *value = param->Attribute(valueAttribute);         // try attribute first
        if (value)
          paramValue = value;
        else
        {
          // <param name="posx">120</param>
          const TiXmlNode *child = param->FirstChild();
          if (child && child->Type() == TiXmlNode::TINYXML_TEXT)
            paramValue = child->ValueStr();                           // and then tag value
        }

        params.insert({ paramName, paramValue });                     // no overwrites
      }
      param = param->NextSiblingElement("param");
    }
  }

  return foundAny;
}
Exemplo n.º 12
0
  void drawArrow(const double &xA, const double &yA, const double &xB, const double &yB, const double &tip_length, Params params)
  {
     // Reshape A and B into a vector of points
     std::vector<Value> points;
	 Vec2d va = { xA, yA };
	 Vec2d vb = { xB, yB };
     points.push_back(va);
     points.push_back(vb);

     // Send message
     Params msg;
     msg["action"] = "draw";
     msg["figure"] = params.pop("figure",current_fig);
     msg["shape"] = (params, "type", "arrow",
                             "points", points,
                             "tip_length", tip_length);

     fputs(Value(msg).toJSONString().append("\n\n").c_str(), channel);
     fflush(channel);
  }
Exemplo n.º 13
0
	CmdResult Handle(User* user, const Params& parameters) override
	{
		User* dest = ServerInstance->FindNick(parameters[1]);
		Channel* channel = ServerInstance->FindChan(parameters[0]);

		if ((dest) && (dest->registered == REG_ALL) && (channel))
		{
			const std::string& reason = (parameters.size() > 2) ? parameters[2] : dest->nick;

			if (dest->server->IsULine())
			{
				user->WriteNumeric(ERR_NOPRIVILEGES, "Cannot use an SA command on a U-lined client");
				return CMD_FAILURE;
			}

			if (!channel->HasUser(dest))
			{
				user->WriteNotice("*** " + dest->nick + " is not on " + channel->name);
				return CMD_FAILURE;
			}

			/* For local clients, directly kick them. For remote clients,
			 * just return CMD_SUCCESS knowing the protocol module will route the SAKICK to the user's
			 * local server and that will kick them instead.
			 */
			if (IS_LOCAL(dest))
			{
				// Target is on this server, kick them and send the snotice
				channel->KickUser(ServerInstance->FakeClient, dest, reason);
				ServerInstance->SNO.WriteGlobalSno('a', user->nick + " SAKICKed " + dest->nick + " on " + channel->name);
			}

			return CMD_SUCCESS;
		}
		else
		{
			user->WriteNotice("*** Invalid nickname or channel");
		}

		return CMD_FAILURE;
	}
Exemplo n.º 14
0
LLNetMap::LLNetMap (const Params & p)
:	LLUICtrl (p),
	mBackgroundColor (p.bg_color()),
	mScale( MAP_SCALE_MID ),
	mPixelsPerMeter( MAP_SCALE_MID / REGION_WIDTH_METERS ),
	mObjectMapTPM(0.f),
	mObjectMapPixels(0.f),
	mTargetPanX(0.f),
	mTargetPanY(0.f),
	mCurPanX(0.f),
	mCurPanY(0.f),
	mUpdateNow(FALSE),
	mObjectImageCenterGlobal( gAgent.getCameraPositionGlobal() ),
	mObjectRawImagep(),
	mObjectImagep(),
	mClosestAgentToCursor(),
	mClosestAgentAtLastRightClick(),
	mToolTipMsg()
{
	mDotRadius = llmax(DOT_SCALE * mPixelsPerMeter, MIN_DOT_RADIUS);
}
Exemplo n.º 15
0
void CFunctionConfig::_AddParam(ParserEnv* e, const Params& params)
{
	for (euint i = 0; i < params.size(); i++)
	{
		const xhn::pair<xhn::string, ValueType>& p = params[i];
		SymbolValue type;
		switch (p.second)
		{
		case IntValue:
			type = IntTypeSym();
			break;
		case FloatValue:
			type = FloatTypeSym();
			break;
		default:
			return;
		}
		SymbolValue* sv = ParserEnv_new_unknown_symbol(e, p.first.c_str());
		AddParam(e, *sv, type);
	}
}
Exemplo n.º 16
0
void DefaultCliDelegate::saveFile(Context* ctx, const CliOpenFile& cof)
{
  Command* saveAsCommand = Commands::instance()->byId(CommandId::SaveFileCopyAs());
  Params params;
  params.set("filename", cof.filename.c_str());
  params.set("filename-format", cof.filenameFormat.c_str());

  if (cof.hasFrameTag()) {
    params.set("frame-tag", cof.frameTag.c_str());
  }
  if (cof.hasFrameRange()) {
    params.set("from-frame", base::convert_to<std::string>(cof.fromFrame).c_str());
    params.set("to-frame", base::convert_to<std::string>(cof.toFrame).c_str());
  }
  if (cof.hasSlice()) {
    params.set("slice", cof.slice.c_str());
  }

  if (cof.ignoreEmpty)
    params.set("ignoreEmpty", "true");

  ctx->executeCommand(saveAsCommand, params);
}
Exemplo n.º 17
0
void SaveFileBaseCommand::onLoadParams(const Params& params)
{
  m_filename = params.get("filename");
  m_filenameFormat = params.get("filename-format");
  m_frameTag = params.get("frame-tag");
  m_aniDir = params.get("ani-dir");
  m_slice = params.get("slice");

  if (params.has_param("from-frame") ||
      params.has_param("to-frame")) {
    doc::frame_t fromFrame = params.get_as<doc::frame_t>("from-frame");
    doc::frame_t toFrame = params.get_as<doc::frame_t>("to-frame");
    m_selFrames.insert(fromFrame, toFrame);
    m_adjustFramesByFrameTag = true;
  }
  else {
    m_selFrames.clear();
    m_adjustFramesByFrameTag = false;
  }
}
Exemplo n.º 18
0
  void drawPolygon(const std::vector<double> &x, const std::vector<double> &y, Params params)
  {
     // Reshape x and y into a vector of points
     std::vector<Value> points;
     std::vector<double>::const_iterator itx = x.begin();
     std::vector<double>::const_iterator ity = y.begin();
	 Vec2d vp;
     while (itx != x.end() && ity != y.end()) {
		vp._data[0] = *itx++;
		vp._data[1] = *ity++;
        points.push_back( vp );
     }
     // Send message
     Params msg;
     msg["action"] = "draw";
     msg["figure"] = params.pop("figure",current_fig);
     msg["shape"] = (params, "type", "polygon",
                             "bounds", points);

     fputs(Value(msg).toJSONString().append("\n\n").c_str(), channel);
     fflush(channel);
  }
Exemplo n.º 19
0
    bool select(T result, Binder binder, Params params)
    {
      prepare();

      if (NULL == stmt)
      {
        assert(false);
        return false;
      }

      sqlite3_reset(stmt);
      sqlite3_clear_bindings(stmt);

      params.set_params(stmt);

      while (SQLITE_ROW == sqlite3_step(stmt)) // iterate all objects
      {
          binder.get(stmt,result);
      }

      return true;
    }
Exemplo n.º 20
0
std::shared_ptr<Texture const> makeTexture(std::string const& name,
                                           Params const& params,
                                           rgba const& defaultValue) {
    if (params.hasRGB(std::string("rgb ") + name)) {
        auto rgb = params.getRGB(std::string("rgb " + name));
        return std::make_shared<ConstantTexture const>(rgb);
    } else if (params.hasFloat(std::string("float ") + name)) {
        auto f = params.getFloat(std::string("float " + name));
        return std::make_shared<ConstantTexture const>(rgba(f, f, f, f));
    } else if (params.hasString(std::string("spectrum ") + name)) {
        auto spd = params.getString(std::string("spectrum " + name));
        return std::make_shared<ConstantTexture const>(
            rgba(Spectrum::loadSPD(pbrtPath + spd)));
    } else if (params.hasString(std::string("texture ") + name)) {
        auto named = params.getString(std::string("texture ") + name);
        auto texture = PBRTState::namedTextures.find(named);
        if (texture != PBRTState::namedTextures.end())
            return texture->second;
        else
            return std::make_shared<ConstantTexture const>(rgba(0, 0, 1, 1));
    } else {
        return std::make_shared<ConstantTexture const>(defaultValue);
    }
}
Exemplo n.º 21
0
    static Evaluation krn(const Params &params,
                          const FluidState &fluidState)
    {
        typedef MathToolbox<Evaluation> Toolbox;
        typedef MathToolbox<typename FluidState::Scalar> FsToolbox;

        // the Eclipse docu is inconsistent here: In some places the connate water
        // saturation is represented by "Swl", in others "Swco" is used.
        Scalar Swco = params.Swl();

        Scalar Sowcr = params.Sowcr();
        Scalar Sogcr = params.Sogcr();
        Scalar Som = std::min(Sowcr, Sogcr); // minimum residual oil saturation

        Scalar eta = params.eta(); // exponent of the beta term

        const Evaluation& Sw = FsToolbox::template toLhs<Evaluation>(fluidState.saturation(waterPhaseIdx));
        const Evaluation& So = FsToolbox::template toLhs<Evaluation>(fluidState.saturation(oilPhaseIdx));
        const Evaluation& Sg = FsToolbox::template toLhs<Evaluation>(fluidState.saturation(gasPhaseIdx));

        Evaluation SSw;
        if (Sw > Swco)
            SSw = (Sw - Swco)/(1 - Swco - Som);
        else
            SSw = 0.0;

        Evaluation SSo;
        if (So > Som)
            SSo = (So - Som)/(1 - Swco - Som);
        else
            SSo = 0.0;

        Evaluation SSg = Sg/(1 - Swco - Som);

        Scalar krocw = OilWaterMaterialLaw::twoPhaseSatKrn(params.oilWaterParams(), Swco);
        Evaluation krow = OilWaterMaterialLaw::twoPhaseSatKrn(params.oilWaterParams(), Sw);
        Evaluation krog = GasOilMaterialLaw::twoPhaseSatKrw(params.gasOilParams(), 1 - Sg);

        Evaluation beta = Toolbox::pow(SSo/((1 - SSw)*(1 - SSg)), eta);
        return beta*krow*krog/krocw;
    }
Exemplo n.º 22
0
    static Evaluation krn(const Params &params,
                          const FluidState &fluidState)
    {
        typedef MathToolbox<typename FluidState::Scalar> FsToolbox;

        Scalar Swco = params.Swl();
        const Evaluation& Sw = FsToolbox::template toLhs<Evaluation>(fluidState.saturation(waterPhaseIdx));
        const Evaluation& Sg = FsToolbox::template toLhs<Evaluation>(fluidState.saturation(gasPhaseIdx));

        Scalar krocw = OilWaterMaterialLaw::twoPhaseSatKrn(params.oilWaterParams(), Swco);
        Evaluation krow = OilWaterMaterialLaw::twoPhaseSatKrn(params.oilWaterParams(), Sw);
        Evaluation krw = OilWaterMaterialLaw::twoPhaseSatKrw(params.oilWaterParams(), Sw);
        Evaluation krg = GasOilMaterialLaw::twoPhaseSatKrn(params.gasOilParams(), 1 - Sg);
        Evaluation krog = GasOilMaterialLaw::twoPhaseSatKrw(params.gasOilParams(), 1 - Sg);

        return krocw*((krow/krocw + krw)*(krog/krocw + krg) - krw - krg);
    }
Exemplo n.º 23
0
    int execute(Params params)
    {
      int nResult;

      prepare();

      if (NULL == stmt)
      {
        assert(false);
        return false;
      }

      sqlite3_reset(stmt);
      sqlite3_clear_bindings(stmt);

      params.set_params(stmt);

      //Execute the command
      nResult = sqlite3_step(stmt);
      assert(SQLITE_DONE == nResult);

      return nResult;
    }
Exemplo n.º 24
0
//--------------------------------------------------------------
void ofApp::setup(){


	ofSetFrameRate(60);

	//Определяем графический буфер
	int w = ofGetWidth();
	int h = ofGetHeight();
	fbo.allocate(w,h,GL_RGB32F_ARB);

	//Заполняем буфер белым цветом
	fbo.begin();
	ofBackground(255,255,255);
	fbo.end();

	//Настраиваем параметры
	param.setup();
	history = 0.9;
	time0 = ofGetElapsedTimef();

	bornRate = 2500;
	bornCount = 0;
}
LLScrollListColumn::LLScrollListColumn(const Params& p, LLScrollListCtrl* parent)
:	mWidth(0),
	mIndex (-1),
	mParentCtrl(parent),
	mName(p.name),
	mLabel(p.header.label),
	mHeader(NULL),
	mMaxContentWidth(0),
	mDynamicWidth(p.width.dynamic_width),
	mRelWidth(p.width.relative_width),
	mFontAlignment(p.halign),
	mSortingColumn(p.sort_column)
{
	if (p.sort_ascending.isProvided())
	{
		mSortDirection = p.sort_ascending() ? ASCENDING : DESCENDING;
	}
	else
	{
		mSortDirection = p.sort_direction;
	}

	setWidth(p.width.pixel_width);
}
Exemplo n.º 26
0
    static void updateHysteresis(Params &params, const FluidState &fluidState)
    {
        switch (params.approach()) {
        case EclStone1Approach:
            Stone1Material::updateHysteresis(params.template getRealParams<EclStone1Approach>(),
                                             fluidState);
            break;

        case EclStone2Approach:
            Stone2Material::updateHysteresis(params.template getRealParams<EclStone2Approach>(),
                                             fluidState);
            break;

        case EclDefaultApproach:
            DefaultMaterial::updateHysteresis(params.template getRealParams<EclDefaultApproach>(),
                                              fluidState);
            break;

        case EclTwoPhaseApproach:
            TwoPhaseMaterial::updateHysteresis(params.template getRealParams<EclTwoPhaseApproach>(),
                                               fluidState);
            break;
        }
    }
Exemplo n.º 27
0
void App::printParams() const
{
    cout << "--- Parameters ---\n";
    cout << "image_size: (" << left.cols << ", " << left.rows << ")\n";
    cout << "image_channels: " << left.channels() << endl;
    cout << "method: " << p.method_str() << endl
        << "ndisp: " << p.ndisp << endl;
    switch (p.method)
    {
    case Params::BM:
        cout << "win_size: " << bm.winSize << endl;
        cout << "prefilter_sobel: " << bm.preset << endl;
        break;
    case Params::BP:
        cout << "iter_count: " << bp.iters << endl;
        cout << "level_count: " << bp.levels << endl;
        break;
    case Params::CSBP:
        cout << "iter_count: " << csbp.iters << endl;
        cout << "level_count: " << csbp.levels << endl;
        break;
    }
    cout << endl;
}
Exemplo n.º 28
0
valueP js_function::call(Params& args,valueP parent)
{
    if(!function_info_) function_info_=new function_info(arguments_,program_);
    javascript_parser* parser=dynamic_cast<javascript_parser*>(get_context());
    if(!parser) throw std::runtime_error("invalid context");
    valueP newScope=new scope;
    if(parent) newScope->insert("this",parent->duplicate());
    scope_pusher_all push(parser,newScope);
    for(unsigned i=0;i<function_info_->identifiers_.size();++i) {
        if(i<args.size()) parser->declaration_scope()->insert(function_info_->identifiers_[i],args[i]);
        else parser->declaration_scope()->insert(function_info_->identifiers_[i],wrap(new undefined,get_context()));
    }
    exception_handler handler;
    const callback_handler* used_handler;
    used_handler=parser->get_callback_handler();
    if(!used_handler) used_handler=&handler;
    auto old_parser_pos = used_handler->parser_pos();
    try {        
        used_handler->parser_pos()=parser_pos_;
        parser->evaluate(function_info_->program_execution_,*used_handler);
    }
    catch(js_exit_return& e) {
        used_handler->parser_pos() = old_parser_pos;
        return e.return_value();
    }
    catch(js_continue& e) {
        throw positional_runtime_error(e.what(),used_handler->parser_pos());
    }
    catch(js_break& e) {
        throw positional_runtime_error(e.what(),used_handler->parser_pos());
    }
    catch(std::exception& e) {
        throw positional_runtime_error(e.what(),used_handler->parser_pos());
    }
    return NULL;
}
Exemplo n.º 29
0
LLNetMap::LLNetMap (const Params & p)
:	LLUICtrl (p),
	mBackgroundColor (p.bg_color()),
	mScale( MAP_SCALE_MID ),
	mPixelsPerMeter( MAP_SCALE_MID / REGION_WIDTH_METERS ),
	mObjectMapTPM(0.f),
	mObjectMapPixels(0.f),
	mTargetPan(0.f, 0.f),
	mCurPan(0.f, 0.f),
	mStartPan(0.f, 0.f),
	mMouseDown(0, 0),
	mPanning(false),
	mUpdateNow(false),
	mObjectImageCenterGlobal( gAgentCamera.getCameraPositionGlobal() ),
	mObjectRawImagep(),
	mObjectImagep(),
	mClosestAgentToCursor(),
	mClosestAgentAtLastRightClick(),
	mToolTipMsg(),
	mPopupMenu(NULL)
{
	mDotRadius = llmax(DOT_SCALE * mPixelsPerMeter, MIN_DOT_RADIUS);
	setScale(gSavedSettings.getF32("MiniMapScale"));
}
Exemplo n.º 30
0
void DialogNewAVReceiver::on_buttonBox_accepted()
{
    if (ui->lineEditName->text().isEmpty())
    {
        ui->labelError->show();
        return;
    }

    Params p;
    p.Add("name", ui->lineEditName->text().toUtf8().constData());
    p.Add("model", ui->comboBoxType->itemData(ui->comboBoxType->currentIndex()).toString().toUtf8().constData());
    p.Add("host", ui->lineEditHost->text().toUtf8().constData());
    p.Add("visible", "true");
    p.Add("type", "AVReceiver");

    output = ListeRoom::Instance().createOutput(p, room);

    accept();
}