Initialise $@ early (fixes t/lib/ph.t for threaded perl).
[p5sagit/p5-mst-13.2.git] / perlsfio.h
CommitLineData
760ac839 1/* The next #ifdef should be redundant if Configure behaves ... */
2#ifdef I_SFIO
3#include <sfio.h>
4#endif
5
6extern Sfio_t* _stdopen _ARG_((int, const char*));
7extern int _stdprintf _ARG_((const char*, ...));
8
9#define PerlIO Sfio_t
10#define PerlIO_stderr() sfstderr
11#define PerlIO_stdout() sfstdout
12#define PerlIO_stdin() sfstdin
13
14#define PerlIO_printf sfprintf
15#define PerlIO_stdoutf _stdprintf
16#define PerlIO_vprintf(f,fmt,a) sfvprintf(f,fmt,a)
17#define PerlIO_read(f,buf,count) sfread(f,buf,count)
18#define PerlIO_write(f,buf,count) sfwrite(f,buf,count)
19#define PerlIO_open(path,mode) sfopen(NULL,path,mode)
20#define PerlIO_fdopen(fd,mode) _stdopen(fd,mode)
21#define PerlIO_close(f) sfclose(f)
22#define PerlIO_puts(f,s) sfputr(f,s,-1)
23#define PerlIO_putc(f,c) sfputc(f,c)
24#define PerlIO_ungetc(f,c) sfungetc(f,c)
25#define PerlIO_sprintf sfsprintf
26#define PerlIO_getc(f) sfgetc(f)
27#define PerlIO_eof(f) sfeof(f)
28#define PerlIO_error(f) sferror(f)
29#define PerlIO_fileno(f) sffileno(f)
30#define PerlIO_clearerr(f) sfclrerr(f)
31#define PerlIO_flush(f) sfsync(f)
32#define PerlIO_tell(f) sftell(f)
33#define PerlIO_seek(f,o,w) sfseek(f,o,w)
34#define PerlIO_rewind(f) (void) sfseek((f),0L,0)
35#define PerlIO_tmpfile() sftmp(0)
36
37#define PerlIO_importFILE(f,fl) croak("Import from FILE * unimplemeted")
38#define PerlIO_exportFILE(f,fl) croak("Export to FILE * unimplemeted")
39#define PerlIO_findFILE(f) NULL
40#define PerlIO_releaseFILE(p,f) croak("Release of FILE * unimplemeted")
41
42#define PerlIO_setlinebuf(f) sfset(f,SF_LINE,1)
43
44/* Now our interface to equivalent of Configure's FILE_xxx macros */
45
46#define PerlIO_has_cntptr(f) 1
47#define PerlIO_get_ptr(f) ((f)->next)
48#define PerlIO_get_cnt(f) ((f)->endr - (f)->next)
49#define PerlIO_canset_cnt(f) 1
50#define PerlIO_fast_gets(f) 1
51#define PerlIO_set_ptrcnt(f,p,c) ((f)->next = (p))
52#define PerlIO_set_cnt(f,c) 1
53
54#define PerlIO_has_base(f) 1
55#define PerlIO_get_base(f) ((f)->data)
56#define PerlIO_get_bufsiz(f) ((f)->endr - (f)->data)
57
58