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: Using links to get module names
Topic Summary:
Created On: 14-Feb-2003 20:56
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.
 14-Feb-2003 20:56
User is offline View Users Profile Print this message


Mary Miller

Posts: 36
Joined: 12-Sep-2002

Hello,

I am attempting to cycle through all of the links in a DOORS module. I want to know the full path and name of the module that links up to the target module. However, I can't seem to get DOORS to print it out to the screen.

Does someone know how to do this?

Thanks,

Mary
Report this to a Moderator Report this to a Moderator
 14-Feb-2003 21:25
User is offline View Users Profile Print this message


Michael Sutherland

Posts: 248
Joined: 13-Sep-2002

Mary,

Use the "fullname" command on the target module reference.

The Analysis Wizard generates the following code, which doesn't print out the fullName if the source and target modules are in the same folder, so if you are using code generated from the analysis wizard, that is likely the part that needs to be changed.

if (getParentFolder(otherMod) == getParentFolder(current Module)) {
s = name(otherMod)
} else {
s = fullName(otherMod)
}

-------------------------
Michael Sutherland
michael@galactic-solutions.com
http://galactic-solutions.com
Report this to a Moderator Report this to a Moderator
 21-Feb-2003 16:22
User is offline View Users Profile Print this message


Jeremy Eble

Posts: 30
Joined: 20-Sep-2002

Since I didn't understand Michael's code completely, I'm including the way I do the same thing that he suggested: using fullName on the link reference module. Since I am usually interested in objects more than modules, I loop through all of the objects in the module, and all of the links in the object.

-------------------------
Jeremy Eble
Software Engineer
Teragon Consulting LLC
jeremy.r.eble@lmco.com
Report this to a Moderator Report this to a Moderator
 21-Feb-2003 17:32
User is offline View Users Profile Print this message


Mark Phillips

Posts: 40
Joined: 17-Dec-2002

Jermy,

Just remember that this will only pull the src names from open modules. You will have to preload the modules with at least read access prior to this working. Use something like the code below.

Michael's code simply checks if the two modules are in the same folder in the database. If they are, he does not output the folder name.

Hope this helps,

Mark

-------------------------
Mark Phillips
mark.phillips@swri.org
Report this to a Moderator Report this to a Moderator
 3-Apr-2003 22:34
User is offline View Users Profile Print this message


Nandan Banodkar

Posts: 22
Joined: 1-Oct-2002

Hi,
I am facing a very unusual probelm here. I am trying to print all inlinked module names (recursively), for a specific current object.

The first time it runs correctly and prints out names of all inlinked modules. However, the next time onwards I run it, one particular inlinked module, say called XXX (at level 2) is always missed out. This missed module is in the same project but in a different folder; however some other modules under similar circumstances did get printed correctly.

Also, I noticed that if I manually close that particular module XXX from the "DOORS > Tools > Manage Open Module" menu after the first run, and then rerun the script, the module XXX gets correctly printed.


/*********************************************************************/
void display_linked(Object o)
{
ModName_ mSrcRef

//preload inlinked modules
for mSrcRef in o<-"*" do {
print name mSrcRef "\n"
read(fullName(mSrcRef), false) //open linked module ReadOnly
}

// repeat for objects
Object oSrc
Link l
for l in o<-"*" do {
oSrc = source l
display_linked( oSrc)
}

}

display_linked current
/*********************************************************************/

Also after one run, when I manually open the linked module at recursion level 1, and see how many inlinks it has, it gives also skips out module XXX, which should actually be present.

I don't have a clue why this is happening, and the [for mSrcRef in o<-"*" do] loop is failing to identify one particular module XXX for me , I have to close it from DOORS menu, and then it shows up correctly.

Any help will be appreciated

Thanks

-------------------------

Nandan Banodkar

(nandanbanodkar@hotmail.com)
Report this to a Moderator Report this to a Moderator
 3-Apr-2003 23:17
User is offline View Users Profile Print this message


Nandan Banodkar

Posts: 22
Joined: 1-Oct-2002

Actually after trying a few things I realized that the line: [ for l in o<-"*" do ] is causing the problem.



void display_links(Object o)
{
ModName_ mSrcRef = null
Link l = null

//preload all inlinked modules and insert name in skiplist
for mSrcRef in o<-"*" do
{
print name mSrcRef "\n"
read(fullName(mSrcRef), false) //open the other module ReadOnly without Display
}

Object oSrc = null
/****
for l in o<-"*" do
{}
****/

// when this is commented, it works each time i run the script, as soon as i uncomment this "for"
// the required module name is not being printed.

}

display_links current


-------------------------

Nandan Banodkar

(nandanbanodkar@hotmail.com)
Report this to a Moderator Report this to a Moderator
 3-Apr-2003 23:41
User is offline View Users Profile Print this message


Mark Phillips

Posts: 40
Joined: 17-Dec-2002

Nandan,

Just a guess, but is this module more than 1 layer deep. It could be that the for l in o<-"*" do { is getting confused by changing the defination of l and o when you go to the next layer of depth.

My initial thoughts are below, but after several minutes of thinking about it...this is not an easy problem (especially to let it be dynamic). If you specified a maximum depth (n), then you could just put several sub-loops inside the main loop, and it would work (but be very ugly!). Other than that, I don't see a cool solution (but then, I started programming in non-OO languages, and am still trying to change the mindset to be more dynamic).

Good luck, and keep us posted if you get it to work,

Mark

------------------------------------

Mark's initial thoughts are listed below, even though they will probably not be usefull at all...

I might consider defineing an array to hold the information for the various levels, and splitting the preopen section into its own function, so the loop would look something like:

Array linkArray = create(1,1)

void preOpen(Object o) {
...
}

void display_links(Object o) {

Link l
Object objSrc
preOpen(o)
for l in o <- "*" do {
objSrc = source(l)
preOpen(objSrc)

I gave up at this point


-------------------------
Mark Phillips
mark.phillips@swri.org
Report this to a Moderator Report this to a Moderator
 4-Apr-2003 00:02
User is offline View Users Profile Print this message


Nandan Banodkar

Posts: 22
Joined: 1-Oct-2002

Thanks Mark for your tips.

However, after spending a lot of time on this one I realised that the problem was not with the code, but with ghost/dangling links. I am sorry that I failed to notice this earlier. What happened in that particular case was that I had 2 modules X and Y with a link from Y to X [X <-- Y].

I was working from the higher level document X, and I saw that there was an incoming link from Y. However on close inspection of Y, I realise that there is no link going from Y to the particular object in X.
i.e. it is a ghost link or dangling link ....

So the: for mSrcRef in o<-"*" do { loop from the higher level document X, works fine and identifies that there is a module Y, from which there should be an incoming link, and prints "Y" for me.

However, as soon as I open "Y" [any mode, any visibility], I believe, the loop: for l in o<-"*" do { will fail, as there is no such link "l".

I hope that explanation helps, as for me I will try to rid my modules of any ghost links before I continue.


Thanks again,



-------------------------

Nandan Banodkar

(nandanbanodkar@hotmail.com)
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.