Welcome to Telelogic Product Support
  Home Downloads Knowledgebase Case Tracking Licensing Help Telelogic Passport
Telelogic DOORS (steve huntington)
Decrease font size
Increase font size
Topic Title: Modules Won't Close
Topic Summary:
Created On: 18-Jan-2007 16:13
Status: Post and Reply
Linear : Threading : Single : Branch
Search Topic Search Topic
Topic Tools Topic Tools
Quick Reply Quick Reply
Subscribe to this topic Subscribe to this topic
E-mail this topic to someone. E-mail this topic
Bookmark this topic Bookmark this topic
View similar topics View similar topics
View topic in raw text format. Print this topic.
 18-Jan-2007 16:13
User is offline View Users Profile Print this message


Lisa Carver

Posts: 61
Joined: 15-Jun-2005

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
Report this to a Moderator Report this to a Moderator
 19-Jan-2007 18:20
User is offline View Users Profile Print this message


Louie Landale

Posts: 2070
Joined: 12-Sep-2002

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.
Report this to a Moderator Report this to a Moderator
 20-Jan-2007 15:51
User is offline View Users Profile Print this message


Lisa Carver

Posts: 61
Joined: 15-Jun-2005

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.
Report this to a Moderator Report this to a Moderator
Statistics
20925 users are registered to the Telelogic DOORS forum.
There are currently 1 users logged in.
The most users ever online was 15 on 15-Jan-2009 at 16:36.
There are currently 0 guests browsing this forum, which makes a total of 1 users using this forum.
You have posted 0 messages to this forum. 0 overall.

FuseTalk Standard Edition v3.2 - © 1999-2009 FuseTalk Inc. All rights reserved.