home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 1998 October
/
PCWorld_1998-10_cd.bin
/
software
/
prehled
/
komix
/
DATA.Z
/
ot2varto.tcl
< prev
next >
Wrap
Text File
|
1997-09-19
|
12KB
|
437 lines
# Copyright (c) 1997 by Cayenne Software 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 Cayenne Software Inc
#
#---------------------------------------------------------------------------
#
# File : @(#)ot2varto.tcl /main/titanic/7 17 Jun 1997
# Author : H. Broeze
# Original date : 17 June 19977
# Description : ObjectTeam to VAR functions
#
#---------------------------------------------------------------------------
#
global idCount
# datastructure
# object.header contains the first header part
# object.id contains id
# entity.attributes contains the attributes which are also objects
# partnership.sets contains the partnership_set
#initialize
global ent_attr_sect
global ent_key_sect
global attr_ent_key_sect
global domain_sect
global part_sect
global partset_sect
global comb_sect
global combset_sect
global attribute_sect
global ent_diag_obj_sect
global part_diag_obj_sect
global partset_diag_obj_sect
global parb_diag_obj_sect
global comb_diag_obj_sect
global combset_diag_obj_sect
set ent_attr_sect ""
set ent_key_sect ""
set attr_ent_key_sect ""
set domain_sect ""
set data_mod_sect ""
set part_sect ""
set partset_sect ""
set comb_sect ""
set combset_sect ""
set attribute_sect ""
set ent_diag_obj_sect ""
set part_diag_obj_sect ""
set partset_diag_obj_sect ""
set comb_diag_obj_sect ""
set combset_diag_obj_sect ""
proc newVarObj {header } {
global idCount
incr idCount
global ${idCount}.header
set ${idCount}.header $idCount,"",1997-01-01-00.00.00.000000,"",1997-01-01-00.00.00.000000,${header}
set ${idCount}.id $idCount
return $idCount
}
proc newEnterpriseModel {name} {
return [newVarObj 0,"${name}",0,0]
}
proc newDataModel {name enterPId dp1 dp2} {
return [newVarObj 0,"${name}",0,0,0,0,"",0,${enterPId},0,0,0,0,0,0,$dp1,$dp2,0,0,0,0,0,0,0,0,0,0,0,0]
}
proc newEntity { table name anltext} {
set localDone ""
set super 0
global doneTables
foreach importLink [get_imports $table] {
if {[get_master_type $importLink] != "supertype"} {
continue
}
set masterTable [get_master $importLink]
if {[lsearch $doneTables $masterTable] != -1} {
global ${masterTable}.no
set super [set ${masterTable}.no]
continue
} else {
lappend doneTables $masterTable
set super [entityToVar $masterTable]
}
#when one found break
break
}
return [newVarObj 0,"${name}",0,9999999,0,0,"Y","C","N",$super,0,0,0,0,0,0,0,0,$anltext,0,0,0,0,0]
}
proc newAttribute { entNo name seqNo nullable comments source domain storable anlText} {
return [newVarObj 0,$entNo,0,"$name",$seqNo,"$nullable","$comments","$source","$storable",0,$domain,0,0,0,0,$anlText,0,0]
}
proc newEnt_Key { entNo name } {
return [newVarObj 0,$entNo,"$name",0,"Y",0,0,0,0]
}
global availableDomains
set availableDomains ""
proc newDomain { {stdType ""} } {
global domain_sect
global availableDomains
if {$stdType == "flag"} {
set type "C"
set stdType empty
} elseif [string match char* $stdType] {
set type "A"
} else {
set firstLetter [string index $stdType 0]
set type [string toupper $firstLetter]
}
if {[lsearch $availableDomains $stdType ] == -1} {
global $stdType
set $stdType [newVarObj 0,0,1,0,"$stdType",0,"$type","0.","0.",0,0,0,0,0,0,0,0,0,0,0]
lappend availableDomains $stdType
set domain_sect $domain_sect\n[set [set $stdType].header]
}
return [set $stdType]
}
proc newANLText { descr } {
return [newVarObj 0,0,"$descr"]
}
proc newPartnership { partSet1 partSet2 minVolSrc expVolSrc maxVolSrc minVolDest expVolDest maxVolDest} {
return [newVarObj 0,$partSet1,$partSet2,$minVolSrc,$expVolSrc,$maxVolSrc,$minVolDest,$expVolDest,$maxVolDest,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]
}
proc getMinVol {link relation} {
set relType [get_relation_type $relation]
if {$relType == "optional"} {
set minVol 0
} elseif {$relType == "total"} {
set minVol 1
} else {
set minVol 0
puts "Error: association type $relType not supported"
}
return $minVol
}
proc getMaxVol {link} {
if {[get_card $link] == "one"} {
return 1
} else {
return 9999999
}
}
proc newPartnershipSet { link relation entNo name lop anlText} {
# minvol = 0 => optional
# maxvol = 1 to create a 1:1 or M:1 for a partnership which originates
# at this partnership
set expVol 1
set minVol [getMinVol $link $relation]
set maxVol [getMaxVol $link]
return [newVarObj 0,$entNo,"$name",$minVol,$maxVol,$expVol,"$lop",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"S",$anlText]
}
proc newCombshipSet { link relation entNo} {
# minvol = 0 => optional
# maxvol = 1 to create a 1:1 or M:1 for a partnership which originates
# at this partnership
if {[get_link_type $link] == "subType"} {
set type "B"
} else {
set type "P"
}
return [newVarObj 0,"$type",0,0,$entNo]
}
proc newCombship { combSet1 combSet2} {
return [newVarObj 0,$combSet1,$combSet2,0,0,0,0,0,0,0,0,0,0,0]
}
proc newDiagProp { } {
return [newVarObj 0,0,0,1,1,1,1,0,0]
}
proc newDiagObjProp { } {
return [newVarObj 0,8421376,0,0,"Arial",48,400,0]
}
proc dumpToFile {fileName} {
#global enterprise_sect
global data_mod_sect
global combset_sect
set sect [section create]
expand_text $sect {
Cayenne Grndwrk V6.1 865590839 0 "ObjectTeam-Model" "" ""
**ENTERPRISE_MODEL**
~$enterprise_sect
**ENTERPRISE_MODELKE**
**ENTERPRISE_MODELSY**
**DATA_MODEL**
~$data_mod_sect
**DATA_MODELANLTEXT**
**DATA_MODELSYNONYM_**
**DATA_MODELER_NOTES**
**DATA_MODELATTRIBUT**
**DATA_MODELDIAGRAM_**
**SWS_CONTROL**
**ANLTEXT**~$anltext_sect
**SYNONYM_OBJECT**
**KEYWORD**
**ER_NOTES**
**ENTITY**~$entity_sect
**ENTITYSYNONYM_OBJE**
**ENTITYKEYWORD**
**ENTITYER_NOTES**
**ENTITYMAP_SYSTEM_M**
**ENTITYATTRIBUTE**~$ent_attr_sect
**ENTITYALLOWED_VAL_**
**ENTITYMAP_SYSTEM_2**
**ENTITYBUSINESS_SJ_**
**ENTITYSUBSET_DEF**
**ENTITYDIAGRAM_OBJE** ~$ent_diag_obj_sect
**ENT_KEY**~$ent_key_sect
**ENT_KEYSYNONYM_OBJ**
**ENT_KEYKEYWORD**
**ENT_KEYER_NOTES**
**ENT_KEYMAP_SYSTEM_**
**ATTR_JUNCTION**
**PARTNERSHIP_SET** ~$partset_sect
**PARTNERSHIP_SETENT**
**PARTNERSHIP_SETSYN**
**PARTNERSHIP_SETKEY**
**PARTNERSHIP_SETER_**
**PARTNERSHIP_SETFOR**
**PARTNERSHIP_SETMAP**
**PARTNERSHIP_SETSUB**
**PARTNERSHIP_SETDIA** ~$partset_diag_obj_sect
**COMB_PSET** ~$combset_sect
**COMB_PSETDIAGRAM_O** ~$combset_diag_obj_sect
**PARTNERSHIP** ~$part_sect
**PARTNERSHIPER_NOTE**
**PARTNERSHIPFOREIGN**
**PARTNERSHIPFOREIG2**
**PARTNERSHIPDIAGRAM** ~$part_diag_obj_sect
**COMB_PSHIP** ~$comb_sect
**COMB_PSHIPDIAGRAM_** ~$comb_diag_obj_sect
**DIMENSION**
**DIMENSIONSYNONYM_O**
**DIMENSIONER_NOTES**
**DIMENSIONKEYWORD**
**DIMENSIONSUBSET_DE**
**DOMAINS** ~$domain_sect
**DOMAINSSYNONYM_OBJ**
**DOMAINSKEYWORD**
**DOMAINSER_NOTES**
**DOMAINSSUBSET_DEF**
**ATTRIBUTE**~$attribute_sect
**ATTRIBUTEENT_KEY**~$attr_ent_key_sect
**ATTRIBUTESYNONYM_O**
**ATTRIBUTEKEYWORD**
**ATTRIBUTEER_NOTES**
**ATTRIBUTEATTRIBUTE**
**ATTRIBUTEALLOWED_V**
**ATTRIBUTEMAP_SYSTE**
**ATTRIBUTEBUSINESS_**
**ATTRIBUTESUBSET_DE**
**METHOD**
**METHODSUBSET_DEF**
**FOREIGN_KEY_ATTR**
**FOREIGN_KEY_ATTRSY**
**MAP_EXT_DESIGN**
**MAP_NAME_TABLE**
**MAP_SYSTEM_MAP**
**MAP_USER_MAP**
**BUSINESS_SJ_AREA**
**BUSINESS_SJ_AREAEX**
**SUBSET_DEF**
**DATA_MDL_SBS_RUL**
**PROC_MDL_SBS_RUL**
**BSA_SUBSET_RULE**
**STRUCTURE**
**STRUCTURESYNONYM_O**
**STRUCTUREKEYWORD**
**STRUCTUREINFO_FLOW**
**STRUCTUREPROCESS_M**
**STRUCT_ENT**
**STRUCT_ATTR**
**STRUCT_ATTRSTRUCT_**
**STRUCT_PSET**
**STRUCT_PSHP**
**ALLOWED_VAL_TBL**
**ALLOWED_VAL_TBLSYN**
**ALLOWED_VAL_TBLKEY**
**ALLOWED_VAL_TBLSUB**
**ALLOWABLE_VALUE**
**SYMBOLIC_CONSTANT**
**DA_FREE_TEXT_BLOCK**
**EXTENSION_OBJECT**
**ROUTE_OBJECT**
**ANLEXT_RTE_OBJ**
**ANLDGM_TEXT**
**ANLDGM_TEXTDIAGRAM**
**DIAGRAM_PROPERTIES** ~$diagProp_sect
**PROCESS_MODEL**
**PROCESS_MODELKEYWO**
**PROCESS_MODELANLTE**
**PROCESS_MODELSYNON**
**PROCESS_MODELSUBSE**
**PROCESS_MODELDIAGR**
**PROCESS_MODELDIAG2**
**PROCESS_MODELDIAG3**
**PROCESS**
**PROCESSANLTEXT**
**PROCESSKEYWORD**
**PROCESSSYNONYM_OBJ**
**PROCESSPERSON_EVEN**
**PROCESSCLOCK_EVENT**
**PROCESSSTORAGE_EVE**
**PROCESSFLOW_EVENT**
**PROCESSDIAGRAM_OBJ**
**PROCESSDIAGRAM_OB2**
**EXTERNAL_AGENT**
**EXTERNAL_AGENTKEYW**
**EXTERNAL_AGENTSYNO**
**EXTERNAL_AGENTDIAG**
**INFO_STORE**
**INFO_STORESYNONYM_**
**INFO_STOREKEYWORD**
**INFO_STOREDIAGRAM_**
**INFO_FLOW**
**INFO_FLOWKEYWORD**
**INFO_FLOWEXTERNAL_**
**INFO_FLOWINFO_STOR**
**INFO_FLOWPROCESS**
**INFO_FLOWSYNONYM_O**
**INFO_FLOWSEND_STAT**
**INFO_FLOWRECEIVE_S**
**INFO_FLOWINSERT_ST**
**INFO_FLOWSELECT_ST**
**INFO_FLOWUPDATE_ST**
**INFO_FLOWDELETE_ST**
**INFO_FLOWCONN_POIN**
**INFO_FLOWDIAGRAM_O**
**INFO_FLOWDIAGRAM_2**
**PWS**
**PWSPSD_EXPR**
**FD_COMMENT**
**STORAGE_EVENT**
**STORAGE_EVENTSYNON**
**STORAGE_EVENTKEYWO**
**FLOW_EVENT**
**FLOW_EVENTSYNONYM_**
**FLOW_EVENTKEYWORD**
**PERSON_EVENT**
**PERSON_EVENTSYNONY**
**PERSON_EVENTKEYWOR**
**CLOCK_EVENT**
**CLOCK_EVENTSYNONYM**
**CLOCK_EVENTKEYWORD**
**EXTERNAL_PROC**
**EXTERNAL_PROCSUBSE**
**PSD**
**PSD_TOPLEVEL**
**PSD_TOPLEVELPWS**
**DO_STATEMENT**
**SEND_STATEMENT**
**SEND_STATEMENTCONN**
**RECEIVE_STATEMENT**
**RECEIVE_STATEMENTC**
**SIGNAL_STATEMENT**
**INSERT_STATEMENT**
**INSERT_STATEMENTCO**
**DELETE_STATEMENT**
**DELETE_STATEMENTCO**
**UPDATE_STATEMENT**
**UPDATE_STATEMENTCO**
**SELECT_STATEMENT**
**SELECT_STATEMENTCO**
**ORDER_ATTRIBUTE**
**IF_STATEMENT**
**CASE_STATEMENT**
**CASE_EXPRESSION**
**SET_STATEMENT**
**SET_FIELD_PROP**
**FOREACH_STATEMENT**
**LOOP_STATEMENT**
**CONDITION_HANDLER**
**COMMENT_STATEMENT**
**RETURN_STATEMENT**
**COMMIT_STATEMENT**
**RESUME_STATEMENT**
**RETRY_STATEMENT**
**CONTINUE_STATEMENT**
**EXIT_STATEMENT**
**SKIP_STATEMENT**
**ABORT_STATEMENT**
**STRUCTURE_STMT**
**WITHIN_STATEMENT**
**PSD_EXPR**
**PSD_EXPRSTRUCT_ENT**
**PSD_EXPRSTRUCT_ATT**
**PSD_EXPRSTRUCT_PSE**
**PSD_EXPRSTRUCT_PSH**
**PSD_EXPRUSER_EXCEP**
**PSD_EXPRANLTEXT**
**PSD_EXPRSYMBOLIC_C**
**USER_EXCEPTION**
**CONN_POINT**
**NOTES**
**NOTESKEYWORD**
**FILTER**
**FILTEROBJECTS**
**FILTERKEYWORDS**
**DIAGRAM_OBJECT_PRO** ~$diagObjProp_sect
**DFD_TEXT_BLOCK**
**BCDFIELD**
**BCDFIELDDIAGRAM_OB**
**BCDTXTB**
**ROLLBACK_STATEMENT**
}
set fd [open $fileName w]
section write $sect $fd
close $fd
}