home *** CD-ROM | disk | FTP | other *** search
- #---------------------------------------------------------------------------
- #
- # (c) Westmount Technology 1994
- #
- # File: @(#)ilstrsecti.tcl /main/hindenburg/2
- # Author: <generated>
- # Description:
- #---------------------------------------------------------------------------
- # SccsId = @(#)ilstrsecti.tcl /main/hindenburg/2 9 Jan 1997 Copyright 1994 Westmount Technology
-
- # Start user added include file section
- require "ilstrconge.tcl"
- # End user added include file section
-
- require "ilsection.tcl"
-
- Class IlStrSection : {IlSection} {
- constructor
- method destructor
- method promoter
- method updateDocDir
- method updateRepository
- method genAttribInfo
- method generateTypeContents
- method contentsGenerator
- attribute _contentsGenerator
- }
-
- constructor IlStrSection {class this name document} {
- set this [IlSection::constructor $class $this $name $document]
- # Start constructor user section
- # End constructor user section
- return $this
- }
-
- method IlStrSection::destructor {this} {
- set ref [$this _contentsGenerator]
- if {$ref != ""} {
- $ref _section ""
- }
- # Start destructor user section
- # End destructor user section
- $this IlSection::destructor
- }
-
- method IlStrSection::promoter {this document} {
- $this IlSection::promoter $document
-
- $this uiType Structure
- global classCount
- $this _contentsGenerator [IlStrConGen new IlStrConGen$classCount $this]
- incr classCount
- }
-
- method IlStrSection::updateDocDir {this} {
-
- # Convert structure file [[$this section] docLocation]
- # and retrieve the Interleaf attribute-files from it
-
- $this synchWithFileSystem
- set strFile [$this docLocation]
-
- if {[catch {set struct [open $strFile r]} reason]} {
- wmtkerror "Error on opening '$strFile' for reading: $reason"
- unlink $strFile
- return 0
- }
-
- set dot ""
-
- while {![eof $struct]} {
- if {[gets $struct line] == -1} {
- break
- }
- if {[string match .@* $line]} {
- if {$dot != ""} {
- close $dot
- set dot ""
- }
-
- set name [string range $line 2 end]
- set section [docTool findSection $name]
- if {$section == ""} continue
-
- set file [[$this contentsGenerator] attribPath $section]
- if {[catch {set dot [open $file w]} reason]} {
- wmtkerror "Error on opening '$file' \
- for writing: $reason"
- set dot ""
- }
- } else {
- if {$dot != ""} {
- puts $dot $line
- }
- }
- }
- if {$dot != ""} {
- close $dot
- }
-
- return 1
- }
-
- method IlStrSection::updateRepository {this} {
-
- # Convert Interleaf attribute-files to ascii
- # and save them in structure [[$this section] docLocation]
- # the copy to the repository
-
- $this lockForWrite updateRepository
- set strFile [$this docLocation]
-
- if {[catch {set struct [open $strFile w]} reason]} {
- wmtkerror "Error on opening '$strFile' for writing: $reason"
- unlink $strFile
- return 0
- }
-
- set comp [[docTool structure] firstComponent]
- for {} {$comp != ""} {set comp [$comp next]} {
- set section [docTool findSection [$comp uiName]]
- if {$section != ""} {
- $this genAttribInfo $struct $section
- }
- }
-
- close $struct
-
- set result [$this upLoad $strFile]
- $this unlock
-
- return $result
- }
-
- method IlStrSection::genAttribInfo {this fid section} {
-
- set file [[$this contentsGenerator] attribPath $section]
-
- puts $fid ".@[$section uiName]"
-
- if {[catch {set dot [open $file r]} reason]} {
- wmtkerror "Error on opening '$file' for reading: $reason"
- } else {
- set skip 1
- while {![eof $dot]} {
- if {[gets $dot line] == -1} {
- break
- }
- if {[string match *\(system_attributes* $line]} {
- set skip 0
- }
- if {!$skip} {
- puts $fid $line
- }
- }
- close $dot
- }
- }
-
- method IlStrSection::generateTypeContents {this} {
-
- [$this contentsGenerator] generate
- }
-
- # Do not delete this line -- regeneration end marker
-
- method IlStrSection::contentsGenerator {this args} {
- if {$args == ""} {
- return [$this _contentsGenerator]
- }
- set ref [$this _contentsGenerator]
- if {$ref != ""} {
- $ref _section ""
- }
- set obj [lindex $args 0]
- if {$obj != ""} {
- $obj _section $this
- }
- $this _contentsGenerator $obj
- }
-
-