POV-Ray : Newsgroups : povray.programming : Adding a keyword Server Time
5 Jul 2024 15:36:32 EDT (-0400)
  Adding a keyword (Message 1 to 7 of 7)  
From: Florian Brucker
Subject: Adding a keyword
Date: 22 Jan 2003 12:17:10
Message: <3e2ed216@news.povray.org>
hey guys!

I was just playing with the pov sources and tried to add a new keyword to
the global_settings block.

I added a token to TOKEN_IDS in parse.h and added a reserved word to
Reserved_Words in tokenize.cpp. I also added a CASE-block into
Parse_Global_Settings in parse.cpp (just a dummy one which states a
warning).

Everything is ok so far and POV compiles fine. But if i use my keyword in
the global_settings block it is taken as a float function:


<Parse_Global_Settings in parse.cpp>
//snip
CASE (INI_IMAGE_WIDTH_TOKEN)
{
    //Dummy stuff
    int MyDummy = (int) Parse_Float();
    Warning(0,"You used ini_image_width\n");
}
END_CASE
//snap
</Parse_Global_Settings>


<sdl>
global_settings {
    ini_image_width 640
}
</sdl>


<message window>
Parse Error: No matching } in 'global_settings', float function
'ini_image_width' found instead
</message window>


I want something like hf_gray_16, a keyword followed by a integer value.
What do I have to do to make POV-Ray accept this?

thanks in advance,
Florian

P.S.: If I do something completely wrong and you think I should do anything
but trying to patch POV, feel free to tell me ;-)


Post a reply to this message

From: ABX
Subject: Re: Adding a keyword
Date: 22 Jan 2003 12:24:59
Message: <iokt2v431p0pcumq8084qke2lblkhb2of2@4ax.com>
On Wed, 22 Jan 2003 18:19:48 +0100, "Florian Brucker" <tor### [at] torfboldcom>
wrote:
> hey guys!
> But if i use my keyword in
> the global_settings block it is taken as a float function:

You probably forgot about order of tokens. Look at 'Important' frame at
http://megapov.inetart.net/manual/parser.html#internals_tokens

> ini_image_width 640

In case you do not need features from 3.5 you can try old MegaPOV. There was
more general feature ini_option(). It is possible it will be also in reworked
MegaPOV but probably not soon. It seems other features are more often
requested.

ABX


Post a reply to this message

From: Christoph Hormann
Subject: Re: Adding a keyword
Date: 22 Jan 2003 12:27:08
Message: <3E2ED46C.3E043413@gmx.de>
Florian Brucker wrote:
> 
> [...]
> 
> <message window>
> Parse Error: No matching } in 'global_settings', float function
> 'ini_image_width' found instead
> </message window>

You probably added your token to TOKEN_IDS at the beginning or somewhere
in the middle.  Better place it at the end (but before 'LAST_TOKEN').

See also:
http://megapov.inetart.net/manual/megapov01.html#internals_tokens

And BTW:

if you intend to introduce the feature i think you are planning to
introduce you should note that this is against the idea behind the concept
of different file types in POV-Ray.  Render settings are given in the ini
files or at the command line and not in the scene file.  

Christoph

-- 
POV-Ray tutorials, include files, Sim-POV,
HCR-Edit and more: http://www.tu-bs.de/~y0013390/
Last updated 31 Dec. 2002 _____./\/^>_*_<^\/\.______


Post a reply to this message

From: ABX
Subject: Re: Adding a keyword
Date: 22 Jan 2003 12:36:19
Message: <b5lt2v80sf8tgd446hqdcagd309db4do14@4ax.com>
On Wed, 22 Jan 2003 18:27:08 +0100, Christoph Hormann <chr### [at] gmxde>
wrote:
> if you intend to introduce the feature i think you are planning to
> introduce you should note that this is against the idea behind the concept
> of different file types in POV-Ray

Well... I don't remember where such concept were elaborated... I wonder what
else could be described in "Internals" chapter in MegaPOV. Any references
and/or requests ?

ABX


Post a reply to this message

From: Christoph Hormann
Subject: Re: Adding a keyword
Date: 22 Jan 2003 12:54:01
Message: <3E2EDAB8.97AD3BC8@gmx.de>
ABX wrote:
> 
> > if you intend to introduce the feature i think you are planning to
> > introduce you should note that this is against the idea behind the concept
> > of different file types in POV-Ray
> 
> Well... I don't remember where such concept were elaborated...

It was mentioned various times that the ini_option feature is deprecated
because it undermines the idea of keeping the scene file free of render
specific settings.  I also know this is not completely consequent since
there are other render specific settings like 'hf_gray_16'.

Supplying render settings in the scene file comments is a better solution
IMO.  This is already supported in the 3.5 windows version and it would be
quite possible to write a script to analyze the beginning of a scene file
and automatically call POV-Ray with the settings found there.  This could
even be extended to search for a #version statement and call the
appropriate (unofficial) version automatically.

Christoph

-- 
POV-Ray tutorials, include files, Sim-POV,
HCR-Edit and more: http://www.tu-bs.de/~y0013390/
Last updated 31 Dec. 2002 _____./\/^>_*_<^\/\.______


Post a reply to this message

From: Thorsten Froehlich
Subject: Re: Adding a keyword
Date: 22 Jan 2003 14:41:02
Message: <3e2ef3ce@news.povray.org>
In article <3e2ed216@news.povray.org> , "Florian Brucker" 
<tor### [at] torfboldcom> wrote:

> Everything is ok so far and POV compiles fine. But if i use my keyword in
> the global_settings block it is taken as a float function:

As others have pointed out, you need to read the comments in the source
code, really!  the few that are there are really there for a reason :-)

    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: Florian Brucker
Subject: Re: Adding a keyword
Date: 22 Jan 2003 17:22:52
Message: <3e2f19bc@news.povray.org>
thanks guys!

you're right, i did insert my token somewhere in the upper part ;-(

As for the splitting of file types: this keyword was just a quick try. I
admit that I played with the idea of having some possibilities to specify
the output options in the scene file, but your point of view seems
absolutely right.

I'll study the comments for a while now, seems I missed some...

thanks,
florian


Post a reply to this message

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