Co-existence with stdio
There is outline support for co-existence of PerlIO with stdio. Obviously if PerlIO is implemented in terms of stdio there is no problem. However if perlio is implemented on top of (say) sfio then mechanisms must exist to create a FILE * which can be passed to library code which is going to use stdio calls.
PerlIO_importFILE(f,flags)
Used to get a PerlIO * from a FILE *. May need additional arguments, interface under review.
PerlIO_exportFILE(f,flags)
Given an PerlIO * return a 'native' FILE * suitable for passing to code expecting to be compiled and linked with ANSI C stdio.h.
The fact that such a FILE * has been 'exported' is recorded, and may affect future PerlIO operations on the original PerlIO *.
PerlIO_findFILE(f)
Returns previously 'exported' FILE * (if any). Place holder until interface is fully defined.
PerlIO_releaseFILE(p,f)
Calling PerlIO_releaseFILE informs PerlIO that all use of FILE * is complete. It is removed from list of 'exported' FILE *s, and associated PerlIO * should revert to original behaviour.
PerlIO_setlinebuf(f)
This corresponds to setlinebuf(). Use is deprecated pending further discussion. (Perl core uses it only when ``dumping''; it has nothing to do with $| auto-flush.)
In addition to user API above there is an ``implementation'' interface which allows perl to get at internals of PerlIO. The following calls correspond to the various FILE_xxx macros determined by Configure. This section is really of interest to only those concerned with detailed perl-core behaviour or implementing a PerlIO mapping.
PerlIO_has_cntptr(f)
Implementation can return pointer to current position in the ``buffer'' and a count of bytes available in the buffer.
PerlIO_get_ptr(f)
Return pointer to next readable byte in buffer.
PerlIO_get_cnt(f)
Return count of readable bytes in the buffer.
PerlIO_canset_cnt(f)
Implementation can adjust its idea of number of bytes in the buffer.
PerlIO_fast_gets(f)
Implementation has all the interfaces required to allow perl's fast code to handle mechanism.
PerlIO_fast_gets(f) = PerlIO_has_cntptr(f) && \
PerlIO_canset_cnt(f) && \
`Can set pointer into buffer'
PerlIO_set_ptrcnt(f,p,c)
Set pointer into buffer, and a count of bytes still in the buffer. Should be used only to set pointer to within range implied by previous calls to PerlIO_get_ptr and PerlIO_get_cnt.
PerlIO_set_cnt(f,c)
Obscure - set count of bytes in the buffer. Deprecated. Currently used in only doio.c to force count < -1 to -1. Perhaps should be PerlIO_set_empty or similar. This call may actually do nothing if ``count'' is deduced from pointer and a ``limit''.
PerlIO_has_base(f)
Implementation has a buffer, and can return pointer to whole buffer and its size. Used by perl for -T / -B tests. Other uses would be very obscure...
PerlIO_get_base(f)
Return start of buffer.
PerlIO_get_bufsiz(f)
Return total size of buffer.
MOISOFT - НОВИНКИ КИНО
