home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 1997 November
/
PCWorld_1997-11_cd.bin
/
software
/
programy
/
komix
/
DATA.Z
/
legacy.tcl
< prev
next >
Wrap
Text File
|
1997-05-27
|
15KB
|
696 lines
#---------------------------------------------------------------------------
#
# Copyright (c) 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 : @(#)legacy.tcl /main/hindenburg/3
# Author : Discovery
# Original date : May 1995
# Description : Legacy stuff for 3.x compatibility
#
#---------------------------------------------------------------------------
#
# @(#)legacy.tcl /main/hindenburg/3 27 May 1997 Copyright 1995 Cadre Technologies Inc.
#
#---------------------------------------------------------------------------
require wmt_util.tcl
#
# Create TCL Callback routines for User Defined Properties
#
OTShRegister::propertyCallbacks
#
# Procedures to convert 3.x style routines to 4.0
#
proc add_attr {object propName propValue} {
return [$object addRunTimeProperty $propName $propValue]
}
proc add_class {ooplModel className {classType class}} {
return [$ooplModel addClass $className $classType]
}
proc add_operation {ooplModel class operName {returnType ""} {parList ""}} {
set operation [$class addOperation $operName $returnType]
foreach param $parList {
$operation addParameter [lindex $param 0] [lindex $param 1]
}
return $operation
}
proc add_super_class {ooplModel subClass superClass} {
return [$ooplModel addSuperClass $subClass $superClass]
}
proc dealloc_model {model} {
$model delete
}
proc get_action {receivedEvent} {
return [$receivedEvent getAction]
}
proc get_assoc {initializer} {
return [$initializer assoc]
}
proc get_attrib {object} {
return [$object attrib]
}
proc get_attributes {receivedEvent} {
return [$receivedEvent getAttributes]
}
proc get_card {link} {
return [$link getCard]
}
proc get_child_events {event} {
return [$event childEventSet]
}
proc get_class {initializer} {
return [$initializer ooplClass]
}
proc get_classes {ooplModel} {
return [$ooplModel ooplClassSet]
}
proc get_column {object} {
return [$object column]
}
proc get_column_type {column} {
return [$column getColumnType]
}
proc get_columns {table} {
return [$table columnSet]
}
proc get_conditions {receivedEvent} {
return [$receivedEvent getConditions]
}
proc get_constraint {object} {
return [$object getConstraint]
}
proc get_creation_params {ooplClass} {
return [$ooplClass creationParamSet]
}
proc get_del_type {link} {
return [$link getDelType]
}
proc get_detail {link} {
return [$link detail]
}
proc get_detail_type {link} {
return [$link getDetailType]
}
proc get_details {table} {
return [$table detailSet]
}
OTShRegister::reportWriter
proc get_diagram_classes {name {type ""}} {
if {$type == "" } {
set type [nt_get_type $name]
set name [nt_get_name $name]
}
set clientCont [ClientContext::global]
set systemV [$clientCont currentSystem]
if [$systemV isNil] {
return ""
}
set diag [$systemV findFileVersion $name $type]
if [$diag isNil] {
#
# Exceptional case: A.B.cdm ...
#
set diag [$systemV findFileVersion $name.$type cdm]
if [$diag isNil] {
puts "ERROR: diagram $name.$type not found"
return ""
}
return $name.$type
}
set items [query -u -s labels.itemRefs.item \
"type in {cad_class cad_container ccd_class ccd_class_ref ccd_container etd_object std_class}" \
$diag.components]
return [query -s name -n "type == cl" $items]
}
proc get_diagram_subjects {name {type ""}} {
if {$type == "" } {
set type [nt_get_type $name]
set name [nt_get_name $name]
}
set clientCont [ClientContext::global]
set systemV [$clientCont currentSystem]
if [$systemV isNil] {
return ""
}
set diag [$systemV findFileVersion $name $type]
if [$diag isNil] {
#
# Exceptional case: A.B.cdm ...
#
set diag [$systemV findFileVersion $name.$type cdm]
if [$diag isNil] {
puts "ERROR: diagram $name.$type not found"
return ""
}
return ""
}
set items [query -u -s labels.itemRefs.item \
"type in {subject}" \
$diag.components]
return [query -s name -n $items]
}
proc get_diagram_name {object} {
return [$object getDiagramName]
}
proc get_diagram_type {object} {
return [$object getDiagramType]
}
proc get_error {ooModel} {
return [$ooModel error]
}
proc get_event {receivedEvent} {
return [$receivedEvent event]
}
proc get_event_type {receivedEvent} {
return [$receivedEvent getEventType]
}
proc get_external {object} {
return [$object getExternal]
}
proc get_parent_event {event} {
return [$event parentEvent]
}
proc get_exports {table} {
return [$table exportSet]
}
proc get_features {ooplClass} {
return [$ooplClass featureSet]
}
proc get_foreign_name {column} {
return [$column getForeignName]
}
proc get_friend {link} {
return [$link friendLink]
}
proc get_ftext {object} {
return [$object getFreeText]
}
proc get_import {impColumn} {
return [$impColumn getImport]
}
proc get_import_type {link} {
return [$link getImportType]
}
proc get_imports {table} {
return [$table importSet]
}
proc get_initial_value {object} {
return [$object getPropertyValue initial_value]
}
proc get_initializers {constructor} {
return [$constructor initializerSet]
}
proc get_ins_type {link} {
return [$link getInsType]
}
proc get_item_id {object} {
return [$object getItemId]
}
proc get_key {object} {
return [$object key]
}
proc get_link {object} {
set objType [$object get_obj_type]
if {! [string match "db_*_attrib" $objType]} {
return ""
}
if {"$objType" == "db_data_attrib"} {
return ""
}
return [$object link]
}
proc get_link_type {link} {
return [$link getLinkType]
}
proc get_login_name {} {
return [M4Login::getUserName]
}
proc get_master {link} {
return [$link master]
}
proc get_master_type {link} {
return [$link getMasterType]
}
proc get_masters {table} {
return [$table masterSet]
}
proc get_multiplicity {attr} {
return [$attr getMultiplicity]
}
proc get_name {object} {
return [$object getName]
}
proc get_obj_type {object} {
return [$object get_obj_type]
}
proc get_oopl_model {ooModel} {
return [$ooModel ooplModel]
}
proc get_opposite {attr} {
return [$attr opposite]
}
proc get_opposite_link {object} {
return [$object oppositeLink]
}
proc get_parameters {object} {
if {[$object get_obj_type] == "constructor"} {
return ""
}
return [$object parameterSet]
}
proc get_phase_classes {} {
set clientCont [ClientContext::global]
set currentPhase [$clientCont currentPhase]
if [$currentPhase isNil] {
return ""
}
set classes ""
foreach systemV [$currentPhase systemVersions] {
set classes [concat $classes [get_system_classes [[$systemV system] name]]]
}
return $classes
}
proc get_qualifier {object} {
return [$object qualifier]
}
proc get_received_events {object} {
return [$object receivedEventSet]
}
proc get_relation {link} {
return [$link relation]
}
proc get_relation_type {relation} {
return [$relation getRelationType]
}
proc get_system {table} {
$table getSystem
}
proc get_src_objs {} {
return [CommandLineInterface::getSourceObjects]
}
proc get_sender_name {receivedEvent} {
return [$receivedEvent getSenderName]
}
proc get_storage {table} {
return [$table getStorage]
}
proc get_system_classes {{sysName ""}} {
set clientCont [ClientContext::global]
set currentPhase [$clientCont currentPhase]
if [$currentPhase isNil] {
return ""
}
set currentSystem [$clientCont currentSystem]
if {$sysName == "" } {
if [$currentSystem isNil] {
return ""
}
} else {
set currentSystem [$currentPhase findSystemVersion $sysName system]
}
query -s file.name "file.type == cdm" [$currentSystem localFileVersions]
}
proc chr2hex {charString} {
return [BinUtil::chr2Hex $charString]
}
proc constructNames { versionSet versionType} {
set fileNameSet ""
foreach version $versionSet {
set obj [$version $versionType]
lappend fileNameSet "[$obj name].[$obj type]"
}
return $fileNameSet
}
proc dec2hex {number} {
return [BinUtil::dec2Hex $number]
}
proc get_system_files {args} {
set currentSystem [[ClientContext::global] currentSystem]
if [$currentSystem isNil] {
return ""
}
if { $args != "" } {
set files [query "file.type == $args" \
[[[ClientContext::global] currentSystem] localFileVersions]]
} else {
set files [$currentSystem localFileVersions]
}
constructNames $files file
}
proc get_systems {} {
set currentPhase [[ClientContext::global] currentPhase]
if [$currentPhase isNil] {
return ""
}
set systems [$currentPhase systemVersions]
constructNames $systems system
}
proc get_sql_model {ooModel} {
return [$ooModel sqlModel]
}
proc get_sql_postfix {column} {
return [$column getSqlPostfix]
}
proc get_subjects {ooplModel} {
return [$ooplModel subjectSet]
}
proc get_sub_classes {object} {
if {[$object get_obj_type] == "inher_group"} {
return [$object subClassSet]
}
return [$object specNodeSet]
}
proc get_super_class {inhgroup} {
return [$inhgroup superClass]
}
proc get_super_classes {ooplClass} {
return [$ooplClass genNodeSet]
}
proc get_super_name {inhgroup} {
return [$inhgroup getSuperClassName]
}
proc get_super_type {inhgroup} {
return [$inhgroup getSuperClassType]
}
proc get_table {class} {
return [$class table]
}
proc get_tables {sqlModel} {
return [$sqlModel tableSet]
}
proc get_tgt_objs {} {
return [CommandLineInterface::getTargetObjects]
}
proc get_type {object} {
return [$object ooplType]
}
proc get_type_3gl {object} {
return [$object getType3GL]
}
proc get_type_4gl {object} {
return [$object getType4GL]
}
proc get_type_std {object} {
return [$object getTypeStd]
}
proc get_unique_name {object} {
return [$object getUniqueName]
}
proc get_upd_type {link} {
return [$link getUpdType]
}
proc get_user_name {} {
return [M4Login::getRealName]
}
proc get_workbench {} {
if [[[ClientContext::global] currentPhase] isNil] {
return ""
}
[[[ClientContext::global] currentPhase] phase] type
}
proc goto_system {sysName {phaseName ""}} {
return [fstorage::goto_system $sysName $phaseName]
}
proc has_attributes {receivedEvent} {
return [$receivedEvent hasAttributes]
}
proc has_tdb {} {
set cc [ClientContext::global]
set configV [$cc currentConfig]
if [$configV isNil] {
return 0
}
if {[$configV getPropertyValue tdbname] != ""} {
return 1
}
return 0
}
proc hexwrite {fileId hexString} {
return [BinUtil::hexWrite $fileId $hexString]
}
proc is_abstract {operation} {
return [$operation isAbstract]
}
proc is_aggregate {object} {
return [$object isAggregate]
}
proc is_class_feature {object} {
return [$object isClassFeature]
}
proc is_const_func {operation} {
return [$operation isConstFunc]
}
proc is_derived {object} {
return [$object isDerived]
}
proc is_dyn_bound {operation} {
return [$operation isDynBound]
}
proc is_external {object} {
return [$object isExternal]
}
proc is_mandatory {attrib} {
return [$attrib isMandatory]
}
proc is_nullable {column} {
return [$column isNullable]
}
proc is_ordered {attrib} {
return [$attrib isOrdered]
}
proc is_overlapping {inhgroup} {
return [$inhgroup isOverlapping]
}
proc is_synthetic {object} {
return [$object isSynthetic]
}
proc load_oo_model {args} {
return [OOModel::createModel]
}
proc m4_error_control {errorId} {
return [M4CheckManager::errorControl $errorId]
}
proc m4_error_count {{reset ""}} {
if {"$reset" == "reset"} {
return [M4CheckManager::resetErrorCount]
}
return [M4CheckManager::getErrorCount]
}
proc m4_fmt_message {string} {
puts stdout $string
}
proc m4_warning_count {{reset ""}} {
if {"$reset" == "reset"} {
return [M4CheckManager::resetWarningCount]
}
return [M4CheckManager::getWarningCount]
}
proc initSectionCmdMap {} {
global sectionCmdMap
set sectionCmdMap(append) {append}
set sectionCmdMap(append_section) {appendSect}
set sectionCmdMap(dealloc) {delete}
set sectionCmdMap(get_column_nr) {columnNr}
set sectionCmdMap(get_contents) {contents}
set sectionCmdMap(get_indent) {indent}
set sectionCmdMap(get_indent_string) {indentString}
set sectionCmdMap(get_line_nr) {lineNr}
set sectionCmdMap(get_tab_width) {tabWidth}
set sectionCmdMap(pop_indent) {popIndent}
set sectionCmdMap(push_indent) {pushIndent}
set sectionCmdMap(set_indent) {indent}
set sectionCmdMap(set_tab_width) {tabWidth}
set sectionCmdMap(write) {write}
}
proc section {subcmnd {sect ""} {args ""}} {
global sectionCmdMap
if ![info exists sectionCmdMap] {
initSectionCmdMap
}
if {$subcmnd == "create"} {
return [TextSection new]
} elseif {$subcmnd == "dealloc"} {
return ""
} elseif {$subcmnd == "append"} {
foreach arg $args {
$sect append $arg
}
return ""
}
if ![info exists sectionCmdMap($subcmnd)] {
return -code error "Invalid command: section $subcmnd $sect $args"
}
return [eval [concat $sect $sectionCmdMap($subcmnd) $args]]
}
proc strxfrm {string8bit} {
return [Map8Bit::map $string8bit]
}