home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 1997 November
/
PCWorld_1997-11_cd.bin
/
software
/
programy
/
komix
/
DATA.Z
/
wntdocprocs_add.tcl
< prev
next >
Wrap
Text File
|
1996-12-05
|
2KB
|
55 lines
# The Windows NT cmd.exe can handle the UNIX / path sepparator ok
proc wntcomm {args} {
set newargs ""
foreach e $args {
regsub -all {\\} $e {/} e
set newargs "$newargs $e"
}
return "cmd.exe /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 [wntcomm "$M4bindir/otsh -f $M4repdir/startreport.tcl -- $name.tcl"]
puts "Running command $command > $tmpname"
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
}