home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 1998 October
/
PCWorld_1998-10_cd.bin
/
software
/
prehled
/
komix
/
DATA.Z
/
docbatch.tcl
< prev
next >
Wrap
Text File
|
1997-10-01
|
3KB
|
140 lines
#---------------------------------------------------------------------------
#
# (c) Cayenne Software Inc. 1997
#
# File: @(#)docbatch.tcl /main/titanic/14
# Author: voyager
# Description: do some docwriter actions as batch job
#---------------------------------------------------------------------------
# SccsId = @(#)docbatch.tcl /main/titanic/14 1 Oct 1997 Copyright 1997 Cayenne Software Inc.
source [m4_path_name tcl libocl.tcl]
source [m4_path_name tcl platform.tcl]
proc read_require_file {file} {
if [catch {set name [m4_path_name tcl $file]}] {
set name $file
} else {
# check again
global required_files
if [info exists required_files($name)] {
return
}
set required_files($name) 1
}
source $name
}
require procs.tcl
require messagehdl.tcl
proc wmtkmessage {msg} {
puts $msg
}
proc wmtkerror {msg} {
if [info exists errorInfo] {
if [strncmp $msg $errorInfo] {
append msg "\n$errorInfo"
} else {
set msg $errorInfo
}
}
set errorMsg ""
set prevStr ""
set nl ""
foreach str [split $msg "\n"] {
if [strncmp $str $prevStr] {
append errorMsg "$nl$str"
set nl "\n"
set prevStr $str
}
}
puts $errorMsg
}
proc wmtkfatal {msg} {
wmtkerror $msg
exit
}
set moduleHdlr [ModuleHandler new \
-moduleSpecSetChanged {
set s_modules [%this selectedModuleSpecSet]
foreach file [%this getFiles tcl s_docbatch.tcl $s_modules] {
source $file
}
} ]
global globalModuleHandler
set globalModuleHandler $moduleHdlr
# redefine proc require_module_file
proc require_module_file {file moduleName} {
set module [$moduleHdlr getModuleSpec $moduleName]
set moduleFile [$moduleHdlr getFiles tcl $file $module]
if {"$moduleFile" != ""} {
require [lindex $moduleFile 0]
}
}
# process corporate and user specs
eval [$moduleHdlr moduleSpecSetChanged]
$moduleHdlr setCurrentContext
# process other level specs
eval [$moduleHdlr moduleSpecSetChanged]
require config.tcl
require_module_file docgenerat.tcl docwriter
require_module_file docprocs.tcl docwriter
require_module_file docstructp.tcl docwriter
require_module_file doctool.tcl docwriter
global classCount
set classCount 0
sourceOptional u_docbatch
global docToolObjectHdlr
set docToolObjectHdlr [CustObjHandler new $globalModuleHandler]
$docToolObjectHdlr setCurrentContext
if {[llength $argv] != 4} {
error "Usage: otprint docbatch.tcl -- <command> \
<configVersion> <systemVersion> <file>"
exit
}
# the component and section generator
set cmd [lindex $argv 0]
set cv [lindex $argv 1]
set sv [lindex $argv 2]
set file [lindex $argv 3]
# make a Document
set document [Document new $sv]
$document initialize [ConfigVersion new $cv]
# cd to the docdir, (possible) UNC-path not allowed:
set crntPath [pwd]
if {$tcl_platform(platform) != "windows"} {
cd [$document directory]
}
# make the doctool
DocTool new docTool $document
DocGenerator new generator
if [catch {set returnValue [docTool startCommand $cmd $file]} msg] {
wmtkerror $msg
set returnValue 0
}
# cd back to (possible) UNC-path not allowed:
if {$tcl_platform(platform) != "windows"} {
cd $crntPath
}
wmtkmessage Done
exit $returnValue