home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 1997 November
/
PCWorld_1997-11_cd.bin
/
software
/
programy
/
komix
/
DATA.Z
/
ada_class.tcl
< prev
next >
Wrap
Text File
|
1997-03-24
|
26KB
|
994 lines
###########################################################################
##
## 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.
##
###########################################################################
# Needed for E_FILE_OPEN_WRITE
#
require cgen_msg.tcl
global ada_hdr_sections
set ada_hdr_sections {
h_hdr_sect
h_user_sect_1
h_incl_sect
h_class_nm_sect
h_user_sect_2
h_pub_data_sect
h_conv_func_sect
h_pub_access_sect
h_pub_func_sect
h_priv_data_sect
h_static_data_sect
h_priv_access_sect
h_priv_func_sect
h_user_sect_3
h_trailer_sect
h_user_sect_4
}
global ada_src_sections
set ada_src_sections {
c_hdr_sect
c_user_sect_1
c_conv_incl_sect
c_class_nm_sect
c_user_sect_2
c_opaque_sect
c_static_data_sect
c_user_sect_3
c_conv_func_sect
c_access_func_sect
c_impl_sect
c_user_sect_4
c_trailer_sect
c_user_sect_5
}
global ada_assoc_sections
set ada_assoc_sections {
h_hdr_sect
h_user_sect_1
h_inter_pkg_sect
h_user_sect_2
}
global ada_link_sections
set ada_link_sections {
h_sect
c_sect
}
global ada_separate_sections
set ada_separate_sections {
c_hdr_sect
c_user_sect_1
c_sep_line_sect
c_impl_sect
}
# Global section array
#
global ada_sections
global assoc_sections
global separate_sections
global link_sections
# Determine the right section based on the accessibility specification and
# whether it is for reading or writing
#
proc get_hdr_sect {access {mode ""}} {
case [split_access_mode $access $mode] in {
{Public} {
return $ada_sections(h_pub_access_sect)
}
{Private} {
return $ada_sections(h_priv_access_sect)
}
{None} {
return $ada_sections(dev_null_sect)
}}
return $ada_sections(h_pub_access_sect)
}
proc get_src_sect {access {mode ""}} {
case [split_access_mode $access $mode] in {
{Public} {
echo "SOURCE (mode=$mode) access is Public\n"
return 1;
}
{Private} {
echo "attrib access is Private\n"
return 1;
}
{None} {
echo "SOURCE (mode=$mode) access is None\n"
return 0;
}}
return 0;
}
# Determine the type of header section based on the accessibility specification and
# whether it is for reading or writing
proc get_hdr_type {access {mode ""}} {
return [split_access_mode $access $mode]
}
# Split up the access mode and return the right part of it
#
proc split_access_mode {access mode} {
if {$access == ""} {
return Public
}
set rw_ac_list [split $access -]
if {[llength $rw_ac_list] == 2} {
if {$mode == "r"} {
return [lindex $rw_ac_list 0]
}
return [lindex $rw_ac_list 1]
}
return $access
}
proc split_op_list_entry {access mode} {
set rw_ac_list [split $access :]
if {[llength $rw_ac_list] == 2} {
if {$mode == "class"} {
return [lindex $rw_ac_list 0]
}
return [lindex $rw_ac_list 1]
}
return $access
}
# Determine the section for an assoc accesser function based on
# the attribute "assoc_access"
#
proc get_assoc_hdr_sect {assoc {mode ""}} {
return [get_hdr_sect [get_assoc_access $assoc] $mode]
}
proc get_assoc_src_sect {assoc {mode ""}} {
return [get_src_sect [get_assoc_access $assoc] $mode]
}
# Determine the section for an attribute accesser function based on
# the attribute "attrib_access"
#
proc get_attrib_hdr_sect {attrib {mode ""}} {
return [get_hdr_sect [get_attrib_access $attrib] $mode]
}
proc get_attrib_src_sect {attrib {is_inline 0} {mode ""}} {
return [get_src_sect [get_attrib_access $attrib] $mode]
}
#Determine the type of header section. "Private", "Public" or "None" is returned.
proc get_attrib_hdr_type {attrib {mode ""}} {
return [get_hdr_type [get_attrib_access $attrib] $mode]
}
proc get_assoc_hdr_type {attrib {mode ""}} {
return [get_hdr_type [get_assoc_access $attrib] $mode]
}
# Determine the type of a given section. "hdr" or "src" is returned.
# Special sections "hdr" and "src" are understood, and are returned as is.
#
proc determine_sect_type {sect} {
if {$sect == "src"} {
set type "src"
} elseif {$sect == "hdr"} {
set type "hdr"
} else {
global ada_sections
foreach n [array names ada_sections] {
if {$ada_sections($n) == $sect} {
if {[lsearch $ada_src_sections $n] != -1} {
set type "src"
} else {
set type "hdr"
}
break
}
}
}
return $type
}
proc get_data_section {class} {
case [get_class_vis $class] in {
{Public} {
return $ada_sections(h_pub_data_sect)
}
{Private} {
return $ada_sections(h_priv_data_sect)
}
{Limited} {
return $ada_sections(h_priv_data_sect)
}
{Opaque} {
return $ada_sections(c_opaque_sect)
}}
}
proc get_func_section {oper} {
case [get_method_access $oper] in {
{Public} {
return $ada_sections(h_pub_func_sect)
}
{Private} {
return $ada_sections(h_priv_func_sect)
}
{} {
return $ada_sections(h_pub_func_sect)
}}
}
proc get_include_section {class} {
#
#if {[get_class_visibility $class] != "Opaque"} {
# return $ada_sections(h_incl_sect)
#} else {
# return $ada_sections(c_hdr_sect)
#}
#
return $ada_sections(h_incl_sect)
}
# Create ada sections
#
proc create_ada_sections {sects} {
global ada_sections
foreach sect $sects {
set ada_sections($sect) [section create]
section set_indent $ada_sections($sect) 0 " "
}
set ada_sections(dev_null_sect) [section create]
}
proc create_assoc_sections {sects} {
global assoc_sections
foreach sect $sects {
set assoc_sections($sect) [section create]
section set_indent $assoc_sections($sect) 0 " "
}
set assoc_sections(dev_null_sect) [section create]
}
proc create_separate_sections {sects} {
global separate_sections
foreach sect $sects {
set separate_sections($sect) [section create]
section set_indent $separate_sections($sect) 0 " "
}
set separate_sections(dev_null_sect) [section create]
}
proc get_class_vis {class} {
set class_visibility [get_class_visibility $class]
if {$class_visibility == ""} {set class_visibility Public}
return $class_visibility
}
# give sections their initial contents
proc init_ada_sections {name data_sect visibility} {
global USERMETHCMMT
section append $ada_sections(h_incl_sect) "with $sysfile_name;\n"
section set_indent $ada_sections(h_user_sect_2) +
section set_indent $ada_sections(h_pub_data_sect) +
section set_indent $ada_sections(h_conv_func_sect) +
section set_indent $ada_sections(h_pub_func_sect) +
section set_indent $ada_sections(h_pub_access_sect) +
section set_indent $ada_sections(h_priv_access_sect) +
section set_indent $ada_sections(h_priv_func_sect) +
section set_indent $ada_sections(h_user_sect_3) +
section append $ada_sections(h_priv_data_sect) "private\n\n"
section set_indent $ada_sections(h_priv_data_sect) +
section set_indent $ada_sections(h_static_data_sect) +
#HM added comments to devide sections
section append $ada_sections(h_pub_func_sect) $USERMETHCMMT
section append $ada_sections(h_pub_func_sect) "\n"
section append $ada_sections(h_priv_func_sect) $USERMETHCMMT
section append $ada_sections(h_priv_func_sect) "\n"
if {$visibility != "Opaque"} {
section append $data_sect "type $g_record_name is record\n"
}
section set_indent $data_sect +
section set_indent $ada_sections(c_user_sect_2) +
section set_indent $ada_sections(c_opaque_sect) +
section set_indent $ada_sections(c_static_data_sect) +
section set_indent $ada_sections(c_user_sect_3) +
section set_indent $ada_sections(c_conv_func_sect) +
section set_indent $ada_sections(c_access_func_sect) +
section set_indent $ada_sections(c_impl_sect) +
section set_indent $ada_sections(c_user_sect_4) +
section append $ada_sections(c_trailer_sect) "\nend $name;\n"
}
proc init_sys_sections {name} {
section append $ada_sections(h_hdr_sect) \
"-- Specification file for ${name}\n\n"
section append $ada_sections(h_class_nm_sect) "package $name is\n"
section append $ada_sections(h_pub_data_sect) "\n"
section set_indent $ada_sections(h_user_sect_2) +
section set_indent $ada_sections(h_pub_data_sect) +
section set_indent $ada_sections(h_user_sect_3) +
section append $ada_sections(h_trailer_sect) "\nend $name;\n"
}
proc init_poly_sections {class} {
set name [get_name $class]
section append $ada_sections(h_hdr_sect) \
"-- Specification file for ${g_poly_prefix}${name}\n\n"
section append $ada_sections(c_hdr_sect) \
"-- Body file for ${g_poly_prefix}${name}\n\n"
section append $ada_sections(h_incl_sect) "with $sysfile_name;\n"
set head_sect $ada_sections(h_class_nm_sect)
section append $ada_sections(c_class_nm_sect) "package body ${g_poly_prefix}${name} is\n\n"
set data_sect $ada_sections(h_pub_data_sect)
section append $head_sect "package ${g_poly_prefix}${name} is\n"
section append $head_sect " type Kind is ("
section set_indent $data_sect +
section append $data_sect "type $g_record_name (${name}_Kind: Kind := A_${name}) is record\n"
section set_indent $data_sect +
section append $data_sect "case ${name}_Kind is\n"
section set_indent $ada_sections(h_pub_func_sect) +
section set_indent $ada_sections(c_impl_sect) +
section set_indent $ada_sections(h_pub_access_sect) +
section set_indent $ada_sections(c_access_func_sect) +
}
# give sections their terminal contents
proc exit_ada_sections {class} {
global ada_sections g_assoc_list g_handle_name g_record_name
global g_component_count
set sect [get_data_section $class]
if {[get_class_visibility $class] != "Opaque"} {
if {$g_component_count == 0} {
section append $sect "null;\n"
}
section set_indent $sect -
section append $sect "end record;\n\n"
section append $ada_sections(h_static_data_sect) "\n"
# Add the line "type Link is access Instance;" (defaults) if
# this class is the object of an association. Opaque packages
# already contain this line.
#
# if {[lsearch $g_assoc_list [get_name $class]] != -1} {
# section append $ada_sections(h_pub_data_sect) \
# "type $g_handle_name is access $g_record_name;\n\n"
# }
# Add it all of the time... In case a class is used as a type
# within another class.
section append $ada_sections(h_pub_data_sect) \
"type $g_handle_name is access $g_record_name;\n\n"
} else {
if {$g_component_count == 0} {
section append $ada_sections(c_opaque_sect) "null;\n"
}
section set_indent $ada_sections(c_opaque_sect) -
section append $ada_sections(c_opaque_sect) "end record;\n\n"
section append $ada_sections(c_static_data_sect) "\n"
}
set tmp_sect [section create]
section append_section $tmp_sect $ada_sections(h_priv_data_sect)
section append_section $tmp_sect $ada_sections(h_priv_access_sect)
section append_section $tmp_sect $ada_sections(h_priv_func_sect)
section append_section $tmp_sect $ada_sections(h_static_data_sect)
echo "private section = [section get_contents $tmp_sect]..."
if {[section get_contents $tmp_sect] == "private\n\n\n" } {
set ada_sections(h_priv_data_sect) [section create]
}
section append $ada_sections(h_user_sect_2) "\n"
}
proc exit_poly_sections {class} {
global g_handle_name
global g_record_name
section append $ada_sections(h_class_nm_sect) ");\n"
section append $ada_sections(h_pub_data_sect) "end case;\n"
section set_indent $ada_sections(h_pub_data_sect) -
section append $ada_sections(h_pub_data_sect) "end record;\n\n"
section append $ada_sections(h_pub_data_sect) "type $g_handle_name is access $g_record_name;\n\n"
section set_indent $ada_sections(h_pub_func_sect) -
section append $ada_sections(h_pub_func_sect) "end ${g_poly_prefix}[get_name $class];\n"
section set_indent $ada_sections(c_impl_sect) -
section append $ada_sections(c_trailer_sect) "end ${g_poly_prefix}[get_name $class];\n"
}
#
# Dependency management. If there is only one target (lib or exe) in the
# system then source files are automatically added to the dependency list
# of that target.
#
global the_only_target
set the_only_target [fstorage::dir {exe lib}]
if {[llength $the_only_target] == 1} {
global the_only_target_deps
foreach dep [fstorage::get_dependencies $the_only_target] {
set the_only_target_deps($dep) 1
}
} else {
catch {unset the_only_target}
}
proc add_only_target_dep {dep} {
if {[info exists the_only_target] &&
![info exists the_only_target_deps($dep)]} {
fstorage::add_dependency $the_only_target $dep
set the_only_target_deps($dep) 1
}
}
# Write the sections to the right file and deallocate them
#
proc write_ada_sections {class hsects csects} {
set class_name [get_name $class]
class2tgtfiles $class_name src_file h_file
#HM do not write the body file if the spec file doesn't change
set do_write 1
if {[do_write_sections $class_name $h_file $hsects 1 1] == 2} {
set do_write 0
}
do_write_sections $class_name $src_file $csects 1 $do_write
section dealloc $ada_sections(dev_null_sect)
unset ada_sections(dev_null_sect)
}
proc write_poly_sections {class hsects csects} {
class2polyfiles $class src_file h_file
set class_name [get_name $class]
if {[is_file_regenerated $h_file] || [is_file_regenerated $src_file]} {
puts stdout "Generating for polymorphic class '${g_poly_prefix}[get_name $class]'"
#HM do not write the body file if the spec file doesn't change
set do_write 1
if {[do_write_sections $class_name $h_file $hsects 4 1] == 2} {
set do_write 0
}
do_write_sections $class_name $src_file $csects 4 $do_write
}
}
proc write_assoc_sections {class hsects ext} {
class2assocfiles $class $ext h_file
set class_name [get_name $class]
do_write_sections $class_name $h_file $hsects 0 1
}
proc write_link_sections {class hsects csects} {
class2linkfiles $class src_file h_file
set class_name [get_name $class]
#HM do not write the body file if the spec file doesn't change
set do_write 1
if {[do_write_sections $class_name $h_file $hsects 3 1] == 2} {
set do_write 0
}
do_write_sections $class_name $src_file $csects 3 $do_write
}
proc write_sys_sections {name hsects} {
class2tgtfiles $name c_file h_file
if {[is_file_regenerated $h_file]} {
puts stdout "Generating for User-Defined Types File '$sysfile_name'"
do_write_sections $name $h_file $hsects 5 1
}
}
proc write_separate_sections {class csects ext} {
class2separatefiles $class $ext c_file
set class_name [get_name $class]
do_write_sections $class_name $c_file $csects 2 1
}
proc is_file_regenerated {filename} {
global skip_file
global gen_file
# if {[llength $sects] == 0} {return 0}
if {[info exists gen_file($filename)] ||
($import_new && ![info exists skip_file($filename)])} {
return 1
}
return 0
}
proc do_write_sections {class_name file_name sects flag do_write} {
set did_save_file 0
if {[llength $sects] == 0} {return $did_save_file}
set nt $file_name
global skip_file
global gen_file
if {[info exists gen_file($nt)] ||
($import_new && ![info exists skip_file($nt)])} {
set cmp_sect [section create]
foreach sect $sects {
case $flag in {
{0} {set sect2 $assoc_sections($sect)}
{1} {set sect2 $ada_sections($sect)}
{2} {set sect2 $separate_sections($sect)}
{3} {set sect2 $link_sections($sect)}
{4} {set sect2 $ada_sections($sect)}
{5} {set sect2 $ada_sections($sect)}
}
section append_section $cmp_sect $sect2
section dealloc $sect2
unset sect2
}
if {[section_equals_file $cmp_sect $nt] || $do_write == 0} {
puts " $nt has not changed: file not written"
section dealloc $cmp_sect
return 2
}
puts stdout " Creating $nt"
if {[catch {set fd [fstorage::open $nt w]} reason]} {
puts stderr $reason
m4_error $E_FILE_OPEN_WRITE $nt
} else {
if { [catch {fstorage::set_imp_from $nt $class_name} \
reason] } {
puts stderr $reason
}
section write $cmp_sect $fd
section dealloc $cmp_sect
fstorage::close $fd
set did_save_file 1
}
}
return $did_save_file
}
proc process_external_class_source {class} {
set class_name [get_name $class]
set tmp_sect [section create]
expand_text $tmp_sect [get_class_source $class]
set files [string trim [section get_contents $tmp_sect]]
section dealloc $tmp_sect
set first 1
foreach entry [split $files ,] {
# first one is hplus_type
# all others are ada_type
if $first {
set first 0
set ftype $ada_spec_type
} else {
set ftype $ada_body_type
}
set file_name [class2file $class_name]
set nt ${file_name}.$ftype
global skip_file
global gen_file
if {[info exists gen_file($nt)] ||
($import_new && ![info exists skip_file($nt)])} {
set fullpath [find_file $entry]
if {$fullpath == ""} {
puts -nonewline "ERROR: class '[get_name $class]': "
puts "external class source file '$entry' not found"
continue
}
puts "Importing external '$fullpath'"
puts " Creating $nt"
if {[catch {set out [fstorage::open $nt w]} reason]} {
puts stderr $reason
m4_error $E_FILE_OPEN_WRITE $nt
} else {
if { [catch {fstorage::set_imp_from $nt \
$class_name} reason] } {
puts stderr $reason
}
set max 8092
set in [open $fullpath r]
while {[set result [read $in $max]] != ""} {
puts -nonewline $out $result
}
close $in
fstorage::close $out
}
}
}
}
# find file using global 'exsrc_searchpath'
proc find_file {file} {
if [file exists $file] {
return $file
}
global exsrc_searchpath
if {! [info exists exsrc_searchpath]} {
return ""
}
foreach dir [split $exsrc_searchpath :] {
set fullpath $dir/$file
if [file exists $fullpath] {
return $fullpath
}
}
return ""
}
# read status arrays and generate 'only-once' code
proc gen_delayed_code {} {
global ada_hdr_incs
catch {unset cpp_hdr_incs}
global cpp_hdr_files
catch {unset cpp_hdr_files}
}
# Global friend array
#
global cpp_friends
proc add_friend {friend} {
global cpp_friends
set cpp_friends([get_name $friend]) 1
}
proc gen_friends {} {
global cpp_friends
if {![info exists cpp_friends]} {
return
}
set sect $ada_sections(h_friend_sect)
section set_indent $sect +
foreach class [lsort [array names cpp_friends]] {
section append $sect "friend class $class;\n"
}
section set_indent $sect +
unset cpp_friends
}
#
# forward declaration / class header inclusion management functions
#
# Global arrays to store the information
#
global cpp_forwards
global cpp_hdr_incs cpp_hdr_incs_name cpp_hdr_incs_name_ext
global cpp_src_incs cpp_src_incs_name cpp_src_incs_name_ext
proc add_forward {class} {
global cpp_forwards
set cpp_forwards([get_name $class]) $class
}
proc add_forward_name {name} {
global cpp_forwards
set cpp_forwards($name) 1
}
proc add_hdr_inc {class} {
global cpp_hdr_incs
set cpp_hdr_incs([get_name $class]) $class
}
proc add_hdr_inc_name {class_name {ext "hxx"}} {
global cpp_hdr_incs_name cpp_hdr_incs_name_ext
set cpp_hdr_incs_name($class_name) 1
set cpp_hdr_incs_name_ext($class_name) $ext
}
proc add_src_inc {class} {
global cpp_src_incs
set cpp_src_incs([get_name $class]) $class
}
proc add_src_inc_name {class_name {ext "hxx"}} {
global cpp_src_incs_name cpp_src_incs_name_ext
set cpp_src_incs_name($class_name) 1
set cpp_src_incs_name_ext($class_name) $ext
}
# Generate forwards. If the class definition is also included, the forward
# is not generated.
#
proc gen_forwards {} {
global cpp_forwards cpp_hdr_incs
if {![info exists cpp_forwards]} {
return
}
set sect $ada_sections(h_fwd_decl_sect)
foreach class [lsort [array names cpp_forwards]] {
if [info exists cpp_hdr_incs($class)] {
continue
}
}
unset cpp_forwards
}
proc gen_hdr_incs {class} {
set user_include_list ""
set incls [get_include_list $class]
echo "incls = $incls"
if {$incls != ""} {
foreach incl [config_include_list [split $incls ,]] {
lappend user_include_list $incl
}
}
# do not sort ! remove duplicates
foreach entry $user_include_list {
if [info exists dup($entry)] {
continue;
}
set dup($entry) 1
section append $ada_sections(h_incl_sect) "with $entry;\n"
}
}
# Generate includes for source file. Don't generate if the file is already
# included in the header file.
#
proc gen_src_incs {} {
global cpp_src_incs cpp_src_incs_name cpp_src_incs_name_ext cpp_hdr_files
if {! [info exists ada_sections(c_hdr_sect)]} {
catch {unset cpp_src_incs}
catch {unset cpp_src_incs_name}
catch {unset cpp_src_incs_name_ext}
return
}
set gen_include_list ""
set user_include_list ""
if [info exists cpp_src_incs] {
foreach class [array names cpp_src_incs] {
if [info exists cpp_hdr_incs($class)] {
continue
}
set hdl $cpp_src_incs($class)
set incls [get_include_list $hdl]
if {$incls == ""} {
lappend gen_include_list [get_name $hdl]
set src_files([h_class2file $class]) 1
} else {
foreach incl [config_include_list [split $incls ,]] {
if [info exists cpp_hdr_files($incl)] {
continue
}
lappend user_include_list $incl
set src_files($incl) 1
}
}
}
}
if [info exists cpp_src_incs_name] {
foreach entry [array names cpp_src_incs_name] {
set file [h_class2file $entry $cpp_src_incs_name_ext($entry)]
if [info exists cpp_hdr_files($file)] {
continue
}
if [info exists src_files($file)] {
continue
}
lappend gen_include_list $entry
}
}
foreach entry [lsort $gen_include_list] {
if {[info exists cpp_src_incs_name_ext($entry)]} {
set ext $cpp_src_incs_name_ext($entry)
} else {
set ext "hxx"
}
# prefer user includes
set idx [lsearch -exact $user_include_list [h_class2file $entry $ext]]
if {$idx == -1} {
gen_include $entry $ada_sections(c_hdr_sect) $ext
}
}
catch {unset cpp_src_incs}
catch {unset cpp_src_incs_name}
catch {unset cpp_src_incs_name_ext}
catch {unset src_files}
}
# Template emulation management
# Sets to be instantiated
#
global cpp_sets
proc instantiate_set {class} {
if $has_templates {
return
}
global cpp_sets
set cpp_sets($class) 1
}
proc gen_sets {} {
global cpp_sets
if {![info exists cpp_sets]} {
return
}
set sect $ada_sections(h_incl_sect)
foreach class [lsort [array names cpp_sets]] {
gen_set_type_def $class $sect
}
unset cpp_sets
}
# Ordered Sets to be instantiated
#
global cpp_osets
proc instantiate_oset {class} {
if $has_templates {
return
}
global cpp_osets
set cpp_osets($class) 1
}
proc gen_osets {} {
global cpp_osets
if {![info exists cpp_osets]} {
return
}
set sect $ada_sections(h_incl_sect)
foreach class [lsort [array names cpp_osets]] {
gen_oset_type_def $class $sect
}
unset cpp_osets
}
# Dicts to be instantiated
#
global cpp_dicts
proc instantiate_dict {key value} {
if $has_templates {
return
}
global cpp_dicts
set cpp_dicts($key,$value) 1
}
proc gen_dicts {} {
global cpp_dicts
if {![info exists cpp_dicts]} {
return
}
set sect $ada_sections(h_incl_sect)
foreach keyval [lsort [array names cpp_dicts]] {
set kv_list [split $keyval ,]
gen_dict_type_def [lindex $kv_list 0] [lindex $kv_list 1] $sect
}
unset cpp_dicts
}
# Set Dicts to be instantiated
#
global cpp_set_dicts
proc instantiate_set_dict {key value} {
if $has_templates {
return
}
global cpp_set_dicts
set cpp_set_dicts($key,$value) 1
}
proc gen_set_dicts {} {
global cpp_set_dicts
if {![info exists cpp_set_dicts]} {
return
}
set sect $ada_sections(h_incl_sect)
foreach keyval [lsort [array names cpp_set_dicts]] {
set kv_list [split $keyval ,]
gen_set_dict_type_def [lindex $kv_list 0] \
[lindex $kv_list 1] $sect
}
unset cpp_set_dicts
}
# Ordered Set Dicts to be instantiated
#
global cpp_oset_dicts
proc instantiate_oset_dict {key value} {
if $has_templates {
return
}
global cpp_oset_dicts
set cpp_oset_dicts($key,$value) 1
}
proc gen_oset_dicts {} {
global cpp_oset_dicts
if {![info exists cpp_oset_dicts]} {
return
}
set sect $ada_sections(h_incl_sect)
foreach keyval [lsort [array names cpp_oset_dicts]] {
set kv_list [split $keyval ,]
gen_oset_dict_type_def [lindex $kv_list 0] \
[lindex $kv_list 1] $sect
}
unset cpp_oset_dicts
}
# FuncMaps to be instantiated
#
global cpp_funcmaps
proc instantiate_funcmap {func} {
if $has_templates {
return
}
global cpp_funcmaps
set cpp_funcmaps($func) 1
}
proc gen_funcmaps {} {
global cpp_funcmaps
if {![info exists cpp_funcmaps]} {
return
}
set sect $ada_sections(h_incl_sect)
foreach func [lsort [array names cpp_funcmaps]] {
gen_funcmap_type_def $func $sect
}
unset cpp_funcmaps
}
#
# Return whether the given class is abstact, i.e. has any abstract operations.
#
proc is_abstract_class {class} {
foreach f [get_features $class] {
if {[get_obj_type $f] == "operation" && [is_abstract $f] == "1"} {
return 1
}
}
return 0
}