POV-Ray : Newsgroups : povray.programming : How does parser.cpp/parstxtr.cpp work? Server Time
28 Jul 2024 06:17:26 EDT (-0400)
  How does parser.cpp/parstxtr.cpp work? (Message 1 to 6 of 6)  
From: jan w
Subject: How does parser.cpp/parstxtr.cpp work?
Date: 21 Oct 2002 13:26:36
Message: <3db438cb@news.povray.org>
Can someone please explain to me, or point me to a direction/documentation,
how the parser works?

Its quite hard for an C novice to understand the inner working of the parser
with all these marcros and definitions...
Or simply help me with my current prob?

My trouble is as follows:
I started to create a grid-pattern. This was created as a block-pattern 
in that way, that I simply copied everywhere (where I found it) the brick-
pattern and renamed it.
At last I changed the inner working in pattern.cpp so I had what I wanted. 
Fine! This worked, and I was happy.

But I decided, I could create a more useful pattern, if I would return a
float and later apply a colormap instead of a simple color.

Returning the float works ok, so far, but as this started as a copy of a 
brick-pattern, I can't apply a colormap. I assume the appropriate code lies
in the parser. Can someone tell me, where which token has how to be added?

Thx ... Jan ...

PS: Question from newbie: 
	struct *T;  
	T->A.B == (*T).A.B ? 

    I'm still getting confused with pointerstuff....

--


Post a reply to this message

From: ABX
Subject: Re: How does parser.cpp/parstxtr.cpp work?
Date: 21 Oct 2002 13:34:55
Message: <1fe8ru03nn6kogrcu774op56dc4of4qo5s@4ax.com>
On 21 Oct 2002 13:26:36 -0400, jan### [at] lzernet wrote:
> But I decided, I could create a more useful pattern, if I would return a
> float and later apply a colormap instead of a simple color.

If it should return float then it can be also coded as internal function.
Check http://abx.art.pl/pov/patches/patches.php?Key=Internal+Functions for
tutorial how to do it.

ABX


Post a reply to this message

From: Christopher James Huff
Subject: Re: How does parser.cpp/parstxtr.cpp work?
Date: 21 Oct 2002 13:47:50
Message: <chrishuff-E24E4F.13430621102002@netplex.aussie.org>
In article <3db438cb@news.povray.org>, jan### [at] lzernet wrote:

> Can someone please explain to me, or point me to a direction/documentation,
> how the parser works?

You don't start with the small questions, do you... ;-)


> Its quite hard for an C novice to understand the inner working of the parser
> with all these marcros and definitions...

Mainly, look at existing code for features that do something similar to 
what you want, and imitate what you see.


> Or simply help me with my current prob?

That would be a lot easier.


> Returning the float works ok, so far, but as this started as a copy of a 
> brick-pattern, I can't apply a colormap. I assume the appropriate code lies
> in the parser. Can someone tell me, where which token has how to be added?

Hmm...POV uses the position of the pattern ID in PATTERN_IDS (in 
pattern.h) to tell block patterns from other patterns, so make sure you 
put it with the "ordinary" patterns. The blend map stuff is handled 
automatically. If you had it working right as a block pattern, you 
probably added some code to the blend map parsing code that you need to 
remove now...block patterns are actually more complex then float 
patterns.

-- 
Christopher James Huff <cja### [at] earthlinknet>
http://home.earthlink.net/~cjameshuff/
POV-Ray TAG: chr### [at] tagpovrayorg
http://tag.povray.org/


Post a reply to this message

From: Thomas Willhalm
Subject: Re: How does parser.cpp/parstxtr.cpp work?
Date: 22 Oct 2002 04:35:55
Message: <3db50dea@news.povray.org>
jan### [at] lzernet wrote:
> 
> PS: Question from newbie:
> struct *T;
> T->A.B == (*T).A.B ?

Yes and btw *T.A.B is the same as *(T.A.B)

>     I'm still getting confused with pointerstuff....

but if you need thm, they're useful. The better way is of course to 
encapsulate them in a C++ class.

Thomas (still not thinking that hiding pointers like in Java is the right
way to go)


Post a reply to this message

From: Jan Walzer
Subject: Re: How does parser.cpp/parstxtr.cpp work?
Date: 22 Oct 2002 11:30:11
Message: <web.3db56e012e88276b576e3f040@news.povray.org>
Thomas Willhalm wrote:
>jan### [at] lzernet wrote:
>>
>> PS: Question from newbie:
>> struct *T;
>> T->A.B == (*T).A.B ?
>Yes and btw *T.A.B is the same as *(T.A.B)

I start to understand ... ... slowly ...

>
>>     I'm still getting confused with pointerstuff....
>but if you need thm, they're useful. The better way is of course to
>encapsulate them in a C++ class.

please lemme 1st understand this C stuff ...

>Thomas (still not thinking that hiding pointers like in Java is the right
>way to go)

They're not really hidden ... It's just the pointer-arithmetic which isn't
allowed (IMHO for good reasons) and that all non-primitive types are given
by reference ...

But thx for the answer ...


Post a reply to this message

From: Thomas Willhalm
Subject: Re: How does parser.cpp/parstxtr.cpp work?
Date: 23 Oct 2002 06:21:48
Message: <3db6783b@news.povray.org>
Jan Walzer wrote:

> Thomas Willhalm wrote:
> 
>>>     I'm still getting confused with pointerstuff....
>>but if you need thm, they're useful. The better way is of course to
>>encapsulate them in a C++ class.
> 
> please lemme 1st understand this C stuff ...

Then perhaps

P. Bothner und W-M Kaehler
Ohne C zu C++
Vieweg-Verlag
ISBN 3-528-05780-7

might offer a shortcut (but only in German AFAIK)

>>Thomas (still not thinking that hiding pointers like in Java is the right
>>way to go)
> 
> They're not really hidden ... It's just the pointer-arithmetic which isn't
> allowed (IMHO for good reasons) and that all non-primitive types are given
> by reference ...

Some people keep saying that there aren't any pointers in Java...
Obviously you know better. If - as it seems - you know Java and German,
then my introduction to C++ on 
http://www.inf.uni-konstanz.de/algo/lehre/skripte/
may also be of some help.

Thomas


Post a reply to this message

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