This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Eliminate BmPREVIOUS_set - with the complexity gone from how the datum
[perl5.git] / perlsfio.h
index c4ed5c7..3d279d0 100644 (file)
@@ -1,8 +1,25 @@
+/*    perlsfio.h
+ *
+ *    Copyright (C) 1996, 1999, 2000, 2001, 2002, by Larry Wall and others
+ *
+ *    You may distribute under the terms of either the GNU General Public
+ *    License or the Artistic License, as specified in the README file.
+ *
+ */
+
 /* The next #ifdef should be redundant if Configure behaves ... */
+#ifndef FILE
+#define FILE FILE
+#endif
 #ifdef I_SFIO
 #include <sfio.h>
 #endif
 
+/* sfio 2000 changed _stdopen to _stdfdopen */
+#if SFIO_VERSION >= 20000101L
+#define _stdopen _stdfdopen
+#endif
+
 extern Sfio_t* _stdopen _ARG_((int, const char*));
 extern int     _stdprintf _ARG_((const char*, ...));
 
@@ -11,9 +28,11 @@ extern int   _stdprintf _ARG_((const char*, ...));
 #define PerlIO_stdout()                        sfstdout
 #define PerlIO_stdin()                 sfstdin
 
+#define PerlIO_isutf8(f)               0
+
 #define PerlIO_printf                  sfprintf
 #define PerlIO_stdoutf                 _stdprintf
-#define PerlIO_vprintf(f,fmt,a)                sfvprintf(f,fmt,a)          
+#define PerlIO_vprintf(f,fmt,a)                sfvprintf(f,fmt,a)
 #define PerlIO_read(f,buf,count)       sfread(f,buf,count)
 #define PerlIO_write(f,buf,count)      sfwrite(f,buf,count)
 #define PerlIO_open(path,mode)         sfopen(NULL,path,mode)
@@ -34,25 +53,22 @@ extern int  _stdprintf _ARG_((const char*, ...));
 #define PerlIO_seek(f,o,w)             sfseek(f,o,w)
 #define PerlIO_rewind(f)               (void) sfseek((f),0L,0)
 #define PerlIO_tmpfile()               sftmp(0)
-
-#define PerlIO_importFILE(f,fl)                Perl_croak(aTHX_ "Import from FILE * unimplemeted")
-#define PerlIO_exportFILE(f,fl)                Perl_croak(aTHX_ "Export to FILE * unimplemeted")
-#define PerlIO_findFILE(f)             NULL
-#define PerlIO_releaseFILE(p,f)                Perl_croak(aTHX_ "Release of FILE * unimplemeted")
+#define PerlIO_exportFILE(f,fl)                Perl_croak(aTHX_ "Export to FILE * unimplemented")
+#define PerlIO_releaseFILE(p,f)                Perl_croak(aTHX_ "Release of FILE * unimplemented")
 
 #define PerlIO_setlinebuf(f)           sfset(f,SF_LINE,1)
 
 /* Now our interface to equivalent of Configure's FILE_xxx macros */
 
-#define PerlIO_has_cntptr(f)           1       
+#define PerlIO_has_cntptr(f)           1
 #define PerlIO_get_ptr(f)              ((f)->next)
 #define PerlIO_get_cnt(f)              ((f)->endr - (f)->next)
-#define PerlIO_canset_cnt(f)           1      
-#define PerlIO_fast_gets(f)            1        
-#define PerlIO_set_ptrcnt(f,p,c)       ((f)->next = (p))          
-#define PerlIO_set_cnt(f,c)            1
+#define PerlIO_canset_cnt(f)           1
+#define PerlIO_fast_gets(f)            1
+#define PerlIO_set_ptrcnt(f,p,c)       STMT_START {(f)->next = (unsigned char *)(p); assert(PerlIO_get_cnt(f) == (c));} STMT_END
+#define PerlIO_set_cnt(f,c)            STMT_START {(f)->next = (f)->endr - (c);} STMT_END
 
-#define PerlIO_has_base(f)             1         
+#define PerlIO_has_base(f)             1
 #define PerlIO_get_base(f)             ((f)->data)
 #define PerlIO_get_bufsiz(f)           ((f)->endr - (f)->data)