/tools/Ruby/lib/ruby/1.8/i386-mingw32/rubyio.h

http://github.com/agross/netopenspace · C Header · 91 lines · 68 code · 12 blank · 11 comment · 2 complexity · a94abc63b042fcf4e723ffa8f41b7880 MD5 · raw file

  1. /**********************************************************************
  2. rubyio.h -
  3. $Author: nobu $
  4. $Date: 2008-04-15 12:35:55 +0900 (Tue, 15 Apr 2008) $
  5. created at: Fri Nov 12 16:47:09 JST 1993
  6. Copyright (C) 1993-2003 Yukihiro Matsumoto
  7. **********************************************************************/
  8. #ifndef RUBYIO_H
  9. #define RUBYIO_H
  10. #include <stdio.h>
  11. #include <errno.h>
  12. #if defined(HAVE_STDIO_EXT_H)
  13. #include <stdio_ext.h>
  14. #endif
  15. typedef struct rb_io_t {
  16. FILE *f; /* stdio ptr for read/write */
  17. FILE *f2; /* additional ptr for rw pipes */
  18. int mode; /* mode flags */
  19. int pid; /* child's pid (for pipes) */
  20. int lineno; /* number of lines read */
  21. char *path; /* pathname for file */
  22. void (*finalize) _((struct rb_io_t*,int)); /* finalize proc */
  23. } rb_io_t;
  24. #define HAVE_RB_IO_T 1
  25. #define OpenFile rb_io_t /* for backward compatibility */
  26. #define FMODE_READABLE 1
  27. #define FMODE_WRITABLE 2
  28. #define FMODE_READWRITE 3
  29. #define FMODE_APPEND 64
  30. #define FMODE_CREATE 128
  31. #define FMODE_BINMODE 4
  32. #define FMODE_SYNC 8
  33. #define FMODE_WBUF 16
  34. #define FMODE_RBUF 32
  35. #define FMODE_WSPLIT 0x200
  36. #define FMODE_WSPLIT_INITIALIZED 0x400
  37. #define GetOpenFile(obj,fp) rb_io_check_closed((fp) = RFILE(rb_io_taint_check(obj))->fptr)
  38. #define MakeOpenFile(obj, fp) do {\
  39. if (RFILE(obj)->fptr) {\
  40. rb_io_close(obj);\
  41. free(RFILE(obj)->fptr);\
  42. RFILE(obj)->fptr = 0;\
  43. }\
  44. fp = 0;\
  45. fp = RFILE(obj)->fptr = ALLOC(rb_io_t);\
  46. fp->f = fp->f2 = NULL;\
  47. fp->mode = 0;\
  48. fp->pid = 0;\
  49. fp->lineno = 0;\
  50. fp->path = NULL;\
  51. fp->finalize = 0;\
  52. } while (0)
  53. #define GetReadFile(fptr) ((fptr)->f)
  54. #define GetWriteFile(fptr) (((fptr)->f2) ? (fptr)->f2 : (fptr)->f)
  55. FILE *rb_fopen _((const char*, const char*));
  56. FILE *rb_fdopen _((int, const char*));
  57. int rb_getc _((FILE*));
  58. long rb_io_fread _((char *, long, FILE *));
  59. long rb_io_fwrite _((const char *, long, FILE *));
  60. int rb_io_mode_flags _((const char*));
  61. int rb_io_modenum_flags _((int));
  62. void rb_io_check_writable _((rb_io_t*));
  63. void rb_io_check_readable _((rb_io_t*));
  64. void rb_io_fptr_finalize _((rb_io_t*));
  65. void rb_io_synchronized _((rb_io_t*));
  66. void rb_io_check_initialized _((rb_io_t*));
  67. void rb_io_check_closed _((rb_io_t*));
  68. int rb_io_wait_readable _((int));
  69. int rb_io_wait_writable _((int));
  70. void rb_io_set_nonblock(rb_io_t *fptr);
  71. VALUE rb_io_taint_check _((VALUE));
  72. NORETURN(void rb_eof_error _((void)));
  73. void rb_read_check _((FILE*));
  74. int rb_read_pending _((FILE*));
  75. #endif