via.xs revision 7c478bd95313f5f23a4c958a745db2134aa03244
#define PERL_NO_GET_CONTEXT
#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"
#ifdef PERLIO_LAYERS
#include "perliol.h"
typedef struct
{
CV *SETLINEBUF;
} PerlIOVia;
#define MYMethod(x) #x,&s->x
CV *
{
#if 0
#endif
if (gv) {
}
else {
}
}
/*
* Try and call method, possibly via cached lookup.
* If method does not exist return Nullsv (caller may fallback to another approach
* If method does exist call it with flags passing variable number of args
* Last arg is a "filehandle" to layer below (if present)
* Returns scalar returned by method (if any) otherwise sv_undef
*/
SV *
...)
{
dSP;
}
if (*PerlIONext(f)) {
if (!s->fh) {
}
}
else {
PerlIO_debug("No next\n");
/* FIXME: How should this work for OPEN etc? */
}
if (count) {
}
else {
result = &PL_sv_undef;
}
}
return result;
}
PerlIO_funcs * tab)
{
if (code == 0) {
if (!arg) {
if (ckWARN(WARN_LAYER))
"No package specified");
code = -1;
}
else {
if (!s->stash) {
s->obj =
pkglen + 13);
}
if (s->stash) {
char lmode[8];
if (!mode) {
/* binmode() passes NULL - so find out what mode is */
}
if (result) {
if (sv_isobject(result)) {
}
}
else {
goto push_failed;
}
}
else {
}
(CV *) - 1)
else
}
else {
if (ckWARN(WARN_LAYER))
"Cannot find package '%.*s'", (int) pkglen,
pkg);
#ifdef ENOSYS
#else
#ifdef ENOENT
#endif
#endif
code = -1;
}
}
}
return code;
}
PerlIO *
{
if (!f) {
}
else {
/* Reopen */
return NULL;
}
if (f) {
if (fd >= 0) {
result =
Nullsv);
}
else if (narg > 0) {
if (*mode == '#') {
result =
}
else {
result =
}
}
if (result) {
if (sv_isobject(result))
return NULL;
}
}
else {
/* Required open method not present */
IV m = n - 1;
while (m >= 0) {
PerlIO_funcs *t =
if (t && t->Open) {
tab = t;
break;
}
n--;
}
if (tab) {
PerlIONext(f), *PerlIONext(f));
if (m + 1 < n) {
/*
* More layers above the one that we used to open -
* apply them now
*/
n) != 0) {
/* If pushing layers fails close the file */
PerlIO_close(f);
f = NULL;
}
}
/* FIXME - Call an OPENED method here ? */
return f;
}
else {
PerlIONext(f), *PerlIONext(f));
/* Sub-layer open failed */
}
}
else {
PerlIO_debug("Nothing to open with");
/* Nothing to do the open */
}
PerlIO_pop(aTHX_ f);
return NULL;
}
}
return f;
}
{
if (s->var) {
SvREFCNT_dec(s->var);
}
if (s->io) {
}
if (s->fh) {
SvREFCNT_dec(s->fh);
}
if (s->obj) {
SvREFCNT_dec(s->obj);
}
return 0;
}
{
return code;
}
{
}
{
PerlIO_pop(aTHX_ f);
return 0;
}
}
{
Nullsv);
if (result)
else
return (Off_t) -1;
#else
#endif
}
{
return (result)
: (Off_t) - 1;
}
{
if (result)
else {
}
}
{
}
else {
Nullsv);
if (result) {
return rd;
}
}
}
return rd;
}
{
Nullsv);
if (result)
return -1;
}
return 0;
}
{
if (s->var) {
SvREFCNT_dec(s->var);
}
return 0;
}
else
}
return -1;
}
{
SvREFCNT_dec(s->var);
}
}
STDCHAR *
{
if (s->var) {
}
}
}
STDCHAR *
{
if (s->var) {
return p;
}
}
}
{
if (s->var) {
return s->cnt;
}
}
return 0;
}
{
if (s->var)
}
return 0;
}
void
{
}
void
{
}
void
{
}
{
}
{
}
SV *
{
}
PerlIO *
int flags)
{
/* Most of the fields will lazily set themselves up as needed
stash and obj have been set up by the implied push
*/
}
return f;
}
sizeof(PerlIO_funcs),
"via",
sizeof(PerlIOVia),
PerlIOVia_open, /* NULL, */
PerlIOVia_binmode, /* NULL, */
};
#endif /* Layers available */
BOOT:
{
#ifdef PERLIO_LAYERS
#endif
}