Initial bulk commit for "Git on MSys"
[msysgit/historical-msysgit.git] / lib / perl5 / 5.6.1 / msys / CORE / perlsfio.h
blobd9b3323bf5cd0f3d84a7651893984dc64a10d6eb
1 /* The next #ifdef should be redundant if Configure behaves ... */
2 #ifdef I_SFIO
3 #include <sfio.h>
4 #endif
6 /* sfio 2000 changed _stdopen to _stdfdopen */
7 #if SFIO_VERSION >= 20000101L
8 #define _stdopen _stdfdopen
9 #endif
11 extern Sfio_t* _stdopen _ARG_((int, const char*));
12 extern int _stdprintf _ARG_((const char*, ...));
14 #define PerlIO Sfio_t
15 #define PerlIO_stderr() sfstderr
16 #define PerlIO_stdout() sfstdout
17 #define PerlIO_stdin() sfstdin
19 #define PerlIO_printf sfprintf
20 #define PerlIO_stdoutf _stdprintf
21 #define PerlIO_vprintf(f,fmt,a) sfvprintf(f,fmt,a)
22 #define PerlIO_read(f,buf,count) sfread(f,buf,count)
23 #define PerlIO_write(f,buf,count) sfwrite(f,buf,count)
24 #define PerlIO_open(path,mode) sfopen(NULL,path,mode)
25 #define PerlIO_fdopen(fd,mode) _stdopen(fd,mode)
26 #define PerlIO_reopen(path,mode,f) sfopen(f,path,mode)
27 #define PerlIO_close(f) sfclose(f)
28 #define PerlIO_puts(f,s) sfputr(f,s,-1)
29 #define PerlIO_putc(f,c) sfputc(f,c)
30 #define PerlIO_ungetc(f,c) sfungetc(f,c)
31 #define PerlIO_sprintf sfsprintf
32 #define PerlIO_getc(f) sfgetc(f)
33 #define PerlIO_eof(f) sfeof(f)
34 #define PerlIO_error(f) sferror(f)
35 #define PerlIO_fileno(f) sffileno(f)
36 #define PerlIO_clearerr(f) sfclrerr(f)
37 #define PerlIO_flush(f) sfsync(f)
38 #if 0
39 /* This breaks tests */
40 #define PerlIO_tell(f) sfseek(f,0,1|SF_SHARE)
41 #else
42 #define PerlIO_tell(f) sftell(f)
43 #endif
44 #define PerlIO_seek(f,o,w) sfseek(f,o,w)
45 #define PerlIO_rewind(f) (void) sfseek((f),0L,0)
46 #define PerlIO_tmpfile() sftmp(0)
48 #define PerlIO_importFILE(f,fl) Perl_croak(aTHX_ "Import from FILE * unimplemeted")
49 #define PerlIO_exportFILE(f,fl) Perl_croak(aTHX_ "Export to FILE * unimplemeted")
50 #define PerlIO_findFILE(f) NULL
51 #define PerlIO_releaseFILE(p,f) Perl_croak(aTHX_ "Release of FILE * unimplemeted")
53 #define PerlIO_setlinebuf(f) sfset(f,SF_LINE,1)
55 /* Now our interface to equivalent of Configure's FILE_xxx macros */
57 #define PerlIO_has_cntptr(f) 1
58 #define PerlIO_get_ptr(f) ((f)->next)
59 #define PerlIO_get_cnt(f) ((f)->endr - (f)->next)
60 #define PerlIO_canset_cnt(f) 1
61 #define PerlIO_fast_gets(f) 1
62 #define PerlIO_set_ptrcnt(f,p,c) STMT_START {(f)->next = (unsigned char *)(p); assert(PerlIO_get_cnt(f) == (c));} STMT_END
63 #define PerlIO_set_cnt(f,c) STMT_START {(f)->next = (f)->endr - (c);} STMT_END
65 #define PerlIO_has_base(f) 1
66 #define PerlIO_get_base(f) ((f)->data)
67 #define PerlIO_get_bufsiz(f) ((f)->endr - (f)->data)