At 10:11 AM 11/4/2003 -0500, Melvin Smith wrote:
At 03:18 PM 11/4/2003 +0100, Juergen Boemmels wrote:
* I needed many casts from PIOHANDLE to FILE * and vice versa. I'm not
  sure if this one fits all approach of PIOHANDLE is the right way.
  Maybe its better to make PIOHANDLE a union. But what to do then
  with the fdopen and getfd ops. It is not guaranteed that a union
  can be casted to an INTVAL and back.

I think it works with casts, unless there are cases where our INTVAL cannot hold a pointer. There are currently 2 cases:

PIOHANDLE is a low level OS handle (UNIX or Win32) and we to
   create a ParrotIO around it.
PIOHANDLE is a stdio FILE * and we need to create a ParrotIO around it.

One more comment. I don't even see the possibility of calling fdopen from the bytecode level with a FILE *. From the bytecode level, either we know some OS constants that are typically streams (UNIX 0,1,2) or the call probably won't come from the bytecode. For the STDIO case, there is currently no way to even call fdopen() from bytecode with a valid parameter, it only works for the low level OS handles.

It may not make sense to expose it, but I don't see how we can do without
exposing it for UNIX and low level Win32 without exposing it for STDIO.

1 possible solution is: remove PIO_stdio_fdopen altogether and move the code
to PIO_stdio_unit() which actually needs it.

-Melvin




Reply via email to