home *** CD-ROM | disk | FTP | other *** search
- #---------------------------------------------------------------------------
- #
- # (c) Westmount Technology 1994
- #
- # File: @(#)fmlistcong.tcl /main/hindenburg/2
- # Author: <generated>
- # Description:
- #---------------------------------------------------------------------------
- # SccsId = @(#)fmlistcong.tcl /main/hindenburg/2 10 Apr 1997 Copyright 1994 Westmount Technology
-
- # Start user added include file section
- # End user added include file section
-
- require "fmcongen.tcl"
-
- Class FmListConGen : {FmConGen} {
- constructor
- method destructor
- method generate
- method genTextLine
- method genTitle
- method makeReport
- attribute frames
- attribute pgfs
- attribute chapter
- }
-
- constructor FmListConGen {class this name section} {
- set this [FmConGen::constructor $class $this $name $section]
- # Start constructor user section
-
- # this is not a type-tied generator, so adjust the type
- # part of the tempate name
- set version [[[[$this section] document] editor] version]
- $this templatePath [m4_path_name etc fm${version}doc.mif]
-
- # End constructor user section
- return $this
- }
-
- method FmListConGen::destructor {this} {
- # Start destructor user section
- # End destructor user section
- $this FmConGen::destructor
- }
-
- method FmListConGen::generate {this} {
-
- # First the contents is generated in a section. This sections
- # is put in a MIF-file by expanding the template MIF-file
- # '<name><version>.mif'. This file contains expandable TCL-
- # macro's to include the contents of the section.
- # Furthermore the template MIF-file contains a macro to include the
- # title of the document using 'FmListConGen::genTitle'.
-
- set mifFid [$this openMif]
-
- # check first if output file can be opened
- if {$mifFid == ""} {
- return
- }
-
- # get the parent (chapter) if the current section
- $this chapter [[$this section] parentSection]
- if { [$this chapter] == "" } {
- return
- }
-
- # Create the sections to be filled in into the MIF-template
- $this frames [TextSection new]
- $this pgfs [TextSection new]
-
- $this makeReport
-
- # make the Framemaker file
- set contents [TextSection new]
-
- # need to do this, otherwise pgfs is removed ???????
- set pgfs [$this pgfs]
- expand_file $contents [$this templatePath]
-
- # Write the contents into the MIF-file
- $contents write $mifFid
- close $mifFid
-
- $this mif2Bin
- }
-
- method FmListConGen::genTextLine {this line} {
-
- # Generate a paragraph-line, within the global paragraphs-section
-
- [$this pgfs] append " <ParaLine\n"
- [$this pgfs] append " <String `[[$this section] escapeText $line]'>\n"
- [$this pgfs] append " <Char HardReturn>\n"
- [$this pgfs] append " >\n"
- }
-
- method FmListConGen::genTitle {this textRectID} {
-
- # Get the level of the section.
- # This determines the kind of title
- set level [[$this section] indentation]
-
- # Determine the kind of title, i.e. the paragraph-tag
- case $level {
- {0 1} {set tag Chapter}
- {2} {set tag Section}
- {3} {set tag SubSection}
- {4} {set tag SubSubSection}
- default {return ""}
- }
-
- # Check if the section is the first one of this level
- # within the upper level. If so then use the paragraph-tag
- # extended with '1', to make the number starting at the beginning.
- set extension 1
-
- set parent [[$this section] parentSection]
- if { $parent == "" } {
- return ""
- }
-
- set brothers [$parent childSectionSet]
-
- # only if it's the first the extension is 1
- if {[$this section] == [$brothers index]} {
- set extension 1
- } else {
- set extension ""
- }
-
- # Make a section for the title
- set title [TextSection new]
-
- # Fill the section with the paragraph that defined the complete title
- $title append " <Para\n"
- $title append " <PgfTag `$tag$extension'>\n"
- $title append " <ParaLine\n"
- $title append " <TextRectID $textRectID>\n"
- $title append " <String `[[$this section] escapeText [[$this section] docTitle]]'>\n"
- $title append " >\n"
- $title append " >\n"
-
- # Return the contents of the title-section to be filled in into
- # the template
- return [$title contents]
- }
-
- method FmListConGen::makeReport {this} {
-
- # Start the paragraph
- [$this pgfs] append " <Para\n"
- [$this pgfs] append " <PgfTag `Reports'>\n"
-
- # get all the cad_classes and cad_containers from the
- # documented system
- foreach file [[[[$this section] document] documentedSystem] localFileVersions] {
- if {[[$file file] type] != "cad"} {
- continue
- }
- set fileName [[$file file] name]
- $this genTextLine $fileName
- foreach comp [$file components] {
- if { [$comp type] == "cad_class" || \
- [$comp type] == "cad_container"} {
- set name ""
- foreach label [$comp labels] {
- if {[$label type] == "name"} {
- set name [$label value]
- }
- }
- if {$name != ""} {
- $this genTextLine " -$name"
- }
- }
- }
- }
-
- # Finish the paragraph
- [$this pgfs] append " >\n"
- }
-
- # Do not delete this line -- regeneration end marker
-
-