![]() |
Telelogic DOORS (steve huntington) | ![]() |
new topic :
profile :
search :
help :
dashboard :
calendar :
home
|
||
Latest News:
|
|
Topic Title: Modules Won't Close Topic Summary: Created On: 18-Jan-2007 16:13 Status: Post and Reply |
Linear : Threading : Single : Branch |
![]() |
![]()
|
![]() |
|
Hi there, I have a very strange problem, and I hope you can help!
Please see the attached code - I am looping through a project, then its modules, then its objects, then the incoming links for the objects and counting them based on the value of an attribute of the links source object. The problem is, usually with my scripts like this, I close each module (as shown by using 'close m'), if I put this in the code and run it, my link count 'DIL' is 0 for all modules. But if I don't close the modules I get the correct values in the output. I don't get this because by the time I close the module, the value should already have been written to the output file. Can anyone shed any light on this for me please? Many thanks indeed |
|
![]() |
|
![]() |
|
The problem is in your 'for lr in o <-..' line. You will not see any links let alone see any of the linked objects unless the module that sources the link is open. See operation 'for all incoming link' in section 'Finding Links' in chapter 'Links' in the DXL manual. The attached LoadInLinks should be ROUTINE before all of your in-link loops. There is a different LoadOutLinks() that loads the modules that are targets of the links; that one use "for Link in obj ->..." do, gets the ModName_ mn = target(lnk), and then opens it (notice its loop is for Links, wherase the InLinks function loops looking for ModName_)
I'm pretty sure your code worked when you didn't close the modules is because the module that sources the links was opened by your code before the modules that target the links and and used for the counting. Thus, your 'for lr in o' loop found all those source modules because they were opened earlier. Most of my DXL that loops through lots of modules usually does this (taking advantage of fIsOpen which is attached): only close the module if you actually opened it. Module mod bool IsOpen for modules I care about { NameFull = fullname of the module mod = fIsOpen(NameFull, false) if (!null mod) { IsOpen = true } else { IsOpen = false mod = read(NameFull, false) } deal with mod if (!IsOpen) close(mod) } // end for modules Advanced thoughts: Your script will end up leaving a bunch of modules open, actually all those that source links which should be a lot. One of my programs has some psuedo-clever logic that when the folder that houses my looping for modules changes, then I browse all the open modules in the project and close them (for mod in proj do ...). This keeps the number of concurrent modules open to a minimum but also doesn't always close all linked modules every time. You could, also, just count the number of open modules and when it reaches some calibratable number (perhaps 25), then close them all. |
|
![]() |
|
![]() |
|
Thank you so much for your detailed response. What you say makes sense about the source module being opened already by the open modules routine.
I will have a go at modify my code to take into account your suggestions. Thank you again. |
|
![]() |
Telelogic DOORS
» DXL Exchange
»
Modules Won't Close
|
![]() |
FuseTalk Standard Edition v3.2 - © 1999-2009 FuseTalk Inc. All rights reserved.