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: #ifdef support?
Topic Summary:
Created On: 18-Jan-2007 21:35
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 Brian Abts, on Thursday, January 25, 2007 1:02 PM

Answer:
quote:

Originally posted by: Heather Linsk
Does dxl support #ifdef? If not, then is there another way to conditionally include a file?   Also - Is there a way for a script to know if it is being called from another script? Thanks! Regards - Heather.


I think this covers your first question. You can use the eval_(string dxlCommand) function to conditionally include a file. For example, the dxl line:

eval_("#include <addins\\test.dxl>")

will execute the test.dxl file on the fly. You need to escape the \'s since the command is in a string. I've used this code to create a master GUI tool that can launch other DXL tools, each of which has their own dxl file.

Also, I believe that the eval_ function is unsupported. So use it at your own risk.
 18-Jan-2007 21:35
User is offline View Users Profile Print this message


Heather Linsk

Posts: 50
Joined: 7-Mar-2006

Does dxl support #ifdef?

If not, then is there another way to conditionally include a file?
 
Also - Is there a way for a script to know if it is being called from another script?

Thanks!

Regards -

Heather.

-------------------------
Heather Linsk
Lead Engineer
General Dynamics AIS
413-494-7095
Report this to a Moderator Report this to a Moderator
 19-Jan-2007 18:24
User is offline View Users Profile Print this message


Louie Landale

Posts: 2070
Joined: 12-Sep-2002

No, you cannot conditionally include a file; all inclusions are performed before any code is executed.

Perhaps the perm "dxlHere()" is what you want.

- Louie
Report this to a Moderator Report this to a Moderator
 24-Jan-2007 21:40
User is offline View Users Profile Print this message


Brian Abts

Posts: 7
Joined: 3-May-2006

Answer Answer
quote:

Originally posted by: Heather Linsk
Does dxl support #ifdef? If not, then is there another way to conditionally include a file?   Also - Is there a way for a script to know if it is being called from another script? Thanks! Regards - Heather.


I think this covers your first question. You can use the eval_(string dxlCommand) function to conditionally include a file. For example, the dxl line:

eval_("#include <addins\\test.dxl>")

will execute the test.dxl file on the fly. You need to escape the \'s since the command is in a string. I've used this code to create a master GUI tool that can launch other DXL tools, each of which has their own dxl file.

Also, I believe that the eval_ function is unsupported. So use it at your own risk.


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

Brian Abts
Software Engineer I
AAI Corp.
Report this to a Moderator Report this to a Moderator
 25-Jan-2007 07:44
User is offline View Users Profile Print this message


Reik Schroeder

Posts: 361
Joined: 28-Jul-2003

Hi Brian, Hi Heather,

there should be one hint to the eval_ function:
The executed script will run in a new DXL context! So you will not be able to use variables, functions ...
from evaluated code within the main code and the other way round!

If you need to interface with evaluated code, you should pass varibales to it:
example:

int i = 5;
string s = "Hello World";
Object o = object (5);

Buffer evalDXLcode = create ();
evalDXLcode += "int i = "i";\n";
evalDXLcode += "string s = "s";\n";
evalDXLcode += "Object o = addr_ ("(int addr_ o)");\n";

evalDXLcode += "#include <addins\\test.dxl>\n";
evalDXLcode += "return_ o.\"Object Text\"\"\"\";\n ";

string result = eval_ (stringOf (evalDXLcode));

delete (evalDXLcode);


You may return results with the return_ function.

BTW: The eval_ is a supported function, because it is described in
DOORS 8.1 API manual

Greetings
Reik

-------------------------
Evosoft GmbH
for Siemens Industry Sector


Berlin, Germany
Report this to a Moderator Report this to a Moderator
 25-Jan-2007 08:59
User is offline View Users Profile Print this message


Tony Goodman

Posts: 1098
Joined: 12-Sep-2002

Hope you don't mind Reik, I fixed a few bugs in that for you.
Some quotes were missing.

-------------------------
Tony Goodman
http://www.smartdxl.com
Report this to a Moderator Report this to a Moderator
 25-Jan-2007 13:04
User is offline View Users Profile Print this message


Heather Linsk

Posts: 50
Joined: 7-Mar-2006

Thank you all for responding!

Brian - the eval_("#include"..") was exactly what I was looking for.
I wanted to launch a GUI in it's own DXL context.

Perfecto!

Thank you again!

Regards -

Heather.

-------------------------
Heather Linsk
Lead Engineer
General Dynamics AIS
413-494-7095
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.