Ejemplo n.º 1
0
wxString Compiler::GetTool(const wxString &name) const
{
	std::map<wxString, wxString>::const_iterator iter = m_tools.find(name);
	if (iter == m_tools.end()) {
		if(name == wxT("C_CompilerName")) {
			// an upgrade, return the CompilerName
			return GetTool(wxT("CompilerName"));
		}
		return wxEmptyString;
	}
	if(name == wxT("C_CompilerName") && iter->second.empty()) {
		return GetTool(wxT("CompilerName"));
	}
	return iter->second;
}
Ejemplo n.º 2
0
//--------------------------------------------------------------------------------------------------
void EScene::SaveToolLTX(ObjClassID clsid, LPCSTR fn)
{
    ESceneToolBase* tool 	= GetTool(clsid);
	int fc = tool->SaveFileCount();
	if(fc==1)
    {
      CInifile ini_part		(fn, FALSE, FALSE, FALSE);
      tool->SaveLTX			(ini_part, 0);
      m_GUID.SaveLTX			(ini_part,"guid","guid");
      ini_part.save_as		();
    }else
    {
    	for(int i=0; i<fc; ++i)
        {
        	
        	string_path 			filename;
            if(i)
            	sprintf				(filename, "%s%d", fn, i);
            else
            	strcpy				(filename, fn);

            CInifile ini_part		(filename, FALSE, FALSE, FALSE);
            tool->SaveLTX			(ini_part, i);
            m_GUID.SaveLTX			(ini_part,"guid","guid");
            ini_part.save_as		();
        }
    }
}
Ejemplo n.º 3
0
int EScene::RaySelect(int flag, ObjClassID classfilter)
{
	if( !valid() ) return 0;

    float dist					= UI->ZFar();
    ESceneToolBase* mt 		= 0;
    if (classfilter==OBJCLASS_DUMMY)
    {
        SceneToolsMapPairIt _I 	= m_SceneTools.begin();
        SceneToolsMapPairIt _E 	= m_SceneTools.end();
        for (; _I!=_E; _I++)
        {
        	float range			= UI->ZFar();
        	_I->second->RaySelect(flag,range,UI->m_CurrentRStart,UI->m_CurrentRDir,TRUE);
            if (range<dist){
            	dist			= range;
                mt				= _I->second;
            }		
        }
    }else{
        mt 						= GetTool(classfilter);
    }
    int count					= 0;
    dist						= UI->ZFar();
    if (mt) 
    	count=mt->RaySelect	(flag,dist,UI->m_CurrentRStart,UI->m_CurrentRDir,FALSE);
	return count;
/*
	CCustomObject *nearest_object = RayPickObject(flt_max,UI->m_CurrentRStart,UI->m_CurrentRNorm,classfilter,0,0);
    if (nearest_object) nearest_object->Select(flag);
    UI->RedrawScene();
    return nearest_object?1:0;
*/
}
Ejemplo n.º 4
0
bool mitk::NavigationToolStorage::AddTool(mitk::NavigationTool::Pointer tool)
{
  if (m_storageLocked)
  {
    MITK_WARN << "Storage is locked, cannot modify it!";
    return false;
  }
  else if (GetTool(tool->GetIdentifier()).IsNotNull())
  {
    MITK_WARN << "Tool ID already exists in storage, can't add!";
    return false;
  }
  else
  {
    m_ToolCollection.push_back(tool);
    if (m_DataStorage.IsNotNull())
    {
      if (!m_DataStorage->Exists(tool->GetDataNode()))
        m_DataStorage->Add(tool->GetDataNode());
    }
    //This line is important so that other widgets can get a notice that the toolStorage has changed!
    this->UpdateMicroservice();
    return true;
  }
}
Ejemplo n.º 5
0
bool EScene::LoadToolLTX(ObjClassID clsid, LPCSTR fn)
{
    ESceneToolBase* tool 	= GetTool(clsid);
    tool->Clear				(true);
	bool res 				= LoadLevelPartLTX(tool, fn);
	return 					res;
}
Ejemplo n.º 6
0
BOOL EScene::UnloadLevelPart(LPCSTR map_name, ObjClassID cls)
{
	xr_string pn	= LevelPartName(map_name,cls);
    if (UnloadLevelPart(GetTool(cls)))
    	return 		TRUE;
    else
    	return			FALSE;
}
Ejemplo n.º 7
0
wxString Compiler::GetTool(const wxString& name) const
{
    std::map<wxString, wxString>::const_iterator iter = m_tools.find(name);
    if(iter == m_tools.end()) {
        if(name == wxT("CC")) {
            // an upgrade, return the CXX
            return GetTool(wxT("CXX"));
        }
        return wxEmptyString;
    }
    if(name == wxT("CC") && iter->second.empty()) {
        return GetTool(wxT("CXX"));
    }
    wxString tool = iter->second;
    tool.Replace("\\", "/");
    return tool;
}
Ejemplo n.º 8
0
unsigned int RepRap::GetNumberOfContiguousTools() const
{
	unsigned int numTools = 0;
	while (GetTool(numTools) != nullptr)
	{
		++numTools;
	}
	return numTools;
}
Ejemplo n.º 9
0
void RepRap::SetToolVariables(int toolNumber, const float* standbyTemperatures, const float* activeTemperatures)
{
	Tool* tool = GetTool(toolNumber);
	if (tool != nullptr)
	{
		tool->SetVariables(standbyTemperatures, activeTemperatures);
	}
	else
	{
		platform->MessageF(GENERIC_MESSAGE, "Error: Attempt to set variables for a non-existent tool: %d.\n", toolNumber);
	}
}
Ejemplo n.º 10
0
void RepRap::PrintTool(int toolNumber, StringRef& reply) const
{
	Tool* tool = GetTool(toolNumber);
	if (tool != nullptr)
	{
		tool->Print(reply);
	}
	else
	{
		reply.copy("Error: Attempt to print details of non-existent tool.\n");
	}
}
Ejemplo n.º 11
0
void EScene::RemoveSelection( ObjClassID classfilter )
{
    if (classfilter==OBJCLASS_DUMMY){
        SceneToolsMapPairIt _I = m_SceneTools.begin();
        SceneToolsMapPairIt _E = m_SceneTools.end();
        for (; _I!=_E; _I++)
            if (_I->second&&_I->second->IsEditable())	_I->second->RemoveSelection();
    }else{
        ESceneToolBase* 		mt = GetTool(classfilter);
        if (mt&&mt->IsEditable()) 	mt->RemoveSelection();
    }
    UI->UpdateScene	(true);
}
Ejemplo n.º 12
0
//-----------------------------------------------------------------------------
// Purpose: Returns a tool pointer for a given tool ID, NULL if there is no
//			corresponding tool.
//-----------------------------------------------------------------------------
CBaseTool *CToolManager::GetToolForID(ToolID_t eToolID)
{
	int nToolCount = GetToolCount();
	for (int i = 0; i < nToolCount; i++)
	{
		CBaseTool *pTool = GetTool(i);
		if (pTool->GetToolID() == eToolID)
		{
			return pTool;
		}
	}

	return NULL;
}
Ejemplo n.º 13
0
void EScene::ShowObjects( bool flag, ObjClassID classfilter, bool bAllowSelectionFlag, bool bSelFlag )
{
    if (classfilter==OBJCLASS_DUMMY){
        SceneToolsMapPairIt _I = m_SceneTools.begin();
        SceneToolsMapPairIt _E = m_SceneTools.end();
        for (; _I!=_E; _I++)
            if (_I->second)	_I->second->ShowObjects(flag, bAllowSelectionFlag, bSelFlag);
    }else{
        ESceneToolBase* mt = GetTool(classfilter);
        if (mt)
        	mt->ShowObjects(flag, bAllowSelectionFlag, bSelFlag);
    }
    UI->RedrawScene();
}
Ejemplo n.º 14
0
bool mitk::NavigationToolStorage::AddTool(mitk::NavigationTool::Pointer tool)
  {
  if (GetTool(tool->GetIdentifier()).IsNotNull()) return false;
  else
    {
    m_ToolCollection.push_back(tool);
    if(m_DataStorage.IsNotNull())
      {
      if (!m_DataStorage->Exists(tool->GetDataNode()))
        m_DataStorage->Add(tool->GetDataNode());
      }
    return true;
    }
  }
Ejemplo n.º 15
0
void EScene::InvertSelection( ObjClassID classfilter )
{
    if (classfilter==OBJCLASS_DUMMY)
    {
        SceneToolsMapPairIt _I = m_SceneTools.begin();
        SceneToolsMapPairIt _E = m_SceneTools.end();
        for (; _I!=_E; ++_I)
            if (_I->second)	_I->second->InvertSelection();
    }else
    {
        ESceneToolBase* mt 	= GetTool(classfilter);
        if (mt)
        	mt->InvertSelection();
    }
    UI->RedrawScene();
}
Ejemplo n.º 16
0
void RepRap::StandbyTool(int toolNumber)
{
	Tool* tool = GetTool(toolNumber);
	if (tool != nullptr)
	{
		tool->Standby();
		if (currentTool == tool)
		{
			currentTool = nullptr;
		}
	}
	else
	{
		platform->MessageF(GENERIC_MESSAGE, "Error: Attempt to standby a non-existent tool: %d.\n", toolNumber);
	}
}
Ejemplo n.º 17
0
int EScene::SelectionCount(bool testflag, ObjClassID classfilter)
{
	int count = 0;

    if (classfilter==OBJCLASS_DUMMY){
        SceneToolsMapPairIt _I = m_SceneTools.begin();
        SceneToolsMapPairIt _E = m_SceneTools.end();
        for (; _I!=_E; _I++)
            if (_I->second)	count+=_I->second->SelectionCount(testflag);
    }else{
        ESceneToolBase* mt = GetTool(classfilter);
        if (mt) 			count+=mt->SelectionCount(testflag);
    }

    return count;
}
Ejemplo n.º 18
0
wxString Compiler::GetGCCVersion() const
{
    // Get the compiler version
    static wxRegEx reVersion("([0-9]+\\.[0-9]+\\.[0-9]+)");
    wxString command;
    command << GetTool("CXX") << " --version";
    wxArrayString out;
    ProcUtils::SafeExecuteCommand(command, out);
    if(out.IsEmpty()) {
        return "";
    }

    if(reVersion.Matches(out.Item(0))) {
        return reVersion.GetMatch(out.Item(0));
    }
    return "";
}
Ejemplo n.º 19
0
const wxArrayString& Compiler::GetBuiltinMacros()
{
    if(!m_compilerBuiltinDefinitions.IsEmpty()) {
        return m_compilerBuiltinDefinitions;
    }

    wxArrayString definitions;
    // Command example: "echo | clang -dM -E - > /tmp/pp"
    if(GetCompilerFamily() == COMPILER_FAMILY_CLANG || GetCompilerFamily() == COMPILER_FAMILY_GCC ||
       GetCompilerFamily() == COMPILER_FAMILY_CYGWIN || GetCompilerFamily() == COMPILER_FAMILY_MINGW) {
        wxString command;
        wxString tool = GetTool("CXX");
        tool.Trim().Trim(false);
        command << "echo | \"" << tool << "\" -dM -E - > ";
        wxString tmpFile = wxFileName::CreateTempFileName("def-macros");
        ::WrapWithQuotes(tmpFile);
        command << tmpFile;
        ::WrapInShell(command);
        // CL_SYSTEM(command);

        ProcUtils::SafeExecuteCommand(command);
        wxFileName cmpMacrosFile(tmpFile);
        if(cmpMacrosFile.Exists()) {
            CL_DEBUG("Compiler builtin macros are written into: %s\n", cmpMacrosFile.GetFullPath());
            // we got our macro files
            {
                CxxPreProcessor pp;
                pp.Parse(cmpMacrosFile, kLexerOpt_CollectMacroValueNumbers);
                definitions = pp.GetDefinitions();
            }

            for(size_t i = 0; i < definitions.GetCount(); ++i) {
                CL_DEBUG("BUILTIN: %s\n", definitions.Item(i));
            }

            {
                // Delete the file
                wxLogNull n;
                ::wxRemoveFile(cmpMacrosFile.GetFullPath());
            }
        }
    }
    m_compilerBuiltinDefinitions.swap(definitions);
    return m_compilerBuiltinDefinitions;
}
Ejemplo n.º 20
0
void EScene::ZoomExtents( ObjClassID cls, BOOL bSel )
{
	Fbox BB;	BB.invalidate();
    if (cls==OBJCLASS_DUMMY){
        SceneToolsMapPairIt _I = m_SceneTools.begin();
        SceneToolsMapPairIt _E = m_SceneTools.end();
        for (; _I!=_E; _I++)
            if (_I->second){
            	Fbox bb; 			bb.invalidate();
            	_I->second->GetBBox	(bb,bSel);
                if (bb.is_valid()) 	BB.merge(bb);
            }
    }else{
        ESceneToolBase* mt = GetTool(cls);
        if (mt) 			mt->GetBBox(BB,bSel);
    }
    if (BB.is_valid()) Device.m_Camera.ZoomExtents(BB);
    else ELog.Msg(mtError,"Can't calculate bounding box. Nothing selected or some object unsupported this function.");
}
Ejemplo n.º 21
0
void Hero::Inherit(Hero* hero){
    if (hero == NULL){
        return;
    }

    m_currentHp = hero->getCurrentHp();
    m_maxHp = hero->getMaxHp();
    m_currentMp = hero->getCurrentMp();
    m_maxMp = hero->getMaxMp();
    setStrenth(hero->getStrenth());
    setDefence(hero->getDefence());
    setMoveVelocity(hero->getMoveVelocity());
    for (Tool* tool : hero->getTools()){
        GetTool(tool->getToolId());
    }
    for (Skill* skill : hero->getSkills()){
        GetSkill(skill->getSkillId());
    }
}
Ejemplo n.º 22
0
void EditorBase::LoadWorkspace()
{
    ConfigFile      config( "Workspace.cfg" );

    // If the subsystem config file can be found, load it.
    if( FileManager::FileExist("Config/Workspace.cfg") )
        config.Load();

    Int32   toolsCount = config.Get( "Workspace", "ToolsCount", (Int32)0 );
    String  toolClassName;

    for( Int32 i = 0; i < toolsCount; i++ )
    {
        ConfigSection& pSection = config["Tool_"+ToString(i)];
        toolClassName = pSection["ClassName"];

        EditorTool* tool = GetTool(toolClassName);
        if( tool )
            tool->LoadSettings( pSection );
    }
}
Ejemplo n.º 23
0
int EScene::FrustumSelect( int flag, ObjClassID classfilter )
{
	CFrustum frustum;
	int count = 0;
    if (!LUI->SelectionFrustum(frustum)) return 0;

    if (classfilter==OBJCLASS_DUMMY)
    {
        SceneToolsMapPairIt _I = m_SceneTools.begin();
        SceneToolsMapPairIt _E = m_SceneTools.end();
        for (; _I!=_E; ++_I)
            if (_I->second)	count+=_I->second->FrustumSelect(flag,frustum);
    }else{
        ESceneToolBase* mt = GetTool(classfilter);
        if (mt)
        	count+=mt->FrustumSelect(flag,frustum);
    }
    
    UI->RedrawScene();
	return count;
}
Ejemplo n.º 24
0
wxArrayString Compiler::POSIXGetIncludePaths() const
{
    wxString command;
    command << GetTool("CXX") << " -v -x c++ /dev/null -fsyntax-only";

    wxString outputStr = ::wxShellExec(command, wxEmptyString);

    wxArrayString arr;
    wxArrayString outputArr = ::wxStringTokenize(outputStr, wxT("\n\r"), wxTOKEN_STRTOK);

    // Analyze the output
    bool collect(false);
    for(size_t i = 0; i < outputArr.GetCount(); i++) {
        if(outputArr[i].Contains(wxT("#include <...> search starts here:"))) {
            collect = true;
            continue;
        }

        if(outputArr[i].Contains(wxT("End of search list."))) {
            break;
        }

        if(collect) {

            wxString file = outputArr.Item(i).Trim().Trim(false);

            // on Mac, (framework directory) appears also,
            // but it is harmless to use it under all OSs
            file.Replace(wxT("(framework directory)"), wxT(""));
            file.Trim().Trim(false);

            wxFileName includePath(file, "");
            includePath.Normalize();

            arr.Add(includePath.GetPath());
        }
    }
    return arr;
}
Ejemplo n.º 25
0
//---------------------------------------------------------------------------------------
//copy/paste utils
//---------------------------------------------------------------------------------------
void EScene::SaveSelection( ObjClassID classfilter, LPCSTR fname )
{
	VERIFY			( fname );

    xr_string 		full_name;
    full_name 		= fname;

    IWriter* F		= FS.w_open(full_name.c_str());  R_ASSERT(F);

    F->open_chunk	(CHUNK_VERSION);
    F->w_u32	   	(CURRENT_FILE_VERSION);
    F->close_chunk	();

    m_SaveCache.clear();
    if (OBJCLASS_DUMMY==classfilter)
    {
        SceneToolsMapPairIt _I = m_SceneTools.begin();
        SceneToolsMapPairIt _E = m_SceneTools.end();
        for (; _I!=_E; ++_I)
            if (_I->second&&_I->second->IsNeedSave())
            {
                F->open_chunk				(CHUNK_TOOLS_DATA+_I->first);
                _I->second->SaveSelection	(m_SaveCache);
                F->w						(m_SaveCache.pointer(),m_SaveCache.size());
                m_SaveCache.clear			();
                F->close_chunk				();
            }
    }else{
    	ESceneToolBase* mt = GetTool(classfilter); VERIFY(mt);
        F->open_chunk	(CHUNK_TOOLS_DATA+classfilter);
        mt->SaveSelection(m_SaveCache);
        F->w			(m_SaveCache.pointer(),m_SaveCache.size());
        m_SaveCache.clear();
        F->close_chunk	();
    }
        
    FS.w_close		(F);
}
Ejemplo n.º 26
0
//初始化主角各动作的动画
bool Hero::init(){
    if (!Sprite::init()){
        return false;
    }
    
    //将包含主角所有动作帧的合图载入到帧缓存池中
    //SpriteFrameCache::getInstance()->addSpriteFramesWithFile("hero.plist", "hero.png");

    //设置主角初始帧
    this->initWithSpriteFrameName("hero_stand00.png");

    //创建站立动画,帧数8,帧率10
    Animation* standAnimation = GameUtile::createNormalAction("hero_stand%02d.png", 8, 10);
    this->setStandAction(RepeatForever::create(Animate::create(standAnimation)));

    //创建行走动画,帧数8,帧率20
    Animation* walkAnimation = GameUtile::createNormalAction("hero_walk%02d.png", 8, 14);
    this->setWalkAction(RepeatForever::create(Animate::create(walkAnimation)));

    Animation* jumpAnimation = GameUtile::createNormalAction("hero_jump%02d.png", 9, 20);
    this->setJumpAction(Sequence::create(Animate::create(jumpAnimation),
        CallFuncN::create(CC_CALLBACK_0(Hero::EnableMoveable, this)),
        NULL));

    //Animation* dropAnimation = GameUtile::createNormalAction("hero_stand00.png", 1, 10);
    //this->setDropAction(RepeatForever::create(Animate::create(dropAnimation)));

    Animation* crouchAnimation = GameUtile::createNormalAction("hero_crouch%02d.png", 4, 20);
    this->setCrouchAction(Animate::create(crouchAnimation));
    Animation* standupAnimation = GameUtile::createNormalAction("hero_standup%02d.png", 4, 20);
    this->setStandupAction(Sequence::create(Animate::create(standupAnimation),
        CallFuncN::create(CC_CALLBACK_0(Hero::EnableMoveable, this)), 
        NULL));

    Animation* attackAnimation = GameUtile::createNormalAction("hero_attack%02d.png", 12, 20);
    this->setAttackAction(Sequence::create(Animate::create(attackAnimation),
        CallFuncN::create(CC_CALLBACK_0(Hero::EnableMoveable, this)), 
        NULL));

    Animation* walkAttackAnimation = GameUtile::createNormalAction("hero_walkattack%02d.png", 6, 30);
    this->setWalkAttackAction(Sequence::create(Animate::create(walkAttackAnimation),
        CallFuncN::create(CC_CALLBACK_0(Hero::EnableMoveable, this)),
        NULL));

    Animation* jumpAttackAnimation = GameUtile::createNormalAction("hero_jumpattack%02d.png", 4, 14);
    this->setJumpAttackAction(Sequence::create(Animate::create(jumpAttackAnimation),
        CallFuncN::create(CC_CALLBACK_0(Hero::EnableMoveable, this)),
        NULL));

    Animation* hurtAnimation = GameUtile::createNormalAction("hero_hurt%02d.png", 2, 20);
    this->setHurtAction(Sequence::create(Animate::create(hurtAnimation), 
        CallFuncN::create(CC_CALLBACK_0(Role::EndHurt, this)), 
        NULL));

    Animation* dieAnimation = GameUtile::createNormalAction("hero_die%02d.png", 5, 10);
    this->setHurtAction(Animate::create(dieAnimation));

    //Add other actions here

    m_currentHp = 100;
    m_maxHp = 100;
    m_currentMp = 100;
    m_maxMp = 100;
    m_strenth = 20;
    m_defence = 20;
    m_moveVelocity = 5;

    m_bodyBox = GameUtile::createBoundingBox(Vec2(32, 16), getContentSize() - Size(64, 28));
    m_attackBox = GameUtile::createBoundingBox(Vec2(80, 20), Size(80, getContentSize().height + 20));
    m_talkingBox = GameUtile::createBoundingBox(Vec2(-400, -50), Size(800, getContentSize().height + 100));

    GetTool(TOOL_HPBOTTLE);
    GetSkill(SKILL_THROW_FIRE);

    //设置初始速度
    this->setVelocity(Vec2(0, 0));

    //set other properties here

    return true;
}
Ejemplo n.º 27
0
Compiler::Compiler(wxXmlNode* node, Compiler::eRegexType regexType)
    : m_objectNameIdenticalToFileName(false)
    , m_isDefault(false)
{
    // ensure all relevant entries exist in switches map (makes sure they show up in build settings dlg)
    SetSwitch("Include", "");
    SetSwitch("Debug", "");
    SetSwitch("Preprocessor", "");
    SetSwitch("Library", "");
    SetSwitch("LibraryPath", "");
    SetSwitch("Source", "");
    SetSwitch("Output", "");
    SetSwitch("Object", "");
    SetSwitch("ArchiveOutput", "");
    SetSwitch("PreprocessOnly", "");

    // ensure all relevant entries exist in tools map (makes sure they show up in build settings dlg)
    SetTool("LinkerName", "");
    SetTool("SharedObjectLinkerName", "");
    SetTool("CXX", "");
    SetTool("CC", "");
    SetTool("AR", "");
    SetTool("ResourceCompiler", "");
    SetTool("MAKE", "");
    SetTool("AS", "as"); // Assembler, default to as

    m_fileTypes.clear();
    if(node) {
        m_name = XmlUtils::ReadString(node, wxT("Name"));
        m_compilerFamily = XmlUtils::ReadString(node, "CompilerFamily");

        if(m_compilerFamily == "GNU GCC") {
            // fix wrong name
            m_compilerFamily = COMPILER_FAMILY_GCC;
        }

        m_isDefault = XmlUtils::ReadBool(node, "IsDefault");

        if(!node->HasProp(wxT("GenerateDependenciesFiles"))) {
            if(m_name == wxT("gnu g++") || m_name == wxT("gnu gcc")) {
                m_generateDependeciesFile = true;
            } else
                m_generateDependeciesFile = false;
        } else {
            m_generateDependeciesFile = XmlUtils::ReadBool(node, wxT("GenerateDependenciesFiles"));
        }

        if(!node->HasProp(wxT("ReadObjectsListFromFile"))) {
            m_readObjectFilesFromList = true;
        } else {
            m_readObjectFilesFromList = XmlUtils::ReadBool(node, wxT("ReadObjectsListFromFile"));
        }

        m_objectNameIdenticalToFileName = XmlUtils::ReadBool(node, wxT("ObjectNameIdenticalToFileName"));

        wxXmlNode* child = node->GetChildren();
        while(child) {
            if(child->GetName() == wxT("Switch")) {
                m_switches[XmlUtils::ReadString(child, wxT("Name"))] = XmlUtils::ReadString(child, wxT("Value"));
            }

            else if(child->GetName() == wxT("Tool")) {
                m_tools[XmlUtils::ReadString(child, wxT("Name"))] = XmlUtils::ReadString(child, wxT("Value"));
            }

            else if(child->GetName() == wxT("Option")) {
                wxString name = XmlUtils::ReadString(child, wxT("Name"));
                if(name == wxT("ObjectSuffix")) {
                    m_objectSuffix = XmlUtils::ReadString(child, wxT("Value"));
                } else if(name == wxT("DependSuffix")) {
                    m_dependSuffix = XmlUtils::ReadString(child, wxT("Value"));
                } else if(name == wxT("PreprocessSuffix")) {
                    m_preprocessSuffix = XmlUtils::ReadString(child, wxT("Value"));
                }
            } else if(child->GetName() == wxT("File")) {
                Compiler::CmpFileTypeInfo ft;
                ft.compilation_line = XmlUtils::ReadString(child, wxT("CompilationLine"));
                ft.extension = XmlUtils::ReadString(child, wxT("Extension")).Lower();

                long kind = (long)CmpFileKindSource;
                if(XmlUtils::ReadLong(child, wxT("Kind"), kind) == CmpFileKindSource) {
                    ft.kind = CmpFileKindSource;
                } else {
                    ft.kind = CmpFileKindResource;
                }
                m_fileTypes[ft.extension] = ft;
            }

            else if(child->GetName() == wxT("Pattern")) {
                if(XmlUtils::ReadString(child, wxT("Name")) == wxT("Error")) {
                    // found an error description
                    CmpInfoPattern errPattern;
                    errPattern.fileNameIndex = XmlUtils::ReadString(child, wxT("FileNameIndex"));
                    errPattern.lineNumberIndex = XmlUtils::ReadString(child, wxT("LineNumberIndex"));
                    errPattern.columnIndex = XmlUtils::ReadString(child, "ColumnIndex", "-1");
                    errPattern.pattern = child->GetNodeContent();
                    m_errorPatterns.push_back(errPattern);
                } else if(XmlUtils::ReadString(child, wxT("Name")) == wxT("Warning")) {
                    // found a warning description
                    CmpInfoPattern warnPattern;
                    warnPattern.fileNameIndex = XmlUtils::ReadString(child, wxT("FileNameIndex"));
                    warnPattern.lineNumberIndex = XmlUtils::ReadString(child, wxT("LineNumberIndex"));
                    warnPattern.columnIndex = XmlUtils::ReadString(child, "ColumnIndex", "-1");
                    warnPattern.pattern = child->GetNodeContent();
                    m_warningPatterns.push_back(warnPattern);
                }
            }

            else if(child->GetName() == wxT("GlobalIncludePath")) {
                m_globalIncludePath = child->GetNodeContent();
            }

            else if(child->GetName() == wxT("GlobalLibPath")) {
                m_globalLibPath = child->GetNodeContent();
            }

            else if(child->GetName() == wxT("PathVariable")) {
                m_pathVariable = child->GetNodeContent();
            }

            else if(child->GetName() == wxT("CompilerOption")) {
                CmpCmdLineOption cmpOption;
                cmpOption.name = XmlUtils::ReadString(child, wxT("Name"));
                cmpOption.help = child->GetNodeContent();
                m_compilerOptions[cmpOption.name] = cmpOption;
            }

            else if(child->GetName() == wxT("LinkerOption")) {
                CmpCmdLineOption cmpOption;
                cmpOption.name = XmlUtils::ReadString(child, wxT("Name"));
                cmpOption.help = child->GetNodeContent();
                m_linkerOptions[cmpOption.name] = cmpOption;
            }

            else if(child->GetName() == wxT("InstallationPath")) {
                m_installationPath = child->GetNodeContent();
            }

            child = child->GetNext();
        }

        if(GetTool("MAKE").IsEmpty()) {
            BuilderConfigPtr bldr = BuildSettingsConfigST::Get()->GetBuilderConfig("");
            if(bldr) {
                SetTool("MAKE", wxString() << bldr->GetToolPath() << " -j " << bldr->GetToolJobs());
            }
        }

        // Default values for the assembler
        if(GetTool("AS").IsEmpty() && GetName().CmpNoCase("vc++") == 0) {
            SetTool("AS", "nasm");

        } else if(GetTool("AS").IsEmpty()) {
            SetTool("AS", "as");
        }

        // For backward compatibility, if the compiler / linker options are empty - add them
        if(IsGnuCompatibleCompiler() && m_compilerOptions.empty()) {
            AddDefaultGnuComplierOptions();
        }

        if(IsGnuCompatibleCompiler() && m_linkerOptions.empty()) {
            AddDefaultGnuLinkerOptions();
        }

    } else {
        // Create a default compiler: g++
        m_name = "";
        m_compilerFamily = COMPILER_FAMILY_GCC;
        m_isDefault = false;
        SetSwitch("Include", "-I");
        SetSwitch("Debug", "-g ");
        SetSwitch("Preprocessor", "-D");
        SetSwitch("Library", "-l");
        SetSwitch("LibraryPath", "-L");
        SetSwitch("Source", "-c ");
        SetSwitch("Output", "-o ");
        SetSwitch("Object", "-o ");
        SetSwitch("ArchiveOutput", " ");
        SetSwitch("PreprocessOnly", "-E");

        m_objectSuffix = ".o";
        m_preprocessSuffix = ".i";

        if(regexType == kRegexGNU) {
            AddPattern(eErrorPattern,
                       "^([^ ][a-zA-Z:]{0,2}[ a-zA-Z\\.0-9_/\\+\\-]+ *)(:)([0-9]*)([:0-9]*)(: )((fatal "
                       "error)|(error)|(undefined reference))",
                       1,
                       3,
                       4);
            AddPattern(eErrorPattern,
                       "^([^ ][a-zA-Z:]{0,2}[ a-zA-Z\\.0-9_/\\+\\-]+ *)(:)([^ ][a-zA-Z:]{0,2}[ a-zA-Z\\.0-9_/\\+\\-]+ "
                       "*)(:)(\\(\\.text\\+[0-9a-fx]*\\))",
                       3,
                       1,
                       -1);
            AddPattern(eErrorPattern,
                       "^([^ ][a-zA-Z:]{0,2}[ a-zA-Z\\.0-9_/\\+\\-]+ *)(:)([^ ][a-zA-Z:]{0,2}[ a-zA-Z\\.0-9_/\\+\\-]+ "
                       "*)(:)([0-9]+)(:)",
                       3,
                       1,
                       -1);
            AddPattern(eErrorPattern, "undefined reference to", -1, -1, -1);
            AddPattern(eErrorPattern, "\\*\\*\\* \\[[a-zA-Z\\-_0-9 ]+\\] (Error)", -1, -1, -1);

            AddPattern(eWarningPattern,
                       "([a-zA-Z:]{0,2}[ a-zA-Z\\.0-9_/\\+\\-]+ *)(:)([0-9]+ *)(:)([0-9:]*)?( warning)",
                       1,
                       3,
                       4);
            AddPattern(eWarningPattern,
                       "([a-zA-Z:]{0,2}[ a-zA-Z\\.0-9_/\\+\\-]+ *)(:)([0-9]+ *)(:)([0-9:]*)?( note)",
                       1,
                       3,
                       -1);
            AddPattern(eWarningPattern,
                       "([a-zA-Z:]{0,2}[ a-zA-Z\\.0-9_/\\+\\-]+ *)(:)([0-9]+ *)(:)([0-9:]*)?([ ]+instantiated)",
                       1,
                       3,
                       -1);
            AddPattern(eWarningPattern,
                       "(In file included from *)([a-zA-Z:]{0,2}[ a-zA-Z\\.0-9_/\\+\\-]+ *)(:)([0-9]+ *)(:)([0-9:]*)?",
                       2,
                       4,
                       -1);

            AddDefaultGnuComplierOptions();
            AddDefaultGnuLinkerOptions();

        } else {

            AddPattern(
                eErrorPattern, "^windres: ([a-zA-Z:]{0,2}[ a-zA-Z\\\\.0-9_/\\+\\-]+) *:([0-9]+): syntax error", 1, 2);
            AddPattern(eErrorPattern, "(^[a-zA-Z\\\\.0-9 _/\\:\\+\\-]+ *)(\\()([0-9]+)(\\))( \\: )(error)", 1, 3);
            AddPattern(eErrorPattern, "(LINK : fatal error)", 1, 1);
            AddPattern(eErrorPattern, "(NMAKE : fatal error)", 1, 1);
            AddPattern(eWarningPattern, "(^[a-zA-Z\\\\.0-9 _/\\:\\+\\-]+ *)(\\()([0-9]+)(\\))( \\: )(warning)", 1, 3);
            AddPattern(eWarningPattern, "([a-z_A-Z]*\\.obj)( : warning)", 1, 1);
            AddPattern(eWarningPattern, "(cl : Command line warning)", 1, 1);
        }

        SetTool("LinkerName", "g++");
#ifdef __WXMAC__
        SetTool("SharedObjectLinkerName", "g++ -dynamiclib -fPIC");
#else
        SetTool("SharedObjectLinkerName", "g++ -shared -fPIC");
#endif

        SetTool("CXX", "g++");
        SetTool("CC", "gcc");
        SetTool("AR", "ar rcu");
        SetTool("ResourceCompiler", "windres");
        SetTool("AS", "as");

#ifdef __WXMSW__
        SetTool("MAKE", "mingw32-make");
#else
        SetTool("MAKE", "make");
#endif

        m_globalIncludePath = wxEmptyString;
        m_globalLibPath = wxEmptyString;
        m_pathVariable = wxEmptyString;
        m_generateDependeciesFile = false;
        m_readObjectFilesFromList = true;
        m_objectNameIdenticalToFileName = false;
    }

    if(m_generateDependeciesFile && m_dependSuffix.IsEmpty()) {
        m_dependSuffix = m_objectSuffix + wxT(".d");
    }

    if(!m_switches[wxT("PreprocessOnly")].IsEmpty() && m_preprocessSuffix.IsEmpty()) {
        m_preprocessSuffix = m_objectSuffix + wxT(".i");
    }

    if(m_fileTypes.empty()) {
        AddCmpFileType("cpp",
                       CmpFileKindSource,
                       "$(CXX) $(SourceSwitch) \"$(FileFullPath)\" $(CXXFLAGS) "
                       "$(ObjectSwitch)$(IntermediateDirectory)/$(ObjectName)$(ObjectSuffix) "
                       "$(IncludePath)");
        AddCmpFileType("cxx",
                       CmpFileKindSource,
                       "$(CXX) $(SourceSwitch) \"$(FileFullPath)\" $(CXXFLAGS) "
                       "$(ObjectSwitch)$(IntermediateDirectory)/$(ObjectName)$(ObjectSuffix) "
                       "$(IncludePath)");
        AddCmpFileType("c++",
                       CmpFileKindSource,
                       "$(CXX) $(SourceSwitch) \"$(FileFullPath)\" $(CXXFLAGS) "
                       "$(ObjectSwitch)$(IntermediateDirectory)/$(ObjectName)$(ObjectSuffix) "
                       "$(IncludePath)");
        AddCmpFileType("c",
                       CmpFileKindSource,
                       "$(CC) $(SourceSwitch) \"$(FileFullPath)\" $(CFLAGS) "
                       "$(ObjectSwitch)$(IntermediateDirectory)/$(ObjectName)$(ObjectSuffix) "
                       "$(IncludePath)");
        AddCmpFileType("cc",
                       CmpFileKindSource,
                       "$(CXX) $(SourceSwitch) \"$(FileFullPath)\" $(CXXFLAGS) "
                       "$(ObjectSwitch)$(IntermediateDirectory)/$(ObjectName)$(ObjectSuffix) "
                       "$(IncludePath)");
        AddCmpFileType("m",
                       CmpFileKindSource,
                       "$(CXX) -x objective-c $(SourceSwitch) \"$(FileFullPath)\" $(CXXFLAGS) "
                       "$(ObjectSwitch)$(IntermediateDirectory)/$(ObjectName)$(ObjectSuffix) "
                       "$(IncludePath)");
        AddCmpFileType("mm",
                       CmpFileKindSource,
                       "$(CXX) -x objective-c++ $(SourceSwitch) \"$(FileFullPath)\" "
                       "$(CXXFLAGS) "
                       "$(ObjectSwitch)$(IntermediateDirectory)/$(ObjectName)$(ObjectSuffix) "
                       "$(IncludePath)");
        AddCmpFileType("s",
                       CmpFileKindSource,
                       "$(AS) \"$(FileFullPath)\" $(ASFLAGS) "
                       "$(ObjectSwitch)$(IntermediateDirectory)/$(ObjectName)$(ObjectSuffix) "
                       "-I$(IncludePath)");
        AddCmpFileType("rc",
                       CmpFileKindResource,
                       "$(RcCompilerName) -i \"$(FileFullPath)\" $(RcCmpOptions)   "
                       "$(ObjectSwitch)$(IntermediateDirectory)/"
                       "$(ObjectName)$(ObjectSuffix) $(RcIncludePath)");
    }

    // Add support for assembler file
    if(m_fileTypes.count("s") == 0) {
        AddCmpFileType("s",
                       CmpFileKindSource,
                       "$(AS) \"$(FileFullPath)\" $(ASFLAGS) "
                       "$(ObjectSwitch)$(IntermediateDirectory)/$(ObjectName)$(ObjectSuffix) "
                       "-I$(IncludePath)");
    }
}
Ejemplo n.º 28
0
mitk::NavigationTool::Pointer mitk::NavigationToolStorage::GetTool(std::string identifier)
  {
  for (int i=0; i<GetToolCount(); i++) if ((GetTool(i)->GetIdentifier())==identifier) return GetTool(i);
  return NULL;
  }
Ejemplo n.º 29
0
xr_string EScene::LevelPartName(LPCSTR map_name, ObjClassID cls)
{
    return 			LevelPartPath(map_name)+GetTool(cls)->ClassName() + ".part";
}
Ejemplo n.º 30
0
mitk::NavigationTool::Pointer mitk::NavigationToolStorage::GetToolByName(std::string name)
  {
  for (int i=0; i<GetToolCount(); i++) if ((GetTool(i)->GetToolName())==name) return GetTool(i);
  return NULL;
  }