int scripting_GetGlobal(const char *global, const char *s, ...) { lua_getglobal(L, global); if(s) { va_list ap; va_start(ap, s); getGlobal(s, ap); va_end(ap); } return 0; }
Node * ColladaInstanceController::process(ColladaElement *parent) { OSG_COLLADA_LOG(("ColladaInstanceController::process\n")); ColladaControllerRefPtr colCont = getTargetElem(); getGlobal()->addInstanceController(this); return colCont->createInstance(this); }
// extern (used by Global.cpp) void video_class_init(as_object& global, const ObjectURI& uri) { Global_as& gl = getGlobal(global); as_object* proto = createObject(gl); as_object* cl = gl.createClass(emptyFunction, proto); attachVideoInterface(*proto); // Register _global.Video global.init_member(uri, cl, as_object::DefaultFlags); }
void dejagnu_class_init(as_object &obj) { Global_as& gl = getGlobal(obj); as_object* proto = createObject(gl); attachInterface(*proto); as_object* cl = gl.createClass(&dejagnu_ctor, proto); obj.init_member("DejaGnu", cl); }
as_value gtkext_widget_show(const fn_call& fn) { // GNASH_REPORT_FUNCTION; boost::intrusive_ptr<GtkExt> ptr = ensureType<GtkExt>(fn.this_ptr); if (fn.nargs > 0) { GtkExt *window = dynamic_cast<GtkExt *>(fn.arg(0).to_object(*getGlobal(fn)).get()); gtk_widget_show(window->getWindow()); } return as_value(); }
bool LuaState::callFunction(std::string fname, LuaValue& value) { //place the function on the stack getGlobal(fname); //push the argument value.push(L); //do it return pcall(1, 0); }
// extern (used by Global.cpp) void displayobject_class_init(as_object& where, const ObjectURI& uri) { Global_as& gl = getGlobal(where); as_object* proto = gl.createObject(); attachDisplayObjectInterface(*proto); as_object* cl = gl.createClass(&displayobject_ctor, proto); attachDisplayObjectStaticInterface(*cl); // Register _global.DisplayObject where.init_member(uri, cl, as_object::DefaultFlags); }
void attachLoadableInterface(as_object& o, int flags) { Global_as& gl = getGlobal(o); o.init_member("addRequestHeader", gl.createFunction( loadableobject_addRequestHeader), flags); o.init_member("getBytesLoaded", gl.createFunction( loadableobject_getBytesLoaded),flags); o.init_member("getBytesTotal", gl.createFunction( loadableobject_getBytesTotal), flags); }
Function::Function(const action_buffer& ab, as_environment& env, size_t start, const ScopeStack& scopeStack) : UserFunction(getGlobal(env)), _env(env), _action_buffer(ab), _scopeStack(scopeStack), _startPC(start), _length(0) { assert( _startPC < _action_buffer.size() ); }
// extern (used by Global.cpp) void video_class_init(as_object& global, const ObjectURI& uri) { // This is going to be the global Video "class"/"function" Global_as& gl = getGlobal(global); as_object* proto = createObject(gl); as_object* cl = gl.createClass(&video_ctor, proto); attachVideoInterface(*proto); // Register _global.Video global.init_member(uri, cl, as_object::DefaultFlags); }
void InstallBranch::onButtonClick(wxCommandEvent &event) { if (event.GetId() == m_butInfo->GetId()) { if ((m_bIsMod || m_bIsExpansion) && !m_bSelectBranch) g_pMainApp->handleInternalLink(m_Item, ACTION_PROFILE, FormatArgs("?help=needgame")); else g_pMainApp->handleInternalLink(m_Item, ACTION_PROFILE, FormatArgs("?help=branches")); EndModal(wxID_CANCEL); } else if (event.GetId() == m_butInstall->GetId()) { MCFBranch b = getBranch(); if (b == UINT_MAX) { UserCore::Item::ItemInfoI* pItemInfo = GetUserCore()->getItemManager()->findItemInfo(m_Item); if ((m_bIsMod || m_bIsExpansion) && !m_bSelectBranch) pItemInfo = GetUserCore()->getItemManager()->findItemInfo(pItemInfo->getParentId()); pItemInfo->addSFlag(UserCore::Item::ItemInfoI::STATUS_LINK|UserCore::Item::ItemInfoI::STATUS_INSTALLED|UserCore::Item::ItemInfoI::STATUS_READY); EndModal(wxID_OK); } else if (b == (UINT_MAX - 1)) { g_pMainApp->handleInternalLink(m_Item, ACTION_SHOWSETTINGS, FormatArgs("tab=cip")); EndModal(wxID_CANCEL); } else if (m_bBuy) { MCFBranch g = getGlobal(); gcString args; if (g == 0 || !g.isGlobal()) args = gcString("?help=buy&branch={0}", b); else args = gcString("?help=buy&branchglobal={0}", g); g_pMainApp->handleInternalLink(m_Item, ACTION_PROFILE, FormatArgs(args)); EndModal(wxID_CANCEL); } else { EndModal(wxID_OK); } } else if (event.GetId() == m_butCancel->GetId()) { EndModal(wxID_CANCEL); } }
Material * ColladaMaterial::createInstance(ColladaInstInfo *colInstInfo) { OSG_COLLADA_LOG(("ColladaMaterial::createInstance\n")); MaterialUnrecPtr retVal = NULL; domMaterialRef material = getDOMElementAs<domMaterial>(); domInstance_effectRef instEffect = material->getInstance_effect(); ColladaInstanceEffectRefPtr colInstEffect = getUserDataAs<ColladaInstanceEffect>(instEffect); if(getInstStore().empty() == true) { OSG_ASSERT(colInstEffect != NULL); OSG_ASSERT(colInstEffect->getTargetElem() != NULL); ColladaInstInfoRefPtr colEffectInstInfo = ColladaEffect::ColladaEffectInstInfo::create(this, colInstEffect); retVal = colInstEffect->getTargetElem()->createInstance( colEffectInstInfo); if(getGlobal()->getOptions()->getCreateNameAttachments() == true && material->getName() != NULL ) { setName(retVal, material->getName()); } editInstStore().push_back(retVal); } else { retVal = dynamic_pointer_cast<Material>(getInstStore()[0]); getGlobal()->getStatCollector()->getElem( ColladaGlobal::statNMaterialUsed)->inc(); } return retVal; }
void ColladaSurface::read2D(domFx_surface_common *surface) { domFx_surface_init_commonRef init = surface->getFx_surface_init_common(); domFx_surface_init_common::domInit_as_nullRef initNull = init->getInit_as_null(); domFx_surface_init_common::domInit_as_targetRef initTarget = init->getInit_as_target(); domFx_surface_init_planar_commonRef initPlanar = init->getInit_planar(); const domFx_surface_init_from_common_Array &initFroms = init->getInit_from_array(); if(initNull != NULL) { SWARNING << "ColladaSurface::read2D: <init_as_null>: NIY" << std::endl; } else if(initTarget != NULL) { SWARNING << "ColladaSurface::read2D: <init_as_target>: NIY" << std::endl; } else if(initPlanar != NULL) { SWARNING << "ColladaSurface::read2D: <init_planar>: NIY" << std::endl; } else if(initFroms.getCount() > 0) { if(initFroms.getCount() > 1) { SWARNING << "ColladaSurface::read2D: only one " << "<init_from> supported." << std::endl; } daeElementRef imageElem = initFroms[0]->getValue().getElement(); domImageRef image = daeSafeCast<domImage>(imageElem); ColladaImageRefPtr colImage = getUserDataAs<ColladaImage>(image); if(colImage == NULL) { colImage = dynamic_pointer_cast<ColladaImage>( ColladaElementFactory::the()->create(image, getGlobal())); colImage->read(); } _image = colImage->getImage(); } }
std::string help(Namespace *ns) const { if (ns == NULL) { return ""; } std::stringstream sstr; if(ns!=getGlobal()->getGlobalNamespace()){ sstr <<"\tNamespace " << ns->name() << " consists of: \n"; } printSubBlockInfo(ns->subspaces(), "Namespaces", sstr); if(not ns->subspaces().empty()){ sstr <<"\t\t\tFor more information on a nested namespace, type help(<namespacename>)\n"; } printSubBlockInfo(ns->vocabularies(), "Vocabularies", sstr); printSubBlockInfo(ns->theories(), "Theories", sstr); printSubBlockInfo(ns->structures(), "Structures", sstr); printSubBlockInfo(ns->terms(), "Terms", sstr); printSubBlockInfo(ns->queries(), "Queries", sstr); // FIXME additional blocks are not detected automatically! // Printing procedures std::map<std::string, std::string> procedures; // Get text for each internal procedure in the given namespace for (auto i = getAllInferences().cbegin(); i < getAllInferences().cend(); ++i) { if ((*i)->getNamespace() == ns->name()) { std::vector<std::string> args; for (auto j = (*i)->getArgumentTypes().cbegin(); j < (*i)->getArgumentTypes().cend(); ++j) { args.push_back(toCString(*j)); } auto text = printProcedure((*i)->getName(), args, (*i)->getDescription()); procedures.insert({text, ""}); } } // Get text for each user defined procedure in the given namespace for (auto it = ns->procedures().cbegin(); it != ns->procedures().cend(); ++it) { auto text = printProcedure(it->first, it->second->args(), it->second->description()); procedures.insert({text, ""}); } if (procedures.empty()) { if (ns->isGlobal()) { sstr << "\t\tThere are no procedures in the global namespace\n"; } else { sstr << "\t\tThere are no procedures in namespace "; ns->putName(sstr); sstr << '\n'; } } else { printSubBlockInfo(procedures, "Procedures", sstr); } return sstr.str(); }
// extern (used by Global.cpp) void sound_class_init(as_object& where, const ObjectURI& uri) { Global_as& gl = getGlobal(where); as_object* proto = createObject(gl); as_object* cl = gl.createClass(&sound_new, proto); attachSoundInterface(*proto); proto->set_member_flags(NSV::PROP_CONSTRUCTOR, PropFlags::readOnly); proto->set_member_flags(NSV::PROP_uuPROTOuu, PropFlags::readOnly, 0); where.init_member(uri, cl, as_object::DefaultFlags); }
//------------------------------------------------------------------------- void MessageQueueThreadUsingCurrentGUIMessageQueueForWindows::setup() { // make sure the window message queue was created by peeking a message MSG msg; memset(&msg, 0, sizeof(msg)); ::PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE); mHWND = ::CreateWindow( getGlobal().mHiddenWindowClassName, _T("zsLibHiddenWindow9127b0cb49457fdb969054c57cff6ed5efe771c0"), 0, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, getGlobal().mModule, NULL ); ZS_THROW_BAD_STATE_IF(NULL == mHWND) }
void ColladaNode::handleInstanceGeometry(domInstance_geometry *instGeo, InstData &instData) { ColladaInstanceGeometryRefPtr colInstGeo = getUserDataAs<ColladaInstanceGeometry>(instGeo); ColladaInstInfoRefPtr geoInstInfo = ColladaGeometry::ColladaGeometryInstInfo::create( this, colInstGeo, instData._bottomN); getGlobal()->editInstQueue().push_back(geoInstInfo); }
void PSViewDictionaryToken:: setValue(PSVinteger pos, const string &key, PSViewToken *value) { if (getGlobal() && value->getLocal()) { psview_->getErrorMgr()->raise(PSVIEW_ERROR_TYPE_INVALID_ACCESS); return; } PSViewToken *key1 = new PSViewNameToken(psview_, key); dictionary_->setValue(pos, key1, value); }
void ColladaNode::readNode(domNode *child) { ColladaNodeRefPtr colNodeChild = getUserDataAs<ColladaNode>(child); if(colNodeChild == NULL) { colNodeChild = dynamic_pointer_cast<ColladaNode>( ColladaElementFactory::the()->create(child, getGlobal())); colNodeChild->read(this); } }
ObjectValue* StringValue::toObject() { // Create a new String object ObjectValue* string = dynamic_cast<ObjectValue*>(getGlobal()->get("String")); if (!string || !string->getCode()) { throw getErrorInstance("TypeError"); } Register<ListValue> list = new ListValue; list->push(this); return string->construct(list); };
void SplitDefinitions::prepare() { savedOptions = BootstrappingUtils::setBootstrappingOptions(); if (not getGlobal()->instance()->alreadyParsed("definitions")) { parsefile("definitions"); } auto defnamespace = getGlobal()->getGlobalNamespace()->subspace("stdspace")->subspace("definitionbootstrapping"); Assert(defnamespace != NULL); auto splitVoc = defnamespace->vocabulary("def_split_voc"); Assert(splitVoc != NULL); sameDef = splitVoc->pred("samedef/2"); Assert(sameDef != NULL); auto deptheo = defnamespace->theory("dependency"); Assert(deptheo != NULL); splittheo = defnamespace->theory("def_split_theory"); Assert(splittheo != NULL); splittheo = FormulaUtils::merge(splittheo, deptheo); Assert(splittheo != NULL); }
void ColladaNode::handleInstanceController( domInstance_controller *instCtrl, InstData &instData ) { ColladaInstanceControllerRefPtr colInstCtrl = getUserDataAs<ColladaInstanceController>(instCtrl); ColladaInstInfoRefPtr ctrlInstInfo = ColladaController::ColladaControllerInstInfo::create( this, colInstCtrl, instData._bottomN); getGlobal()->editInstQueue().push_back(ctrlInstInfo); }
// this callback takes 2 arguments // void gtk_container_set_border_width (GtkContainer *container, guint border_width); as_value gtkext_container_set_border_width(const fn_call& fn) { // GNASH_REPORT_FUNCTION; boost::intrusive_ptr<GtkExt> ptr = ensureType<GtkExt>(fn.this_ptr); if (fn.nargs > 0) { GtkExt *window = dynamic_cast<GtkExt *>(fn.arg(0).to_object(*getGlobal(fn)).get()); int width = fn.arg(1).to_int(); window->container_set_border_width(width); dbglogfile << "set container border width to " << width << " !" << endl; } return as_value(); }
void ColladaNode::readInstanceGeometry(domInstance_geometry *instGeo) { ColladaInstanceGeometryRefPtr colInstGeo = getUserDataAs<ColladaInstanceGeometry>(instGeo); if(colInstGeo == NULL) { colInstGeo = dynamic_pointer_cast<ColladaInstanceGeometry>( ColladaElementFactory::the()->create(instGeo, getGlobal())); colInstGeo->read(this); } }
void ColladaNode::readInstanceNode(domInstance_node *instNode) { ColladaInstanceNodeRefPtr colInstNode = getUserDataAs<ColladaInstanceNode>(instNode); if(colInstNode == NULL) { colInstNode = dynamic_pointer_cast<ColladaInstanceNode>( ColladaElementFactory::the()->create(instNode, getGlobal())); colInstNode->read(this); } }
void ColladaNode::readInstanceController(domInstance_controller *instCtrl) { ColladaInstanceControllerRefPtr colInstCtrl = getUserDataAs<ColladaInstanceController>(instCtrl); if(colInstCtrl == NULL) { colInstCtrl = dynamic_pointer_cast<ColladaInstanceController>( ColladaElementFactory::the()->create(instCtrl, getGlobal())); colInstCtrl->read(this); } }
void PSViewDictionaryToken:: addValue(PSViewToken *key, PSViewToken *value) { if (getGlobal() && (key->getLocal() || value->getLocal())) psview_->getErrorMgr()->raise(PSVIEW_ERROR_TYPE_INVALID_ACCESS); if (key->isString()) { PSViewStringToken *string_token = (PSViewStringToken *) key; key = new PSViewNameToken(string_token); } dictionary_->addValue(key, value); }
static as_value get_flash_text_package(const fn_call& fn) { log_debug("Loading flash.text package"); Global_as& gl = getGlobal(fn); as_object* pkg = createObject(gl); VM& vm = getVM(fn); textrenderer_class_init(*pkg, getURI(vm, "TextRenderer")); return pkg; }
static as_value get_flash_net_package(const fn_call& fn) { log_debug("Loading flash.net package"); Global_as& gl = getGlobal(fn); as_object* pkg = createObject(gl); VM& vm = getVM(fn); filereference_class_init(*pkg, getURI(vm, "FileReference")); return pkg; }
std::string LuaInterface::traceback(const std::string& errorMessage, int level) { // gets debug.traceback getGlobal("debug"); getField("traceback"); remove(-2); // remove debug // calls debug.traceback(errorMessage, level) pushString(errorMessage); pushInteger(level); call(2,1); // returns the traceback message return popString(); }