line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#include "EXTERN.h" |
2
|
|
|
|
|
|
|
#include "perl.h" |
3
|
|
|
|
|
|
|
#include "XSUB.h" |
4
|
|
|
|
|
|
|
#include "perlio.h" |
5
|
|
|
|
|
|
|
#include "perliol.h" |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
#include "eol.h" |
8
|
|
|
|
|
|
|
#include "fill.h" |
9
|
|
|
|
|
|
|
#include "write.h" |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
IV |
12
|
9
|
|
|
|
|
|
PerlIOEOL_pushed(pTHX_ PerlIO *f, const char *mode, SV *arg, PerlIO_funcs *tab) |
13
|
|
|
|
|
|
|
{ |
14
|
9
|
|
|
|
|
|
PerlIOEOL *s = PerlIOSelf(f, PerlIOEOL); |
15
|
9
|
|
|
|
|
|
char *p, *eol_w = NULL, *eol_r = NULL; |
16
|
|
|
|
|
|
|
STRLEN len; |
17
|
|
|
|
|
|
|
|
18
|
9
|
50
|
|
|
|
|
if (PerlIOBase(PerlIONext(f))->flags & PERLIO_F_UTF8) { |
19
|
0
|
|
|
|
|
|
PerlIOBase(f)->flags |= PERLIO_F_UTF8; |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
else { |
22
|
9
|
|
|
|
|
|
PerlIOBase(f)->flags &= ~PERLIO_F_UTF8; |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
9
|
|
|
|
|
|
s->name = NULL; |
26
|
9
|
|
|
|
|
|
s->read.cr = s->write.cr = 0; |
27
|
9
|
|
|
|
|
|
s->read.seen = s->write.seen = 0; |
28
|
|
|
|
|
|
|
|
29
|
9
|
50
|
|
|
|
|
p = SvPV(arg, len); |
30
|
9
|
50
|
|
|
|
|
if (len) { |
31
|
9
|
|
|
|
|
|
char *end = p + len; |
32
|
9
|
|
|
|
|
|
Newz('e', eol_r, len + 1, char); |
33
|
9
|
|
|
|
|
|
Copy(p, eol_r, len, char); |
34
|
|
|
|
|
|
|
|
35
|
9
|
|
|
|
|
|
p = eol_r; end = p + len; |
36
|
47
|
100
|
|
|
|
|
for (; p < end; p++) { |
37
|
38
|
100
|
|
|
|
|
*p = toLOWER(*p); |
38
|
38
|
100
|
|
|
|
|
if ((*p == '-') && (eol_w == NULL)) { |
|
|
50
|
|
|
|
|
|
39
|
2
|
|
|
|
|
|
*p = '\0'; |
40
|
2
|
|
|
|
|
|
eol_w = p+1; |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
else { |
45
|
0
|
|
|
|
|
|
Perl_die(aTHX_ "Must pass CRLF, CR, LF or Native to :eol()."); |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
9
|
100
|
|
|
|
|
if (eol_w == NULL) { eol_w = eol_r; } |
49
|
|
|
|
|
|
|
|
50
|
9
|
100
|
|
|
|
|
EOL_AssignEOL( eol_r, s->read ); |
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
51
|
9
|
100
|
|
|
|
|
EOL_AssignEOL( eol_w, s->write ); |
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
52
|
|
|
|
|
|
|
|
53
|
9
|
|
|
|
|
|
Safefree( eol_r ); |
54
|
|
|
|
|
|
|
|
55
|
9
|
|
|
|
|
|
return PerlIOBuf_pushed(aTHX_ f, mode, arg, tab); |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
STDCHAR * |
59
|
23
|
|
|
|
|
|
PerlIOEOL_get_base(pTHX_ PerlIO *f) |
60
|
|
|
|
|
|
|
{ |
61
|
23
|
|
|
|
|
|
PerlIOBuf *b = PerlIOSelf(f, PerlIOBuf); |
62
|
23
|
100
|
|
|
|
|
if (!b->buf) { |
63
|
9
|
|
|
|
|
|
PerlIOEOL *s = PerlIOSelf(f, PerlIOEOL); |
64
|
|
|
|
|
|
|
|
65
|
9
|
50
|
|
|
|
|
if (!b->bufsiz) |
66
|
9
|
|
|
|
|
|
b->bufsiz = 4096; |
67
|
|
|
|
|
|
|
|
68
|
9
|
100
|
|
|
|
|
b->buf = Newz( 'B', b->buf, b->bufsiz * ( (s->read.eol == EOL_CRLF) ? 2 : 1 ), STDCHAR ); |
69
|
|
|
|
|
|
|
|
70
|
9
|
50
|
|
|
|
|
if (!b->buf) { |
71
|
0
|
|
|
|
|
|
b->buf = (STDCHAR *) & b->oneword; |
72
|
0
|
|
|
|
|
|
b->bufsiz = sizeof(b->oneword); |
73
|
|
|
|
|
|
|
} |
74
|
9
|
|
|
|
|
|
b->ptr = b->buf; |
75
|
9
|
|
|
|
|
|
b->end = b->ptr; |
76
|
|
|
|
|
|
|
} |
77
|
23
|
|
|
|
|
|
return b->buf; |
78
|
|
|
|
|
|
|
} |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
void |
81
|
0
|
|
|
|
|
|
PerlIOEOL_clearerr(pTHX_ PerlIO *f) |
82
|
|
|
|
|
|
|
{ |
83
|
|
|
|
|
|
|
PerlIOEOL *s; |
84
|
|
|
|
|
|
|
|
85
|
0
|
0
|
|
|
|
|
if (PerlIOValid(f)) { |
|
|
0
|
|
|
|
|
|
86
|
0
|
|
|
|
|
|
s = PerlIOSelf(f, PerlIOEOL); |
87
|
0
|
0
|
|
|
|
|
if (PerlIOBase(f)->flags & PERLIO_F_EOF) { |
88
|
0
|
|
|
|
|
|
s->read.cr = s->write.cr = 0; |
89
|
0
|
|
|
|
|
|
s->read.seen = s->write.seen = 0; |
90
|
|
|
|
|
|
|
} |
91
|
|
|
|
|
|
|
} |
92
|
|
|
|
|
|
|
|
93
|
0
|
|
|
|
|
|
PerlIOBase_clearerr(aTHX_ f); |
94
|
0
|
|
|
|
|
|
} |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
SSize_t |
97
|
4
|
|
|
|
|
|
PerlIOEOL_write(pTHX_ PerlIO *f, const void *vbuf, Size_t count) |
98
|
|
|
|
|
|
|
{ |
99
|
4
|
|
|
|
|
|
PerlIOEOL *s = PerlIOSelf(f, PerlIOEOL); |
100
|
4
|
|
|
|
|
|
const STDCHAR *i, *start = vbuf, *end = vbuf; |
101
|
|
|
|
|
|
|
|
102
|
4
|
|
|
|
|
|
end += (unsigned int)count; |
103
|
|
|
|
|
|
|
|
104
|
4
|
50
|
|
|
|
|
EOL_StartUpdate( s->write ); |
|
|
0
|
|
|
|
|
|
105
|
|
|
|
|
|
|
|
106
|
4
|
50
|
|
|
|
|
if (!(PerlIOBase(f)->flags & PERLIO_F_CANWRITE)) { return 0; } |
107
|
|
|
|
|
|
|
|
108
|
24
|
100
|
|
|
|
|
EOL_Dispatch( s->write, WriteWithCR, WriteWithLF, WriteWithCRLF ); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
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|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
109
|
|
|
|
|
|
|
|
110
|
3
|
100
|
|
|
|
|
if (start >= end) { return count; } |
111
|
|
|
|
|
|
|
|
112
|
1
|
|
|
|
|
|
return ( (start + PerlIOBuf_write(aTHX_ f, start, end - start)) - (STDCHAR*)vbuf ); |
113
|
|
|
|
|
|
|
} |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
IV |
116
|
9
|
|
|
|
|
|
PerlIOEOL_fill(pTHX_ PerlIO * f) |
117
|
|
|
|
|
|
|
{ |
118
|
9
|
|
|
|
|
|
IV code = PerlIOBuf_fill(aTHX_ f); |
119
|
9
|
|
|
|
|
|
PerlIOEOL *s = PerlIOSelf(f, PerlIOEOL); |
120
|
9
|
|
|
|
|
|
PerlIOBuf *b = PerlIOSelf(f, PerlIOBuf); |
121
|
9
|
|
|
|
|
|
const STDCHAR *i, *start = b->ptr, *end = b->end; |
122
|
9
|
|
|
|
|
|
STDCHAR *buf = NULL, *ptr = NULL; |
123
|
|
|
|
|
|
|
|
124
|
9
|
100
|
|
|
|
|
if (code != 0) { return code; } |
125
|
|
|
|
|
|
|
|
126
|
5
|
50
|
|
|
|
|
EOL_StartUpdate( s->read ); |
|
|
0
|
|
|
|
|
|
127
|
45
|
100
|
|
|
|
|
EOL_Dispatch( s->read, FillWithCR, FillWithLF, FillWithCRLF ); |
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
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|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
128
|
|
|
|
|
|
|
|
129
|
4
|
50
|
|
|
|
|
if (buf == NULL) { return 0; } |
130
|
|
|
|
|
|
|
|
131
|
4
|
50
|
|
|
|
|
if (i > start) { |
132
|
4
|
|
|
|
|
|
Move(start, ptr, i - start, STDCHAR); |
133
|
4
|
|
|
|
|
|
ptr += i - start; |
134
|
|
|
|
|
|
|
} |
135
|
|
|
|
|
|
|
|
136
|
4
|
|
|
|
|
|
b->ptr = b->buf; |
137
|
4
|
|
|
|
|
|
b->end = b->buf + (ptr - buf); |
138
|
|
|
|
|
|
|
|
139
|
4
|
100
|
|
|
|
|
if (buf != b->buf) { |
140
|
2
|
|
|
|
|
|
Copy(buf, b->buf, ptr - buf, STDCHAR); |
141
|
2
|
|
|
|
|
|
Safefree(buf); |
142
|
|
|
|
|
|
|
} |
143
|
|
|
|
|
|
|
|
144
|
4
|
|
|
|
|
|
return 0; |
145
|
|
|
|
|
|
|
} |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
PerlIO * |
148
|
9
|
|
|
|
|
|
PerlIOEOL_open(pTHX_ PerlIO_funcs *self, PerlIO_list_t *layers, |
149
|
|
|
|
|
|
|
IV n, const char *mode, int fd, int imode, int perm, |
150
|
|
|
|
|
|
|
PerlIO *old, int narg, SV **args) |
151
|
|
|
|
|
|
|
{ |
152
|
9
|
50
|
|
|
|
|
SV *arg = (narg > 0) ? *args : PerlIOArg; |
153
|
9
|
|
|
|
|
|
PerlIO *f = PerlIOBuf_open( aTHX_ self, layers, n, mode, fd, imode, perm, old, narg, args ); |
154
|
|
|
|
|
|
|
|
155
|
9
|
50
|
|
|
|
|
if (f) { |
156
|
9
|
|
|
|
|
|
PerlIOEOL *s = PerlIOSelf(f, PerlIOEOL); |
157
|
9
|
50
|
|
|
|
|
s->name = (STDCHAR *)savepv( SvPV_nolen(arg) ); |
158
|
|
|
|
|
|
|
} |
159
|
|
|
|
|
|
|
|
160
|
9
|
|
|
|
|
|
return f; |
161
|
|
|
|
|
|
|
} |
162
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
PerlIO_funcs PerlIO_eol = { |
164
|
|
|
|
|
|
|
sizeof(PerlIO_funcs), |
165
|
|
|
|
|
|
|
"eol", |
166
|
|
|
|
|
|
|
sizeof(PerlIOEOL), |
167
|
|
|
|
|
|
|
PERLIO_K_BUFFERED | PERLIO_K_UTF8, |
168
|
|
|
|
|
|
|
PerlIOEOL_pushed, |
169
|
|
|
|
|
|
|
PerlIOBuf_popped, |
170
|
|
|
|
|
|
|
PerlIOEOL_open, |
171
|
|
|
|
|
|
|
PerlIOBase_binmode, |
172
|
|
|
|
|
|
|
NULL, |
173
|
|
|
|
|
|
|
PerlIOBase_fileno, |
174
|
|
|
|
|
|
|
PerlIOBuf_dup, |
175
|
|
|
|
|
|
|
PerlIOBuf_read, |
176
|
|
|
|
|
|
|
PerlIOBuf_unread, |
177
|
|
|
|
|
|
|
PerlIOEOL_write, |
178
|
|
|
|
|
|
|
PerlIOBuf_seek, |
179
|
|
|
|
|
|
|
PerlIOBuf_tell, |
180
|
|
|
|
|
|
|
PerlIOBuf_close, |
181
|
|
|
|
|
|
|
PerlIOBuf_flush, |
182
|
|
|
|
|
|
|
PerlIOEOL_fill, |
183
|
|
|
|
|
|
|
PerlIOBase_eof, |
184
|
|
|
|
|
|
|
PerlIOBase_error, |
185
|
|
|
|
|
|
|
PerlIOEOL_clearerr, |
186
|
|
|
|
|
|
|
PerlIOBase_setlinebuf, |
187
|
|
|
|
|
|
|
PerlIOEOL_get_base, |
188
|
|
|
|
|
|
|
PerlIOBuf_bufsiz, |
189
|
|
|
|
|
|
|
PerlIOBuf_get_ptr, |
190
|
|
|
|
|
|
|
PerlIOBuf_get_cnt, |
191
|
|
|
|
|
|
|
PerlIOBuf_set_ptrcnt |
192
|
|
|
|
|
|
|
}; |
193
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
MODULE = PerlIO::eol PACKAGE = PerlIO::eol |
195
|
|
|
|
|
|
|
|
196
|
|
|
|
|
|
|
BOOT: |
197
|
|
|
|
|
|
|
#ifdef PERLIO_LAYERS |
198
|
2
|
|
|
|
|
|
PerlIO_define_layer(aTHX_ &PerlIO_eol); |
199
|
|
|
|
|
|
|
#endif |
200
|
|
|
|
|
|
|
|
201
|
|
|
|
|
|
|
unsigned int |
202
|
|
|
|
|
|
|
eol_is_mixed(arg) |
203
|
|
|
|
|
|
|
SV *arg |
204
|
|
|
|
|
|
|
PROTOTYPE: $ |
205
|
|
|
|
|
|
|
CODE: |
206
|
|
|
|
|
|
|
STRLEN len; |
207
|
|
|
|
|
|
|
register U8 *i, *end; |
208
|
4
|
|
|
|
|
|
register unsigned int seen = 0; |
209
|
4
|
50
|
|
|
|
|
i = (U8*)SvPV(arg, len); |
210
|
4
|
|
|
|
|
|
end = i + len; |
211
|
4
|
|
|
|
|
|
RETVAL = 0; |
212
|
17
|
100
|
|
|
|
|
for (; i < end; i++) { |
213
|
13
|
50
|
|
|
|
|
EOL_CheckForMixedCRLF( seen, EOL_Break, EOL_Seen( seen, EOL_CR, EOL_Break ), break, ( i++ ) ); |
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
214
|
|
|
|
|
|
|
} |
215
|
|
|
|
|
|
|
OUTPUT: |
216
|
|
|
|
|
|
|
RETVAL |
217
|
|
|
|
|
|
|
|
218
|
|
|
|
|
|
|
char * |
219
|
|
|
|
|
|
|
CR() |
220
|
|
|
|
|
|
|
PROTOTYPE: |
221
|
|
|
|
|
|
|
CODE: |
222
|
1
|
|
|
|
|
|
RETVAL = "\015"; |
223
|
|
|
|
|
|
|
OUTPUT: |
224
|
|
|
|
|
|
|
RETVAL |
225
|
|
|
|
|
|
|
|
226
|
|
|
|
|
|
|
char * |
227
|
|
|
|
|
|
|
LF() |
228
|
|
|
|
|
|
|
PROTOTYPE: |
229
|
|
|
|
|
|
|
CODE: |
230
|
1
|
|
|
|
|
|
RETVAL = "\012"; |
231
|
|
|
|
|
|
|
OUTPUT: |
232
|
|
|
|
|
|
|
RETVAL |
233
|
|
|
|
|
|
|
|
234
|
|
|
|
|
|
|
char * |
235
|
|
|
|
|
|
|
CRLF() |
236
|
|
|
|
|
|
|
PROTOTYPE: |
237
|
|
|
|
|
|
|
CODE: |
238
|
1
|
|
|
|
|
|
RETVAL = "\015\012"; |
239
|
|
|
|
|
|
|
OUTPUT: |
240
|
|
|
|
|
|
|
RETVAL |
241
|
|
|
|
|
|
|
|
242
|
|
|
|
|
|
|
char * |
243
|
|
|
|
|
|
|
NATIVE() |
244
|
|
|
|
|
|
|
PROTOTYPE: |
245
|
|
|
|
|
|
|
CODE: |
246
|
0
|
|
|
|
|
|
RETVAL = ( |
247
|
|
|
|
|
|
|
(EOL_NATIVE == EOL_CR) ? "\015" : |
248
|
|
|
|
|
|
|
(EOL_NATIVE == EOL_LF) ? "\012" : |
249
|
|
|
|
|
|
|
(EOL_NATIVE == EOL_CRLF) ? "\015\012" : "" |
250
|
|
|
|
|
|
|
); |
251
|
|
|
|
|
|
|
OUTPUT: |
252
|
|
|
|
|
|
|
RETVAL |