1. Oops

------=_NextPart_000_0012_01BE8187.0CA72040
        charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

I had some typos with that previous mail the type should read like this:

type RGB_Trip(sequence redgreenblue)

   integer l, i

   l =3D length(redgreenblue)
   if l !=3D 3 then
      return 0
   end if
   for i =3D 1 to 3 do
      if sequence(redgreenblue[i]) then
         return 0
      elsif redgreenblue[i] < 0 then
         return 0
      elsif redgreenblue[i] > #FF then
         return 0
      end if

   end for

end type


------=_NextPart_000_0012_01BE8187.0CA72040
        charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD W3 HTML//EN">
<HTML>
<HEAD>

<META content=3Dtext/html;charset=3Diso-8859-1 =
http-equiv=3DContent-Type>
<META content=3D'"MSHTML 4.72.3110.7"' name=3DGENERATOR>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT color=3D#000000 size=3D2>I had some typos with that previous =
mail the=20
type should read like this:</FONT></DIV>
<DIV><FONT color=3D#000000 size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT color=3D#000000 size=3D2>type RGB_Trip(sequence=20
redgreenblue)</FONT></DIV>
<DIV><FONT color=3D#000000 size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT color=3D#000000 size=3D2>&nbsp;&nbsp; integer l, =
i</FONT></DIV>
<DIV><FONT color=3D#000000 size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT color=3D#000000 size=3D2>&nbsp;&nbsp; l =3D=20
length(redgreenblue)<BR>&nbsp;&nbsp; if l !=3D 3=20
then<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return 0<BR>&nbsp;&nbsp; end=20
if<BR>&nbsp;&nbsp; for i =3D 1 to 3 do<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
if=20
sequence(redgreenblue[i])=20
then<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return=20
0<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; elsif redgreenblue[i] &lt; 0=20
then<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return=20
0<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; elsif redgreenblue[i] &gt; #FF=20
then<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return=20
0<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; end if</FONT></DIV>
<DIV><FONT color=3D#000000 size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT color=3D#000000 size=3D2>&nbsp;&nbsp; end for</FONT></DIV>
<DIV><FONT color=3D#000000 size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT color=3D#000000 size=3D2>end =

------=_NextPart_000_0012_01BE8187.0CA72040--

new topic     » topic index » view message » categorize

2. Re: Oops

EU>I had some typos with that previous mail the type should read like this:

EU>type RGB_Trip(sequence redgreenblue)

EU>   integer l, i

EU>   l = length(redgreenblue)
EU>   if l != 3 then
EU>      return 0
EU>   end if
EU>   for i = 1 to 3 do
EU>      if sequence(redgreenblue[i]) then
EU>         return 0
EU>      elsif redgreenblue[i] < 0 then
EU>         return 0
EU>      elsif redgreenblue[i] > #FF then
EU>         return 0
EU>      end if

EU>   end for

EU>end type


The error is at the second line. You can't define variables that you are
going to use in a for statement - they are defined automatically. Just
remove i from the declaration, and it'll work.

Jeffrey Fielding
JJProg at cyberbury.net
http://members.tripod.com/~JJProg/

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

3. Re: Oops

--X-X-X-X-X-X--NeoPlanet-MIME-Attachment--X-X-X-X-X-X-X19474388-X


Content-Transfer-Encoding:7bit

Ok, now can anyone tell me why this program doesn't work.

Content-Transfer-Encoding:7bit





--X-X-X-X-X-X--NeoPlanet-MIME-Attachment--X-X-X-X-X-X-X19474388-X

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

4. Re: Oops

I can't actually try "executing" your wif.e file, since I don't
have fileman.e.

But I do notice one thing right away... in your Encode() function,
you declare the variable Encoded to be of type WIF. But you then
immediately refer to:

   Encoded[WIF_PalRef]

before you've assigned any value to the variable! You're doing the
same thing in your UnEncode() function too. Declaring a variable
doesn't actually fill it in Euphoria... you still must put in some
valid data (in this case, an sequence that is a valid WIF type)
before you can use it. I sometimes declare a DEFAULT_type constant
with my built-in types; if a type requires a sequence of length 5,
I'll have:

   constant DEFAULT_MY_TYPE = {0,0,0,0,0}

and then assign the constant to variables of that type before
using them.

There may be more logic errors, but that was the most obvious one I
saw from just glancing at the code. I take it you're still using the
public domain version of Euphoria, or does the code crash before it
gets to those functions?


Rod Jackson

----------
From:   theskaman at mindspring.com[SMTP:theskaman at mindspring.com]
Sent:   Thursday, April 08, 1999 7:00 AM
To:     EUPHORIA at LISTSERV.MUOHIO.EDU
Subject:        Re: Oops

<<File: ATT00002.html>><<File: WIF.E>><<File: wiftest.ex>>
Ok, now can anyone tell me why this program doesn't work.

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

5. Re: Oops

I believe the following is illegal:

integer i

for i = 1 to 666 do
end for

Change the for...end for loop variable and it'll be okay.

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

6. Re: Oops

"C. K. Lester" wrote:
>
> I believe the following is illegal:
>
> integer i
>
> for i = 1 to 666 do
> end for
>
> Change the for...end for loop variable and it'll be okay.

   Reading Refman.doc, it says that loop variables are "not even
 declared outside of the loop". It seems to me that the above
 should be legal. However, I tried it it causes an error.

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

7. Re: Oops

At 02:56 PM 4/9/99 -0400, you wrote:
>"C. K. Lester" wrote:
>>
>> I believe the following is illegal:
>>
>> integer i
>>
>> for i = 1 to 666 do
>> end for
>>
>> Change the for...end for loop variable and it'll be okay.
>
>   Reading Refman.doc, it says that loop variables are "not even
> declared outside of the loop". It seems to me that the above
> should be legal. However, I tried it it causes an error.

However, the following is legal:

integer k

for i = 1 to any_number do
end for

integer i

...as long as any loops thereafter do not use 'i'. Right?

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

8. Re: Oops

"C. K. Lester" <cklester at TICNET.COM> wrote:
>>
>>   Reading Refman.doc, it says that loop variables are "not even
>> declared outside of the loop". It seems to me that the above
>> should be legal. However, I tried it it causes an error.
>
>However, the following is legal:
>
>integer k
>
>for i = 1 to any_number do
>end for
>
>integer i
>
>...as long as any loops thereafter do not use 'i'. Right?

Correct. The following, by the way, is also legal:

integer i

procedure whatever()
   for i = 1 to 100 do
   end for
end procedure

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

Search



Quick Links

User menu

Not signed in.

Misc Menu