static bool pluginInitialize(Plugin &plugin) { if(Server::create()->start(plugin.getPath(), OS_MYSQL_DATA) == false) return false; if(DatabasesSystem::instance()->addDriver(shared_ptr<IDatabaseDriver>(OS_NEW Driver(plugin.getPath()))) == false) return false; shared_ptr<ThirdPartyLibrary> mysqlLibrary = ThirdPartyLibrariesReporter::instance()->addLibrary(); OS_ASSERT(mysqlLibrary != nullptr); mysqlLibrary->setName("Mysql"); mysqlLibrary->setUrl("http://www.mysql.com"); mysqlLibrary->setLicense("GPL"); return true; }
static bool pluginInitialize(Plugin &plugin) { g_componentsPath = plugin.getPath(); ExtensionsSystem::instance()->loadExtension(shared_ptr<IExtensionsExtension>(OS_NEW components::ComponentsExtension(g_componentsPath))); // Components ExtensionsSystem::instance()->registerComponent(shared_ptr<IExtensionsComponent>(OS_NEW components::documentation::Documentation())); ExtensionsSystem::instance()->registerComponent(shared_ptr<IExtensionsComponent>(OS_NEW components::forum::Forum())); ExtensionsSystem::instance()->registerComponent(shared_ptr<IExtensionsComponent>(OS_NEW components::forum::Section())); // Modules //ExtensionsSystem::instance()->registerModule(shared_ptr<IExtensionsModule>(OS_NEW components::modules::Pathway())); ExtensionsSystem::instance()->registerModule(shared_ptr<IExtensionsModule>(OS_NEW components::modules::Mirror())); ExtensionsSystem::instance()->registerModule(shared_ptr<IExtensionsModule>(OS_NEW components::modules::Text())); ExtensionsSystem::instance()->registerModule(shared_ptr<IExtensionsModule>(OS_NEW components::modules::XsltTransform())); ExtensionsSystem::instance()->registerModule(shared_ptr<IExtensionsModule>(OS_NEW components::modules::LanguageSwitcher())); ExtensionsSystem::instance()->registerModule(shared_ptr<IExtensionsModule>(OS_NEW components::modules::QuickSearch())); ExtensionsSystem::instance()->registerModule(shared_ptr<IExtensionsModule>(OS_NEW components::modules::Search())); ExtensionsSystem::instance()->registerModule(shared_ptr<IExtensionsModule>(OS_NEW components::modules::Feed())); return true; }
LibraryClass::LibraryClass() : Class("lib", Class::library) { createBuiltinMember("new", 2, AbstractSyntaxTree::createBuiltinMethode(metatype(), [] (Cursor *cursor) { size_t base = get_stack_base(cursor); Reference &rvalue = *cursor->stack().at(base); Reference &self = *cursor->stack().at(base - 1); if (Plugin *plugin = Plugin::load(to_string(rvalue))) { self.data<Library>()->plugin = plugin; cursor->stack().pop_back(); } else { cursor->stack().pop_back(); cursor->stack().pop_back(); cursor->stack().push_back(SharedReference::unique(Reference::create<None>())); } })); createBuiltinMember("call", VARIADIC 2, AbstractSyntaxTree::createBuiltinMethode(metatype(), [] (Cursor *cursor) { size_t base = get_stack_base(cursor); SharedReference va_args = cursor->stack().at(base); SharedReference function = cursor->stack().at(base - 1); SharedReference self = cursor->stack().at(base - 2); std::string func_name = to_string(*function); Plugin *plugin = self->data<Library>()->plugin; cursor->stack().pop_back(); cursor->stack().pop_back(); cursor->stack().pop_back(); for (Iterator::ctx_type::value_type &arg : va_args->data<Iterator>()->ctx) { cursor->stack().push_back(arg); } int signature = static_cast<int>(va_args->data<Iterator>()->ctx.size()); if (!plugin->call(func_name, signature, cursor)) { error("no function '%s' taking %d arguments found in plugin '%s'", func_name.c_str(), signature, plugin->getPath().c_str()); } })); }