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

📄 global.tcl

📁 vxworks下MV5500的BSP支持包。是支持tornad221下的版本。
💻 TCL
📖 第 1 页 / 共 4 页
字号:
# This procedure checks if a product is a licensed product, given a # featureId. A licensed product has a non-zero featureId.## SYNOPSIS:# licensedProductCheck featureID## PARAMETERS:# <featureID># Feature ID of the product## RETURNS: 1 if product is a licensed product, 0 otherwise.## ERRORS: N/A#proc licensedProductCheck {featureID} {    if { $featureID > 0 } {        return 1      } else {        return 0    }}################################################################################ hostIdGen - Generates the host Id## This routine generates the host Id from flexlm lmhostid call. If there is # no NIC card, it will proble for the Volume Serial Number (windows only)## SYNOPSIS:# hostIdGen## PARAMETERS:#     For Windows use#         "vsn":      Retrieve drive c: serial number (for Windows)#     For UNIX, no argument needed## RETURNS:#     host id from lmhostid call## ERRORS: N/A#proc hostIdGen {{arg ""}} {    global env setupVals    set hostId ""    if {"$arg" == ""} {        set option ""    } else {        set option "-$arg"    }        if {[isUnix]} {        if { [file exists $env(CD_BIN)/lmutil] } {            if { ![catch {exec $env(CD_BIN)/lmutil lmhostid -n} id] } {                set hostId $id            } else {                messageBox "INVALID HOST ID: $id\nSETUP will terminate.\n"                return -1            }        }    } else { # windows        if { [file exists $env(CD_BIN)/lmutil.exe] } {                                   if { [catch {exec $env(CD_BIN)/lmutil.exe \                                        lmhostid $option -n} hostId] } {                 messageBox "Failed retrieving hostID: $hostId"                set setupVals(cancel) 1                                applicationExit                return 0                                }                        # if no NIC card             if {"$hostId" == "ffffffff"} {                if {[catch {exec $env(CD_BIN)/lmutil.exe \                                        lmhostid -vsn -n} hostId]} {                     messageBox "Failed retrieving hostID (vsn): $hostId"                    set setupVals(cancel) 1                                    applicationExit                    return 0                                }             }                    }    }    dbgputs "hostID: $hostId"    return $hostId}############################################################################## hostOSGet - return the host OS version## This routine return the host OS version## SYNOPSYS:# hostOSGet## PARAMETERS: n/a## RETURNS: host OS version in string format or Error## ERRORS: N/A#proc hostOSGet {} {    set hostOS ""    if {[isUnix]} {        catch {exec uname -a} hostOS    } else {        if [catch {setupWinVerGetEx} hostOS] {            puts "error: $hostOS"        }    }    return $hostOS}############################################################################### isWRSStandAlone - determine whether the product is a Wind River#                   stand-alone product## This procedure determines whether the product is a Wind River stand-alone # product (i.e. whether this product is installed separate from the Tornado# tree. If the product is a Wind River stand-alone, then tornado-centric # codes will not be executed by SETUP (see more details in CONFIG.TCL)## SYNOPSIS# .tS# isWRSStandAlone# .tE## PARAMETERS: N/A## RETURNS: 0 if not WRS stand-alone#          1 if WRS stand-alone## ERRORS: N/A#proc isWRSStandAlone {} {    global WRS_STAND_ALONE    return $WRS_STAND_ALONE}############################################################################### isTornadoProduct - determine whether the CD is a standard Tornado #                    installation## This procedure determines whether the product is a standard Tornado# installation (i.e. whether this product is made for Tornado and is installed # into a Tornado tree). Tornado-centric codes will be executed by SETUP.## SYNOPSIS# .tS# is# .tE## PARAMETERS: N/A## RETURNS: 0 if non-Tornado product#          1 if Tornado product## ERRORS: N/A#proc isTornadoProduct {} {    global TORNADO_PRODUCT    return $TORNADO_PRODUCT}############################################################################### isStandAlone - determine if the product is FULLY a stand-alone product## This procedure determines if the product is FULLY a stand-alone product# (i.e. whether this product is installed separate from the Tornado tree) # and is NOT part of Wind River products (see more details in CONFIG.TCL).## SYNOPSIS# .tS# isStandAlone# .tE## PARAMETERS: N/A## RETURNS: 0 if not a FULL stand-alone#          1 if a FULL stand-alone## ERRORS: N/A##proc isStandAlone {} {    global STAND_ALONE    return $STAND_ALONE}############################################################################## isNumeric## This routine checks that a value is all numeric## SYNOPSYS:# isAllNumeric value title control## PARAMETERS:# the value to be accessed# an optional title for the message box.# an optional window.control value to write valid numbers to## RETURNS: 1 if value passed is all numeric, else returns 0## ERRORS: N/A#proc isNumeric {value {title "Numeric Input Error"} {control foo}} {    global ctrlVals    regexp {[0-9]*} $value match    set allNums $match    set lenAllNums [string length $allNums]    set lenValue [string length $value]    if {$lenAllNums != $lenValue} {        if {[controlExists $control]} {            if { $ctrlVals(useInputScript) } {                autoSetupLog "Error: This field must be numeric."                autoSetupLog "Application Exit\n"                set setupVals(cancel) 1                                applicationExit                return 0            } else {                dialog ok_with_title $title \                       "This field must be numeric, please re-enter the number."                controlValuesSet $control $allNums            }        }        return 0    } else {        return 1    }}############################################################################### isGUImode - determine whether SETUP is run on GUI mode or TEXT mode## This procedure will determine whether  SETUP is run on GUI mode or TEXT mode## SYNOPSIS# .tS# isGUImode# .tE## PARAMETERS: N/A## RETURNS: 0 if SETUP is run on TEXT mode#          1 if SETUP is run on GUI mode## ERRORS: N/A#proc isGUImode {} {    global setupVals    if { $setupVals(cmdMode) != "text" } {        return 1;    } else {        return 0;    }}############################################################################### isBSPcd - determine whether user is installing a BSP CD## This procedure will check the DISK_ID file of the CD image to determine# whether user is running a BSP CD installation## SYNOPSIS# .tS# isBSPcd# .tE## PARAMETERS: N/A## RETURNS: 1 if SETUP is running a BSP CD installation#          0 if otherwise (i.e. running a core CD)## ERRORS: N/A#proc isBSPcd {} {    global setupVals    return $setupVals(BSPcd)}################################################################################ tornadoVersionSet - sets the Tornado Version## Sets the global variable setupVals(torVersionNum) ## SYNOPSIS:# tornadoVersionSet val## PARAMETERS:# <val># Contains the Tornado Version## RETURNS: N/A## ERRORS: N/A#proc tornadoVersionSet {val} {    global setupVals    set setupVals(torVersionNum) $val}################################################################################ tornadoVersionGet - returns the Tornado Version## This routine returns the Tornado Version.  If it does not exist an empty# string is returned.## SYNOPSIS:# tornadoVersionGet## PARAMETERS: N/A## RETURNS: the Tornado Version if it exists, else an empty string.## ERRORS: N/A#proc tornadoVersionGet {} {    global setupVals    if {[info exists setupVals(torVersionNum)]} {        set v $setupVals(torVersionNum)    } else {                set v ""    }    return $v}################################################################################ tornadoDefaultGroupSet - sets the default Tornado Program Group name## Sets the global variable setupVals(torVersionNum)## SYNOPSIS:# tornadoDefaultGroupSet val## PARAMETERS:# <val># Contains the Tornado Program Group name## RETURNS: N/A## ERRORS: N/A#proc tornadoDefaultGroupSet {val} {    global setupVals    set setupVals(defGroup) $val}################################################################################ tornadoDefaultGroupGet - returns the default Tornado Program Group name## This routine returns the default Tornado Program Group name.  # If it does not exist an empty string is returned.## SYNOPSIS:# tornadoDefaultGroupGet## PARAMETERS: N/A## RETURNS: the Tornado Program Group name if it exists, else an empty string.## ERRORS: N/A#proc tornadoDefaultGroupGet {} {    global setupVals    if {[info exists setupVals(defGroup)]} {        set v $setupVals(defGroup)    } else {        set v ""    }    return $v}################################################################################ wrsLicenseGet - returns the customer's WRS license number ## This routine uses the Setup shared library function to return the customer's# WRS license number.   ## SYNOPSIS:# wrsLicenseGet## PARAMETERS: N/A## RETURNS: the WRS license number, or 0 if error.   ## ERRORS: N/A#proc wrsLicenseGet {} {    if [catch {setupLicenseNumGet} lic] {        dbgputs "wrsLicenseGet error: $lic"	return 0    } else {        return $lic    }}############################################################################### lunique - return a new list with unique elements of the old list## This procedure will return a new list with unique elements of the old list## SYNOPSIS# .tS# lunique# .tE## PARAMETERS:# .IP oldList# a list of elements## RETURNS: a new list with unique elements of the old list## ERRORS: N/A#proc lunique {oldList} {    set newList ""    foreach item $oldList {        if { [lsearch -exact $newList $item] == -1} {            lappend newList $item        }    }    return $newList}############################################################################### lsubstringAppend - inserts a string into a list, its position determined#                    by whether the string is a substring of an item already#                    in the list.## This procedure inserts a string into a list of strings.  It checks whether# the string is a substring of an item in the list.  If so, it inserts# the substring after the last occurrence of a pattern match.  For example,# "gnu" is added after "sfgnule sfgnu".  If there is no pattern match, the# string is added to the front of the list.## This procedure is used by toolsetExtract, which needs to ensure that# the toolset list orders the tools with unique tool strings coming first,# e.g. "sfgnule sfgnu gnule gnu".## SYNOPSIS# .tS# lsubstringAppend <list> <newitem># .tE## PARAMETERS:#     list: a list of strings#     newitem: string to be added to the list## RETURNS: a list of strings sorted with substrings coming last## ERRORS: N/A#proc lsubstringAppend {list newitem} {      if {[llength $list] == 0} {        set list $newitem    } else {                # check if newitem is a substring of any string in the list        set stringMatch [string first $newitem $list]        if {$stringMatch == -1} {            # no match, just concat the string to the front of the list            set list [concat $newitem $list]        } else {            # find the last string the newitem is a substring of            # and insert the newitem after that string            for {set i 0} {$i < [llength $list]} {incr i} {                set item [lindex $list $i]                if {[string first $newitem $item] != -1} {                    set matchPosition [expr $i + 1]                }             }            set list [linsert $list $matchPosition $newitem]        }     }    return $list}global LicInfoGetAllRequest LicFileConfigRequest CommitRequest AuthorizePinRequestset LicInfoGetAllRequest 1set LicFileConfigRequest 2set CommitRequest        3set AuthorizePinRequest  4

⌨️ 快捷键说明

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