home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 1998 October
/
PCWorld_1998-10_cd.bin
/
software
/
prehled
/
komix
/
DATA.Z
/
pbroundtrip.tcl
< prev
next >
Wrap
Text File
|
1997-08-06
|
3KB
|
110 lines
#---------------------------------------------------------------------------
#
# Copyright (c) 1997 by Cayenne Software Inc.
#
# This software is furnished under a license and may be used only in
# accordance with the terms of such license and with the inclusion of
# the above copyright notice. This software or any other copies thereof
# may not be provided or otherwise made available to any other person.
# No title to and ownership of the software is hereby transferred.
#
# The information in this software is subject to change without notice
# and should not be construed as a commitment by Cayenne Software Inc.
#
#---------------------------------------------------------------------------
#
# File : @(#)pbroundtrip.tcl /main/titanic/3 25 Jul 1997
# Original date : July 1997
# Description : Roundtrip for PowerBuilder
#
#---------------------------------------------------------------------------
#
source [m4_path_name tcl cginit.tcl]
require "pbgentor.tcl"
require "pbllibrary.tcl"
require "procs.tcl"
global argv
set lang "pb"
set rtOptions ""
set roundtrip 0
set argsFile ""
set fileName ""
set systemName ""
set prevPhase ""
set phaseName ""
if {[regexp {\-x *} $argv total dummy]} {
set roundtrip 1
set rtOptions "-x"
}
if {[regexp {\-F *([^-][^ ]*)} $argv total argsFile]} {
if {[llength $argsFile] > 0} {
set argsFile [lindex $argsFile 0]
}
set rtOptions "$rtOptions -F $argsFile"
}
if {[regexp {\-D *([^-][^ ]*)} $argv total fileName]} {
set rtOptions "$rtOptions -D $fileName"
}
if {[regexp {\-S *([^-][^ ]*)} $argv total systemName]} {
set rtOptions "$rtOptions -S $systemName"
}
if {[regexp {\-A *([^-][^ ]*)} $argv total prevPhase]} {
set rtOptions "$rtOptions -A $prevPhase"
}
if {[regexp {\-T *([^-][^ ]*)} $argv total phaseName]} {
set rtOptions "$rtOptions -T $phaseName"
}
set parseFile [args_file {}]
set rtOptions "-1 $parseFile $rtOptions"
set cc [ClientContext::global]
set sysV [$cc currentSystem]
set systemName [[$sysV system] name]
set systemPath [$sysV path]
set autoLibrary [PBGenerator::checkAutoLibrary]
if {$argsFile == ""} {
puts stdout "nothing to do!"
return
}
if {$roundtrip == 0} {
puts stdout "no roundtrip!"
return
}
if {($autoLibrary && \
($systemName != ""))} {
# argsFile2 will be a copy of argsFile
set argsFile2 [args_file {}]
file copy -force $argsFile $argsFile2
set pbLib [PblLibrary new]
$pbLib libraryName [string tolower $systemName]
set libraryName [$pbLib getLibName]
set fileDesc [open $argsFile r]
if {$fileDesc != ""} {
puts stdout "Exporting from ${libraryName}.pbl \[${systemPath}\]:"
while {[gets $fileDesc line] >= 0 } {
if {$line != ""} {
puts stdout " $line"
}
}
close $fileDesc
set inclFile ""
set ret [$pbLib exportFiles $argsFile2 $inclFile $systemPath]
}
}
set script "[quoteIf [m4_path_name bin reveng_${lang}$EXE_EXT]] $rtOptions"
# because eval will evaluate '\'
regsub -all {\\} $script {\\\\} script
# reroute both stdout and stderr from execution to stdout
set ret [catch {eval exec >&@stdout $script}]
if {$ret != 0} {
set dosReturnErrorCode [expr {([lindex $errorCode 0] == "CHILDSTATUS") ? \
[lindex $errorCode 2] : "unknown" }]
puts stdout "$msg"
return
}
source $parseFile