diff options
author | Nick Ing-Simmons <nik@tiuk.ti.com> | 2002-07-11 09:16:46 +0000 |
---|---|---|
committer | Nick Ing-Simmons <nik@tiuk.ti.com> | 2002-07-11 09:16:46 +0000 |
commit | 4ec2216f20a53a69267b31ce136e7410687cbe32 (patch) | |
tree | 96c95cc2bb9e43f5cfb7a60f65657db028a051da /perlio.c | |
parent | 81428673dc5737b28b793d38fc79696f8d6e80c4 (diff) | |
download | perl-4ec2216f20a53a69267b31ce136e7410687cbe32.tar.gz |
(Re-)instate :pop as a "back door" to perl level layer stack
manipulation.
p4raw-id: //depot/perlio@17479
Diffstat (limited to 'perlio.c')
-rw-r--r-- | perlio.c | 54 |
1 files changed, 42 insertions, 12 deletions
@@ -915,6 +915,46 @@ PerlIO_layer_fetch(pTHX_ PerlIO_list_t *av, IV n, PerlIO_funcs *def) return def; } +IV +PerlIOPop_pushed(pTHX_ PerlIO *f, const char *mode, SV *arg, PerlIO_funcs *tab) +{ + if (PerlIOValid(f)) { + PerlIO_flush(f); + PerlIO_pop(aTHX_ f); + return 0; + } + return -1; +} + +PerlIO_funcs PerlIO_remove = { + sizeof(PerlIO_funcs), + "pop", + 0, + PERLIO_K_DUMMY | PERLIO_K_UTF8, + PerlIOPop_pushed, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, /* flush */ + NULL, /* fill */ + NULL, + NULL, + NULL, + NULL, + NULL, /* get_base */ + NULL, /* get_bufsiz */ + NULL, /* get_ptr */ + NULL, /* get_cnt */ + NULL, /* set_ptrcnt */ +}; + PerlIO_list_t * PerlIO_default_layers(pTHX) { @@ -937,6 +977,7 @@ PerlIO_default_layers(pTHX) PerlIO_define_layer(aTHX_ & PerlIO_mmap); #endif PerlIO_define_layer(aTHX_ & PerlIO_utf8); + PerlIO_define_layer(aTHX_ & PerlIO_remove); PerlIO_define_layer(aTHX_ & PerlIO_byte); PerlIO_list_push(aTHX_ PL_def_layerlist, PerlIO_find_layer(aTHX_ osLayer->name, 0, 0), @@ -1026,18 +1067,6 @@ PerlIO_push(pTHX_ PerlIO *f, PerlIO_funcs *tab, const char *mode, SV *arg) } IV -PerlIOPop_pushed(pTHX_ PerlIO *f, const char *mode, SV *arg, PerlIO_funcs *tab) -{ - PerlIO_pop(aTHX_ f); - if (*f) { - PerlIO_flush(f); - PerlIO_pop(aTHX_ f); - return 0; - } - return -1; -} - -IV PerlIOBase_binmode(pTHX_ PerlIO *f) { if (PerlIOValid(f)) { @@ -1691,6 +1720,7 @@ Perl_PerlIO_set_ptrcnt(pTHX_ PerlIO *f, STDCHAR * ptr, int cnt) } } + /*--------------------------------------------------------------------------------------*/ /* * utf8 and raw dummy layers |