📄 data_pilot_insert.restore
字号:
# Project Navigator Project Restoration Script## WARNING: Do not modify this file. Any alteration of this file is not# supported and will likely cause project restoration to fail. The # format and the contents will be modified without further notice.## This script can be used to recreate the associated project. To use this script,# source it in a Xilinx Tcl shell, such as xtclsh or the Project Navigator Tcl# Shell tab, and call the 'restore' proc. Restore takes the project directory as# an optional argument. Pass in the project directory if it is different than the# current working directory, otherwise don't pass in anything.## Example:# In this example the project is in the directory "./projects/m_project_dir".## source ./projects/m_project_dir/my_project.restore# restore ./projects/m_project_dir## Example:# In this example the project is in the current working directory.## source my_project.restore# restore## Note that restoring a project this way has the following limitations:# - Process status will not be restored.# - A root-level source will be set as "Top", even if a lower-level source had# previously been set as "Top".# - Sources with non-default Design View associations will revert to the default# association.# - Snapshots will not be restored.## The project which failed to load will be backed up as <project>.fail.# Please open a Technical Support WebCase at# www.xilinx.com/support/clearexpress/websupport.htm and submit this file, along# with the project source files, for evaluation.## Copyright 2007, Xilinx, Inc.proc ERR { msg } { puts "ERROR: $msg"}proc WARN { msg } { puts "WARNING: $msg"}proc INFO { msg } { puts "$msg"}# Helper that returns 1 if the string is blank, otherwise 0.proc IsBlank { str } { if { [string length $str] == 0 } { return 1 } return 0}# Helper for determining whether a value is 'NULL'.# Returns 1 if the value is 0; returns 0 if the value is anything else.proc IsNull { val } { if { $val == 0 } { return 1 } return 0}proc HandleException { script { msg "" } } { set catch_result [catch { uplevel 1 $script } RESULT] if {$catch_result} { if {![IsBlank $msg]} { ERR $msg } INFO "$RESULT" INFO "$::errorInfo" }}# These two procs help to load shared libraries in a platform# independent way.proc _LoadLibrary {name} { set libExt [info sharedlibextension] set libFullName "$name$libExt" HandleException { load $libFullName } "A problem occured loading library $libFullName."}proc _LoadFactoryLibrary {Factory} { HandleException { Xilinx::Cit::FactoryLoad $Factory } "A problem occured loading library $Factory."}_LoadLibrary libCit_CoreStub_LoadLibrary libPrjrep_CommonStub_LoadFactoryLibrary libPrjrep_Common_LoadLibrary libDpm_SupportStub_LoadLibrary libDpm_PnfStub_LoadLibrary libDpm_DefnDataStub_LoadLibrary libDpm_DesignDataStub_LoadLibrary libDpm_HdlStub_LoadLibrary libPrjrep_RepositoryStub_LoadLibrary libCitI_CoreStub_LoadLibrary libHdcI_HdcHDProjectStub_LoadLibrary libTcltaskI_TaskStub_LoadLibrary libCommonI_CommonStub_LoadFactoryLibrary libTcltask_Helpers_LoadFactoryLibrary libHdcC_HDProject_LoadLibrary libHdcI_HdcContainerStub# Helper to exectute code only when the (pointer) variable name is valid.proc OnOkPtr { var_name script } { if { [ uplevel info exists $var_name ] } { upvar $var_name var if { $var != 0 } { return [ uplevel $script ] } }}# Helper to exectute code only when the (pointer) variable name is 0.proc OnNullPtr { var_name script } { if { [ uplevel info exists $var_name ] } { upvar $var_name var if { $var == 0 } { return [ uplevel $script ] } }}# Helper to exectute code only when the value of variable name is 1.proc OnSuccess { var_name script } { if { $val != 0 } { return [ uplevel $script ] }}# Helper to exectute code only when the value of variable name is 0.proc OnFail { val script } { if { $val != 1 } { return [ uplevel $script ] }}# Helper to get a component interface.proc GetInterface { iUnk id { name "" } } { if {$iUnk == 0} { return 0 } set iIface [ $iUnk GetInterface $id ] OnNullPtr iIface { if {![IsBlank $name]} { ERR " Could not get the \"$name\" interface." } } return $iIface}# Helper to create a component and return one of its interfaces.proc CreateComponent { compId ifaceId { name "" } } { set iUnk [ ::Xilinx::Cit::FactoryCreate $compId ] set iIface [ GetInterface $iUnk $ifaceId ] OnNullPtr iIface { if {![IsBlank $name]} { ERR "Could not create a \"$name\" component." } } return $iIface}# Helper to release an objectproc Release { args } { foreach iUnk $args { set i_refcount [ GetInterface $iUnk $::xilinx::Prjrep::IRefCountID ] OnNullPtr i_refcount { set i_refcount [ GetInterface $iUnk $::xilinx::CommonI::IRefCountID ] } OnOkPtr i_refcount { $i_refcount Release } }}# Helper to loop over IIterator based pointers.proc ForEachIterEle { _ele_var_name _iter script } { if {$_iter == 0} { return 0 } upvar $_ele_var_name ele for { $_iter First } { ![ $_iter IsEnd ] } { $_iter Next } { set ele [ $_iter CurrentItem ] set returned_val [ uplevel $script ] }}# Helper to get the Tcl Project Manager, if possible.proc GetTclProjectMgr { } { set TclProjectMgrId "{7d528480-1196-4635-aba9-639446e4aa59}" set iUnk [ Xilinx::CitP::CreateComponent $TclProjectMgrId ] if {$iUnk == 0} { return 0 } set iTclProjectMgr [ $iUnk GetInterface $::xilinx::TcltaskI::ITclProjectMgrID ] OnNullPtr iTclProjectMgr { ERR "Could not create a \"TclProjectMgr\" component." } return $iTclProjectMgr}# Helper to get the current Tcl Project, if one is open.proc GetCurrentTclProject { } { set iTclProject 0 set iTclProjectMgr [GetTclProjectMgr] OnOkPtr iTclProjectMgr { set errmsg "" $iTclProjectMgr GetCurrentTclProject iTclProject errmsg } return $iTclProject}# Helper to get the current HDProject, if one is open.proc GetCurrentHDProject { } { set iHDProject 0 set iTclProjectMgr [GetTclProjectMgr] set errmsg "" OnOkPtr iTclProjectMgr { $iTclProjectMgr GetCurrentHDProject iHDProject errmsg } OnNullPtr iHDProject { ERR "Could not get the current HDProject." } return $iHDProject}# Helper to create a Project Helper.proc GetProjectHelper { } { set ProjectHelperID "{0725c3d2-5e9b-4383-a7b6-a80c932eac21}" set iProjHelper [CreateComponent $ProjectHelperID $::xilinx::Dpm::IProjectHelperID "Project Helper"] return $iProjHelper}# Helper to find out if a project is currently open.# Returns 1 if a project is open, otherwise 0.proc IsProjectOpen { } { set iTclProject [GetCurrentTclProject] set isOpen [expr {$iTclProject != 0}] Release $iTclProject return $isOpen}# Helper to return the lock file for the specified project if there is one.# Returns an empty string if there is no lock file on the specified project,# or there is no corresponding .ise file# This assumes that the project_file is in the current directory.# It also assumes project_file does not have a path.proc GetProjectLockFile { project_file } { if { ![ file isfile "$project_file" ] } { return } INFO "Checking for a lock file for \"$project_file\"." set lock_file "__ISE_repository_${project_file}_.lock" if { [ file isfile "$lock_file" ] } { return $lock_file } return }# Helper to back up the project file.# This assumes that the project_file is in the current directory.proc BackUpProject { project_file backup_file } { if { ![ file isfile "$project_file" ] } { WARN "Could not find \"$project_file\"; the project will not be backed up." return 0 } else { INFO "Backing up the project to \"$backup_file\"." file copy -force "$project_file" "$backup_file" } return 1}# Helper to remove the project file so that a new project can be created# in its place. Presumably the old project is corrupted and can no longer# be opened.proc RemoveProject { project_file } { file delete -force "$project_file" # Return failure if the project still exists. if { [ file isfile "$project_file" ] } { ERR "Could not remove \"$project_file\"; Unable to restore the project." return 0 } return 1}# Helper to open a project and return a project facilitator (pointer).proc OpenFacilProject { project_name } { # first make sure the tcl project mgr singleton exists GetTclProjectMgr # get a Project Helper and open the project. set iProjHelper [GetProjectHelper] if {$iProjHelper == 0} { return 0 } set result [$iProjHelper Open $project_name] OnFail $result { if {$result == 576460769483292673} { ERR "Could not open the project \"$project_name\" because it is locked." } else { ERR "Could not open the \"$project_name\" project." } Release $iProjHelper set iProjHelper 0 } return $iProjHelper}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -