home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 1998 October
/
PCWorld_1998-10_cd.bin
/
software
/
prehled
/
komix
/
DATA.Z
/
cginit.tcl
< prev
next >
Wrap
Text File
|
1997-08-04
|
2KB
|
93 lines
#---------------------------------------------------------------------------
#
# Copyright (c) 1995 by Cadre Technologies Inc.
#
# This software is furnished under a license and may be used only in
# accordance with the terms of such license and with the inclusion of
# the above copyright notice. This software or any other copies thereof
# may not be provided or otherwise made available to any other person.
# No title to and ownership of the software is hereby transferred.
#
# The information in this software is subject to change without notice
# and should not be construed as a commitment by Cadre Technologies Inc.
#
#---------------------------------------------------------------------------
#
# File : @(#)cginit.tcl /main/titanic/9
# Original date : August 1995
# Description : Initialization for codegeneration stuff
#
#---------------------------------------------------------------------------
#
global classCount; set classCount 0
#
# Make sure all modules are loaded (needed for RevEng (otprint))
#
global modHdlr
set modHdlr [ModuleHandler new]
$modHdlr setCurrentContext
#
# Require: source a file only once
#
proc require {file} {
global required_files
if [info exists required_files($file)] {
return
}
set required_files($file) 1
read_require_file $file
}
#
# Reload even if it has been sourced before
#
proc require_with_reload {file} {
global required_files
set required_files($file) 1
read_require_file $file
}
#
# require_all_module_files: requires the specified file from every
# (active) module.
#
proc require_all_module_files {file} {
global required_files
if [info exists required_files($file)] {
return
}
set required_files($file) 1
global modHdlr
foreach sfile [$modHdlr getSelectedFiles "tcl" $file] {
uplevel #0 source \{$sfile\}
}
}
#
# Dot not call the next procedure directly, but use require or
# require_with_reload. If this procedure is called directly, the
# uplevel command may cause strange behaviour ...
#
proc read_require_file {fullName} {
set fileName [lindex [split $fullName .] 0]
set fileType [lindex [split $fullName .] 1]
set cc [ClientContext::global]
if [catch {
set cmd [$cc getCustomFileContents $fileName $fileType tcl]
} msg] {
puts $msg
return
}
uplevel #0 $cmd
}