POV-Ray : Newsgroups : povray.general : Passing file handles to macros - how? : Re: Passing file handles to macros - how? Server Time
4 Aug 2024 20:13:03 EDT (-0400)
  Re: Passing file handles to macros - how?  
From: Christopher James Huff
Date: 24 Apr 2003 20:34:37
Message: <cjameshuff-353FF4.20344724042003@netplex.aussie.org>
In article <3ea7fc66$1@news.povray.org>,
 "Thorsten Froehlich" <tho### [at] trfde> wrote:

> > What do you need the STL for? Reference counting is trivial to
> > implement.
> 
> Yes, reinvent the wheel. 

Reference counting is extremely simple...in my opinion, it doesn't come 
under "reinventing the wheel". And if there is no widespread standard 
implementation, rolling your own is better than not doing it at all.


> And then try to add it in a clean manner in POV-Ray. 

This is a bit more difficult...what I'd really like is to dump the 
current file handling completely and start over again, with a new syntax 
and more functionality. To get something I'd call "clean" would require 
pretty extensive changes...something I'd rather start from scratch than 
try to refactor and redesign so much code.


> The problem of not being able to use "real" classes as members of
> most data structures makes it a real hassle.  It is about getting a clean
> well-working implementation.  It isn't about "Reference counting is trivial
> to implement." at all.

Are you talking about problems with allocating instances of those 
classes? Something that causes trouble with the vtables?
It should not be difficult to create a simple reference-counted pointer 
class that hides all the difficulties of using C++ objects in the data 
structures, and which itself doesn't have any problems.


> It could be closed, couldn't it?  So what happens if you close it inside the
> macro and the try to use it after the macro returns?  You run into tons of
> problems due to the current structure of the code, and you should have an
> idea how many there are given that you have had a look at the source code
> before...

I would not use reference counting for that. Closing the file would set 
some validity flag...having a reference does not mean having an open 
file. Attempting to use the file would then give some kind of error.

-- 
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

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