⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 global.tcl

📁 windml3.0.3
💻 TCL
📖 第 1 页 / 共 4 页
字号:
# global.tcl - global Tcl functions for Setup.
#
# Copyright 1996-2003 Wind River Systems, Inc.
#
# modification history
# --------------------
# 04j,07nov03,bjl  added bypass procedures.
# 04i,27feb03,bjl  added lunique from compselect page and added
#                  lsubstringAppend procedure.                    
# 04h,14feb03,bjl  added wrsLicenseGet procedure.  
# 04g,13jun02,wmd  Need to add in size of DOCS directory if it exists for
#                  setupSizeGet return, SPR #78583.
# 04f,05mar02,bwd  Modified SETUP to be non-tornado centric
# 04e,20dec01,bwd  Added proc isBSPcd to check if user is installing BSP CD
# 04d,03dec01,bwd  Modified licensedProductCheck to check for non-zero
#                  featureId as a licensed product
# 04c,17sep01,bwd  Fixed spr 70204 - removed exit 1
# 04b,13sep01,bwd  Added path conversion for proc destDirGet
# 04a,12jun01,j_w  Modified for Tornado 2.2
# 03a,02may01,j_w  Update hostIdGen to use ether address by default
# 03z,08nov00,j_w  update arFlag to -crus
# 03y,15sep00,bwd  Modified proc hostIdGen to take in an argument to specify
#                  where to get hostID from for Windows
# 03x,31aug00,bwd  First check if file lmhostid exists before executing it
# 03w,28jun00,bwd  Changed the size of SETUP directory for linux to 77 MB
# 03v,09jun00,bwd  Added another host type check for x86-linux2
# 03u,05jun00,bwd  SPR 31449: changed the size of setup directory (in 
#                  setupSizeGet procedure) to match the actual size
# 03t,23may00,bwd  Fixed SPR 31387 - declared ctrlVals variable
# 03s,11may00,wmd  Fix spr # 31178, German version Windows causes Setup to
#                  fail.
# 03r,19apr00,bwd  Modified procedure licensedProductCheck to check using
#                  feature IDs
# 03q,27mar00,bwd  Removed proc licInfoDataParse - no longer used
# 03p,15feb00,j_w  Fix file closing in fileContentGet
# 03o,11feb00,wmd  Fix so that a mild error message is displayed if a file is
#                  missing.
# 03n,02feb00,bwd  Fixed error handling for test automation
# 03m,24jan00,bwd  Added new procedure "isGUImode" to check if SETUP is run in
#                  GUI mode or TEXT mode
# 03l,06dec99,j_w  Added licensedProductCheck
# 03k,12nov99,wmd  lmFeaturesTotals is now an array.
# 03j,11nov99,j_w  Added hostOSGet
# 03i,03nov99,wmd  Add a isNumeric procedure.
# 03h,03nov99,j_w  modified licInfoDataParse to add the PIN required field
# 03g,02nov99,j_w  added licInfoDataParse
# 03f,21oct99,bjl  removed parisc-hpux support.
# 03e,20oct99,j_w  Added lmhostIdGet
# 03d,19oct99,bjl  added tornadoProductCheck procedure.
# 03c,18oct99,j_w  Used setupVals(defGroup) in defGroupSet and defGroupGet
# 03b,05oct99,j_w  Added authCodeGet and authCodeSet
# 03a,30Sep99,j_w  Modified for T3
# 02s,31mar99,wmd  Update the sizes for Setup files in setupSizeGet.
# 02r,29mar99,wmd  Make sure that check for env(SETUP_DEBUG) or env(INF_DEBUG)
#                  are caught.
# 02q,19mar99,wmd  Add proc to write to a file, close the file.
# 02p,03mar99,tcy  Added setupSizeGet() (fix for SPR 25228)
# 02o,24feb99,wmd  Fix so that if exec call returns error, free is still set.
# 02n,02feb99,tcy  modify defGroupSet () to set Tornado2 as default if
#                  folder name selected is a T101 folder
# 02m,28jan99,bjl  added headers and edited for coding conventions.
# 02l,28jan99,wmd  Fix bug in checkPathLen when filename itself is too long.
# 02k,14jan99,wmd  Move procedure debug from INSTALL.TCL to this file.
# 02j,13jan99,wmd  Copy fspace proc from fspace.tcl to this file.
# 02i,18nov98,wmd  added proc checkPathLen
# 02h,16oct98,tcy  added instKeyData[G|S]et()
# 02g,15oct98,tcy  do a unix2dos on filename if win98 host in proc cdFileNameGet
# 02f,13oct98,wmd  do a unix2dos on filename if win95 host in proc cdFileNameGet
# 02e,15sep98,wmd  added cdFileNameGet proc, changed tmpDirGet() to return
#                  /vobs/wpwr/host/<HOST_TYPE>/lib if env var TCL_DEBUG exists.
# 02d,11sep98,tcy  added sysDir[G|S]et ()
# 02c,01sep98,wmd  added destDirDispGet proc.
# 02b,19aug98,wmd  add proc tmpDirGet.
# 02a,22jul98,tcy  moved licenseHomeDirGet/Set () to LICW32.TCL
# 01d,10aug97,pdn  fixed instKeyGet() to trim off white space before return.
# 01c,09feb97,pdn  added exitMsgSet/exitMsgGet functions
# 01b,25nov96,sj   added functions for tempDir, arFlags, currentIndex
# 01a,14nov96,pdn  written
#
# DESCRIPTION
# This file contains the common functions used by the Setup Tcl files.
#
#*/

##############################################################################
#
# userNameGet - returns the name of the user.
#
# This routine returns the name of the user.  If the user name has not been
# set, an empty string is returned.
#
# SYNOPSIS:
# userNameGet
#
# PARAMETERS: N/A
#
# RETURNS: the user name if it exists, else an empty string.
#
# ERRORS: N/A
#

proc userNameGet {} {
    global setupVals

    if {[info exists setupVals(userName)]} {
        return $setupVals(userName)
    } else {
        return ""
    }
}

##############################################################################
#
# userNameSet - sets the name of the user.
#
# Sets the global variable setupVals(userName) to the name of the user.
#
# SYNOPSIS:
# userNameSet val
#
# PARAMETERS:
# <val>
# Contains the name of the user.
#
# RETURNS: N/A
#
# ERRORS: N/A
#

proc userNameSet {val} {
    global setupVals

    set setupVals(userName) $val
}

##############################################################################
#
# companyNameGet - returns the company name.
#
# This routine returns the company name.  If the company name has not
# been set, an empty string is returned.
#
# SYNOPSIS:
# companyNameGet
#
# PARAMETERS: N/A
#
# RETURNS: the company name if it exists, else an empty string.
#
# ERRORS: N/A
#

proc companyNameGet {} {
    global setupVals

    if {[info exists setupVals(companyName)]} {
        return $setupVals(companyName)
    } else {
        return ""
    }
}

##############################################################################
#
# companyNameSet - sets the name of the company.
#
# Sets the global variable setupVals(companyName) to the name of the company.
#
# SYNOPSIS:
# companyNameSet val
#
# PARAMETERS:
# <val>
# Contains the name of the company.
#
# RETURNS: N/A
#
# ERRORS: N/A
#

proc companyNameSet {val} {
    global setupVals

    set setupVals(companyName) $val
}

##############################################################################
#
# instKeyGet - returns the installation key.
#
# This routine returns the installation key.  If the installation key has not
# been set, an empty string is returned.
#
# SYNOPSIS:
# instKeyGet
#
# PARAMETERS: N/A
#
# RETURNS: the installation key if it exists, else an empty string.
#
# ERRORS: N/A
#

proc instKeyGet {} {
    global setupVals

    if {[info exists setupVals(instKey)]} {
        return [string trim $setupVals(instKey)]
    } else {
        return ""
    }
}

##############################################################################
#
# instKeySet - sets the installation key.
#
# Sets the global variable setupVals(instKey) to the installation key.
#
# SYNOPSIS:
# instKeySet val
#
# PARAMETERS:
# <val>
# Contains the installation key.
#
# RETURNS: N/A
#
# ERRORS: N/A
#

proc instKeySet {val} {
    global setupVals

    set setupVals(instKey) $val
}

##############################################################################
#
# instKeyDataGet - returns the installation key data.
#
# This routine returns the installation key data, which includes
# the installation key history for a particular CD.  If the installation key
# data has not been set, an empty string is returned.
#
# SYNOPSIS:
# instKeyDataGet
#
# PARAMETERS: N/A
#
# RETURNS: the installation key data if it exists, else an empty string.
#
# ERRORS: N/A
#

proc instKeyDataGet {} {
    global setupVals

    if {[info exists setupVals(keyList)]} {
        return [string trim $setupVals(keyList)]
    } else {
        return ""
    }
}

##############################################################################
#
# instKeyDataSet - sets the installation key data.
#
# Sets the global variable setupVals(keyList) to the installation key data.
#
# SYNOPSIS:
# instKeyDataSet val
#
# PARAMETERS:
# <val>
# Contains the installation key data.
#
# RETURNS: N/A
#
# ERRORS: N/A
#

proc instKeyDataSet {val} {
    global setupVals

    set setupVals(keyList) $val
}

##############################################################################
#
# cdromZipDirGet - returns the directory containing the Setup zip files.
#
# This routine returns the directory containing the Setup zip (WIND) files.
# If the zip directory has not been set, an empty string is returned.
#
# SYNOPSIS:
# cdromZipDirGet
#
# PARAMETERS: N/A
#
# RETURNS: the zip directory if it exists, else an empty string.
#
# ERRORS: N/A
#

proc cdromZipDirGet {} {
    global setupVals

    if {[info exists setupVals(cdromZipDir)]} {
        return $setupVals(cdromZipDir)
    } else {
        return ""
    }
}

##############################################################################
#
# cdromZipDirSet - sets the zip directory.
#
# Sets the global variable setupVals(cdromZipDir) to the directory
# containing the Setup zip (WIND) files.
#
# SYNOPSIS:
# cdromZipDirSet val
#
# PARAMETERS:
# <val>
# Contains the zip directory.
#
# RETURNS: N/A
#
# ERRORS: N/A
#

proc cdromZipDirSet {val} {
    global setupVals

    set setupVals(cdromZipDir) $val
}

##############################################################################
#
# cdromRootDirGet - returns the root directory of the CD-ROM.
#
# This routine returns the root directory of the CD-ROM, or the root
# of the Setup tree.  If the root directory has not been set, an empty
# string is returned.
#
# SYNOPSIS:
# cdromRootDirGet
#
# PARAMETERS: N/A
#
# RETURNS: the Setup root directory if it exists, else an empty string.
#
# ERRORS: N/A
#

proc cdromRootDirGet {} {
    global env

    if {[info exists env(CD_ROOT)]} {
        return $env(CD_ROOT)
    } else {
        return ""
    }
}

##############################################################################
#
# cdFileNameGet - returns the root directory of the CD-ROM.
#
# This routine returns the root directory of the CD-ROM, or the root
# of the Setup tree.  If the root directory has not been set, an empty
# string is returned.
#
# SYNOPSIS:
# cdromRootDirGet
#
# PARAMETERS: N/A
#
# RETURNS: the Setup root directory if it exists, else an empty string.
#
# ERRORS: N/A
#

proc cdFileNameGet {fileName} {
    global ctrlVals

    # return only valid all uppercase or all lower case path/fileName

    set fn [string toupper $fileName]

    if {$ctrlVals(version) == "WIN95" || $ctrlVals(version) == "WIN98"} {
        set fn [unixToDos [file join [cdromRootDirGet] $fn]]
    } else {
        set fn [file join [cdromRootDirGet] $fn]
    }
    if {[file exists $fn]} {
        return $fn
    }

    set fn [string tolower $fileName]
    if {$ctrlVals(version) == "WIN95" || $ctrlVals(version) == "WIN98"} {
        set fn [unixToDos [file join [cdromRootDirGet] $fn]]
    } else {
        set fn [file join [cdromRootDirGet] $fn]
    }
    if {[file exists $fn]} {
        return $fn
    }

    if {$ctrlVals(version) == "WIN95" || $ctrlVals(version) == "WIN98"} {
        set fn [unixToDos [file join [cdromRootDirGet] $fileName]]
    } else {
        set fn [file join [cdromRootDirGet] $fileName]
    }
    return $fn
}

##############################################################################
#
# tmpDirGet - returns the temporary directory.
#
# This routine returns the temporary directory set by the environment
# variable TMP.  For debugging purposes and to use the tcl debugger, setting
# the environment variable TCL_DEBUG will return the [windHostType]/lib
# directory in the current view.  If the temp directory has not been set,
# an empty string is returned.
#
# SYNOPSIS:
# tmpDirGet
#
# PARAMETERS: N/A
#
# RETURNS: /vobs/wpwr/host/[windHostTypeGet] if env(TCL_DEBUG) exists,
#          the value set by the environment variable TMP, or the empty
#          string if neither exists.
#
# ERRORS: N/A
#

proc tmpDirGet {} {
    global env

    if {[info exists env(TCL_DEBUG)]} {
        return /vobs/wpwr/host/[windHostTypeGet]/lib
    }

    if {[info exists env(TMP)]} {
        return $env(TMP)
    } else {
        return ""
    }
}

##############################################################################
#
# uninstHomeDirGet - returns the uninstall home directory.
#
# This routine returns the uninstall home directory set by
# setupVals(uninstHomeDir).  If the uninstall home directory has not
# been set, an empty string is returned.
#
# SYNOPSIS:
# uninstHomeDirGet
#
# PARAMETERS: N/A
#
# RETURNS: the installation key if it exists, else an empty string.
#
# ERRORS: N/A
#

proc uninstHomeDirGet {} {
    global setupVals

    if {[info exists setupVals(uninstHomeDir)]} {
        return $setupVals(uninstHomeDir)
    } else {
        return ""
    }
}

##############################################################################
#
# uninstHomeDirSet - sets the uninstall home directory.
#
# Sets the global variable setupVals(uninstHomeDir) to the uninstall
# home directory.
#
# SYNOPSIS:
# uninstHomeDirSet val
#
# PARAMETERS:
# <val>
# Contains the uninstall home directory.
#
# RETURNS: N/A
#
# ERRORS: N/A
#

proc uninstHomeDirSet {val} {
    global setupVals

    set setupVals(uninstHomeDir) $val
}

##############################################################################
#
# destDirDispGet - returns the destination directory with slashes displayed
#                  in Unix format.
#
# Returns the destination directory to be displayed to the user.  Slashes
# are converted to Unix format.
#
# SYNOPSIS:
# destDirDispGet
#
# PARAMETERS: N/A
#
# RETURNS: the destination directory with slashes converted to Unix format.
#
# ERRORS: N/A
#

proc destDirDispGet {} {

    set destDir [destDirGet]
    if {$destDir != ""} {
        set destDir [dosToUnix $destDir]
    }
    return $destDir
}

##############################################################################
#
# destDirGet - returns the destination directory.
#
# This routine returns the destination directory location to install
# the files for the product(s).  If the destination directory has not
# been set, an empty string is returned.
#
# SYNOPSIS:
# destDirGet
#
# PARAMETERS: N/A
#
# RETURNS: the destination directory if it exists, else an empty string.
#
# ERRORS: N/A
#

proc destDirGet {} {

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -