| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
#ifdef __MINGW32__ |
|
3
|
|
|
|
|
|
|
#ifndef __USE_MINGW_ANSI_STDIO |
|
4
|
|
|
|
|
|
|
#define __USE_MINGW_ANSI_STDIO 1 |
|
5
|
|
|
|
|
|
|
#endif |
|
6
|
|
|
|
|
|
|
#endif |
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
#define PERL_NO_GET_CONTEXT 1 |
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
#include "EXTERN.h" |
|
11
|
|
|
|
|
|
|
#include "perl.h" |
|
12
|
|
|
|
|
|
|
#include "XSUB.h" |
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
|
|
15
|
2
|
|
|
|
|
|
SV * win32_fmode(pTHX_ FILE *stream ) { |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
#ifdef _WIN32 |
|
18
|
|
|
|
|
|
|
# ifndef LIBC_IS_UCRT |
|
19
|
|
|
|
|
|
|
/* |
|
20
|
|
|
|
|
|
|
* Win32 code supplied by BrowserUK |
|
21
|
|
|
|
|
|
|
* to work aroumd the MS C runtime library's |
|
22
|
|
|
|
|
|
|
* lack of a function to retrieve the file mode |
|
23
|
|
|
|
|
|
|
* used when a file is opened |
|
24
|
|
|
|
|
|
|
*/ |
|
25
|
|
|
|
|
|
|
return newSViv(stream->_flag); |
|
26
|
|
|
|
|
|
|
# else |
|
27
|
|
|
|
|
|
|
croak("win32_fmode function works only with MSVCRT"); |
|
28
|
|
|
|
|
|
|
# endif |
|
29
|
|
|
|
|
|
|
#else |
|
30
|
2
|
|
|
|
|
|
croak("win32_fmode function works only with MS Windows"); |
|
31
|
|
|
|
|
|
|
#endif |
|
32
|
|
|
|
|
|
|
} |
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
#ifdef PERL580_OR_LATER |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
/* |
|
37
|
|
|
|
|
|
|
* XS code to deal with filehandles |
|
38
|
|
|
|
|
|
|
* attached to memory objects supplied |
|
39
|
|
|
|
|
|
|
* by attn.steven.kuo. (Applies only |
|
40
|
|
|
|
|
|
|
* to perl 5.8 and later.) |
|
41
|
|
|
|
|
|
|
*/ |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
#include |
|
44
|
|
|
|
|
|
|
#endif |
|
45
|
|
|
|
|
|
|
|
|
46
|
80
|
|
|
|
|
|
SV * perliol_readable(pTHX_ SV * handle) { |
|
47
|
|
|
|
|
|
|
#ifdef PERL580_OR_LATER |
|
48
|
|
|
|
|
|
|
IV flags; |
|
49
|
|
|
|
|
|
|
IO *io; |
|
50
|
|
|
|
|
|
|
PerlIO *f; |
|
51
|
80
|
|
|
|
|
|
io = sv_2io(handle); |
|
52
|
80
|
|
|
|
|
|
f = IoIFP(io); |
|
53
|
80
|
50
|
|
|
|
|
if(PerlIOValid(f)){ |
|
|
|
50
|
|
|
|
|
|
|
54
|
80
|
|
|
|
|
|
flags = PerlIOBase(f)->flags; |
|
55
|
80
|
100
|
|
|
|
|
if(flags & PERLIO_F_CANREAD) return newSVuv(1); |
|
56
|
24
|
|
|
|
|
|
return newSVuv(0); |
|
57
|
|
|
|
|
|
|
} |
|
58
|
0
|
|
|
|
|
|
croak("Couldn't validate the filehandle passed to perliol_readable"); |
|
59
|
|
|
|
|
|
|
#else |
|
60
|
|
|
|
|
|
|
croak("perliol_readable function works only with perl 5.8 or later"); |
|
61
|
|
|
|
|
|
|
#endif |
|
62
|
|
|
|
|
|
|
} |
|
63
|
|
|
|
|
|
|
|
|
64
|
48
|
|
|
|
|
|
SV * perliol_writable(pTHX_ SV * handle) { |
|
65
|
|
|
|
|
|
|
#ifdef PERL580_OR_LATER |
|
66
|
|
|
|
|
|
|
IV flags; |
|
67
|
|
|
|
|
|
|
IO *io; |
|
68
|
|
|
|
|
|
|
PerlIO *f; |
|
69
|
48
|
|
|
|
|
|
io = sv_2io(handle); |
|
70
|
48
|
|
|
|
|
|
f = IoIFP(io); |
|
71
|
48
|
50
|
|
|
|
|
if(PerlIOValid(f)){ |
|
|
|
50
|
|
|
|
|
|
|
72
|
48
|
|
|
|
|
|
flags = PerlIOBase(f)->flags; |
|
73
|
48
|
100
|
|
|
|
|
if(flags & PERLIO_F_CANWRITE) return newSVuv(1); |
|
74
|
8
|
|
|
|
|
|
return newSVuv(0); |
|
75
|
|
|
|
|
|
|
} |
|
76
|
0
|
|
|
|
|
|
croak("Couldn't validate the filehandle passed to perliol_writable"); |
|
77
|
|
|
|
|
|
|
#else |
|
78
|
|
|
|
|
|
|
croak("perliol_writable function works only with perl 5.8 or later"); |
|
79
|
|
|
|
|
|
|
#endif |
|
80
|
|
|
|
|
|
|
} |
|
81
|
|
|
|
|
|
|
|
|
82
|
12
|
|
|
|
|
|
SV * is_appendable(pTHX_ SV * handle) { |
|
83
|
|
|
|
|
|
|
#ifdef PERL561_OR_LATER |
|
84
|
|
|
|
|
|
|
IO *io; |
|
85
|
12
|
|
|
|
|
|
io = sv_2io(handle); |
|
86
|
12
|
100
|
|
|
|
|
if (IoTYPE(io) == IoTYPE_APPEND) return newSVuv(1); |
|
87
|
8
|
|
|
|
|
|
return newSVuv(0); |
|
88
|
|
|
|
|
|
|
#else |
|
89
|
|
|
|
|
|
|
croak("is_appendable function implemented only with perl 5.6.1 or later"); |
|
90
|
|
|
|
|
|
|
#endif |
|
91
|
|
|
|
|
|
|
} |
|
92
|
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
MODULE = FileHandle::Fmode PACKAGE = FileHandle::Fmode |
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
PROTOTYPES: DISABLE |
|
97
|
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
SV * |
|
100
|
|
|
|
|
|
|
win32_fmode (stream) |
|
101
|
|
|
|
|
|
|
FILE * stream |
|
102
|
|
|
|
|
|
|
CODE: |
|
103
|
2
|
|
|
|
|
|
RETVAL = win32_fmode (aTHX_ stream); |
|
104
|
|
|
|
|
|
|
OUTPUT: RETVAL |
|
105
|
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
SV * |
|
107
|
|
|
|
|
|
|
perliol_readable (handle) |
|
108
|
|
|
|
|
|
|
SV * handle |
|
109
|
|
|
|
|
|
|
CODE: |
|
110
|
80
|
|
|
|
|
|
RETVAL = perliol_readable (aTHX_ handle); |
|
111
|
|
|
|
|
|
|
OUTPUT: RETVAL |
|
112
|
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
SV * |
|
114
|
|
|
|
|
|
|
perliol_writable (handle) |
|
115
|
|
|
|
|
|
|
SV * handle |
|
116
|
|
|
|
|
|
|
CODE: |
|
117
|
48
|
|
|
|
|
|
RETVAL = perliol_writable (aTHX_ handle); |
|
118
|
|
|
|
|
|
|
OUTPUT: RETVAL |
|
119
|
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
SV * |
|
121
|
|
|
|
|
|
|
is_appendable (handle) |
|
122
|
|
|
|
|
|
|
SV * handle |
|
123
|
|
|
|
|
|
|
CODE: |
|
124
|
12
|
|
|
|
|
|
RETVAL = is_appendable (aTHX_ handle); |
|
125
|
|
|
|
|
|
|
OUTPUT: RETVAL |
|
126
|
|
|
|
|
|
|
|