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

📄 install.old

📁 好东西,欢迎下在,联系方式E-mail:xoming117@tom.com
💻 OLD
📖 第 1 页 / 共 5 页
字号:
            }

            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 total number of files of a part
# 
# SYNOPSIS
# partInfoGet <attrib> <partIndex>
#
# PARAMETERS: 
#    <attrib> : a part object's attribute
#    <partIndex> : an integer indentifies a part
#
# RETURNS: requested attribute
#
# ERRORS: N/A
#

proc partInfoGet {info partIndex} {
    global partObj

    switch $info {
        instFlag { return $partObj($partIndex,instFlag) }

        prevInstFlag { return $partObj($partIndex,prevInstFlag) }

        featureId { 
            if {$partObj($partIndex,featureId) > 0} {
                return $partObj($partIndex,featureId)
            } {
                return ""
            }
        }

        desc { return $partObj($partIndex,desc) }

        parent { return $partObj($partIndex,parent) }

        size { return $partObj($partIndex,size) }

        totalFile { return $partObj($partIndex,totalFile) }

        default { puts "partInfoGet: unknown info: $info" }
    }
}

##############################################################################
#
# partInfoSet - changes an attribute of a part object
#
# see partInfoGet() for available attribute of a part object
#
# SYNOPSIS
# partInfoSet <attrib> <partIndex> [value]
#
# PARAMETERS: 
#    <attrib> : an attribute of a part object
#    <partIndex> : an integer that identifies a part
#    [value] : new attribute value
#
# RETURNS: N/A
#
# ERRORS: N/A
#

proc partInfoSet {info partIndex {value ""}} {
    global partObj pickList

    switch $info {
        instFlag { set partObj($partIndex,instFlag) $value }

        featureId { set partObj($partIndex,featureId) $value }

        desc { set partObj($partIndex,desc) $value }

        parent { set partObj($partIndex,parent) $value }

        stateCommit {
            set partObj($partIndex,prevInstFlag) \
            $partObj($partIndex,instFlag)
            }
    
        stateRestore {
            set partObj($partIndex,instFlag) $partObj($partIndex,prevInstFlag)
            set pickList(part,$partIndex) $partObj($partIndex,prevInstFlag)
        }

        default { puts "partInfoSet: unknown info: $info" }
    }
}

##############################################################################
#
# stateInfoHelper -  determents if a selection state is changing
#
# By comparing the total size of the current and previous selection state, this 
# function helps reduce unnesscessary GUI updating.
#
# SYNOPSIS
# stateInfoHelper <state> <totalCurr> <totalPrev>
#
# PARAMETERS: 
#    <state> : curent state
#    <totalCurr> : total size in current state
#    <totalPrev> : total size in previous state
#
# RETURNS: new state.
#
# ERRORS: N/A
#

proc stateInfoHelper {state totalCurr totalPrev} {
    set retVal $state

    if {"$state" != "unchanged"} {

        if {"$totalCurr" == "0"} {
            set retVal "${state}ToNone"

        } elseif {"$totalCurr" >= "$totalPrev"} {
            set retVal "${state}Incr"

        } elseif {"$totalCurr" < "$totalPrev"} {
             set retVal "${state}Decr"
        }
    }

    return $retVal
}

##############################################################################
#
# ob

⌨️ 快捷键说明

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