POV-Ray : Newsgroups : povray.general : Feature Request: Binary #write : Re: Feature Request: Binary #write Server Time
30 Jul 2024 18:16:40 EDT (-0400)
  Re: Feature Request: Binary #write  
From: Edouard
Date: 26 Mar 2009 06:15:00
Message: <web.49cb54e56dca0b64eba2273d0@news.povray.org>
Tim Attwood wrote:

> FOPEN_DIRECTIVE:
>     #fopen IDENTIFIER "filename" OPEN_TYPE [FILE_MODE]
> OPEN_TYPE:
>     read | write | append
> FILE_MODE
>     standard | binary

This I like hugely.



Clipka wrote:

> That alone wouldn't quite do the job: How is POV to know whether to write
> a particular value as a byte, 16-bit or 32-bit integer?

Personally I think it's far cleaner to just be able to write raw bytes (in an
8bit clean stream), and not support 16 or 32 bit values. Once you have raw
bytes, you can trivially write a macro to write big endian 16 bit values. Or
little endian. Or 64 bit values. Or anything.



Tim Attwood wrote:

> Obviously the standard for binary files is 8 bit bytes.
>
> POV supports encoding and decoding byte values with the
> chr(N) and asc(S) functions in ASCII mode.
>
> You can already write byte values as #write(handle,chr(N)).

And this seems like the perfect way to write bytes to a binary stream.

Doesn't work on the Mac OS X beta of 3.7 now - NULLs get swallowed, and anything
over 0x7f gets written as a space. And the global_settings{ charset ... }
directive doesn't really seem to do much in this version either.

So my ideal solution would be to add the "binary" flag to a file open command,
and then fix write( ..., chr() ) to actually write bytes cleanly. I could write
a DF3 file once that was done with ease.

But I'm not doing the work, so I'll gratefully accept whatever actually gets
done. :-)

Cheers,
Edouard.


Post a reply to this message

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