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: Is module handle the same as a module?
Topic Summary: setting current to current module
Created On: 4-Aug-2005 13:58
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 Leidy Ramirez, on Thursday, August 11, 2005 2:34 PM

Answer:
Tony, Thanxs! :-). I found out that my error was when I was passing my array. You can't pass the an array with un-initialize values to the create function when trying ot create a attribute type. e.g. string attrVal[3] attrVal[0] = "Low" attrVal[1] = "High" string mess = "" attrType at = create("LowHighList", attrVal, mess) will crash and give you an access violation error. It is obvious that the create function will try to access the unitialized values of the array. Thanks for the comments. It helped me find my solution. Leidy Ramirez
 4-Aug-2005 13:58
User is offline View Users Profile Print this message


Leidy Ramirez

Posts: 11
Joined: 15-Jun-2005

Item it

for it in current Folder do {
Module mod = edit(moduleName, false)
current = Module mod           -------------------- > Not working, syntax errror
}

If I set it like this:

for it in current Folder do {
Module mod = edit(moduleName, false)
current = current Module
print "Current: " name current "\n" ----------------------> prints parent folder
}

Or
for it in current Folder do {
Module mod = edit(moduleName, false)
current = mod
print "Current: " name current "\n" ----------------------> prints parent folder
}

I am trying to set the current to the current module inside my loop. The edit function returns a module handle, that's reason I believe it does not let me do current = Module mod because "mod" is module handle. I don't understand why is not working in the other cases.  Any feedback will be greatly appreciated.

Thank you,

Leidy Ramirez




Report this to a Moderator Report this to a Moderator
 4-Aug-2005 16:34
User is offline View Users Profile Print this message


Tony Goodman

Posts: 1098
Joined: 12-Sep-2002

Use the following to set the curent Module:

(current ModuleRef__) = mod

You do not need to (and can't) cast "mod".

e.g:
Item it
Module mod
for it in current Folder do {
mod = edit(fullName(it), false)
(current ModuleRef__) = mod
print("Current Module = " name(current Module) "\n")
close(mod)
}

The function "current" is overloaded for different types, so you need to make the item type explicit unless you are assigning to a variable.

e.g.
print("Current Folder = " name(current Folder) "\n")
print("Current Module = " name(current Module) "\n")

-------------------------
Tony Goodman
http://www.smartdxl.com
Report this to a Moderator Report this to a Moderator
 4-Aug-2005 16:38
User is offline View Users Profile Print this message


Chris Jones

Posts: 177
Joined: 1-Jul-2005

What exactly is moduleName set to? I assume you'd want to set it to the fullName of the item you're currently on:

Item it
string moduleName = ""

for it in current Folder do {

moduleName = fullName(it)

print moduleName "\n"
Module mod = edit(moduleName, false)
current = mod
print "Current: " name (current Module) "\n"
}

Then I think you have to specifically tell it to use the (current Module). If you just say current it seems to assume current Folder. Hope this helps!

Edit: Looks like Tony beat me to it! He can explain a lot better than I can too.

Edited: 4-Aug-2005 at 16:39 by Chris Jones
Report this to a Moderator Report this to a Moderator
 8-Aug-2005 19:05
User is offline View Users Profile Print this message


Leidy Ramirez

Posts: 11
Joined: 15-Jun-2005

Tony and Chris,

If I pritn the current module, I get the current module. If I print current I get the parent folder. I tried also putting all the "formal" modules in skiplist and then iterating to the list but still when I print current inside the module skiplist I still get the parent folder. I am tryign to create a attribute definition and I keep getting a ACCESS_VIOLATION_ERROR when I call the create function and I am pretty sure that it is because of "current". Here is the code that I have now:


  string sAttrName = ""
  string sAttrType = ""
  string sAttrDefault = ""
  string sAttrValue = ""
  string sAttrValueList[50]
  int count = 0
  Item itm
  Item it
   sAttrValueList[0] = "low"
     sAttrValueList[1] = "medium"
     sAttrValueList[2] = "high"
    
  current = current Project
 
 
    for itm in current Project do
    {
  
     string tpy = type(itm)
     if(tpy == "Folder" and (name itm) == "01 Customer Specs") {
     Folder fld = folder(itm)
     current = fld
     print "CURRENT0: " name current "\n"
     Skip listOfModules = create
     Module modu
     for it in fld do
     {
      tpy = type(it)
      print "inside folder" "\n"
      if(tpy == "Formal")
      {
       read(fullName(it), false)
       Module m = module(it)
       print "it's a formal module" "\n"
       if(!null m)
       put(listOfModules, m, m)
       else
        print "null mod" "\n"
     
      }//if(tpy == "Formal")
     }  //for it in current Folder do
     
      Module mod
      print "completed list" sizeof(listOfModules) "\n"
      for mod in listOfModules do {
       edit(fullName(mod), false)
       print "MODULE: " name mod "\n"
        current ModuleRef__ = mod
          
       print "CURRENT1: " name (current Module)  "\n"
     
  print "creating attribute for " name current " module " "\n"
  AttrType at =  create (sAttrName, sAttrValueList, mess)
  if(null at || !null mess)
  {
   print "failed to create attribute. error: " mess "\n"
         }
       }
   }
 }

Thanks in advance for your comments and suggestions.

Leidy Ramirez
Report this to a Moderator Report this to a Moderator
 9-Aug-2005 08:55
User is offline View Users Profile Print this message


Tony Goodman

Posts: 1098
Joined: 12-Sep-2002

The attached does the job.
You will need to add more error checking etc.

You first loop "for item in project" recurses through sub-folders, which is unnecessary if you are only interested in the Customer Specs folder, so I replaced the loop with a test for the existence of the folder in the project.

Then I get a handle on the Customer Specs folder using the folder() function.

The "for item in folder" loop does not recurse and suits our purpose for getting modules in that folder.

The current module is set correctly when you open a module for edit.

Remember to save and close the module afterwards.

-------------------------
Tony Goodman
http://www.smartdxl.com
Report this to a Moderator Report this to a Moderator
 11-Aug-2005 14:34
User is offline View Users Profile Print this message


Leidy Ramirez

Posts: 11
Joined: 15-Jun-2005

Answer Answer
Tony, Thanxs! :-). I found out that my error was when I was passing my array. You can't pass the an array with un-initialize values to the create function when trying ot create a attribute type. e.g. string attrVal[3] attrVal[0] = "Low" attrVal[1] = "High" string mess = "" attrType at = create("LowHighList", attrVal, mess) will crash and give you an access violation error. It is obvious that the create function will try to access the unitialized values of the array. Thanks for the comments. It helped me find my solution. Leidy Ramirez
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.