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: current [module]
Topic Summary: current module function documentation
Created On: 11-Mar-2008 21:13
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.
 11-Mar-2008 21:13
User is offline View Users Profile Print this message


Robert Smith

Posts: 9
Joined: 10-Mar-2008

In the DXL Reference Manual for DOORS 8.1, page 245, they have a section
current [module]:
-------------------------------------------------------------------------------------------
Declaration
Module current()

Operation
Returns a reference to the current module. In some contexts current could be ambiguous, in which case it should be followed by Module in a cast.

Example
print (current Module)."Description" "\n"
-------------------------------------------------------------------------------------------
This line -> print (current Module)."Description" "\n" <-
occurs in a section documenting the current[module] function. So it would seem that any following example that uses current would be of the function, and not the current variable (or whatever the thing named current is that you can assign to it). However, if I change it to include the optional parentheses:

print (current() Module)."Description" "\n"

it does not compile giving this error:

-E- DXL: <Line:100> incorrect cast, expected (Module)
-I- DXL: all done with 1 error and 0 warnings

Edited: 11-Mar-2008 at 22:41 by Robert Smith
Report this to a Moderator Report this to a Moderator
 12-Mar-2008 15:46
User is offline View Users Profile Print this message


Louie Landale

Posts: 2070
Joined: 12-Sep-2002

Don't quite understand what's going on, whether 'current' is a function or a variable or both, but of the 4 lines below, only the 4th one generates an error:

print (Module current). "Description" "\n"
print (Module current())."Description" "\n"
print (current Module). "Description" "\n"
print (current() Module)."Description" "\n"

This reminds me of the guy that goes to the doctor, puts his arm above his head and then touches his ear, and says "It hurts when I do this". To which the doctor replied "Don't do that".

Do this: print (current Module)."Description" "\n"

Well, actually you should capture the current module at the top of your script, and then use that variable:
Module mCurr = current
...
print (mCurr)."Description" "\n"

- Louie
Report this to a Moderator Report this to a Moderator
 18-Mar-2008 22:31
User is offline View Users Profile Print this message


Eric Piallat

Posts: 33
Joined: 26-Jan-2004

string myFunc() {return "A\n"}
int myFunc() {return 1}

print myFunc int
print myFunc string
print (int myFunc())
print (string myFunc())

It is described inside introduction of the DXL Referencce Manual:
Introduction => Expressions => Casts
Because of DXL's overloading facility, it is easy to write expressions that have more than one possible interpretation; that is, they are ambiguous. Casts are used to pick which interpretation is required. Casts in DXL come in two forms:

expression type
(type expression)
In the first form, the type name can appear after the expression, as in:

o = current Object
In the second form, the type may come first, but the whole expression must be within parenthesis:

o = (Object current)


What is unclear in documentation is that the first form requires that nothing appears between expression and type, and thus only function with no parameter can be casted this way.


I suppose this was introduced to allow such syntaxes without parentheses (DXL's parents seem like they hate parentheses)

print fullName of current Module
Item i; for i in current Folder do print type of i

-------------------------
E. Piallat
CeBeNetwork
Report this to a Moderator Report this to a Moderator
 19-Mar-2008 13:47
User is offline View Users Profile Print this message


Gordon Woods

Posts: 35
Joined: 2-Mar-2007

along the same lines you can have

Module currentModule // define a module handle
currentModule = current Module // set to current module

and also

Module currentModule = current Module // define and set current module handle

or

Module currentModule = current // define and set current module handle

All will compile quite happily and currentModule can be used later as handle to the current module

and don't forget

(current ModuleRef__) = currentModule // reset the current Module to the saved current module handle

and both of these work

print (name currentModule) "\n"
or
print currentModule."Name" "\n"


isn't it fun !

-----------------
Gordon Woods
BAE Systems (Operations) Ltd
gordon.woods@incose.org
Report this to a Moderator Report this to a Moderator
 19-Mar-2008 17:17
User is offline View Users Profile Print this message


Louie Landale

Posts: 2070
Joined: 12-Sep-2002

The only time I cast using <expression Type> is when using current, as in:

print (current Module)."name" "\n"

Not sure how I got started doing that but probably by seeing examples in the DXL manual. Also, when said outload it sounds better than

print (Module current)."name" "\n"

Other than that, I always cast via (Type expression), as in the above.

As for your comments about the name of the a module, I point out that 'name' is an attribute of the module but its also available when the module is not open, and thus you need a name(mod ref) function in order to get the name when its not open. That function, might as well, allows an open Module variable but it doesn't need to.

- Louie
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.