示例#1
0
bool Properties::getVec3(const char* name, Vec3* out) const
{
    return parseVec3(getString(name), out);
}
示例#2
0
 void cleanUp (ValueUnion& data) const noexcept                       { getString (data)-> ~String(); }
示例#3
0
 int toInt (const ValueUnion& data) const noexcept       { return getString (data)->getIntValue(); };
示例#4
0
 std::string GeneratorPVWatts_Impl::pvWattsVersion() const {
   boost::optional<std::string> value = getString(OS_Generator_PVWattsFields::PVWattsVersion,true);
   OS_ASSERT(value);
   return value.get();
 }
BOOL LLFloaterBulkPermission::start()
{
	// note: number of top-level objects to modify is mObjectIDs.count().
	getChild<LLScrollListCtrl>("queue output")->addSimpleElement(getString("start_text"));
	return nextObject();
}
示例#6
0
 std::string CoilCoolingWater_Impl::typeOfAnalysis()
 {
   return getString( openstudio::OS_Coil_Cooling_WaterFields::TypeofAnalysis,true ).get();
 }
 std::string FluidCoolerSingleSpeed_Impl::performanceInputMethod() const {
   boost::optional<std::string> value = getString(OS_FluidCooler_SingleSpeedFields::PerformanceInputMethod,true);
   OS_ASSERT(value);
   return value.get();
 }
 boost::optional<std::string> ZoneHVACLowTemperatureRadiantElectric_Impl::radiantSurfaceType() const 
 {
   return getString(OS_ZoneHVAC_LowTemperatureRadiant_ElectricFields::RadiantSurfaceType,true);
 }
bool LLPanelGroupGeneral::needsApply(std::string& mesg)
{ 
	updateChanged();
	mesg = getString("group_info_unchanged");
	return mChanged || mGroupID.isNull();
}
// virtual
BOOL LLPanelPlaceProfile::postBuild()
{
	LLPanelPlaceInfo::postBuild();

	mForSalePanel = getChild<LLPanel>("for_sale_panel");
	mYouAreHerePanel = getChild<LLPanel>("here_panel");
	gIdleCallbacks.addFunction(&LLPanelPlaceProfile::updateYouAreHereBanner, this);

	//Icon value should contain sale price of last selected parcel.
	mForSalePanel->getChild<LLIconCtrl>("icon_for_sale")->
				setMouseDownCallback(boost::bind(&LLPanelPlaceProfile::onForSaleBannerClick, this));

	mParcelOwner = getChild<LLTextBox>("owner_value");

	mParcelRatingIcon = getChild<LLIconCtrl>("rating_icon");
	mParcelRatingText = getChild<LLTextBox>("rating_value");
	mVoiceIcon = getChild<LLIconCtrl>("voice_icon");
	mVoiceText = getChild<LLTextBox>("voice_value");
	mFlyIcon = getChild<LLIconCtrl>("fly_icon");
	mFlyText = getChild<LLTextBox>("fly_value");
	mPushIcon = getChild<LLIconCtrl>("push_icon");
	mPushText = getChild<LLTextBox>("push_value");
	mBuildIcon = getChild<LLIconCtrl>("build_icon");
	mBuildText = getChild<LLTextBox>("build_value");
	mScriptsIcon = getChild<LLIconCtrl>("scripts_icon");
	mScriptsText = getChild<LLTextBox>("scripts_value");
	mDamageIcon = getChild<LLIconCtrl>("damage_icon");
	mDamageText = getChild<LLTextBox>("damage_value");

	mRegionNameText = getChild<LLTextBox>("region_name");
	mRegionTypeText = getChild<LLTextBox>("region_type");
	mRegionRatingIcon = getChild<LLIconCtrl>("region_rating_icon");
	mRegionRatingText = getChild<LLTextBox>("region_rating");
	mRegionOwnerText = getChild<LLTextBox>("region_owner");
	mRegionGroupText = getChild<LLTextBox>("region_group");

	mEstateNameText = getChild<LLTextBox>("estate_name");
	mEstateRatingText = getChild<LLTextBox>("estate_rating");
	mEstateOwnerText = getChild<LLTextBox>("estate_owner");
	mCovenantText = getChild<LLTextEditor>("covenant");

	mSalesPriceText = getChild<LLTextBox>("sales_price");
	mAreaText = getChild<LLTextBox>("area");
	mTrafficText = getChild<LLTextBox>("traffic");
	mPrimitivesText = getChild<LLTextBox>("primitives");
	mParcelScriptsText = getChild<LLTextBox>("parcel_scripts");
	mTerraformLimitsText = getChild<LLTextBox>("terraform_limits");
	mSubdivideText = getChild<LLTextEditor>("subdivide");
	mResaleText = getChild<LLTextEditor>("resale");
	mSaleToText = getChild<LLTextBox>("sale_to");

	icon_pg = getString("icon_PG");
	icon_m = getString("icon_M");
	icon_r = getString("icon_R");
	icon_voice = getString("icon_Voice");
	icon_voice_no = getString("icon_VoiceNo");
	icon_fly = getString("icon_Fly");
	icon_fly_no = getString("icon_FlyNo");
	icon_push = getString("icon_Push");
	icon_push_no = getString("icon_PushNo");
	icon_build = getString("icon_Build");
	icon_build_no = getString("icon_BuildNo");
	icon_scripts = getString("icon_Scripts");
	icon_scripts_no = getString("icon_ScriptsNo");
	icon_damage = getString("icon_Damage");
	icon_damage_no = getString("icon_DamageNo");

	return TRUE;
}
示例#11
0
文件: Call.c 项目: sgonyea/ffi
void
rbffi_SetupCallParams(int argc, VALUE* argv, int paramCount, Type** paramTypes,
        FFIStorage* paramStorage, void** ffiValues,
        VALUE* callbackParameters, int callbackCount, VALUE enums)
{
    VALUE callbackProc = Qnil;
    FFIStorage* param = &paramStorage[0];
    int i, argidx, cbidx, argCount;

    if (unlikely(paramCount != -1 && paramCount != argc)) {
        if (argc == (paramCount - 1) && callbackCount == 1 && rb_block_given_p()) {
            callbackProc = rb_block_proc();
        } else {
            rb_raise(rb_eArgError, "wrong number of arguments (%d for %d)", argc, paramCount);
        }
    }

    argCount = paramCount != -1 ? paramCount : argc;

    for (i = 0, argidx = 0, cbidx = 0; i < argCount; ++i) {
        Type* paramType = paramTypes[i];
        int type;

        
        if (unlikely(paramType->nativeType == NATIVE_MAPPED)) {
            VALUE values[] = { argv[argidx], Qnil };
            argv[argidx] = rb_funcall2(((MappedType *) paramType)->rbConverter, id_to_native, 2, values);
            paramType = ((MappedType *) paramType)->type;
        }

        type = argidx < argc ? TYPE(argv[argidx]) : T_NONE;
        ffiValues[i] = param;

        switch (paramType->nativeType) {

            case NATIVE_INT8:
                param->s8 = NUM2INT(argv[argidx]);
                ++argidx;
                ADJ(param, INT8);
                break;


            case NATIVE_INT16:
                param->s16 = NUM2INT(argv[argidx]);
                ++argidx;
                ADJ(param, INT16);
                break;


            case NATIVE_INT32:
                if (unlikely(type == T_SYMBOL && enums != Qnil)) {
                    VALUE value = rb_funcall(enums, id_map_symbol, 1, argv[argidx]);
                    param->s32 = NUM2INT(value);

                } else {
                    param->s32 = NUM2INT(argv[argidx]);
                }

                ++argidx;
                ADJ(param, INT32);
                break;


            case NATIVE_BOOL:
                if (type != T_TRUE && type != T_FALSE) {
                    rb_raise(rb_eTypeError, "wrong argument type  (expected a boolean parameter)");
                }
                param->s8 = argv[argidx++] == Qtrue;
                ADJ(param, INT8);
                break;


            case NATIVE_UINT8:
                param->u8 = NUM2UINT(argv[argidx]);
                ADJ(param, INT8);
                ++argidx;
                break;


            case NATIVE_UINT16:
                param->u16 = NUM2UINT(argv[argidx]);
                ADJ(param, INT16);
                ++argidx;
                break;


            case NATIVE_UINT32:
                param->u32 = NUM2UINT(argv[argidx]);
                ADJ(param, INT32);
                ++argidx;
                break;


            case NATIVE_INT64:
                param->i64 = NUM2LL(argv[argidx]);
                ADJ(param, INT64);
                ++argidx;
                break;


            case NATIVE_UINT64:
                param->u64 = NUM2ULL(argv[argidx]);
                ADJ(param, INT64);
                ++argidx;
                break;

            case NATIVE_LONG:
                *(ffi_sarg *) param = NUM2LONG(argv[argidx]);
                ADJ(param, LONG);
                ++argidx;
                break;

            case NATIVE_ULONG:
                *(ffi_arg *) param = NUM2ULONG(argv[argidx]);
                ADJ(param, LONG);
                ++argidx;
                break;

            case NATIVE_FLOAT32:
                param->f32 = (float) NUM2DBL(argv[argidx]);
                ADJ(param, FLOAT32);
                ++argidx;
                break;

            case NATIVE_FLOAT64:
                param->f64 = NUM2DBL(argv[argidx]);
                ADJ(param, FLOAT64);
                ++argidx;
                break;


            case NATIVE_STRING:
                param->ptr = getString(argv[argidx++], type);
                ADJ(param, ADDRESS);
                break;

            case NATIVE_POINTER:
            case NATIVE_BUFFER_IN:
            case NATIVE_BUFFER_OUT:
            case NATIVE_BUFFER_INOUT:
                param->ptr = getPointer(argv[argidx++], type);
                ADJ(param, ADDRESS);
                break;


            case NATIVE_FUNCTION:
            case NATIVE_CALLBACK:
                if (callbackProc != Qnil) {
                    param->ptr = callback_param(callbackProc, callbackParameters[cbidx++]);
                } else {
                    param->ptr = callback_param(argv[argidx], callbackParameters[cbidx++]);
                    ++argidx;
                }
                ADJ(param, ADDRESS);
                break;

            case NATIVE_STRUCT:
                ffiValues[i] = getPointer(argv[argidx++], type);
                break;

            default:
                rb_raise(rb_eArgError, "Invalid parameter type: %d", paramType->nativeType);
        }
    }
}
void LLPanelPlaceProfile::displaySelectedParcelInfo(LLParcel* parcel,
													LLViewerRegion* region,
													const LLVector3d& pos_global,
													bool is_current_parcel)
{
	if (!region || !parcel)
		return;

	// send EstateCovenantInfo message
	LLMessageSystem *msg = gMessageSystem;
	msg->newMessage("EstateCovenantRequest");
	msg->nextBlockFast(_PREHASH_AgentData);
	msg->addUUIDFast(_PREHASH_AgentID,	gAgent.getID());
	msg->addUUIDFast(_PREHASH_SessionID,gAgent.getSessionID());
	msg->sendReliable(region->getHost());

	LLParcelData parcel_data;

	// HACK: Converting sim access flags to the format
	// returned by remote parcel response.
	U8 sim_access = region->getSimAccess();
	switch(sim_access)
	{
	case SIM_ACCESS_MATURE:
		parcel_data.flags = 0x1;

		mParcelRatingIcon->setValue(icon_m);
		mRegionRatingIcon->setValue(icon_m);
		break;

	case SIM_ACCESS_ADULT:
		parcel_data.flags = 0x2;

		mParcelRatingIcon->setValue(icon_r);
		mRegionRatingIcon->setValue(icon_r);
		break;

	default:
		parcel_data.flags = 0;

		mParcelRatingIcon->setValue(icon_pg);
		mRegionRatingIcon->setValue(icon_pg);
	}

	std::string rating = LLViewerRegion::accessToString(sim_access);
	mParcelRatingText->setText(rating);
	mRegionRatingText->setText(rating);

	parcel_data.desc = parcel->getDesc();
	parcel_data.name = parcel->getName();
	parcel_data.sim_name = region->getName();
	parcel_data.snapshot_id = parcel->getSnapshotID();
	mPosRegion.setVec((F32)fmod(pos_global.mdV[VX], (F64)REGION_WIDTH_METERS),
					  (F32)fmod(pos_global.mdV[VY], (F64)REGION_WIDTH_METERS),
					  (F32)pos_global.mdV[VZ]);
	parcel_data.global_x = pos_global.mdV[VX];
	parcel_data.global_y = pos_global.mdV[VY];
	parcel_data.global_z = pos_global.mdV[VZ];

	std::string on = getString("on");
	std::string off = getString("off");

	LLViewerParcelMgr* vpm = LLViewerParcelMgr::getInstance();

	// Processing parcel characteristics
	if (vpm->allowAgentVoice(region, parcel))
	{
		mVoiceIcon->setValue(icon_voice);
		mVoiceText->setText(on);
	}
	else
	{
		mVoiceIcon->setValue(icon_voice_no);
		mVoiceText->setText(off);
	}

	if (vpm->allowAgentFly(region, parcel))
	{
		mFlyIcon->setValue(icon_fly);
		mFlyText->setText(on);
	}
	else
	{
		mFlyIcon->setValue(icon_fly_no);
		mFlyText->setText(off);
	}

	if (vpm->allowAgentPush(region, parcel))
	{
		mPushIcon->setValue(icon_push);
		mPushText->setText(on);
	}
	else
	{
		mPushIcon->setValue(icon_push_no);
		mPushText->setText(off);
	}

	if (vpm->allowAgentBuild(parcel))
	{
		mBuildIcon->setValue(icon_build);
		mBuildText->setText(on);
	}
	else
	{
		mBuildIcon->setValue(icon_build_no);
		mBuildText->setText(off);
	}

	if (vpm->allowAgentScripts(region, parcel))
	{
		mScriptsIcon->setValue(icon_scripts);
		mScriptsText->setText(on);
	}
	else
	{
		mScriptsIcon->setValue(icon_scripts_no);
		mScriptsText->setText(off);
	}

	if (vpm->allowAgentDamage(region, parcel))
	{
		mDamageIcon->setValue(icon_damage);
		mDamageText->setText(on);
	}
	else
	{
		mDamageIcon->setValue(icon_damage_no);
		mDamageText->setText(off);
	}

	mRegionNameText->setText(region->getName());
	mRegionTypeText->setText(region->getSimProductName());

	// Determine parcel owner
	if (parcel->isPublic())
	{
		mParcelOwner->setText(getString("public"));
		mRegionOwnerText->setText(getString("public"));
	}
	else
	{
		if (parcel->getIsGroupOwned())
		{
			mRegionOwnerText->setText(getString("group_owned_text"));

			if(!parcel->getGroupID().isNull())
			{
				// FIXME: Using parcel group as region group.
				gCacheName->get(parcel->getGroupID(), TRUE,
								boost::bind(&LLPanelPlaceInfo::nameUpdatedCallback, mRegionGroupText, _2, _3));

				gCacheName->get(parcel->getGroupID(), TRUE,
								boost::bind(&LLPanelPlaceInfo::nameUpdatedCallback, mParcelOwner, _2, _3));
			}
			else
			{
				std::string owner = getString("none_text");
				mRegionGroupText->setText(owner);
				mParcelOwner->setText(owner);
			}
		}
		else
		{
			// Figure out the owner's name
			gCacheName->get(parcel->getOwnerID(), FALSE,
							boost::bind(&LLPanelPlaceInfo::nameUpdatedCallback, mParcelOwner, _2, _3));
			gCacheName->get(region->getOwner(), FALSE,
							boost::bind(&LLPanelPlaceInfo::nameUpdatedCallback, mRegionOwnerText, _2, _3));
		}

		if(LLParcel::OS_LEASE_PENDING == parcel->getOwnershipStatus())
		{
			mRegionOwnerText->setText(mRegionOwnerText->getText() + getString("sale_pending_text"));
		}
	}

	mEstateRatingText->setText(region->getSimAccessString());

	S32 area;
	S32 claim_price;
	S32 rent_price;
	F32 dwell;
	BOOL for_sale;
	vpm->getDisplayInfo(&area, &claim_price, &rent_price, &for_sale, &dwell);
	if (for_sale)
	{
		const LLUUID& auth_buyer_id = parcel->getAuthorizedBuyerID();
		if(auth_buyer_id.notNull())
		{
			gCacheName->get(auth_buyer_id, TRUE,
							boost::bind(&LLPanelPlaceInfo::nameUpdatedCallback, mSaleToText, _2, _3));

			// Show sales info to a specific person or a group he belongs to.
			if (auth_buyer_id != gAgent.getID() && !gAgent.isInGroup(auth_buyer_id))
			{
				for_sale = FALSE;
			}
		}
		else
		{
			mSaleToText->setText(getString("anyone"));
		}

		mForSalePanel->setVisible(for_sale);

		const U8* sign = (U8*)getString("price_text").c_str();
		const U8* sqm = (U8*)getString("area_text").c_str();

		mSalesPriceText->setText(llformat("%s%d ", sign, parcel->getSalePrice()));
		mAreaText->setText(llformat("%d %s", area, sqm));
		mTrafficText->setText(llformat("%.0f", dwell));

		// Can't have more than region max tasks, regardless of parcel
		// object bonus factor.
		S32 primitives = llmin(llround(parcel->getMaxPrimCapacity() * parcel->getParcelPrimBonus()),
							   (S32)region->getMaxTasks());

		const U8* available = (U8*)getString("available").c_str();
		const U8* allocated = (U8*)getString("allocated").c_str();

		mPrimitivesText->setText(llformat("%d %s, %d %s", primitives, available, parcel->getPrimCount(), allocated));

		if (parcel->getAllowOtherScripts())
		{
			mParcelScriptsText->setText(getString("all_residents_text"));
		}
		else if (parcel->getAllowGroupScripts())
		{
			mParcelScriptsText->setText(getString("group_text"));
		}
		else
		{
			mParcelScriptsText->setText(off);
		}

		mTerraformLimitsText->setText(parcel->getAllowTerraform() ? on : off);

		if (region->getRegionFlags() & REGION_FLAGS_ALLOW_PARCEL_CHANGES)
		{
			mSubdivideText->setText(getString("can_change"));
		}
		else
		{
			mSubdivideText->setText(getString("can_not_change"));
		}
		if (region->getRegionFlags() & REGION_FLAGS_BLOCK_LAND_RESELL)
		{
			mResaleText->setText(getString("can_not_resell"));
		}
		else
		{
			mResaleText->setText(getString("can_resell"));
		}
	}

	mSelectedParcelID = parcel->getLocalID();
	mLastSelectedRegionID = region->getRegionID();
	LLPanelPlaceInfo::processParcelInfo(parcel_data);

	mYouAreHerePanel->setVisible(is_current_parcel);
	getChild<LLAccordionCtrlTab>("sales_tab")->setVisible(for_sale);
}
示例#13
0
bool Properties::getColor(const char* name, Vec4* out) const
{
    return parseColor(getString(name), out);
}
示例#14
0
bool Properties::getQuaternionFromAxisAngle(const char* name, Quaternion* out) const
{
    return parseAxisAngle(getString(name), out);
}
示例#15
0
// Default constructor
LLFloaterAbout::LLFloaterAbout() 
:	LLFloater(std::string("floater_about"), std::string("FloaterAboutRect"), LLStringUtil::null)
{
	LLUICtrlFactory::getInstance()->buildFloater(this, "floater_about.xml");

	// Support for changing product name.
	std::string title("About ");
	title += LLAppViewer::instance()->getSecondLifeTitle();
	setTitle(title);

	LLViewerTextEditor *support_widget = 
		getChild<LLViewerTextEditor>("support_editor", true);

	LLViewerTextEditor *credits_widget = 
		getChild<LLViewerTextEditor>("credits_editor", true);


	if (!support_widget || !credits_widget)
	{
		return;
	}

	// For some reason, adding style doesn't work unless this is true.
	support_widget->setParseHTML(TRUE);

	// Text styles for release notes hyperlinks
	LLStyleSP viewer_link_style(new LLStyle);
	viewer_link_style->setVisible(true);
	viewer_link_style->setFontName(LLStringUtil::null);
	viewer_link_style->setLinkHREF(get_viewer_release_notes_url());
	viewer_link_style->setColor(gSavedSettings.getColor4("HTMLLinkColor"));

	// Version string
	std::string version = std::string(LLAppViewer::instance()->getSecondLifeTitle()
		+ llformat(" %d.%d.%d (%d) %s %s (%s)\n",
		LL_VERSION_MAJOR, LL_VERSION_MINOR, LL_VERSION_PATCH, LL_VIEWER_BUILD,
		__DATE__, __TIME__,
		LL_CHANNEL));
	support_widget->appendColoredText(version, FALSE, FALSE, gColors.getColor("TextFgReadOnlyColor"));
	support_widget->appendStyledText(LLTrans::getString("ReleaseNotes"), false, false, viewer_link_style);

	std::string support;
	support.append("\n\n");

#if LL_MSVC
    support.append(llformat("Built with MSVC version %d\n\n", _MSC_VER));
#endif

#if LL_GNUC
    support.append(llformat("Built with GCC version %d\n\n", GCC_VERSION));
#endif

	// Position
	LLViewerRegion* region = gAgent.getRegion();
	if (region)
	{
		LLStyleSP server_link_style(new LLStyle);
		server_link_style->setVisible(true);
		server_link_style->setFontName(LLStringUtil::null);
		server_link_style->setLinkHREF(region->getCapability("ServerReleaseNotes"));
		server_link_style->setColor(gSavedSettings.getColor4("HTMLLinkColor"));

		const LLVector3d &pos = gAgent.getPositionGlobal();
		LLUIString pos_text = getString("you_are_at");
		pos_text.setArg("[POSITION]",
						llformat("%.1f, %.1f, %.1f ", pos.mdV[VX], pos.mdV[VY], pos.mdV[VZ]));
		support.append(pos_text);

		std::string region_text = llformat("in %s located at ",
										gAgent.getRegion()->getName().c_str());
		support.append(region_text);

		std::string buffer;
		buffer = gAgent.getRegion()->getHost().getHostName();
		support.append(buffer);
		support.append(" (");
		buffer = gAgent.getRegion()->getHost().getString();
		support.append(buffer);
		support.append(")\n");
		support.append(gLastVersionChannel);
		support.append("\n");

		support_widget->appendColoredText(support, FALSE, FALSE, gColors.getColor("TextFgReadOnlyColor"));
		support_widget->appendStyledText(LLTrans::getString("ReleaseNotes"), false, false, server_link_style);

		support = "\n\n";
	}

	// *NOTE: Do not translate text like GPU, Graphics Card, etc -
	//  Most PC users that know what these mean will be used to the english versions,
	//  and this info sometimes gets sent to support
	
	// CPU
	support.append("CPU: ");
	support.append( gSysCPU.getCPUString() );
	support.append("\n");

	U32 memory = gSysMemory.getPhysicalMemoryKB() / 1024;
	// Moved hack adjustment to Windows memory size into llsys.cpp

	std::string mem_text = llformat("Memory: %u MB\n", memory );
	support.append(mem_text);

	support.append("OS Version: ");
	support.append( LLAppViewer::instance()->getOSInfo().getOSString() );
	support.append("\n");

	support.append("Graphics Card Vendor: ");
	support.append( (const char*) glGetString(GL_VENDOR) );
	support.append("\n");

	support.append("Graphics Card: ");
	support.append( (const char*) glGetString(GL_RENDERER) );
	support.append("\n");

#if LL_WINDOWS
    getWindow()->incBusyCount();
    getWindow()->setCursor(UI_CURSOR_ARROW);
    support.append("Windows Graphics Driver Version: ");
    LLSD driver_info = gDXHardware.getDisplayInfo();
    if (driver_info.has("DriverVersion"))
    {
        support.append(driver_info["DriverVersion"]);
    }
    support.append("\n");
    getWindow()->decBusyCount();
    getWindow()->setCursor(UI_CURSOR_ARROW);
#endif

	support.append("OpenGL Version: ");
	support.append( (const char*) glGetString(GL_VERSION) );
	support.append("\n");

	support.append("\n");

	support.append("libcurl Version: ");
	support.append( LLCurl::getVersionString() );
	support.append("\n");

	support.append("J2C Decoder Version: ");
	support.append( LLImageJ2C::getEngineInfo() );
	support.append("\n");

	support.append("Audio Driver Version: ");
	bool want_fullname = true;
	support.append( gAudiop ? gAudiop->getDriverName(want_fullname) : "(none)" );
	support.append("\n");

	// TODO: Implement media plugin version query

	support.append("Qt Webkit Version: 4.5.2 ");
	support.append("\n");

	if (gPacketsIn > 0)
	{
		std::string packet_loss = llformat("Packets Lost: %.0f/%.0f (%.1f%%)", 
			LLViewerStats::getInstance()->mPacketsLostStat.getCurrent(),
			F32(gPacketsIn),
			100.f*LLViewerStats::getInstance()->mPacketsLostStat.getCurrent() / F32(gPacketsIn) );
		support.append(packet_loss);
		support.append("\n");
	}

	support_widget->appendColoredText(support, FALSE, FALSE, gColors.getColor("TextFgReadOnlyColor"));

	// Fix views
	support_widget->setCursorPos(0);
	support_widget->setEnabled(FALSE);
	support_widget->setTakesFocus(TRUE);
	support_widget->setHandleEditKeysDirectly(TRUE);

	credits_widget->setCursorPos(0);
	credits_widget->setEnabled(FALSE);
	credits_widget->setTakesFocus(TRUE);
	credits_widget->setHandleEditKeysDirectly(TRUE);

	center();

	sInstance = this;
}
BOOL LLPanelGroupGeneral::postBuild()
{
	bool recurse = true;

	mEditCharter = getChild<LLTextEditor>("charter", recurse);
	if(mEditCharter)
	{
		mEditCharter->setCommitCallback(onCommitAny, this);
		mEditCharter->setFocusReceivedCallback(boost::bind(onFocusEdit, _1, this));
		mEditCharter->setFocusChangedCallback(boost::bind(onFocusEdit, _1, this));
	}



	mListVisibleMembers = getChild<LLNameListCtrl>("visible_members", recurse);
	if (mListVisibleMembers)
	{
		mListVisibleMembers->setDoubleClickCallback(openProfile, this);
		mListVisibleMembers->setContextMenu(LLScrollListCtrl::MENU_AVATAR);
		
		mListVisibleMembers->setSortCallback(boost::bind(&LLPanelGroupGeneral::sortMembersList,this,_1,_2,_3));
	}

	// Options
	mCtrlShowInGroupList = getChild<LLCheckBoxCtrl>("show_in_group_list", recurse);
	if (mCtrlShowInGroupList)
	{
		mCtrlShowInGroupList->setCommitCallback(onCommitAny, this);
	}

	mComboMature = getChild<LLComboBox>("group_mature_check", recurse);	
	if(mComboMature)
	{
		mComboMature->setCurrentByIndex(0);
		mComboMature->setCommitCallback(onCommitAny, this);
		if (gAgent.isTeen())
		{
			// Teens don't get to set mature flag. JC
			mComboMature->setVisible(FALSE);
			mComboMature->setCurrentByIndex(NON_MATURE_CONTENT);
		}
	}
	mCtrlOpenEnrollment = getChild<LLCheckBoxCtrl>("open_enrollement", recurse);
	if (mCtrlOpenEnrollment)
	{
		mCtrlOpenEnrollment->setCommitCallback(onCommitAny, this);
	}

	mCtrlEnrollmentFee = getChild<LLCheckBoxCtrl>("check_enrollment_fee", recurse);
	if (mCtrlEnrollmentFee)
	{
		mCtrlEnrollmentFee->setCommitCallback(onCommitEnrollment, this);
	}

	mSpinEnrollmentFee = getChild<LLSpinCtrl>("spin_enrollment_fee", recurse);
	if (mSpinEnrollmentFee)
	{
		mSpinEnrollmentFee->setCommitCallback(onCommitAny, this);
		mSpinEnrollmentFee->setPrecision(0);
		mSpinEnrollmentFee->resetDirty();
	}

	BOOL accept_notices = FALSE;
	BOOL list_in_profile = FALSE;
	LLGroupData data;
	if(gAgent.getGroupData(mGroupID,data))
	{
		accept_notices = data.mAcceptNotices;
		list_in_profile = data.mListInProfile;
	}
	mCtrlReceiveNotices = getChild<LLCheckBoxCtrl>("receive_notices", recurse);
	if (mCtrlReceiveNotices)
	{
		mCtrlReceiveNotices->setCommitCallback(onCommitUserOnly, this);
		mCtrlReceiveNotices->set(accept_notices);
		mCtrlReceiveNotices->setEnabled(data.mID.notNull());
	}
	
	mCtrlListGroup = getChild<LLCheckBoxCtrl>("list_groups_in_profile", recurse);
	if (mCtrlListGroup)
	{
		mCtrlListGroup->setCommitCallback(onCommitUserOnly, this);
		mCtrlListGroup->set(list_in_profile);
		mCtrlListGroup->setEnabled(data.mID.notNull());
		mCtrlListGroup->resetDirty();
	}

	mActiveTitleLabel = getChild<LLTextBox>("active_title_label", recurse);
	
	mComboActiveTitle = getChild<LLComboBox>("active_title", recurse);
	if (mComboActiveTitle)
	{
		mComboActiveTitle->setCommitCallback(onCommitTitle, this);
		mComboActiveTitle->resetDirty();
	}

	mIncompleteMemberDataStr = getString("incomplete_member_data_str");

	// If the group_id is null, then we are creating a new group
	if (mGroupID.isNull())
	{
		mEditCharter->setEnabled(TRUE);

		mCtrlShowInGroupList->setEnabled(TRUE);
		mComboMature->setEnabled(TRUE);
		mCtrlOpenEnrollment->setEnabled(TRUE);
		mCtrlEnrollmentFee->setEnabled(TRUE);
		mSpinEnrollmentFee->setEnabled(TRUE);

	}

	return LLPanelGroupTab::postBuild();
}
示例#17
0
文件: stackF.c 项目: Kegeruneku/nife
void execCod(void *A)
{
int i,n, ea, Ea, *ai, InDo=0, OnErr=0, mFCTP;
long L, P;
char * C, *D, *F, *W, *S, *ADo_Next, *ADo_Leave;
void * T, *T2;
void (*f)(void);
struct Fct * FR;

    /* printf("pid = %d ITASK=%d FctInTask=%d\n",getpid(),ITASK,FctInTask);*/
    if (FctInTask) {
        if (ITASK==0) {
           if (FctInTask==-1) {
              FctInTask=0; return;
           }
           if (MakeTask(A)) return;
        }
        if (ITASK!=FctInTask) return;
    }
    D_Cod++;
    ai = (int*)A;
    i = *ai++;
    ea = *ai++;
    Ea = *ai;
    if (ea) tellOnErr(A);
    C = (char*)A+(3*sizeof(int));
    D = C;
    F = C+i;
    n = sizeof(T);
    while (C <= F) {
       /* printf("execCod : %s %d - %x : %ld\n",
              codByAddr(A),(int)(C-D),*C,(long)*(C+1));
       */
       if (noErr() && ((C==F) || ((Code)*C != T_ONER)) ) { /* to find onerr: */
          if (ea && (OnErr==0)) {
             C = D+ea;
          }  else {
             printf("Called in %s err=%d i=%d/%d cod=<%x>\n",
                    codByAddr(A),noErr(),(int)(C-D),i,*C);
             break; /* end of while */
          }
       }
       if (C==F) break; /* end of code */
       switch((Code)*C) {
       case T_ONER :
           if (noErr()==0) { /* jmp end: */
               if (Ea) C = D+Ea;
               else C = F; /* to break */
           } else {
             if (OnErr==0) {
                OnErr=1;
                majLastErr(A);
                razErr();
             } else C = F;
           }
           break;
       case T_RET :
           C = F; /* to break */
           break;
       case T_END :
           break; /* nothing */
       case T_JEND :
           if (Ea) C = D+Ea;
           else C = F; /* to break */
           break;
       case T_NUM :
           bcopy((void*)(C+1),(void*)&T,n);
           insertVal(T);
           break;
       case T_CHA :
           bcopy((void*)(C+1),(void*)&W,n);
           putString(W);
           break;
       case T_LIB :
           if (InstallOn) {
              if (InstallOn < 3) {
                 bcopy((void*)(C+1),(void*)&T,n);
                 _MODIF_FCT_INST_(T);
                 _MODIF_FCT_TYP_(1);
              } else {
                 _MODIF_FCT_INST_(VIDE);
                 _MODIF_FCT_TYP_(0);
              }
              InstallOn=0;
           } else {
              bcopy((void*)(C+1),(void*)&f,n);
              f();
              /* free context loops */
              if (Do_Evts) { /* quit or cut */
                 /*printf("execCod T_LIB : Evts %d\n",Do_Evts);*/
                 if (InDo) {
                    if (Do_Evts>0) {
                       C=ADo_Leave;
                       I_DO--;
                       InDo = 0;
                       Do_Evts--;
                    } else {
                       C=ADo_Next;
                       Do_Evts=0;
                    }
                 } else { /* quit */
                    C = F;
                 }
              }
           }
           break;
       case T_FCT :
           if (InstallOn) {
              if (InstallOn < 3) {
                 bcopy((void*)(C+1),(void*)&T,n);
                 T2=fctByCode(T);
                 _MODIF_FCT_INST_(T2);
                 _MODIF_FCT_TYP_(2);
              } else {
                 _MODIF_FCT_INST_(VIDE);
                 _MODIF_FCT_TYP_(0);
              }
              InstallOn=0;
           } else {
              bcopy((void*)(C+1),(void*)&T,n);
              execCod(T);
              /* free context loops */
              if (Do_Evts) { /* quit or cut */
                 /*printf("execCod T_FCT : Evts %d\n",Do_Evts);*/
                 if (InDo) {
                    if (Do_Evts>0) {
                       C=ADo_Leave;
                       I_DO--;
                       InDo = 0;
                       Do_Evts--;
                    } else {
                       C=ADo_Next;
                       Do_Evts=0;
                    }
                 } else { /* quit */
                    C = F;
                 }
              }
           }
           break;
       case T_FCTDS :
       case T_EXEKS :
           if ((S = getString()) != NULL)
              free((void*)S); /* remove the string */
           break;
       case T_FCTD :
           if ((S = getString()) != NULL)
              free((void*)S); /* remove the string */
           if (noErr()) break;
       case T_FCTDW :
       case T_FCTP :
              bcopy((void*)(C+1),(void*)&T,n);
              FR = (struct Fct *)T;
              execCod(FR->c);
              /* free context loops */
              if (Do_Evts) { /* quit or cut */
                 /*printf("execCod T_FCTD : Evts %d\n",Do_Evts);*/
                 if (InDo) {
                    if (Do_Evts>0) {
                       C=ADo_Leave;
                       I_DO--;
                       InDo = 0;
                       Do_Evts--;
                    } else {
                       C=ADo_Next;
                       Do_Evts=0;
                    }
                 } else { /* quit */
                    C = F;
                 }
              }
           if (*C == T_FCTP) {
              if (mFCTP) *C = T_FCTDW;
              else *C = T_FCTD;
           }
           break;
       case T_EXEK :
           if ((S = getString()) != NULL) {
              if (strlen(S)>0) { /* to do with T_FCTD */
                 mFCTP=0;
                 T = makeFunction(S);
                 if (T != VIDE) {
                    bcopy((void*)&T, (void*)(C+1),n);
                    *C = T_FCTP;
                    C -= (n+1);
                    unlinkLastFct();
                    /* upgrading precedent code ? not always ! */
                    if (C >= D) {
                       if (*C == T_CHA) { /* case of a string */
                          *C = T_CHAS;
                          mFCTP=1;
                       }
                       if (*C == T_VAR) { /* case of a variable string */
                          bcopy((void*)(C+1),(void*)&W,n);
                          if (isVarChar(W)) {
                             *C = T_VARS;
                             mFCTP=1;
                          }
                       }
                    }
                 } else /* error in compilation */
                    *C = T_EXEKS;
              }
              free((void*)S); 
           }
           break;
       case T_IF :
           if (!getBool()) {
               bcopy((void*)(C+1),(void*)&L,n);
               C += L;
           }
           break;
       case T_IFN :
           if (getBool()) {
               bcopy((void*)(C+1),(void*)&L,n);
               C += L;
           }
           break;
       case T_DO :
           I_DO++;
           InDo=1;
           /* maj do_adresses */
           W = C + (2*(n+1));
           bcopy((void*)(W+1),(void*)&L,n);
           ADo_Leave=D+L-n-1;
           ADo_Next=ADo_Leave-(2*(n+1));
           /* printf("execCod T_DO : AL= %d AN=%d\n",
                (int)(ADo_Leave-D), (int)(ADo_Next-D));*/
           getParLong(&P);
           D_DO[I_DO] = P;
           getParLong(&P);
           L_DO[I_DO] = P;
           if (P > D_DO[I_DO]) S_DO[I_DO]=0;
           else S_DO[I_DO]=1;
           break;
       case T_DO_I :
           IF_getIndDo(0);
           break;
       case T_DO_J :
           IF_getIndDo(1);
           break;
       case T_DO_K :
           IF_getIndDo(2);
           break;
       case T_IFD :
           if (S_DO[I_DO]) {
             if (D_DO[I_DO] > L_DO[I_DO]) {
               bcopy((void*)(C+1),(void*)&L,n);
               C += L;
             } else {
               I_DO--;
               InDo=0;
             }
           } else {
             if (D_DO[I_DO] < L_DO[I_DO]) {
               bcopy((void*)(C+1),(void*)&L,n);
               C += L;
             } else {
               I_DO--;
               InDo=0;
             }
           }
           break;
       case T_LOOP :
           if (S_DO[I_DO]) D_DO[I_DO]--;
           else D_DO[I_DO]++;
           break;
       case T_PLOO :
           getParLong(&P);
           D_DO[I_DO]+=P;
           break;
       case T_JMP :
           bcopy((void*)(C+1),(void*)&L,n);
           C += L;
           break;
       case T_GOTO :
           bcopy((void*)(C+1),(void*)&L,n);
           C = D + L - n-1;
           break;
       case T_VAR  :
           if (InstallOn) {
              if (InstallOn  == 3) {
                 bcopy((void*)(C+1),(void*)&T,n);
                 _MODIF_FCT_INST_(T);
                 _MODIF_FCT_TYP_(3);
              } else {
                 _MODIF_FCT_INST_(VIDE);
                 _MODIF_FCT_TYP_(0);
              }
              InstallOn=0;
           } else {
              bcopy((void*)(C+1),(void*)&W,n);
              executeVar(W);
              /* free context loops */
              if (Do_Evts) { /* quit or cut */
                 /*printf("execCod T_VAR : Evts %d\n",Do_Evts);*/
                 if (InDo) {
                    if (Do_Evts>0) {
                       C=ADo_Leave;
                       I_DO--;
                       InDo = 0;
                       Do_Evts--;
                    } else {
                       C=ADo_Next;
                       Do_Evts=0;
                    }
                 } else { /* quit */
                    C = F;
                 }
              }
           }
           break;
       case T_BKC :
           bcopy((void*)(C+1),(void*)&W,n);
           execLib(W);
           break;
       case T_BKC1 : /* like makeFct */
           bcopy((void*)(C+1),(void*)&W,n);
           /* try to modify the code */
           if (VARS==2) { /* VARS UP */
              if ((T = varByName(W)) != VIDE) {
                 *C = T_VAR;
              } else {
                 if ((T = fctByName(W)) != VIDE) {
                    *C = T_FCT;
                    FR = (struct Fct *)T;
                    T = FR->c;
                 }
              }
           } else {
              if ((T = fctByName(W)) != VIDE) {
                 *C = T_FCT;
                 FR = (struct Fct *)T;
                 T = FR->c;
              } else {
                 if ((VARS==1) && ((T = varByName(W)) != VIDE)) {
                    *C = T_VAR;
                 }
              }
           }
           if ((Code)*C != T_BKC1) { /* code is updated */
              bcopy((void*)&T, (void*)(C+1),n);
              C-=(n+1);       /* it must be executed */
           }
           break;
       case T_NOP :
       case T_CHAS :
       case T_VARS :
       case T_FCTDWS :
           break;
       default :
           messErr(11);
       }
       C+= n+1;
    }
    D_Cod--;
    if (ea) tellOnErr(VIDE);
}
void SpeakerDictionary_XMLHandler::error(const SAXParseException& e)
{
	cerr << "WARNING: " << getString(e.getMessage()) << endl;
	cerr << " at line " << e.getLineNumber () << " col " << e.getColumnNumber () << endl;
}
示例#19
0
 std::string CoilCoolingWater_Impl::heatExchangerConfiguration()
 {
   return getString( openstudio::OS_Coil_Cooling_WaterFields::HeatExchangerConfiguration,true ).get();
 }
void SpeakerDictionary_XMLHandler::fatalError(const SAXParseException& e)
{
	cerr << "ERROR: " << getString(e.getMessage()) << endl;
	cerr << " at line " << e.getLineNumber () << " col " << e.getColumnNumber () << endl;
	throw getString(e.getMessage()).c_str();
}
 std::string CurveExponentialSkewNormal_Impl::outputUnitType() const {
   boost::optional<std::string> value = getString(OS_Curve_ExponentialSkewNormalFields::OutputUnitType,true);
   OS_ASSERT(value);
   return value.get();
 }
示例#22
0
文件: script.cpp 项目: Fyre91/scummvm
bool ScScript::initTables() {
	uint32 origIP = _iP;

	readHeader();
	// load symbol table
	_iP = _header.symbolTable;

	_numSymbols = getDWORD();
	_symbols = new char*[_numSymbols];
	for (uint32 i = 0; i < _numSymbols; i++) {
		uint32 index = getDWORD();
		_symbols[index] = getString();
	}

	// load functions table
	_iP = _header.funcTable;

	_numFunctions = getDWORD();
	_functions = new TFunctionPos[_numFunctions];
	for (uint32 i = 0; i < _numFunctions; i++) {
		_functions[i].pos = getDWORD();
		_functions[i].name = getString();
	}


	// load events table
	_iP = _header.eventTable;

	_numEvents = getDWORD();
	_events = new TEventPos[_numEvents];
	for (uint32 i = 0; i < _numEvents; i++) {
		_events[i].pos = getDWORD();
		_events[i].name = getString();
	}


	// load externals
	if (_header.version >= 0x0101) {
		_iP = _header.externalsTable;

		_numExternals = getDWORD();
		_externals = new TExternalFunction[_numExternals];
		for (uint32 i = 0; i < _numExternals; i++) {
			_externals[i].dll_name = getString();
			_externals[i].name = getString();
			_externals[i].call_type = (TCallType)getDWORD();
			_externals[i].returns = (TExternalType)getDWORD();
			_externals[i].nu_params = getDWORD();
			if (_externals[i].nu_params > 0) {
				_externals[i].params = new TExternalType[_externals[i].nu_params];
				for (int j = 0; j < _externals[i].nu_params; j++) {
					_externals[i].params[j] = (TExternalType)getDWORD();
				}
			}
		}
	}

	// load method table
	_iP = _header.methodTable;

	_numMethods = getDWORD();
	_methods = new TMethodPos[_numMethods];
	for (uint32 i = 0; i < _numMethods; i++) {
		_methods[i].pos = getDWORD();
		_methods[i].name = getString();
	}


	_iP = origIP;

	return STATUS_OK;
}
示例#23
0
 std::string GeneratorPVWatts_Impl::arrayType() const {
   boost::optional<std::string> value = getString(OS_Generator_PVWattsFields::ArrayType, true);
   OS_ASSERT(value);
   return value.get();
 }
示例#24
0
文件: script.cpp 项目: Fyre91/scummvm
bool ScScript::executeInstruction() {
	bool ret = STATUS_OK;

	uint32 dw;
	const char *str = nullptr;

	//ScValue* op = new ScValue(_gameRef);
	_operand->cleanup();

	ScValue *op1;
	ScValue *op2;

	uint32 inst = getDWORD();
	switch (inst) {

	case II_DEF_VAR:
		_operand->setNULL();
		dw = getDWORD();
		if (_scopeStack->_sP < 0) {
			_globals->setProp(_symbols[dw], _operand);
		} else {
			_scopeStack->getTop()->setProp(_symbols[dw], _operand);
		}

		break;

	case II_DEF_GLOB_VAR:
	case II_DEF_CONST_VAR: {
		dw = getDWORD();
		/*      char *temp = _symbols[dw]; // TODO delete */
		// only create global var if it doesn't exist
		if (!_engine->_globals->propExists(_symbols[dw])) {
			_operand->setNULL();
			_engine->_globals->setProp(_symbols[dw], _operand, false, inst == II_DEF_CONST_VAR);
		}
		break;
	}

	case II_RET:
		if (_scopeStack->_sP >= 0 && _callStack->_sP >= 0) {
			_scopeStack->pop();
			_iP = (uint32)_callStack->pop()->getInt();
		} else {
			if (_thread) {
				_state = SCRIPT_THREAD_FINISHED;
			} else {
				if (_numEvents == 0 && _numMethods == 0) {
					_state = SCRIPT_FINISHED;
				} else {
					_state = SCRIPT_PERSISTENT;
				}
			}
		}

		break;

	case II_RET_EVENT:
		_state = SCRIPT_FINISHED;
		break;


	case II_CALL:
		dw = getDWORD();

		_operand->setInt(_iP);
		_callStack->push(_operand);

		_iP = dw;

		break;

	case II_CALL_BY_EXP: {
		// push var
		// push string
		str = _stack->pop()->getString();
		char *methodName = new char[strlen(str) + 1];
		strcpy(methodName, str);

		ScValue *var = _stack->pop();
		if (var->_type == VAL_VARIABLE_REF) {
			var = var->_valRef;
		}

		bool res = STATUS_FAILED;
		bool triedNative = false;

		// we are already calling this method, try native
		if (_thread && _methodThread && strcmp(methodName, _threadEvent) == 0 && var->_type == VAL_NATIVE && _owner == var->getNative()) {
			triedNative = true;
			res = var->_valNative->scCallMethod(this, _stack, _thisStack, methodName);
		}

		if (DID_FAIL(res)) {
			if (var->isNative() && var->getNative()->canHandleMethod(methodName)) {
				if (!_unbreakable) {
					_waitScript = var->getNative()->invokeMethodThread(methodName);
					if (!_waitScript) {
						_stack->correctParams(0);
						runtimeError("Error invoking method '%s'.", methodName);
						_stack->pushNULL();
					} else {
						_state = SCRIPT_WAITING_SCRIPT;
						_waitScript->copyParameters(_stack);
					}
				} else {
					// can call methods in unbreakable mode
					_stack->correctParams(0);
					runtimeError("Cannot call method '%s'. Ignored.", methodName);
					_stack->pushNULL();
				}
				delete[] methodName;
				break;
			}
			/*
			ScValue* val = var->getProp(MethodName);
			if (val) {
			    dw = GetFuncPos(val->getString());
			    if (dw==0) {
			        TExternalFunction* f = GetExternal(val->getString());
			        if (f) {
			            ExternalCall(_stack, _thisStack, f);
			        }
			        else{
			            // not an internal nor external, try for native function
			            _gameRef->ExternalCall(this, _stack, _thisStack, val->getString());
			        }
			    }
			    else{
			        _operand->setInt(_iP);
			        _callStack->Push(_operand);
			        _iP = dw;
			    }
			}
			*/
			else {
				res = STATUS_FAILED;
				if (var->_type == VAL_NATIVE && !triedNative) {
					res = var->_valNative->scCallMethod(this, _stack, _thisStack, methodName);
				}

				if (DID_FAIL(res)) {
					_stack->correctParams(0);
					runtimeError("Call to undefined method '%s'. Ignored.", methodName);
					_stack->pushNULL();
				}
			}
		}
		delete[] methodName;
	}
	break;

	case II_EXTERNAL_CALL: {
		uint32 symbolIndex = getDWORD();

		TExternalFunction *f = getExternal(_symbols[symbolIndex]);
		if (f) {
			externalCall(_stack, _thisStack, f);
		} else {
			_gameRef->externalCall(this, _stack, _thisStack, _symbols[symbolIndex]);
		}

		break;
	}
	case II_SCOPE:
		_operand->setNULL();
		_scopeStack->push(_operand);
		break;

	case II_CORRECT_STACK:
		dw = getDWORD(); // params expected
		_stack->correctParams(dw);
		break;

	case II_CREATE_OBJECT:
		_operand->setObject();
		_stack->push(_operand);
		break;

	case II_POP_EMPTY:
		_stack->pop();
		break;

	case II_PUSH_VAR: {
		ScValue *var = getVar(_symbols[getDWORD()]);
		if (false && /*var->_type==VAL_OBJECT ||*/ var->_type == VAL_NATIVE) {
			_operand->setReference(var);
			_stack->push(_operand);
		} else {
			_stack->push(var);
		}
		break;
	}

	case II_PUSH_VAR_REF: {
		ScValue *var = getVar(_symbols[getDWORD()]);
		_operand->setReference(var);
		_stack->push(_operand);
		break;
	}

	case II_POP_VAR: {
		char *varName = _symbols[getDWORD()];
		ScValue *var = getVar(varName);
		if (var) {
			ScValue *val = _stack->pop();
			if (!val) {
				runtimeError("Script stack corruption detected. Please report this script at WME bug reports forum.");
				var->setNULL();
			} else {
				if (val->getType() == VAL_VARIABLE_REF) {
					val = val->_valRef;
				}
				if (val->_type == VAL_NATIVE) {
					var->setValue(val);
				} else {
					var->copy(val);
				}
			}
		}

		break;
	}

	case II_PUSH_VAR_THIS:
		_stack->push(_thisStack->getTop());
		break;

	case II_PUSH_INT:
		_stack->pushInt((int)getDWORD());
		break;

	case II_PUSH_FLOAT:
		_stack->pushFloat(getFloat());
		break;


	case II_PUSH_BOOL:
		_stack->pushBool(getDWORD() != 0);

		break;

	case II_PUSH_STRING:
		_stack->pushString(getString());
		break;

	case II_PUSH_NULL:
		_stack->pushNULL();
		break;

	case II_PUSH_THIS_FROM_STACK:
		_operand->setReference(_stack->getTop());
		_thisStack->push(_operand);
		break;

	case II_PUSH_THIS:
		_operand->setReference(getVar(_symbols[getDWORD()]));
		_thisStack->push(_operand);
		break;

	case II_POP_THIS:
		_thisStack->pop();
		break;

	case II_PUSH_BY_EXP: {
		str = _stack->pop()->getString();
		ScValue *val = _stack->pop()->getProp(str);
		if (val) {
			_stack->push(val);
		} else {
			_stack->pushNULL();
		}

		break;
	}

	case II_POP_BY_EXP: {
		str = _stack->pop()->getString();
		ScValue *var = _stack->pop();
		ScValue *val = _stack->pop();

		if (val == nullptr) {
			runtimeError("Script stack corruption detected. Please report this script at WME bug reports forum.");
			var->setNULL();
		} else {
			var->setProp(str, val);
		}

		break;
	}

	case II_PUSH_REG1:
		_stack->push(_reg1);
		break;

	case II_POP_REG1:
		_reg1->copy(_stack->pop());
		break;

	case II_JMP:
		_iP = getDWORD();
		break;

	case II_JMP_FALSE: {
		dw = getDWORD();
		//if (!_stack->pop()->getBool()) _iP = dw;
		ScValue *val = _stack->pop();
		if (!val) {
			runtimeError("Script corruption detected. Did you use '=' instead of '==' for comparison?");
		} else {
			if (!val->getBool()) {
				_iP = dw;
			}
		}
		break;
	}

	case II_ADD:
		op2 = _stack->pop();
		op1 = _stack->pop();

		if (op1->isNULL() || op2->isNULL()) {
			_operand->setNULL();
		} else if (op1->getType() == VAL_STRING || op2->getType() == VAL_STRING) {
			char *tempStr = new char [strlen(op1->getString()) + strlen(op2->getString()) + 1];
			strcpy(tempStr, op1->getString());
			strcat(tempStr, op2->getString());
			_operand->setString(tempStr);
			delete[] tempStr;
		} else if (op1->getType() == VAL_INT && op2->getType() == VAL_INT) {
			_operand->setInt(op1->getInt() + op2->getInt());
		} else {
			_operand->setFloat(op1->getFloat() + op2->getFloat());
		}

		_stack->push(_operand);

		break;

	case II_SUB:
		op2 = _stack->pop();
		op1 = _stack->pop();

		if (op1->isNULL() || op2->isNULL()) {
			_operand->setNULL();
		} else if (op1->getType() == VAL_INT && op2->getType() == VAL_INT) {
			_operand->setInt(op1->getInt() - op2->getInt());
		} else {
			_operand->setFloat(op1->getFloat() - op2->getFloat());
		}

		_stack->push(_operand);

		break;

	case II_MUL:
		op2 = _stack->pop();
		op1 = _stack->pop();

		if (op1->isNULL() || op2->isNULL()) {
			_operand->setNULL();
		} else if (op1->getType() == VAL_INT && op2->getType() == VAL_INT) {
			_operand->setInt(op1->getInt() * op2->getInt());
		} else {
			_operand->setFloat(op1->getFloat() * op2->getFloat());
		}

		_stack->push(_operand);

		break;

	case II_DIV:
		op2 = _stack->pop();
		op1 = _stack->pop();

		if (op2->getFloat() == 0.0f) {
			runtimeError("Division by zero.");
		}

		if (op1->isNULL() || op2->isNULL() || op2->getFloat() == 0.0f) {
			_operand->setNULL();
		} else {
			_operand->setFloat(op1->getFloat() / op2->getFloat());
		}

		_stack->push(_operand);

		break;

	case II_MODULO:
		op2 = _stack->pop();
		op1 = _stack->pop();

		if (op2->getInt() == 0) {
			runtimeError("Division by zero.");
		}

		if (op1->isNULL() || op2->isNULL() || op2->getInt() == 0) {
			_operand->setNULL();
		} else {
			_operand->setInt(op1->getInt() % op2->getInt());
		}

		_stack->push(_operand);

		break;

	case II_NOT:
		op1 = _stack->pop();
		//if (op1->isNULL()) _operand->setNULL();
		if (op1->isNULL()) {
			_operand->setBool(true);
		} else {
			_operand->setBool(!op1->getBool());
		}
		_stack->push(_operand);

		break;

	case II_AND:
		op2 = _stack->pop();
		op1 = _stack->pop();
		if (op1 == nullptr || op2 == nullptr) {
			runtimeError("Script corruption detected. Did you use '=' instead of '==' for comparison?");
			_operand->setBool(false);
		} else {
			_operand->setBool(op1->getBool() && op2->getBool());
		}
		_stack->push(_operand);
		break;

	case II_OR:
		op2 = _stack->pop();
		op1 = _stack->pop();
		if (op1 == nullptr || op2 == nullptr) {
			runtimeError("Script corruption detected. Did you use '=' instead of '==' for comparison?");
			_operand->setBool(false);
		} else {
			_operand->setBool(op1->getBool() || op2->getBool());
		}
		_stack->push(_operand);
		break;

	case II_CMP_EQ:
		op2 = _stack->pop();
		op1 = _stack->pop();

		/*
		if ((op1->isNULL() && !op2->isNULL()) || (!op1->isNULL() && op2->isNULL())) _operand->setBool(false);
		else if (op1->isNative() && op2->isNative()) {
		    _operand->setBool(op1->getNative() == op2->getNative());
		}
		else if (op1->getType()==VAL_STRING || op2->getType()==VAL_STRING) {
		    _operand->setBool(scumm_stricmp(op1->getString(), op2->getString())==0);
		}
		else if (op1->getType()==VAL_FLOAT && op2->getType()==VAL_FLOAT) {
		    _operand->setBool(op1->getFloat() == op2->getFloat());
		}
		else{
		    _operand->setBool(op1->getInt() == op2->getInt());
		}
		*/

		_operand->setBool(ScValue::compare(op1, op2) == 0);
		_stack->push(_operand);
		break;

	case II_CMP_NE:
		op2 = _stack->pop();
		op1 = _stack->pop();

		/*
		if ((op1->isNULL() && !op2->isNULL()) || (!op1->isNULL() && op2->isNULL())) _operand->setBool(true);
		else if (op1->isNative() && op2->isNative()) {
		    _operand->setBool(op1->getNative() != op2->getNative());
		}
		else if (op1->getType()==VAL_STRING || op2->getType()==VAL_STRING) {
		    _operand->setBool(scumm_stricmp(op1->getString(), op2->getString())!=0);
		}
		else if (op1->getType()==VAL_FLOAT && op2->getType()==VAL_FLOAT) {
		    _operand->setBool(op1->getFloat() != op2->getFloat());
		}
		else{
		    _operand->setBool(op1->getInt() != op2->getInt());
		}
		*/

		_operand->setBool(ScValue::compare(op1, op2) != 0);
		_stack->push(_operand);
		break;

	case II_CMP_L:
		op2 = _stack->pop();
		op1 = _stack->pop();

		/*
		if (op1->getType()==VAL_FLOAT && op2->getType()==VAL_FLOAT) {
		    _operand->setBool(op1->getFloat() < op2->getFloat());
		}
		else _operand->setBool(op1->getInt() < op2->getInt());
		*/

		_operand->setBool(ScValue::compare(op1, op2) < 0);
		_stack->push(_operand);
		break;

	case II_CMP_G:
		op2 = _stack->pop();
		op1 = _stack->pop();

		/*
		if (op1->getType()==VAL_FLOAT && op2->getType()==VAL_FLOAT) {
		    _operand->setBool(op1->getFloat() > op2->getFloat());
		}
		else _operand->setBool(op1->getInt() > op2->getInt());
		*/

		_operand->setBool(ScValue::compare(op1, op2) > 0);
		_stack->push(_operand);
		break;

	case II_CMP_LE:
		op2 = _stack->pop();
		op1 = _stack->pop();

		/*
		if (op1->getType()==VAL_FLOAT && op2->getType()==VAL_FLOAT) {
		    _operand->setBool(op1->getFloat() <= op2->getFloat());
		}
		else _operand->setBool(op1->getInt() <= op2->getInt());
		*/

		_operand->setBool(ScValue::compare(op1, op2) <= 0);
		_stack->push(_operand);
		break;

	case II_CMP_GE:
		op2 = _stack->pop();
		op1 = _stack->pop();

		/*
		if (op1->getType()==VAL_FLOAT && op2->getType()==VAL_FLOAT) {
		    _operand->setBool(op1->getFloat() >= op2->getFloat());
		}
		else _operand->setBool(op1->getInt() >= op2->getInt());
		*/

		_operand->setBool(ScValue::compare(op1, op2) >= 0);
		_stack->push(_operand);
		break;

	case II_CMP_STRICT_EQ:
		op2 = _stack->pop();
		op1 = _stack->pop();

		//_operand->setBool(op1->getType()==op2->getType() && op1->getFloat()==op2->getFloat());
		_operand->setBool(ScValue::compareStrict(op1, op2) == 0);
		_stack->push(_operand);

		break;

	case II_CMP_STRICT_NE:
		op2 = _stack->pop();
		op1 = _stack->pop();

		//_operand->setBool(op1->getType()!=op2->getType() || op1->getFloat()!=op2->getFloat());
		_operand->setBool(ScValue::compareStrict(op1, op2) != 0);
		_stack->push(_operand);
		break;

	case II_DBG_LINE: {
		int newLine = getDWORD();
		if (newLine != _currentLine) {
			_currentLine = newLine;
		}
		break;

	}
	default:
		_gameRef->LOG(0, "Fatal: Invalid instruction %d ('%s', line %d, IP:0x%x)\n", inst, _filename, _currentLine, _iP - sizeof(uint32));
		_state = SCRIPT_FINISHED;
		ret = STATUS_FAILED;
	} // switch(instruction)

	//delete op;

	return ret;
}
void LLFloaterBulkPermission::handleInventory(LLViewerObject* viewer_obj, LLInventoryObject::object_list_t* inv)
{
	LLScrollListCtrl* list = getChild<LLScrollListCtrl>("queue output");

	LLInventoryObject::object_list_t::const_iterator it = inv->begin();
	LLInventoryObject::object_list_t::const_iterator end = inv->end();
	for ( ; it != end; ++it)
	{
		LLAssetType::EType asstype = (*it)->getType();
		if(
			( asstype == LLAssetType::AT_ANIMATION && gSavedSettings.getBOOL("BulkChangeIncludeAnimations")) ||
			( asstype == LLAssetType::AT_BODYPART  && gSavedSettings.getBOOL("BulkChangeIncludeBodyParts" )) ||
			( asstype == LLAssetType::AT_CLOTHING  && gSavedSettings.getBOOL("BulkChangeIncludeClothing"  )) ||
			( asstype == LLAssetType::AT_GESTURE   && gSavedSettings.getBOOL("BulkChangeIncludeGestures"  )) ||
			( asstype == LLAssetType::AT_LANDMARK  && gSavedSettings.getBOOL("BulkChangeIncludeLandmarks" )) ||
			( asstype == LLAssetType::AT_NOTECARD  && gSavedSettings.getBOOL("BulkChangeIncludeNotecards" )) ||
			( asstype == LLAssetType::AT_OBJECT    && gSavedSettings.getBOOL("BulkChangeIncludeObjects"   )) ||
			( asstype == LLAssetType::AT_LSL_TEXT  && gSavedSettings.getBOOL("BulkChangeIncludeScripts"   )) ||
			( asstype == LLAssetType::AT_SOUND     && gSavedSettings.getBOOL("BulkChangeIncludeSounds"    )) ||
			( asstype == LLAssetType::AT_TEXTURE   && gSavedSettings.getBOOL("BulkChangeIncludeTextures"  )))
		{
			LLViewerObject* object = gObjectList.findObject(viewer_obj->getID());

			if (object)
			{
				LLInventoryItem* item = (LLInventoryItem*)((LLInventoryObject*)(*it));
				LLViewerInventoryItem* new_item = (LLViewerInventoryItem*)item;
				LLPermissions perm(new_item->getPermissions());
				U32 flags = new_item->getFlags();

				U32 desired_next_owner_perms = LLFloaterPerms::getNextOwnerPerms("BulkChange");
				U32 desired_everyone_perms = LLFloaterPerms::getEveryonePerms("BulkChange");
				U32 desired_group_perms = LLFloaterPerms::getGroupPerms("BulkChange");

				// If next owner permissions have changed (and this is an object)
				// then set the slam permissions flag so that they are applied on rez.
				if((perm.getMaskNextOwner() != desired_next_owner_perms)
				   && (new_item->getType() == LLAssetType::AT_OBJECT))
				{
					flags |= LLInventoryItemFlags::II_FLAGS_OBJECT_SLAM_PERM;
				}
				// If everyone permissions have changed (and this is an object)
				// then set the overwrite everyone permissions flag so they
				// are applied on rez.
				if ((perm.getMaskEveryone() != desired_everyone_perms)
				    && (new_item->getType() == LLAssetType::AT_OBJECT))
				{
					flags |= LLInventoryItemFlags::II_FLAGS_OBJECT_PERM_OVERWRITE_EVERYONE;
				}
				// If group permissions have changed (and this is an object)
				// then set the overwrite group permissions flag so they
				// are applied on rez.
				if ((perm.getMaskGroup() != desired_group_perms)
				    && (new_item->getType() == LLAssetType::AT_OBJECT))
				{
					flags |= LLInventoryItemFlags::II_FLAGS_OBJECT_PERM_OVERWRITE_GROUP;
				}

				// chomp the inventory name so it fits in the scroll window nicely
				// and the user can see the [OK]
				std::string invname;
				invname=item->getName().substr(0,item->getName().size() < 30 ? item->getName().size() : 30 );
				
				LLUIString status_text = getString("status_text");
				status_text.setArg("[NAME]", invname.c_str());
				// Check whether we appear to have the appropriate permissions to change permission on this item.
				// Although the server will disallow any forbidden changes, it is a good idea to guess correctly
				// so that we can warn the user. The risk of getting this check wrong is therefore the possibility
				// of incorrectly choosing to not attempt to make a valid change.
				//
				// Trouble is this is extremely difficult to do and even when we know the results
				// it is difficult to design the best messaging. Therefore in this initial implementation
				// we'll always try to set the requested permissions and consider all cases successful
				// and perhaps later try to implement a smarter, friendlier solution. -MG
				if(true
					//gAgent.allowOperation(PERM_MODIFY, perm, GP_OBJECT_MANIPULATE) // for group and everyone masks
					//|| something else // for next owner perms
					)
				{
					perm.setMaskNext(desired_next_owner_perms);
					perm.setMaskEveryone(desired_everyone_perms);
					perm.setMaskGroup(desired_group_perms);
					new_item->setPermissions(perm); // here's the beef
					new_item->setFlags(flags); // and the tofu
					updateInventory(object,new_item,TASK_INVENTORY_ITEM_KEY,FALSE);
					//status_text.setArg("[STATUS]", getString("status_ok_text"));
					status_text.setArg("[STATUS]", "");
				}
				else
				{
					//status_text.setArg("[STATUS]", getString("status_bad_text"));
					status_text.setArg("[STATUS]", "");
				}
				
				list->addSimpleElement(status_text.getString());

				//TODO if we are an object inside an object we should check a recuse flag and if set
				//open the inventory of the object and recurse - Michelle2 Zenovka

				//	if(recurse &&  ( (*it)->getType() == LLAssetType::AT_OBJECT && processObject))
				//	{
				//		I think we need to get the UUID of the object inside the inventory
				//		call item->fetchFromServer();
				//		we need a call back to say item has arrived *sigh*
				//		we then need to do something like
				//		LLUUID* id = new LLUUID(mID);
				//		registerVOInventoryListener(obj,id);
				//		requestVOInventory();
				//	}
			}
		}
	}

	nextObject();
}
 std::string AvailabilityManagerNightCycle_Impl::controlType() const {
   boost::optional<std::string> value = getString(OS_AvailabilityManager_NightCycleFields::ControlType,true);
   OS_ASSERT(value);
   return value.get();
 }
示例#27
0
 void createCopy (ValueUnion& dest, const ValueUnion& source) const   { new (dest.stringValue) String (*getString (source)); }
示例#28
0
LLWString LLControlGroup::getWString(const std::string& name)
{
	return utf8str_to_wstring(getString(name));
}
示例#29
0
 int64 toInt64 (const ValueUnion& data) const noexcept   { return getString (data)->getLargeIntValue(); };
示例#30
0
文件: config.cpp 项目: AtlantisCD9/Qt
/*!
  Looks up the configuarion variable \a var in the string
  map and returns the boolean value.
 */
bool Config::getBool(const QString& var) const
{
    return QVariant(getString(var)).toBool();
}