📄 toolchain.tcl
字号:
# Copyright (c) 2000, Red Hat, Inc.# # This file is part of Source-Navigator.# # Source-Navigator is free software; you can redistribute it and/or# modify it under the terms of the GNU General Public License as published# by the Free Software Foundation; either version 2, or (at your option)# any later version.# # Source-Navigator is distributed in the hope that it will be useful,# but WITHOUT ANY WARRANTY; without even the implied warranty of# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU# General Public License for more details.# # You should have received a copy of the GNU General Public License along# with Source-Navigator; see the file COPYING. If not, write to# the Free Software Foundation, 59 Temple Place - Suite 330, Boston,# MA 02111-1307, USA.# #################################################### Toolchain spec and class for SN-IDE.## Copyright (c) 1999 Cygnus Solutions, Inc.## Written by Ian Roxborough <irox@cygnus.com>##################################################itcl_class snToolChain { protected ruleFlagsIDTagsList # array of IDTags for a flag_type for a rule protected rules # array of basic actions a rule protected ruleFlagsDebug # array of Debug flags protected ruleFlagsOptimize # array of Optimization flags protected ruleFlagsWarning # array of Warning flags protected ruleFlagsCodeGen # array of Code Generation flags protected ruleSuffix # array of rule suffixes protected ruleTool # array of "locations" of tools protected FormatDefinesProcs # array of define format proc of a tools protected FormatIncludeProcs # array of define format proc of a tools protected FileInfo # array of file type used by rules protected RuleInfo # array of general info for each rule protected linkerTool # Linker name/location. protected applicationEntryPoint ;# Flags for the entry point. protected isEmbedded # True if embedded (EL/IX) toolchain protected debuggerName # Name of debugger for target protected shortName # Short name of target. # Long name of toolchain i.e. "GNUPro elix x86" protected fulldescription "" # The tool (if any) to be used after the link stage. protected postLinkerTool "" protected postLinkerSuffixes "" protected postLinkerFlags "" # The proc to generate the rule for post Linking. protected userPostLinkerRule "" # The proc for creating and destorying custom target edit GUI. protected userGUIcode "" protected userRemoveGUIcode "" ################################################################## # snToolChain::AddRule # Add the basic rule/flags required to compile/transform/etc # # Parameters: # rule_type: CC CPP JAVA OTHER # rule_suffix: .c.obj .c.o .java.o etc # bin_tool: the binary to be executed, gcc, cl.exe, /usr/bin/gcc, etc # basic_action: "-c $<" minimal required flags method AddRule {rule_type rule_suffix bin_tool basic_action} { set ruleSuffix(${rule_type}) ${rule_suffix} set rules(${rule_type}) ${basic_action} set ruleTool(${rule_type}) ${bin_tool} } method AddRuleSuffix {rule_type rule_suffix} { set ruleSuffix(${rule_type}) [concat $ruleSuffix(${rule_type})\ ${rule_suffix}] } ################################################################## # snToolChain::AddTool # Add a tool assocated with a rule type, i.e. CC -> gcc. # # Parameters: # rule_type: CC CPP JAVA OTHER # tool: the binary to be executed, gcc, cl.exe, /usr/bin/gcc, etc method AddTool {rule_type tool} { set ruleSuffix(${rule_type}) ${tool} } ################################################################## # snToolChain::GetTool # Returns the tool given the rule_type. # # Parameters: # rule_type: CC CPP JAVA ... # # returns the the binary to be executed, gcc, cl.exe, /usr/bin/gcc, etc method GetTool {rule_type} { return $ruleTool(${rule_type}) } ################################################################## # snToolChain::AddFlagSet # Add Optimization flags to a rule. # Used to add flag(s) set to the rule. Each set of flags # will be selectable in the rule settings dialog later. # # Parameters: # rule_suffix - the rule that the flags apply to (e.g. .c.o) # flagType - Debug, Optimize, Warning # flags - the flags to be used (e.g. -Os -O2) # info - this is the information to displayed in the # widget used to select the flags set. This information # maybe a text string or one of the predefined flag sets: # OPT_NONE - None. # OPT_STD - Standard. # OPT_SPEED - Maximum Speed. # OPT_SIZE - Minimum Size. # # DBG_NONE - None. # DBG_STD - Standard debug. method AddRuleFlagSet {rule_type flag_type flags id_tag} { #TODO: check rule exists #TODO: check valid flag type switch ${flag_type} { Debug { set ruleFlagsDebug(${rule_type}${id_tag}) ${flags} } Optimize { set ruleFlagsOptimize(${rule_type}${id_tag}) ${flags} } Warning { set ruleFlagsWarning(${rule_type}${id_tag}) ${flags} } CodeGen { set ruleFlagsCodeGen(${rule_type}${id_tag}) ${flags} } } lappend ruleFlagsIDTagsList(${rule_type}${flag_type}) ${id_tag} } method AddRuleInfo {rule file_type general_description} { #TODO: check rule is valid set FileInfo(${rule}) ${file_type} set RuleInfo(${rule}) ${general_description} } method GetFileInfo {rule} { return [set FileInfo(${rule})] } method GetGeneralInfo {rule} { return [set RuleInfo(${rule})] } method GetRulesList {} { return [array names ruleTool] } method GetRuleSuffixList {rule_type} { return $ruleSuffix(${rule_type}) } method GetBasicAction {rule_type} { return $rules(${rule_type}) } method GetRuleFlags {rule_type flag_type id_tag} { #TODO: check rule exists #TODO: check valid flag type set flags "" switch ${flag_type} { Debug { if {[info exists ruleFlagsDebug(${rule_type}${id_tag})]} { set flags $ruleFlagsDebug(${rule_type}${id_tag}) } } Optimize { if {[info exists\ ruleFlagsOptimize(${rule_type}${id_tag})]} { set flags $ruleFlagsOptimize(${rule_type}${id_tag}) } } Warning { if {[info exists ruleFlagsWarning(${rule_type}${id_tag})]} { set flags $ruleFlagsWarning(${rule_type}${id_tag}) } } CodeGen { if {[info exists ruleFlagsCodeGen(${rule_type}${id_tag})]} { set flags $ruleFlagsCodeGen(${rule_type}${id_tag}) } } } return ${flags} } method GetRuleFlagsIDTagsList {rule_type flag_type} { return $ruleFlagsIDTagsList(${rule_type}${flag_type}) } method AddExeLinkerEntryPointFlag {rule_type flags} { set applicationEntryPoint(${rule_type}) ${flags} } method GetLinkerEntryPointFlag {rule_type} { if {[info exists applicationEntryPoint(${rule_type})]} { return $applicationEntryPoint(${rule_type}) } else { return "" } } method AddExeLinkerTool {tool} { set linkerTool(exeTool) ${tool} } method GetExeLinkerTool {} { if {[info exists linkerTool(exeTool)]} { return $linkerTool(exeTool) } return "" } method AddExeLinkerRule {basic_action} { set linkerTool(exeAction) ${basic_action} } method GetExeLinkerRule {} { if {[info exists linkerTool(exeAction)]} { return $linkerTool(exeAction) } return "" } method AddExeLinkerFlagSet {flag_type flags info} { } method AddLibLinkerTool {tool} { set linkerTool(libTool) ${tool} } method GetLibLinkerTool {} { if {[info exists linkerTool(libTool)]} { return $linkerTool(libTool) } return "" } method AddLibLinkerRule {basic_action} { set linkerTool(libAction) ${basic_action} } method GetLibLinkerRule {} { if {[info exists linkerTool(libAction)]} { return $linkerTool(libAction) } return "" } method SetUserTargetEditGUI {proc} { set userGUIcode $proc } # This is called to add custom GUI # bit to the targeteditor dialog. method GetUserTargetEditGUI {} { return $userGUIcode } method SetRemoveUserTargetEditGUI {proc} { set userRemoveGUIcode $proc } # This is called to add custom GUI
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -