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
|
|
|
|
|
|
|
#include "math_ryu_include.h" |
15
|
|
|
|
|
|
|
#include "ryu_headers/ryu.h" |
16
|
|
|
|
|
|
|
#include "ryu_headers/ryu_parse.h" |
17
|
|
|
|
|
|
|
#include "ryu_headers/common.h" |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
/* s2d */ |
20
|
|
|
|
|
|
|
|
21
|
4181
|
|
|
|
|
|
NV M_RYU_s2d(char * buffer) { |
22
|
|
|
|
|
|
|
NV nv; |
23
|
4181
|
|
|
|
|
|
s2d(buffer, &nv); |
24
|
4181
|
|
|
|
|
|
return nv; |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
/* End s2d */ |
28
|
|
|
|
|
|
|
/* d2s */ |
29
|
|
|
|
|
|
|
|
30
|
7
|
|
|
|
|
|
void M_RYU_d2s_buffered_n(pTHX_ SV * nv) { |
31
|
7
|
|
|
|
|
|
dXSARGS; |
32
|
|
|
|
|
|
|
int n; |
33
|
|
|
|
|
|
|
char * result; |
34
|
|
|
|
|
|
|
|
35
|
7
|
|
|
|
|
|
Newxz(result, D_BUF, char); |
36
|
|
|
|
|
|
|
|
37
|
7
|
50
|
|
|
|
|
n = d2s_buffered_n(SvNV(nv), result); |
38
|
7
|
|
|
|
|
|
ST(0) = MORTALIZED_PV(result); /* defined in math_ryu_include.h */ |
39
|
7
|
|
|
|
|
|
ST(1) = sv_2mortal(newSViv(n)); |
40
|
|
|
|
|
|
|
|
41
|
7
|
|
|
|
|
|
Safefree(result); |
42
|
7
|
|
|
|
|
|
XSRETURN(2); |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
7
|
|
|
|
|
|
SV * M_RYU_d2s_buffered(pTHX_ SV * nv) { |
46
|
|
|
|
|
|
|
char * result; |
47
|
|
|
|
|
|
|
SV * outsv; |
48
|
|
|
|
|
|
|
|
49
|
7
|
|
|
|
|
|
Newxz(result, D_BUF, char); |
50
|
|
|
|
|
|
|
|
51
|
7
|
50
|
|
|
|
|
d2s_buffered(SvNV(nv), result); |
52
|
|
|
|
|
|
|
|
53
|
7
|
|
|
|
|
|
outsv = newSVpv(result, 0); |
54
|
7
|
|
|
|
|
|
Safefree(result); |
55
|
7
|
|
|
|
|
|
return outsv; |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
2103
|
|
|
|
|
|
SV * M_RYU_d2s(pTHX_ SV * nv) { |
59
|
2103
|
50
|
|
|
|
|
return newSVpv(d2s(SvNV(nv)), 0); |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
/* End d2s */ |
63
|
|
|
|
|
|
|
/* d2fixed */ |
64
|
|
|
|
|
|
|
|
65
|
7
|
|
|
|
|
|
void M_RYU_d2fixed_buffered_n(pTHX_ SV * nv, SV * prec) { |
66
|
7
|
|
|
|
|
|
dXSARGS; |
67
|
|
|
|
|
|
|
int n; |
68
|
|
|
|
|
|
|
char * result; |
69
|
|
|
|
|
|
|
|
70
|
7
|
50
|
|
|
|
|
Newxz(result, D_BUF + SvUV(prec), char); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
71
|
|
|
|
|
|
|
|
72
|
7
|
50
|
|
|
|
|
n = d2fixed_buffered_n(SvNV(nv), SvUV(prec), result); |
|
|
50
|
|
|
|
|
|
73
|
|
|
|
|
|
|
|
74
|
7
|
|
|
|
|
|
ST(0) = MORTALIZED_PV(result); /* defined in math_ryu_include.h */ |
75
|
7
|
|
|
|
|
|
ST(1) = sv_2mortal(newSViv(n)); |
76
|
7
|
|
|
|
|
|
Safefree(result); |
77
|
7
|
|
|
|
|
|
XSRETURN(2); |
78
|
|
|
|
|
|
|
} |
79
|
|
|
|
|
|
|
|
80
|
7
|
|
|
|
|
|
SV * M_RYU_d2fixed_buffered(pTHX_ SV * nv, SV * prec) { |
81
|
|
|
|
|
|
|
char * result; |
82
|
|
|
|
|
|
|
SV * outsv; |
83
|
|
|
|
|
|
|
|
84
|
7
|
50
|
|
|
|
|
Newxz(result, D_BUF + SvUV(prec), char); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
85
|
|
|
|
|
|
|
|
86
|
7
|
50
|
|
|
|
|
d2fixed_buffered(SvNV(nv), SvUV(prec), result); |
|
|
50
|
|
|
|
|
|
87
|
|
|
|
|
|
|
|
88
|
7
|
|
|
|
|
|
outsv = newSVpv(result, 0); |
89
|
7
|
|
|
|
|
|
Safefree(result); |
90
|
7
|
|
|
|
|
|
return outsv; |
91
|
|
|
|
|
|
|
} |
92
|
|
|
|
|
|
|
|
93
|
21
|
|
|
|
|
|
SV * M_RYU_d2fixed(pTHX_ SV * nv, SV * prec) { |
94
|
21
|
50
|
|
|
|
|
return newSVpv(d2fixed(SvNV(nv), SvUV(prec)), 0); |
|
|
50
|
|
|
|
|
|
95
|
|
|
|
|
|
|
} |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
/*End d2fixed */ |
98
|
|
|
|
|
|
|
/* d2exp */ |
99
|
|
|
|
|
|
|
|
100
|
7
|
|
|
|
|
|
void M_RYU_d2exp_buffered_n(pTHX_ SV * nv, SV * exponent) { |
101
|
7
|
|
|
|
|
|
dXSARGS; |
102
|
|
|
|
|
|
|
int n; |
103
|
|
|
|
|
|
|
char * result; |
104
|
|
|
|
|
|
|
|
105
|
7
|
50
|
|
|
|
|
Newxz(result, D_BUF + SvUV(exponent), char); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
106
|
|
|
|
|
|
|
|
107
|
7
|
50
|
|
|
|
|
n = d2exp_buffered_n(SvNV(nv), SvUV(exponent), result); |
|
|
50
|
|
|
|
|
|
108
|
|
|
|
|
|
|
|
109
|
7
|
|
|
|
|
|
ST(0) = MORTALIZED_PV(result); /* defined in math_ryu_include.h */ |
110
|
7
|
|
|
|
|
|
ST(1) = sv_2mortal(newSViv(n)); |
111
|
7
|
|
|
|
|
|
Safefree(result); |
112
|
7
|
|
|
|
|
|
XSRETURN(2); |
113
|
|
|
|
|
|
|
} |
114
|
|
|
|
|
|
|
|
115
|
7
|
|
|
|
|
|
SV * M_RYU_d2exp_buffered(pTHX_ SV * nv, SV * exponent) { |
116
|
|
|
|
|
|
|
char * result; |
117
|
|
|
|
|
|
|
SV * outsv; |
118
|
|
|
|
|
|
|
|
119
|
7
|
50
|
|
|
|
|
Newxz(result, D_BUF + SvUV(exponent), char); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
120
|
|
|
|
|
|
|
|
121
|
7
|
50
|
|
|
|
|
d2exp_buffered(SvNV(nv), SvUV(exponent), result); |
|
|
50
|
|
|
|
|
|
122
|
|
|
|
|
|
|
|
123
|
7
|
|
|
|
|
|
outsv = newSVpv(result, 0); |
124
|
7
|
|
|
|
|
|
Safefree(result); |
125
|
7
|
|
|
|
|
|
return outsv; |
126
|
|
|
|
|
|
|
} |
127
|
|
|
|
|
|
|
|
128
|
21
|
|
|
|
|
|
SV * M_RYU_d2exp(pTHX_ SV * nv, SV * exponent) { |
129
|
21
|
50
|
|
|
|
|
return newSVpv(d2exp(SvNV(nv), SvUV(exponent)), 0); |
|
|
50
|
|
|
|
|
|
130
|
|
|
|
|
|
|
} |
131
|
|
|
|
|
|
|
|
132
|
1
|
|
|
|
|
|
int _sis_perl_version(void) { |
133
|
1
|
|
|
|
|
|
return SIS_PERL_VERSION; |
134
|
|
|
|
|
|
|
} |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
/* End d2exp */ |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
MODULE = Math::Ryu PACKAGE = Math::Ryu PREFIX = M_RYU_ |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
PROTOTYPES: DISABLE |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
NV |
145
|
|
|
|
|
|
|
M_RYU_s2d (buffer) |
146
|
|
|
|
|
|
|
char * buffer |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
void |
149
|
|
|
|
|
|
|
M_RYU_d2s_buffered_n (nv) |
150
|
|
|
|
|
|
|
SV * nv |
151
|
|
|
|
|
|
|
PREINIT: |
152
|
|
|
|
|
|
|
I32* temp; |
153
|
|
|
|
|
|
|
PPCODE: |
154
|
7
|
|
|
|
|
|
temp = PL_markstack_ptr++; |
155
|
7
|
|
|
|
|
|
M_RYU_d2s_buffered_n(aTHX_ nv); |
156
|
7
|
50
|
|
|
|
|
if (PL_markstack_ptr != temp) { |
157
|
|
|
|
|
|
|
/* truly void, because dXSARGS not invoked */ |
158
|
0
|
|
|
|
|
|
PL_markstack_ptr = temp; |
159
|
0
|
|
|
|
|
|
XSRETURN_EMPTY; /* return empty stack */ |
160
|
|
|
|
|
|
|
} |
161
|
|
|
|
|
|
|
/* must have used dXSARGS; list context implied */ |
162
|
7
|
|
|
|
|
|
return; /* assume stack size is correct */ |
163
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
SV * |
165
|
|
|
|
|
|
|
M_RYU_d2s_buffered (nv) |
166
|
|
|
|
|
|
|
SV * nv |
167
|
|
|
|
|
|
|
CODE: |
168
|
7
|
|
|
|
|
|
RETVAL = M_RYU_d2s_buffered (aTHX_ nv); |
169
|
|
|
|
|
|
|
OUTPUT: RETVAL |
170
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
SV * |
172
|
|
|
|
|
|
|
M_RYU_d2s (nv) |
173
|
|
|
|
|
|
|
SV * nv |
174
|
|
|
|
|
|
|
CODE: |
175
|
2103
|
|
|
|
|
|
RETVAL = M_RYU_d2s (aTHX_ nv); |
176
|
|
|
|
|
|
|
OUTPUT: RETVAL |
177
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
void |
179
|
|
|
|
|
|
|
M_RYU_d2fixed_buffered_n (nv, prec) |
180
|
|
|
|
|
|
|
SV * nv |
181
|
|
|
|
|
|
|
SV * prec |
182
|
|
|
|
|
|
|
PREINIT: |
183
|
|
|
|
|
|
|
I32* temp; |
184
|
|
|
|
|
|
|
PPCODE: |
185
|
7
|
|
|
|
|
|
temp = PL_markstack_ptr++; |
186
|
7
|
|
|
|
|
|
M_RYU_d2fixed_buffered_n(aTHX_ nv, prec); |
187
|
7
|
50
|
|
|
|
|
if (PL_markstack_ptr != temp) { |
188
|
|
|
|
|
|
|
/* truly void, because dXSARGS not invoked */ |
189
|
0
|
|
|
|
|
|
PL_markstack_ptr = temp; |
190
|
0
|
|
|
|
|
|
XSRETURN_EMPTY; /* return empty stack */ |
191
|
|
|
|
|
|
|
} |
192
|
|
|
|
|
|
|
/* must have used dXSARGS; list context implied */ |
193
|
7
|
|
|
|
|
|
return; /* assume stack size is correct */ |
194
|
|
|
|
|
|
|
|
195
|
|
|
|
|
|
|
SV * |
196
|
|
|
|
|
|
|
M_RYU_d2fixed_buffered (nv, prec) |
197
|
|
|
|
|
|
|
SV * nv |
198
|
|
|
|
|
|
|
SV * prec |
199
|
|
|
|
|
|
|
CODE: |
200
|
7
|
|
|
|
|
|
RETVAL = M_RYU_d2fixed_buffered (aTHX_ nv, prec); |
201
|
|
|
|
|
|
|
OUTPUT: RETVAL |
202
|
|
|
|
|
|
|
|
203
|
|
|
|
|
|
|
SV * |
204
|
|
|
|
|
|
|
M_RYU_d2fixed (nv, prec) |
205
|
|
|
|
|
|
|
SV * nv |
206
|
|
|
|
|
|
|
SV * prec |
207
|
|
|
|
|
|
|
CODE: |
208
|
21
|
|
|
|
|
|
RETVAL = M_RYU_d2fixed (aTHX_ nv, prec); |
209
|
|
|
|
|
|
|
OUTPUT: RETVAL |
210
|
|
|
|
|
|
|
|
211
|
|
|
|
|
|
|
void |
212
|
|
|
|
|
|
|
M_RYU_d2exp_buffered_n (nv, exponent) |
213
|
|
|
|
|
|
|
SV * nv |
214
|
|
|
|
|
|
|
SV * exponent |
215
|
|
|
|
|
|
|
PREINIT: |
216
|
|
|
|
|
|
|
I32* temp; |
217
|
|
|
|
|
|
|
PPCODE: |
218
|
7
|
|
|
|
|
|
temp = PL_markstack_ptr++; |
219
|
7
|
|
|
|
|
|
M_RYU_d2exp_buffered_n(aTHX_ nv, exponent); |
220
|
7
|
50
|
|
|
|
|
if (PL_markstack_ptr != temp) { |
221
|
|
|
|
|
|
|
/* truly void, because dXSARGS not invoked */ |
222
|
0
|
|
|
|
|
|
PL_markstack_ptr = temp; |
223
|
0
|
|
|
|
|
|
XSRETURN_EMPTY; /* return empty stack */ |
224
|
|
|
|
|
|
|
} |
225
|
|
|
|
|
|
|
/* must have used dXSARGS; list context implied */ |
226
|
7
|
|
|
|
|
|
return; /* assume stack size is correct */ |
227
|
|
|
|
|
|
|
|
228
|
|
|
|
|
|
|
SV * |
229
|
|
|
|
|
|
|
M_RYU_d2exp_buffered (nv, exponent) |
230
|
|
|
|
|
|
|
SV * nv |
231
|
|
|
|
|
|
|
SV * exponent |
232
|
|
|
|
|
|
|
CODE: |
233
|
7
|
|
|
|
|
|
RETVAL = M_RYU_d2exp_buffered (aTHX_ nv, exponent); |
234
|
|
|
|
|
|
|
OUTPUT: RETVAL |
235
|
|
|
|
|
|
|
|
236
|
|
|
|
|
|
|
SV * |
237
|
|
|
|
|
|
|
M_RYU_d2exp (nv, exponent) |
238
|
|
|
|
|
|
|
SV * nv |
239
|
|
|
|
|
|
|
SV * exponent |
240
|
|
|
|
|
|
|
CODE: |
241
|
21
|
|
|
|
|
|
RETVAL = M_RYU_d2exp (aTHX_ nv, exponent); |
242
|
|
|
|
|
|
|
OUTPUT: RETVAL |
243
|
|
|
|
|
|
|
|
244
|
|
|
|
|
|
|
int |
245
|
|
|
|
|
|
|
_sis_perl_version () |
246
|
|
|
|
|
|
|
|
247
|
|
|
|
|
|
|
|