PageRenderTime 90ms CodeModel.GetById 85ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 0ms

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