 |
 |
|
 |
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
And of course the condition of the while-loop may be dependant of
the calculations.
--
main(i,_){for(_?--i,main(i+2,"FhhQHFIJD|FQTITFN]zRFHhhTBFHhhTBFysdB"[i]
):5;i&&_>1;printf("%s",_-70?_&1?"[]":" ":(_=0,"\n")),_/=2);} /*- Warp -*/
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
On Thu, 06 May 1999 23:57:54 +0200, Ralf Muschall wrote:
>Nieminen Mika wrote:
>
>> #declare Index+=1;
>> #declare PosX*=1.5;
>> #declare PosY/=2;
>> #declare PosZ-=10;
>
>Agreed, but I think ++ and -- are not necessary.
>OTOH, I'd like to see the equality operator renamed from
>= to == (I always get bitten by writing something like
>#if(foo==bar)
>and then having to correct it).
Don't forget || and &&.
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Nieminen Mika wrote:
>Because #declared identifiers in povray are not macros, while #defined
>identifiers in C are macros.
I have to admit my experience with C programming is extremely
limited. I guess I am confused as to what a "macro" is then.
I assumed that constants were macros. What makes #define a
macro and #declare not a macro? They seem to serve the same
purpose.
(There was actually a small discussion in povray.general entitled
"Macro tutorial" started by Andrew Cocker. I mentioned there that
#define and #declare are the same thing. If this is incorrect I
may have mislead Andrew and others.)
--
...coffee?...yes please! extra sugar,extra cream...Thank you.
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
This reminds me, there was a pure ASM rewite of POV 2.2 i think, crashed
everytime for me tho!!
Rick
GrimDude <vos### [at] arkansas net> wrote in message
news:37321713.0@news.povray.org...
> Aw, what we have now is fine!
>
> I, too, get bit (heh) by things like this. At least you're not doing:
>
> loop:
> inc ax,bitcount
> cmp cx,ax
> jne next_color
> inc cx,01d
> jmp loop
>
> Well, it's been awhile. :)
>
> GrimDude
> vos### [at] arkansas net
>
>
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
On Fri, 07 May 1999 13:46:56 -0400, Phil Clute <pcl### [at] tiac net> wrote:
>I have to admit my experience with C programming is extremely
>limited. I guess I am confused as to what a "macro" is then.
>I assumed that constants were macros. What makes #define a
>macro and #declare not a macro? They seem to serve the same
>purpose.
C's #define lets you do
#define FOO(x,y,z) (x*32+y*z)
which you can then use like a function:
printf( "%d", FOO(1,2,3) );
whereas #declare creates an actual instance of the specified
object and puts it in a "variable." #declare is a lot like the
BASIC "Let" statement.
#macro is pretty much the same as #define, but with a little
different syntax.
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Aah I see! Thanks for your help.
--
...coffee?...yes please! extra sugar,extra cream...Thank you.
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Phil Clute <pcl### [at] tiac net> wrote:
: I have to admit my experience with C programming is extremely
: limited. I guess I am confused as to what a "macro" is then.
: I assumed that constants were macros. What makes #define a
: macro and #declare not a macro? They seem to serve the same
: purpose.
A macro identifier is completely replaced by its value. For example:
#define PrintStatus printf("This is the status\n")
Now you can type something like:
void Function(void)
{ PrintStatus;
}
When parsing, the compiler substitutes the macro, so it converts it to:
void Function(void)
{ printf("This is the status\n");
}
Povray #declared identifiers do _not_ work this way. For example, you can't
make this:
#declare MyTexture=texture { pigment { rgb 1 } }
sphere { 0,1 MyTexture }
Povray does _not_ substitute the identifier "MyTexture" with its value, ie.
the result is _not_ this:
sphere { 0,1 texture { pigment { rgb 1 } } }
Instead, povray will issue an error:
error: No matching } in sphere, texture identifier found instead.
However, #macros work in povray exactly like #defines in C. You can make
this:
#macro MyTexture() texture { pigment { rgb 1 } } #end
sphere { 0,1 MyTexture() }
and it will work.
You can make this same thing in C:
#define MyTexture() texture(whatever)
and when you type "MyTexture()" it will be substituted with
"texture(whatever)" (of course the parenthesis are obsolete here). You can
also give arguments the the #defined macro, just like to the povray
#macro.
A better naming for the commands would be, for example, #let instead
of #declare and #define instead of #macro (although #macro is ok). Of
course it's too late now.
--
main(i,_){for(_?--i,main(i+2,"FhhQHFIJD|FQTITFN]zRFHhhTBFHhhTBFysdB"[i]
):5;i&&_>1;printf("%s",_-70?_&1?"[]":" ":(_=0,"\n")),_/=2);} /*- Warp -*/
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Nieminen Mika wrote:
>Instead, povray will issue an error:
>error: No matching } in sphere, texture identifier found instead.
Oh so that's why! I've tried to do exactly that, and that's the
error message I got.
Thanks
Phil
--
...coffee?...yes please! extra sugar,extra cream...Thank you.
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
I was just looking through textures.inc and I found this:
#declare Shadow_Clouds =
texture { // The blue sky background for the
clouds
pigment { rgb <0.196078, 0.6, 0.8> }
finish { ambient 0.7 diffuse 0 }
}
texture { // The upper part of the clouds
pigment { FBM_Clouds }
finish { ambient 1.0 diffuse 0 }
}
texture { // The darker underside of the clouds
pigment { FBM_Clouds translate -0.15*y }
finish { ambient 0.6 diffuse 0 }
}
This gives the error message you said it would, so I wonder why it's in
there?
--
...coffee?...yes please! extra sugar,extra cream...Thank you.
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
You have to use texture identifiers this way:
sphere { 0,1 texture { MyTexture } }
--
main(i,_){for(_?--i,main(i+2,"FhhQHFIJD|FQTITFN]zRFHhhTBFHhhTBFysdB"[i]
):5;i&&_>1;printf("%s",_-70?_&1?"[]":" ":(_=0,"\n")),_/=2);} /*- Warp -*/
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |