1. Bug in last line of source file

Rob,

The following six lines are the last lines in a main .ex file that calls
a function in an .e file. As is, they completely crashed the program,
with a screen full of error information, before it would run.

ErrorFileList = NiceFormProcessFiles(CmdLin, Action)
if length(ErrorFileList) > 0 then
        Writeln("ERRORS WITH THE FOLLOWING FILES:")
        WritelnSp(ErrorFileList, "\n")
        abort(1)
end if

When I add a final line, something like the "--end file" comment below,
the program works just fine.

ErrorFileList = NiceFormProcessFiles(CmdLin, Action)
if length(ErrorFileList) > 0 then
        Writeln("ERRORS WITH THE FOLLOWING FILES:")
        WritelnSp(ErrorFileList, "\n")
        abort(1)
end if
--end file

Apparently that if statement (maybe others) cannot be the last line in
an .ex file. I did not check to see if there was a final CrLf pair at
the end of the .ex file, that is, whether a final CrLf made a
difference.

By the way, it has nothing to do with the Writeln statements which are
adaptations of routines in write.e. The same thing happens with puts(),
any other statement, or no statement in body of the if statement.

I tried ErrorFileList as both an object and a sequence. Same results.
--
Terry Constant
constant at flash.net

new topic     » topic index » view message » categorize

2. Re: Bug in last line of source file

Terry Constant writes:
> The following six lines are the last lines in a main .ex file that
> calls a function in an .e file. As is, they completely crashed
> the program, with a screen full of error information, before it
> would run.

> ErrorFileList = NiceFormProcessFiles(CmdLin, Action)
> if length(ErrorFileList) > 0 then
>        Writeln("ERRORS WITH THE FOLLOWING FILES:")
>        WritelnSp(ErrorFileList, "\n")
>        abort(1)
> end if

> When I add a final line, something like the "--end file"
> comment below, the program works just fine.

I ran your code on my machine (I had to supply dummy declarations
for a few things) and did not see any crash. For me it's ok
with or without the final comment line, and if I remove the
final \r\n on the last line, so the last character in the file is 'f',
it still runs ok.

You say it "completely crashed the program with
a screen full of error messages before it would run".
How could it run after having a screen full of error messages?
What messages did you see? Were they just warnings?
Were you running this under 4DOS using long command lines
(greater than 128 characters)?

Regards,
     Rob Craig
     Rapid Deployment Software

new topic     » goto parent     » topic index » view message » categorize

3. Re: Bug in last line of source file

>Terry Constant writes:
>> The following six lines are the last lines in a main .ex file that
>> calls a function in an .e file. As is, they completely crashed
>> the program, with a screen full of error information, before it
>> would run.
>
>> ErrorFileList = NiceFormProcessFiles(CmdLin, Action)
>> if length(ErrorFileList) > 0 then
>>        Writeln("ERRORS WITH THE FOLLOWING FILES:")
>>        WritelnSp(ErrorFileList, "\n")
>>        abort(1)
>> end if
>
>> When I add a final line, something like the "--end file"
>> comment below, the program works just fine.
>
>I ran your code on my machine (I had to supply dummy declarations
>for a few things) and did not see any crash. For me it's ok
>with or without the final comment line, and if I remove the
>final \r\n on the last line, so the last character in the file is 'f',
>it still runs ok.


I once got the same problem when "inventing" InstallKit. If you attach data
at the end of a bounded file, the last line of your program should be
"abort(0) [ENTER]". If you don't do this the Euphoria interpreter just tries
to go on reading the source file... and voila! you got an error. If you use
a comment mark ("--"), it work for a certain amout of data. If the data is
too long the interpreter complains "line too long" or something like that.

Regards,
    Daniel Berstein
    daber at pair.com

new topic     » goto parent     » topic index » view message » categorize

4. Re: Bug in last line of source file

Daniel Berstein wrote:
>
>
> I once got the same problem when "inventing" InstallKit. If you attach data
> at the end of a bounded file, the last line of your program should be
> "abort(0) [ENTER]". If you don't do this the Euphoria interpreter just tries
> to go on reading the source file... and voila! you got an error. If you use
> a comment mark ("--"), it work for a certain amout of data. If the data is
> too long the interpreter complains "line too long" or something like that.
>

Daniel,
Thanks for the info. I was coding on the idea that Euphoria defaulted to
a 0 on exit. Regardless, I like your solution of abort(0) with a "for
sure" CrLf pair at the end of the file. I will incorporate that line in
all my code from now on.

--
Terry Constant
constant at flash.net

new topic     » goto parent     » topic index » view message » categorize

5. Re: Bug in last line of source file

Robert Craig wrote:
>
> I ran your code on my machine (I had to supply dummy declarations
> for a few things) and did not see any crash. For me it's ok
> with or without the final comment line, and if I remove the
> final \r\n on the last line, so the last character in the file is 'f',
> it still runs ok.
>
> You say it "completely crashed the program with
> a screen full of error messages before it would run".
> How could it run after having a screen full of error messages?
> What messages did you see? Were they just warnings?
> Were you running this under 4DOS using long command lines
> (greater than 128 characters)?
>

Attn: David Cuny

Hi Rob,

As to all your questions, none of them were an issue. Neither is
Euphoria at fault.

I am using Cuny's latest version of PP 1.01b. PP is the culprit. When I
previously looked at the .ex file it produces, I failed to notice that
it mishandled the last line having the "end if". Thus, PP is having the
problem described, not Euphoria. When I manually put the correct line in
the .ex file, everything worked just fine.

I apologize for missing that last line and bothering you with bogus
feedback.

--
Terry Constant
constant at flash.net

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu