home *** CD-ROM | disk | FTP | other *** search
- #---------------------------------------------------------------------------
- #
- # (c) Cayenne Software Inc. 1997
- #
- # File: @(#)exportetfe.tcl /main/titanic/1
- # Description: export tool (et.tcl) front end
- #
- #---------------------------------------------------------------------------
- # SccsId = @(#)exportetfe.tcl /main/titanic/1 4 Nov 1997 Copyright 1997 Cayenne Software Inc.
-
- global SCCS_W0; set SCCS_W0 "
- @(#)exportetfe.tcl /main/titanic/1
- "
- global progName0; set progName0 "exportetfe.tcl"
-
- global et_dont_run; set et_dont_run 1
- source [m4_path_name tcl et.tcl]
-
-
- proc setProg0 {} {
- set name [string trim $SCCS_W0 "\n%"]
- if {$name != "W"} {
- regexp "@.#.(.*)\t" $name dummy name
- global progName0
- set progName0 $name
- }
- }
-
- proc rmFile {fileName {warn 1}} {
- if {[catch {BasicFS::removeFile $fileName} msg] && $warn} {
- puts stderr "ERROR\[$progName0]: $msg"
- }
- }
-
- proc main {argv} {
- #
- # tmpFile
- # 1: basic et args (not: -f, -a, -o)
- # 2: outFile {a|w} (a: append; w: write)
- # 3: identity of fileV1 (e.g. Graph:Uj0DiTzQ40bYw4QDuAGUAAQAAAAEA)
- # 4: identity of fileV2
- # ...
- #
- setProg0
-
- set fileVersions {}
- set tmpFile [lvarpop argv]
- if {[catch {set fd [open $tmpFile r]} msg]} {
- puts stderr "ERROR\[$progName0]: $msg"
- rmFile $tmpFile 0
- return
- }
- if {[gets $fd line] > 0} {
- set basicArgs $line
- } else {
- puts stderr "ERROR\[$progName0]: file '$tmpFile' does not have any arguments at line 1"
- rmFile $tmpFile 0
- return
- }
- if {[gets $fd line] > 0} {
- set outFile [lindex $line 0]
- set mode [lindex $line 1]
- set outFileArg -o
- if {$mode == "a"} {
- set outFileArg -a
- }
- } else {
- puts stderr "ERROR\[$progName0]: file '$tmpFile' does not have an output file specified at line 2"
- rmFile $tmpFile 0
- return
- }
- while {[gets $fd line] > 0} {
- lappend fileVersions $line
- }
- close $fd
- rmFile $tmpFile
-
- set etArgs $basicArgs
- lappend etArgs ${outFileArg}$outFile
- foreach fileV $fileVersions {
- set args [concat -f$fileV $etArgs]
- puts stderr "% exportTool $args"
- exportTool $args
- puts stderr ""
- if {$outFileArg != ""} {
- set etArgs $basicArgs
- lappend etArgs -a$outFile
- set outFileArg ""
- }
- }
- }
-
-
- if {[catch {main $argv} reason]} {
- puts stderr $errorInfo
- }
-