Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado
The IDL documentation mentions include files, which allows "statements contained in an include file" to be "textually inserted into the including file." However, I can not find any mention or examples of how, exactly, to include other files. What is the syntax? Are there any examples in the documentation or sample code that comes with IDL? Nils
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
Liam Gumley wrote: > block termination statements (ENDFOR, ENDIF, ENDREP, ENDWHILE) > are only allowed in procedures or functions. 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 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Cheers, eddie ----- ---- --- --- ---- --- -- --- --- -- -- - - - - |\ A G Edward Haskell |\ Center for Coastal Physical Oceanography |\ Old Dominion University, Norfolk VA 23529 |\ Voice 757.683.4816 Fax 757.683.5550 |\ e-mail haskell*ccpo.odu.edu ----- ---- --- ---- --- --- --- --- -- -- -- - - - -