home *** CD-ROM | disk | FTP | other *** search
- #---------------------------------------------------------------------------
- #
- # 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/hindenburg/2
- # Original date : August 1995
- # Description : Initialization for codegeneration stuff
- #
- #---------------------------------------------------------------------------
- #
-
- global classCount; set classCount 0
-
- #
- # 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
- }
-
- #
- # 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 2 $cmd
- }
-