|
|
|
|
|
|
| |
| |
|
|
|
|
| |
| |
|
|
The following code generates this error:
Write(FileHandle <----ERROR
Parse Error: Expected 2 parameters but only 0 found.
#macro Write (File, Doodle)
#write (File, Doodle)
#end
#fopen FileHandle "c:\\1.txt" write
Write(FileHandle,1)
#fclose FileHandle
While the following code generates this error:
Write(1, FileHandle <----ERROR
Parse Error: Expected 2 parameters but only 1 found.
#macro Write (Doodle, File)
#write (File, Doodle)
#end
#fopen FileHandle "c:\\1.txt" write
Write(1, FileHandle)
#fclose FileHandle
My question is: can I pass file handles as parameters to macros, and
if yes, how?
Peter Popov ICQ : 15002700
Personal e-mail : pet### [at] vipbg
TAG e-mail : pet### [at] tagpovrayorg
Post a reply to this message
|
|
| |
| |
|
|
From: Christoph Hormann
Subject: Re: Passing file handles to macros - how?
Date: 22 Apr 2003 04:55:57
Message: <3EA50397.32C07AC2@gmx.de>
|
|
|
| |
| |
|
|
Peter Popov wrote:
>
> [...]
>
> #fopen FileHandle "c:\\1.txt" write
> Write(1, FileHandle)
> #fclose FileHandle
>
> My question is: can I pass file handles as parameters to macros, and
> if yes, how?
>
I recently experienced the same problem and i think you can't. File
handles are different from other identifiers.
Christoph
--
POV-Ray tutorials, include files, Sim-POV,
HCR-Edit and more: http://www.tu-bs.de/~y0013390/
Last updated 28 Feb. 2003 _____./\/^>_*_<^\/\.______
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
On Tue, 22 Apr 2003 10:55:51 +0200, Christoph Hormann
<chr### [at] gmxde> wrote:
>I recently experienced the same problem and i think you can't. File
>handles are different from other identifiers.
Then why can I #undef, #ifdef and #ifndef them? I mean, sure they are
not normal identifiers, you can't assign to them etc. but the fact
that you can't pass them to macros looks to me like an overlooking and
not a design feature.
The docs don't mention it anywhere. What they say is that a macro
parameter is either an RVALUE or an identifier. However, a file handle
*is* in a way an identifier as it a) uniquely identifies a file and b)
you can #ifdef, #ifndef and #undef it. So why the limitation?
Peter Popov ICQ : 15002700
Personal e-mail : pet### [at] vipbg
TAG e-mail : pet### [at] tagpovrayorg
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
On Tue, 22 Apr 2003 12:48:14 +0300, Peter Popov <pet### [at] vipbg> wrote:
> So why the limitation?
I have no idea but I imagine you can workaround it with passing it as string and
Parse_String() macro.
ABX
Post a reply to this message
|
|
| |
| |
|
|
From: Christoph Hormann
Subject: Re: Passing file handles to macros - how?
Date: 22 Apr 2003 06:10:41
Message: <3EA51521.EF2E030B@gmx.de>
|
|
|
| |
| |
|
|
Peter Popov wrote:
>
> Then why can I #undef, #ifdef and #ifndef them? I mean, sure they are
> not normal identifiers, you can't assign to them etc. but the fact
> that you can't pass them to macros looks to me like an overlooking and
> not a design feature.
Dunno about #undef but the defined(FileHandle) function checks if the file
has reached the end while reading.
Christoph
--
POV-Ray tutorials, include files, Sim-POV,
HCR-Edit and more: http://www.tu-bs.de/~y0013390/
Last updated 28 Feb. 2003 _____./\/^>_*_<^\/\.______
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
On Tue, 22 Apr 2003 11:53:36 +0200, ABX <abx### [at] abxartpl> wrote:
>I have no idea but I imagine you can workaround it with passing it as string and
>Parse_String() macro.
In this case the file handle should be global, which doesn't help
much.
I am rendering an animation. I read the data from a file, calculate an
iteration and write it back to the file. If the file is globally open
(the file handle is globally defined), it can only be open for reading
*or* writing/appending, which doesn't solve my case. The whole thing
is macro-based so the scene is just along the lines of
#include ...
#declare Object=Macro(Parameters)
camera... lights...
As you see, there's no way with this setup (and I *do* want it to be
like that because it's an include I'd like to release) that I can have
the file handle be global.
I consider this a genuine bug, not exactly along the lines of "it's
not working properly" but more like "there's an artificial limitation
which looks like it shouldn't be there".
Peter Popov ICQ : 15002700
Personal e-mail : pet### [at] vipbg
TAG e-mail : pet### [at] tagpovrayorg
Post a reply to this message
|
|
| |
| |
|
|
From: Thorsten Froehlich
Subject: Re: Passing file handles to macros - how?
Date: 22 Apr 2003 07:16:30
Message: <3ea5248e$1@news.povray.org>
|
|
|
| |
| |
|
|
In article <1ev9avov9b6hkd269fm74okpsdfq31kpg1@4ax.com> , Peter Popov
<pet### [at] vipbg> wrote:
> My question is: can I pass file handles as parameters to macros, and
> if yes, how?
No, because you cannot make copies of file handles for obvious reasons.
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
|
|
| |
| |
|
|
|
|
| |
| |
|
|
On Tue, 22 Apr 2003 13:16:31 +0200, "Thorsten Froehlich"
<tho### [at] trfde> wrote:
>No, because you cannot make copies of file handles for obvious reasons.
But you can make references to them, right?
Peter Popov ICQ : 15002700
Personal e-mail : pet### [at] vipbg
TAG e-mail : pet### [at] tagpovrayorg
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
On Tue, 22 Apr 2003 13:16:16 +0300, Peter Popov <pet### [at] vipbg> wrote:
> > I have no idea but I imagine you can workaround it with passing it as string and
> > Parse_String() macro.
>
> In this case the file handle should be global, which doesn't help
> much.
You mean this working workaround does not help you ?
#include "strings.inc"
#macro Write(File_Handle)
#write( Parse_String(File_Handle) , "test")
#end
#fopen ID1 "test1.txt" write
Write("ID1")
#fclose ID1
#fopen ID2 "test2.txt" write
Write("ID2")
#fclose ID2
ABX
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
On Tue, 22 Apr 2003 13:37:15 +0200, ABX <abx### [at] abxartpl> wrote:
>You mean this working workaround does not help you ?
I have to see. In your case it works. In my case, the file handle is
created within a macro which in turn has to pass it to other macros,
so I have to check the scope with which it is created.
In the meanwhile, I am already rendering with the ugliest workaround
possible -- I played parser and pasted the macro code with the
necessary parameters substituted, heh :)
Peter Popov ICQ : 15002700
Personal e-mail : pet### [at] vipbg
TAG e-mail : pet### [at] tagpovrayorg
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |