![]() |
Telelogic DOORS (steve huntington) | ![]() |
new topic :
profile :
search :
help :
dashboard :
calendar :
home
|
||
Latest News:
|
|
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 |
![]() |
![]()
|
![]() |
|
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 |
|
![]() |
|
![]() |
|
Louie,
Please post the code you are referring to. |
|
![]() |
|
![]() |
|
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 |
|
![]() |
|
![]() |
|
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. |
|
![]() |
|
![]() |
|
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 |
|
![]() |
|
![]() |
|
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) } } |
|
![]() |
|
![]() |
|
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 |
|
![]() |
Telelogic DOORS
» DXL Exchange
»
Louie's Tidbit #9: Duplicate Nested Loops
|
![]() |
FuseTalk Standard Edition v3.2 - © 1999-2009 FuseTalk Inc. All rights reserved.