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

Home » Public Forums » archive » Re: Correct format of "included" files (using "at" sign)
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: Correct format of "included" files (using "at" sign) [message #1844] Wed, 02 March 1994 07:02
sterner is currently offline  sterner
Messages: 106
Registered: February 1991
Senior Member
kspencer@iti.org (Kevin Spencer) writes:

> Yes, it's frustrating that they don't document the differences in syntax
> between compiled routines and the "script" files. As far as I know, you
> have to keep statements to one line, and can't use block statements. IDL
> just treats the commands as if they were issued in interactive mode.

Think of the @ symbol as meaning "include the contents of the
specified file at this point" where that text must be appropriate
for the current IDL mode. If you are in interactive mode the @ file
is called a batch file and must have the same syntax as you would
type in that mode. If you are in compile mode the file is called
an include file and the text may have the syntax used in routines.

Ray Sterner sterner@tesla.jhuapl.edu
Johns Hopkins University North latitude 39.16 degrees.
Applied Physics Laboratory West longitude 76.90 degrees.
Laurel, MD 20723-6099
Re: Correct format of "included" files (using "at" sign) [message #1847 is a reply to message #1844] Tue, 01 March 1994 18:11 Go to previous message
Jackel is currently offline  Jackel
Messages: 30
Registered: April 1993
Member
In article <Mar1.191234.31054@acs.ucalgary.ca> steele@wesson.phys.ucalgary.ca (Dave Steele) writes:
> From: steele@wesson.phys.ucalgary.ca (Dave Steele)
> Subject: Correct format of "included" files (using "at" sign)
> Date: Tue, 1 Mar 1994 19:12:34 GMT
> Keywords: IDL, "at" sign, substituted code

> I'm trying to use the "at" sign (the $%^&*! 'xrn' editor won't let

...Text deleted

> --
> David Steele | Internet : steele@wesson.phys.ucalgary.ca
> Department of Physics and Astronomy | SPAN : CANCAL::STEELE
> The University of Calgary | Phone : +1 403 220 8651
> OPINIONS EXPRESSED WITHIN ARE MY OWN AND NOT THOSE OF THE UNIVERSITY OF CALGARY

Could you be more specific about what you're trying? On the PC I can make a
program TEST.PRO as follows:

------------------------------------------------------------ --------------
pro TEST

print,'This program tests include blocks'
@c:\idl\test.1
print,'The end'

end
------------------------------------------------------------ ---------------

where the file c:\idl\test.1 is just:

------------------------------------------------------------ --------------
FOR i=0,10 DO BEGIN
print,i
ENDFOR
------------------------------------------------------------ ---------------

and it works fine. The only way I can create problems is to put a space
before the @ sign, and then it just won't compile. Is the above code
basically what you want to do, or have I misunderstood?
Re: Correct format of "included" files (using "at" sign) [message #1848 is a reply to message #1847] Tue, 01 March 1994 17:26 Go to previous message
paul is currently offline  paul
Messages: 22
Registered: June 1991
Junior Member
In article <Mar1.191234.31054@acs.ucalgary.ca>, steele@wesson.phys.ucalgary.ca (Dave Steele) writes:
|> I'm trying to use the "at" sign (the $%^&*! 'xrn' editor won't let
|> me type it!) to substitute some code into IDL. The procedure is
|> tersely described on p. 2-7 of the User's Guide for v3.1. I'm
|> getting a problem that I think has to do with the format of the
|> code I'm including. It is an IF_THEN_ELSE block with no header
|> line (like PRO ... or FUNCTION ...) and no trailer lines (like
|> RETURN, END, EXIT). If I run the routine that invokes the code
|> substitution, I get syntax errors in the first lines following the
|> invocation. If I add a line saying 'END' to the substituted code,
|> I get dropped back to the IDL> prompt at the end of the substituted
|> code.

...text deleted

The IDL interpreter treats input from a file using the at sign command just
as if the contents of the file were typed in at the prompt. This results in
different behavior than if the file were compiled with the .run command. In
particular multi-line compound statements that contain BEGIN and END statements
are not recognized unless you tell the interpreter that a given command line
is not complete. Here is how to do it...


j=0
k=0
for i=0,10 do begin &$
if i le 2 then begin &$
j=j+1 &$
k=k+2 &$
endif else begin &$
j=j-1 &$
k=k-2 &$
endelse &$
print,i,j,k &$
endfor

If you leave out the &$ the interpreter gets confused because each line of
input is not an independently excutable statement.

____________________________________________________________ _______________
Paul Ricchiazzi Internet: paul@esrg.ucsb.edu
Earth Space Research Group, UCSB
____________________________________________________________ _______________
Re: Correct format of "included" files (using "at" sign) [message #1850 is a reply to message #1848] Tue, 01 March 1994 11:30 Go to previous message
kspencer is currently offline  kspencer
Messages: 21
Registered: December 1993
Junior Member
steele@wesson.phys.ucalgary.ca (Dave Steele) writes:

> I'm trying to use the "at" sign (the $%^&*! 'xrn' editor won't let
> me type it!) to substitute some code into IDL. The procedure is
> tersely described on p. 2-7 of the User's Guide for v3.1. I'm
> getting a problem that I think has to do with the format of the
> code I'm including. It is an IF_THEN_ELSE block with no header
> line (like PRO ... or FUNCTION ...) and no trailer lines (like
> RETURN, END, EXIT). If I run the routine that invokes the code
> substitution, I get syntax errors in the first lines following the
> invocation. If I add a line saying 'END' to the substituted code,
> I get dropped back to the IDL> prompt at the end of the substituted
> code.

[deleted]

> Dave

> --
> David Steele | Internet : steele@wesson.phys.ucalgary.ca
> Department of Physics and Astronomy | SPAN : CANCAL::STEELE
> The University of Calgary | Phone : +1 403 220 8651
> OPINIONS EXPRESSED WITHIN ARE MY OWN AND NOT THOSE OF THE UNIVERSITY OF CALGARY

Dave,

Yes, it's frustrating that they don't document the differences in syntax
between compiled routines and the "script" files. As far as I know, you
have to keep statements to one line, and can't use block statements. IDL
just treats the commands as if they were issued in interactive mode.

Kevin

-----------------------------------------------------------
Kevin Spencer
Cognitive Psychophysiology Laboratory and Beckman Institute
University of Illinois at Urbana-Champaign
kspencer@p300.cpl.uiuc.edu / kspencer@psych.uiuc.edu
-----------------------------------------------------------
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: What's happening at support@pvi.com
Next Topic: rotate y axis values

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

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

Total time taken to generate the page: 0.00438 seconds