rubyio.h
DEFINITIONS
This source file includes following functions.
1
2
3
4
5
6
7
8
9
10
11
12
13 #ifndef RUBYIO_H
14 #define RUBYIO_H
15
16 #include <stdio.h>
17 #include <errno.h>
18
19 typedef struct OpenFile {
20 FILE *f;
21 FILE *f2;
22 int mode;
23 int pid;
24 int lineno;
25 char *path;
26 void (*finalize) _((struct OpenFile*));
27 } OpenFile;
28
29 #define FMODE_READABLE 1
30 #define FMODE_WRITABLE 2
31 #define FMODE_READWRITE 3
32 #define FMODE_BINMODE 4
33 #define FMODE_SYNC 8
34 #define FMODE_WBUF 16
35
36 #define GetOpenFile(obj,fp) rb_io_check_closed((fp) = RFILE(rb_io_taint_check(obj))->fptr)
37
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(OpenFile);\
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
54 #define GetReadFile(fptr) ((fptr)->f)
55 #define GetWriteFile(fptr) (((fptr)->f2) ? (fptr)->f2 : (fptr)->f)
56
57 FILE *rb_fopen _((const char*, const char*));
58 FILE *rb_fdopen _((int, const char*));
59 int rb_getc _((FILE*));
60 long rb_io_fread _((char *, long, FILE *));
61 int rb_io_mode_flags _((const char*));
62 void rb_io_check_writable _((OpenFile*));
63 void rb_io_check_readable _((OpenFile*));
64 void rb_io_fptr_finalize _((OpenFile*));
65 void rb_io_synchronized _((OpenFile*));
66 void rb_io_check_closed _((OpenFile*));
67
68 VALUE rb_io_taint_check _((VALUE));
69 void rb_eof_error _((void));
70
71 void rb_read_check _((FILE*));
72 int rb_read_pending _((FILE*));
73 #endif