📄 install.tcl
字号:
if {"$defInstFlag" == "1"} {
set productObj($prodIndex,instFlag) 1
set productObj($prodIndex,prevInstFlag) 1
}
}
if {[llength $partIndexList] == 1} {
set partObj([lindex $partIndexList 0],instFlag) 1
set partObj([lindex $partIndexList 0],prevInstFlag) 1
}
lappend productDescList \
[list $productObj($prodIndex,desc) $prodIndex]
}
set cdObj(productIndexList) {}
foreach pair [lsort $productDescList] {
lappend cdObj(productIndexList) [lindex $pair 1]
}
}
if [debug] {puts "finish constructing the products array"}
}
##############################################################################
#
# cdInfoGet - returns the requested information
#
# Following is the list of available commands:
#
# Command Meaning
# ------- -------
# number the name of the CDROM
# size the total size of unlocked products
# totalFile the total files of unlocked products
# stateInfo the global selection information
# featureIdList the feature list of unlocked products
# productIndexList the index list of unlocked products
# selectedProdIndexList the selected products index list
# selectedProdNameList the selected products name list
# installedFeatureIdList the selected feature id list
#
# SYNOPSIS
# cdInfoGet <command>
#
# PARAMETERS:
# <command> : one of the above commands
#
# RETURNS: the requested information
#
# ERRORS: N/A
#
proc cdInfoGet {info} {
global cdObj
switch $info {
number { return $cdObj(number) }
productIndexList { return $cdObj(productIndexList) }
selectedProdIndexList {
set retVal {}
foreach prodIndex $cdObj(productIndexList) {
if [productInfoGet instFlag $prodIndex] {
lappend retVal $prodIndex
}
}
return $retVal
}
selectedProdNameList {
set retVal {}
foreach prodIndex [cdInfoGet selectedProdIndexList] {
set prodName [productInfoGet name $prodIndex]
if {[lsearch $retVal "$prodName"] == "-1"} {
lappend retVal $prodName
}
}
return $retVal
}
size {
set retVal 0
foreach selProdIndex [cdInfoGet selectedProdIndexList] {
incr retVal [productInfoGet size $selProdIndex]
}
return $retVal
}
totalFile {
set retVal 0
foreach selProdIndex [cdInfoGet selectedProdIndexList] {
incr retVal [productInfoGet totalFile $selProdIndex]
}
return $retVal
}
installedFeatureIdList {
set retVal {}
foreach selProdIndex [cdInfoGet selectedProdIndexList] {
set fId [productInfoGet installedFeatureIdList $selProdIndex]
if {("$fId" != "") && ([lsearch $retVal $fId] == "-1")} {
lappend retVal $fId
}
}
return [split [join $retVal]]
}
featureIdList {
set retVal {}
foreach prodIndex [cdInfoGet productIndexList] {
set fId [productInfoGet featureIdList $prodIndex]
if {("$fId" != "") && ([lsearch $retVal $fId] == "-1")} {
lappend retVal $fId
}
}
return [split [join $retVal]]
}
stateInfo {
set totalPrev 0
set totalCurr 0
set state "unchanged"
foreach prodIndex [cdInfoGet productIndexList] {
set prev [productInfoGet prevInstFlag $prodIndex]
set curr [productInfoGet instFlag $prodIndex]
incr totalPrev $prev
incr totalCurr $curr
if {"$prev" != "$curr"} {
set state "changed"
}
}
return [stateInfoHelper $state $totalCurr $totalPrev]
}
default { puts "cdInfoGet: unknown command: $info" }
}
}
##############################################################################
#
# featureDescGet - returns the feature name given the feature id
#
# SYNOPSIS
# featureDescGet <featureId>
#
# PARAMETERS:
# <featureId> : an integer
#
# RETURNS: the associated feature description or unknown if not exists.
#
# ERRORS: N/A
#
proc featureDescGet {featureId} {
global featureObj
if [info exists featureObj($featureId)] {
return $featureObj($featureId)
} {
return "unknown"
}
}
##############################################################################
#
# productInfoGet - returns the requested info of a product.
#
# Attribute Meaning
# --------- -------
# partIndexList a list of integer indentifies parts
# number a string that represents a product, sale perpective
# name a string that represents a product, mfg perpective
# desc a string that describes a product
# instFlag a toggle flag that tells if a product is selected
# prevInstFlag a previous stage of the above flag
# size a total size of a product
# totalFile a total files of a product
# selectedPartIndexList a list of selected part of a product
# featureIdList a list of feature id of a product
# installedFeatureIdList a list of selected feature id of a product
# stateInfo a selection state of a product
#
# SYNOPSIS
# productInfoGet <attrib> <productId>
#
# PARAMETERS:
# <attrib> : one of the above attributes
# <productId> : a uniq integer that identifies the product.
#
# RETURNS: the requested information.
#
# ERRORS: N/A
#
proc productInfoGet {info prodIndex} {
global productObj
switch $info {
partIndexList { return $productObj($prodIndex,partIndexList) }
number { return $productObj($prodIndex,number) }
name { return $productObj($prodIndex,name) }
desc { return $productObj($prodIndex,desc) }
instFlag { return $productObj($prodIndex,instFlag) }
prevInstFlag { return $productObj($prodIndex,prevInstFlag) }
size {
set retVal 0
foreach partIndex [productInfoGet selectedPartIndexList $prodIndex] {
incr retVal [partInfoGet size $partIndex]
}
if {($retVal < 104858) && ($retVal > 0)} { set retVal 104858 }
return $retVal
}
totalFile {
set retVal 0
foreach partIndex [productInfoGet selectedPartIndexList $prodIndex] {
incr retVal [partInfoGet totalFile $partIndex]
}
return $retVal
}
selectedPartIndexList {
set retVal {}
foreach partIndex $productObj($prodIndex,partIndexList) {
if {"[partInfoGet instFlag $partIndex]" == "1"} {
lappend retVal $partIndex
}
}
return $retVal
}
featureIdList {
set retVal {}
foreach partIndex $productObj($prodIndex,partIndexList) {
set fId [partInfoGet featureId $partIndex]
if {"$fId" != ""} {
lappend retVal $fId
}
}
return [join $retVal]
}
installedFeatureIdList {
set retVal {}
foreach partIndex $productObj($prodIndex,partIndexList) {
set fId [partInfoGet featureId $partIndex]
if {"$fId" != ""} {
lappend retVal $fId
}
}
return [join $retVal]
}
stateInfo {
set totalPrev 0
set totalCurr 0
set state "unchanged"
foreach partIndex $productObj($prodIndex,partIndexList) {
set prev [partInfoGet prevInstFlag $partIndex]
set curr [partInfoGet instFlag $partIndex]
incr totalPrev $prev
incr totalCurr $curr
if {"$prev" != "$curr"} {
set state "changed"
}
}
return [stateInfoHelper $state $totalCurr $totalPrev]
}
default { puts "productInfoGet: unknown info: $info" }
}
}
##############################################################################
#
# productInfoSet - changes the product object attributes
#
# see productInfoGet() for available products attributes.
#
# SYNOPSIS
# productInfoSet <attrib> <prodIndex> [value]
#
# PARAMETERS:
# <attrib> : a product attribute
# <prodIndex> : an integer identifies a product
# [value] : new value of an attribute
#
# RETURNS: N/A
#
# ERRORS: N/A
#
proc productInfoSet {info prodIndex {value ""}} {
global productObj pickList
switch $info {
partIndexList { set productObj($prodIndex,partIndexList) $value }
number { set productObj($prodIndex,number) $value }
desc { set productObj($prodIndex,desc) $value }
instFlag {
if {"$productObj($prodIndex,instFlag)" == "0" && \
"$value" == "1"} {
set setAllFlag 1
set productObj($prodIndex,instFlag) $value
foreach partIndex [productInfoGet partIndexList $prodIndex] {
if {"[partInfoGet instFlag $partIndex]" == "1"} {
set setAllFlag 0
break
}
}
if {"$setAllFlag" == "1"} {
foreach partIndex [productInfoGet partIndexList $prodIndex] {
partInfoSet instFlag $partIndex 1
set pickList(part,$partIndex) 1
}
}
} {
set productObj($prodIndex,instFlag) $value
}
}
stateCommit {
set productObj($prodIndex,prevInstFlag) \
$productObj($prodIndex,instFlag)
}
stateRestore {
set productObj($prodIndex,instFlag) \
$productObj($prodIndex,prevInstFlag)
}
childStateCommit {
foreach partIndex $productObj($prodIndex,partIndexList) {
partInfoSet stateCommit $partIndex
}
}
childStateRestore {
foreach partIndex $productObj($prodIndex,partIndexList) {
partInfoSet stateRestore $partIndex
}
}
default { puts "productInfoSet: unknown info: $info" }
}
}
##############################################################################
#
# partInfoGet - returns the requested attribute of a part object.
#
# Attribute Meaning
# --------- -------
# instFlag a toggle flags that indicate a selection state of a part
# prevInstFlag a previous state of the above flag
# featureId an integer that associated w/ licensed part
# desc a part description
# parent an integer that identifies the parent product
# size a total size of a part
# totalFile a tot
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -