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: Baseline is broken in 7.0 DXL...
Topic Summary:
Created On: 25-Feb-2004 16:57
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.
Answer This question was answered by Jim Babcock, on Friday, February 27, 2004 2:32 PM

Answer:
Progress made!

Apparently what you see in the GUI is not necessarily whats seen by DXL. When Tony told me he ran my code and it worked, I approached debugging from a different angle. I wrote a test dxl that did nothing but count baselines... and guess what: the requirements module only had one baseline and it was 0.1. When I was working with this I had create 3 baselines in the GUI, but I guess I needed to exit or save the modules to have them be real.

This is why I was upset with Louie's red herrings! I knew either I was setting up my test case wrong or baseline functionality was broke. I only had two days to fix this (I'm done today at noon) and didn't have time to go on fishing expedition. If someone had said, "Hey, you need to save out your module before baseline updates are actually in the database", I might has finished up yesterday

I'm truly sorry if I hurt your feelings, Louie
 25-Feb-2004 16:57
User is offline View Users Profile Print this message


Jim Babcock

Posts: 6
Joined: 18-Feb-2004

Or it could be me...

I'm working on moving some customizations from 5.? to 7.0. I didn't write them originally, in fact I don't have a lot of DOORS experience, so please be patient with me . So far I've cleared 16 of 19 items and the only thing I've had to "fix" is to change a variable name... "ModuleVersion" is apparently now a reserved word.

The issue at hand is a larger function called from a verification module, prompts the user for a requirements module name and baseline then links them together. So far I've gotten as far as checking if the base line exists in the module. It does, but DXL doesn't see it that way. When I look though "file/baseline/view" I see 0.0 -, 1.0 and 2.0. When I execute the following code:



<<
i=0
for b in reqmod_current do
{
reqmodbaseline = (major b) "." (minor b) (suffix b) ""
ack "one"
ack requirementmodbaseline " : " reqmodbaseline
if (reqmodbaseline == requirementmodbaseline)
{
i=1
baseline_major = major b
//ack "selected baseline major = " baseline_major ""
baseline_minor = minor bPDCU Equipment Specification
//ack "selected baseline minor = " baseline_minor ""
baseline_suffix = suffix b
//ack "selected baseline siffix = " baseline_suffix ""
}
}

>>


it executes this loop zero times and fails the subsiquent if statement. If I short circuit the if statement and force:


<<
reqmod_specifiedbaseline = load (reqmod_current, baseline (1, 0, ""), true)
>>


It pukes and give me the following errors:


<<
-R-E- DXL: <Line:657> An unexpected error has occurred: baseline '1.0' does not exist

-R-F- DXL: <Line:657> internal error, please submit a bug report
>>



Any ideas?

Thanks,

JimB
Report this to a Moderator Report this to a Moderator
 25-Feb-2004 19:40
User is offline View Users Profile Print this message


Louie Landale

Posts: 2070
Joined: 12-Sep-2002

I don't get the reference to "PDCU Equipment Specification".

Anyway the only thing I can think of is that :

[1] "reqmod_current" does NOT in fact point to the open requirements module. Perhaps it actually points to the Verification module. Insert:
print "reqmod_current = " (fullName(reqmod_current)) "\n"

[2] If you prompt for a module name you no doubt get it back unqualified: just "PDCU Module" rather than with paths: "/MyProject/MyRequirements/PDCU Module". If there is also a "PDCU Module" in the "current folder" (probably the one with the Verification module), then you are opening the WRONG req module if you open it. Perhaps you want to "Tools Menu >> Find" modules in the project with that name.

[3] You are NOT declaring your variables and "b" isn't really of type "Baseline". Auto declare is a disaster for software development and I suggest you turn it off. Edit your ../Lib/dxl/startup.dxl file and insert "XFLAGS_ &=~AutoDeclare_" at the bottom. Then you'll get Interpreter errors if you use a variable without first declaring it, such as happens when you misspell it. Be advised, however, that many Telelogic scripts do NOT declare their variables, so you'll have to turn auto declare back on when you are done developing your code; otherwise some wizards, layouts, and scripts won't work: comment out the above statement with "// ".

- Louie
Report this to a Moderator Report this to a Moderator
 25-Feb-2004 20:22
User is offline View Users Profile Print this message


Jim Babcock

Posts: 6
Joined: 18-Feb-2004

The string "PDCU Equipment Specification" is a random/accidental cut and paste accident that happened just before I copied the snippet of code and hasn't been written out to the file (I'm editing with VIm).

[1] [2] Reqmod_current is defined by:


<< RmodShortName = requirementmodname
RmodFullName = RmodShortName //for DOORSv4

if (!DOORSv4) // If this isn't DOORS V4, get the full module pathname.
{
RmodFullName = eval_ " Item iref
string RmodFullName = null
for iref in current Project do
{
if (name iref \"\" == \"" RmodShortName "\" && type iref == \"Formal\")
{ RmodFullName = fullName iref return_ RmodFullName }
} "
}

reqmod_current = read (RmodFullName, false)
>>



And is pointing where I think it should. Regardless of which of the two modules its pointing at (I've checked for duplicates as well), they both have atleast TWO baselines and should run through the loop more than ZERO times. This is code that worked until the version change...


[3] The code snippet is actually part of a 1000+ line dxl and b is indeed declared:


<<
Baseline b
>>


I started my college career using Fortran and had some funky experiences with auto-declaring variables... I learned my lesson early on

Thanks for responding,

JimB
Report this to a Moderator Report this to a Moderator
 25-Feb-2004 21:29
User is offline View Users Profile Print this message


Louie Landale

Posts: 2070
Joined: 12-Sep-2002

You seem to be declaring 2 "RmodFullName" variables. The one in your example is declared from within an If clause, and so will be UNDEFINED at the end of the clause and you end up using the one that was declared earlier.

int i = 0
if (true)
{ int i = 3
}
print i "\n" // will print 0.

Forget it. Keep functions reasonably short; declare everything up front; don't declare within the code.

Did you know that the Red Baron's squadron leader, the first true combat aviator (I forgot his name), came up with the 8 principles of air combat, and these same 8 are still taught today? Likewise even if temptation to violate basic coding principles is extremely high in the new fangled languages, principles are still principles for a reason. Many of these new fangled language features are designed so nerds can write read-only "clever" code that cannot be debugged.

Yeah, I coded FORTRAN 2 on punch cards; then then came up with the "while" loop. Ever drop 1000 punch cards at 1pm before the code was due? Hurray for FORTRAN.

- Louie

Whats all this "eval_" and "return_" stuff?
Report this to a Moderator Report this to a Moderator
 26-Feb-2004 16:15
User is offline View Users Profile Print this message


Jim Babcock

Posts: 6
Joined: 18-Feb-2004

Louie:

I really don't need lectures on coding style and variable scope. I thought I made it clear that I was attempting to maintain code that worked until they upgraded DOORS. This is code that worked in 5, York England is using in 6 and it probably dates back to 4.5 or 4.6. I've traced the problem to some baseline calls and if you don't have any specific knowledge with these functions, you are not helping me. I don't like being rude who are trying to help, but they are paying me too much money to sit around and debate the style of code I didn't write

Roger:

I adjusted your line to 0 and 1 because "current Module" is at 0.1. I get the same error.



<<
-R-E- DXL: <Line:657> An unexpected error has occurred: baseline '0.1' does not exist

-R-F- DXL: <Line:657> internal error, please submit a bug report
>>

Report this to a Moderator Report this to a Moderator
 27-Feb-2004 09:26
User is offline View Users Profile Print this message


Tony Goodman

Posts: 1098
Joined: 12-Sep-2002

I agree with Louie, but I also sympathise with JIm.
I too have worked on really bad legacy code (Y2K - what a nightmare).

I have tried your code Jim, and once I have declared all the variables, it seems to work fine.

I am concerned about the use of the eval_ string to get the module name. There is no need for this to be run in its own context, so I would rip this out and replace it with a simple function.

I am also concerned about using a string comparison to compare user input with an actual baseline.
If possible, add a combo box so the user can select the baseline from a list, rather than having to type it in exactly.

Does this code still have to support all versions?

I also remember a discussion about nested baseline loops that caused funnies like this, see the following thread

http://support.telelogic.com/en/doors/forums/messageview.cfm?catid=17&threadid=1232.

Can't be more help without seeing all the code I afraid, but good luck!



-------------------------
Tony Goodman
http://www.smartdxl.com
Report this to a Moderator Report this to a Moderator
 27-Feb-2004 14:32
User is offline View Users Profile Print this message


Jim Babcock

Posts: 6
Joined: 18-Feb-2004

Answer Answer
Progress made!

Apparently what you see in the GUI is not necessarily whats seen by DXL. When Tony told me he ran my code and it worked, I approached debugging from a different angle. I wrote a test dxl that did nothing but count baselines... and guess what: the requirements module only had one baseline and it was 0.1. When I was working with this I had create 3 baselines in the GUI, but I guess I needed to exit or save the modules to have them be real.

This is why I was upset with Louie's red herrings! I knew either I was setting up my test case wrong or baseline functionality was broke. I only had two days to fix this (I'm done today at noon) and didn't have time to go on fishing expedition. If someone had said, "Hey, you need to save out your module before baseline updates are actually in the database", I might has finished up yesterday

I'm truly sorry if I hurt your feelings, Louie
Report this to a Moderator Report this to a Moderator
 27-Feb-2004 15:06
User is offline View Users Profile Print this message


Louie Landale

Posts: 2070
Joined: 12-Sep-2002

I really thought I HAD found the bug in the code and thought I was "reminding". These "clever" language features are mostly traps.

In DOORS v5 the source module is closed and reopened when you Baseline; but apparently it doesn't do that anymore in v7. Maybe there is some caching issue associated with v7, where the Interface sees one thing but DXL queries the Server for the same thing.

Maybe your code can self-defend itself by issuing a "save(current Module)" up front. After your deadline give it a try and it it works we can add that to "common knowledge", in this case for DXL that deals with Baselines.

- Louie

"red herring". Forgive my ignorance, but is that a bad thing?
Report this to a Moderator Report this to a Moderator
 27-Feb-2004 15:26
User is offline View Users Profile Print this message


Jim Babcock

Posts: 6
Joined: 18-Feb-2004

Unfortunately for the common knowledge, my deadline means I turn in my ID badge and go find other work... this was a 1-2 week consulting gig. I may or may not ever use DOORS again.
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.