home *** CD-ROM | disk | FTP | other *** search
- #---------------------------------------------------------------------------
- #
- # (c) Cayenne Software Inc. 1996
- #
- # File: @(#)config_pb.tcl /main/hindenburg/4
- # Author:
- # Description: Configure PB Environment, i.e.:
- # - in ObjectDesign: import system 'PBBuiltins' with PB builtins
- # - in Implementation: install Cayenne class library
- #---------------------------------------------------------------------------
- # SccsId = @(#)config_pb.tcl /main/hindenburg/4 10 Apr 1997 Copyright 1996 Cayenne Software Inc.
-
- proc m4copydir {dir} {
- set save_dir [pwd]
- set subdir [location config $dir]
- if [catch {set cddir [location [m4_var get M4_home] $subdir]}] {
- return
- }
- cd $cddir
- set files [glob -nocomplain classlib.pbl *.sru]
-
- set cc [ClientContext::global]
- set dest [location [[$cc currentPhase] path] src]
- if {! [file exist $dest]} {
- mkdir -path [list $dest]
- }
- set pblFile [path_name concat $dest classlib pbl]
- if [file exist $pblFile] {
- puts "PowerBuilder library '$pblFile' already exists. "
- puts -nonewline "Do you want to continue? \[no\]: "
- set answer [gets stdin]
- switch -glob -- [string tolower $answer] {
- y* {}
- default {return}
- }
- puts ""
- }
- foreach file $files {
- puts "Copying $file to $dest ..."
- BasicFS::copyFile $file [location $dest $file]
- }
- cd $save_dir
- }
-
- proc importBuiltins {} {
- set cc [ClientContext::global]
- set phaseV [$cc currentPhase]
- set sysV [$phaseV findSystemVersion "PBBuiltins" "system"]
- if {![$sysV isNil]} {
- puts -nonewline "System 'PBBuiltins' already exists. "
- puts -nonewline "Do you want to continue? \[no\]: "
- set answer [gets stdin]
- switch -glob -- [string tolower $answer] {
- y* {}
- default {return}
- }
- }
- set srcDir [location [m4_var get M4_home] config src PB]
- set file [path_name concat $srcDir PBBuiltins tcl]
- if {! [file exist $file]} {
- puts "'Configure PB Environment' failed:\
- file '$file' not found."
- } else {
- puts "Importing system 'PBBuiltins' ..."
- source $file
- }
- }
-
- set cc [ClientContext::global]
- set phaseType [[[$cc currentPhase] phase] type]
- if {$phaseType == "ObjectDesign"} {
- importBuiltins
- } elseif {$phaseType == "Implementation"} {
- m4copydir [location src PB]
- } else {
- puts "'Configure PB Environment' failed: invalid phase type '$phaseType'."
- }
-
-