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: Use of #include
Topic Summary: using string variables with #include
Created On: 15-Mar-2006 16:17
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 Peter Chattaway, on Thursday, March 16, 2006 10:14 AM

Answer:
Paul

You've confirmed my suspicions - I was hoping there might be a way of declaring 'special' variables before the preprocessing happens ie.. which can be used at that point...

Thanks

Reik

Some useful tips. Thank you.

Regards
Peter
 15-Mar-2006 16:17
User is offline View Users Profile Print this message


Peter Chattaway

Posts: 14
Joined: 6-Apr-2004

I'm trying to reduce size of my code by breaking it down into .inc files.

But the path of my dxl files is likely to change, so I want to set up a string variable, and then use that to reference my include my files.

But how do I do it?...

The following example shows the problem I face


string strInclude = "c:/includeMe.inc"
//#include strInclude // I want to use this line, but it doesn't work
#include "c:/includeMe.inc" // I'm forced to use this line
Report this to a Moderator Report this to a Moderator
 16-Mar-2006 10:02
User is offline View Users Profile Print this message


Reik Schroeder

Posts: 361
Joined: 28-Jul-2003

Hi Peter,

AFAIK it is not possible to use dynamic #include statements.
I tried this a long time ago to prevent from double including. Btw. you have to assure yourself the dependencies of include files, because there is no #ifndef available!

But you can use a different method to define this path. The DOORSADDINS environment variable or the start parameter -a to your doors.exe

There you can define a list of search pathes for your include files.
These pathes can also refer to mapped network drives, if you neeed this. We are using this method to work directly on our CVS Clearcase.

But remember the original path DOORSHOME/lib/dxl/addins will be used as first choice, so if the file you want to include exists in both directories, Doors will use the local one in DOORSHOME/lib/dxl/addins!

I hope this will help you a little bit ...

Greetings
Reik Schröder

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


Berlin, Germany
Report this to a Moderator Report this to a Moderator
 16-Mar-2006 10:04
User is offline View Users Profile Print this message


Paul Tiplady

Posts: 176
Joined: 28-Oct-2003

I think the short answer is you can't do it that way. The problem is that, like C, the proprocessing happens first. This means all includes are done before any code is evaluated. So the variable is undefined when you try to do the include.

Reik has given alternatives (he replied at the same time as me!)

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


Paul dot Tiplady at TRW dot com
TRW Automotive
Report this to a Moderator Report this to a Moderator
 16-Mar-2006 10:14
User is offline View Users Profile Print this message


Peter Chattaway

Posts: 14
Joined: 6-Apr-2004

Answer Answer
Paul

You've confirmed my suspicions - I was hoping there might be a way of declaring 'special' variables before the preprocessing happens ie.. which can be used at that point...

Thanks

Reik

Some useful tips. Thank you.

Regards
Peter
Report this to a Moderator Report this to a Moderator
 5-Dec-2006 15:43
User is offline View Users Profile Print this message


Shyam Sundar

Posts: 8
Joined: 26-Jul-2006



-------------------------
Regards,
Shyam
Report this to a Moderator Report this to a Moderator
 7-Dec-2006 01:20
User is offline View Users Profile Print this message


Louie Landale

Posts: 2070
Joined: 12-Sep-2002

Yes. Be advised that the addins and DOORSADDINS variables have double use; first to define folders that house menus for open formal modules and also as you said to define where to look for include files.

All my include statements look like this:
#include <Includes/BlaBlaBla.inc>

My addins points to //Server/DXL/Module. Under that are sibling folders 'Includes' and 'Module-Scripts'; where 'Module-Scripts' appear in the menu (Includes doesn't appear since it does NOT contain any files named 'Includes.hlp' and 'Includes.idx'.). Fine.

I have on my local client: c:/Doors-Stuff/DXL-Local/ folder that contains sibling folders 'Includes' and also 'InProgress' that appears in MY menus. My addins first point to the DXL-Local folder and THEN to the normal deployed location. Since it comes first the #include statement resolve to finding include files I have in DXL-Local/Includes folder which are the ones I currently have in development. If I need to run an important job on the production database and don't want to use developmental includes, I've got another DOORS icon that uses the '-a ' switch to just point to the addins on the network, bypassing my local client altogether.

Be advised that the search order of directories appears to be as follows: [1] The current working Windows folder which is usually the last folder you clicked on in Windows Explorer [2] DOORSHOME/lib/dxl/addins [3] specified order of 'addins' or 'DOORSADDINS' variables. That first one is a shocker, discovered by one of the DOORS munchkins when faced with an error in my deployment instructions. You can thus cleverly rediriect include files by selecting a directory in Windows Explorer before invoking DOORS, and won't have to deal with extra icons or registry editing.

- Louie
Report this to a Moderator Report this to a Moderator
 14-Dec-2006 06:37
User is offline View Users Profile Print this message


Michael Cvitanovich

Posts: 21
Joined: 31-Mar-2006

I have a related question re include files. I have a script that includes a link file with a statement like: #include The script and the include file are in the same directory. If I use the Tools\Edit DXL... menu option to load and run the script all is fine, regardless of where I put the files (as long as the script and the include file are together). I put the files together in a subdirectory of the addins directory so that I could get a menu in DOORS. If I load the script as before it works fine, but if I use the DOORS menu item just created the include file can't be found. I need to change the include statement to be: #include Am I doing something wrong, or does DOORS not look in the same directory for include files if you run from the menu? Can anyone help? Thanks, Michael.
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.