1. loopy loop execution

This has happened several times now, and i don't know why. I have
a while loop, and the only way out of it is thru these three exits:



if match("GIF87",upperTheWebPage) then
         TheRadarPic = TheWebPage
         exit
       end if
       if match("GIF89",upperTheWebPage) then
         TheRadarPic = TheWebPage
         exit
       end if
       if match("JFIF",upperTheWebPage) and match("=FF=D9<!--- eof ---
>",TheWebPage) then
         TheRadarPic = TheWebPage
         exit
       end if

Now along comes a file (TheWebPage) containing ONLY :
<!--- EOF --->

and the program exits the while loop, and where TheWebPage was
pronounced to be 16 chars long by this line:

puts(1,sprintf("%d",length(TheWebPage))&" -- ")

TheRadarPic is now 0 bytes long, said by this line:

puts(1,sprintf("%d",length(TheRadarPic))&"\n")

So my questions are, how is it getting out of the while loop?, and
how is the length being changed? This is an intermittant problem, it
doesn't always do this, it's like a once-a-day thing.

Kat,
forgot to have with trace,
but has it on now.....

new topic     » topic index » view message » categorize

2. Re: loopy loop execution

Kat wrote:
> 
> 
> and the program exits the while loop, and where TheWebPage was
> pronounced to be 16 chars long by this line:
> 
> puts(1,sprintf("%d",length(TheWebPage))&" -- ")
> 
> TheRadarPic is now 0 bytes long, said by this line:
> 
> puts(1,sprintf("%d",length(TheRadarPic))&"\n")
> 
> So my questions are, how is it getting out of the while loop?, and
> how is the length being changed? This is an intermittant problem, it
> doesn't always do this, it's like a once-a-day thing.
> 

I guess my first suspicion would be that there's a disconnect between
TheWebPage and upperTheWebPage.  Maybe try something like:
printf(1, "TheWebPage %d upperTheWebPage %d TheRadarPic %d\n",
    { length(TheWebPage), length(upperTheWebPage), length(TheRadarPic) })

Also, I'm assuming that you've got }}}
<eucode>while 1 do</eucode>
{{{
 (or the
equivalent) as the while loop.
 
Matt Lewis

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

3. Re: loopy loop execution

Kat wrote:
> and the program exits the while loop, and where TheWebPage was
> pronounced to be 16 chars long by this line:

Kat:

   You aren't taking into account the CR and Linefeed which
 would be the two characters.

Bernie

My files in archive:
WMOTOR, XMOTOR, W32ENGIN, MIXEDLIB, EU_ENGIN, WIN32ERU, WIN32API 

Can be downloaded here:
http://www.rapideuphoria.com/cgi-bin/asearch.exu?dos=on&win=on&lnx=on&gen=on&keywords=bernie+ryan

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

4. Re: loopy loop execution

> 
> 
> posted by: Matt Lewis <matthewwalkerlewis at gmail.com>
> 
> Kat wrote:
> > 
> > 
> > and the program exits the while loop, and where TheWebPage was
> > pronounced to be 16 chars long by this line:
> > 
> > puts(1,sprintf("%d",length(TheWebPage))&" -- ")
> > 
> > TheRadarPic is now 0 bytes long, said by this line:
> > 
> > puts(1,sprintf("%d",length(TheRadarPic))&"\n")
> > 
> > So my questions are, how is it getting out of the while loop?, and
> > how is the length being changed? This is an intermittant problem, it
> > doesn't always do this, it's like a once-a-day thing.
> > 
> 
> I guess my first suspicion would be that there's a disconnect between
> TheWebPage and upperTheWebPage. 

upperTheWebPage = upper(TheWebPage)

> Maybe try something like: }}}
<eucode>
> printf(1, "TheWebPage %d upperTheWebPage %d TheRadarPic %d\n",
>     { length(TheWebPage), length(upperTheWebPage), length(TheRadarPic)
>     })
> </eucode>
{{{

> Also, I'm assuming that you've got }}}
<eucode>while 1 do</eucode>
{{{
 (or the
> equivalent) as the while loop.

It's 
while equal(TheWebPage,"") do


and the bottom of the loop sets TheWebPage back to "" if it hasn't 
exited already. So does the start of the loop, and the line before 
the loop. Full code for the loop is at 
http://designerthinking.com/temp/whiledemo.e

The same loop is in use in other apps, which would crash horribly if 
it made the same error as this app is doing, same as this app is 
crashing.

Kat

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

5. Re: loopy loop execution

> 
> 
> posted by: Bernie Ryan <xotron at bluefrog.com>
> 
> Kat wrote:
> > and the program exits the while loop, and where TheWebPage was
> > pronounced to be 16 chars long by this line:
> 
> Kat:
> 
>    You aren't taking into account the CR and Linefeed which
>  would be the two characters.

So? It isn't exiting on length, it's exiting on the false match of a 
picture header in the file, which isn't there.

Kat

> Bernie
> 
> My files in archive:
> WMOTOR, XMOTOR, W32ENGIN, MIXEDLIB, EU_ENGIN, WIN32ERU, WIN32API 
> 
> Can be downloaded here:
> http://www.rapideuphoria.com/cgi-bin/asearch.exu?dos=on&win=on&lnx=on&
> gen=on&keywords=bernie+ryan
> 
> 
> 
>

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

Search



Quick Links

User menu

Not signed in.

Misc Menu