home *** CD-ROM | disk | FTP | other *** search
- #---------------------------------------------------------------------------
- #
- # (c) Cayenne Software Inc. 1996
- #
- # File: @(#)repinfosec.tcl /main/hindenburg/2
- # Author: <generated>
- # Description:
- #---------------------------------------------------------------------------
- # SccsId = @(#)repinfosec.tcl /main/hindenburg/2 25 Sep 1996 Copyright 1996 Cayenne Software Inc.
-
- # Start user added include file section
- # End user added include file section
-
-
- Class RepInfoSection : {GCObject} {
- constructor
- method destructor
- method clear
- method format
- method contents
- method addHeader
- method addLine
- method addItem
- method addParameter
- attribute items
- attribute text
- attribute view
- }
-
- constructor RepInfoSection {class this view} {
- set this [GCObject::constructor $class $this]
- $this view $view
- # Start constructor user section
-
- $this items [List new]
-
- # End constructor user section
- return $this
- }
-
- method RepInfoSection::destructor {this} {
- # Start destructor user section
- # End destructor user section
- }
-
- method RepInfoSection::clear {this} {
- [$this items] contents {}
- $this text ""
- }
-
- method RepInfoSection::format {this} {
- set maxLabel 0
- [$this items] foreach item {
- set t [lindex $item 0]
- if {$t == "ITEM"} {
- set len [string length [lindex $item 1]]
- if {$len > $maxLabel} {
- set maxLabel $len
- }
- }
- }
-
- set text [TextSection new]
- $this text $text
-
- [$this items] foreach item {
- switch [lindex $item 0] {
- HDR {
- $text append "[lindex $item 1]\n"
- }
- ITEM {
- $text append "[format " %-${maxLabel}s : %s\n" \
- [lindex $item 1] [lindex $item 2]]"
- }
- LINE {
- $text append " [lindex $item 1]\n"
- }
- }
- }
- }
-
- method RepInfoSection::contents {this} {
- set text [$this text]
- if {$text != ""} {
- return [$text contents]
- }
- return ""
- }
-
- method RepInfoSection::addHeader {this title} {
- set items [$this items]
- if {[$items length] > 0} {
- $items append [list HDR ""]
- }
- $items append [list HDR $title]
- }
-
- method RepInfoSection::addLine {this line} {
- [$this items] append [list LINE $line]
- }
-
- method RepInfoSection::addItem {this label value} {
- [$this items] append [list ITEM $label $value]
- }
-
- method RepInfoSection::addParameter {this name value} {
- switch [[$this view] paramMode] {
- Meta4 {
- set value "M4_${name}=${value};RW"
- [$this items] append [list LINE $value]
- }
- Sh {
- set value "M4_${name}='${value};RW'; export M4_${name}"
- [$this items] append [list LINE $value]
- }
- Csh {
- set value "setenv M4_${name} '${value};RW'"
- [$this items] append [list LINE $value]
- }
- default {
- set value [RepInfoSection::fmtNum $value]
- [$this items] append [list ITEM $name $value]
- }
- }
- }
-
- proc RepInfoSection::fmtNum {num} {
- return [format "%10d" $num]
- }
-
- # Do not delete this line -- regeneration end marker
-
-