home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 1997 November
/
PCWorld_1997-11_cd.bin
/
software
/
programy
/
komix
/
DATA.Z
/
config_dp.tcl
< prev
next >
Wrap
Text File
|
1997-04-17
|
4KB
|
134 lines
#---------------------------------------------------------------------------
#
# (c) Cayenne Software Inc. 1996
#
# File: @(#)config_dp.tcl /main/hindenburg/4
# Author: resc
# Description: Config file for Delphi
#---------------------------------------------------------------------------
# SccsId = @(#)config_dp.tcl /main/hindenburg/4 17 Apr 1997 18 Mar 1997 Copyright 1996 Cayenne Software Inc.
source [m4_path_name tcl cginit.tcl]
require wmt_util.tcl
require machdep.tcl
proc importBuiltins {} {
set cc [ClientContext::global]
set phaseV [$cc currentPhase]
foreach sys {DelphiVCL} {
set sysV [$phaseV findSystemVersion $sys "system"]
if {![$sysV isNil]} {
puts -nonewline "System '$sys' already exists. Configure again? \[no]: "
set answer [gets stdin]
switch -glob -- [string tolower $answer] {
y* {puts ""}
default {continue}
}
}
set srcDir [location [m4_var get M4_home] tcl l_delphi]
set file [path_name concat $srcDir $sys tcl]
if {![file exist $file]} {
puts "Import of system '$sys' failed: file '$file' not found."
} else {
puts "Importing system '$sys'... (this action will take some time)"
source $file
}
puts ""
}
}
proc m4copyfile {dir custName {fsName ""}} {
if {$fsName == ""} {
set fsName $custName
}
if [file exists $fsName] {
set sourcefile $fsName
} else {
set sourcefile [m4_path_name $dir $fsName]
}
set customFileV [findCustomizationFile $custName 1]
$customFileV lockForWrite "Configure Delphi Environment"
$customFileV upLoad $sourcefile
$customFileV unlock
}
proc m4basedir {} {
set clientContext [ClientContext::global]
set configV [$clientContext currentConfig]
if {[$configV isNil]} {
return [m4_var get M4_home]
}
return [$configV path]
}
proc findCustomizationFile {fullName {create 0}} {
set name [lindex [split $fullName .] 0]
set type [lindex [split $fullName .] 1]
set clientContext [ClientContext::global]
set configV [$clientContext currentConfig]
set customFileV [$configV findCustomFileVersion $name $type]
if {$create && [$customFileV isNil]} {
puts "Creating customization file '$fullName' at configuration level"
set customFileV [$configV createCustomFileVersion $name $type]
}
return $customFileV
}
proc m4copydir {dir} {
set save_dir [pwd]
set subdir [location config $dir]
if [catch {set cddir [m4_path_name $subdir ClassDict.pas]}] {
return
}
set PhaseV [[ClientContext::global] currentPhase]
cd [path_name directory $cddir]
set base [m4basedir]
set files [glob -nocomplain *]
set dest [location [$PhaseV path] src]
if {! [file exist $dest]} {
mkdir -path [list $dest]
}
foreach file $files {
puts "copying $file to $dest"
copy_text_file $file [location $dest $file]
}
cd $save_dir
}
puts "Configure Delphi Environment"
puts "============================\n"
set cc [ClientContext::global]
set phaseType [[[$cc currentPhase] phase] type]
switch $phaseType {
"ObjectDesign" {
importBuiltins
puts "'Configure Delphi Environment' finished for phase '${phaseType}'."
}
"Implementation" {
m4copydir [location src DP]
puts "'Configure Delphi Environment' finished for phase '${phaseType}'."
}
default {
puts "'Configure Delphi Environment' failed: invalid phase type '${phaseType}'."
}
}