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