Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

69 lines
2.4 KiB

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