Re: Including files [message #15608 is a reply to message #15524] |
Thu, 27 May 1999 00:00   |
Liam Gumley
Messages: 473 Registered: November 1994
|
Senior Member |
|
|
eddie haskell wrote:
> I have no problems with using ENDs in most places. It is a matter of
> properly placed '&'s and '$'s. I saved the following code, which does
> nothing worthwhile, as TEST (without the .pro) and was able to use it in
> $MAIN$, procedures, functions, other loops, and at the command prompt as
> @TEST
> and it also works just by copying the block to the command prompt.
> This works on my Unix box, IDL5.1, but I would be surprised if this was
> version or platform dependent. Granted, this makes the code look a tad
> ugly, but I have had occasions where it was handy to "batchify" a couple
> hundred lines of code like this.
>
> ;;;;;; TEST ;;;;;;;;;;;;;;;;;;;;
> i=0
> FOR j=0,2 do begin $
> i=i+1 & $
> IF (j ge 1) then begin $
> i=i+1 & $
> REPEAT begin $
> i=i+1 & $
> WHILE (i lt 20) do begin $
> i=i+2 & $
> CASE j of & $
> 0 : i=i+1 & $
> else : i=i-1 & $
> ENDCASE & $
> ENDWHILE & $
> ENDREP until (i gt 25) & $
> ENDIF & $
> ENDFOR
> print,i
I guess the bottom line from the previous posts was that as long as you
don't use @ at the command line, you don't need the & $ at the end of
every line of your script. In fact you can include a complete procedure
or function (but why would you want to?), e.g.
;---test.pro---
@include
pro test
print, 'Hello world'
include
end
;---
;---include.pro---
pro include
print, 'This was included'
end
;---
IDL> test
% Compiled module: TEST.
Hello world
This was included
Cheers,
Liam.
--
Liam E. Gumley
Space Science and Engineering Center, UW-Madison
http://cimss.ssec.wisc.edu/~gumley
|
|
|