![]() |
Telelogic DOORS (steve huntington) | ![]() |
new topic :
profile :
search :
help :
dashboard :
calendar :
home
|
||
Latest News:
|
|
Topic Title: #include question Topic Summary: variable access between include files Created On: 1-Mar-2007 18:00 Status: Post and Reply |
Linear : Threading : Single : Branch |
![]() |
![]()
|
![]() |
|
I have a question on using include files. If in a dxl file, I tell it to include two files, can I access variables in the first include file in the second include. It somewhat seems an include file basically is just a way to break down your code, but essentially is the same as including the code from the include file in the dxl file. If this is true, I would think I could access global variables from the first include file in functions in the second since the variables from the first would already be declared. Does anyone know? I have a program that I don't want to be a few thousand lines long all in one file so I'm trying to break it up, but its starting to get difficult to pass things around and also not to repeat variable names.
------------------------- David Pechacek AAI Services Textron dpechacek@sc-aaicorp.com David.Pechacek@gmail.com |
|
![]() |
|
![]() |
|
I always break larger scripts down in to manageable sized files. This allows functionality to be grouped which makes the code much easier to understand and maintain.
Another advantage of course is that you can develop your own library of routines and include the relavant files in new scripts. This saves a lot of time and effort. The interpreter replaces the #include directive with the contents of the file before execution. ------------------------- Tony Goodman http://www.smartdxl.com |
|
![]() |
|
![]() |
|
Hi David.
There is an undocumented dx perm - if I can remember the syntax it is: eval_(#include<d:/mydir/myfile.dxl> ![]() Ewen Miller QinetiQ |
|
![]() |
|
![]() |
|
Yes, when you #include the interpreter pulls all that stuff in before it interprets it.
Yes, variables and functions declared in the MAIN of the 1st include are available anywhere in the 2nd include. However, while this has nothing to do with includes; you CAN declare functions within a function, but the variables in the parent function are NOT available inside the child function. All 'global' variables must be in the top context (you don't care about that) or declared in the MAIN; normal nesting really doesn't work in DXL. Back to Includes; I've probably got the biggest pile of included library outside of Telelogic. These libraries are generally true functions: they deal with globabal constants and call parameters are don't monkey with global variables. Yes, a few of my library do communicate with each other in global variables and several of them declare internal variables 'globally' to make them run faster; but I believe there is only a single one that communicates with the Main via a global variable. These libraries are for inclusion and use by any DXL that needs them. Your huge DXL is probably simial, a whole bunch of the functions are true parameter driven things that are great candidates for inclusion, even if you don't figure to provide them for other DXL. - Louie |
|
![]() |
Telelogic DOORS
» DXL Exchange
»
#include question
|
![]() |
FuseTalk Standard Edition v3.2 - © 1999-2009 FuseTalk Inc. All rights reserved.