|Version 19 (modified by nwellnhof, 4 years ago)|
- Separate pipe-related logic out of FileHandle. Create a Pipe PMC type. nwellnhof: I'm not sure a Pipe PMC would be very useful. What we should do is to deprecate opening pipes to external commands via FileHandles which is an ugly Perl5ism, see Ideas.
- Create a "Select" PMC, maybe have a look at libevent.
- Move buffering logic from FileHandle and StringHandle to Handle. Be able to inherit it from all other PMC types. (include buffering-related ATTRs, METHOD_buffer_type, and METHOD_buffer_size). nwellnhof: We should keep the buffering logic at a C level. All that is needed for now is to pass the buffering functions a pair of read/write callbacks for files and sockets (recv/send).
- Move encoding logic (METHOD_encoding, ATTR_encoding, etc) from StringHandle and FileHandle to Handle. Be able to inherit it from all other PMC types. nwellnhof: The encoding logic is encapsulated in the string code quite well now, so I think we should have the StringHandle PMC handle encodings on its own. Only the encoding attribute should be shared.
- Unify logic wherever possible so multiple IO types can share
- Use GET_ATTR macros in src/io/filehandle.c so all functions will be able to handle subclasses
- Change IO API to not use PCCINVOKE calls. Method calls on IO PMCs should call the API functions, not the other way around.
- Unify the codepaths for Socket and Pipe into the IO API. Refactor the IO API to be more unified.
- Add externally-visible socket functions to src/io/api.c from src/io/socket_*.c
- Rename Parrot_io_new_pmc to Parrot_io_new_filehandle_pmc
- Add Pipe and Socket logic to Parrot_io_open. Call into Parrot_io_open from the "Open" method of each
- Add Pipe and Socket logic to Parrot_io_close.
- Add Pipe and Socket logic to Parrot_io_is_closed.
- Add Pipe and Socket logic to Parrot_io_flush
- Add Pipe and Socket logic to Parrot_io_reads
- Add Pipe and Socket logic to Parrot_io_readline
- Error handling: Figure out what happens if an unsuitable PMC type is passed to Parrot_io_seek, Parrot_io_tell, Parrot_io_eof, Parrot_io_is_tty
- Extract a sane buffering API.
- Cleanup Parrot_io_write, Parrot_io_puts, Parrot_io_putps. Unify where possible and remove duplicated effort
- Add an src/io/pipe.c and src/io/stringhandle.c files for type-specific logic similar to src/io/filehandle.c
- Make sure the functions in src/io/buffer.c will work with all buffer-enabled PMC types
- Evaluate Parrot_io_make_offset, Parrot_io_make_offset32, Parrot_io_make_offset_pmc. If they do not need to be in src/io/api.c, move them elsewhere (src/io/filehandle.c?)
- Make 'print' and 'say' stringify the same way. (See http://rt.perl.org/rt3/Ticket/Display.html?id=55196)
- Change 'fprintf' to 'PIO_fprintf' where relevant.
- Plain %s in parrot printf-alike functions do not handle NULL C strings well. Fix.
- Further optimize where possible.
- Move src/io/filehandle.c:Parrot_io_clear_buffer to src/io/buffer.c
- Move src/io/filehandle.c:Parrot_io_is_encoding to src/io/core.c
- Rename PARROT_NET_DEVEL to PARROT_NETWORKING_SUPPORT. Cleanup it's uses (#534)
various IO related RT tickets
- Create "StreamDescriptor" PMC type to abstract out system-dependent IO descriptors. Would allow FileHandles and Sockets to be subclassed more easily
- Create a "StreamBuffer" PMC type to abstract out buffering details. Would allow FileHandles and Sockets to be subclassed more easily, and give all IO types easy access to buffering
- Parrot_io_printf should output to Parrot's standard output PMC, not stdout
- Parrot_io_eprintf should output to Parrot's standard error PMC, not stderr
- Create an OSHandle PMC that FileHandle and Socket inherit from, but not StringHandle.
- Deprecate the current pipe API and create an OSProcess PMC that works like this (think IPC::Open3)
proc = new 'OSProcess' # flags is something like EXEC_STDIN|EXEC_STDOUT|EXEC_STDERR proc.'exec'(command, args, flags) # get stdin of exec'ed process for writing w_handle = proc.'stdin'() # get stdout of exec'ed process for reading r_handle = proc.'stdout'()
- Create an abstract "IOHandle" class
- Abstract relevant API code from FileHandle and Socket into IOHandle
- Fix StringHandle to be a proper subclass of IOHandle
- Rip out the layers structures and macros. (After the migration is complete.)
- Remove src/io/io_mmap.c, unused and not useful.
- Convert I/O layers to I/O objects. (allison)
- src/io/io_unix.c is the guts of most I/O on most platforms. src/io/io_win32.c is Windows. src/io/io_stdio.c is STDIN, STDOUT, and STDERR. These three need to be ported to the new system. (allison)
- src/io/io_utf8.c is really the wrong way to go about it. Filehandles should be marked with character set and encoding similar to strings. (allison)
- Create a PMC named "FileHandle", as a core file handle object, which can be subclassed by various HLLs. (allison)
- Continue to support different I/O operations on different platforms, using C '#ifdef's on platform-specific sections. (allison)
- All 'PIO_*' functions change to 'Parrot_io_*'. (Since the implementation is completely changing, better to create new functions with the new names than to change the names of existing functions.) (allison)
- Remove deprecated opcode 'pioctl', and fix related documentation. (See http://rt.perl.org/rt3/Ticket/Display.html?id=48589)
- Decide if we plan to use AIO before the 1.0 release. (See http://rt.perl.org/rt3/Ticket/Display.html?id=57920)
- Remove src/io/io_passdown.c and src/io/io_layers.c, purely implementation artifacts of I/O layers implementation.
- Change src/io/io_string.c to a subclass of FileHandle PMC, that provides the same interface, but to a string instead of a file handle.
- All IO PMC types should inherit from Handle
- Add a "Close" or "Disconnect" method to the Socket PMC
- Add an improved file-like API to the Socket PMC (open, close, readline, etc). Internally, these methods should direct to similar functions in src/io/api.c
- Move METHOD_get_fd from FileHandle to Handle. Be able to inherit this into Socket, Pipe, etc.