CARVIEW |
Select Language
HTTP/2 302
server: nginx
date: Thu, 31 Jul 2025 02:11:31 GMT
content-type: text/plain; charset=utf-8
content-length: 0
x-archive-redirect-reason: found capture at 20210116124906
location: https://web.archive.org/web/20210116124906/https://perl5.git.perl.org/perl5.git/blob/HEAD:/perlio.h
server-timing: captures_list;dur=0.461970, exclusion.robots;dur=0.019204, exclusion.robots.policy;dur=0.009406, esindex;dur=0.010794, cdx.remote;dur=85.538212, LoadShardBlock;dur=219.526263, PetaboxLoader3.resolve;dur=101.346059, PetaboxLoader3.datanode;dur=109.018702
x-app-server: wwwb-app219
x-ts: 302
x-tr: 338
server-timing: TR;dur=0,Tw;dur=0,Tc;dur=0
set-cookie: SERVER=wwwb-app219; path=/
x-location: All
x-rl: 0
x-na: 0
x-page-cache: MISS
server-timing: MISS
x-nid: DigitalOcean
referrer-policy: no-referrer-when-downgrade
permissions-policy: interest-cohort=()
HTTP/2 200
server: nginx
date: Thu, 31 Jul 2025 02:11:32 GMT
content-type: application/xhtml+xml; charset=utf-8
x-archive-orig-date: Sat, 16 Jan 2021 12:49:05 GMT
x-archive-orig-server: Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips
x-archive-orig-keep-alive: timeout=5, max=100
x-archive-orig-connection: Keep-Alive
x-archive-orig-x-crawler-transfer-encoding: chunked
x-archive-orig-content-length: 55498
x-archive-guessed-content-type: text/html
x-archive-guessed-charset: utf-8
memento-datetime: Sat, 16 Jan 2021 12:49:06 GMT
link: ; rel="original", ; rel="timemap"; type="application/link-format", ; rel="timegate", ; rel="first memento"; datetime="Sat, 16 Jan 2021 12:49:06 GMT", ; rel="memento"; datetime="Sat, 16 Jan 2021 12:49:06 GMT", ; rel="last memento"; datetime="Sat, 16 Jan 2021 12:49:06 GMT"
content-security-policy: default-src 'self' 'unsafe-eval' 'unsafe-inline' data: blob: archive.org web.archive.org web-static.archive.org wayback-api.archive.org athena.archive.org analytics.archive.org pragma.archivelab.org wwwb-events.archive.org
x-archive-src: CC-MAIN-2021-04-1610703506640.22-0034/CC-MAIN-20210116104719-20210116134719-00699.warc.gz
server-timing: captures_list;dur=0.540018, exclusion.robots;dur=0.019576, exclusion.robots.policy;dur=0.009432, esindex;dur=0.011349, cdx.remote;dur=14.718551, LoadShardBlock;dur=146.539887, PetaboxLoader3.datanode;dur=99.465569, PetaboxLoader3.resolve;dur=148.417436, load_resource;dur=191.692309
x-app-server: wwwb-app219
x-ts: 200
x-tr: 474
server-timing: TR;dur=0,Tw;dur=0,Tc;dur=0
x-location: All
x-rl: 0
x-na: 0
x-page-cache: MISS
server-timing: MISS
x-nid: DigitalOcean
referrer-policy: no-referrer-when-downgrade
permissions-policy: interest-cohort=()
perl5.git.perl.org Git - perl5.git/blob - perlio.h
This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
1 /* perlio.h
2 *
3 * Copyright (C) 1996, 1997, 1999, 2000, 2001, 2002, 2003,
4 * 2004, 2005, 2006, 2007, by Larry Wall and others
5 *
6 * You may distribute under the terms of either the GNU General Public
7 * License or the Artistic License, as specified in the README file.
8 *
9 */
11 #ifndef PERLIO_H_
12 #define PERLIO_H_
13 /*
14 Interface for perl to IO functions.
15 There is a hierarchy of Configure determined #define controls:
16 USE_STDIO - No longer available via Configure. Formerly forced
17 PerlIO_xxx() to be #define-d onto stdio functions.
18 Now generates compile-time error.
20 USE_PERLIO - The primary Configure variable that enables PerlIO.
21 PerlIO_xxx() are real functions
22 defined in perlio.c which implement extra functionality
23 required for utf8 support.
25 */
27 #ifndef USE_PERLIO
28 # define USE_STDIO
29 #endif
31 #ifdef USE_STDIO
32 # error "stdio is no longer supported as the default base layer -- use perlio."
33 #endif
35 /* -------------------- End of Configure controls ---------------------------- */
37 /*
38 * Although we may not want stdio to be used including <stdio.h> here
39 * avoids issues where stdio.h has strange side effects
40 */
41 #include <stdio.h>
43 #if defined(USE_64_BIT_STDIO) && defined(HAS_FTELLO) && !defined(USE_FTELL64)
44 #define ftell ftello
45 #endif
47 #if defined(USE_64_BIT_STDIO) && defined(HAS_FSEEKO) && !defined(USE_FSEEK64)
48 #define fseek fseeko
49 #endif
51 /* BS2000 includes are sometimes a bit non standard :-( */
52 #if defined(POSIX_BC) && defined(O_BINARY) && !defined(O_TEXT)
53 #undef O_BINARY
54 #endif
56 #ifndef PerlIO
57 /* ----------- PerlIO implementation ---------- */
58 /* PerlIO not #define-d to something else - define the implementation */
60 typedef struct _PerlIO PerlIOl;
61 typedef struct _PerlIO_funcs PerlIO_funcs;
62 typedef PerlIOl *PerlIO;
63 #define PerlIO PerlIO
64 #define PERLIO_LAYERS 1
66 #define PERLIO_FUNCS_DECL(funcs) const PerlIO_funcs funcs
67 #define PERLIO_FUNCS_CAST(funcs) (PerlIO_funcs*)(funcs)
69 PERL_CALLCONV void PerlIO_define_layer(pTHX_ PerlIO_funcs *tab);
70 PERL_CALLCONV PerlIO_funcs *PerlIO_find_layer(pTHX_ const char *name,
71 STRLEN len,
72 int load);
73 PERL_CALLCONV PerlIO *PerlIO_push(pTHX_ PerlIO *f, PERLIO_FUNCS_DECL(*tab),
74 const char *mode, SV *arg);
75 PERL_CALLCONV void PerlIO_pop(pTHX_ PerlIO *f);
76 PERL_CALLCONV AV* PerlIO_get_layers(pTHX_ PerlIO *f);
77 PERL_CALLCONV void PerlIO_clone(pTHX_ PerlInterpreter *proto,
78 CLONE_PARAMS *param);
80 #endif /* PerlIO */
82 /* ----------- End of implementation choices ---------- */
84 /* We now need to determine what happens if source trys to use stdio.
85 * There are three cases based on PERLIO_NOT_STDIO which XS code
86 * can set how it wants.
87 */
89 #ifdef PERL_CORE
90 /* Make a choice for perl core code
91 - currently this is set to try and catch lingering raw stdio calls.
92 This is a known issue with some non UNIX ports which still use
93 "native" stdio features.
94 */
95 # ifndef PERLIO_NOT_STDIO
96 # define PERLIO_NOT_STDIO 1
97 # endif
98 #else
99 # ifndef PERLIO_NOT_STDIO
100 # define PERLIO_NOT_STDIO 0
101 # endif
102 #endif
104 #ifdef PERLIO_NOT_STDIO
105 #if PERLIO_NOT_STDIO
106 /*
107 * PERLIO_NOT_STDIO #define'd as 1
108 * Case 1: Strong denial of stdio - make all stdio calls (we can think of) errors
109 */
110 #include "nostdio.h"
111 #else /* if PERLIO_NOT_STDIO */
112 /*
113 * PERLIO_NOT_STDIO #define'd as 0
114 * Case 2: Declares that both PerlIO and stdio can be used
115 */
116 #endif /* if PERLIO_NOT_STDIO */
117 #else /* ifdef PERLIO_NOT_STDIO */
118 /*
119 * PERLIO_NOT_STDIO not defined
120 * Case 3: Try and fake stdio calls as PerlIO calls
121 */
122 #include "fakesdio.h"
123 #endif /* ifndef PERLIO_NOT_STDIO */
125 /* ----------- fill in things that have not got #define'd ---------- */
127 #ifndef Fpos_t
128 #define Fpos_t Off_t
129 #endif
131 #ifndef EOF
132 #define EOF (-1)
133 #endif
135 /* This is to catch case with no stdio */
136 #ifndef BUFSIZ
137 #define BUFSIZ 1024
138 #endif
140 /* The default buffer size for the perlio buffering layer */
141 #ifndef PERLIOBUF_DEFAULT_BUFSIZ
142 #define PERLIOBUF_DEFAULT_BUFSIZ (BUFSIZ > 8192 ? BUFSIZ : 8192)
143 #endif
145 #ifndef SEEK_SET
146 #define SEEK_SET 0
147 #endif
149 #ifndef SEEK_CUR
150 #define SEEK_CUR 1
151 #endif
153 #ifndef SEEK_END
154 #define SEEK_END 2
155 #endif
157 #define PERLIO_DUP_CLONE 1
158 #define PERLIO_DUP_FD 2
160 /* --------------------- Now prototypes for functions --------------- */
162 START_EXTERN_C
163 #ifndef __attribute__format__
164 # ifdef HASATTRIBUTE_FORMAT
165 # define __attribute__format__(x,y,z) __attribute__((format(x,y,z)))
166 # else
167 # define __attribute__format__(x,y,z)
168 # endif
169 #endif
170 #ifndef PerlIO_init
171 PERL_CALLCONV void PerlIO_init(pTHX);
172 #endif
173 #ifndef PerlIO_stdoutf
174 PERL_CALLCONV int PerlIO_stdoutf(const char *, ...)
175 __attribute__format__(__printf__, 1, 2);
176 #endif
177 #ifndef PerlIO_puts
178 PERL_CALLCONV int PerlIO_puts(PerlIO *, const char *);
179 #endif
180 #ifndef PerlIO_open
181 PERL_CALLCONV PerlIO *PerlIO_open(const char *, const char *);
182 #endif
183 #ifndef PerlIO_openn
184 PERL_CALLCONV PerlIO *PerlIO_openn(pTHX_ const char *layers, const char *mode,
185 int fd, int imode, int perm, PerlIO *old,
186 int narg, SV **arg);
187 #endif
188 #ifndef PerlIO_eof
189 PERL_CALLCONV int PerlIO_eof(PerlIO *);
190 #endif
191 #ifndef PerlIO_error
192 PERL_CALLCONV int PerlIO_error(PerlIO *);
193 #endif
194 #ifndef PerlIO_clearerr
195 PERL_CALLCONV void PerlIO_clearerr(PerlIO *);
196 #endif
197 #ifndef PerlIO_getc
198 PERL_CALLCONV int PerlIO_getc(PerlIO *);
199 #endif
200 #ifndef PerlIO_putc
201 PERL_CALLCONV int PerlIO_putc(PerlIO *, int);
202 #endif
203 #ifndef PerlIO_ungetc
204 PERL_CALLCONV int PerlIO_ungetc(PerlIO *, int);
205 #endif
206 #ifndef PerlIO_fdopen
207 PERL_CALLCONV PerlIO *PerlIO_fdopen(int, const char *);
208 #endif
209 #ifndef PerlIO_importFILE
210 PERL_CALLCONV PerlIO *PerlIO_importFILE(FILE *, const char *);
211 #endif
212 #ifndef PerlIO_exportFILE
213 PERL_CALLCONV FILE *PerlIO_exportFILE(PerlIO *, const char *);
214 #endif
215 #ifndef PerlIO_findFILE
216 PERL_CALLCONV FILE *PerlIO_findFILE(PerlIO *);
217 #endif
218 #ifndef PerlIO_releaseFILE
219 PERL_CALLCONV void PerlIO_releaseFILE(PerlIO *, FILE *);
220 #endif
221 #ifndef PerlIO_read
222 PERL_CALLCONV SSize_t PerlIO_read(PerlIO *, void *, Size_t);
223 #endif
224 #ifndef PerlIO_unread
225 PERL_CALLCONV SSize_t PerlIO_unread(PerlIO *, const void *, Size_t);
226 #endif
227 #ifndef PerlIO_write
228 PERL_CALLCONV SSize_t PerlIO_write(PerlIO *, const void *, Size_t);
229 #endif
230 #ifndef PerlIO_setlinebuf
231 PERL_CALLCONV void PerlIO_setlinebuf(PerlIO *);
232 #endif
233 #ifndef PerlIO_printf
234 PERL_CALLCONV int PerlIO_printf(PerlIO *, const char *, ...)
235 __attribute__format__(__printf__, 2, 3);
236 #endif
237 #ifndef PerlIO_vprintf
238 PERL_CALLCONV int PerlIO_vprintf(PerlIO *, const char *, va_list);
239 #endif
240 #ifndef PerlIO_tell
241 PERL_CALLCONV Off_t PerlIO_tell(PerlIO *);
242 #endif
243 #ifndef PerlIO_seek
244 PERL_CALLCONV int PerlIO_seek(PerlIO *, Off_t, int);
245 #endif
246 #ifndef PerlIO_rewind
247 PERL_CALLCONV void PerlIO_rewind(PerlIO *);
248 #endif
249 #ifndef PerlIO_has_base
250 PERL_CALLCONV int PerlIO_has_base(PerlIO *);
251 #endif
252 #ifndef PerlIO_has_cntptr
253 PERL_CALLCONV int PerlIO_has_cntptr(PerlIO *);
254 #endif
255 #ifndef PerlIO_fast_gets
256 PERL_CALLCONV int PerlIO_fast_gets(PerlIO *);
257 #endif
258 #ifndef PerlIO_canset_cnt
259 PERL_CALLCONV int PerlIO_canset_cnt(PerlIO *);
260 #endif
261 #ifndef PerlIO_get_ptr
262 PERL_CALLCONV STDCHAR *PerlIO_get_ptr(PerlIO *);
263 #endif
264 #ifndef PerlIO_get_cnt
265 PERL_CALLCONV SSize_t PerlIO_get_cnt(PerlIO *);
266 #endif
267 #ifndef PerlIO_set_cnt
268 PERL_CALLCONV void PerlIO_set_cnt(PerlIO *, SSize_t);
269 #endif
270 #ifndef PerlIO_set_ptrcnt
271 PERL_CALLCONV void PerlIO_set_ptrcnt(PerlIO *, STDCHAR *, SSize_t);
272 #endif
273 #ifndef PerlIO_get_base
274 PERL_CALLCONV STDCHAR *PerlIO_get_base(PerlIO *);
275 #endif
276 #ifndef PerlIO_get_bufsiz
277 PERL_CALLCONV SSize_t PerlIO_get_bufsiz(PerlIO *);
278 #endif
279 #ifndef PerlIO_tmpfile
280 PERL_CALLCONV PerlIO *PerlIO_tmpfile(void);
281 #endif
282 #ifndef PerlIO_tmpfile_flags
283 PERL_CALLCONV PerlIO *PerlIO_tmpfile_flags(int flags);
284 #endif
285 #ifndef PerlIO_stdin
286 PERL_CALLCONV PerlIO *PerlIO_stdin(void);
287 #endif
288 #ifndef PerlIO_stdout
289 PERL_CALLCONV PerlIO *PerlIO_stdout(void);
290 #endif
291 #ifndef PerlIO_stderr
292 PERL_CALLCONV PerlIO *PerlIO_stderr(void);
293 #endif
294 #ifndef PerlIO_getpos
295 PERL_CALLCONV int PerlIO_getpos(PerlIO *, SV *);
296 #endif
297 #ifndef PerlIO_setpos
298 PERL_CALLCONV int PerlIO_setpos(PerlIO *, SV *);
299 #endif
300 #ifndef PerlIO_fdupopen
301 PERL_CALLCONV PerlIO *PerlIO_fdupopen(pTHX_ PerlIO *, CLONE_PARAMS *, int);
302 #endif
303 #if !defined(PerlIO_modestr)
304 PERL_CALLCONV char *PerlIO_modestr(PerlIO *, char *buf);
305 #endif
306 #ifndef PerlIO_isutf8
307 PERL_CALLCONV int PerlIO_isutf8(PerlIO *);
308 #endif
309 #ifndef PerlIO_apply_layers
310 PERL_CALLCONV int PerlIO_apply_layers(pTHX_ PerlIO *f, const char *mode,
311 const char *names);
312 #endif
313 #ifndef PerlIO_binmode
314 PERL_CALLCONV int PerlIO_binmode(pTHX_ PerlIO *f, int iotype, int omode,
315 const char *names);
316 #endif
317 #ifndef PerlIO_getname
318 PERL_CALLCONV char *PerlIO_getname(PerlIO *, char *);
319 #endif
321 PERL_CALLCONV void PerlIO_destruct(pTHX);
323 PERL_CALLCONV int PerlIO_intmode2str(int rawmode, char *mode, int *writing);
325 #ifdef PERLIO_LAYERS
326 PERL_CALLCONV void PerlIO_cleanup(pTHX);
328 PERL_CALLCONV void PerlIO_debug(const char *fmt, ...)
329 __attribute__format__(__printf__, 1, 2);
330 typedef struct PerlIO_list_s PerlIO_list_t;
332 #endif
334 END_EXTERN_C
335 #endif /* PERLIO_H_ */
337 /*
338 * ex: set ts=8 sts=4 sw=4 et:
339 */