home *** CD-ROM | disk | FTP | other *** search
- #---------------------------------------------------------------------------
-
- #
-
- # (c) Cayenne Software Inc. 1997
-
- #
-
- # File: @(#)config_pbexample.tcl /main/titanic/6
-
- # Author:
-
- # Description: Base for configure PowerBuilder Examples
-
- #---------------------------------------------------------------------------
-
- # SccsId = @(#)config_pbexample.tcl /main/titanic/6 27 Oct 1997 Copyright 1997 Cayenne Software Inc.
-
-
-
- source [m4_path_name tcl cginit.tcl]
-
-
-
- require wmt_util.tcl
-
- require machdep.tcl
-
-
-
-
-
- proc getBrowserType {fileType} {
-
- global fstorage::custObjHandler
-
- set custObjHandler ${fstorage::custObjHandler}
-
- if {$custObjHandler == ""} {
-
- set modHandler [ModuleHandler new]
-
- $modHandler setCurrentContext
-
- set custObjHandler [CustObjHandler new $modHandler]
-
- set fstorage::custObjHandler $custObjHandler
-
- $custObjHandler setCurrentContext
-
- }
-
- set objSpecSet [$custObjHandler currentObjectSpecSet]
-
- foreach objSpec $objSpecSet {
-
- if {([$objSpec fsExtension] == $fileType) &&
-
- ([$objSpec repositoryType] == "ExternalFileVersion")} {
-
- return [$objSpec browserType]
-
- }
-
- set repositoryType [$objSpec repositoryType]
-
- }
-
- return ""
-
- }
-
-
-
-
-
- proc m4copydir {dir checkfile} {
-
- set save_dir [pwd]
-
- set subdir [location config $dir]
-
- if [catch {set cddir [m4_path_name $subdir $checkfile]}] {
-
- puts "could not find $checkfile in $subdir"
-
- return
-
- }
-
-
-
- set PhaseV [[ClientContext::global] currentPhase]
-
-
-
- cd [path_name directory $cddir]
-
-
-
- set files [glob -nocomplain *]
-
- set dest [location [$PhaseV path] $dir]
-
- if {! [file exist $dest]} {
-
- mkdir -path [list $dest]
-
- }
-
- foreach file $files {
-
- set fileName [nt_get_name $file]
-
- set fileType [nt_get_type $file]
-
- set browserType [getBrowserType $fileType]
-
- set fullName "$fileName.$browserType"
-
- if {$browserType != ""} {
-
- if [catch {set fd [fstorage::open $fullName w]} reason] {
-
- puts stderr $reason
-
- puts stderr "could not create $file.$fileType \($browserType\)"
-
- continue
-
- } else {
-
- fstorage::close $fd
-
- fstorage::set_imp_from $fullName $fileName
-
- puts "copying $file to $dest"
-
- fstorage::copyFile $file phase $dir $file
-
- }
-
- } else {
-
- puts "copying $file to $dest"
-
- fstorage::copyFile $file phase $dir $file
-
- }
-
- }
-
- cd $save_dir
-
- }
-
-
-
-
-
- proc mkImplementation {checkfile} {
-
- set cc [ClientContext::global]
-
- set path [$cc currentLevelString]
-
- set configV [$cc currentConfig]
-
- set phaseV [$cc currentPhase]
-
- set nextPhaseV [$phaseV next $configV]
-
- if {[$nextPhaseV isNil]} {
-
- puts "No 'Implementation' phase available"
-
- return
-
- }
-
- set sysV [$cc currentSystem]
-
- if {![$sysV isNil]} {
-
- set sysName [[$sysV system] name]
-
- set sysV [$nextPhaseV findSystemVersion $sysName "system"]
-
- if {[$sysV isNil]} {
-
- puts "Creating system '$sysName' in 'Implementation' phase..."
-
- set sysV [$nextPhaseV createSystemVersion $sysName "cl" "system" $configV]
-
- }
-
- while {[$cc currentLevel] != "Config"} {
-
- $cc upLevel
-
- }
-
- $cc downLevelId $nextPhaseV
-
- $cc downLevelId $sysV
-
-
-
- m4copydir $sysName $checkfile
-
- } else {
-
- puts "No current system"
-
- return
-
- }
-
- }
-
-
-
- proc installExample {sysName designSrc checkfile} {
-
-
-
- set cc [ClientContext::global]
-
- set phaseV [$cc currentPhase]
-
- set sysV [$phaseV findSystemVersion $sysName "system"]
-
- if {![$sysV isNil]} {
-
- puts "System '$sysName' already exists: not configuring it again."
-
- } else {
-
- require "$designSrc"
-
- mkImplementation $checkfile
-
- }
-
- }
-
-
-
-