comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: Where is the right place to define new structs?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: Where is the right place to define new structs? [message #26499] Wed, 05 September 2001 11:48
Stein Vidar Hagfors H[1] is currently offline  Stein Vidar Hagfors H[1]
Messages: 56
Registered: February 2000
Member
Olaf Stetzer <olaf.stetzer@imk.fzk.de> writes:

> Hello again,
>
> just another question:
>
> I want to implement a function for thermodynamic
> calculations I need. This function needs a parameter
> set as input and returns a parameter set as output, so
> I have to define the structs which hold these sets
> somewhere.
>
> I think that the right place is in the same .pro-file

Nope. For a structure named "mystruct", put it in a file called
mystruct__define, inside a PRO called mystruct__define, with no
arguments. This will automatically be run if mystruct is not defined,
upon the first encounter of statements like

my_var = {mystruct}

E.g. mystruct__define.pro:

PRO mystruct__define
dummy = {mystruct, fielda:0.0, fieldb:"" }
END

--
------------------------------------------------------------ --------------
Stein Vidar Hagfors Haugan
ESA SOHO SOC/European Space Agency Science Operations Coordinator for SOHO

NASA Goddard Space Flight Center, Email: shaugan@esa.nascom.nasa.gov
Mail Code 682.3, Bld. 26, Room G-1, Tel.: 1-301-286-9028/240-354-6066
Greenbelt, Maryland 20771, USA. Fax: 1-301-286-0264
------------------------------------------------------------ --------------
Re: Where is the right place to define new structs? [message #26506 is a reply to message #26499] Wed, 05 September 2001 03:04 Go to previous message
R.Bauer is currently offline  R.Bauer
Messages: 1424
Registered: November 1998
Senior Member
>
> IDL searches routines along its search path but it looks first
> in the path were idl is in.
>
> cd,current=current
> print,current
>
> You can define this path by idlde preferences path or startup.
>
> We prefer the startup method.
> Because it is necessary if you have a library and many users
> all of them should have the same order of pathes.
>
> You can define a function like
>
> function my_func
>
> struct={a:1}
>
> return,struct
> end
>
> If this is saved in the search path it is loaded
>
> by x=my_funct()
>
> If you like named structure you can define them in the startup file
> too.
>
> Then you only have to call them by x={name of structure}
>
> regards
>
> Reimar
>
> --


The online help says:

"
Select Startup File


Click this button to specify the name of an IDL batch file to be
executed automatically each time IDL is run. The startup file is
displayed below.

Note - Startup files are executed one statement at a time. It is not
possible to define program modules, (procedures, functions, or
main-level programs) in the startup file.

"


We are using one startup file for all of our platforms.

Reimar



> Reimar Bauer
>
> Institut fuer Stratosphaerische Chemie (ICG-1)
> Forschungszentrum Juelich
> email: R.Bauer@fz-juelich.de
> http://www.fz-juelich.de/icg/icg1/
> ============================================================ ======
> a IDL library at ForschungsZentrum Juelich
> http://www.fz-juelich.de/icg/icg1/idl_icglib/idl_lib_intro.h tml
>
> http://www.fz-juelich.de/zb/text/publikation/juel3786.html
> ============================================================ ======
>
> read something about linux / windows
> http://www.suse.de/de/news/hotnews/MS.html

--
Reimar Bauer

Institut fuer Stratosphaerische Chemie (ICG-1)
Forschungszentrum Juelich
email: R.Bauer@fz-juelich.de
http://www.fz-juelich.de/icg/icg1/
============================================================ ======
a IDL library at ForschungsZentrum Juelich
http://www.fz-juelich.de/icg/icg1/idl_icglib/idl_lib_intro.h tml

http://www.fz-juelich.de/zb/text/publikation/juel3786.html
============================================================ ======

read something about linux / windows
http://www.suse.de/de/news/hotnews/MS.html
Re: Where is the right place to define new structs? [message #26507 is a reply to message #26506] Wed, 05 September 2001 02:45 Go to previous message
Jaco van Gorkom is currently offline  Jaco van Gorkom
Messages: 97
Registered: November 2000
Member
Olaf Stetzer wrote:
> ... This function needs a parameter
> set as input and returns a parameter set as output, so
> I have to define the structs which hold these sets
> somewhere.
>
> I think that the right place is in the same .pro-file
> which holds the function but I am not sure if IDL is reading
> this definition automatically when I use the function in a
> different program.

You probably want to use the input structure before the
function is run for the first time, which is tricky at best if
the named structure is defined in the function .pro-file .
The right place to put it is in an inputstruct__define.pro file.
Look up "Automatic Structure Definition" in the online help.

Have fun,
Jaco

> ps: Maybe it is the right time of buying a book on
> IDL-coding now... :-)

It is indeed. You won't regret it, really.
Re: Where is the right place to define new structs? [message #26509 is a reply to message #26507] Wed, 05 September 2001 00:58 Go to previous message
R.Bauer is currently offline  R.Bauer
Messages: 1424
Registered: November 1998
Senior Member
Olaf Stetzer wrote:
>
> Hello again,
>
> just another question:
>
> I want to implement a function for thermodynamic
> calculations I need. This function needs a parameter
> set as input and returns a parameter set as output, so
> I have to define the structs which hold these sets
> somewhere.
>
> I think that the right place is in the same .pro-file
> which holds the function but I am not sure if IDL is reading
> this definition automatically when I use the function in a
> different program. Here is an example:
>
> foo.pro:
>
> define structs...
>
> function code...
>
> bar.pro:
>
> use one of the structs, then
> call the fuction foo and pass
> the struct to the function.
>
> Thanks for your help,
>
> Olaf
>
> ps: Maybe it is the right time of buying a book on
> IDL-coding now... :-)



Dear Olaf,

IDL searches routines along its search path but it looks first
in the path were idl is in.

cd,current=current
print,current

You can define this path by idlde preferences path or startup.

We prefer the startup method.
Because it is necessary if you have a library and many users
all of them should have the same order of pathes.

You can define a function like

function my_func

struct={a:1}

return,struct
end

If this is saved in the search path it is loaded

by x=my_funct()


If you like named structure you can define them in the startup file
too.

Then you only have to call them by x={name of structure}



regards

Reimar

--
Reimar Bauer

Institut fuer Stratosphaerische Chemie (ICG-1)
Forschungszentrum Juelich
email: R.Bauer@fz-juelich.de
http://www.fz-juelich.de/icg/icg1/
============================================================ ======
a IDL library at ForschungsZentrum Juelich
http://www.fz-juelich.de/icg/icg1/idl_icglib/idl_lib_intro.h tml

http://www.fz-juelich.de/zb/text/publikation/juel3786.html
============================================================ ======

read something about linux / windows
http://www.suse.de/de/news/hotnews/MS.html
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: Display clashes under Red Hat Linux 7.1/IDL 5.2
Next Topic: Re: color bitmap button labels

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 19:50:31 PDT 2025

Total time taken to generate the page: 0.00688 seconds