home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 1998 October
/
PCWorld_1998-10_cd.bin
/
software
/
prehled
/
komix
/
DATA.Z
/
startreport.tcl
< prev
next >
Wrap
Text File
|
1997-08-26
|
2KB
|
94 lines
#----------------------------------------------------------------------------
#
# (c) Cadre Technologies Inc. 1995
#
# File: @(#)startreport.tcl /main/titanic/1
# Author: Harm Leijendeckers
# Description: Start script for all standard reports. It should
# be sourced with the desired report as argument.
# fe: otsh -f startreport.tcl -- projects.tcl
# Needed files: $M4_home/reports/rwsource.tcl
# $M4_home/reports/reportbase.tcl
#
#----------------------------------------------------------------------------
# SccsId = @(#)startreport.tcl /main/titanic/1 26 Aug 1997 Copyright 1995 Cadre Technologies Inc.
#
# Check arguments
#
set reportName [lvarpop argv]
if { $reportName == "" } {
error "Need argument report name"
}
global Options
if { [lindex $argv 0] == "-o" } {
lvarpop argv
set Options $argv
if { $Options == "" } {
error "Option -o needs argument(s)"
}
} else {
set Options ""
}
#
# Source scripts
#
OTShRegister::reportWriter
OTShRegister::propertyKnowledge
set cc [ClientContext::global]
eval [$cc getCustomFileContents rwsource tcl reports]
eval [$cc getCustomFileContents reportbase tcl reports]
#
# Source report
#
set root [file root $reportName]
set userReport [path_name concat [location ~ icase] $root tcl]
if [file isfile $userReport] {
source $userReport
} else {
if [$cc customFileExists $root tcl reports] {
eval [$cc getCustomFileContents $root tcl reports]
} else {
if [file isfile $reportName] {
source $reportName
} else {
error "Can't open file $reportName"
}
}
}
#
# Check if this is a converted report
#
if [info exists CONVERTED] {
eval [$cc getCustomFileContents startconvrep tcl reports]
return
}
#
# Execute report and show traceback if an error occured
#
if { ![string length [info var executeMe]] } {
error "Do not know how to execute report $reportName"
}
if { [catch { $executeMe execute } string] == 1 } {
puts $errorInfo
exit
}
#
# If nothing was printed (pageno == lineno == 0)
#
if { !([[$executeMe report] pageno] || [[$executeMe report] lineno]) } {
puts "Report: [$executeMe reportName] -- No appropriate data found"
}