home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 1997 November
/
PCWorld_1997-11_cd.bin
/
software
/
programy
/
komix
/
DATA.Z
/
w95docprocs_add.tcl
< prev
next >
Wrap
Text File
|
1996-12-05
|
3KB
|
63 lines
#
# TCL-procedure: createReports name_list
#
# The createReports procedure creates local sections which will allow
# inclusion of actual reports in a document.
# The argument name_list is a , sepperated list of report names without
# the .tcl suffix for example: classes, events. storeFile and section
# are pre-defined given by the environment. Also global $document is set.
proc w95comm {args} {
set e ""
set newargs ""
foreach e $args {
regsub -all {/} $e {\\} e
set newargs "$newargs $e"
}
return "COMMAND.COM /C $newargs"
}
proc createReport { name_list storeFile section } {
# Prepare path_names
set M4repdir [path_name concat [m4_var get M4_home] reports]
set M4bindir [path_name concat [m4_var get M4_home] bin]
# use the ClientContext to switch systems
set cc [ClientContext::global]
# remember the current document-system we are in now
set currsys [$cc currentSystem]
# get the system handle of the system we are documenting now
# the document object is a global set var in docbatch.tcl
set docsys [$document docSys]
# Change the context to the system to execute the report in
$cc changeLevelId $docsys
# Set the first indent level to indent +
set indent +
# open the file in where the sub-structure will be generated
set fid [open $storeFile w]
# For each report name in the name_list run the (TCLbased) report-writer
foreach name [split $name_list " "] {
set name [string trim $name]
set tmpname [args_file {}]
puts "Executing TCL report writer for report $name.tcl"
# Run A command.com to redirect output
set command [w95comm "$M4bindir/otsh -f $M4repdir/startreport.tcl -- $name.tcl"]
puts "Running command $command"
system "$command > $tmpname"
# Now generate the additional structure lines note that the section
# name - must - differ from the name used in the .str file, e.g.
# the new section name must be unique. We use the the report name.
regsub -all {\\} $tmpname {\\\\} newtmp
puts $fid "$name|$indent||DocText||$newtmp"
set indent =
}
# Close the sub-structure file
close $fid
# Go back to the context fo the current document system
$cc changeLevelId $currsys
}