linking programs/ procedures [message #19791] |
Wed, 26 April 2000 00:00  |
Sameer Nigam
Messages: 1 Registered: April 2000
|
Junior Member |
|
|
hi!
how do i link two-three files during compilation?
also if i have a procedure X that is written in a file say X.pro and i
want to call it as a subroutine in another procedure Y that is in another
file Y, can i just call that procedure by reference/name and if so how do
i do it?
any suggestions would be most welcome
|
|
|
Re: linking programs/ procedures [message #19909 is a reply to message #19791] |
Fri, 28 April 2000 00:00  |
Richard G. French
Messages: 65 Registered: June 1997
|
Member |
|
|
I've found another use for the much-maligned '@' symbol.
I often have a program that has the form:
; define a bunch of specific varibles, such as
datafile='saturn.dat'
images_to_plot=[2,4,6,7]
; ***************** END OF USER INPUT **************
;
; now do operations that make use of USER input
; blah
; blah
; blah
I like to separate the specific user input from the generic commands,
but
keep them as a MAIN routine so that I have access to all of the
variables
when I am done.
For example, When I generate figures for a publication, I like to have a
separate procedure
file for each figure - one that takes NO interactive input and simply
makes the
damn plot the right way - guaranteed. SO, I might do something like
this:
; figure1.pro
datafile='saturn.dat'
images_to_plot=[2,4,6,7]
; ***************** END OF USER INPUT **************
@main_program_commands_that_produce_a_plot.pro
end
; figure2.pro
datafile='mars.dat'
images_to_plot=[0,3,4]
; ***************** END OF USER INPUT **************
@main_program_commands_that_produce_a_plot.pro
end
This makes the 'driver' files very short, and it guarantees that
the generic plotting routine is the same for all of the plots.
One of the reason I have not gotten into object graphics and the other
fancy interactive stuff is that, when all is said and done, and I have
a plot I like, I want to be able to generate it again without having to
do any user interaction - I want a file of commands that reproduce the
plot exactly, and which are easily changed if I want to use a different
data file, for example.
I'd be curious to know if others out there are similarly stubborn about
wanting to have command files that are guaranteed to make a SPECIFIC
figure for a publication. It is most of what I end up using IDL for.
Dick French
|
|
|