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: Louie's Tidbit #9: Duplicate Nested Loops
Topic Summary:
Created On: 10-Feb-2004 16:27
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.
 10-Feb-2004 16:27
User is offline View Users Profile Print this message


Louie Landale

Posts: 2070
Joined: 12-Sep-2002

I have a function that loops through the baselines of a module:
for bl in mod do.
Inside that loop I call a library function that likewise loops through the module's baselines. It turns out that the inner loop screws up the outer loop such that you get an "unexpected" error when you execute the top of the outer loop for the 2nd time.

Perhaps someone with more "C" experience can chime in here, but I conclude that for DOORS related constructs (those types that start with capital letter such as Baseline, Module, Skip, Link, Object etc), you cannot have identical nested loops like this. I suspect it would be similar to having two nested "for (i=0; etc)" loops; the inner loop "i" messes up the outer.

That may be pretty important for those of us with massive libary files where the workings of a function are often obscured by various levels of library calls.

- Louie
Report this to a Moderator Report this to a Moderator
 10-Feb-2004 19:26
User is offline View Users Profile Print this message


Douglas Zawacki

Posts: 97
Joined: 14-Aug-2003

Louie,

Please post the code you are referring to.
Report this to a Moderator Report this to a Moderator
 10-Feb-2004 21:26
User is offline View Users Profile Print this message


Louie Landale

Posts: 2070
Joined: 12-Sep-2002

Code looks like attached. Run it from a module with more than one baseline. Yes, it looks hokey but I fell into this because the functions are already in the Library and I started writing a new MAIN program.

- Louie
Report this to a Moderator Report this to a Moderator
 11-Feb-2004 12:18
User is offline View Users Profile Print this message


Roy Bond

Posts: 39
Joined: 25-Mar-2003

Louie,

I've had similar problems when messing with modules and permissions.

The only solution I could find was to move the module read outside of the loops, and replace it with a boolean variable which is set true when the if statement is satisfied (or use arrays if there is more than one item which satisfies the if statement).

Outside the loop, if the variable is true, then open the module.

I don't think its really to do with C, - it's more of a DOORS feature!

Roy.
Report this to a Moderator Report this to a Moderator
 11-Feb-2004 20:49
User is offline View Users Profile Print this message


Louie Landale

Posts: 2070
Joined: 12-Sep-2002

A side issue is when deleting links. You cannot delete the link from within a link loop. Rather, put the link in a Skip list and after the link loop, delete all the links in the Skip.

- Louie
Report this to a Moderator Report this to a Moderator
 12-Feb-2004 02:06
User is offline View Users Profile Print this message


Douglas Zawacki

Posts: 97
Joined: 14-Aug-2003

Louie,

I tried your code and see the problem occuring. And I"d have to say it certainly should be possible to do what you are trying to do. At first I thought it was because you were performing multiple operations with the same Module Handle...but even when I opened the module up with a new handle it bombed out.

I'd say chalk it up to another one of those lovely DOORS "features" !?!?

I'm sure you are aware that you could have written the OpenBaseline function using a baselineExists() instead of trying to loop through and match the strings. But because you had older code in a library you were lucky enough to stumble upon this bee's nest.

With regards to your side note:
Are you saying you cannot do this?
Object o
Module m = current
for o in m do
{
for l in o->"*" do
{
delete(l)
}
}
Report this to a Moderator Report this to a Moderator
 12-Feb-2004 21:51
User is offline View Users Profile Print this message


Louie Landale

Posts: 2070
Joined: 12-Sep-2002

Yes, the delete of the link inside the loop will often cause failure. Try creating 7 links and then delete every other one. I don't recall the intermittent error I got. Be advised this is confirmed in the manual.

- Louie
Report this to a Moderator Report this to a Moderator
Statistics
20925 users are registered to the Telelogic DOORS forum.
There are currently 0 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 0 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.