home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 1997 November
/
PCWorld_1997-11_cd.bin
/
software
/
programy
/
komix
/
DATA.Z
/
drsdxlcomm.tcl
< prev
next >
Wrap
Text File
|
1997-06-03
|
15KB
|
501 lines
#---------------------------------------------------------------------------
#
# (c) Cayenne Software Inc. 1997
#
# File: @(#)drsdxlcomm.tcl /main/hindenburg/23
# Author: <generated>
# Description:
#---------------------------------------------------------------------------
# SccsId = @(#)drsdxlcomm.tcl /main/hindenburg/23 3 Jun 1997 Copyright 1997 Cayenne Software Inc.
# Start user added include file section
# End user added include file section
#Class DrsDxlCommand : {GCObject} {
# constructor
# method destructor
# method execute
# method newCommand
# method command
# method doorsInitialize
# method doorsObjectTypeCreate
# method doorsObjectAttributeCreate
# method doorsProjConfigure
# method doorsModuleConfigure
# method doorsModuleEdit
# method doorsViewSave
# method doorsObjectFind
# method doorsObjectDelete
# method doorsObjectAttrSetValue
# method doorsObjectAttrAppendValue
# method doorsObjectCreateTopObject
# method doorsObjectCreateChild
# method doorsObjectAttrSave
# method doorsObjectCreateLink
# method doorsResultSave
# method doorsModuleSave
# method doorsFilterOn
# method doorsFilterOff
# method doorsObjectShow
# method doorsObjectHide
# attribute channel
# attribute firstOut
# attribute varCounter
# attribute mustBeDone
# attribute commandSection
# attribute oleObject
#}
constructor DrsDxlCommand {class this} {
set this [GCObject::constructor $class $this]
# Start constructor user section
if $win95 {
$this oleObject [OleAutoObject new "DOORS.Application"]
}
$this commandSection [TextSection new]
$this channel [args_file {} ]
$this firstOut 0
$this varCounter 1
$this mustBeDone 0
# End constructor user section
return $this
}
method DrsDxlCommand::destructor {this} {
# Start destructor user section
set commandSection [$this commandSection]
unlink [$this channel]
if $win95 {
[$this oleObject] delete
}
# End destructor user section
}
method DrsDxlCommand::execute {this {doorsModule ""}} {
catch OtkRegister::license
eval_encrypted .EJMDJMWGVhN2JeKzw.SFhSW18lRjNQW006V1pjU0tWVV9HYHJnWHtaVk1pNVZHSV4.UT1oZlZVUE5SNzI3QTVQOmdmYmRjSVZbXDxOU1NZL09RTk1IOzxXQGxqTklZTVc9R0FKVUhxY3tbUk83UjgyTlxDO1VQUkZgWylBQklPWUdfWz5YYjUqJTA5LEl9OSo2QzV3VGxPW0lgP0dPJj47Pl93Z15IVW5HVlRCJkBRRmU9QV9AVEJORE1AbGJnWUd1Y2M9UVRPTF5LYDdOWihBS0xRRlRQMUJcRmxfOnJeVFZaVV9wP0pPTVo8XmFPU01pPlNdRT5DTUAtZURITl0oUk8vVElN
if $win95 {
[$this oleObject] runFile $fileName
} else {
exec dxlsend "#include <$fileName>"
}
set returnFile [open [$this channel] r]
set returnValue [read $returnFile]
close $returnFile
unlink $fileName
$this mustBeDone 0
return $returnValue
}
method DrsDxlCommand::newCommand {this} {
set commandSection [$this commandSection]
if [llength $commandSection] {
$commandSection delete
}
$this commandSection [TextSection new]
}
method DrsDxlCommand::command {this} {
[$this commandSection] contents
}
method DrsDxlCommand::doorsInitialize {this {refresh "true"}} {
$this commandSection [TextSection new]
regsub -all {\\} [$this channel] "/" dxlChannel
expand_text [$this commandSection] {
Module currentModule
bool storedFiltering
Link ln
int linked = 0
Object startObject
Object lastObject
Object searchObject
Stream outStream
int returnValue = 0
string attrValue
string projectName = ""
Project curProj = current
pragma runLim, 10000000
if (!null curProj) {
projectName = name curProj
} else {
ack "No DOORS project opened"
halt
}
string otDrsProjName = "~[m4_var get M4_doors_project]"
if (projectName != otDrsProjName) {
if ("~$refresh" == "true") {
ack "New project selected, first Refresh Project"
halt
}
}
int searchNo
int found
outStream = write "~${dxlChannel}"
Object findObject (int searchNo) {
Object searchObject
startObject = current
searchObject = startObject
int returnValue
found = 0
while (found == 0 && !(null searchObject)) {
returnValue = searchObject."Absolute Number"
if (returnValue == searchNo) {
found = 1
}
else
searchObject = parent searchObject
}
if (found == 0) {
startObject = currentModule first
searchObject = startObject
returnValue = searchObject."Absolute Number"
if (returnValue == searchNo) {
found = 1
}
else
searchObject = next searchObject
}
while (found==0 && searchObject!=startObject && !(null searchObject)) {
returnValue = searchObject."Absolute Number"
if (returnValue == searchNo) {
found = 1
} else
searchObject = next searchObject
}
return searchObject
}
}
}
method DrsDxlCommand::doorsObjectTypeCreate {this attrName type} {
$this mustBeDone 1
expand_text [$this commandSection] {
create object type "~$type" attribute "~$attrName"
}
}
method DrsDxlCommand::doorsObjectAttributeCreate {this attrSection attrNames modName} {
foreach attribute $attrNames {
expand_text $attrSection {
if (!exists attribute "~$attribute") {
create object attribute "~$attribute" type "text"
ack "In formal module ~$modName the ~$attribute attribute is created"
}
}
}
}
method DrsDxlCommand::doorsProjConfigure {this userAttributes} {
$this mustBeDone 1
set functionBody [TextSection new]
set formModName [m4_var get M4_doors_formal_module]
$this doorsModuleConfigure $functionBody $formModName "formalModule" \
"ObjectTeam reference"
set attrs "SelectedItems ParentOTVersions OTType OTEditorTypes \
OTViews $userAttributes"
$this doorsObjectAttributeCreate $functionBody $attrs $formModName
expand_text $functionBody {
save newMod
}
#set linkMod [m4_var get M4_doors_link_module]
set linkMod [m4_var get M4_doors_trace_link_module]
$this doorsModuleConfigure $functionBody $linkMod "linkModule" \
"ObjectTeam Interphase links" $formModName $formModName
set linkMod [m4_var get M4_doors_connections_link_module]
$this doorsModuleConfigure $functionBody $linkMod "linkModule" \
"ObjectTeam object connections" $formModName $formModName \
"manyToMany"
expand_text [$this commandSection] {
void createModules () {
~[$functionBody contents]
}
}
expand_text [$this commandSection] {
Project curProj = current
if (null curProj) {
ack "No DOORS project opend"
halt
} else {
createModules
}
}
}
method DrsDxlCommand::doorsModuleConfigure {this modSection modName modType comment {fromModule ""} {toModule ""} {linkRelation "manyToOne"}} {
if {$modType == "formalModule" } {
expand_text $modSection {
Module newMod = current
if (exists module "~$modName") {
ack "Formal module ~$modName not created. It already exists"
newMod = edit "~$modName"
current = newMod
} else {
newMod = create ("~$modName" , "~$comment", "OT", 1)
current = newMod
ack "Formal module ~$modName created."
}
}
} else {
expand_text $modSection {
if (exists module "~$modName") {
ack "Link module ~$modName not created. It already exists"
} else {
Module linkMod = create("~$modName", "~$comment", ~$linkRelation)
ack "Link module ~$modName created."
current = linkMod
Linkset ls = create (linkMod, "~$fromModule", "~$toModule")
ack "Linkset from ~$fromModule to ~$toModule in link module ~$modName created."
save linkMod
load ls
}
}
}
}
method DrsDxlCommand::doorsModuleEdit {this moduleName editType displayed} {
expand_text [$this commandSection] {
currentModule = ~$editType ("~$moduleName", ~$displayed)
storedFiltering = filtering currentModule
}
expand_text [$this commandSection] {
level 0
}
$this doorsFilterOff
return currentModule
}
method DrsDxlCommand::doorsViewSave {this viewName} {
[.main messageArea] message "Save DOORS view $viewName"
set moduleName [m4_var get M4_doors_formal_module]
$this mustBeDone 1
set m4_shared [m4_var get M4_doors_edit_shared]
if ![llength $m4_shared] {
m4_var set M4_doors_edit_shared "false"
}
if {$m4_shared == "true"} {
set editType "share"
} else {
set editType "edit"
}
set m4_disp [m4_var get M4_doors_edit_displayed]
if ![llength $m4_disp] {
m4_var set M4_doors_edit_displayed "true"
}
if {$m4_disp == "true"} {
set displayed "true"
}
$this doorsInitialize
expand_text [$this commandSection] {
currentModule = ~$editType ("~$moduleName", ~$displayed)
storedFiltering = filtering currentModule
Object viewObject
viewObject = currentModule first
while (!null viewObject) {
viewObject."OTViews"= viewObject."OTViews" " " "OTView_~$viewName"
viewObject = next viewObject
}
Filter f1 = contents ("OTView_~$viewName", true)
set f1
save view "~$viewName"
}
$this doorsModuleSave "currentModule"
}
method DrsDxlCommand::doorsObjectSetCurrent {this doorsObject} {
expand_text [$this commandSection] {
current = ~$doorsObject
}
}
method DrsDxlCommand::doorsObjectFind {this no} {
set varName "searchObject[$this varCounter]"
$this varCounter [expr [$this varCounter] + 1]
expand_text [$this commandSection] {
Object ~$varName
~$varName = findObject ~$no
}
return $varName
}
method DrsDxlCommand::doorsObjectDelete {this doorsObject} {
$this mustBeDone 1
expand_text [$this commandSection] {
~$doorsObject delete
flushDeletions
}
}
method DrsDxlCommand::doorsObjectAttrSetValue {this obj attrName attrValue} {
$this mustBeDone 1
regsub -all {\\} $attrValue "" newValue
regsub -all {\"} $newValue "\\\"" newValue
expand_text [$this commandSection] {
if (exists attribute "~$attrName")
~$obj."~$attrName"= "~$newValue"
}
return $obj
}
method DrsDxlCommand::doorsObjectAttrAppendValue {this attrName toAppValue} {
$this mustBeDone 1
expand_text [$this commandSection] {
attrValue = ~$obj."~$attrName"
~$obj."~$attrName"= attrValue "~$toAppValue"
}
return $obj
}
method DrsDxlCommand::doorsObjectCreateTopObject {this objectName} {
$this mustBeDone 1
set newObject newObject$objectName
expand_text [$this commandSection] {
lastObject = currentModule first
Object ~$newObject
if (null lastObject) {
~$newObject = create currentModule
} else {
lastObject = last sibling (currentModule first)
~$newObject = create lastObject
}
}
$this doorsObjectShow $newObject
return [$this doorsObjectAttrSetValue $newObject "Object Heading" $objectName]
}
method DrsDxlCommand::doorsObjectCreateChild {this doorsObject objectName {filteredName ""}} {
if ![llength $filteredName] {
set filteredName $objectName
}
$this mustBeDone 1
set newObject newObject$filteredName
expand_text [$this commandSection] {
Object ~$newObject
~$newObject = create last below ~$doorsObject
}
$this doorsObjectShow $newObject
set sectionDict [Dictionary new]
$sectionDict contents [m4_var get M4_doors_section_mapping]
set specialName [$sectionDict set $objectName]
if [llength $specialName] {
set objectName $specialName
}
return [$this doorsObjectAttrSetValue $newObject "Object Heading" $objectName]
}
method DrsDxlCommand::doorsObjectAttrSave {this toSaveObject toSaveAttr} {
expand_text [$this commandSection] {
attrValue = ~$toSaveObject."~$toSaveAttr"
}
$this doorsResultSave attrValue
}
method DrsDxlCommand::doorsObjectDeleteLinks {this doorsObject linkMod} {
$this mustBeDone 1
expand_text [$this commandSection] {
for ln in ~$doorsObject<-"~$linkMod" do {
delete ln
}
for ln in ~$doorsObject->"~$linkMod" do {
delete ln
}
flushDeletions
}
}
method DrsDxlCommand::doorsObjectCreateLink {this destObject srcObject linkMod} {
$this mustBeDone 1
expand_text [$this commandSection] {
~$destObject <- "~$linkMod" <- ~$srcObject
}
return $srcObject
}
method DrsDxlCommand::doorsResultSave {this doorsResult} {
if ![$this firstOut] {
expand_text [$this commandSection] {
outStream << ~$doorsResult ""
}
} else {
expand_text [$this commandSection] {
outStream << " " ~$doorsResult ""
}
}
$this firstOut 1
return $doorsResult
}
method DrsDxlCommand::doorsModuleSave {this toSaveModule} {
expand_text [$this commandSection] {
if (storedFiltering == true) {
filtering on
}
save ~$toSaveModule
}
return $toSaveModule
}
method DrsDxlCommand::doorsFilterOn {this} {
expand_text [$this commandSection] {
filtering on
}
}
method DrsDxlCommand::doorsFilterOff {this} {
expand_text [$this commandSection] {
if (storedFiltering == true) {
filtering off
}
}
}
method DrsDxlCommand::doorsObjectShow {this doorsObject {minorOperation ""}} {
$this mustBeDone 1
if {$minorOperation == "All" } {
expand_text [$this commandSection] {
searchObject = currentModule first
while (!null searchObject) {
accept searchObject
searchObject = searchObject next
}
}
return ""
}
expand_text [$this commandSection] {
if (!null ~$doorsObject)
accept ~$doorsObject
}
return $doorsObject
}
method DrsDxlCommand::doorsObjectHide {this doorsObject {minorOperation ""}} {
$this mustBeDone 1
if {$minorOperation == "All" } {
expand_text [$this commandSection] {
searchObject = currentModule first
while (!null searchObject) {
reject searchObject
searchObject = searchObject next
}
}
return ""
}
expand_text [$this commandSection] {
reject ~$doorsObject
}
return $doorsObject
}
# Do not delete this line -- regeneration end marker