home *** CD-ROM | disk | FTP | other *** search
/ PC World 1997 November / PCWorld_1997-11_cd.bin / software / programy / komix / DATA.Z / gencorba.tcl < prev    next >
Text File  |  1996-10-17  |  3KB  |  102 lines

  1. ###########################################################################
  2. ##
  3. ##  Copyright (c) 1996 by Cadre Technologies Inc.
  4. ##
  5. ##  This software is furnished under a license and may be used only in
  6. ##  accordance with the terms of such license and with the inclusion of
  7. ##  the above copyright notice. This software or any other copies thereof
  8. ##  may not be provided or otherwise made available to any other person.
  9. ##  No title to and ownership of the software is hereby transferred.
  10. ##
  11. ##  The information in this software is subject to change without notice
  12. ##  and should not be construed as a commitment by Cadre Technologies Inc.
  13. ##
  14. #      File:           @(#)gencorba.tcl    /main/hindenburg/1
  15. #
  16. ###########################################################################
  17.  
  18. require wmt_util.tcl
  19.  
  20. global comment_string; set comment_string(corba) "// "
  21. global cc
  22.  
  23. set cc [ClientContext::global]
  24.  
  25. require corba_utils.tcl
  26. require corba_funcs.tcl
  27. require corba_disp.tcl
  28.  
  29. proc generate_corba {} {
  30.     find_file_types
  31.  
  32.     set systemName [getCurrentSystemName]
  33.     set tgt_objs [get_tgt_objs]
  34.     if [lempty $tgt_objs] {
  35.         # import new
  36.         global skip_file
  37.         set file_list "idl"
  38.         set old_files [fstorage::dir $file_list]
  39.  
  40.         generate [$oomodel ooplModel]
  41.     } else {
  42.         # import selected
  43.         global gen_file
  44.         set do_corba 0
  45.         foreach file $tgt_objs {
  46.             set gen_file($file) 1
  47.             set type [nt_get_type $file]
  48.             if {"$type" == "idl"} {
  49.                 set do_corba 1
  50.             }
  51.         }
  52.         if $do_corba {
  53.             generate [$oomodel ooplModel]
  54.         }
  55.     }
  56. }
  57.  
  58. # Search for user defined Tcl files and "source" them. Tcl files are sourced
  59. # in the following order:
  60. #    - u_gencorba.tcl; EITHER in m4_home/tcl OR in <project_dir>/tcl
  61. #    - all tcl files in the system named "Tcl"
  62. #    - all tcl files in the current system
  63.  
  64.  
  65. # "Source" a tcl file
  66. #
  67. proc source_tcl_file {file} {
  68.     if [catch {source $file}] {
  69.     m4_error $E_USER_TCL $file
  70.     puts stderr $errorInfo
  71.     }
  72. }
  73.  
  74. # "Source" all tcl files in the current system
  75. #
  76. proc source_all_tcl_files {} {
  77.     foreach file [fstorage::dir tcl] {
  78.     source_tcl_file [fstorage::get_uenv_path $file absolute]
  79.     }
  80. }
  81.  
  82. # "Source" all tcl files in the system named "Tcl"
  83. #
  84. proc source_files_in_tcl_sys {} {
  85.     set clientCont [ClientContext::global]
  86.     set origSys [$clientCont levelNameAt System]
  87.     if [catch {fstorage::goto_system Tcl.system}] {
  88.         return
  89.     }
  90.     source_all_tcl_files
  91.     fstorage::goto_system $origSys
  92. }
  93.  
  94. if {[$cc customFileExists u_gencorba tcl "" 0]} {
  95.     require u_gencorba.tcl
  96. }
  97.  
  98. source_files_in_tcl_sys
  99. source_all_tcl_files
  100.  
  101. generate_corba
  102.