home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 1998 October
/
PCWorld_1998-10_cd.bin
/
software
/
prehled
/
komix
/
DATA.Z
/
cpp_const.tcl
< prev
next >
Wrap
Text File
|
1996-06-05
|
9KB
|
368 lines
#---------------------------------------------------------------------------
#
# Copyright (c) 1994-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 : @(#)cpp_const.tcl 2.1
# Original date : Tue Apr 19 10:43:02 MET DST 1994
# Description : C++ generator constants
#
#---------------------------------------------------------------------------
#
# Name of type column in database
#
global TYPE_ID_NM
set TYPE_ID_NM class_type
#
# Regeneration magic strings
#
global START_INCLUDE_MESSAGE
set START_INCLUDE_MESSAGE "// Start user added include file section"
global END_INCLUDE_MESSAGE
set END_INCLUDE_MESSAGE "// End user added include file section"
global START_CTOR_MESSAGE
set START_CTOR_MESSAGE "// Start constructor user section"
global END_CTOR_MESSAGE
set END_CTOR_MESSAGE "// End constructor user section"
global START_DTOR_MESSAGE
set START_DTOR_MESSAGE "// Start destructor user section"
global END_DTOR_MESSAGE
set END_DTOR_MESSAGE "// End destructor user section"
# regeneration stops after this marker is found
#
global REGEN_END
set REGEN_END "// Do not delete this line -- regeneration end marker"
#
# 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$} [$class get_obj_type]] {
set name [string trimright [generate $class fwd Value]]
} else {
set name [$class getName]
}
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$} [$class get_obj_type]] {
set name [string trimright [generate $class fwd Value]]
} else {
set name [$class getName]
}
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
}
}