home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 1997 November
/
PCWorld_1997-11_cd.bin
/
software
/
programy
/
komix
/
DATA.Z
/
ada95_const.tcl
< prev
next >
Wrap
Text File
|
1997-03-24
|
10KB
|
386 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.
##
###########################################################################
# Name of type column in database
#
global TYPE_ID_NM
set TYPE_ID_NM class_type
# Name of type table in database
#
global TYPE_TABLE_NM
set TYPE_TABLE_NM cpp_tt
#
# Regeneration constants and magic strings
#
global WS ;# whitespace regexp: {blank, tab}
set WS {[ ]}
global ID ;# identifier regexp
set ID {[A-Za-z0-9_\.]+}
global USERINITLINE
set USERINITLINE "^${WS}*--OT Ignore"
global USEREXITLINE
set USEREXITLINE "^${WS}*--OT Analyze"
global USERINITINFO
set USERINITINFO "--OT Ignore"
global USEREXITINFO
set USEREXITINFO "--OT Analyze"
global OBSOLETE
set OBSOLETE "--OT OBSOLETE:"
global OLDUSERINITLINE
set OLDUSERINITLINE "^${WS}*-- User+"
global OLDUSEREXITLINE
set OLDUSEREXITLINE "^${WS}*-- User-"
global OLDOBSOLETE
set OLDOBSOLETE "-- OBSOLETE:"
#HM Added magic strings
global ASSOCCMMT
set ASSOCCMMT "--OT Association components"
global ASSOCACCESSCMMT
set ASSOCACCESSCMMT "--OT Association accessor methods"
global ATTRACCESSCMMT
set ATTRACCESSCMMT "--OT Attribute accessor methods"
global USERMETHCMMT
set USERMETHCMMT "--OT User-defined methods"
global LINKPACKAGECMMT
set LINKPACKAGECMMT "--OT Package for association only"
global LINKCONVCMMT
set LINKCONVCMMT "--OT Link conversion functions"
#
# default for type modifiers
#
global default_type_modifier
set default_type_modifier "Reference"
global default_return_type_modifier
set default_return_type_modifier "Value"
#
# Configuration functions
#
# Return the file name for a class name
#
proc class2file {name} {
return $name
}
proc h_class2file {name {ext "hxx"}} {
return [class2file $name].$ext
}
# Generate an #include statement for 'class' in 'sect'
#
proc gen_include {class sect {ext "hxx"}} {
set protector [protector_name $class $ext]
expand_text $sect {
#ifndef ~$protector
#include "~[class2file $class].~$ext"
#endif
}
}
proc gen_include_filename {filename sect} {
expand_text $sect {
#include <~$filename>
}
}
# Return the protector name for 'class'
#
proc protector_name {class {ext "hxx"}} {
return "[string toupper [class2file $class]]_[string toupper $ext]"
}
# Configure a list of include files that was specified in the 'include_list'
# property of a class. This allows for customization of the 'include_list'
# property that was generated by 'Reverse Engineer C++', which by default
# stores the path as specified in the 'Reverse Engineer C++' dialog.
#
# This routine will be passed a TCL list of include files, and
# must return an optionally modified version of this list.
#
proc config_include_list {list} {
return $list
}
# The "pointer" name for 'class'
#
proc pointer_name {class} {
return "${class}Ptr"
}
# The "reference" name for 'class'
#
proc reference_name {class} {
return "${class}Ref"
}
# The set name for 'class'
#
proc set_name {class} {
return "${class}Set"
}
# The set type name for 'class'
#
proc set_type_name {class} {
add_hdr_inc_name ${set::name}
if [regexp {.*_type$} [get_obj_type $class]] {
set name [string trimright [generate $class fwd Value]]
} else {
set name [get_name $class]
}
if $has_templates {
return "${set::name}<$name>"
}
instantiate_set $name
return ${name}_${set::name}
}
# Generate the set type definition for 'class' in 'sect'
#
proc gen_set_type_def {class sect} {
if $has_templates {
# nothing to generate: templates are supported
return
}
# simulate an instantiation of a template
set protector [string toupper "${class}_${set::name}"]
expand_text $sect {
#ifndef ~$protector
#define ~$protector
class ~$class;
declare(~${set::name},~$class);
#endif
}
}
# The ordered set name for 'class'
#
proc oset_name {class} {
return "${class}OSet"
}
# The ordered set type name for 'class'
#
proc oset_type_name {class} {
add_hdr_inc_name ${oset::name}
if [regexp {.*_type$} [get_obj_type $class]] {
set name [string trimright [generate $class fwd Value]]
} else {
set name [get_name $class]
}
if $has_templates {
return "${oset::name}<$name>"
}
instantiate_oset $name
return ${name}_${oset::name}
}
# Generate the ordered set type definition for 'class' in 'sect'
#
proc gen_oset_type_def {class sect} {
if $has_templates {
# nothing to generate: templates are supported
return
}
# simulate an instantiation of a template
set protector [string toupper "${class}_${oset::name}"]
expand_text $sect {
#ifndef ~$protector
#define ~$protector
class ~$class;
declare(~${oset::name},~$class);
#endif
}
}
# The dict name for 'class'
#
proc dict_name {class} {
return "${class}Dict"
}
# The dict type name for 'key' and 'value'
#
proc dict_type_name {key_type value_type} {
add_hdr_inc_name ${dict::name}
# key : value semantics: include
# value : pointer semantics: forward
set key [string trimright [generate $key_type inc Value]]
set value [string trimright [generate $value_type fwd Value]]
if $has_templates {
return "${dict::name}<$key, $value>"
}
instantiate_dict $key $value
return ${key}${value}_${dict::name}
}
# Generate the dict type definition for 'class' in 'sect'
#
proc gen_dict_type_def {key value sect} {
if $has_templates {
# nothing to generate: templates are supported
return
}
# simulate an instantiation of a template
set protector [string toupper "${key}${value}_${dict::name}"]
expand_text $sect {
#ifndef ~$protector
#define ~$protector
class ~$value;
declare2(~${dict::name},~$key,~$value);
#endif
}
}
# The set dict name for 'class'
#
proc set_dict_name {class} {
return "${class}PSDict"
}
# The set dict type name for 'key' and 'value'
#
proc set_dict_type_name {key_type value_type} {
# key : value semantics: include
# value : pointer semantics: forward
set key [string trimright [generate $key_type inc Value]]
set value [string trimright [generate $value_type fwd Value]]
# the PSetDict instantiation requires the PtrSet
# to be instantiated
instantiate_set $value
add_hdr_inc_name ${psdict::name}
if $has_templates {
return "${psdict::name}<$key, $value>"
}
instantiate_set_dict $key $value
return ${key}${value}_${psdict::name}
}
# Generate the set dict type definition for 'class' in 'sect'
#
proc gen_set_dict_type_def {key value sect} {
if $has_templates {
# nothing to generate: templates are supported
return
}
# simulate an instantiation of a template
set protector [string toupper "${key}${value}_${psdict::name}"]
expand_text $sect {
#ifndef ~$protector
#define ~$protector
class ~$value;
declare2(~${psdict::name},~$key,~$value);
#endif
}
}
# The ordered set dict name for 'class'
#
proc oset_dict_name {class} {
return "${class}OPSDict"
}
# The ordered set dict type name for 'key' and 'value'
#
proc oset_dict_type_name {key_type value_type} {
# key : value semantics: include
# value : pointer semantics: forward
set key [string trimright [generate $key_type inc Value]]
set value [string trimright [generate $value_type fwd Value]]
# the OPSetDict instantiation requires the OPtrSet
# to be instantiated
instantiate_oset $value
add_hdr_inc_name ${opsdict::name}
if $has_templates {
return "${opsdict::name}<$key, $value>"
}
instantiate_oset_dict $key $value
return ${key}${value}_${opsdict::name}
}
#Generate the ordered set dict type definition for 'class' in 'sect'
#
proc gen_oset_dict_type_def {key value sect} {
if $has_templates {
# nothing to generate: templates are supported
return
}
# simulate an instantiation of a template
set protector [string toupper "${key}${value}_${opsdict::name}"]
expand_text $sect {
#ifndef ~$protector
#define ~$protector
class ~$value;
declare2(~${opsdict::name},~$key,~$value);
#endif
}
}
# The funcmap name for 'func'
#
proc funcmap_name {func} {
return "${func}FM"
}
# The funcmap type name for 'func'
#
proc funcmap_type_name {func} {
add_hdr_inc_name NmFuncMap
if $has_templates {
return "NmFuncMap< $func >"
}
instantiate_funcmap $func
return ${func}_NmFuncMap
}
# Generate the funcmap type definition for 'func' in 'sect'
#
proc gen_funcmap_type_def {func sect} {
if $has_templates {
# nothing to generate: templates are supported
return
}
# simulate an instantiation of a template
set protector [string toupper "${func}_NmFuncMap"]
expand_text $sect {
#ifndef ~$protector
#define ~$protector
declare(NmFuncMap,~$func);
#endif
}
}