 |
 |
|
 |
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Hello
I'm trying to make some macros to enable me to
experiment with different rotation matrix's. (That I
later will apply to 3D vectors to get the desired
rotation of the vector.)
I know about the built in rotate functions in POV-Ray.
I just want to learn about rotation matrix's.
Each matrix is built up as an array of 3 3D-vectors
each. And my macros again operate on these arrays.
My problem is that I get several different error
messages when I try to Run the file below in this
message (I did not alter it between the Runs).
Can anyone please tell me if I am doing anything wrong
in my macros? (variable passing, variable declarations,
variable name conflicts etc.)
I am using POV-Ray v3.1g.watcom.win32 (Pentium II
optimized) and I am using a 100 MHz Pentium PC with
32 MB RAM, running Windows 98.
Regards
Tor Olav
mailto:tor### [at] hotmail com
http://www.crosswinds.net/~tok/tokrays.html
Here is some of the error messages:
Warning Stream to console.......On
#local PP = array[3]
#local QQ = array[3]
#local PP = Mtrans(NN)
#local NN <----ERROR
C:\My documents\POVray-bilder\Matrix03_.inc:39: error: undeclared
identifier expected but float function 'clock_delta' found instead.
Warning Stream to console.......On
#local PP = array[3]
#local QQ = array[3]
#local PP = Mtrans(NN)
#local NN <----ERROR
C:\My documents\POVray-bilder\Matrix03_.inc:39: error: undeclared
identifier expected but float function 'tan' found instead.
Warning Stream to console.......On
#local PP = array[3]
#local QQ = array[3]
#local PP = Mtrans(NN)
#local NN <----ERROR
C:\My documents\POVray-bilder\Matrix03_.inc:39: error: undeclared
identifier expected but float function 'on' found instead.
Warning Stream to console.......On
#local PP = array[3]
#local QQ = array[3]
#local PP = Mtrans(NN)
#local NN <----ERROR
C:\My documents\POVray-bilder\Matrix03_.inc:39: error: undeclared
identifier expected but float function 'abs' found instead.
Warning Stream to console.......On
#local PP = array[3]
#local QQ = array[3]
#local PP = Mtrans(NN)
#local NN <----ERROR
C:\My documents\POVray-bilder\Matrix03_.inc:39: error: undeclared
identifier expected but float function found instead.
Warning Stream to console.......On
#)
#local PP = array[3]
#local QQ = array[3]
#local PP = Mtrans(NN <----ERROR
C:\My documents\POVray-bilder\Matrix03_.inc:54: error: Cannot pass
uninitialized identifier as macro parameter.
Initialize first.
Warning Stream to console.......On
#local QQ = array[3]
#local PP = Mtrans(NN)
#local NN = array[3]
#local NN[0] = <MM[0] <----ERROR
C:\My documents\POVray-bilder\Matrix03_.inc:40: error: Attempt to access
uninitialized array element.
Here is the POV-file that generates the errors:
// =============================================================
//
// Copyright 2000 by Tor Olav Kristensen
//
// =============================================================
#macro S3Prod(U, V, W)
vdot(U, vcross(V, W))
#end
#macro Mcof(MM)
#local NN = array[3]
#local NN[0] = vcross(MM[1], MM[2]);
#local NN[1] = vcross(MM[2], MM[0]);
#local NN[2] = vcross(MM[0], MM[1]);
NN
#end
#macro Mdet(MM)
S3Prod(MM[0], MM[1], MM[2])
#end
#macro Mtrans(MM)
#local NN = array[3]
#local NN[0] = <MM[0].x, MM[1].x, MM[2].x>;
#local NN[1] = <MM[0].y, MM[1].y, MM[2].y>;
#local NN[2] = <MM[0].z, MM[1].z, MM[2].z>;
NN
#end
#macro Mmult(MM, NN)
#local PP = array[3]
#local QQ = array[3]
#local PP = Mtrans(NN)
#local QQ[0] = <vdot(MM[0], PP[0]), vdot(MM[0], PP[1]), vdot(MM[0],
PP[2])>;
#local QQ[1] = <vdot(MM[1], PP[0]), vdot(MM[1], PP[1]), vdot(MM[1],
PP[2])>;
#local QQ[2] = <vdot(MM[2], PP[0]), vdot(MM[2], PP[1]), vdot(MM[2],
PP[2])>;
QQ
#end
#macro Mscale(s, MM)
#local NN = array[3]
#local NN[0] = s*MM[0];
#local NN[1] = s*MM[1];
#local NN[2] = s*MM[2];
MM
#end
#macro Minv(MM)
#local NN = array[3]
#local PP = array[3]
#local QQ = array[3]
#local s = 1/Mdet(MM);
#local NN = Mcof(MM)
#local PP = Mtrans(NN)
#local QQ = Mscale(s, PP)
QQ
#end
#declare MMi =
array[3] {
< 2, 0, 6>,
< 8, 1, -4>,
< 0, 5, 7>
}
#declare QQi = array[3]
#declare QQi = Minv(MMi)
#declare RRi = array[3]
#declare RRi = Mmult(MMi, Minv(MMi))
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
What do you have for the version number in the scene. That can effect which
features are enabled or not. Also, are you using MegaPov? I usuall have to
add #version unofficial MegaPov 0.4; to my scenes to get those to work.
Josh
Tor Olav Kristensen wrote:
> Hello
>
> I'm trying to make some macros to enable me to
> experiment with different rotation matrix's. (That I
> later will apply to 3D vectors to get the desired
> rotation of the vector.)
>
> I know about the built in rotate functions in POV-Ray.
> I just want to learn about rotation matrix's.
>
> Each matrix is built up as an array of 3 3D-vectors
> each. And my macros again operate on these arrays.
>
> My problem is that I get several different error
> messages when I try to Run the file below in this
> message (I did not alter it between the Runs).
>
> Can anyone please tell me if I am doing anything wrong
> in my macros? (variable passing, variable declarations,
> variable name conflicts etc.)
>
> I am using POV-Ray v3.1g.watcom.win32 (Pentium II
> optimized) and I am using a 100 MHz Pentium PC with
> 32 MB RAM, running Windows 98.
>
> Regards
>
> Tor Olav
>
> mailto:tor### [at] hotmail com
> http://www.crosswinds.net/~tok/tokrays.html
>
<snip>
--
Josh English
eng### [at] spiritone com
"May your hopes, dreams, and plans not be destroyed by a few zeros."
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
I know that these are not directly part of the problem,
but, s seems to be flagged as a reserved word in MegaPOV.
Tor Olav Kristensen wrote:
>
> Hello
>
> I'm trying to make some macros to enable me to
> experiment with different rotation matrix's. (That I
> later will apply to 3D vectors to get the desired
> rotation of the vector.)
>
><snip>
>
> #macro Mscale(s, MM)
>
> #local NN = array[3]
> #local NN[0] = s*MM[0];
> #local NN[1] = s*MM[1];
> #local NN[2] = s*MM[2];
>
> MM
>
> #end
>
> #macro Minv(MM)
>
> #local NN = array[3]
> #local PP = array[3]
> #local QQ = array[3]
> #local s = 1/Mdet(MM);
> #local NN = Mcof(MM)
> #local PP = Mtrans(NN)
> #local QQ = Mscale(s, PP)
>
> QQ
>
> #end
--
Mr. Art
"Often the appearance of reality is more important
than the reality of the appearance."
Bill DeWitt 2000
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Hi Josh
Thanks for replying.
Josh English wrote:
>
> What do you have for the version number in the scene. That can effect which
> features are enabled or not.
I had not put any #version declaration in the file.
But now I did try to insert
#version 3.1;
at the beginning of the file, but the problems persists.
I still get wildly changing error messages for the same file.
(I even got new ones.)
> Also, are you using MegaPov? I usuall have to
> add #version unofficial MegaPov 0.4; to my scenes to get those to work.
No, I am using plain POV-Ray v3.1g for Windows
Regards
Tor Olav
mailto:tor### [at] hotmail com
http://www.crosswinds.net/~tok/tokrays.html
> Tor Olav Kristensen wrote:
>
> > Hello
> >
> > I'm trying to make some macros to enable me to
> > experiment with different rotation matrix's. (That I
> > later will apply to 3D vectors to get the desired
> > rotation of the vector.)
> >
> > I know about the built in rotate functions in POV-Ray.
> > I just want to learn about rotation matrix's.
> >
> > Each matrix is built up as an array of 3 3D-vectors
> > each. And my macros again operate on these arrays.
> >
> > My problem is that I get several different error
> > messages when I try to Run the file below in this
> > message (I did not alter it between the Runs).
> >
> > Can anyone please tell me if I am doing anything wrong
> > in my macros? (variable passing, variable declarations,
> > variable name conflicts etc.)
> >
> > I am using POV-Ray v3.1g.watcom.win32 (Pentium II
> > optimized) and I am using a 100 MHz Pentium PC with
> > 32 MB RAM, running Windows 98.
> >
> > Regards
> >
> > Tor Olav
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Hello mr. art
Thanks for replying.
Right now I did try to replace the s with other
variable names, but it didn't stop those ever-
changing error messages.
I'm just using plain POV-Ray (v3.1g) for Windows
(Not MegaPOV).
I looked up reserved identifiers and keywords in
the help file, but I could not find 's' listed
for this plain version of POV-Ray.
Regards
Tor Olav
mailto:tor### [at] hotmail com
http://www.crosswinds.net/~tok/tokrays.html
"mr.art" wrote:
>
> I know that these are not directly part of the problem,
> but, s seems to be flagged as a reserved word in MegaPOV.
>
> Tor Olav Kristensen wrote:
> >
> > Hello
> >
> > I'm trying to make some macros to enable me to
> > experiment with different rotation matrix's. (That I
> > later will apply to 3D vectors to get the desired
> > rotation of the vector.)
> >
> ><snip>
> >
> > #macro Mscale(s, MM)
> >
> > #local NN = array[3]
> > #local NN[0] = s*MM[0];
> > #local NN[1] = s*MM[1];
> > #local NN[2] = s*MM[2];
> >
> > MM
> >
> > #end
> >
> > #macro Minv(MM)
> >
> > #local NN = array[3]
> > #local PP = array[3]
> > #local QQ = array[3]
> > #local s = 1/Mdet(MM);
> > #local NN = Mcof(MM)
> > #local PP = Mtrans(NN)
> > #local QQ = Mscale(s, PP)
> >
> > QQ
> >
> > #end
>
> --
> Mr. Art
>
> "Often the appearance of reality is more important
> than the reality of the appearance."
> Bill DeWitt 2000
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Tor Olav Kristensen wrote:
>
> My problem is that I get several different error
> messages when I try to Run the file below in this
> message (I did not alter it between the Runs).
I have sometimes gotten error messages that seemed like the
wrong error message. If I recall correctly, it turned out that
the actual error was at some point earlier than what the parser
flagged.
--
ICQ: 46085459
Post a reply to this message
|
 |
|  |
|  |
|
 |
From: Vahur Krouverk
Subject: Re: Different error messages for same POV-file
Date: 14 Mar 2000 03:39:23
Message: <38CDFB03.F82A8CEA@aetec.ee>
|
|
 |
|  |
|  |
|
 |
Tor Olav Kristensen wrote:
>
> Hello
>
Hello.
Just a thought: try to add semicolons to lines, where they are
missing...
Post a reply to this message
|
 |
|  |
|  |
|
 |
From: Tor Olav Kristensen
Subject: Re: Different error messages for same POV-file
Date: 14 Mar 2000 17:29:10
Message: <38CEBC39.582A511F@online.no>
|
|
 |
|  |
|  |
|
 |
Hello John
I too have got error messages pointing to the
wrong point in my code when my error(s) were
hidden somewhere earlier.
In these cases I just had to start commenting
out code, changing variable names and moving
things around until the error messages points
at my real error.
I suspect that this may also be the case here,
and I have therefore tried to play around with
my code before posting to this newsgroup... But
I haven't had any luck smoking out my(?) errors
yet.
But I have found out that if I replace the last
line of these four:
#declare QQi = array[3]
#declare QQi = Minv(MMi)
#declare RRi = array[3]
#declare RRi = Mmult(MMi, Minv(MMi))
with
#declare RRi = Mmult(MMi, QQi)
then the error messages disappear.
This may be my solution for this time, but the
problem still bothers me, because I want to be
able to replace macros like e.g. this one:
#macro Minv(MM)
#local NN = array[3]
#local PP = array[3]
#local QQ = array[3]
#local s = 1/Mdet(MM);
#local NN = Mcof(MM)
#local PP = Mtrans(NN)
#local QQ = Mscale(s, PP)
QQ
#end
with macors like this one:
#macro Minv(MM)
Mscale(1/Mdet(MM), Mtrans(Mcof(MM)))
#end
Lately I have also found that it seems that
the more I do of the substitutions like the
one above, the more it seems likely that I
start getting those random changing error
messages I have described earlier.
(It seems like I can do some substitutions
without being punished.)
And now I don't know how to proceed in my
hunt for these errors.
Am I the only one who is getting changing
error messages when running the code I
enclosed in my initial posting?
Regards
Tor Olav
mailto:tor### [at] hotmail com
http://www.crosswinds.net/~tok/tokrays.html
John VanSickle wrote:
>
> Tor Olav Kristensen wrote:
> >
> > My problem is that I get several different error
> > messages when I try to Run the file below in this
> > message (I did not alter it between the Runs).
>
> I have sometimes gotten error messages that seemed like the
> wrong error message. If I recall correctly, it turned out that
> the actual error was at some point earlier than what the parser
> flagged.
>
> --
> ICQ: 46085459
Post a reply to this message
|
 |
|  |
|  |
|
 |
From: Tor Olav Kristensen
Subject: Re: Different error messages for same POV-file
Date: 14 Mar 2000 18:09:40
Message: <38CEC5B6.C3C921B1@online.no>
|
|
 |
|  |
|  |
|
 |
Hi Vahur
Vahur Krouverk wrote:
>
> Tor Olav Kristensen wrote:
> >
> > Hello
> >
> Hello.
>
> Just a thought: try to add semicolons to lines, where they are
> missing...
Hmm...
I have been a little bit worried about my use of semicolons.
Earlier I have seen that too many missing semicolons can
cause crashes of POV-Ray (on my Windows 98 machine at home,
and if I remember right, also on my Windows NT4 machine at
work).
Therefore I have looked through my code to make sure that I
had put them where I thought they should be.
But your reply (thank you btw.) made me check both my code
and the help file once again.
Here are my (rather lengthy) findings:
When POV-Ray parses my file, I do not get any warning
messages like this one:
warning: All #versions and #declares of float, vector, and
color require semi-colon ';' at end.
So everything apparently looked fine, but I thought that
maybe my array declarations should have some semi-colons as
well (even if array declarations aren't mentioned in
messages like the one above.)
In the help file for Windows didn't have any luck finding
explicit instructions about whether I should use semi-colons
after array declarations or not.
But I found two code examples of array declarations:
The first one
8< snip
#declare MyArray = array[10];
#declare MyArray[5] = pigment{White} //all other elements must be
//pigments too.
8< snip
used semi-colon, and the second one
8< snip
#declare MyArray = array[10]
#declare MyGrid = array[4][5]
#declare YourArray = MyArray //this is ok
8< snip
did not.
So now I thought that I should try to insert some of them
after my array declarations.
So I did, but now the parser started complaining about these
semi-colons:
#declare NNi = array[3]; <----ERROR
error: object or directive expected but ; found instead.
... So now I am totally confused about semi-colons!
;(
Regards
Tor Olav
--
mailto:tor### [at] hotmail com
http://www.crosswinds.net/~tok/tokrays.html
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Tor Olav Kristensen wrote:
>
> I have been a little bit worried about my use of semicolons.
>
> Earlier I have seen that too many missing semicolons can
> cause crashes of POV-Ray (on my Windows 98 machine at home,
> and if I remember right, also on my Windows NT4 machine at
> work).
This is new to me. You mean the machine crached? Or just POV quit parsing?
Usually, missing semi-colons should only produce warnings (at least in the
current version). Only in some macros have I seen actual errors caused by them.
> ... So now I am totally confused about semi-colons!
>
Semi-colons should only go after declarations of floats and vectors (colours can
also be thought of as vectors).
If you are declaring an array, it should not have a semi-colon:
#declare MyArray=array[10]
If the docs said otherwse, this is a typo. However, if you are declaring an
element of an array, and that element is a float or a vector, it should have a
semi-colon:
#declare MyArray[0]=11.5;
See docs section "Declaring identifiers" for further reference.
Margus
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Tor Olav Kristensen wrote:
>
> Hello John
>
> I too have got error messages pointing to the
> wrong point in my code when my error(s) were
> hidden somewhere earlier.
>
> In these cases I just had to start commenting
> out code, changing variable names and moving
> things around until the error messages points
> at my real error.
>
> I suspect that this may also be the case here,
> and I have therefore tried to play around with
> my code before posting to this newsgroup... But
> I haven't had any luck smoking out my(?) errors
> yet.
>
> But I have found out that if I replace the last
> line of these four:
>
> #declare QQi = array[3]
> #declare QQi = Minv(MMi)
>
> #declare RRi = array[3]
> #declare RRi = Mmult(MMi, Minv(MMi))
>
> with
>
> #declare RRi = Mmult(MMi, QQi)
>
> then the error messages disappear.
There appears to be a bug in macro argument parsing. Sometimes when
I #declare a value using a macro, the semicolon at the end of the
declare statement is flagged as an error, and when it's absent a
warning message is displayed.
Regards,
John
--
ICQ: 46085459
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Margus Ramst wrote:
>
> Tor Olav Kristensen wrote:
> >
> > I have been a little bit worried about my use of semicolons.
> >
> > Earlier I have seen that too many missing semicolons can
> > cause crashes of POV-Ray (on my Windows 98 machine at home,
> > and if I remember right, also on my Windows NT4 machine at
> > work).
>
> This is new to me. You mean the machine crached? Or just POV quit parsing?
> Usually, missing semi-colons should only produce warnings (at least in the
> current version). Only in some macros have I seen actual errors caused by them.
>
I mean that as far as I remember, POV-Ray stopped executing and Windows
gave me an error message like:
This application has performed an illegal operation...
(When I restarted POV-Ray, reloaded the offending POV-file and tried
to run it again, I got the same crash. And when I thereafter added all
the
necessary semi-colons POV-Ray executed correctly again.)
Earlier I had not got used to typing semi-colons at the end of float
and vector declarations, so I saw these error messages once or twice a
month or so, but now I usually forget very few of the semi-colons, so I
seldom see these crashes.
If it happens again I will provide you with the offending POV-file.
Btw. Do you have any idea of how POV-Ray manage to give me several
different error messages after successive runs (without me altering
my code or any settings in POV-Ray) ?
For me this seems like POV-Ray is in error ...
(Or could my error trigger several error messages, where only a
random selected one is printed each time?)
The funny thing is that none of the keywords ('clock_delta', 'tan',
'on') that POV-Ray claims it found in a wrong place, appears in my
POV-file.
error: undeclared identifier expected but float function 'clock_delta'
found instead.
> > ... So now I am totally confused about semi-colons!
> >
>
> Semi-colons should only go after declarations of floats and vectors (colours can
> also be thought of as vectors).
> If you are declaring an array, it should not have a semi-colon:
>
> #declare MyArray=array[10]
>
> If the docs said otherwse, this is a typo. However, if you are declaring an
> element of an array, and that element is a float or a vector, it should have a
> semi-colon:
>
Thanks for clarifying!
> #declare MyArray[0]=11.5;
>
> See docs section "Declaring identifiers" for further reference.
>
> Margus
Regards
Tor Olav
--
mailto:tor### [at] hotmail com
http://www.crosswinds.net/~tok/tokrays.html
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
In article <38D04348.E90DFF94@hotmail.com>, Tor Olav Kristensen
<tor### [at] hotmail com> wrote:
> Earlier I had not got used to typing semi-colons at the end of float
> and vector declarations, so I saw these error messages once or twice a
> month or so, but now I usually forget very few of the semi-colons, so I
> seldom see these crashes.
I really wish POV-Ray would accept, if not require, semicolons at the
end of declarations. It should be a simple modification to make, at
least for someone who understands the declaration code(I don't).
> Btw. Do you have any idea of how POV-Ray manage to give me several
> different error messages after successive runs (without me altering
> my code or any settings in POV-Ray) ?
>
> For me this seems like POV-Ray is in error ...
>
> (Or could my error trigger several error messages, where only a
> random selected one is printed each time?)
>
> The funny thing is that none of the keywords ('clock_delta', 'tan',
> 'on') that POV-Ray claims it found in a wrong place, appears in my
> POV-file.
>
> error: undeclared identifier expected but float function 'clock_delta'
> found instead.
It sounds like POV is using(internally, not in your scene) a variable
that doesn't get initialized...this would qualify as a bug even if that
isn't the cause.
--
Chris Huff
e-mail: chr### [at] yahoo com
Web page: http://chrishuff.dhs.org/
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Chris Huff wrote:
> I really wish POV-Ray would accept, if not require, semicolons at the
> end of declarations. It should be a simple modification to make, at
> least for someone who understands the declaration code(I don't).
Why ?
--
Ken Tyler - 1300+ Povray, Graphics, 3D Rendering, and Raytracing Links:
http://home.pacbell.net/tylereng/index.html http://www.povray.org/links/
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
In article <38D15EDC.6F76A0B0@pacbell.net>, lin### [at] povray org
wrote:
> Chris Huff wrote:
>
> > I really wish POV-Ray would accept, if not require, semicolons at the
> > end of declarations. It should be a simple modification to make, at
> > least for someone who understands the declaration code(I don't).
>
> Why ?
So we don't have to remember which times a semicolon is required?
Currently, it is not consistant. You have to memorize the special
cases:float, vector, color... It would be easier to just allow a
semicolon at the end of every #declare and #local. If they were
required, it might even simplify the parser and make things a little
faster.
--
Chris Huff
e-mail: chr### [at] yahoo com
Web page: http://chrishuff.dhs.org/
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Chris Huff wrote:
>
> In article <38D15EDC.6F76A0B0@pacbell.net>, lin### [at] povray org
> wrote:
>
> > Chris Huff wrote:
> >
> > > I really wish POV-Ray would accept, if not require, semicolons at the
> > > end of declarations. It should be a simple modification to make, at
> > > least for someone who understands the declaration code(I don't).
> >
> > Why ?
>
> So we don't have to remember which times a semicolon is required?
> Currently, it is not consistant. You have to memorize the special
> cases:float, vector, color... It would be easier to just allow a
> semicolon at the end of every #declare and #local. If they were
> required, it might even simplify the parser and make things a little
> faster.
#declare Bob =
object {
#declare Axel = box{-.5,.5}
#declare Col1 = rgb<1,1,1>;
#declare Col2 = rgb<0,0,0>;
#declare XXX = pigment{checker color Col1 color Col2}
#declare a = 0;
#while (a<1)
object{Axel translate a pigment{XXX}}
#declare a=a+1;
#end
}
;
object{Bob}
Which semi-colon closes the Bob declaration in the example above ?
I know it is obvious to us but this is a simple example which might
confuse the hell out of the parser.
Or do you make yet another special rule so that semi-colons don't
apply to declared objects and CSG operations because they already
use curly braces to define their ending ?
Does this make sense #declare foo = object {bar}; ?
--
Ken Tyler - 1300+ Povray, Graphics, 3D Rendering, and Raytracing Links:
http://home.pacbell.net/tylereng/index.html http://www.povray.org/links/
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
In article <38D169C7.81AB9F18@pacbell.net>, lin### [at] povray org
wrote:
> Chris Huff wrote:
> >
> > In article <38D15EDC.6F76A0B0@pacbell.net>, lin### [at] povray org
> > wrote:
> >
> > > Chris Huff wrote:
> > >
> > > > I really wish POV-Ray would accept, if not require, semicolons at
> > > > the
> > > > end of declarations. It should be a simple modification to make, at
> > > > least for someone who understands the declaration code(I don't).
> > >
> > > Why ?
> >
> > So we don't have to remember which times a semicolon is required?
> > Currently, it is not consistant. You have to memorize the special
> > cases:float, vector, color... It would be easier to just allow a
> > semicolon at the end of every #declare and #local. If they were
> > required, it might even simplify the parser and make things a little
> > faster.
>
>
> #declare Bob =
> object {
> #declare Axel = box{-.5,.5}
> #declare Col1 = rgb<1,1,1>;
> #declare Col2 = rgb<0,0,0>;
> #declare XXX = pigment{checker color Col1 color Col2}
>
> #declare a = 0;
> #while (a<1)
> object{Axel translate a pigment{XXX}}
> #declare a=a+1;
> #end
> }
> ;
>
> object{Bob}
>
> Which semi-colon closes the Bob declaration in the example above ?
The last one.
> I know it is obvious to us but this is a simple example which might
> confuse the hell out of the parser.
I doubt it, it shouldn't be hard to do. Actually, it most likely
wouldn't require much extra work at all. And you missed two, one in the
declaration of Axel and the other in XXX.
And just to nit-pick, your while loop is indented wrong, the #while
should be on the same level as "#declare a = 0;", and "object{Axel..."
should be on the same level as "#declare a=a+1;". And it would probably
be a good idea to use capitals instead of lowercase, "A" insead of "a",
to avoid conflicts with future reserved words/characters. And those
#declares(other than the loop counter) really should be outside the
object, no purpose is served in putting them there. And your #while()
loop will only loop once, kind of useless that way. :-)
> Or do you make yet another special rule so that semi-colons don't
> apply to declared objects and CSG operations because they already
> use curly braces to define their ending ?
>
> Does this make sense #declare foo = object {bar}; ?
The } defines the end of the object, not the declaration, so the
semicolon should remain. Maybe also allow an "implied union" without a
"union {}" wrapper(just specify multiple objects between the "=" and the
";"), but I don't think that would be very useful and it would make
things harder to read.
And yes, that code makes sense.
--
Chris Huff
e-mail: chr### [at] yahoo com
Web page: http://chrishuff.dhs.org/
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
I will indent my code anyway I see fit and I think you are over complicating
things.
--
Ken Tyler - 1300+ Povray, Graphics, 3D Rendering, and Raytracing Links:
http://home.pacbell.net/tylereng/index.html http://www.povray.org/links/
Post a reply to this message
|
 |
|  |
|  |
|
 |
From: Nieminen Juha
Subject: Re: Different error messages for same POV-file
Date: 17 Mar 2000 10:04:22
Message: <38d24976@news.povray.org>
|
|
 |
|  |
|  |
|
 |
Ken <tyl### [at] pacbell net> wrote:
: I know it is obvious to us but this is a simple example which might
: confuse the hell out of the parser.
Language parsers (C++, Java...) do it all the time (ie. several nested
blocks which end with ';') so it's not so difficult after all. For example:
class Test
{ int x;
};
--
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
|
 |
|  |
|  |
|
 |
From: Nieminen Juha
Subject: Re: Different error messages for same POV-file
Date: 17 Mar 2000 10:05:19
Message: <38d249ae@news.povray.org>
|
|
 |
|  |
|  |
|
 |
Chris Huff <chr### [at] yahoo com> wrote:
: And just to nit-pick, your while loop is indented wrong
Don't tell him how to indent. He will not listen anyways :)
--
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 Juha wrote:
>
> Chris Huff <chr### [at] yahoo com> wrote:
> : And just to nit-pick, your while loop is indented wrong
>
> Don't tell him how to indent. He will not listen anyways :)
You sure got that one right.
--
Ken Tyler - 1300+ Povray, Graphics, 3D Rendering, and Raytracing Links:
http://home.pacbell.net/tylereng/index.html http://www.povray.org/links/
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
#declare Foo = Bar;
Now replace Foo with whatever variable you want and replace Bar with
whatever you want to initialise it with.
Doesn't that make more sense than having lots of rules about when to put
the semicolon?
PoD.
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Chris Huff wrote:
>
> > error: undeclared identifier expected but float function 'clock_delta'
> > found instead.
>
> It sounds like POV is using(internally, not in your scene) a variable
> that doesn't get initialized...this would qualify as a bug even if that
> isn't the cause.
>
Do you think this may be the same bug that appears when running the
file I enclosed in my posting "POV-file that crashes POV-Ray"
17. March ?
Regards
Tor Olav
--
mailto:tor### [at] hotmail com
http://www.crosswinds.net/~tok/tokrays.html
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
I have now found a way to do several nested
calls of macros that passes arrays to each other
(like in the last macro below), without
getting error messages and without having to
make global declarations of local variables.
I will post my "solution" here if anyone is
interested.
Regards
Tor Olav
--
mailto:tor### [at] hotmail com
http://www.crosswinds.net/~tok/tokrays.html
Tor Olav Kristensen wrote:
>
> ...I want to be
> able to replace macros like e.g. this one:
>
> #macro Minv(MM)
>
> #local NN = array[3]
> #local PP = array[3]
> #local QQ = array[3]
> #local s = 1/Mdet(MM);
> #local NN = Mcof(MM)
> #local PP = Mtrans(NN)
> #local QQ = Mscale(s, PP)
>
> QQ
>
> #end
>
> with macors like this one:
>
> #macro Minv(MM)
>
> Mscale(1/Mdet(MM), Mtrans(Mcof(MM)))
>
> #end
>
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|
 |