home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 1998 October
/
PCWorld_1998-10_cd.bin
/
software
/
prehled
/
komix
/
DATA.Z
/
delphiconfig.tcl
< prev
next >
Wrap
Text File
|
1997-10-01
|
3KB
|
138 lines
#---------------------------------------------------------------------------
#
# (c) Cayenne Software Inc. 1996
#
# File: @(#)delphiconfig.tcl /main/titanic/3
# Author: resc
# Description: Config file for Delphi
#---------------------------------------------------------------------------
# SccsId = @(#)delphiconfig.tcl /main/titanic/3 1 Oct 1997 18 Mar 1997 Copyright 1996 Cayenne Software Inc.
source [m4_path_name tcl cginit.tcl]
require caynutil.tcl
global thisModulesName
set thisModulesName "delphi"
#
# Return base directory to install stuff
#
proc moduleBaseDir {name} {
set modHdlr [ModuleHandler new]
if {$modHdlr == ""} {
return ""
}
$modHdlr setCurrentContext
set spec [$modHdlr getModuleSpec $name]
if {$spec != ""} {
return [$spec path]
}
return ""
}
#
# Import Delphi VCL library
#
proc importBuiltins {dir} {
set cc [ClientContext::global]
set phaseV [$cc currentPhase]
foreach sys {DelphiVCL} {
puts ""
set sysV [$phaseV findSystemVersion $sys "system"]
if {![$sysV isNil]} {
puts "System '$sys' already exists: not configuring it again."
continue
}
global thisModulesName
set srcDir [location [moduleBaseDir $thisModulesName] $dir]
set file [path_name concat $srcDir $sys tcl]
if {! [file exist $file]} {
puts "'Configure Delphi Environment' failed:\
file '$file' not found."
} else {
puts "Importing system '$sys' ... (this action will take some time)"
source $file
puts ""
}
}
}
#
# Copy other Pascal files
#
proc m4copydir {dir} {
set save_dir [pwd]
global thisModulesName
set subdir [location [moduleBaseDir $thisModulesName] $dir]
if [catch {cd $subdir} msg] {
puts "Error: $subdir not found"
return
}
set files [glob -nocomplain ClassDict.pas *.sru]
set cc [ClientContext::global]
set dest [location [[$cc currentPhase] path] src]
if {! [file exist $dest]} {
mkdir -path [list $dest]
}
set pasFile [path_name concat $dest ClassDict pas]
if [file exist $pasFile] {
puts "Overwriting file '$pasFile' ..."
}
foreach file $files {
puts "Copying $file to $dest ..."
BasicFS::copyFile $file [location $dest $file]
}
cd $save_dir
}
proc makeCfgSystems {} {
set cc [ClientContext::global]
set configV [$cc currentConfig]
set phaseV [$cc currentPhase]
foreach sys {DelphiVCL} {
puts ""
set sysV [$phaseV findSystemVersion $sys "system"]
if {[$sysV isNil]} {
puts "Creating System '$sys'."
set sysV [$phaseV createSystemVersion $sys "cl" "system" $configV]
$sysV freeze "Configure Delphi"
} elseif {[$sysV status] == "working"} {
$sysV freeze "Configure Delphi"
}
}
}
#
# Main part
#
puts "Configure Delphi Environment"
puts "============================\n"
set cc [ClientContext::global]
set phaseType [[[$cc currentPhase] phase] type]
switch $phaseType {
"ObjectDesign" {
importBuiltins [location tcl]
puts "'Configure Delphi Environment' finished for phase '${phaseType}'."
}
"Implementation" {
m4copydir [location config]
makeCfgSystems
puts "'Configure Delphi Environment' finished for phase '${phaseType}'."
}
default {
puts "'Configure Delphi Environment' failed: invalid phase type '${phaseType}'."
}
}