}
IV
-PerlIOVia_pushed(PerlIO *f, const char *mode, SV *arg)
+PerlIOVia_pushed(pTHX_ PerlIO *f, const char *mode, SV *arg)
{
- IV code = PerlIOBase_pushed(f,mode,Nullsv);
+ IV code = PerlIOBase_pushed(aTHX_ f,mode,Nullsv);
if (code == 0)
{
- dTHX;
PerlIOVia *s = PerlIOSelf(f,PerlIOVia);
if (!arg)
{
}
IV
-PerlIOVia_popped(PerlIO *f)
+PerlIOVia_popped(pTHX_ PerlIO *f)
{
- dTHX;
PerlIOVia *s = PerlIOSelf(f,PerlIOVia);
PerlIOVia_method(aTHX_ f,MYMethod(POPPED),G_VOID,Nullsv);
if (s->var)
}
IV
-PerlIOVia_close(PerlIO *f)
+PerlIOVia_close(pTHX_ PerlIO *f)
{
- dTHX;
PerlIOVia *s = PerlIOSelf(f,PerlIOVia);
- IV code = PerlIOBase_close(f);
+ IV code = PerlIOBase_close(aTHX_ f);
SV *result = PerlIOVia_method(aTHX_ f,MYMethod(CLOSE),G_SCALAR,Nullsv);
if (result && SvIV(result) != 0)
code = SvIV(result);
}
IV
-PerlIOVia_fileno(PerlIO *f)
+PerlIOVia_fileno(pTHX_ PerlIO *f)
{
- dTHX;
PerlIOVia *s = PerlIOSelf(f,PerlIOVia);
SV *result = PerlIOVia_method(aTHX_ f,MYMethod(FILENO),G_SCALAR,Nullsv);
return (result) ? SvIV(result) : PerlIO_fileno(PerlIONext(f));
}
IV
-PerlIOVia_seek(PerlIO *f, Off_t offset, int whence)
+PerlIOVia_seek(pTHX_ PerlIO *f, Off_t offset, int whence)
{
- dTHX;
PerlIOVia *s = PerlIOSelf(f,PerlIOVia);
SV *offsv = sv_2mortal(newSViv(offset));
SV *whsv = sv_2mortal(newSViv(whence));
}
Off_t
-PerlIOVia_tell(PerlIO *f)
+PerlIOVia_tell(pTHX_ PerlIO *f)
{
- dTHX;
PerlIOVia *s = PerlIOSelf(f,PerlIOVia);
SV *result = PerlIOVia_method(aTHX_ f,MYMethod(TELL),G_SCALAR,Nullsv);
return (result) ? (Off_t) SvIV(result) : (Off_t) -1;
}
SSize_t
-PerlIOVia_unread(PerlIO *f, const void *vbuf, Size_t count)
+PerlIOVia_unread(pTHX_ PerlIO *f, const void *vbuf, Size_t count)
{
- dTHX;
PerlIOVia *s = PerlIOSelf(f,PerlIOVia);
SV *buf = sv_2mortal(newSVpvn((char *)vbuf,count));
SV *result = PerlIOVia_method(aTHX_ f,MYMethod(UNREAD),G_SCALAR,buf,Nullsv);
return (SSize_t) SvIV(result);
else
{
- return PerlIOBase_unread(f,vbuf,count);
+ return PerlIOBase_unread(aTHX_ f,vbuf,count);
}
}
SSize_t
-PerlIOVia_read(PerlIO *f, void *vbuf, Size_t count)
+PerlIOVia_read(pTHX_ PerlIO *f, void *vbuf, Size_t count)
{
SSize_t rd = 0;
if (PerlIOBase(f)->flags & PERLIO_F_CANREAD)
{
if (PerlIOBase(f)->flags & PERLIO_F_FASTGETS)
{
- rd = PerlIOBase_read(f,vbuf,count);
+ rd = PerlIOBase_read(aTHX_ f,vbuf,count);
}
else
{
- dTHX;
PerlIOVia *s = PerlIOSelf(f,PerlIOVia);
SV *buf = sv_2mortal(newSV(count));
SV *n = sv_2mortal(newSViv(count));
}
SSize_t
-PerlIOVia_write(PerlIO *f, const void *vbuf, Size_t count)
+PerlIOVia_write(pTHX_ PerlIO *f, const void *vbuf, Size_t count)
{
if (PerlIOBase(f)->flags & PERLIO_F_CANWRITE)
{
- dTHX;
PerlIOVia *s = PerlIOSelf(f,PerlIOVia);
SV *buf = newSVpvn((char *)vbuf,count);
SV *result = PerlIOVia_method(aTHX_ f,MYMethod(WRITE),G_SCALAR,buf,Nullsv);
}
IV
-PerlIOVia_fill(PerlIO *f)
+PerlIOVia_fill(pTHX_ PerlIO *f)
{
if (PerlIOBase(f)->flags & PERLIO_F_CANREAD)
{
- dTHX;
PerlIOVia *s = PerlIOSelf(f,PerlIOVia);
SV *result = PerlIOVia_method(aTHX_ f,MYMethod(FILL),G_SCALAR,Nullsv);
if (s->var)
}
IV
-PerlIOVia_flush(PerlIO *f)
+PerlIOVia_flush(pTHX_ PerlIO *f)
{
- dTHX;
PerlIOVia *s = PerlIOSelf(f,PerlIOVia);
SV *result = PerlIOVia_method(aTHX_ f,MYMethod(FLUSH),G_SCALAR,Nullsv);
if (s->var && s->cnt > 0)
}
STDCHAR *
-PerlIOVia_get_base(PerlIO *f)
+PerlIOVia_get_base(pTHX_ PerlIO *f)
{
if (PerlIOBase(f)->flags & PERLIO_F_CANREAD)
{
}
STDCHAR *
-PerlIOVia_get_ptr(PerlIO *f)
+PerlIOVia_get_ptr(pTHX_ PerlIO *f)
{
if (PerlIOBase(f)->flags & PERLIO_F_CANREAD)
{
}
SSize_t
-PerlIOVia_get_cnt(PerlIO *f)
+PerlIOVia_get_cnt(pTHX_ PerlIO *f)
{
if (PerlIOBase(f)->flags & PERLIO_F_CANREAD)
{
}
Size_t
-PerlIOVia_bufsiz(PerlIO *f)
+PerlIOVia_bufsiz(pTHX_ PerlIO *f)
{
if (PerlIOBase(f)->flags & PERLIO_F_CANREAD)
{
}
void
-PerlIOVia_set_ptrcnt(PerlIO *f, STDCHAR *ptr, SSize_t cnt)
+PerlIOVia_set_ptrcnt(pTHX_ PerlIO *f, STDCHAR *ptr, SSize_t cnt)
{
PerlIOVia *s = PerlIOSelf(f,PerlIOVia);
s->cnt = cnt;
}
void
-PerlIOVia_setlinebuf(PerlIO *f)
+PerlIOVia_setlinebuf(pTHX_ PerlIO *f)
{
- dTHX;
PerlIOVia *s = PerlIOSelf(f,PerlIOVia);
PerlIOVia_method(aTHX_ f,MYMethod(SETLINEBUF),G_VOID,Nullsv);
- PerlIOBase_setlinebuf(f);
+ PerlIOBase_setlinebuf(aTHX_ f);
}
void
-PerlIOVia_clearerr(PerlIO *f)
+PerlIOVia_clearerr(pTHX_ PerlIO *f)
{
- dTHX;
PerlIOVia *s = PerlIOSelf(f,PerlIOVia);
PerlIOVia_method(aTHX_ f,MYMethod(CLEARERR),G_VOID,Nullsv);
- PerlIOBase_clearerr(f);
+ PerlIOBase_clearerr(aTHX_ f);
}
IV
-PerlIOVia_error(PerlIO *f)
+PerlIOVia_error(pTHX_ PerlIO *f)
{
- dTHX;
PerlIOVia *s = PerlIOSelf(f,PerlIOVia);
SV *result = PerlIOVia_method(aTHX_ f,"ERROR",&s->mERROR,G_SCALAR,Nullsv);
- return (result) ? SvIV(result) : PerlIOBase_error(f);
+ return (result) ? SvIV(result) : PerlIOBase_error(aTHX_ f);
}
IV
-PerlIOVia_eof(PerlIO *f)
+PerlIOVia_eof(pTHX_ PerlIO *f)
{
- dTHX;
PerlIOVia *s = PerlIOSelf(f,PerlIOVia);
SV *result = PerlIOVia_method(aTHX_ f,"EOF",&s->mEOF,G_SCALAR,Nullsv);
- return (result) ? SvIV(result) : PerlIOBase_eof(f);
+ return (result) ? SvIV(result) : PerlIOBase_eof(aTHX_ f);
}
SV *
* it has either done so itself, or it is shared and still in
* use
*/
- if ((*l->tab->Popped) (f) != 0)
+ if ((*l->tab->Popped) (aTHX_ f) != 0)
return;
}
*f = l->next;;
*f = l;
PerlIO_debug("PerlIO_push f=%p %s %s %p\n", (void*)f, tab->name,
(mode) ? mode : "(Null)", (void*)arg);
- if ((*l->tab->Pushed) (f, mode, arg) != 0) {
+ if ((*l->tab->Pushed) (aTHX_ f, mode, arg) != 0) {
PerlIO_pop(aTHX_ f);
return NULL;
}
}
IV
-PerlIOPop_pushed(PerlIO *f, const char *mode, SV *arg)
+PerlIOPop_pushed(pTHX_ PerlIO *f, const char *mode, SV *arg)
{
- dTHX;
PerlIO_pop(aTHX_ f);
if (*f) {
PerlIO_flush(f);
}
IV
-PerlIORaw_pushed(PerlIO *f, const char *mode, SV *arg)
+PerlIORaw_pushed(pTHX_ PerlIO *f, const char *mode, SV *arg)
{
/*
* Remove the dummy layer
*/
- dTHX;
PerlIO_pop(aTHX_ f);
/*
* Pop back to bottom layer
int
PerlIO__close(PerlIO *f)
{
+ dTHX;
if (f && *f)
- return (*PerlIOBase(f)->tab->Close) (f);
+ return (*PerlIOBase(f)->tab->Close) (aTHX_ f);
else {
SETERRNO(EBADF, SS$_IVCHAN);
return -1;
dTHX;
int code = -1;
if (f && *f) {
- code = (*PerlIOBase(f)->tab->Close) (f);
+ code = (*PerlIOBase(f)->tab->Close) (aTHX_ f);
while (*f) {
PerlIO_pop(aTHX_ f);
}
int
PerlIO_fileno(PerlIO *f)
{
+ dTHX;
if (f && *f)
- return (*PerlIOBase(f)->tab->Fileno) (f);
+ return (*PerlIOBase(f)->tab->Fileno) (aTHX_ f);
else {
SETERRNO(EBADF, SS$_IVCHAN);
return -1;
SSize_t
PerlIO_read(PerlIO *f, void *vbuf, Size_t count)
{
+ dTHX;
if (f && *f)
- return (*PerlIOBase(f)->tab->Read) (f, vbuf, count);
+ return (*PerlIOBase(f)->tab->Read) (aTHX_ f, vbuf, count);
else {
SETERRNO(EBADF, SS$_IVCHAN);
return -1;
SSize_t
PerlIO_unread(PerlIO *f, const void *vbuf, Size_t count)
{
+ dTHX;
if (f && *f)
- return (*PerlIOBase(f)->tab->Unread) (f, vbuf, count);
+ return (*PerlIOBase(f)->tab->Unread) (aTHX_ f, vbuf, count);
else {
SETERRNO(EBADF, SS$_IVCHAN);
return -1;
SSize_t
PerlIO_write(PerlIO *f, const void *vbuf, Size_t count)
{
+ dTHX;
if (f && *f)
- return (*PerlIOBase(f)->tab->Write) (f, vbuf, count);
+ return (*PerlIOBase(f)->tab->Write) (aTHX_ f, vbuf, count);
else {
SETERRNO(EBADF, SS$_IVCHAN);
return -1;
int
PerlIO_seek(PerlIO *f, Off_t offset, int whence)
{
+ dTHX;
if (f && *f)
- return (*PerlIOBase(f)->tab->Seek) (f, offset, whence);
+ return (*PerlIOBase(f)->tab->Seek) (aTHX_ f, offset, whence);
else {
SETERRNO(EBADF, SS$_IVCHAN);
return -1;
Off_t
PerlIO_tell(PerlIO *f)
{
+ dTHX;
if (f && *f)
- return (*PerlIOBase(f)->tab->Tell) (f);
+ return (*PerlIOBase(f)->tab->Tell) (aTHX_ f);
else {
SETERRNO(EBADF, SS$_IVCHAN);
return -1;
int
PerlIO_flush(PerlIO *f)
{
+ dTHX;
if (f) {
if (*f) {
PerlIO_funcs *tab = PerlIOBase(f)->tab;
if (tab && tab->Flush) {
- return (*tab->Flush) (f);
+ return (*tab->Flush) (aTHX_ f);
}
else {
PerlIO_debug("Cannot flush f=%p :%s\n", (void*)f, tab->name);
* things on fflush(NULL), but should we be bound by their design
* decisions? --jhi
*/
- dTHX;
PerlIO **table = &PL_perlio;
int code = 0;
while ((f = *table)) {
}
void
-PerlIOBase_flush_linebuf()
+PerlIOBase_flush_linebuf(pTHX)
{
- dTHX;
PerlIO **table = &PL_perlio;
PerlIO *f;
while ((f = *table)) {
int
PerlIO_fill(PerlIO *f)
{
+ dTHX;
if (f && *f)
- return (*PerlIOBase(f)->tab->Fill) (f);
+ return (*PerlIOBase(f)->tab->Fill) (aTHX_ f);
else {
SETERRNO(EBADF, SS$_IVCHAN);
return -1;
int
PerlIO_eof(PerlIO *f)
{
+ dTHX;
if (f && *f)
- return (*PerlIOBase(f)->tab->Eof) (f);
+ return (*PerlIOBase(f)->tab->Eof) (aTHX_ f);
else {
SETERRNO(EBADF, SS$_IVCHAN);
return -1;
int
PerlIO_error(PerlIO *f)
{
+ dTHX;
if (f && *f)
- return (*PerlIOBase(f)->tab->Error) (f);
+ return (*PerlIOBase(f)->tab->Error) (aTHX_ f);
else {
SETERRNO(EBADF, SS$_IVCHAN);
return -1;
void
PerlIO_clearerr(PerlIO *f)
{
+ dTHX;
if (f && *f)
- (*PerlIOBase(f)->tab->Clearerr) (f);
+ (*PerlIOBase(f)->tab->Clearerr) (aTHX_ f);
else
SETERRNO(EBADF, SS$_IVCHAN);
}
void
PerlIO_setlinebuf(PerlIO *f)
{
+ dTHX;
if (f && *f)
- (*PerlIOBase(f)->tab->Setlinebuf) (f);
+ (*PerlIOBase(f)->tab->Setlinebuf) (aTHX_ f);
else
SETERRNO(EBADF, SS$_IVCHAN);
}
STDCHAR *
PerlIO_get_base(PerlIO *f)
{
+ dTHX;
if (f && *f)
- return (*PerlIOBase(f)->tab->Get_base) (f);
+ return (*PerlIOBase(f)->tab->Get_base) (aTHX_ f);
return NULL;
}
int
PerlIO_get_bufsiz(PerlIO *f)
{
+ dTHX;
if (f && *f)
- return (*PerlIOBase(f)->tab->Get_bufsiz) (f);
+ return (*PerlIOBase(f)->tab->Get_bufsiz) (aTHX_ f);
return 0;
}
STDCHAR *
PerlIO_get_ptr(PerlIO *f)
{
+ dTHX;
PerlIO_funcs *tab = PerlIOBase(f)->tab;
if (tab->Get_ptr == NULL)
return NULL;
- return (*tab->Get_ptr) (f);
+ return (*tab->Get_ptr) (aTHX_ f);
}
#undef PerlIO_get_cnt
int
PerlIO_get_cnt(PerlIO *f)
{
+ dTHX;
PerlIO_funcs *tab = PerlIOBase(f)->tab;
if (tab->Get_cnt == NULL)
return 0;
- return (*tab->Get_cnt) (f);
+ return (*tab->Get_cnt) (aTHX_ f);
}
#undef PerlIO_set_cnt
void
PerlIO_set_cnt(PerlIO *f, int cnt)
{
- (*PerlIOBase(f)->tab->Set_ptrcnt) (f, NULL, cnt);
+ dTHX;
+ (*PerlIOBase(f)->tab->Set_ptrcnt) (aTHX_ f, NULL, cnt);
}
#undef PerlIO_set_ptrcnt
void
PerlIO_set_ptrcnt(PerlIO *f, STDCHAR * ptr, int cnt)
{
+ dTHX;
PerlIO_funcs *tab = PerlIOBase(f)->tab;
if (tab->Set_ptrcnt == NULL) {
- dTHX;
Perl_croak(aTHX_ "PerlIO buffer snooping abuse");
}
- (*PerlIOBase(f)->tab->Set_ptrcnt) (f, ptr, cnt);
+ (*PerlIOBase(f)->tab->Set_ptrcnt) (aTHX_ f, ptr, cnt);
}
/*--------------------------------------------------------------------------------------*/
*/
IV
-PerlIOUtf8_pushed(PerlIO *f, const char *mode, SV *arg)
+PerlIOUtf8_pushed(pTHX_ PerlIO *f, const char *mode, SV *arg)
{
if (PerlIONext(f)) {
- dTHX;
PerlIO_funcs *tab = PerlIOBase(f)->tab;
PerlIO_pop(aTHX_ f);
if (tab->kind & PERLIO_K_UTF8)
*/
IV
-PerlIOBase_fileno(PerlIO *f)
+PerlIOBase_fileno(pTHX_ PerlIO *f)
{
return PerlIO_fileno(PerlIONext(f));
}
}
IV
-PerlIOBase_pushed(PerlIO *f, const char *mode, SV *arg)
+PerlIOBase_pushed(pTHX_ PerlIO *f, const char *mode, SV *arg)
{
PerlIOl *l = PerlIOBase(f);
#if 0
}
IV
-PerlIOBase_popped(PerlIO *f)
+PerlIOBase_popped(pTHX_ PerlIO *f)
{
return 0;
}
SSize_t
-PerlIOBase_unread(PerlIO *f, const void *vbuf, Size_t count)
+PerlIOBase_unread(pTHX_ PerlIO *f, const void *vbuf, Size_t count)
{
- dTHX;
/*
* Save the position as current head considers it
*/
SSize_t done;
PerlIO_push(aTHX_ f, &PerlIO_pending, "r", Nullsv);
PerlIOSelf(f, PerlIOBuf)->posn = old;
- done = PerlIOBuf_unread(f, vbuf, count);
+ done = PerlIOBuf_unread(aTHX_ f, vbuf, count);
return done;
}
SSize_t
-PerlIOBase_read(PerlIO *f, void *vbuf, Size_t count)
+PerlIOBase_read(pTHX_ PerlIO *f, void *vbuf, Size_t count)
{
STDCHAR *buf = (STDCHAR *) vbuf;
if (f) {
}
IV
-PerlIOBase_noop_ok(PerlIO *f)
+PerlIOBase_noop_ok(pTHX_ PerlIO *f)
{
return 0;
}
IV
-PerlIOBase_noop_fail(PerlIO *f)
+PerlIOBase_noop_fail(pTHX_ PerlIO *f)
{
return -1;
}
IV
-PerlIOBase_close(PerlIO *f)
+PerlIOBase_close(pTHX_ PerlIO *f)
{
IV code = 0;
PerlIO *n = PerlIONext(f);
if (PerlIO_flush(f) != 0)
code = -1;
- if (n && *n && (*PerlIOBase(n)->tab->Close) (n) != 0)
+ if (n && *n && (*PerlIOBase(n)->tab->Close)(aTHX_ n) != 0)
code = -1;
PerlIOBase(f)->flags &=
~(PERLIO_F_CANREAD | PERLIO_F_CANWRITE | PERLIO_F_OPEN);
}
IV
-PerlIOBase_eof(PerlIO *f)
+PerlIOBase_eof(pTHX_ PerlIO *f)
{
if (f && *f) {
return (PerlIOBase(f)->flags & PERLIO_F_EOF) != 0;
}
IV
-PerlIOBase_error(PerlIO *f)
+PerlIOBase_error(pTHX_ PerlIO *f)
{
if (f && *f) {
return (PerlIOBase(f)->flags & PERLIO_F_ERROR) != 0;
}
void
-PerlIOBase_clearerr(PerlIO *f)
+PerlIOBase_clearerr(pTHX_ PerlIO *f)
{
if (f && *f) {
PerlIO *n = PerlIONext(f);
}
void
-PerlIOBase_setlinebuf(PerlIO *f)
+PerlIOBase_setlinebuf(pTHX_ PerlIO *f)
{
if (f) {
PerlIOBase(f)->flags |= PERLIO_F_LINEBUF;
}
IV
-PerlIOUnix_fileno(PerlIO *f)
+PerlIOUnix_fileno(pTHX_ PerlIO *f)
{
return PerlIOSelf(f, PerlIOUnix)->fd;
}
IV
-PerlIOUnix_pushed(PerlIO *f, const char *mode, SV *arg)
+PerlIOUnix_pushed(pTHX_ PerlIO *f, const char *mode, SV *arg)
{
- IV code = PerlIOBase_pushed(f, mode, arg);
+ IV code = PerlIOBase_pushed(aTHX_ f, mode, arg);
PerlIOUnix *s = PerlIOSelf(f, PerlIOUnix);
if (*PerlIONext(f)) {
s->fd = PerlIO_fileno(PerlIONext(f));
{
if (f) {
if (PerlIOBase(f)->flags & PERLIO_F_OPEN)
- (*PerlIOBase(f)->tab->Close) (f);
+ (*PerlIOBase(f)->tab->Close)(aTHX_ f);
}
if (narg > 0) {
char *path = SvPV_nolen(*args);
SSize_t
-PerlIOUnix_read(PerlIO *f, void *vbuf, Size_t count)
+PerlIOUnix_read(pTHX_ PerlIO *f, void *vbuf, Size_t count)
{
- dTHX;
int fd = PerlIOSelf(f, PerlIOUnix)->fd;
if (!(PerlIOBase(f)->flags & PERLIO_F_CANREAD))
return 0;
}
SSize_t
-PerlIOUnix_write(PerlIO *f, const void *vbuf, Size_t count)
+PerlIOUnix_write(pTHX_ PerlIO *f, const void *vbuf, Size_t count)
{
- dTHX;
int fd = PerlIOSelf(f, PerlIOUnix)->fd;
while (1) {
SSize_t len = PerlLIO_write(fd, vbuf, count);
}
IV
-PerlIOUnix_seek(PerlIO *f, Off_t offset, int whence)
+PerlIOUnix_seek(pTHX_ PerlIO *f, Off_t offset, int whence)
{
- dSYS;
Off_t new =
PerlLIO_lseek(PerlIOSelf(f, PerlIOUnix)->fd, offset, whence);
PerlIOBase(f)->flags &= ~PERLIO_F_EOF;
}
Off_t
-PerlIOUnix_tell(PerlIO *f)
+PerlIOUnix_tell(pTHX_ PerlIO *f)
{
- dSYS;
return PerlLIO_lseek(PerlIOSelf(f, PerlIOUnix)->fd, 0, SEEK_CUR);
}
IV
-PerlIOUnix_close(PerlIO *f)
+PerlIOUnix_close(pTHX_ PerlIO *f)
{
- dTHX;
int fd = PerlIOSelf(f, PerlIOUnix)->fd;
int code = 0;
if (PerlIOBase(f)->flags & PERLIO_F_OPEN) {
} PerlIOStdio;
IV
-PerlIOStdio_fileno(PerlIO *f)
+PerlIOStdio_fileno(pTHX_ PerlIO *f)
{
- dSYS;
return PerlSIO_fileno(PerlIOSelf(f, PerlIOStdio)->stdio);
}
* This isn't used yet ...
*/
IV
-PerlIOStdio_pushed(PerlIO *f, const char *mode, SV *arg)
+PerlIOStdio_pushed(pTHX_ PerlIO *f, const char *mode, SV *arg)
{
if (*PerlIONext(f)) {
- dSYS;
PerlIOStdio *s = PerlIOSelf(f, PerlIOStdio);
char tmode[8];
FILE *stdio =
else
return -1;
}
- return PerlIOBase_pushed(f, mode, arg);
+ return PerlIOBase_pushed(aTHX_ f, mode, arg);
}
#undef PerlIO_importFILE
}
IV
-PerlIOStdio_close(PerlIO *f)
+PerlIOStdio_close(pTHX_ PerlIO *f)
{
- dSYS;
#ifdef SOCKS5_VERSION_NAME
int optval;
Sock_size_t optlen = sizeof(int);
SSize_t
-PerlIOStdio_read(PerlIO *f, void *vbuf, Size_t count)
+PerlIOStdio_read(pTHX_ PerlIO *f, void *vbuf, Size_t count)
{
- dSYS;
FILE *s = PerlIOSelf(f, PerlIOStdio)->stdio;
SSize_t got = 0;
if (count == 1) {
}
SSize_t
-PerlIOStdio_unread(PerlIO *f, const void *vbuf, Size_t count)
+PerlIOStdio_unread(pTHX_ PerlIO *f, const void *vbuf, Size_t count)
{
- dSYS;
FILE *s = PerlIOSelf(f, PerlIOStdio)->stdio;
STDCHAR *buf = ((STDCHAR *) vbuf) + count - 1;
SSize_t unread = 0;
}
SSize_t
-PerlIOStdio_write(PerlIO *f, const void *vbuf, Size_t count)
+PerlIOStdio_write(pTHX_ PerlIO *f, const void *vbuf, Size_t count)
{
- dSYS;
return PerlSIO_fwrite(vbuf, 1, count,
PerlIOSelf(f, PerlIOStdio)->stdio);
}
IV
-PerlIOStdio_seek(PerlIO *f, Off_t offset, int whence)
+PerlIOStdio_seek(pTHX_ PerlIO *f, Off_t offset, int whence)
{
- dSYS;
FILE *stdio = PerlIOSelf(f, PerlIOStdio)->stdio;
return PerlSIO_fseek(stdio, offset, whence);
}
Off_t
-PerlIOStdio_tell(PerlIO *f)
+PerlIOStdio_tell(pTHX_ PerlIO *f)
{
- dSYS;
FILE *stdio = PerlIOSelf(f, PerlIOStdio)->stdio;
return PerlSIO_ftell(stdio);
}
IV
-PerlIOStdio_flush(PerlIO *f)
+PerlIOStdio_flush(pTHX_ PerlIO *f)
{
- dSYS;
FILE *stdio = PerlIOSelf(f, PerlIOStdio)->stdio;
if (PerlIOBase(f)->flags & PERLIO_F_CANWRITE) {
return PerlSIO_fflush(stdio);
}
IV
-PerlIOStdio_fill(PerlIO *f)
+PerlIOStdio_fill(pTHX_ PerlIO *f)
{
- dSYS;
FILE *stdio = PerlIOSelf(f, PerlIOStdio)->stdio;
int c;
/*
}
IV
-PerlIOStdio_eof(PerlIO *f)
+PerlIOStdio_eof(pTHX_ PerlIO *f)
{
- dSYS;
return PerlSIO_feof(PerlIOSelf(f, PerlIOStdio)->stdio);
}
IV
-PerlIOStdio_error(PerlIO *f)
+PerlIOStdio_error(pTHX_ PerlIO *f)
{
- dSYS;
return PerlSIO_ferror(PerlIOSelf(f, PerlIOStdio)->stdio);
}
void
-PerlIOStdio_clearerr(PerlIO *f)
+PerlIOStdio_clearerr(pTHX_ PerlIO *f)
{
- dSYS;
PerlSIO_clearerr(PerlIOSelf(f, PerlIOStdio)->stdio);
}
void
-PerlIOStdio_setlinebuf(PerlIO *f)
+PerlIOStdio_setlinebuf(pTHX_ PerlIO *f)
{
- dSYS;
#ifdef HAS_SETLINEBUF
PerlSIO_setlinebuf(PerlIOSelf(f, PerlIOStdio)->stdio);
#else
#ifdef FILE_base
STDCHAR *
-PerlIOStdio_get_base(PerlIO *f)
+PerlIOStdio_get_base(pTHX_ PerlIO *f)
{
- dSYS;
FILE *stdio = PerlIOSelf(f, PerlIOStdio)->stdio;
return (STDCHAR*)PerlSIO_get_base(stdio);
}
Size_t
-PerlIOStdio_get_bufsiz(PerlIO *f)
+PerlIOStdio_get_bufsiz(pTHX_ PerlIO *f)
{
- dSYS;
FILE *stdio = PerlIOSelf(f, PerlIOStdio)->stdio;
return PerlSIO_get_bufsiz(stdio);
}
#ifdef USE_STDIO_PTR
STDCHAR *
-PerlIOStdio_get_ptr(PerlIO *f)
+PerlIOStdio_get_ptr(pTHX_ PerlIO *f)
{
- dSYS;
FILE *stdio = PerlIOSelf(f, PerlIOStdio)->stdio;
return (STDCHAR*)PerlSIO_get_ptr(stdio);
}
SSize_t
-PerlIOStdio_get_cnt(PerlIO *f)
+PerlIOStdio_get_cnt(pTHX_ PerlIO *f)
{
- dSYS;
FILE *stdio = PerlIOSelf(f, PerlIOStdio)->stdio;
return PerlSIO_get_cnt(stdio);
}
void
-PerlIOStdio_set_ptrcnt(PerlIO *f, STDCHAR * ptr, SSize_t cnt)
+PerlIOStdio_set_ptrcnt(pTHX_ PerlIO *f, STDCHAR * ptr, SSize_t cnt)
{
FILE *stdio = PerlIOSelf(f, PerlIOStdio)->stdio;
- dSYS;
if (ptr != NULL) {
#ifdef STDIO_PTR_LVALUE
- PerlSIO_set_ptr(stdio, (void*)ptr); /* LHS STDCHAR* cast non-portable */
+ PerlSIO_set_ptr(stdio, (void*)ptr); /* LHS STDCHAR* cast non-portable */
#ifdef STDIO_PTR_LVAL_SETS_CNT
if (PerlSIO_get_cnt(stdio) != (cnt)) {
dTHX;
*/
IV
-PerlIOBuf_pushed(PerlIO *f, const char *mode, SV *arg)
+PerlIOBuf_pushed(pTHX_ PerlIO *f, const char *mode, SV *arg)
{
- dSYS;
PerlIOBuf *b = PerlIOSelf(f, PerlIOBuf);
int fd = PerlIO_fileno(f);
Off_t posn;
if (posn != (Off_t) - 1) {
b->posn = posn;
}
- return PerlIOBase_pushed(f, mode, arg);
+ return PerlIOBase_pushed(aTHX_ f, mode, arg);
}
PerlIO *
(*tab->Open) (aTHX_ tab, layers, n - 1, mode, fd, imode, perm,
next, narg, args);
if (!next
- || (*PerlIOBase(f)->tab->Pushed) (f, mode, PerlIOArg) != 0) {
+ || (*PerlIOBase(f)->tab->Pushed) (aTHX_ f, mode, PerlIOArg) != 0) {
return NULL;
}
}
* read or write state
*/
IV
-PerlIOBuf_flush(PerlIO *f)
+PerlIOBuf_flush(pTHX_ PerlIO *f)
{
PerlIOBuf *b = PerlIOSelf(f, PerlIOBuf);
int code = 0;
}
IV
-PerlIOBuf_fill(PerlIO *f)
+PerlIOBuf_fill(pTHX_ PerlIO *f)
{
PerlIOBuf *b = PerlIOSelf(f, PerlIOBuf);
PerlIO *n = PerlIONext(f);
if (PerlIO_flush(f) != 0)
return -1;
if (PerlIOBase(f)->flags & PERLIO_F_TTY)
- PerlIOBase_flush_linebuf();
+ PerlIOBase_flush_linebuf(aTHX);
if (!b->buf)
PerlIO_get_base(f); /* allocate via vtable */
}
SSize_t
-PerlIOBuf_read(PerlIO *f, void *vbuf, Size_t count)
+PerlIOBuf_read(pTHX_ PerlIO *f, void *vbuf, Size_t count)
{
PerlIOBuf *b = PerlIOSelf(f, PerlIOBuf);
if (f) {
if (!b->ptr)
PerlIO_get_base(f);
- return PerlIOBase_read(f, vbuf, count);
+ return PerlIOBase_read(aTHX_ f, vbuf, count);
}
return 0;
}
SSize_t
-PerlIOBuf_unread(PerlIO *f, const void *vbuf, Size_t count)
+PerlIOBuf_unread(pTHX_ PerlIO *f, const void *vbuf, Size_t count)
{
const STDCHAR *buf = (const STDCHAR *) vbuf + count;
PerlIOBuf *b = PerlIOSelf(f, PerlIOBuf);
}
SSize_t
-PerlIOBuf_write(PerlIO *f, const void *vbuf, Size_t count)
+PerlIOBuf_write(pTHX_ PerlIO *f, const void *vbuf, Size_t count)
{
PerlIOBuf *b = PerlIOSelf(f, PerlIOBuf);
const STDCHAR *buf = (const STDCHAR *) vbuf;
}
IV
-PerlIOBuf_seek(PerlIO *f, Off_t offset, int whence)
+PerlIOBuf_seek(pTHX_ PerlIO *f, Off_t offset, int whence)
{
IV code;
if ((code = PerlIO_flush(f)) == 0) {
}
Off_t
-PerlIOBuf_tell(PerlIO *f)
+PerlIOBuf_tell(pTHX_ PerlIO *f)
{
PerlIOBuf *b = PerlIOSelf(f, PerlIOBuf);
/*
}
IV
-PerlIOBuf_close(PerlIO *f)
+PerlIOBuf_close(pTHX_ PerlIO *f)
{
- IV code = PerlIOBase_close(f);
+ IV code = PerlIOBase_close(aTHX_ f);
PerlIOBuf *b = PerlIOSelf(f, PerlIOBuf);
if (b->buf && b->buf != (STDCHAR *) & b->oneword) {
Safefree(b->buf);
}
STDCHAR *
-PerlIOBuf_get_ptr(PerlIO *f)
+PerlIOBuf_get_ptr(pTHX_ PerlIO *f)
{
PerlIOBuf *b = PerlIOSelf(f, PerlIOBuf);
if (!b->buf)
}
SSize_t
-PerlIOBuf_get_cnt(PerlIO *f)
+PerlIOBuf_get_cnt(pTHX_ PerlIO *f)
{
PerlIOBuf *b = PerlIOSelf(f, PerlIOBuf);
if (!b->buf)
}
STDCHAR *
-PerlIOBuf_get_base(PerlIO *f)
+PerlIOBuf_get_base(pTHX_ PerlIO *f)
{
PerlIOBuf *b = PerlIOSelf(f, PerlIOBuf);
if (!b->buf) {
}
Size_t
-PerlIOBuf_bufsiz(PerlIO *f)
+PerlIOBuf_bufsiz(pTHX_ PerlIO *f)
{
PerlIOBuf *b = PerlIOSelf(f, PerlIOBuf);
if (!b->buf)
}
void
-PerlIOBuf_set_ptrcnt(PerlIO *f, STDCHAR * ptr, SSize_t cnt)
+PerlIOBuf_set_ptrcnt(pTHX_ PerlIO *f, STDCHAR * ptr, SSize_t cnt)
{
PerlIOBuf *b = PerlIOSelf(f, PerlIOBuf);
if (!b->buf)
*/
IV
-PerlIOPending_fill(PerlIO *f)
+PerlIOPending_fill(pTHX_ PerlIO *f)
{
/*
* Should never happen
}
IV
-PerlIOPending_close(PerlIO *f)
+PerlIOPending_close(pTHX_ PerlIO *f)
{
/*
* A tad tricky - flush pops us, then we close new top
}
IV
-PerlIOPending_seek(PerlIO *f, Off_t offset, int whence)
+PerlIOPending_seek(pTHX_ PerlIO *f, Off_t offset, int whence)
{
/*
* A tad tricky - flush pops us, then we seek new top
IV
-PerlIOPending_flush(PerlIO *f)
+PerlIOPending_flush(pTHX_ PerlIO *f)
{
- dTHX;
PerlIOBuf *b = PerlIOSelf(f, PerlIOBuf);
if (b->buf && b->buf != (STDCHAR *) & b->oneword) {
Safefree(b->buf);
}
void
-PerlIOPending_set_ptrcnt(PerlIO *f, STDCHAR * ptr, SSize_t cnt)
+PerlIOPending_set_ptrcnt(pTHX_ PerlIO *f, STDCHAR * ptr, SSize_t cnt)
{
if (cnt <= 0) {
PerlIO_flush(f);
}
else {
- PerlIOBuf_set_ptrcnt(f, ptr, cnt);
+ PerlIOBuf_set_ptrcnt(aTHX_ f, ptr, cnt);
}
}
IV
-PerlIOPending_pushed(PerlIO *f, const char *mode, SV *arg)
+PerlIOPending_pushed(pTHX_ PerlIO *f, const char *mode, SV *arg)
{
- IV code = PerlIOBase_pushed(f, mode, arg);
+ IV code = PerlIOBase_pushed(aTHX_ f, mode, arg);
PerlIOl *l = PerlIOBase(f);
/*
* Our PerlIO_fast_gets must match what we are pushed on, or sv_gets()
}
SSize_t
-PerlIOPending_read(PerlIO *f, void *vbuf, Size_t count)
+PerlIOPending_read(pTHX_ PerlIO *f, void *vbuf, Size_t count)
{
SSize_t avail = PerlIO_get_cnt(f);
SSize_t got = 0;
if (count < avail)
avail = count;
if (avail > 0)
- got = PerlIOBuf_read(f, vbuf, avail);
+ got = PerlIOBuf_read(aTHX_ f, vbuf, avail);
if (got >= 0 && got < count) {
SSize_t more =
PerlIO_read(f, ((STDCHAR *) vbuf) + got, count - got);
} PerlIOCrlf;
IV
-PerlIOCrlf_pushed(PerlIO *f, const char *mode, SV *arg)
+PerlIOCrlf_pushed(pTHX_ PerlIO *f, const char *mode, SV *arg)
{
IV code;
PerlIOBase(f)->flags |= PERLIO_F_CRLF;
- code = PerlIOBuf_pushed(f, mode, arg);
+ code = PerlIOBuf_pushed(aTHX_ f, mode, arg);
#if 0
PerlIO_debug("PerlIOCrlf_pushed f=%p %s %s fl=%08" UVxf "\n",
f, PerlIOBase(f)->tab->name, (mode) ? mode : "(Null)",
SSize_t
-PerlIOCrlf_unread(PerlIO *f, const void *vbuf, Size_t count)
+PerlIOCrlf_unread(pTHX_ PerlIO *f, const void *vbuf, Size_t count)
{
PerlIOCrlf *c = PerlIOSelf(f, PerlIOCrlf);
if (c->nl) {
c->nl = NULL;
}
if (!(PerlIOBase(f)->flags & PERLIO_F_CRLF))
- return PerlIOBuf_unread(f, vbuf, count);
+ return PerlIOBuf_unread(aTHX_ f, vbuf, count);
else {
const STDCHAR *buf = (const STDCHAR *) vbuf + count;
PerlIOBuf *b = PerlIOSelf(f, PerlIOBuf);
}
SSize_t
-PerlIOCrlf_get_cnt(PerlIO *f)
+PerlIOCrlf_get_cnt(pTHX_ PerlIO *f)
{
PerlIOBuf *b = PerlIOSelf(f, PerlIOBuf);
if (!b->buf)
}
void
-PerlIOCrlf_set_ptrcnt(PerlIO *f, STDCHAR * ptr, SSize_t cnt)
+PerlIOCrlf_set_ptrcnt(pTHX_ PerlIO *f, STDCHAR * ptr, SSize_t cnt)
{
PerlIOBuf *b = PerlIOSelf(f, PerlIOBuf);
PerlIOCrlf *c = PerlIOSelf(f, PerlIOCrlf);
}
SSize_t
-PerlIOCrlf_write(PerlIO *f, const void *vbuf, Size_t count)
+PerlIOCrlf_write(pTHX_ PerlIO *f, const void *vbuf, Size_t count)
{
if (!(PerlIOBase(f)->flags & PERLIO_F_CRLF))
- return PerlIOBuf_write(f, vbuf, count);
+ return PerlIOBuf_write(aTHX_ f, vbuf, count);
else {
PerlIOBuf *b = PerlIOSelf(f, PerlIOBuf);
const STDCHAR *buf = (const STDCHAR *) vbuf;
}
IV
-PerlIOCrlf_flush(PerlIO *f)
+PerlIOCrlf_flush(pTHX_ PerlIO *f)
{
PerlIOCrlf *c = PerlIOSelf(f, PerlIOCrlf);
if (c->nl) {
*(c->nl) = 0xd;
c->nl = NULL;
}
- return PerlIOBuf_flush(f);
+ return PerlIOBuf_flush(aTHX_ f);
}
PerlIO_funcs PerlIO_crlf = {
static size_t page_size = 0;
IV
-PerlIOMmap_map(PerlIO *f)
+PerlIOMmap_map(pTHX_ PerlIO *f)
{
- dTHX;
PerlIOMmap *m = PerlIOSelf(f, PerlIOMmap);
IV flags = PerlIOBase(f)->flags;
IV code = 0;
}
STDCHAR *
-PerlIOMmap_get_base(PerlIO *f)
+PerlIOMmap_get_base(pTHX_ PerlIO *f)
{
PerlIOMmap *m = PerlIOSelf(f, PerlIOMmap);
PerlIOBuf *b = &m->base;
b->buf = NULL; /* Clear to trigger below */
}
if (!b->buf) {
- PerlIOMmap_map(f); /* Try and map it */
+ PerlIOMmap_map(aTHX_ f); /* Try and map it */
if (!b->buf) {
/*
* Map did not work - recover PerlIOBuf buffer if we have one
b->ptr = b->end = b->buf;
if (b->buf)
return b->buf;
- return PerlIOBuf_get_base(f);
+ return PerlIOBuf_get_base(aTHX_ f);
}
SSize_t
-PerlIOMmap_unread(PerlIO *f, const void *vbuf, Size_t count)
+PerlIOMmap_unread(pTHX_ PerlIO *f, const void *vbuf, Size_t count)
{
PerlIOMmap *m = PerlIOSelf(f, PerlIOMmap);
PerlIOBuf *b = &m->base;
if (!b->buf && m->bbuf)
b->buf = m->bbuf;
if (!b->buf) {
- PerlIOBuf_get_base(f);
+ PerlIOBuf_get_base(aTHX_ f);
m->bbuf = b->buf;
}
}
- return PerlIOBuf_unread(f, vbuf, count);
+ return PerlIOBuf_unread(aTHX_ f, vbuf, count);
}
SSize_t
-PerlIOMmap_write(PerlIO *f, const void *vbuf, Size_t count)
+PerlIOMmap_write(pTHX_ PerlIO *f, const void *vbuf, Size_t count)
{
PerlIOMmap *m = PerlIOSelf(f, PerlIOMmap);
PerlIOBuf *b = &m->base;
if (!b->buf && m->bbuf)
b->buf = m->bbuf;
if (!b->buf) {
- PerlIOBuf_get_base(f);
+ PerlIOBuf_get_base(aTHX_ f);
m->bbuf = b->buf;
}
}
- return PerlIOBuf_write(f, vbuf, count);
+ return PerlIOBuf_write(aTHX_ f, vbuf, count);
}
IV
-PerlIOMmap_flush(PerlIO *f)
+PerlIOMmap_flush(pTHX_ PerlIO *f)
{
PerlIOMmap *m = PerlIOSelf(f, PerlIOMmap);
PerlIOBuf *b = &m->base;
- IV code = PerlIOBuf_flush(f);
+ IV code = PerlIOBuf_flush(aTHX_ f);
/*
* Now we are "synced" at PerlIOBuf level
*/
}
IV
-PerlIOMmap_fill(PerlIO *f)
+PerlIOMmap_fill(pTHX_ PerlIO *f)
{
PerlIOBuf *b = PerlIOSelf(f, PerlIOBuf);
IV code = PerlIO_flush(f);
if (code == 0 && !b->buf) {
- code = PerlIOMmap_map(f);
+ code = PerlIOMmap_map(aTHX_ f);
}
if (code == 0 && !(PerlIOBase(f)->flags & PERLIO_F_RDBUF)) {
- code = PerlIOBuf_fill(f);
+ code = PerlIOBuf_fill(aTHX_ f);
}
return code;
}
IV
-PerlIOMmap_close(PerlIO *f)
+PerlIOMmap_close(pTHX_ PerlIO *f)
{
PerlIOMmap *m = PerlIOSelf(f, PerlIOMmap);
PerlIOBuf *b = &m->base;
m->bbuf = NULL;
b->ptr = b->end = b->buf;
}
- if (PerlIOBuf_close(f) != 0)
+ if (PerlIOBuf_close(aTHX_ f) != 0)
code = -1;
return code;
}
char *name;
Size_t size;
IV kind;
- IV (*Pushed) (PerlIO *f, const char *mode, SV *arg);
- IV (*Popped) (PerlIO *f);
+ IV (*Pushed) (pTHX_ PerlIO *f, const char *mode, SV *arg);
+ IV (*Popped) (pTHX_ PerlIO *f);
PerlIO *(*Open) (pTHX_ PerlIO_funcs *tab,
PerlIO_list_t *layers, IV n,
const char *mode,
int fd, int imode, int perm,
PerlIO *old, int narg, SV **args);
SV *(*Getarg) (pTHX_ PerlIO *f, CLONE_PARAMS *param, int flags);
- IV (*Fileno) (PerlIO *f);
+ IV (*Fileno) (pTHX_ PerlIO *f);
PerlIO *(*Dup) (pTHX_ PerlIO *f, PerlIO *o, CLONE_PARAMS *param, int flags);
/* Unix-like functions - cf sfio line disciplines */
- SSize_t(*Read) (PerlIO *f, void *vbuf, Size_t count);
- SSize_t(*Unread) (PerlIO *f, const void *vbuf, Size_t count);
- SSize_t(*Write) (PerlIO *f, const void *vbuf, Size_t count);
- IV (*Seek) (PerlIO *f, Off_t offset, int whence);
- Off_t(*Tell) (PerlIO *f);
- IV (*Close) (PerlIO *f);
+ SSize_t(*Read) (pTHX_ PerlIO *f, void *vbuf, Size_t count);
+ SSize_t(*Unread) (pTHX_ PerlIO *f, const void *vbuf, Size_t count);
+ SSize_t(*Write) (pTHX_ PerlIO *f, const void *vbuf, Size_t count);
+ IV (*Seek) (pTHX_ PerlIO *f, Off_t offset, int whence);
+ Off_t(*Tell) (pTHX_ PerlIO *f);
+ IV (*Close) (pTHX_ PerlIO *f);
/* Stdio-like buffered IO functions */
- IV (*Flush) (PerlIO *f);
- IV (*Fill) (PerlIO *f);
- IV (*Eof) (PerlIO *f);
- IV (*Error) (PerlIO *f);
- void (*Clearerr) (PerlIO *f);
- void (*Setlinebuf) (PerlIO *f);
+ IV (*Flush) (pTHX_ PerlIO *f);
+ IV (*Fill) (pTHX_ PerlIO *f);
+ IV (*Eof) (pTHX_ PerlIO *f);
+ IV (*Error) (pTHX_ PerlIO *f);
+ void (*Clearerr) (pTHX_ PerlIO *f);
+ void (*Setlinebuf) (pTHX_ PerlIO *f);
/* Perl's snooping functions */
- STDCHAR *(*Get_base) (PerlIO *f);
- Size_t(*Get_bufsiz) (PerlIO *f);
- STDCHAR *(*Get_ptr) (PerlIO *f);
- SSize_t(*Get_cnt) (PerlIO *f);
- void (*Set_ptrcnt) (PerlIO *f, STDCHAR * ptr, SSize_t cnt);
+ STDCHAR *(*Get_base) (pTHX_ PerlIO *f);
+ Size_t(*Get_bufsiz) (pTHX_ PerlIO *f);
+ STDCHAR *(*Get_ptr) (pTHX_ PerlIO *f);
+ SSize_t(*Get_cnt) (pTHX_ PerlIO *f);
+ void (*Set_ptrcnt) (pTHX_ PerlIO *f, STDCHAR * ptr, SSize_t cnt);
};
/*--------------------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------------------*/
/* Generic, or stub layer functions */
-extern IV PerlIOBase_fileno(PerlIO *f);
+extern IV PerlIOBase_fileno(pTHX_ PerlIO *f);
extern PerlIO *PerlIOBase_dup(pTHX_ PerlIO *f, PerlIO *o, CLONE_PARAMS *param, int flags);
-extern IV PerlIOBase_pushed(PerlIO *f, const char *mode, SV *arg);
-extern IV PerlIOBase_popped(PerlIO *f);
-extern SSize_t PerlIOBase_read(PerlIO *f, void *vbuf, Size_t count);
-extern SSize_t PerlIOBase_unread(PerlIO *f, const void *vbuf,
+extern IV PerlIOBase_pushed(pTHX_ PerlIO *f, const char *mode, SV *arg);
+extern IV PerlIOBase_popped(pTHX_ PerlIO *f);
+extern SSize_t PerlIOBase_read(pTHX_ PerlIO *f, void *vbuf, Size_t count);
+extern SSize_t PerlIOBase_unread(pTHX_ PerlIO *f, const void *vbuf,
Size_t count);
-extern IV PerlIOBase_eof(PerlIO *f);
-extern IV PerlIOBase_error(PerlIO *f);
-extern void PerlIOBase_clearerr(PerlIO *f);
-extern IV PerlIOBase_close(PerlIO *f);
-extern void PerlIOBase_setlinebuf(PerlIO *f);
-extern void PerlIOBase_flush_linebuf(void);
+extern IV PerlIOBase_eof(pTHX_ PerlIO *f);
+extern IV PerlIOBase_error(pTHX_ PerlIO *f);
+extern void PerlIOBase_clearerr(pTHX_ PerlIO *f);
+extern IV PerlIOBase_close(pTHX_ PerlIO *f);
+extern void PerlIOBase_setlinebuf(pTHX_ PerlIO *f);
+extern void PerlIOBase_flush_linebuf(pTHX);
-extern IV PerlIOBase_noop_ok(PerlIO *f);
-extern IV PerlIOBase_noop_fail(PerlIO *f);
+extern IV PerlIOBase_noop_ok(pTHX_ PerlIO *f);
+extern IV PerlIOBase_noop_fail(pTHX_ PerlIO *f);
/*--------------------------------------------------------------------------------------*/
/* perlio buffer layer
PerlIO_list_t *layers, IV n,
const char *mode, int fd, int imode,
int perm, PerlIO *old, int narg, SV **args);
-extern IV PerlIOBuf_pushed(PerlIO *f, const char *mode, SV *arg);
+extern IV PerlIOBuf_pushed(pTHX_ PerlIO *f, const char *mode, SV *arg);
extern PerlIO *PerlIOBuf_dup(pTHX_ PerlIO *f, PerlIO *o, CLONE_PARAMS *param, int flags);
-extern SSize_t PerlIOBuf_read(PerlIO *f, void *vbuf, Size_t count);
-extern SSize_t PerlIOBuf_unread(PerlIO *f, const void *vbuf, Size_t count);
-extern SSize_t PerlIOBuf_write(PerlIO *f, const void *vbuf, Size_t count);
-extern IV PerlIOBuf_seek(PerlIO *f, Off_t offset, int whence);
-extern Off_t PerlIOBuf_tell(PerlIO *f);
-extern IV PerlIOBuf_close(PerlIO *f);
-extern IV PerlIOBuf_flush(PerlIO *f);
-extern IV PerlIOBuf_fill(PerlIO *f);
-extern STDCHAR *PerlIOBuf_get_base(PerlIO *f);
-extern Size_t PerlIOBuf_bufsiz(PerlIO *f);
-extern STDCHAR *PerlIOBuf_get_ptr(PerlIO *f);
-extern SSize_t PerlIOBuf_get_cnt(PerlIO *f);
-extern void PerlIOBuf_set_ptrcnt(PerlIO *f, STDCHAR * ptr, SSize_t cnt);
+extern SSize_t PerlIOBuf_read(pTHX_ PerlIO *f, void *vbuf, Size_t count);
+extern SSize_t PerlIOBuf_unread(pTHX_ PerlIO *f, const void *vbuf, Size_t count);
+extern SSize_t PerlIOBuf_write(pTHX_ PerlIO *f, const void *vbuf, Size_t count);
+extern IV PerlIOBuf_seek(pTHX_ PerlIO *f, Off_t offset, int whence);
+extern Off_t PerlIOBuf_tell(pTHX_ PerlIO *f);
+extern IV PerlIOBuf_close(pTHX_ PerlIO *f);
+extern IV PerlIOBuf_flush(pTHX_ PerlIO *f);
+extern IV PerlIOBuf_fill(pTHX_ PerlIO *f);
+extern STDCHAR *PerlIOBuf_get_base(pTHX_ PerlIO *f);
+extern Size_t PerlIOBuf_bufsiz(pTHX_ PerlIO *f);
+extern STDCHAR *PerlIOBuf_get_ptr(pTHX_ PerlIO *f);
+extern SSize_t PerlIOBuf_get_cnt(pTHX_ PerlIO *f);
+extern void PerlIOBuf_set_ptrcnt(pTHX_ PerlIO *f, STDCHAR * ptr, SSize_t cnt);
extern int PerlIOUnix_oflags(const char *mode);