POV-Ray : Newsgroups : povray.unofficial.patches : Patch or Unofficial Version with Persistent Variables/Objects : Re: Patch or Unofficial Version with Persistent Variables/Objects Server Time
3 Dec 2023 06:19:05 EST (-0500)
  Re: Patch or Unofficial Version with Persistent Variables/Objects  
From: Excentp
Date: 9 Apr 2014 16:30:00
Message: <web.5345accd2520f633dd5403ef0@news.povray.org>
Christian Froeschlin <chr### [at] chrfrde> wrote:
> > If not, I would like to know how which POV-Ray source code files to alter so as
> > to be able to load unchanging object data only once and retain it for all
> > frames.
> Sorry for the long silence, you find me in continuous state of guilt.
> I did hack something together for this based on 3.7b34 (back in
> 2009 I think) with the intent of creating a real patch after 3.7
> proper was released. Of course that turned out to be a lot of
> years in between and now mostly busy with other things.
> After your post I thought I might give it a shot but I actually got
> stuck already getting 3.7 release to compile (new computer, new OS,
> new Visual Studio version, changed build) and think I won't be
> focussing on this anytime soon.
> I just dug up an old CVS repository from a backup of my last
> computers hard drive to find out what changes I did. Its a bit
> of a mess, really, I didn't plan to store this for eternity.
> Still I think the info could help you implement a patch for 3.7
> even if the codebase probably looks totally different than in 2009.
> The 5 files I changed were parse.h, parse.cpp, reswords.h, reswords.cpp
> and tokenize.cpp. I attach 2 zipfiles, one contains the state these
> files were in in 3.7b34 and one the files after my changes (because
> it's all a bit of a mess there can be changes regarding tokens
> for an aoi pattern in there too, ignore those).
> The basic idea of the change is to introduce a new symbol table.
> POVRay already had 2, one for reserved words and one for variables.
> The new symbol table is for static variables introduced using a
> new keyword #static instead of #declare. When a variable name
> is use, it is first looked up in the static table and then
> falls through to the dynamic table.
> Really the only difference between the tables is that I
> completely left out the code for freeing the static table
> after rendering. This has the following effects:
> In a command line environment, static variables values persist
> between frames of an animation.
> In an interactive GUI environment, static variables persist as
> long as the process is running. So you can run a single render
> that loads static variables, and when you run any other render
> it can still see that variable. In order to be complete such a
> patch should contain GUI functionality to show and clear the
> currently stored static variables.
> But even without it is very useful. It would be cool to see it
> implemented in an official version.
> Hope this helps,
>    Christian
> PS: Strictly speaking code changes based on beta version should not
> be published but the idea there is to prevent variants of unsupported
> and outdated versions making the rounds. I hope showing you one change
> I made in 2009 will not cause b34 to go rampant again :)


Of interest to me is the reswords.h. The current 3.7 has this line

#define SYM_ENTRY_REF_MAX           USHRT_MAX

in place of your changes

// Special symbol tables
#define ST_RESERVED_WORDS           0   // Reserved words only
#define ST_STATIC_SYMBOLS           1   // #static
#define ST_GLOBAL_SYMBOLS           2   // #declare / top-level #local

Post a reply to this message

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