void dwarf_compileunit(dwarf_t* dwarf, ast_t* program) { assert(ast_id(program) == TK_PROGRAM); ast_t* package = ast_child(program); const char* path = package_path(package); const char* name = package_filename(package); //FIX symbols_package(dwarf->symbols, path, name); }
static void init_module(compile_t* c, ast_t* program, pass_opt_t* opt) { c->opt = opt; // Get the first package and the builtin package. ast_t* package = ast_child(program); ast_t* builtin = ast_sibling(package); // If we have only one package, we are compiling builtin itself. if(builtin == NULL) builtin = package; c->reach = reach_new(); // The name of the first package is the name of the program. c->filename = package_filename(package); // LLVM context and machine settings. if(c->opt->library || target_is_ilp32(opt->triple)) c->callconv = LLVMCCallConv; else c->callconv = LLVMFastCallConv; if(!c->opt->release || c->opt->library || c->opt->extfun) c->linkage = LLVMExternalLinkage; else c->linkage = LLVMPrivateLinkage; c->context = LLVMContextCreate(); c->machine = make_machine(opt); c->target_data = LLVMGetTargetMachineData(c->machine); // Create a module. c->module = LLVMModuleCreateWithNameInContext(c->filename, c->context); // Set the target triple. LLVMSetTarget(c->module, opt->triple); // Set the data layout. char* layout = LLVMCopyStringRepOfTargetData(c->target_data); LLVMSetDataLayout(c->module, layout); LLVMDisposeMessage(layout); // IR builder. c->builder = LLVMCreateBuilderInContext(c->context); c->di = LLVMNewDIBuilder(c->module); // TODO: what LANG id should be used? c->di_unit = LLVMDIBuilderCreateCompileUnit(c->di, 0x0004, package_filename(package), package_path(package), "ponyc-" PONY_VERSION, c->opt->release); // Empty frame stack. c->frame = NULL; }
/// /// \brief ³õʼ»¯½Å±¾Ä£¿é /// \date 2017/08/28 /// \author albert.xu /// xgc_bool InitServerScript( ini_reader &ini ) { _Lua = luaL_newstate(); XGC_ASSERT_RETURN( _Lua, false ); luaL_openlibs( _Lua ); getGlobalNamespace( _Lua ) .addCFunction( "DBG", luaLog<0> ) .addCFunction( "INF", luaLog<1> ) .addCFunction( "WRN", luaLog<2> ) .addCFunction( "ERR", luaLog<3> ) ; LuaRef package = getGlobal( _Lua, "package" ); std::stringstream package_path( package["path"].cast< xgc::string >() ); auto count = ini.get_item_count( "LuaScripts", "Path" ); for( xgc_size i = 0; i < count; ++i ) { auto path = ini.get_item_value( "LuaScripts", "Path", i, xgc_nullptr ); list_directory( path, [&package_path]( xgc_lpcstr root, xgc_lpcstr relative, xgc_lpcstr file )->bool{ if( xgc_nullptr == file ) { package_path << root << "/" << relative << "/?;"; package_path << root << "/" << relative << "/?.lua;"; } return true; }, -1 ); } package["path"] = package_path.str(); auto luaMain = ini.get_item_value( "LuaScripts", "Main", "main.lua" ); if( luaMain ) { luaDoFile( luaMain ); } return true; }
/** * Create used materials */ void srs_ui_but::CButProjection::createMaterials(Ogre::Camera * camera) { // std::cerr << "CButProjection::createMaterials S" << std::endl; // std::cerr << "1" << std::endl; // Load materials // Ogre::String nameOfResourceGroup( "MaterialGroup1" ); { // Create resource group Ogre::ResourceGroupManager& lRgMgr = Ogre::ResourceGroupManager::getSingleton(); // lRgMgr.createResourceGroup(nameOfResourceGroup); // std::cerr << "2" << std::endl; // Get path std::string package_path( ros::package::getPath("srs_ui_but") ); ogre_tools::V_string paths; Ogre::String resource_path(package_path + "/src/but_display/materials"); // std::cerr << "3" << std::endl; // std::cerr << "Materials path: " << resource_path.c_str() << std::endl; // std::cerr << "Exisist: " << lRgMgr.resourceGroupExists("srs_ui_but") << std::endl; if( ! lRgMgr.resourceGroupExists("srs_ui_but")) { // std::cerr << "Creating resource group: srs_ui_but" << std::endl; lRgMgr.createResourceGroup("srs_ui_but"); } // std::cerr << "4" << std::endl; if( ! lRgMgr.isResourceGroupInitialised("srs_ui_but") ) { // std::cerr << "Initializing resource group: srs_ui_but" << std::endl; lRgMgr.addResourceLocation(resource_path, "FileSystem", "srs_ui_but"); lRgMgr.initialiseResourceGroup("srs_ui_but"); } if( ! lRgMgr.isResourceGroupLoaded("srs_ui_but") ) { // std::cerr << "Loading resource group: srs_ui_but" << std::endl; lRgMgr.addResourceLocation(resource_path, "FileSystem", "srs_ui_but"); lRgMgr.loadResourceGroup("srs_ui_but"); } // std::cerr << "5" << std::endl; // std::cerr << "Loaded materials: " << std::endl; /* // Get material manager Ogre::MaterialManager& lMaterialManager = Ogre::MaterialManager::getSingleton(); // List loaded materials Ogre::ResourceManager::ResourceMapIterator materialIterator = lMaterialManager.getResourceIterator(); // Write materials int count(0); while (materialIterator.hasMoreElements()) { Ogre::String name( (static_cast<Ogre::MaterialPtr>(materialIterator.peekNextValue()))->getName() ); std::cerr << name << std::endl; materialIterator.moveNext(); count++; } std::cerr << "Num of materials: " << count << std::endl; //*/ } // Load compositor { if( Ogre::CompositorManager::getSingleton().addCompositor(camera->getViewport(), "zTestedProjection") == 0 ) { std::cerr << "COMPOSITOR FAILED TO LOAD." << std::endl; } else { Ogre::CompositorManager::getSingleton().setCompositorEnabled(camera->getViewport(), "zTestedProjection", true); // std::cerr << "Creating Projection data" << std::endl; //! Create material m_projectionData = new CProjectionData( scene_manager_, update_nh_, "tested_projection", "srs_ui_but" ); // std::cerr << "Projection data done. Running CMaterialListener" << std::endl; // Create material listener m_ml = new CMaterialListener( m_projectionData->getMaterialPtr(), "myscheme" ); connectML( true ); } } //*/ // std::cerr << "CButProjection::createMaterials E" << std::endl; }