home *** CD-ROM | disk | FTP | other *** search
- #---------------------------------------------------------------------------
- #
- # Copyright (c) 1997 by Cayenne Software, Inc.
- #
- # This software is furnished under a license and may be used only in
- # accordance with the terms of such license and with the inclusion of
- # the above copyright notice. This software or any other copies thereof
- # may not be provided or otherwise made available to any other person.
- # No title to and ownership of the software is hereby transferred.
- #
- # The information in this software is subject to change without notice
- # and should not be construed as a commitment by Cayenne Software, Inc.
- #
- #---------------------------------------------------------------------------
- #
- # File : vacppgentor.tcl
- # Author :
- # Original date : November 1997
- # Description : Classes for code generation
- #
- #---------------------------------------------------------------------------
-
- #---------------------------------------------------------------------------
- # File: @(#)vacppgener.tcl /main/titanic/2
- #---------------------------------------------------------------------------
-
- # Start user added include file section
-
- # End user added include file section
-
- require "generator.tcl"
-
- Class VACPPGenerator : {Generator} {
- constructor
- method destructor
- method generate
- method generateSpecialFiles
- attribute ooplModel
- attribute importer
- attribute fileHandler
- }
-
- constructor VACPPGenerator {class this} {
- set this [Generator::constructor $class $this]
- # Start constructor user section
- # End constructor user section
- return $this
- }
-
- method VACPPGenerator::destructor {this} {
- # Start destructor user section
- # End destructor user section
- $this Generator::destructor
- }
-
- method VACPPGenerator::generate {this classList} {
- set typeToClassDict [Dictionary new]
-
- set project [VAParts new]
-
- $classList foreach cl {
- $cl vaGenerate $project
- set tempDict [Dictionary new]
- $typeToClassDict set $cl $tempDict
- }
-
- $project generate $typeToClassDict
- return $typeToClassDict
- }
-
- method VACPPGenerator::generateSpecialFiles {this fileList} {
- set fileName [[$this fileHandler] getProjectFileName]
- set text [TextSection new]
-
- m4_message $M_GENSPEC $fileName
-
- foreach fileV [[[ClientContext::global] currentSystem] localFileVersions] {
- set type [[$fileV file] type]
- set name [[$fileV file] name]
- if {$type == "vbe" && $name != [getCurrentSystemName]} {
- if {[catch {set fd [fstorage::open "$name.$type" r]} reason]} {
- m4_error $E_NOTADDSPEC $name $fileName
- puts stderr $reason
- } else {
- m4_message $M_ADDSPEC $name $fileName
- while {![eof $fd]} {
- set line [gets $fd]
- if {[regexp {^//VBPartDataFile:} $line]} {
- $text append "//VBPartDataFile: [getCurrentSystemName].vbb\n"
- } else {
- $text append "$line\n"
- }
- }
- close $fd
- }
- }
- }
-
- if {[M4CheckManager::getErrorCount] > 0} {
- m4_message $M_NOSAVING $fileName
- } else {
- m4_message $M_CREATINGSPEC $fileName
- [$this fileHandler] writeSectionToNamedFile $text $fileName
- }
- }
-
- # Do not delete this line -- regeneration end marker
-
- #---------------------------------------------------------------------------
- # File: @(#)vacppfileh.tcl /main/titanic/1
- #---------------------------------------------------------------------------
-
- # Start user added include file section
- # End user added include file section
-
- require "filehandle.tcl"
-
- Class VACPPFileHandler : {FileHandler} {
- constructor
- method destructor
- method getFileName
- method getSpecialFiles
- method getFileTypes
- method getProjectFileName
- attribute VBEType
- }
-
- constructor VACPPFileHandler {class this} {
- set this [FileHandler::constructor $class $this]
- $this VBEType "vbe"
- # Start constructor user section
- # End constructor user section
- return $this
- }
-
- method VACPPFileHandler::destructor {this} {
- # Start destructor user section
- # End destructor user section
- $this FileHandler::destructor
- }
-
- method VACPPFileHandler::getFileName {this class fileType} {
- return "[$class getName].$fileType"
- }
-
- method VACPPFileHandler::getSpecialFiles {this} {
- set list [List new]
- $list append [$this getProjectFileName]
- return $list
- }
-
- method VACPPFileHandler::getFileTypes {this} {
- set list [List new]
- $list append [$this VBEType]
- return $list
- }
-
- method VACPPFileHandler::getProjectFileName {this} {
- return "[getCurrentSystemName].[$this VBEType]"
- }
-
- # Do not delete this line -- regeneration end marker
-
- #---------------------------------------------------------------------------
- # File: @(#)dummygener.tcl /main/titanic/1
- #---------------------------------------------------------------------------
-
- # Start user added include file section
- # End user added include file section
-
- Class DummyGenerator : {CppGenerator} {
- constructor
- method destructor
- method generateSpecialFiles
- }
-
- constructor DummyGenerator {class this} {
- set this [CppGenerator::constructor $class $this]
- # Start constructor user section
- # End constructor user section
- return $this
- }
-
- method DummyGenerator::destructor {this} {
- # Start destructor user section
- # End destructor user section
- $this CppGenerator::destructor
- }
-
- method DummyGenerator::generateSpecialFiles {this fileList} {
- }
-
- selfPromoter CppGenerator {this} {
- DummyGenerator promote $this
- }
-
- # Do not delete this line -- regeneration end marker
-
-