home *** CD-ROM | disk | FTP | other *** search
- ###########################################################################
- ##
- ## Copyright (c) 1996 by Cadre Technologies Inc.
- ## and Scientific Toolworks 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.
- ## or Scientific Toolworks Inc.
- ##
- ###########################################################################
-
- #
- # Configuration variables
- #
-
- # has_templates: true if compiler supports templates
- #
- global has_templates
- set has_templates 1
-
-
- global g_record_name
- global g_handle_name
- global g_inh_ext
- global o_record_name
- global g_ordered_set_cname
- global g_ordered_set_rname
- global g_unordered_set_cname
- global g_unordered_set_rname
- global g_qualified_rname
- global g_qualified_cname
- global g_generate_separates
- global g_alt_link_class_ext
-
- set g_record_name [m4_var get M4_Ada95_Class_Record_Type_Name]
- if {$g_record_name == ""} {set g_record_name "Instance"}
-
- set g_handle_name [m4_var get M4_Ada95_Class_Access_Type_Name]
- if {$g_handle_name == ""} {set g_handle_name "Link"}
-
- set g_inh_ext [m4_var get M4_Ada95_Class_Record_Inh_Attrib_Ext]
- if {$g_inh_ext == ""} {set g_inh_ext "_Inh"}
-
- set o_record_name [m4_var get M4_Ada95_Opaque_Record_Type_Name]
- if {$o_record_name == ""} {set o_record_name "Data"}
-
- set g_ordered_set_cname [m4_var get M4_Ada95_Ordered_Assoc_Generic_Package_Name]
- if {$g_ordered_set_cname == ""} {set g_ordered_set_cname "Generic_Ordered_Set"}
-
- set g_ordered_set_rname [m4_var get M4_Ada95_Ordered_Assoc_Type_Name]
- if {$g_ordered_set_rname == ""} {set g_ordered_set_rname "Ordered_Set"}
-
- set g_unordered_set_cname [m4_var get M4_Ada95_Unordered_Assoc_Generic_Package_Name]
- if {$g_unordered_set_cname == ""} {set g_unordered_set_cname "Generic_Unordered_Set"}
-
- set g_unordered_set_rname [m4_var get M4_Ada95_Unordered_Assoc_Type_Name]
- if {$g_unordered_set_rname == ""} {set g_unordered_set_rname "Unordered_Set"}
-
- set g_qualified_cname [m4_var get M4_Ada95_Qualified_Assoc_Generic_Package_Name]
- if {$g_qualified_cname == ""} {set g_qualified_cname "Generic_Dictionary"}
-
- set g_qualified_rname [m4_var get M4_Ada95_Qualified_Assoc_Type_Name]
- if {$g_qualified_rname == ""} {set g_qualified_rname "Dictionary"}
-
- set g_generate_separates [m4_var get M4_Ada95_Generate_Subunit_Files]
- if {$g_generate_separates == ""} {set g_generate_separates "Off"}
-
- set g_alt_link_class_ext [m4_var get M4_Ada95_Alt_Link_Class_Ext]
- if {$g_alt_link_class_ext == ""} {set g_alt_link_class_ext "_Alt"}
-
- global sysfile_name
- set sysfile_name "[cap [getCurrentSystemName]]_Types"
-
-
- # directory search path for external sources
- # could be a list separated by ':'
- global exsrc_searchpath
- # example usage:
- # set exsrc_searchpath /usr/source:/usr/you/project/src
-
- # a String class is used in the persistence layer
- global string::name
- set string::name String
-
- # the funcmap class is used in the persistence layer
- global funcmap::key_type_name
- set funcmap::key_type_name ${string::name}
-
- #
- # PtrSet configuration
- #
- global set::name
- set set::name PtrSet
- global set::add
- set set::add add
- global set::remove
- set set::remove remove
- proc set::iter {sect name type action} {
- set s_name [uncap [set_name $name]]
- set piv [uncap [pointer_name $name]]
- expand_text $sect {
- ~$type *~$piv;
-
- for (~$piv = ~$s_name.first(); ~$piv; ~$piv = ~$s_name.next()) {
- ~[eval $action $piv]
- }
- }
- }
-
- #
- # OPtrSet configuration
- #
- global oset::name
- set oset::name OPtrSet
- global oset::add
- set oset::add append
- global oset::remove
- set oset::remove remove
- proc oset::iter {sect name type action} {
- set os_name [uncap [oset_name $name]]
- expand_text $sect {
- for (int i = 0; i < ~$os_name.size(); i++) {
- ~[eval $action $os_name\\\[i\\\]]
- }
- }
- }
-
- #
- # PtrDict configuration
- #
- global dict::name
- set dict::name PtrDict
- global dict::set
- set dict::set set
- global dict::remove
- set dict::remove remove
-
- # 'return_type' not used here
- proc dict::get_and_return {sect name key return_type} {
- expand_text $sect {
- return ~$name.get(~$key);
- }
- }
-
- proc dict::get_test_and_act {sect name key return_type action} {
- set dct_name [uncap [dict_name $name]]
- set ptr_name [uncap [pointer_name $return_type]]
- expand_text $sect {
- ~$return_type *~$ptr_name;
- if (~$ptr_name = ~$dct_name.get(~$key)) {
- ~[eval $action $ptr_name]
- }
- }
- }
-
- proc dict::iter {sect name type qual_type action} {
- set dct_name [uncap [dict_name $name]]
- set piv [uncap [pointer_name $name]]
- expand_text $sect {
- ~$type *~$piv;
-
- for (~$piv = ~$dct_name.firstValue(); ~$piv; ~$piv = ~$dct_name.nextValue()) {
- ~[eval $action $piv]}
- }
- }
-
- proc dict::initializer {name key value} {
- # not used here
- return ""
- }
-
- #
- # PSetDict configuration
- #
- global psdict::name
- set psdict::name PSetDict
- global psdict::add
- set psdict::add add
- global psdict::remove
- set psdict::remove remove
-
- proc psdict::get_and_return {sect name key return_type} {
- set sdct_name [uncap [set_dict_name $name]]
- expand_text $sect {
- return ~$sdct_name.get(~$key);
- }
- }
-
- proc psdict::iter {sect name type qual_type action} {
- set sdct_name [uncap [set_dict_name $name]]
- set piv [uncap [pointer_name $name]]
- set psiv [uncap [pointer_name [set_name $name]]]
- expand_text $sect {
- ~[set_type_name $type] *~$psiv;
-
- for (~$psiv = ~$sdct_name.firstValue(); ~$psiv; ~$psiv = ~$sdct_name.nextValue()) {
- ~$type *~$piv;
- for (~$piv = ~$psiv->first(); ~$piv; ~$piv = ~$psiv->next()) {
- ~[eval $action $piv]
- }
- }
- }
- }
-
- proc psdict::initializer {name key value} {
- # not used here
- return ""
- }
-
- #
- # OPSetDict configuration
- #
- global opsdict::name
- set opsdict::name OPSetDict
- global opsdict::add
- set opsdict::add append
- global opsdict::remove
- set opsdict::remove remove
-
- proc opsdict::get_and_return {sect name key return_type} {
- set osdct_name [uncap [oset_dict_name $name]]
- expand_text $sect {
- return ~$osdct_name.get(~$key);
- }
- }
-
- proc opsdict::iter {sect name type qual_type action} {
- set osdct_name [uncap [oset_dict_name $name]]
- set piv [uncap [pointer_name $name]]
- set opsiv [uncap [pointer_name [oset_name $name]]]
- expand_text $sect {
- ~[oset_type_name $type] *~$opsiv;
-
- for (~$opsiv = ~$osdct_name.firstValue(); ~$opsiv; ~$opsiv = ~$osdct_name.nextValue()) {
- for (int i = 0; i < ~$opsiv->size(); i++) {
- ~[eval $action $opsiv->at(i)]
- }
- }
- }
- }
-
- proc opsdict::initializer {name key value} {
- # not used here
- return ""
- }
-