** without checking the ungetc buffer.
**/
-/* Not very thread-safe? */
static S64_IOB *s64_buffer = (S64_IOB *) NULL;
/* initialize the buffer area */
}
/* get a buffered stream pointer */
-static S64_IOB *S_s64_get_buffer( PerlIO *fp) {
+static S64_IOB *S_s64_get_buffer(pTHX_ PerlIO *fp) {
S64_IOB *ptr = s64_buffer;
while( ptr && ptr->fp != fp)
ptr = ptr->next;
}
/* create a buffered stream pointer */
-static S64_IOB *S_s64_create_buffer( PerlIO *f) {
+static S64_IOB *S_s64_create_buffer(pTHX_ PerlIO *f) {
S64_IOB *ptr = malloc( sizeof( S64_IOB));
if( ptr) {
ptr->fp = f;
}
/* delete a buffered stream pointer */
-void Perl_do_s64_delete_buffer( PerlIO *f) {
- S64_IOB *ptr = S_s64_get_buffer(f);
+void Perl_do_s64_delete_buffer(pTHX_ PerlIO *f) {
+ S64_IOB *ptr = S_s64_get_buffer(aTHX_ f);
if( ptr) {
/* fix the stream pointer according to the bytes buffered */
/* required, if this is called in a seek-context */
/* internal buffer management */
#define _S64_BUFFER_SIZE 32
-static int S_s64_malloc( S64_IOB *ptr) {
+static int S_s64_malloc(pTHX_ S64_IOB *ptr) {
if( ptr) {
if( !ptr->buffer) {
ptr->buffer = (int *) calloc( _S64_BUFFER_SIZE, sizeof( int));
}
/* SOCKS 64 bit getc replacement */
-int Perl_do_s64_getc( PerlIO *f) {
- S64_IOB *ptr = S_s64_get_buffer(f);
+int Perl_do_s64_getc(pTHX_ PerlIO *f) {
+ S64_IOB *ptr = S_s64_get_buffer(aTHX_ f);
if( ptr) {
if( ptr->cnt)
return( ptr->buffer[--ptr->cnt]);
}
/* SOCKS 64 bit ungetc replacement */
-int Perl_do_s64_ungetc( int ch, PerlIO *f) {
- S64_IOB *ptr = S_s64_get_buffer(f);
+int Perl_do_s64_ungetc(pTHX_ int ch, PerlIO *f) {
+ S64_IOB *ptr = S_s64_get_buffer(aTHX_ f);
- if( !ptr) ptr = S_s64_create_buffer(f);
+ if( !ptr) ptr = S_s64_create_buffer(aTHX_ f);
if( !ptr) return( EOF);
if( !ptr->buffer || (ptr->buffer && ptr->cnt >= ptr->size))
- if( !S_s64_malloc( ptr)) return( EOF);
+ if( !S_s64_malloc(aTHX_ ptr)) return( EOF);
ptr->buffer[ptr->cnt++] = ch;
return( ch);
}
/* SOCKS 64 bit fread replacement */
-SSize_t Perl_do_s64_fread(void *buf, SSize_t count, PerlIO* f) {
+SSize_t Perl_do_s64_fread(pTHX_ void *buf, SSize_t count, PerlIO* f) {
SSize_t len = 0;
char *bufptr = (char *) buf;
- S64_IOB *ptr = S_s64_get_buffer(f);
+ S64_IOB *ptr = S_s64_get_buffer(aTHX_ f);
if( ptr) {
while( ptr->cnt && count) {
*bufptr++ = ptr->buffer[--ptr->cnt];
}
/* SOCKS 64 bit fseek replacement */
-int Perl_do_s64_seek(PerlIO* f, Off_t offset, int whence) {
- S64_IOB *ptr = S_s64_get_buffer(f);
+int Perl_do_s64_seek(pTHX_ PerlIO* f, Off_t offset, int whence) {
+ S64_IOB *ptr = S_s64_get_buffer(aTHX_ f);
/* Simply clear the buffer and seek if the position is absolute */
if( SEEK_SET == whence || SEEK_END == whence) {
}
/* SOCKS 64 bit ftell replacement */
-Off_t Perl_do_s64_tell(PerlIO* f) {
+Off_t Perl_do_s64_tell(pTHX_ PerlIO* f) {
Off_t offset = 0;
- S64_IOB *ptr = S_s64_get_buffer(f);
+ S64_IOB *ptr = S_s64_get_buffer(aTHX_ f);
if( ptr)
offset = ptr->cnt;
return( ftello(f) - offset);
#define do_vecset Perl_do_vecset
#define do_vop Perl_do_vop
#if defined(SOCKS_64BIT_BUG)
+#define do_s64_tell Perl_do_s64_tell
+#define do_s64_fread Perl_do_s64_fread
+#define do_s64_getc Perl_do_s64_getc
+#define do_s64_seek Perl_do_s64_seek
+#define do_s64_ungetc Perl_do_s64_ungetc
+#define do_s64_delete_buffer Perl_do_s64_delete_buffer
#define s64_get_buffer S_s64_get_buffer
#define s64_create_buffer S_s64_create_buffer
#define s64_malloc S_s64_malloc
#define do_vecset(a) Perl_do_vecset(aTHX_ a)
#define do_vop(a,b,c,d) Perl_do_vop(aTHX_ a,b,c,d)
#if defined(SOCKS_64BIT_BUG)
+#define do_s64_tell(a) Perl_do_s64_tell(aTHX_ a)
+#define do_s64_fread(a,b,c) Perl_do_s64_fread(aTHX_ a,b,c)
+#define do_s64_getc(a) Perl_do_s64_getc(aTHX_ a)
+#define do_s64_seek(a,b,c) Perl_do_s64_seek(aTHX_ a,b,c)
+#define do_s64_ungetc(a,b) Perl_do_s64_ungetc(aTHX_ a,b)
+#define do_s64_delete_buffer(a) Perl_do_s64_delete_buffer(aTHX_ a)
#define s64_get_buffer(a) S_s64_get_buffer(aTHX_ a)
#define s64_create_buffer(a) S_s64_create_buffer(aTHX_ a)
#define s64_malloc(a) S_s64_malloc(aTHX_ a)
#define Perl_do_vop CPerlObj::Perl_do_vop
#define do_vop Perl_do_vop
#if defined(SOCKS_64BIT_BUG)
+#define Perl_do_s64_tell CPerlObj::Perl_do_s64_tell
#define do_s64_tell Perl_do_s64_tell
+#define Perl_do_s64_fread CPerlObj::Perl_do_s64_fread
#define do_s64_fread Perl_do_s64_fread
+#define Perl_do_s64_getc CPerlObj::Perl_do_s64_getc
#define do_s64_getc Perl_do_s64_getc
+#define Perl_do_s64_seek CPerlObj::Perl_do_s64_seek
#define do_s64_seek Perl_do_s64_seek
+#define Perl_do_s64_ungetc CPerlObj::Perl_do_s64_ungetc
#define do_s64_ungetc Perl_do_s64_ungetc
+#define Perl_do_s64_delete_buffer CPerlObj::Perl_do_s64_delete_buffer
#define do_s64_delete_buffer Perl_do_s64_delete_buffer
#define do_s64_init_buffer Perl_do_s64_init_buffer
#define S_s64_get_buffer CPerlObj::S_s64_get_buffer
p |void |do_vecset |SV* sv
p |void |do_vop |I32 optype|SV* sv|SV* left|SV* right
#if defined(SOCKS_64BIT_BUG)
-Ajnop |Off_t |do_s64_tell |PerlIO* fp
-Ajnop |SSize_t|do_s64_fread |void *buf|SSize_t count|PerlIO* fp
-Ajnop |int |do_s64_getc |PerlIO* fp
-Ajnop |int |do_s64_seek |PerlIO* fp|Off_t pos|int whence
-Ajnop |int |do_s64_ungetc |int ch|PerlIO* fp
-Ajnop |void |do_s64_delete_buffer|PerlIO* fp
+p |Off_t |do_s64_tell |PerlIO* fp
+p |SSize_t|do_s64_fread |void *buf|SSize_t count|PerlIO* fp
+p |int |do_s64_getc |PerlIO* fp
+p |int |do_s64_seek |PerlIO* fp|Off_t pos|int whence
+p |int |do_s64_ungetc |int ch|PerlIO* fp
+p |void |do_s64_delete_buffer|PerlIO* fp
Ajnop |void |do_s64_init_buffer
s |S64_IOB * |s64_get_buffer |PerlIO *f
s |S64_IOB * |s64_create_buffer |PerlIO *f
#define PerlIO_fdopen fdopen
#define PerlIO_reopen freopen
#ifdef SOCKS_64BIT_BUG
-# define PerlIO_close(f) (Perl_do_s64_delete_buffer(f), fclose(f))
+# define PerlIO_close(f) (Perl_do_s64_delete_buffer(aTHX_ f), fclose(f))
#else
# define PerlIO_close(f) fclose(f)
#endif
# define PerlIO_tell(f) ftell(f)
#else
# ifdef SOCKS_64BIT_BUG
-# define PerlIO_getc(f) Perl_do_s64_getc(f)
-# define PerlIO_ungetc(f,c) Perl_do_s64_ungetc(c,f)
-# define PerlIO_read(f,buf,count) Perl_do_s64_fread(buf,count,f)
-# define PerlIO_tell(f) Perl_do_s64_tell(f)
+# define PerlIO_getc(f) Perl_do_s64_getc(aTHX_ f)
+# define PerlIO_ungetc(f,c) Perl_do_s64_ungetc(aTHX_ c,f)
+# define PerlIO_read(f,buf,count) Perl_do_s64_fread(aTHX_ buf,count,f)
+# define PerlIO_tell(f) Perl_do_s64_tell(aTHX_ f)
# else
# define PerlIO_getc(f) getc(f)
# define PerlIO_ungetc(f,c) ungetc(c,f)
#define PerlIO_clearerr(f) clearerr(f)
#define PerlIO_flush(f) Fflush(f)
#ifdef SOCKS_64BIT_BUG
-# define PerlIO_seek(f,o,w) Perl_do_s64_seek(f,o,w)
+# define PerlIO_seek(f,o,w) Perl_do_s64_seek(aTHX_ f,o,w)
#else
# if defined(VMS) && !defined(__DECC)
/* Old VAXC RTL doesn't reset EOF on seek; Perl folk seem to expect this */
PERL_CALLCONV void Perl_do_vecset(pTHX_ SV* sv);
PERL_CALLCONV void Perl_do_vop(pTHX_ I32 optype, SV* sv, SV* left, SV* right);
#if defined(SOCKS_64BIT_BUG)
-PERL_CALLCONV Off_t Perl_do_s64_tell(PerlIO* fp);
-PERL_CALLCONV SSize_t Perl_do_s64_fread(void *buf, SSize_t count, PerlIO* fp);
-PERL_CALLCONV int Perl_do_s64_getc(PerlIO* fp);
-PERL_CALLCONV int Perl_do_s64_seek(PerlIO* fp, Off_t pos, int whence);
-PERL_CALLCONV int Perl_do_s64_ungetc(int ch, PerlIO* fp);
-PERL_CALLCONV void Perl_do_s64_delete_buffer(PerlIO* fp);
+PERL_CALLCONV Off_t Perl_do_s64_tell(pTHX_ PerlIO* fp);
+PERL_CALLCONV SSize_t Perl_do_s64_fread(pTHX_ void *buf, SSize_t count, PerlIO* fp);
+PERL_CALLCONV int Perl_do_s64_getc(pTHX_ PerlIO* fp);
+PERL_CALLCONV int Perl_do_s64_seek(pTHX_ PerlIO* fp, Off_t pos, int whence);
+PERL_CALLCONV int Perl_do_s64_ungetc(pTHX_ int ch, PerlIO* fp);
+PERL_CALLCONV void Perl_do_s64_delete_buffer(pTHX_ PerlIO* fp);
PERL_CALLCONV void Perl_do_s64_init_buffer(void);
STATIC S64_IOB * S_s64_get_buffer(pTHX_ PerlIO *f);
STATIC S64_IOB * S_s64_create_buffer(pTHX_ PerlIO *f);