From: Nick Ing-Simmons Date: Sun, 19 Nov 2000 20:57:17 +0000 (+0000) Subject: Add dummy crlf layer (just as buffer) X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=66ecd56be076649bc9da523c12d89e06e353e801;p=p5sagit%2Fp5-mst-13.2.git Add dummy crlf layer (just as buffer) Correct 1st bug - one layer of indirection. p4raw-id: //depot/perlio@7755 --- diff --git a/perlio.c b/perlio.c index ca05ac5..7f2d66f 100644 --- a/perlio.c +++ b/perlio.c @@ -373,6 +373,7 @@ PerlIO_default_layer(I32 n) PerlIO_define_layer(&PerlIO_unix); PerlIO_define_layer(&PerlIO_perlio); PerlIO_define_layer(&PerlIO_stdio); + PerlIO_define_layer(&PerlIO_crlf); #ifdef HAS_MMAP PerlIO_define_layer(&PerlIO_mmap); #endif @@ -450,7 +451,7 @@ PerlIO_apply_layers(pTHX_ PerlIO *f, const char *mode, const char *names) SV *layer = PerlIO_find_layer(s,e-s); if (layer) { - PerlIO_funcs *tab = INT2PTR(PerlIO_funcs *, SvIV(layer)); + PerlIO_funcs *tab = INT2PTR(PerlIO_funcs *, SvIV(SvRV(layer))); if (tab) { PerlIO *new = PerlIO_push(f,tab,mode); @@ -1853,6 +1854,40 @@ PerlIO_funcs PerlIO_perlio = { PerlIOBuf_set_ptrcnt, }; +/*--------------------------------------------------------------------------------------*/ +/* crlf - translation currently just a copy of perlio to prove + that extra buffering which real one will do is not an issue. + */ + +PerlIO_funcs PerlIO_crlf = { + "crlf", + sizeof(PerlIOBuf), + 0, + PerlIOBase_fileno, + PerlIOBuf_fdopen, + PerlIOBuf_open, + PerlIOBuf_reopen, + PerlIOBase_pushed, + PerlIOBase_noop_ok, + PerlIOBuf_read, + PerlIOBuf_unread, + PerlIOBuf_write, + PerlIOBuf_seek, + PerlIOBuf_tell, + PerlIOBuf_close, + PerlIOBuf_flush, + PerlIOBuf_fill, + PerlIOBase_eof, + PerlIOBase_error, + PerlIOBase_clearerr, + PerlIOBuf_setlinebuf, + PerlIOBuf_get_base, + PerlIOBuf_bufsiz, + PerlIOBuf_get_ptr, + PerlIOBuf_get_cnt, + PerlIOBuf_set_ptrcnt, +}; + #ifdef HAS_MMAP /*--------------------------------------------------------------------------------------*/ /* mmap as "buffer" layer */ diff --git a/perliol.h b/perliol.h index 58fad63..1b7c172 100644 --- a/perliol.h +++ b/perliol.h @@ -67,6 +67,7 @@ struct _PerlIO extern PerlIO_funcs PerlIO_unix; extern PerlIO_funcs PerlIO_perlio; extern PerlIO_funcs PerlIO_stdio; +extern PerlIO_funcs PerlIO_crlf; #ifdef HAS_MMAP extern PerlIO_funcs PerlIO_mmap; #endif