home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 1998 October
/
PCWorld_1998-10_cd.bin
/
software
/
prehled
/
komix
/
DATA.Z
/
delphiimpo.tcl
< prev
next >
Wrap
Text File
|
1997-08-26
|
4KB
|
131 lines
#---------------------------------------------------------------------------
#
# (c) Cayenne Software Inc. 1997
#
# File: @(#)delphiimpo.tcl /main/titanic/7
# Author: <generated>
# Description:
#---------------------------------------------------------------------------
# SccsId = @(#)delphiimpo.tcl /main/titanic/7 26 Aug 1997 Copyright 1997 Cayenne Software Inc.
# Start user added include file section
require delphi_msg.tcl
require delphioopl.tcl
require delphitgt.tcl
require delphigtor.tcl
# End user added include file section
require "importer.tcl"
Class DelphiImporter : {Importer} {
constructor
method destructor
method generateOopl
method getOoplFileTypesToGenerateFor
method getFileNamesNotToGenerateFor
}
constructor DelphiImporter {class this} {
set this [Importer::constructor $class $this]
# Start constructor user section
# End constructor user section
return $this
}
method DelphiImporter::destructor {this} {
# Start destructor user section
# End destructor user section
$this Importer::destructor
}
method DelphiImporter::generateOopl {this classes} {
set fileHandler [DPFileHandler new]
$fileHandler sourceTclFiles
set selectedClasses [List new]
set acvar [string tolower [m4_var get M4_delphi_autoconvert]]
set autoconvert [expr {($acvar == "1") || ($acvar == "on") || ($acvar == "yes")}]
foreach class $classes {
if [$class isExternal] {
continue
}
if {[$class getName] == ""} {
m4_warning $W_NONAMECLASS
} else {
$selectedClasses append $class
# Auto conversion of forms to txt
#
if {([$class isForm]) && ($autoconvert)} {
set fileV [fstorage::getFileVersion "[$class getUnitName].txt"]
if {![$fileV isNil]} {
set path [$fileV path]
set len [string length $path]
incr len -4
set dfmfile "[string range $path 0 $len]dfm"
system "formconv $dfmfile"
}
}
}
}
set delphiGenerator [DPGenerator new]
$delphiGenerator ooplModel [$this ooplModel]
set generatedSections [$delphiGenerator generate $selectedClasses]
$generatedSections foreach class classToSection {
$classToSection foreach type section {
set written [$fileHandler writeSectionToFile $section $class $type]
# Auto conversion of txt to forms
#
if {$written && ($type == "txt") && $autoconvert} {
set fileV [fstorage::getFileVersion "[$class getUnitName].txt"]
if {![$fileV isNil]} {
system "formconv [$fileV path]"
}
}
}
}
# Special files
set import_new [lempty [$this targetObjects]]
if $import_new {
set specialFileList [$fileHandler getSpecialFiles]
} else {
set specialFileList [List new]
set selectedFiles [$this targetObjects]
[$fileHandler getSpecialFiles] foreach specialFile {
if { [lsearch $selectedFiles $specialFile] != -1 } {
$specialFileList append $specialFile
}
}
}
if { ![$specialFileList empty] } {
if {[M4CheckManager::getErrorCount] > 0} {
m4_error $E_NOSPECFILES
} else {
$delphiGenerator generateSpecialFiles $specialFileList
}
}
}
method DelphiImporter::getOoplFileTypesToGenerateFor {this} {
return [list ${DPFileHandler::PASType} ${DPFileHandler::DFMType} ${DPFileHandler::DPRType}]
}
method DelphiImporter::getFileNamesNotToGenerateFor {this} {
return "[getCurrentSystemName]"
}
# Do not delete this line -- regeneration end marker