home *** CD-ROM | disk | FTP | other *** search
- #---------------------------------------------------------------------------
- #
- # Copyright (c) 1993-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 : @(#)gencpp.tcl /main/hindenburg/1
- # Author : frmo
- # Original date : 4-2-1993
- # Description : Generate C++ : entry point
- #
- #---------------------------------------------------------------------------
- #
-
- require wmt_util.tcl
- require cpp_const.tcl
-
- set cc [ClientContext::global]
-
- if {! [$cc customFileExists cpp_config tcl "" 0]} {
- set msg "couldn't read file 'cpp_config.tcl': C++ environment not configured"
- error $msg "" ERR_CPP_CONFIG
- }
-
- require cpp_config.tcl
- require cpp_class.tcl
- require cpp_funcs.tcl
- require cpp_disp.tcl
- require cpp_regen.tcl
- require libsql.tcl
- require gen_db_def.tcl
- require gen_db_fnc.tcl
-
- proc generate_cpp {} {
- find_file_types
-
- set systemName [getCurrentSystemName]
- set tgt_objs [get_tgt_objs]
- if [lempty $tgt_objs] {
- # import new
- global skip_file
- global do_struct_file
- set struct_file ${systemName}Struct.$hplus_type
- set file_list "$esqlcplus_type $cplus_type $hplus_type"
- set old_files [fstorage::dir $file_list]
- foreach file $old_files {
- if {$file != $struct_file || !$do_struct_file} {
- set skip_file($file) 1
- }
- }
-
- if {![info exists skip_file($struct_file)]} {
- generate [$oomodel sqlModel]
- }
-
- generate [$oomodel ooplModel]
- # (Re)generate the makefile if there are new files
- set new_files [fstorage::dir $file_list]
- if {"$old_files" != "$new_files"} {
- require_with_reload makemake.tcl
- }
- } else {
- # import selected
- global gen_file
- set do_cpp 0
- foreach file $tgt_objs {
- set gen_file($file) 1
- if {"$file" == "${systemName}Struct.$hplus_type"} {
- continue
- }
- set type [nt_get_type $file]
- if {"$type" == "$cplus_type" || "$type" == "$hplus_type"
- || "$type" == "$esqlcplus_type"} {
- set do_cpp 1
- }
- }
- if {[info exists gen_file(${systemName}Struct.$hplus_type)]} {
- generate [$oomodel sqlModel]
- }
- if $do_cpp {
- generate [$oomodel ooplModel]
- }
- }
- }
-
- # Search for user defined Tcl files and "source" them. Tcl files are sourced
- # in the following order:
- # - u_gencpp.tcl; EITHER in m4_home/tcl OR in <project_dir>/tcl
- # - all tcl files in the system named "Tcl"
- # - all tcl files in the current system
-
-
- # "Source" a tcl file
- #
- proc source_tcl_file {file} {
- if [catch {source $file}] {
- m4_error $E_USER_TCL $file
- puts stderr $errorInfo
- }
- }
-
- # "Source" all tcl files in the current system
- #
- proc source_all_tcl_files {} {
- foreach file [fstorage::dir tcl] {
- source_tcl_file [fstorage::get_uenv_path $file absolute]
- }
- }
-
- # "Source" all tcl files in the system named "Tcl"
- #
- proc source_files_in_tcl_sys {} {
- set clientCont [ClientContext::global]
- set origSys [$clientCont levelNameAt System]
- if [catch {fstorage::goto_system Tcl.system}] {
- return
- }
- source_all_tcl_files
- fstorage::goto_system $origSys
- }
-
- if {[$cc customFileExists u_gencpp tcl "" 0]} {
- require u_gencpp.tcl
- }
-
- source_files_in_tcl_sys
- source_all_tcl_files
-
- generate_cpp
-