POV-Ray : Newsgroups : povray.beta-test : semicolon not expected Server Time
30 Jul 2024 08:21:14 EDT (-0400)
  semicolon not expected (Message 11 to 18 of 18)  
<<< Previous 10 Messages Goto Initial 10 Messages
From: Rune
Subject: Re: semicolon not expected
Date: 7 Jan 2002 17:46:22
Message: <3c3a253e@news.povray.org>
"Christopher James Huff" wrote:
> If you wrap the conditional in parentheses, it will work fine

Yes, I use that trick all the time...

Rune
--
3D images and anims, include files, tutorials and more:
Rune's World:    http://rsj.mobilixnet.dk (updated Jan 2)
POV-Ray Users:   http://rsj.mobilixnet.dk/povrayusers/
POV-Ray Webring: http://webring.povray.co.uk


Post a reply to this message

From: Mike Williams
Subject: Re: semicolon not expected
Date: 7 Jan 2002 17:49:16
Message: <jkJfWHAWefO8EwOg@econym.demon.co.uk>

>On Mon, 07 Jan 2002 13:18:44 +0100, "Thorsten Froehlich" <tho### [at] trfde>
>wrote:
>> Semicolons are listed as required after every #local, #declare and #version
>> with a float, vector or color value.  If you don't include the required
>> semicolon the problem is in your scene and the parser reports it as soon as
>> it is possible to report this.
>
>I think you misunderstand my report so I post shorter example:
>
>#macro Test2() #if(yes) 2 #end #end
>#local F=Test2();
>
>note: there is semicolon but parser expects object or directive

But POV macros behave as if they were *macros* not functions.

If POV macros behaved like *functions* then Test2() would return the
value "2". "2" is a float, so you'd expect a semicolon to be
permissible.

Since POV macros behave like *macros*, Test2() behaves as if it returns
the code "#if(yes) 2 #end".


So 
        #macro Test2() #if(yes) 2 #end #end
        #local F=Test2();
behaves like the illegal statement
        #local F=#if(yes) 2 #end;


Note that this is legal:
        #macro Test2() (#if(yes) 2 #end) #end
        #local F=Test2();
Because that behaves like the legal statement
        #local F=(#if(yes) 2 #end);

-- 
Mike Williams
Gentleman of Leisure


Post a reply to this message

From: Warp
Subject: Re: semicolon not expected
Date: 7 Jan 2002 18:25:08
Message: <3c3a2e54@news.povray.org>
Mike Williams <mik### [at] nospamplease> wrote:
: But POV macros behave as if they were *macros* not functions.

  In fact, POV-Ray macros do not work like real substitution macros
(like the #defined macros in C).
  This:

    #macro A()
      #local a = 5;
    #end
    #local a = 6;
    A()

is *not* the same as:

    #local a = 6;
    #local a = 5;

  I think that at low-level the difference between pov-macros and C-macros
is that in the latter the macro body is truely placed in the place of the
macro call by the pre-compiler (and then the actual compiler sees just this
but has no knowledge of the original macro), while in POV-Ray the macro is
parsed where it is, without making a real substitution. The difference is
very tenuous and most of the time it has no effect, but in some cases it
has (like when you use #local identifiers inside the macro).

-- 
#macro M(A,N,D,L)plane{-z,-9pigment{mandel L*9translate N color_map{[0rgb x]
[1rgb 9]}scale<D,D*3D>*1e3}rotate y*A*8}#end M(-3<1.206434.28623>70,7)M(
-1<.7438.1795>1,20)M(1<.77595.13699>30,20)M(3<.75923.07145>80,99)// - Warp -


Post a reply to this message

From:
Subject: Re: semicolon not expected
Date: 8 Jan 2002 02:18:03
Message: <e27l3uo56s3vv86e0rcf75ngov3v340ava@4ax.com>
On Mon, 7 Jan 2002 19:31:34 +0000, Mike Williams <mik### [at] nospamplease> wrote:

> behaves like the illegal statement
>        #local F=#if(yes) 2 #end;

I agree paranthesis are best workaround but IMO there is no place in
documentation where above is listed as illegal.

ABX


Post a reply to this message

From: ingo
Subject: Re: semicolon not expected
Date: 8 Jan 2002 06:42:20
Message: <Xns91908178BAC86seed7@povray.org>

wrote:

> [..] IMO there is no place in
> documentation where above is listed as illegal.

I'll see what I can do about it.

Ingo


Post a reply to this message

From:
Subject: Re: semicolon not expected
Date: 8 Jan 2002 07:00:36
Message: <imnl3ugieel5s8n4du2t2noe339ctren0k@4ax.com>
On 8 Jan 2002 06:42:20 -0500, ingo <ing### [at] homenl> wrote:
> > [..] IMO there is no place in
> > documentation where above is listed as illegal.
>
> I'll see what I can do about it.

Wait for the team. Perhaps it is yet a bug.

ABX


Post a reply to this message

From: Thorsten Froehlich
Subject: Re: semicolon not expected
Date: 9 Jan 2002 12:53:56
Message: <3c3c83b4@news.povray.org>

Skiba <abx### [at] babilonorg>  wrote:

> Wait for the team. Perhaps it is yet a bug.

No, if this worked the way in 3.1 it was by design hat only macros may
return data.  I don't see a point in changing something that worked this way
before without problems, also it doesn't work as one would expect as a
programmer it is still deterministic and an easy rule for users.

    Thorsten

____________________________________________________
Thorsten Froehlich, Duisburg, Germany
e-mail: tho### [at] trfde

Visit POV-Ray on the web: http://mac.povray.org


Post a reply to this message

From: Ron Parker
Subject: Re: semicolon not expected
Date: 14 Jan 2002 16:06:36
Message: <slrna46i2u.bc5.ron.parker@fwi.com>
On 7 Jan 2002 09:00:15 -0500, Warp wrote:

>: #macro Test2() #if(yes) 2 #end #end
>: #local F=Test2();
> 
>   Isn't the "right way" of returning values from a macro something like:
> 
> #macro Test2() #if(yes) #local res=2; #end res #end

Except for that minor detail of it causing crashes when you return a local.

-- 
#local R=rgb 99;#local P=R-R;#local F=pigment{gradient x}box{0,1pigment{gradient
y pigment_map{[.5F pigment_map{[.3R][.3F color_map{[.15red 99][.15P]}rotate z*45
translate x]}]#local H=pigment{gradient y color_map{[.5P][.5R]}scale 1/3}[.5F
pigment_map{[.3R][.3H][.7H][.7R]}]}}}camera{location.5-3*z}//only my opinions


Post a reply to this message

<<< Previous 10 Messages Goto Initial 10 Messages

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.