1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24 #if defined _IO_EOF_SEEN
25 # if !defined _IO_UNBUFFERED
26 # define _IO_UNBUFFERED 0x2
27 # endif
28 # if !defined _IO_IN_BACKUP
29 # define _IO_IN_BACKUP 0x100
30 # endif
31 #endif
32
33
34
35 #if defined __NetBSD__
36
37 # include <sys/param.h>
38 #endif
39
40 #include <errno.h>
41
42 #if defined __sferror || defined __DragonFly__ || defined __ANDROID__
43
44
45 # if defined __DragonFly__
46
47 # define fp_ ((struct { struct __FILE_public pub; \
48 struct { unsigned char *_base; int _size; } _bf; \
49 void *cookie; \
50 void *_close; \
51 void *_read; \
52 void *_seek; \
53 void *_write; \
54 struct { unsigned char *_base; int _size; } _ub; \
55 int _ur; \
56 unsigned char _ubuf[3]; \
57 unsigned char _nbuf[1]; \
58 struct { unsigned char *_base; int _size; } _lb; \
59 int _blksize; \
60 fpos_t _offset; \
61 \
62 } *) fp)
63
64 # define _p pub._p
65 # define _flags pub._flags
66 # define _r pub._r
67 # define _w pub._w
68 # elif defined __ANDROID__
69 # ifdef __LP64__
70 # define _gl_flags_file_t int
71 # else
72 # define _gl_flags_file_t short
73 # endif
74
75
76
77
78
79
80 # define fp_ ((struct { unsigned char *_p; \
81 int _r; \
82 int _w; \
83 _gl_flags_file_t _flags; \
84 _gl_flags_file_t _file; \
85 struct { unsigned char *_base; size_t _size; } _bf; \
86 int _lbfsize; \
87 void *_cookie; \
88 void *_close; \
89 void *_read; \
90 void *_seek; \
91 void *_write; \
92 struct { unsigned char *_base; size_t _size; } _ext; \
93 unsigned char *_up; \
94 int _ur; \
95 unsigned char _ubuf[3]; \
96 unsigned char _nbuf[1]; \
97 struct { unsigned char *_base; size_t _size; } _lb; \
98 int _blksize; \
99 fpos_t _offset; \
100 \
101 } *) fp)
102 # else
103 # define fp_ fp
104 # endif
105
106 # if (defined __NetBSD__ && __NetBSD_Version__ >= 105270000) || defined __OpenBSD__ || defined __minix
107
108
109
110 struct __sfileext
111 {
112 struct __sbuf _ub;
113
114 };
115 # define fp_ub ((struct __sfileext *) fp->_ext._base)->_ub
116 # elif defined __ANDROID__
117 struct __sfileext
118 {
119 struct { unsigned char *_base; size_t _size; } _ub;
120
121 };
122 # define fp_ub ((struct __sfileext *) fp_->_ext._base)->_ub
123 # else
124 # define fp_ub fp_->_ub
125 # endif
126
127 # define HASUB(fp) (fp_ub._base != NULL)
128
129 # if defined __ANDROID__
130
131
132 # ifndef __SEOF
133 # define __SLBF 1
134 # define __SNBF 2
135 # define __SRD 4
136 # define __SWR 8
137 # define __SRW 0x10
138 # define __SEOF 0x20
139 # define __SERR 0x40
140 # endif
141 # ifndef __SOFF
142 # define __SOFF 0x1000
143 # endif
144 # endif
145
146 #endif
147
148
149
150
151 #ifdef __TANDEM
152 # ifndef _IOERR
153
154
155 # define _IOERR 0x40
156 # define _IOREAD 0x80
157 # define _IOWRT 0x4
158 # define _IORW 0x100
159 # endif
160 #endif
161
162 #if defined _IOERR
163
164 # if defined __sun && defined _LP64
165 # define fp_ ((struct { unsigned char *_ptr; \
166 unsigned char *_base; \
167 unsigned char *_end; \
168 long _cnt; \
169 int _file; \
170 unsigned int _flag; \
171 } *) fp)
172 # elif defined __VMS
173 # define fp_ ((struct _iobuf *) fp)
174 # else
175 # define fp_ fp
176 # endif
177
178 # if defined _SCO_DS || (defined __SCO_VERSION__ || defined __sysv5__)
179 # define _cnt __cnt
180 # define _ptr __ptr
181 # define _base __base
182 # define _flag __flag
183 # endif
184
185 #elif defined _WIN32 && ! defined __CYGWIN__
186
187
188 # define WINDOWS_OPAQUE_FILE
189
190 struct _gl_real_FILE
191 {
192
193
194 unsigned char *_ptr;
195 unsigned char *_base;
196 int _cnt;
197 int _flag;
198 int _file;
199 int _charbuf;
200 int _bufsiz;
201 };
202 # define fp_ ((struct _gl_real_FILE *) fp)
203
204
205
206 # define _IOREAD 0x1
207 # define _IOWRT 0x2
208 # define _IORW 0x4
209 # define _IOEOF 0x8
210 # define _IOERR 0x10
211
212 #endif