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

Home » Public Forums » archive » quirk End of file encountered before end of program
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: quirk End of file encountered before end of program [message #89860 is a reply to message #89856] Thu, 11 December 2014 07:45 Go to previous messageGo to previous message
Jim  Pendleton is currently offline  Jim Pendleton
Messages: 165
Registered: November 2011
Senior Member
On Thursday, December 11, 2014 8:03:55 AM UTC-7, LC's No-Spam Newsreading account wrote:
> I am trying to adapt some old code to a new task. I *occasionally* get
> (IDL 8.4 on Linux)
>
> return
> ^
> % Syntax error.
> At: xxx.pro, Line 26
>
> % End of file encountered before end of program.
> At: xxx.pro, Line 28
>
> although the program contains a perfectly valid return and end statement
>
> Then I strip the program of almost all code, and it compiles. Then I
> gradually add code until I get the error. Each time I exit and
> reenter IDL.
>
> I had a thought that it could be a sequence of begin end clauses in a
> case statement (could it confuse the end of a begin end with the
> compiler end ?) but than I remove entirely the case statement and go
> back to the code which last time compiled, and it still gives the
> error.
>
> The code should look something like this
>
> pro xxx.pro,ARGUMENTS
> openw,2,'temporary.temp'
> printf,2,'structure=create_struct( $'
>
> CASE STATEMENT FILLING THE STRUCTURE DEFINITION in the temp file
> (the default for an "empty" structure would just be)
> printf,2," 'data',-1 $"
>
> printf,2,')'
> close,2
> ; and instantiate it
> @ temporary.temp
> ;help,structure
> return
> end
>
> sometimes the code with the CASE gives the error, sometimes doesn't.
> Sometimes the code without the CASE gives the error, I comment out the
> batch invocation of @ temporary.temp, and it doesn't ... then I reinsert
> the batch invocation and then it works.
>
> I also have the impression sometimes it finds an early version of
> temporary.temp or does not find it even if existing. But the file is on
> a local disk, not NFS (these glitches can occur if nfs client and server
> are out of sync), and moreover we use ntp to keep all our clocks on
> synch.
>
> Any clue ? I hate non-reproducible errors ...
>
>
> --
> ------------------------------------------------------------ ----------
> nospam@mi.iasf.cnr.it is a newsreading account used by more persons to
> avoid unwanted spam. Any mail returning to this address will be rejected.
> Users can disclose their e-mail address in the article if they wish so.

I suspect this isn't behaving as you wish it to behave, due to a misinterpretation of how "@" is used.

The "@" in your code is interpreted at compile time, not at run time.

Make a simple example

pro abc
@def
print, 'here'
end

Attempt to compile it, without executing it. You'll notice that you get an error "%Error opening file. File: def". But the routine still compiles. Try

IDL> abc

Create a file "def" and put a single line in it

print, 'there'

Do not recompile abc. Simply execute it.

The output does not change. Recompile abc.pro and execute and this time the "def" file is included and executed, as expected.

In your example, you will always be out of synch by one execution with respect to your "@temporary.temp". It's including the version of the file from your previous execution, not the version of the file you are generating on the fly. When you get syntax errors, it's highly likely this is because there's an error in the syntax of the "temporary.temp" file from the previous execution.

I expect what you really want here (short of a logical redesign involving hashes) will be one or more calls to CREATE_STRUCT rather than what you have now.

Jim P
"I work for Exelis"
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: reading binary file with READ_BINARY
Next Topic: IDLgrPolygon question

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

Current Time: Wed Oct 08 19:58:54 PDT 2025

Total time taken to generate the page: 0.00435 seconds