line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
/* |
2
|
|
|
|
|
|
|
* This file was generated automatically by ExtUtils::ParseXS version 3.34 from the |
3
|
|
|
|
|
|
|
* contents of cookbook.xs. Do not edit this file, edit cookbook.xs instead. |
4
|
|
|
|
|
|
|
* |
5
|
|
|
|
|
|
|
* ANY CHANGES MADE HERE WILL BE LOST! |
6
|
|
|
|
|
|
|
* |
7
|
|
|
|
|
|
|
*/ |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
#line 1 "t/cookbook/cookbook.xs" |
10
|
|
|
|
|
|
|
#include |
11
|
|
|
|
|
|
|
using namespace xs; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
#line 14 "t/cookbook/cookbook_xsgen.cc" |
14
|
|
|
|
|
|
|
#ifndef PERL_UNUSED_VAR |
15
|
|
|
|
|
|
|
# define PERL_UNUSED_VAR(var) if (0) var = var |
16
|
|
|
|
|
|
|
#endif |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
#ifndef dVAR |
19
|
|
|
|
|
|
|
# define dVAR dNOOP |
20
|
|
|
|
|
|
|
#endif |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
/* This stuff is not part of the API! You have been warned. */ |
24
|
|
|
|
|
|
|
#ifndef PERL_VERSION_DECIMAL |
25
|
|
|
|
|
|
|
# define PERL_VERSION_DECIMAL(r,v,s) (r*1000000 + v*1000 + s) |
26
|
|
|
|
|
|
|
#endif |
27
|
|
|
|
|
|
|
#ifndef PERL_DECIMAL_VERSION |
28
|
|
|
|
|
|
|
# define PERL_DECIMAL_VERSION \ |
29
|
|
|
|
|
|
|
PERL_VERSION_DECIMAL(PERL_REVISION,PERL_VERSION,PERL_SUBVERSION) |
30
|
|
|
|
|
|
|
#endif |
31
|
|
|
|
|
|
|
#ifndef PERL_VERSION_GE |
32
|
|
|
|
|
|
|
# define PERL_VERSION_GE(r,v,s) \ |
33
|
|
|
|
|
|
|
(PERL_DECIMAL_VERSION >= PERL_VERSION_DECIMAL(r,v,s)) |
34
|
|
|
|
|
|
|
#endif |
35
|
|
|
|
|
|
|
#ifndef PERL_VERSION_LE |
36
|
|
|
|
|
|
|
# define PERL_VERSION_LE(r,v,s) \ |
37
|
|
|
|
|
|
|
(PERL_DECIMAL_VERSION <= PERL_VERSION_DECIMAL(r,v,s)) |
38
|
|
|
|
|
|
|
#endif |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
/* XS_INTERNAL is the explicit static-linkage variant of the default |
41
|
|
|
|
|
|
|
* XS macro. |
42
|
|
|
|
|
|
|
* |
43
|
|
|
|
|
|
|
* XS_EXTERNAL is the same as XS_INTERNAL except it does not include |
44
|
|
|
|
|
|
|
* "STATIC", ie. it exports XSUB symbols. You probably don't want that |
45
|
|
|
|
|
|
|
* for anything but the BOOT XSUB. |
46
|
|
|
|
|
|
|
* |
47
|
|
|
|
|
|
|
* See XSUB.h in core! |
48
|
|
|
|
|
|
|
*/ |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
/* TODO: This might be compatible further back than 5.10.0. */ |
52
|
|
|
|
|
|
|
#if PERL_VERSION_GE(5, 10, 0) && PERL_VERSION_LE(5, 15, 1) |
53
|
|
|
|
|
|
|
# undef XS_EXTERNAL |
54
|
|
|
|
|
|
|
# undef XS_INTERNAL |
55
|
|
|
|
|
|
|
# if defined(__CYGWIN__) && defined(USE_DYNAMIC_LOADING) |
56
|
|
|
|
|
|
|
# define XS_EXTERNAL(name) __declspec(dllexport) XSPROTO(name) |
57
|
|
|
|
|
|
|
# define XS_INTERNAL(name) STATIC XSPROTO(name) |
58
|
|
|
|
|
|
|
# endif |
59
|
|
|
|
|
|
|
# if defined(__SYMBIAN32__) |
60
|
|
|
|
|
|
|
# define XS_EXTERNAL(name) EXPORT_C XSPROTO(name) |
61
|
|
|
|
|
|
|
# define XS_INTERNAL(name) EXPORT_C STATIC XSPROTO(name) |
62
|
|
|
|
|
|
|
# endif |
63
|
|
|
|
|
|
|
# ifndef XS_EXTERNAL |
64
|
|
|
|
|
|
|
# if defined(HASATTRIBUTE_UNUSED) && !defined(__cplusplus) |
65
|
|
|
|
|
|
|
# define XS_EXTERNAL(name) void name(pTHX_ CV* cv __attribute__unused__) |
66
|
|
|
|
|
|
|
# define XS_INTERNAL(name) STATIC void name(pTHX_ CV* cv __attribute__unused__) |
67
|
|
|
|
|
|
|
# else |
68
|
|
|
|
|
|
|
# ifdef __cplusplus |
69
|
|
|
|
|
|
|
# define XS_EXTERNAL(name) extern "C" XSPROTO(name) |
70
|
|
|
|
|
|
|
# define XS_INTERNAL(name) static XSPROTO(name) |
71
|
|
|
|
|
|
|
# else |
72
|
|
|
|
|
|
|
# define XS_EXTERNAL(name) XSPROTO(name) |
73
|
|
|
|
|
|
|
# define XS_INTERNAL(name) STATIC XSPROTO(name) |
74
|
|
|
|
|
|
|
# endif |
75
|
|
|
|
|
|
|
# endif |
76
|
|
|
|
|
|
|
# endif |
77
|
|
|
|
|
|
|
#endif |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
/* perl >= 5.10.0 && perl <= 5.15.1 */ |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
/* The XS_EXTERNAL macro is used for functions that must not be static |
83
|
|
|
|
|
|
|
* like the boot XSUB of a module. If perl didn't have an XS_EXTERNAL |
84
|
|
|
|
|
|
|
* macro defined, the best we can do is assume XS is the same. |
85
|
|
|
|
|
|
|
* Dito for XS_INTERNAL. |
86
|
|
|
|
|
|
|
*/ |
87
|
|
|
|
|
|
|
#ifndef XS_EXTERNAL |
88
|
|
|
|
|
|
|
# define XS_EXTERNAL(name) XS(name) |
89
|
|
|
|
|
|
|
#endif |
90
|
|
|
|
|
|
|
#ifndef XS_INTERNAL |
91
|
|
|
|
|
|
|
# define XS_INTERNAL(name) XS(name) |
92
|
|
|
|
|
|
|
#endif |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
/* Now, finally, after all this mess, we want an ExtUtils::ParseXS |
95
|
|
|
|
|
|
|
* internal macro that we're free to redefine for varying linkage due |
96
|
|
|
|
|
|
|
* to the EXPORT_XSUB_SYMBOLS XS keyword. This is internal, use |
97
|
|
|
|
|
|
|
* XS_EXTERNAL(name) or XS_INTERNAL(name) in your code if you need to! |
98
|
|
|
|
|
|
|
*/ |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
#undef XS_EUPXS |
101
|
|
|
|
|
|
|
#if defined(PERL_EUPXS_ALWAYS_EXPORT) |
102
|
|
|
|
|
|
|
# define XS_EUPXS(name) XS_EXTERNAL(name) |
103
|
|
|
|
|
|
|
#else |
104
|
|
|
|
|
|
|
/* default to internal */ |
105
|
|
|
|
|
|
|
# define XS_EUPXS(name) XS_INTERNAL(name) |
106
|
|
|
|
|
|
|
#endif |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
#ifndef PERL_ARGS_ASSERT_CROAK_XS_USAGE |
109
|
|
|
|
|
|
|
#define PERL_ARGS_ASSERT_CROAK_XS_USAGE assert(cv); assert(params) |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
/* prototype to pass -Wmissing-prototypes */ |
112
|
|
|
|
|
|
|
STATIC void |
113
|
|
|
|
|
|
|
S_croak_xs_usage(const CV *const cv, const char *const params); |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
STATIC void |
116
|
|
|
|
|
|
|
S_croak_xs_usage(const CV *const cv, const char *const params) |
117
|
|
|
|
|
|
|
{ |
118
|
|
|
|
|
|
|
const GV *const gv = CvGV(cv); |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
PERL_ARGS_ASSERT_CROAK_XS_USAGE; |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
if (gv) { |
123
|
|
|
|
|
|
|
const char *const gvname = GvNAME(gv); |
124
|
|
|
|
|
|
|
const HV *const stash = GvSTASH(gv); |
125
|
|
|
|
|
|
|
const char *const hvname = stash ? HvNAME(stash) : NULL; |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
if (hvname) |
128
|
|
|
|
|
|
|
Perl_croak_nocontext("Usage: %s::%s(%s)", hvname, gvname, params); |
129
|
|
|
|
|
|
|
else |
130
|
|
|
|
|
|
|
Perl_croak_nocontext("Usage: %s(%s)", gvname, params); |
131
|
|
|
|
|
|
|
} else { |
132
|
|
|
|
|
|
|
/* Pants. I don't think that it should be possible to get here. */ |
133
|
|
|
|
|
|
|
Perl_croak_nocontext("Usage: CODE(0x%" UVxf ")(%s)", PTR2UV(cv), params); |
134
|
|
|
|
|
|
|
} |
135
|
|
|
|
|
|
|
} |
136
|
|
|
|
|
|
|
#undef PERL_ARGS_ASSERT_CROAK_XS_USAGE |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
#define croak_xs_usage S_croak_xs_usage |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
#endif |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
/* NOTE: the prototype of newXSproto() is different in versions of perls, |
143
|
|
|
|
|
|
|
* so we define a portable version of newXSproto() |
144
|
|
|
|
|
|
|
*/ |
145
|
|
|
|
|
|
|
#ifdef newXS_flags |
146
|
|
|
|
|
|
|
#define newXSproto_portable(name, c_impl, file, proto) newXS_flags(name, c_impl, file, proto, 0) |
147
|
|
|
|
|
|
|
#else |
148
|
|
|
|
|
|
|
#define newXSproto_portable(name, c_impl, file, proto) (PL_Sv=(SV*)newXS(name, c_impl, file), sv_setpv(PL_Sv, proto), (CV*)PL_Sv) |
149
|
|
|
|
|
|
|
#endif /* !defined(newXS_flags) */ |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
#if PERL_VERSION_LE(5, 21, 5) |
152
|
|
|
|
|
|
|
# define newXS_deffile(a,b) Perl_newXS(aTHX_ a,b,file) |
153
|
|
|
|
|
|
|
#else |
154
|
|
|
|
|
|
|
# define newXS_deffile(a,b) Perl_newXS_deffile(aTHX_ a,b) |
155
|
|
|
|
|
|
|
#endif |
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
#line 158 "t/cookbook/cookbook_xsgen.cc" |
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
/* INCLUDE: Including 'recipe01.xsi' from 'cookbook.xs' */ |
160
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
#include |
162
|
|
|
|
|
|
|
#include |
163
|
|
|
|
|
|
|
struct DateRecipe01a { |
164
|
0
|
|
|
|
|
|
DateRecipe01a() { update(false) ; } |
165
|
0
|
|
|
|
|
|
~DateRecipe01a() { std::cout << "~DateRecipe01a()\n"; } |
166
|
0
|
|
|
|
|
|
void update(bool trace = true) { |
167
|
0
|
0
|
|
|
|
|
if (trace) std::cout << "DateRecipe01a::update()\n"; |
168
|
0
|
|
|
|
|
|
epoch = std::time(nullptr); |
169
|
0
|
|
|
|
|
|
} |
170
|
|
|
|
|
|
|
|
171
|
0
|
|
|
|
|
|
int get_epoch() const { return epoch; } |
172
|
|
|
|
|
|
|
private: |
173
|
|
|
|
|
|
|
std::time_t epoch; |
174
|
|
|
|
|
|
|
}; |
175
|
|
|
|
|
|
|
namespace xs { |
176
|
|
|
|
|
|
|
template <> |
177
|
|
|
|
|
|
|
struct Typemap : TypemapObject { |
178
|
0
|
0
|
|
|
|
|
static std::string package () { return "MyTest::Cookbook::DateRecipe01a"; } |
179
|
|
|
|
|
|
|
}; |
180
|
|
|
|
|
|
|
} |
181
|
|
|
|
|
|
|
struct DateRecipe01b { |
182
|
0
|
|
|
|
|
|
DateRecipe01b() { update(false) ; } |
183
|
0
|
|
|
|
|
|
~DateRecipe01b() { std::cout << "~DateRecipe01b()\n"; } |
184
|
0
|
|
|
|
|
|
void update(bool trace = true) { |
185
|
0
|
0
|
|
|
|
|
if (trace) std::cout << "DateRecipe01b::update()\n"; |
186
|
0
|
|
|
|
|
|
epoch = std::time(nullptr); |
187
|
0
|
|
|
|
|
|
} |
188
|
|
|
|
|
|
|
|
189
|
0
|
|
|
|
|
|
int get_epoch() const { return epoch; } |
190
|
|
|
|
|
|
|
private: |
191
|
|
|
|
|
|
|
std::time_t epoch; |
192
|
|
|
|
|
|
|
}; |
193
|
|
|
|
|
|
|
namespace xs { |
194
|
|
|
|
|
|
|
template <> |
195
|
|
|
|
|
|
|
struct Typemap : TypemapObject { |
196
|
0
|
0
|
|
|
|
|
static std::string package () { return "MyTest::Cookbook::DateRecipe01b"; } |
197
|
|
|
|
|
|
|
}; |
198
|
|
|
|
|
|
|
} |
199
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
|
201
|
0
|
|
|
|
|
|
XS_EUPXS(XS_MyTest__Cookbook__DateRecipe01a_new) { xs::throw_guard(cv, [=]() |
202
|
|
|
|
|
|
|
{ |
203
|
0
|
|
|
|
|
|
dVAR; dXSARGS; |
204
|
0
|
0
|
|
|
|
|
if (items != 1) |
205
|
0
|
|
|
|
|
|
croak_xs_usage(cv, "CLASS"); |
206
|
|
|
|
|
|
|
{ |
207
|
|
|
|
|
|
|
DateRecipe01a * RETVAL; |
208
|
0
|
|
|
|
|
|
SV* CLASS = ST(0) |
209
|
|
|
|
|
|
|
; |
210
|
|
|
|
|
|
|
#line 50 "t/cookbook/recipe01.xsi" |
211
|
|
|
|
|
|
|
xs::Sv PROTO; PERL_UNUSED_VAR(PROTO); |
212
|
|
|
|
|
|
|
PROTO = CLASS; |
213
|
|
|
|
|
|
|
RETVAL = new DateRecipe01a(); |
214
|
|
|
|
|
|
|
#line 215 "t/cookbook/cookbook_xsgen.cc" |
215
|
|
|
|
|
|
|
{ |
216
|
|
|
|
|
|
|
SV * RETVALSV; |
217
|
0
|
0
|
|
|
|
|
RETVALSV = xs::out(RETVAL, PROTO).detach(); |
218
|
0
|
0
|
|
|
|
|
RETVALSV = sv_2mortal(RETVALSV); |
219
|
0
|
|
|
|
|
|
ST(0) = RETVALSV; |
220
|
|
|
|
|
|
|
} |
221
|
|
|
|
|
|
|
} |
222
|
0
|
|
|
|
|
|
XSRETURN(1); |
223
|
0
|
0
|
|
|
|
|
}); } |
224
|
|
|
|
|
|
|
|
225
|
|
|
|
|
|
|
|
226
|
|
|
|
|
|
|
|
227
|
0
|
|
|
|
|
|
XS_EUPXS(XS_MyTest__Cookbook__DateRecipe01a_update) { xs::throw_guard(cv, [=]() |
228
|
|
|
|
|
|
|
{ |
229
|
0
|
|
|
|
|
|
dVAR; dXSARGS; |
230
|
0
|
0
|
|
|
|
|
if (items != 1) |
231
|
0
|
|
|
|
|
|
croak_xs_usage(cv, "THIS"); |
232
|
|
|
|
|
|
|
PERL_UNUSED_VAR(ax); /* -Wall */ |
233
|
0
|
|
|
|
|
|
SP -= items; |
234
|
|
|
|
|
|
|
{ |
235
|
0
|
0
|
|
|
|
|
DateRecipe01a* THIS = xs::in(ST(0)); if (!SvOK(ST(0))) throw "undef not allowed as THIS"; |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
236
|
|
|
|
|
|
|
; |
237
|
|
|
|
|
|
|
#line 52 "t/cookbook/recipe01.xsi" |
238
|
|
|
|
|
|
|
THIS->update(); |
239
|
|
|
|
|
|
|
#line 240 "t/cookbook/cookbook_xsgen.cc" |
240
|
0
|
|
|
|
|
|
PUTBACK; |
241
|
0
|
|
|
|
|
|
return; |
242
|
|
|
|
|
|
|
} |
243
|
0
|
0
|
|
|
|
|
}); } |
244
|
|
|
|
|
|
|
|
245
|
|
|
|
|
|
|
|
246
|
|
|
|
|
|
|
|
247
|
0
|
|
|
|
|
|
XS_EUPXS(XS_MyTest__Cookbook__DateRecipe01a_get_epoch) { xs::throw_guard(cv, [=]() |
248
|
|
|
|
|
|
|
{ |
249
|
0
|
|
|
|
|
|
dVAR; dXSARGS; |
250
|
0
|
0
|
|
|
|
|
if (items != 1) |
251
|
0
|
|
|
|
|
|
croak_xs_usage(cv, "THIS"); |
252
|
|
|
|
|
|
|
{ |
253
|
|
|
|
|
|
|
std::time_t RETVAL; |
254
|
0
|
0
|
|
|
|
|
DateRecipe01a* THIS = xs::in(ST(0)); if (!SvOK(ST(0))) throw "undef not allowed as THIS"; |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
255
|
|
|
|
|
|
|
; |
256
|
|
|
|
|
|
|
#line 54 "t/cookbook/recipe01.xsi" |
257
|
|
|
|
|
|
|
xs::Sv PROTO; PERL_UNUSED_VAR(PROTO); |
258
|
|
|
|
|
|
|
RETVAL = THIS->get_epoch(); |
259
|
|
|
|
|
|
|
#line 260 "t/cookbook/cookbook_xsgen.cc" |
260
|
|
|
|
|
|
|
{ |
261
|
|
|
|
|
|
|
SV * RETVALSV; |
262
|
0
|
0
|
|
|
|
|
RETVALSV = xs::out(RETVAL, PROTO).detach(); |
263
|
0
|
0
|
|
|
|
|
RETVALSV = sv_2mortal(RETVALSV); |
264
|
0
|
|
|
|
|
|
ST(0) = RETVALSV; |
265
|
|
|
|
|
|
|
} |
266
|
|
|
|
|
|
|
} |
267
|
0
|
|
|
|
|
|
XSRETURN(1); |
268
|
0
|
0
|
|
|
|
|
}); } |
269
|
|
|
|
|
|
|
|
270
|
|
|
|
|
|
|
|
271
|
|
|
|
|
|
|
|
272
|
0
|
|
|
|
|
|
XS_EUPXS(XS_MyTest__Cookbook__DateRecipe01a_DESTROY) { xs::throw_guard(cv, [=]() |
273
|
|
|
|
|
|
|
{ |
274
|
0
|
|
|
|
|
|
dVAR; dXSARGS; |
275
|
0
|
0
|
|
|
|
|
if (items != 1) |
276
|
0
|
|
|
|
|
|
croak_xs_usage(cv, "THIS"); |
277
|
|
|
|
|
|
|
PERL_UNUSED_VAR(ax); /* -Wall */ |
278
|
0
|
|
|
|
|
|
SP -= items; |
279
|
|
|
|
|
|
|
{ |
280
|
0
|
0
|
|
|
|
|
DateRecipe01a* THIS = xs::in(ST(0)); if (!SvOK(ST(0))) throw "undef not allowed as THIS"; |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
281
|
|
|
|
|
|
|
; |
282
|
|
|
|
|
|
|
#line 57 "t/cookbook/recipe01.xsi" |
283
|
|
|
|
|
|
|
std::cout << "xs-adapter MyTest::Cookbook::DateRecipe01a::DESTROY\n"; |
284
|
|
|
|
|
|
|
xs::Typemap().destroy(THIS, SvRV(ST(0))); |
285
|
|
|
|
|
|
|
#line 286 "t/cookbook/cookbook_xsgen.cc" |
286
|
0
|
|
|
|
|
|
PUTBACK; |
287
|
0
|
|
|
|
|
|
return; |
288
|
|
|
|
|
|
|
} |
289
|
0
|
0
|
|
|
|
|
}); } |
290
|
|
|
|
|
|
|
|
291
|
|
|
|
|
|
|
|
292
|
|
|
|
|
|
|
|
293
|
0
|
|
|
|
|
|
XS_EUPXS(XS_MyTest__Cookbook__DateRecipe01b_new) { xs::throw_guard(cv, [=]() |
294
|
|
|
|
|
|
|
{ |
295
|
0
|
|
|
|
|
|
dVAR; dXSARGS; |
296
|
0
|
0
|
|
|
|
|
if (items != 1) |
297
|
0
|
|
|
|
|
|
croak_xs_usage(cv, "CLASS"); |
298
|
|
|
|
|
|
|
{ |
299
|
|
|
|
|
|
|
DateRecipe01b * RETVAL; |
300
|
0
|
|
|
|
|
|
SV* CLASS = ST(0) |
301
|
|
|
|
|
|
|
; |
302
|
|
|
|
|
|
|
#line 63 "t/cookbook/recipe01.xsi" |
303
|
|
|
|
|
|
|
xs::Sv PROTO; PERL_UNUSED_VAR(PROTO); |
304
|
|
|
|
|
|
|
PROTO = CLASS; |
305
|
|
|
|
|
|
|
RETVAL = new DateRecipe01b(); |
306
|
|
|
|
|
|
|
#line 307 "t/cookbook/cookbook_xsgen.cc" |
307
|
|
|
|
|
|
|
{ |
308
|
|
|
|
|
|
|
SV * RETVALSV; |
309
|
0
|
0
|
|
|
|
|
RETVALSV = xs::out(RETVAL, PROTO).detach(); |
310
|
0
|
0
|
|
|
|
|
RETVALSV = sv_2mortal(RETVALSV); |
311
|
0
|
|
|
|
|
|
ST(0) = RETVALSV; |
312
|
|
|
|
|
|
|
} |
313
|
|
|
|
|
|
|
} |
314
|
0
|
|
|
|
|
|
XSRETURN(1); |
315
|
0
|
0
|
|
|
|
|
}); } |
316
|
|
|
|
|
|
|
|
317
|
|
|
|
|
|
|
|
318
|
|
|
|
|
|
|
|
319
|
0
|
|
|
|
|
|
XS_EUPXS(XS_MyTest__Cookbook__DateRecipe01b_update) { xs::throw_guard(cv, [=]() |
320
|
|
|
|
|
|
|
{ |
321
|
0
|
|
|
|
|
|
dVAR; dXSARGS; |
322
|
0
|
0
|
|
|
|
|
if (items != 1) |
323
|
0
|
|
|
|
|
|
croak_xs_usage(cv, "THIS"); |
324
|
|
|
|
|
|
|
PERL_UNUSED_VAR(ax); /* -Wall */ |
325
|
0
|
|
|
|
|
|
SP -= items; |
326
|
|
|
|
|
|
|
{ |
327
|
0
|
0
|
|
|
|
|
DateRecipe01b* THIS = xs::in(ST(0)); if (!SvOK(ST(0))) throw "undef not allowed as THIS"; |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
328
|
|
|
|
|
|
|
; |
329
|
|
|
|
|
|
|
#line 65 "t/cookbook/recipe01.xsi" |
330
|
|
|
|
|
|
|
THIS->update(); |
331
|
|
|
|
|
|
|
#line 332 "t/cookbook/cookbook_xsgen.cc" |
332
|
0
|
|
|
|
|
|
PUTBACK; |
333
|
0
|
|
|
|
|
|
return; |
334
|
|
|
|
|
|
|
} |
335
|
0
|
0
|
|
|
|
|
}); } |
336
|
|
|
|
|
|
|
|
337
|
|
|
|
|
|
|
|
338
|
|
|
|
|
|
|
|
339
|
0
|
|
|
|
|
|
XS_EUPXS(XS_MyTest__Cookbook__DateRecipe01b_get_epoch) { xs::throw_guard(cv, [=]() |
340
|
|
|
|
|
|
|
{ |
341
|
0
|
|
|
|
|
|
dVAR; dXSARGS; |
342
|
0
|
0
|
|
|
|
|
if (items != 1) |
343
|
0
|
|
|
|
|
|
croak_xs_usage(cv, "THIS"); |
344
|
|
|
|
|
|
|
{ |
345
|
|
|
|
|
|
|
std::time_t RETVAL; |
346
|
0
|
0
|
|
|
|
|
DateRecipe01b* THIS = xs::in(ST(0)); if (!SvOK(ST(0))) throw "undef not allowed as THIS"; |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
347
|
|
|
|
|
|
|
; |
348
|
|
|
|
|
|
|
#line 67 "t/cookbook/recipe01.xsi" |
349
|
|
|
|
|
|
|
xs::Sv PROTO; PERL_UNUSED_VAR(PROTO); |
350
|
|
|
|
|
|
|
RETVAL = THIS->get_epoch(); |
351
|
|
|
|
|
|
|
#line 352 "t/cookbook/cookbook_xsgen.cc" |
352
|
|
|
|
|
|
|
{ |
353
|
|
|
|
|
|
|
SV * RETVALSV; |
354
|
0
|
0
|
|
|
|
|
RETVALSV = xs::out(RETVAL, PROTO).detach(); |
355
|
0
|
0
|
|
|
|
|
RETVALSV = sv_2mortal(RETVALSV); |
356
|
0
|
|
|
|
|
|
ST(0) = RETVALSV; |
357
|
|
|
|
|
|
|
} |
358
|
|
|
|
|
|
|
} |
359
|
0
|
|
|
|
|
|
XSRETURN(1); |
360
|
0
|
0
|
|
|
|
|
}); } |
361
|
|
|
|
|
|
|
|
362
|
|
|
|
|
|
|
|
363
|
|
|
|
|
|
|
/* INCLUDE: Returning to 'cookbook.xs' from 'recipe01.xsi' */ |
364
|
|
|
|
|
|
|
|
365
|
|
|
|
|
|
|
|
366
|
|
|
|
|
|
|
/* INCLUDE: Including 'recipe02.xsi' from 'cookbook.xs' */ |
367
|
|
|
|
|
|
|
|
368
|
|
|
|
|
|
|
#include |
369
|
|
|
|
|
|
|
#include |
370
|
|
|
|
|
|
|
struct DateRecipe02a { |
371
|
0
|
|
|
|
|
|
DateRecipe02a() { update() ; } |
372
|
0
|
|
|
|
|
|
void update() { epoch = std::time(nullptr); } |
373
|
|
|
|
|
|
|
|
374
|
0
|
|
|
|
|
|
int get_epoch() const { return epoch; } |
375
|
|
|
|
|
|
|
private: |
376
|
|
|
|
|
|
|
std::time_t epoch; |
377
|
|
|
|
|
|
|
}; |
378
|
|
|
|
|
|
|
namespace xs { |
379
|
|
|
|
|
|
|
template <> |
380
|
|
|
|
|
|
|
struct Typemap : TypemapObject { |
381
|
0
|
0
|
|
|
|
|
static std::string package () { return "MyTest::Cookbook::DateRecipe02a"; } |
382
|
|
|
|
|
|
|
}; |
383
|
|
|
|
|
|
|
} |
384
|
|
|
|
|
|
|
struct DateRecipe02b { |
385
|
0
|
|
|
|
|
|
DateRecipe02b() { update() ; } |
386
|
0
|
|
|
|
|
|
void update() { epoch = std::time(nullptr); } |
387
|
|
|
|
|
|
|
|
388
|
0
|
|
|
|
|
|
int get_epoch() const { return epoch; } |
389
|
|
|
|
|
|
|
private: |
390
|
|
|
|
|
|
|
std::time_t epoch; |
391
|
|
|
|
|
|
|
}; |
392
|
|
|
|
|
|
|
namespace xs { |
393
|
|
|
|
|
|
|
template <> |
394
|
|
|
|
|
|
|
struct Typemap : TypemapObject { |
395
|
0
|
0
|
|
|
|
|
static std::string package () { return "MyTest::Cookbook::DateRecipe02b"; } |
396
|
|
|
|
|
|
|
}; |
397
|
|
|
|
|
|
|
} |
398
|
|
|
|
|
|
|
|
399
|
|
|
|
|
|
|
|
400
|
0
|
|
|
|
|
|
XS_EUPXS(XS_MyTest__Cookbook__DateRecipe02a_new) { xs::throw_guard(cv, [=]() |
401
|
|
|
|
|
|
|
{ |
402
|
0
|
|
|
|
|
|
dVAR; dXSARGS; |
403
|
0
|
0
|
|
|
|
|
if (items != 1) |
404
|
0
|
|
|
|
|
|
croak_xs_usage(cv, "CLASS"); |
405
|
|
|
|
|
|
|
{ |
406
|
|
|
|
|
|
|
DateRecipe02a * RETVAL; |
407
|
0
|
|
|
|
|
|
SV* CLASS = ST(0) |
408
|
|
|
|
|
|
|
; |
409
|
|
|
|
|
|
|
#line 41 "t/cookbook/recipe02.xsi" |
410
|
|
|
|
|
|
|
xs::Sv PROTO; PERL_UNUSED_VAR(PROTO); |
411
|
|
|
|
|
|
|
PROTO = CLASS; |
412
|
|
|
|
|
|
|
RETVAL = new DateRecipe02a(); |
413
|
|
|
|
|
|
|
#line 414 "t/cookbook/cookbook_xsgen.cc" |
414
|
|
|
|
|
|
|
{ |
415
|
|
|
|
|
|
|
SV * RETVALSV; |
416
|
0
|
0
|
|
|
|
|
RETVALSV = xs::out(RETVAL, PROTO).detach(); |
417
|
0
|
0
|
|
|
|
|
RETVALSV = sv_2mortal(RETVALSV); |
418
|
0
|
|
|
|
|
|
ST(0) = RETVALSV; |
419
|
|
|
|
|
|
|
} |
420
|
|
|
|
|
|
|
} |
421
|
0
|
|
|
|
|
|
XSRETURN(1); |
422
|
0
|
0
|
|
|
|
|
}); } |
423
|
|
|
|
|
|
|
|
424
|
|
|
|
|
|
|
|
425
|
|
|
|
|
|
|
|
426
|
0
|
|
|
|
|
|
XS_EUPXS(XS_MyTest__Cookbook__DateRecipe02a_update) { xs::throw_guard(cv, [=]() |
427
|
|
|
|
|
|
|
{ |
428
|
0
|
|
|
|
|
|
dVAR; dXSARGS; |
429
|
0
|
0
|
|
|
|
|
if (items != 1) |
430
|
0
|
|
|
|
|
|
croak_xs_usage(cv, "THIS"); |
431
|
|
|
|
|
|
|
PERL_UNUSED_VAR(ax); /* -Wall */ |
432
|
0
|
|
|
|
|
|
SP -= items; |
433
|
|
|
|
|
|
|
{ |
434
|
0
|
0
|
|
|
|
|
DateRecipe02a* THIS = xs::in(ST(0)); if (!SvOK(ST(0))) throw "undef not allowed as THIS"; |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
435
|
|
|
|
|
|
|
; |
436
|
|
|
|
|
|
|
#line 43 "t/cookbook/recipe02.xsi" |
437
|
|
|
|
|
|
|
THIS->update(); |
438
|
|
|
|
|
|
|
#line 439 "t/cookbook/cookbook_xsgen.cc" |
439
|
0
|
|
|
|
|
|
PUTBACK; |
440
|
0
|
|
|
|
|
|
return; |
441
|
|
|
|
|
|
|
} |
442
|
0
|
0
|
|
|
|
|
}); } |
443
|
|
|
|
|
|
|
|
444
|
|
|
|
|
|
|
|
445
|
|
|
|
|
|
|
|
446
|
0
|
|
|
|
|
|
XS_EUPXS(XS_MyTest__Cookbook__DateRecipe02a_get_epoch) { xs::throw_guard(cv, [=]() |
447
|
|
|
|
|
|
|
{ |
448
|
0
|
|
|
|
|
|
dVAR; dXSARGS; |
449
|
0
|
0
|
|
|
|
|
if (items != 1) |
450
|
0
|
|
|
|
|
|
croak_xs_usage(cv, "THIS"); |
451
|
|
|
|
|
|
|
{ |
452
|
|
|
|
|
|
|
std::time_t RETVAL; |
453
|
0
|
0
|
|
|
|
|
DateRecipe02a* THIS = xs::in(ST(0)); if (!SvOK(ST(0))) throw "undef not allowed as THIS"; |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
454
|
|
|
|
|
|
|
; |
455
|
|
|
|
|
|
|
#line 45 "t/cookbook/recipe02.xsi" |
456
|
|
|
|
|
|
|
xs::Sv PROTO; PERL_UNUSED_VAR(PROTO); |
457
|
|
|
|
|
|
|
RETVAL = THIS->get_epoch(); |
458
|
|
|
|
|
|
|
#line 459 "t/cookbook/cookbook_xsgen.cc" |
459
|
|
|
|
|
|
|
{ |
460
|
|
|
|
|
|
|
SV * RETVALSV; |
461
|
0
|
0
|
|
|
|
|
RETVALSV = xs::out(RETVAL, PROTO).detach(); |
462
|
0
|
0
|
|
|
|
|
RETVALSV = sv_2mortal(RETVALSV); |
463
|
0
|
|
|
|
|
|
ST(0) = RETVALSV; |
464
|
|
|
|
|
|
|
} |
465
|
|
|
|
|
|
|
} |
466
|
0
|
|
|
|
|
|
XSRETURN(1); |
467
|
0
|
0
|
|
|
|
|
}); } |
468
|
|
|
|
|
|
|
|
469
|
|
|
|
|
|
|
|
470
|
|
|
|
|
|
|
|
471
|
0
|
|
|
|
|
|
XS_EUPXS(XS_MyTest__Cookbook__DateRecipe02a_DESTROY) { xs::throw_guard(cv, [=]() |
472
|
|
|
|
|
|
|
{ |
473
|
0
|
|
|
|
|
|
dVAR; dXSARGS; |
474
|
0
|
0
|
|
|
|
|
if (items != 1) |
475
|
0
|
|
|
|
|
|
croak_xs_usage(cv, "THIS"); |
476
|
|
|
|
|
|
|
PERL_UNUSED_VAR(ax); /* -Wall */ |
477
|
0
|
|
|
|
|
|
SP -= items; |
478
|
|
|
|
|
|
|
{ |
479
|
0
|
0
|
|
|
|
|
DateRecipe02a* THIS = xs::in(ST(0)); if (!SvOK(ST(0))) throw "undef not allowed as THIS"; |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
480
|
|
|
|
|
|
|
; |
481
|
|
|
|
|
|
|
#line 51 "t/cookbook/recipe02.xsi" |
482
|
|
|
|
|
|
|
xs::Typemap().destroy(THIS, SvRV(ST(0))); |
483
|
|
|
|
|
|
|
#line 484 "t/cookbook/cookbook_xsgen.cc" |
484
|
0
|
|
|
|
|
|
PUTBACK; |
485
|
0
|
|
|
|
|
|
return; |
486
|
|
|
|
|
|
|
} |
487
|
0
|
0
|
|
|
|
|
}); } |
488
|
|
|
|
|
|
|
|
489
|
|
|
|
|
|
|
|
490
|
|
|
|
|
|
|
|
491
|
0
|
|
|
|
|
|
XS_EUPXS(XS_MyTest__Cookbook__DateRecipe02b_new) { xs::throw_guard(cv, [=]() |
492
|
|
|
|
|
|
|
{ |
493
|
0
|
|
|
|
|
|
dVAR; dXSARGS; |
494
|
0
|
0
|
|
|
|
|
if (items != 1) |
495
|
0
|
|
|
|
|
|
croak_xs_usage(cv, "CLASS"); |
496
|
|
|
|
|
|
|
{ |
497
|
|
|
|
|
|
|
DateRecipe02b * RETVAL; |
498
|
0
|
|
|
|
|
|
SV* CLASS = ST(0) |
499
|
|
|
|
|
|
|
; |
500
|
|
|
|
|
|
|
#line 57 "t/cookbook/recipe02.xsi" |
501
|
|
|
|
|
|
|
xs::Sv PROTO; PERL_UNUSED_VAR(PROTO); |
502
|
|
|
|
|
|
|
PROTO = CLASS; |
503
|
|
|
|
|
|
|
RETVAL = new DateRecipe02b(); |
504
|
|
|
|
|
|
|
#line 505 "t/cookbook/cookbook_xsgen.cc" |
505
|
|
|
|
|
|
|
{ |
506
|
|
|
|
|
|
|
SV * RETVALSV; |
507
|
0
|
0
|
|
|
|
|
RETVALSV = xs::out(RETVAL, PROTO).detach(); |
508
|
0
|
0
|
|
|
|
|
RETVALSV = sv_2mortal(RETVALSV); |
509
|
0
|
|
|
|
|
|
ST(0) = RETVALSV; |
510
|
|
|
|
|
|
|
} |
511
|
|
|
|
|
|
|
} |
512
|
0
|
|
|
|
|
|
XSRETURN(1); |
513
|
0
|
0
|
|
|
|
|
}); } |
514
|
|
|
|
|
|
|
|
515
|
|
|
|
|
|
|
|
516
|
|
|
|
|
|
|
|
517
|
0
|
|
|
|
|
|
XS_EUPXS(XS_MyTest__Cookbook__DateRecipe02b_update) { xs::throw_guard(cv, [=]() |
518
|
|
|
|
|
|
|
{ |
519
|
0
|
|
|
|
|
|
dVAR; dXSARGS; |
520
|
0
|
0
|
|
|
|
|
if (items != 1) |
521
|
0
|
|
|
|
|
|
croak_xs_usage(cv, "THIS"); |
522
|
|
|
|
|
|
|
PERL_UNUSED_VAR(ax); /* -Wall */ |
523
|
0
|
|
|
|
|
|
SP -= items; |
524
|
|
|
|
|
|
|
{ |
525
|
0
|
0
|
|
|
|
|
DateRecipe02b* THIS = xs::in(ST(0)); if (!SvOK(ST(0))) throw "undef not allowed as THIS"; |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
526
|
|
|
|
|
|
|
; |
527
|
|
|
|
|
|
|
#line 59 "t/cookbook/recipe02.xsi" |
528
|
|
|
|
|
|
|
THIS->update(); |
529
|
|
|
|
|
|
|
#line 530 "t/cookbook/cookbook_xsgen.cc" |
530
|
0
|
|
|
|
|
|
PUTBACK; |
531
|
0
|
|
|
|
|
|
return; |
532
|
|
|
|
|
|
|
} |
533
|
0
|
0
|
|
|
|
|
}); } |
534
|
|
|
|
|
|
|
|
535
|
|
|
|
|
|
|
|
536
|
|
|
|
|
|
|
|
537
|
0
|
|
|
|
|
|
XS_EUPXS(XS_MyTest__Cookbook__DateRecipe02b_get_epoch) { xs::throw_guard(cv, [=]() |
538
|
|
|
|
|
|
|
{ |
539
|
0
|
|
|
|
|
|
dVAR; dXSARGS; |
540
|
0
|
0
|
|
|
|
|
if (items != 1) |
541
|
0
|
|
|
|
|
|
croak_xs_usage(cv, "THIS"); |
542
|
|
|
|
|
|
|
{ |
543
|
|
|
|
|
|
|
std::time_t RETVAL; |
544
|
0
|
0
|
|
|
|
|
DateRecipe02b* THIS = xs::in(ST(0)); if (!SvOK(ST(0))) throw "undef not allowed as THIS"; |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
545
|
|
|
|
|
|
|
; |
546
|
|
|
|
|
|
|
#line 61 "t/cookbook/recipe02.xsi" |
547
|
|
|
|
|
|
|
xs::Sv PROTO; PERL_UNUSED_VAR(PROTO); |
548
|
|
|
|
|
|
|
RETVAL = THIS->get_epoch(); |
549
|
|
|
|
|
|
|
#line 550 "t/cookbook/cookbook_xsgen.cc" |
550
|
|
|
|
|
|
|
{ |
551
|
|
|
|
|
|
|
SV * RETVALSV; |
552
|
0
|
0
|
|
|
|
|
RETVALSV = xs::out(RETVAL, PROTO).detach(); |
553
|
0
|
0
|
|
|
|
|
RETVALSV = sv_2mortal(RETVALSV); |
554
|
0
|
|
|
|
|
|
ST(0) = RETVALSV; |
555
|
|
|
|
|
|
|
} |
556
|
|
|
|
|
|
|
} |
557
|
0
|
|
|
|
|
|
XSRETURN(1); |
558
|
0
|
0
|
|
|
|
|
}); } |
559
|
|
|
|
|
|
|
|
560
|
|
|
|
|
|
|
|
561
|
|
|
|
|
|
|
/* INCLUDE: Returning to 'cookbook.xs' from 'recipe02.xsi' */ |
562
|
|
|
|
|
|
|
|
563
|
|
|
|
|
|
|
|
564
|
|
|
|
|
|
|
/* INCLUDE: Including 'recipe03.xsi' from 'cookbook.xs' */ |
565
|
|
|
|
|
|
|
|
566
|
|
|
|
|
|
|
struct TimezoneRecipe03 { |
567
|
0
|
|
|
|
|
|
const char* get_name() const { return name; } |
568
|
0
|
|
|
|
|
|
static const TimezoneRecipe03& get_instance() { |
569
|
0
|
0
|
|
|
|
|
static TimezoneRecipe03* instance = new TimezoneRecipe03(); |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
570
|
0
|
|
|
|
|
|
return *instance; |
571
|
|
|
|
|
|
|
} |
572
|
|
|
|
|
|
|
private: |
573
|
0
|
|
|
|
|
|
TimezoneRecipe03() { name = "Europe/Minsk"; } |
574
|
|
|
|
|
|
|
const char* name; |
575
|
|
|
|
|
|
|
}; |
576
|
|
|
|
|
|
|
namespace xs { |
577
|
|
|
|
|
|
|
template <> |
578
|
|
|
|
|
|
|
struct Typemap : TypemapObject { |
579
|
0
|
0
|
|
|
|
|
static std::string package () { return "MyTest::Cookbook::TimezoneRecipe03"; } |
580
|
|
|
|
|
|
|
}; |
581
|
|
|
|
|
|
|
} |
582
|
|
|
|
|
|
|
|
583
|
|
|
|
|
|
|
|
584
|
0
|
|
|
|
|
|
XS_EUPXS(XS_MyTest__Cookbook__TimezoneRecipe03_get_name) { xs::throw_guard(cv, [=]() |
585
|
|
|
|
|
|
|
{ |
586
|
0
|
|
|
|
|
|
dVAR; dXSARGS; |
587
|
0
|
0
|
|
|
|
|
if (items != 1) |
588
|
0
|
|
|
|
|
|
croak_xs_usage(cv, "THIS"); |
589
|
|
|
|
|
|
|
{ |
590
|
|
|
|
|
|
|
const char * RETVAL; |
591
|
0
|
0
|
|
|
|
|
dXSTARG; |
|
|
0
|
|
|
|
|
|
592
|
0
|
0
|
|
|
|
|
const TimezoneRecipe03* THIS = xs::in(ST(0)); if (!SvOK(ST(0))) throw "undef not allowed as THIS"; |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
593
|
|
|
|
|
|
|
; |
594
|
|
|
|
|
|
|
#line 24 "t/cookbook/recipe03.xsi" |
595
|
|
|
|
|
|
|
RETVAL = THIS->get_name(); |
596
|
|
|
|
|
|
|
#line 597 "t/cookbook/cookbook_xsgen.cc" |
597
|
0
|
0
|
|
|
|
|
sv_setpv(TARG, RETVAL); XSprePUSH; PUSHTARG; |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
598
|
|
|
|
|
|
|
} |
599
|
0
|
|
|
|
|
|
XSRETURN(1); |
600
|
0
|
0
|
|
|
|
|
}); } |
601
|
|
|
|
|
|
|
|
602
|
|
|
|
|
|
|
|
603
|
|
|
|
|
|
|
|
604
|
0
|
|
|
|
|
|
XS_EUPXS(XS_MyTest__Cookbook__TimezoneRecipe03_get_instance) { xs::throw_guard(cv, [=]() |
605
|
|
|
|
|
|
|
{ |
606
|
0
|
|
|
|
|
|
dVAR; dXSARGS; |
607
|
0
|
0
|
|
|
|
|
if (items != 0) |
608
|
0
|
|
|
|
|
|
croak_xs_usage(cv, ""); |
609
|
|
|
|
|
|
|
{ |
610
|
|
|
|
|
|
|
const TimezoneRecipe03 * RETVAL; |
611
|
|
|
|
|
|
|
#line 26 "t/cookbook/recipe03.xsi" |
612
|
|
|
|
|
|
|
xs::Sv PROTO; PERL_UNUSED_VAR(PROTO); |
613
|
|
|
|
|
|
|
RETVAL = &TimezoneRecipe03::get_instance(); |
614
|
|
|
|
|
|
|
#line 615 "t/cookbook/cookbook_xsgen.cc" |
615
|
|
|
|
|
|
|
{ |
616
|
|
|
|
|
|
|
SV * RETVALSV; |
617
|
0
|
0
|
|
|
|
|
RETVALSV = xs::out(RETVAL, PROTO).detach(); |
618
|
0
|
0
|
|
|
|
|
RETVALSV = sv_2mortal(RETVALSV); |
619
|
0
|
|
|
|
|
|
ST(0) = RETVALSV; |
620
|
|
|
|
|
|
|
} |
621
|
|
|
|
|
|
|
} |
622
|
0
|
|
|
|
|
|
XSRETURN(1); |
623
|
0
|
0
|
|
|
|
|
}); } |
624
|
|
|
|
|
|
|
|
625
|
|
|
|
|
|
|
|
626
|
|
|
|
|
|
|
/* INCLUDE: Returning to 'cookbook.xs' from 'recipe03.xsi' */ |
627
|
|
|
|
|
|
|
|
628
|
|
|
|
|
|
|
|
629
|
|
|
|
|
|
|
/* INCLUDE: Including 'recipe04.xsi' from 'cookbook.xs' */ |
630
|
|
|
|
|
|
|
|
631
|
|
|
|
|
|
|
#include |
632
|
|
|
|
|
|
|
#include |
633
|
|
|
|
|
|
|
struct TimezoneRecipe04 { |
634
|
0
|
|
|
|
|
|
const char* get_name() const { return name.c_str(); } |
635
|
0
|
|
|
|
|
|
static std::shared_ptr create(const char* name) { |
636
|
0
|
|
|
|
|
|
return std::make_shared(name); |
637
|
|
|
|
|
|
|
} |
638
|
0
|
0
|
|
|
|
|
TimezoneRecipe04(const char* name_): name{name_} { } |
639
|
0
|
|
|
|
|
|
~TimezoneRecipe04() { std::cout << "~TimezoneRecipe04()\n"; } |
640
|
|
|
|
|
|
|
private: |
641
|
|
|
|
|
|
|
std::string name; |
642
|
|
|
|
|
|
|
}; |
643
|
|
|
|
|
|
|
using TimezoneRecipe04SP = std::shared_ptr; |
644
|
|
|
|
|
|
|
namespace xs { |
645
|
|
|
|
|
|
|
template <> |
646
|
|
|
|
|
|
|
struct Typemap : TypemapObject { |
647
|
0
|
0
|
|
|
|
|
static std::string package () { return "MyTest::Cookbook::TimezoneRecipe04"; } |
648
|
|
|
|
|
|
|
}; |
649
|
|
|
|
|
|
|
} |
650
|
0
|
|
|
|
|
|
struct DateRecipe04 { |
651
|
0
|
|
|
|
|
|
DateRecipe04() { update() ; } |
652
|
0
|
|
|
|
|
|
void update() { epoch = std::time(nullptr); } |
653
|
|
|
|
|
|
|
|
654
|
0
|
|
|
|
|
|
int get_epoch() const { return epoch; } |
655
|
0
|
|
|
|
|
|
void set_timezone(TimezoneRecipe04SP tz_) { tz = tz_; } |
656
|
0
|
|
|
|
|
|
TimezoneRecipe04SP get_timezone() { return tz; } |
657
|
|
|
|
|
|
|
private: |
658
|
|
|
|
|
|
|
std::time_t epoch; |
659
|
|
|
|
|
|
|
TimezoneRecipe04SP tz; |
660
|
|
|
|
|
|
|
}; |
661
|
|
|
|
|
|
|
namespace xs { |
662
|
|
|
|
|
|
|
template <> |
663
|
|
|
|
|
|
|
struct Typemap : TypemapObject { |
664
|
0
|
0
|
|
|
|
|
static std::string package () { return "MyTest::Cookbook::DateRecipe04"; } |
665
|
|
|
|
|
|
|
}; |
666
|
|
|
|
|
|
|
} |
667
|
|
|
|
|
|
|
|
668
|
|
|
|
|
|
|
|
669
|
0
|
|
|
|
|
|
XS_EUPXS(XS_MyTest__Cookbook__TimezoneRecipe04_get_name) { xs::throw_guard(cv, [=]() |
670
|
|
|
|
|
|
|
{ |
671
|
0
|
|
|
|
|
|
dVAR; dXSARGS; |
672
|
0
|
0
|
|
|
|
|
if (items != 1) |
673
|
0
|
|
|
|
|
|
croak_xs_usage(cv, "tz"); |
674
|
|
|
|
|
|
|
{ |
675
|
|
|
|
|
|
|
const char * RETVAL; |
676
|
0
|
0
|
|
|
|
|
dXSTARG; |
|
|
0
|
|
|
|
|
|
677
|
0
|
0
|
|
|
|
|
TimezoneRecipe04SP tz = xs::in(ST(0)); |
678
|
|
|
|
|
|
|
; |
679
|
|
|
|
|
|
|
#line 48 "t/cookbook/recipe04.xsi" |
680
|
|
|
|
|
|
|
RETVAL = tz->get_name(); |
681
|
|
|
|
|
|
|
#line 682 "t/cookbook/cookbook_xsgen.cc" |
682
|
0
|
0
|
|
|
|
|
sv_setpv(TARG, RETVAL); XSprePUSH; PUSHTARG; |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
683
|
|
|
|
|
|
|
} |
684
|
0
|
|
|
|
|
|
XSRETURN(1); |
685
|
0
|
0
|
|
|
|
|
}); } |
686
|
|
|
|
|
|
|
|
687
|
|
|
|
|
|
|
|
688
|
|
|
|
|
|
|
|
689
|
0
|
|
|
|
|
|
XS_EUPXS(XS_MyTest__Cookbook__TimezoneRecipe04_create) { xs::throw_guard(cv, [=]() |
690
|
|
|
|
|
|
|
{ |
691
|
0
|
|
|
|
|
|
dVAR; dXSARGS; |
692
|
0
|
0
|
|
|
|
|
if (items != 1) |
693
|
0
|
|
|
|
|
|
croak_xs_usage(cv, "name"); |
694
|
|
|
|
|
|
|
{ |
695
|
0
|
|
|
|
|
|
TimezoneRecipe04SP RETVAL; |
696
|
0
|
0
|
|
|
|
|
const char* name = (const char *)SvPV_nolen(ST(0)) |
|
|
0
|
|
|
|
|
|
697
|
|
|
|
|
|
|
; |
698
|
|
|
|
|
|
|
#line 50 "t/cookbook/recipe04.xsi" |
699
|
|
|
|
|
|
|
xs::Sv PROTO; PERL_UNUSED_VAR(PROTO); |
700
|
|
|
|
|
|
|
RETVAL = TimezoneRecipe04::create(name); |
701
|
|
|
|
|
|
|
#line 702 "t/cookbook/cookbook_xsgen.cc" |
702
|
|
|
|
|
|
|
{ |
703
|
|
|
|
|
|
|
SV * RETVALSV; |
704
|
0
|
0
|
|
|
|
|
RETVALSV = xs::out(RETVAL, PROTO).detach(); |
705
|
0
|
0
|
|
|
|
|
RETVALSV = sv_2mortal(RETVALSV); |
706
|
0
|
|
|
|
|
|
ST(0) = RETVALSV; |
707
|
|
|
|
|
|
|
} |
708
|
|
|
|
|
|
|
} |
709
|
0
|
|
|
|
|
|
XSRETURN(1); |
710
|
0
|
0
|
|
|
|
|
}); } |
711
|
|
|
|
|
|
|
|
712
|
|
|
|
|
|
|
|
713
|
|
|
|
|
|
|
|
714
|
0
|
|
|
|
|
|
XS_EUPXS(XS_MyTest__Cookbook__DateRecipe04_new) { xs::throw_guard(cv, [=]() |
715
|
|
|
|
|
|
|
{ |
716
|
0
|
|
|
|
|
|
dVAR; dXSARGS; |
717
|
0
|
0
|
|
|
|
|
if (items != 1) |
718
|
0
|
|
|
|
|
|
croak_xs_usage(cv, "CLASS"); |
719
|
|
|
|
|
|
|
{ |
720
|
|
|
|
|
|
|
DateRecipe04 * RETVAL; |
721
|
0
|
|
|
|
|
|
SV* CLASS = ST(0) |
722
|
|
|
|
|
|
|
; |
723
|
|
|
|
|
|
|
#line 55 "t/cookbook/recipe04.xsi" |
724
|
|
|
|
|
|
|
xs::Sv PROTO; PERL_UNUSED_VAR(PROTO); |
725
|
|
|
|
|
|
|
PROTO = CLASS; |
726
|
|
|
|
|
|
|
RETVAL = new DateRecipe04(); |
727
|
|
|
|
|
|
|
#line 728 "t/cookbook/cookbook_xsgen.cc" |
728
|
|
|
|
|
|
|
{ |
729
|
|
|
|
|
|
|
SV * RETVALSV; |
730
|
0
|
0
|
|
|
|
|
RETVALSV = xs::out(RETVAL, PROTO).detach(); |
731
|
0
|
0
|
|
|
|
|
RETVALSV = sv_2mortal(RETVALSV); |
732
|
0
|
|
|
|
|
|
ST(0) = RETVALSV; |
733
|
|
|
|
|
|
|
} |
734
|
|
|
|
|
|
|
} |
735
|
0
|
|
|
|
|
|
XSRETURN(1); |
736
|
0
|
0
|
|
|
|
|
}); } |
737
|
|
|
|
|
|
|
|
738
|
|
|
|
|
|
|
|
739
|
|
|
|
|
|
|
|
740
|
0
|
|
|
|
|
|
XS_EUPXS(XS_MyTest__Cookbook__DateRecipe04_update) { xs::throw_guard(cv, [=]() |
741
|
|
|
|
|
|
|
{ |
742
|
0
|
|
|
|
|
|
dVAR; dXSARGS; |
743
|
0
|
0
|
|
|
|
|
if (items != 1) |
744
|
0
|
|
|
|
|
|
croak_xs_usage(cv, "THIS"); |
745
|
|
|
|
|
|
|
PERL_UNUSED_VAR(ax); /* -Wall */ |
746
|
0
|
|
|
|
|
|
SP -= items; |
747
|
|
|
|
|
|
|
{ |
748
|
0
|
0
|
|
|
|
|
DateRecipe04* THIS = xs::in(ST(0)); if (!SvOK(ST(0))) throw "undef not allowed as THIS"; |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
749
|
|
|
|
|
|
|
; |
750
|
|
|
|
|
|
|
#line 57 "t/cookbook/recipe04.xsi" |
751
|
|
|
|
|
|
|
THIS->update(); |
752
|
|
|
|
|
|
|
#line 753 "t/cookbook/cookbook_xsgen.cc" |
753
|
0
|
|
|
|
|
|
PUTBACK; |
754
|
0
|
|
|
|
|
|
return; |
755
|
|
|
|
|
|
|
} |
756
|
0
|
0
|
|
|
|
|
}); } |
757
|
|
|
|
|
|
|
|
758
|
|
|
|
|
|
|
|
759
|
|
|
|
|
|
|
|
760
|
0
|
|
|
|
|
|
XS_EUPXS(XS_MyTest__Cookbook__DateRecipe04_get_epoch) { xs::throw_guard(cv, [=]() |
761
|
|
|
|
|
|
|
{ |
762
|
0
|
|
|
|
|
|
dVAR; dXSARGS; |
763
|
0
|
0
|
|
|
|
|
if (items != 1) |
764
|
0
|
|
|
|
|
|
croak_xs_usage(cv, "THIS"); |
765
|
|
|
|
|
|
|
{ |
766
|
|
|
|
|
|
|
std::time_t RETVAL; |
767
|
0
|
0
|
|
|
|
|
DateRecipe04* THIS = xs::in(ST(0)); if (!SvOK(ST(0))) throw "undef not allowed as THIS"; |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
768
|
|
|
|
|
|
|
; |
769
|
|
|
|
|
|
|
#line 59 "t/cookbook/recipe04.xsi" |
770
|
|
|
|
|
|
|
xs::Sv PROTO; PERL_UNUSED_VAR(PROTO); |
771
|
|
|
|
|
|
|
RETVAL = THIS->get_epoch(); |
772
|
|
|
|
|
|
|
#line 773 "t/cookbook/cookbook_xsgen.cc" |
773
|
|
|
|
|
|
|
{ |
774
|
|
|
|
|
|
|
SV * RETVALSV; |
775
|
0
|
0
|
|
|
|
|
RETVALSV = xs::out(RETVAL, PROTO).detach(); |
776
|
0
|
0
|
|
|
|
|
RETVALSV = sv_2mortal(RETVALSV); |
777
|
0
|
|
|
|
|
|
ST(0) = RETVALSV; |
778
|
|
|
|
|
|
|
} |
779
|
|
|
|
|
|
|
} |
780
|
0
|
|
|
|
|
|
XSRETURN(1); |
781
|
0
|
0
|
|
|
|
|
}); } |
782
|
|
|
|
|
|
|
|
783
|
|
|
|
|
|
|
|
784
|
|
|
|
|
|
|
|
785
|
0
|
|
|
|
|
|
XS_EUPXS(XS_MyTest__Cookbook__DateRecipe04_get_timezone) { xs::throw_guard(cv, [=]() |
786
|
|
|
|
|
|
|
{ |
787
|
0
|
|
|
|
|
|
dVAR; dXSARGS; |
788
|
0
|
0
|
|
|
|
|
if (items != 1) |
789
|
0
|
|
|
|
|
|
croak_xs_usage(cv, "THIS"); |
790
|
|
|
|
|
|
|
{ |
791
|
0
|
|
|
|
|
|
TimezoneRecipe04SP RETVAL; |
792
|
0
|
0
|
|
|
|
|
DateRecipe04* THIS = xs::in(ST(0)); if (!SvOK(ST(0))) throw "undef not allowed as THIS"; |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
793
|
|
|
|
|
|
|
; |
794
|
|
|
|
|
|
|
#line 61 "t/cookbook/recipe04.xsi" |
795
|
|
|
|
|
|
|
xs::Sv PROTO; PERL_UNUSED_VAR(PROTO); |
796
|
|
|
|
|
|
|
RETVAL = THIS->get_timezone(); |
797
|
|
|
|
|
|
|
#line 798 "t/cookbook/cookbook_xsgen.cc" |
798
|
|
|
|
|
|
|
{ |
799
|
|
|
|
|
|
|
SV * RETVALSV; |
800
|
0
|
0
|
|
|
|
|
RETVALSV = xs::out(RETVAL, PROTO).detach(); |
801
|
0
|
0
|
|
|
|
|
RETVALSV = sv_2mortal(RETVALSV); |
802
|
0
|
|
|
|
|
|
ST(0) = RETVALSV; |
803
|
|
|
|
|
|
|
} |
804
|
|
|
|
|
|
|
} |
805
|
0
|
|
|
|
|
|
XSRETURN(1); |
806
|
0
|
0
|
|
|
|
|
}); } |
807
|
|
|
|
|
|
|
|
808
|
|
|
|
|
|
|
|
809
|
|
|
|
|
|
|
|
810
|
0
|
|
|
|
|
|
XS_EUPXS(XS_MyTest__Cookbook__DateRecipe04_set_timezone) { xs::throw_guard(cv, [=]() |
811
|
|
|
|
|
|
|
{ |
812
|
0
|
|
|
|
|
|
dVAR; dXSARGS; |
813
|
0
|
0
|
|
|
|
|
if (items != 2) |
814
|
0
|
|
|
|
|
|
croak_xs_usage(cv, "THIS, tz"); |
815
|
|
|
|
|
|
|
PERL_UNUSED_VAR(ax); /* -Wall */ |
816
|
0
|
|
|
|
|
|
SP -= items; |
817
|
|
|
|
|
|
|
{ |
818
|
0
|
0
|
|
|
|
|
DateRecipe04* THIS = xs::in(ST(0)); if (!SvOK(ST(0))) throw "undef not allowed as THIS"; |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
819
|
|
|
|
|
|
|
; |
820
|
0
|
0
|
|
|
|
|
TimezoneRecipe04SP tz = xs::in(ST(1)); |
821
|
|
|
|
|
|
|
; |
822
|
|
|
|
|
|
|
#line 63 "t/cookbook/recipe04.xsi" |
823
|
|
|
|
|
|
|
THIS->set_timezone(tz); |
824
|
|
|
|
|
|
|
#line 825 "t/cookbook/cookbook_xsgen.cc" |
825
|
0
|
|
|
|
|
|
PUTBACK; |
826
|
0
|
|
|
|
|
|
return; |
827
|
|
|
|
|
|
|
} |
828
|
0
|
0
|
|
|
|
|
}); } |
829
|
|
|
|
|
|
|
|
830
|
|
|
|
|
|
|
|
831
|
|
|
|
|
|
|
/* INCLUDE: Returning to 'cookbook.xs' from 'recipe04.xsi' */ |
832
|
|
|
|
|
|
|
|
833
|
|
|
|
|
|
|
|
834
|
|
|
|
|
|
|
/* INCLUDE: Including 'recipe05.xsi' from 'cookbook.xs' */ |
835
|
|
|
|
|
|
|
|
836
|
|
|
|
|
|
|
#include |
837
|
|
|
|
|
|
|
struct TimezoneRecipe05: public panda::Refcnt { |
838
|
0
|
|
|
|
|
|
const char* get_name() const { return name.c_str(); } |
839
|
0
|
0
|
|
|
|
|
TimezoneRecipe05(const char* name_): name{name_} { } |
840
|
0
|
0
|
|
|
|
|
~TimezoneRecipe05() { std::cout << "~TimezoneRecipe05()\n"; } |
841
|
|
|
|
|
|
|
private: |
842
|
|
|
|
|
|
|
std::string name; |
843
|
|
|
|
|
|
|
}; |
844
|
|
|
|
|
|
|
using TimezoneRecipe05SP = panda::iptr; |
845
|
0
|
|
|
|
|
|
struct DateRecipe05 { |
846
|
0
|
|
|
|
|
|
DateRecipe05() { update() ; } |
847
|
0
|
|
|
|
|
|
void update() { epoch = std::time(nullptr); } |
848
|
|
|
|
|
|
|
|
849
|
0
|
|
|
|
|
|
int get_epoch() const { return epoch; } |
850
|
0
|
|
|
|
|
|
void set_timezone(TimezoneRecipe05SP tz_) { tz = tz_; } |
851
|
0
|
|
|
|
|
|
TimezoneRecipe05SP get_timezone() { return tz; } |
852
|
|
|
|
|
|
|
private: |
853
|
|
|
|
|
|
|
std::time_t epoch; |
854
|
|
|
|
|
|
|
TimezoneRecipe05SP tz; |
855
|
|
|
|
|
|
|
}; |
856
|
|
|
|
|
|
|
namespace xs { |
857
|
|
|
|
|
|
|
template <> |
858
|
|
|
|
|
|
|
struct Typemap : TypemapObject { |
859
|
0
|
0
|
|
|
|
|
static std::string package () { return "MyTest::Cookbook::TimezoneRecipe05"; } |
860
|
|
|
|
|
|
|
}; |
861
|
|
|
|
|
|
|
} |
862
|
|
|
|
|
|
|
namespace xs { |
863
|
|
|
|
|
|
|
template <> |
864
|
|
|
|
|
|
|
struct Typemap : TypemapObject { |
865
|
0
|
0
|
|
|
|
|
static std::string package () { return "MyTest::Cookbook::DateRecipe05"; } |
866
|
|
|
|
|
|
|
}; |
867
|
|
|
|
|
|
|
} |
868
|
|
|
|
|
|
|
|
869
|
|
|
|
|
|
|
|
870
|
0
|
|
|
|
|
|
XS_EUPXS(XS_MyTest__Cookbook__TimezoneRecipe05_get_name) { xs::throw_guard(cv, [=]() |
871
|
|
|
|
|
|
|
{ |
872
|
0
|
|
|
|
|
|
dVAR; dXSARGS; |
873
|
0
|
0
|
|
|
|
|
if (items != 1) |
874
|
0
|
|
|
|
|
|
croak_xs_usage(cv, "THIS"); |
875
|
|
|
|
|
|
|
{ |
876
|
|
|
|
|
|
|
const char * RETVAL; |
877
|
0
|
0
|
|
|
|
|
dXSTARG; |
|
|
0
|
|
|
|
|
|
878
|
0
|
0
|
|
|
|
|
TimezoneRecipe05* THIS = xs::in(ST(0)); if (!SvOK(ST(0))) throw "undef not allowed as THIS"; |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
879
|
|
|
|
|
|
|
; |
880
|
|
|
|
|
|
|
#line 46 "t/cookbook/recipe05.xsi" |
881
|
|
|
|
|
|
|
RETVAL = THIS->get_name(); |
882
|
|
|
|
|
|
|
#line 883 "t/cookbook/cookbook_xsgen.cc" |
883
|
0
|
0
|
|
|
|
|
sv_setpv(TARG, RETVAL); XSprePUSH; PUSHTARG; |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
884
|
|
|
|
|
|
|
} |
885
|
0
|
|
|
|
|
|
XSRETURN(1); |
886
|
0
|
0
|
|
|
|
|
}); } |
887
|
|
|
|
|
|
|
|
888
|
|
|
|
|
|
|
|
889
|
|
|
|
|
|
|
|
890
|
0
|
|
|
|
|
|
XS_EUPXS(XS_MyTest__Cookbook__TimezoneRecipe05_create) { xs::throw_guard(cv, [=]() |
891
|
|
|
|
|
|
|
{ |
892
|
0
|
|
|
|
|
|
dVAR; dXSARGS; |
893
|
0
|
0
|
|
|
|
|
if (items != 1) |
894
|
0
|
|
|
|
|
|
croak_xs_usage(cv, "name"); |
895
|
|
|
|
|
|
|
{ |
896
|
0
|
|
|
|
|
|
TimezoneRecipe05SP RETVAL; |
897
|
0
|
0
|
|
|
|
|
const char* name = (const char *)SvPV_nolen(ST(0)) |
|
|
0
|
|
|
|
|
|
898
|
|
|
|
|
|
|
; |
899
|
|
|
|
|
|
|
#line 48 "t/cookbook/recipe05.xsi" |
900
|
|
|
|
|
|
|
xs::Sv PROTO; PERL_UNUSED_VAR(PROTO); |
901
|
|
|
|
|
|
|
RETVAL = TimezoneRecipe05SP(new TimezoneRecipe05(name)); |
902
|
|
|
|
|
|
|
#line 903 "t/cookbook/cookbook_xsgen.cc" |
903
|
|
|
|
|
|
|
{ |
904
|
|
|
|
|
|
|
SV * RETVALSV; |
905
|
0
|
0
|
|
|
|
|
RETVALSV = xs::out(RETVAL, PROTO).detach(); |
906
|
0
|
0
|
|
|
|
|
RETVALSV = sv_2mortal(RETVALSV); |
907
|
0
|
|
|
|
|
|
ST(0) = RETVALSV; |
908
|
|
|
|
|
|
|
} |
909
|
|
|
|
|
|
|
} |
910
|
0
|
|
|
|
|
|
XSRETURN(1); |
911
|
0
|
0
|
|
|
|
|
}); } |
912
|
|
|
|
|
|
|
|
913
|
|
|
|
|
|
|
|
914
|
|
|
|
|
|
|
|
915
|
0
|
|
|
|
|
|
XS_EUPXS(XS_MyTest__Cookbook__DateRecipe05_new) { xs::throw_guard(cv, [=]() |
916
|
|
|
|
|
|
|
{ |
917
|
0
|
|
|
|
|
|
dVAR; dXSARGS; |
918
|
0
|
0
|
|
|
|
|
if (items != 1) |
919
|
0
|
|
|
|
|
|
croak_xs_usage(cv, "CLASS"); |
920
|
|
|
|
|
|
|
{ |
921
|
|
|
|
|
|
|
DateRecipe05 * RETVAL; |
922
|
0
|
|
|
|
|
|
SV* CLASS = ST(0) |
923
|
|
|
|
|
|
|
; |
924
|
|
|
|
|
|
|
#line 53 "t/cookbook/recipe05.xsi" |
925
|
|
|
|
|
|
|
xs::Sv PROTO; PERL_UNUSED_VAR(PROTO); |
926
|
|
|
|
|
|
|
PROTO = CLASS; |
927
|
|
|
|
|
|
|
RETVAL = new DateRecipe05(); |
928
|
|
|
|
|
|
|
#line 929 "t/cookbook/cookbook_xsgen.cc" |
929
|
|
|
|
|
|
|
{ |
930
|
|
|
|
|
|
|
SV * RETVALSV; |
931
|
0
|
0
|
|
|
|
|
RETVALSV = xs::out(RETVAL, PROTO).detach(); |
932
|
0
|
0
|
|
|
|
|
RETVALSV = sv_2mortal(RETVALSV); |
933
|
0
|
|
|
|
|
|
ST(0) = RETVALSV; |
934
|
|
|
|
|
|
|
} |
935
|
|
|
|
|
|
|
} |
936
|
0
|
|
|
|
|
|
XSRETURN(1); |
937
|
0
|
0
|
|
|
|
|
}); } |
938
|
|
|
|
|
|
|
|
939
|
|
|
|
|
|
|
|
940
|
|
|
|
|
|
|
|
941
|
0
|
|
|
|
|
|
XS_EUPXS(XS_MyTest__Cookbook__DateRecipe05_update) { xs::throw_guard(cv, [=]() |
942
|
|
|
|
|
|
|
{ |
943
|
0
|
|
|
|
|
|
dVAR; dXSARGS; |
944
|
0
|
0
|
|
|
|
|
if (items != 1) |
945
|
0
|
|
|
|
|
|
croak_xs_usage(cv, "THIS"); |
946
|
|
|
|
|
|
|
PERL_UNUSED_VAR(ax); /* -Wall */ |
947
|
0
|
|
|
|
|
|
SP -= items; |
948
|
|
|
|
|
|
|
{ |
949
|
0
|
0
|
|
|
|
|
DateRecipe05* THIS = xs::in(ST(0)); if (!SvOK(ST(0))) throw "undef not allowed as THIS"; |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
950
|
|
|
|
|
|
|
; |
951
|
|
|
|
|
|
|
#line 55 "t/cookbook/recipe05.xsi" |
952
|
|
|
|
|
|
|
THIS->update(); |
953
|
|
|
|
|
|
|
#line 954 "t/cookbook/cookbook_xsgen.cc" |
954
|
0
|
|
|
|
|
|
PUTBACK; |
955
|
0
|
|
|
|
|
|
return; |
956
|
|
|
|
|
|
|
} |
957
|
0
|
0
|
|
|
|
|
}); } |
958
|
|
|
|
|
|
|
|
959
|
|
|
|
|
|
|
|
960
|
|
|
|
|
|
|
|
961
|
0
|
|
|
|
|
|
XS_EUPXS(XS_MyTest__Cookbook__DateRecipe05_get_epoch) { xs::throw_guard(cv, [=]() |
962
|
|
|
|
|
|
|
{ |
963
|
0
|
|
|
|
|
|
dVAR; dXSARGS; |
964
|
0
|
0
|
|
|
|
|
if (items != 1) |
965
|
0
|
|
|
|
|
|
croak_xs_usage(cv, "THIS"); |
966
|
|
|
|
|
|
|
{ |
967
|
|
|
|
|
|
|
std::time_t RETVAL; |
968
|
0
|
0
|
|
|
|
|
DateRecipe05* THIS = xs::in(ST(0)); if (!SvOK(ST(0))) throw "undef not allowed as THIS"; |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
969
|
|
|
|
|
|
|
; |
970
|
|
|
|
|
|
|
#line 57 "t/cookbook/recipe05.xsi" |
971
|
|
|
|
|
|
|
xs::Sv PROTO; PERL_UNUSED_VAR(PROTO); |
972
|
|
|
|
|
|
|
RETVAL = THIS->get_epoch(); |
973
|
|
|
|
|
|
|
#line 974 "t/cookbook/cookbook_xsgen.cc" |
974
|
|
|
|
|
|
|
{ |
975
|
|
|
|
|
|
|
SV * RETVALSV; |
976
|
0
|
0
|
|
|
|
|
RETVALSV = xs::out(RETVAL, PROTO).detach(); |
977
|
0
|
0
|
|
|
|
|
RETVALSV = sv_2mortal(RETVALSV); |
978
|
0
|
|
|
|
|
|
ST(0) = RETVALSV; |
979
|
|
|
|
|
|
|
} |
980
|
|
|
|
|
|
|
} |
981
|
0
|
|
|
|
|
|
XSRETURN(1); |
982
|
0
|
0
|
|
|
|
|
}); } |
983
|
|
|
|
|
|
|
|
984
|
|
|
|
|
|
|
|
985
|
|
|
|
|
|
|
|
986
|
0
|
|
|
|
|
|
XS_EUPXS(XS_MyTest__Cookbook__DateRecipe05_get_timezone) { xs::throw_guard(cv, [=]() |
987
|
|
|
|
|
|
|
{ |
988
|
0
|
|
|
|
|
|
dVAR; dXSARGS; |
989
|
0
|
0
|
|
|
|
|
if (items != 1) |
990
|
0
|
|
|
|
|
|
croak_xs_usage(cv, "THIS"); |
991
|
|
|
|
|
|
|
{ |
992
|
0
|
|
|
|
|
|
TimezoneRecipe05SP RETVAL; |
993
|
0
|
0
|
|
|
|
|
DateRecipe05* THIS = xs::in(ST(0)); if (!SvOK(ST(0))) throw "undef not allowed as THIS"; |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
994
|
|
|
|
|
|
|
; |
995
|
|
|
|
|
|
|
#line 59 "t/cookbook/recipe05.xsi" |
996
|
|
|
|
|
|
|
xs::Sv PROTO; PERL_UNUSED_VAR(PROTO); |
997
|
|
|
|
|
|
|
RETVAL = THIS->get_timezone(); |
998
|
|
|
|
|
|
|
#line 999 "t/cookbook/cookbook_xsgen.cc" |
999
|
|
|
|
|
|
|
{ |
1000
|
|
|
|
|
|
|
SV * RETVALSV; |
1001
|
0
|
0
|
|
|
|
|
RETVALSV = xs::out(RETVAL, PROTO).detach(); |
1002
|
0
|
0
|
|
|
|
|
RETVALSV = sv_2mortal(RETVALSV); |
1003
|
0
|
|
|
|
|
|
ST(0) = RETVALSV; |
1004
|
|
|
|
|
|
|
} |
1005
|
|
|
|
|
|
|
} |
1006
|
0
|
|
|
|
|
|
XSRETURN(1); |
1007
|
0
|
0
|
|
|
|
|
}); } |
1008
|
|
|
|
|
|
|
|
1009
|
|
|
|
|
|
|
|
1010
|
|
|
|
|
|
|
|
1011
|
0
|
|
|
|
|
|
XS_EUPXS(XS_MyTest__Cookbook__DateRecipe05_set_timezone) { xs::throw_guard(cv, [=]() |
1012
|
|
|
|
|
|
|
{ |
1013
|
0
|
|
|
|
|
|
dVAR; dXSARGS; |
1014
|
0
|
0
|
|
|
|
|
if (items != 2) |
1015
|
0
|
|
|
|
|
|
croak_xs_usage(cv, "THIS, tz"); |
1016
|
|
|
|
|
|
|
PERL_UNUSED_VAR(ax); /* -Wall */ |
1017
|
0
|
|
|
|
|
|
SP -= items; |
1018
|
|
|
|
|
|
|
{ |
1019
|
0
|
0
|
|
|
|
|
DateRecipe05* THIS = xs::in(ST(0)); if (!SvOK(ST(0))) throw "undef not allowed as THIS"; |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
1020
|
|
|
|
|
|
|
; |
1021
|
0
|
0
|
|
|
|
|
TimezoneRecipe05SP tz = xs::in(ST(1)); |
1022
|
|
|
|
|
|
|
; |
1023
|
|
|
|
|
|
|
#line 61 "t/cookbook/recipe05.xsi" |
1024
|
|
|
|
|
|
|
THIS->set_timezone(tz); |
1025
|
|
|
|
|
|
|
#line 1026 "t/cookbook/cookbook_xsgen.cc" |
1026
|
0
|
|
|
|
|
|
PUTBACK; |
1027
|
0
|
|
|
|
|
|
return; |
1028
|
|
|
|
|
|
|
} |
1029
|
0
|
0
|
|
|
|
|
}); } |
1030
|
|
|
|
|
|
|
|
1031
|
|
|
|
|
|
|
|
1032
|
|
|
|
|
|
|
/* INCLUDE: Returning to 'cookbook.xs' from 'recipe05.xsi' */ |
1033
|
|
|
|
|
|
|
|
1034
|
|
|
|
|
|
|
|
1035
|
|
|
|
|
|
|
/* INCLUDE: Including 'recipe06.xsi' from 'cookbook.xs' */ |
1036
|
|
|
|
|
|
|
|
1037
|
0
|
|
|
|
|
|
struct Base06 { |
1038
|
0
|
|
|
|
|
|
virtual const char* method() { return "from base"; } |
1039
|
0
|
0
|
|
|
|
|
virtual ~Base06() { } |
1040
|
|
|
|
|
|
|
}; |
1041
|
0
|
0
|
|
|
|
|
struct Derived06A: public Base06 { |
1042
|
0
|
|
|
|
|
|
virtual const char* method() { return "from derived-A"; } |
1043
|
0
|
|
|
|
|
|
const char* specific_method() { return "specific-A"; } |
1044
|
|
|
|
|
|
|
}; |
1045
|
0
|
0
|
|
|
|
|
struct Derived06B: public Base06 { |
1046
|
0
|
|
|
|
|
|
virtual const char* method() { return "from derived-B"; } |
1047
|
0
|
|
|
|
|
|
const char* specific_method() { return "specific-B"; } |
1048
|
|
|
|
|
|
|
}; |
1049
|
|
|
|
|
|
|
namespace xs { |
1050
|
|
|
|
|
|
|
template |
1051
|
|
|
|
|
|
|
struct Typemap : TypemapObject { |
1052
|
0
|
0
|
|
|
|
|
static std::string package () { return "MyTest::Cookbook::Base04"; } |
1053
|
|
|
|
|
|
|
}; |
1054
|
|
|
|
|
|
|
|
1055
|
|
|
|
|
|
|
template <> struct Typemap : Typemap { |
1056
|
0
|
0
|
|
|
|
|
static std::string package () { return "MyTest::Cookbook::Derived06A"; } |
1057
|
|
|
|
|
|
|
}; |
1058
|
|
|
|
|
|
|
|
1059
|
|
|
|
|
|
|
template <> struct Typemap : Typemap { |
1060
|
0
|
0
|
|
|
|
|
static std::string package () { return "MyTest::Cookbook::Derived06B"; } |
1061
|
|
|
|
|
|
|
}; |
1062
|
|
|
|
|
|
|
} |
1063
|
|
|
|
|
|
|
|
1064
|
|
|
|
|
|
|
|
1065
|
0
|
|
|
|
|
|
XS_EUPXS(XS_MyTest__Cookbook__Base06_method) { xs::throw_guard(cv, [=]() |
1066
|
|
|
|
|
|
|
{ |
1067
|
0
|
|
|
|
|
|
dVAR; dXSARGS; |
1068
|
0
|
0
|
|
|
|
|
if (items != 1) |
1069
|
0
|
|
|
|
|
|
croak_xs_usage(cv, "THIS"); |
1070
|
|
|
|
|
|
|
{ |
1071
|
|
|
|
|
|
|
const char * RETVAL; |
1072
|
0
|
0
|
|
|
|
|
dXSTARG; |
|
|
0
|
|
|
|
|
|
1073
|
0
|
0
|
|
|
|
|
Base06* THIS = xs::in(ST(0)); if (!SvOK(ST(0))) throw "undef not allowed as THIS"; |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
1074
|
|
|
|
|
|
|
; |
1075
|
|
|
|
|
|
|
#line 38 "t/cookbook/recipe06.xsi" |
1076
|
|
|
|
|
|
|
RETVAL = THIS->method(); |
1077
|
|
|
|
|
|
|
#line 1078 "t/cookbook/cookbook_xsgen.cc" |
1078
|
0
|
0
|
|
|
|
|
sv_setpv(TARG, RETVAL); XSprePUSH; PUSHTARG; |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
1079
|
|
|
|
|
|
|
} |
1080
|
0
|
|
|
|
|
|
XSRETURN(1); |
1081
|
0
|
0
|
|
|
|
|
}); } |
1082
|
|
|
|
|
|
|
|
1083
|
|
|
|
|
|
|
|
1084
|
|
|
|
|
|
|
|
1085
|
0
|
|
|
|
|
|
XS_EUPXS(XS_MyTest__Cookbook__Base06_new) { xs::throw_guard(cv, [=]() |
1086
|
|
|
|
|
|
|
{ |
1087
|
0
|
|
|
|
|
|
dVAR; dXSARGS; |
1088
|
0
|
0
|
|
|
|
|
if (items != 1) |
1089
|
0
|
|
|
|
|
|
croak_xs_usage(cv, "CLASS"); |
1090
|
|
|
|
|
|
|
{ |
1091
|
|
|
|
|
|
|
Base06 * RETVAL; |
1092
|
0
|
|
|
|
|
|
SV* CLASS = ST(0) |
1093
|
|
|
|
|
|
|
; |
1094
|
|
|
|
|
|
|
#line 40 "t/cookbook/recipe06.xsi" |
1095
|
|
|
|
|
|
|
xs::Sv PROTO; PERL_UNUSED_VAR(PROTO); |
1096
|
|
|
|
|
|
|
PROTO = CLASS; |
1097
|
|
|
|
|
|
|
RETVAL = new Base06(); |
1098
|
|
|
|
|
|
|
#line 1099 "t/cookbook/cookbook_xsgen.cc" |
1099
|
|
|
|
|
|
|
{ |
1100
|
|
|
|
|
|
|
SV * RETVALSV; |
1101
|
0
|
0
|
|
|
|
|
RETVALSV = xs::out(RETVAL, PROTO).detach(); |
1102
|
0
|
0
|
|
|
|
|
RETVALSV = sv_2mortal(RETVALSV); |
1103
|
0
|
|
|
|
|
|
ST(0) = RETVALSV; |
1104
|
|
|
|
|
|
|
} |
1105
|
|
|
|
|
|
|
} |
1106
|
0
|
|
|
|
|
|
XSRETURN(1); |
1107
|
0
|
0
|
|
|
|
|
}); } |
1108
|
|
|
|
|
|
|
|
1109
|
|
|
|
|
|
|
|
1110
|
|
|
|
|
|
|
|
1111
|
0
|
|
|
|
|
|
XS_EUPXS(XS_MyTest__Cookbook__Derived06A_new) { xs::throw_guard(cv, [=]() |
1112
|
|
|
|
|
|
|
{ |
1113
|
0
|
|
|
|
|
|
dVAR; dXSARGS; |
1114
|
0
|
0
|
|
|
|
|
if (items != 1) |
1115
|
0
|
|
|
|
|
|
croak_xs_usage(cv, "CLASS"); |
1116
|
|
|
|
|
|
|
{ |
1117
|
|
|
|
|
|
|
Derived06A * RETVAL; |
1118
|
0
|
|
|
|
|
|
SV* CLASS = ST(0) |
1119
|
|
|
|
|
|
|
; |
1120
|
|
|
|
|
|
|
#line 45 "t/cookbook/recipe06.xsi" |
1121
|
|
|
|
|
|
|
xs::Sv PROTO; PERL_UNUSED_VAR(PROTO); |
1122
|
|
|
|
|
|
|
PROTO = CLASS; |
1123
|
|
|
|
|
|
|
RETVAL = new Derived06A(); |
1124
|
|
|
|
|
|
|
#line 1125 "t/cookbook/cookbook_xsgen.cc" |
1125
|
|
|
|
|
|
|
{ |
1126
|
|
|
|
|
|
|
SV * RETVALSV; |
1127
|
0
|
0
|
|
|
|
|
RETVALSV = xs::out(RETVAL, PROTO).detach(); |
1128
|
0
|
0
|
|
|
|
|
RETVALSV = sv_2mortal(RETVALSV); |
1129
|
0
|
|
|
|
|
|
ST(0) = RETVALSV; |
1130
|
|
|
|
|
|
|
} |
1131
|
|
|
|
|
|
|
} |
1132
|
0
|
|
|
|
|
|
XSRETURN(1); |
1133
|
0
|
0
|
|
|
|
|
}); } |
1134
|
|
|
|
|
|
|
|
1135
|
|
|
|
|
|
|
|
1136
|
|
|
|
|
|
|
|
1137
|
0
|
|
|
|
|
|
XS_EUPXS(XS_MyTest__Cookbook__Derived06A_specific_method) { xs::throw_guard(cv, [=]() |
1138
|
|
|
|
|
|
|
{ |
1139
|
0
|
|
|
|
|
|
dVAR; dXSARGS; |
1140
|
0
|
0
|
|
|
|
|
if (items != 1) |
1141
|
0
|
|
|
|
|
|
croak_xs_usage(cv, "THIS"); |
1142
|
|
|
|
|
|
|
{ |
1143
|
|
|
|
|
|
|
const char * RETVAL; |
1144
|
0
|
0
|
|
|
|
|
dXSTARG; |
|
|
0
|
|
|
|
|
|
1145
|
0
|
0
|
|
|
|
|
Derived06A* THIS = xs::in(ST(0)); if (!SvOK(ST(0))) throw "undef not allowed as THIS"; |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
1146
|
|
|
|
|
|
|
; |
1147
|
|
|
|
|
|
|
#line 47 "t/cookbook/recipe06.xsi" |
1148
|
|
|
|
|
|
|
RETVAL = THIS->specific_method(); |
1149
|
|
|
|
|
|
|
#line 1150 "t/cookbook/cookbook_xsgen.cc" |
1150
|
0
|
0
|
|
|
|
|
sv_setpv(TARG, RETVAL); XSprePUSH; PUSHTARG; |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
1151
|
|
|
|
|
|
|
} |
1152
|
0
|
|
|
|
|
|
XSRETURN(1); |
1153
|
0
|
0
|
|
|
|
|
}); } |
1154
|
|
|
|
|
|
|
|
1155
|
|
|
|
|
|
|
|
1156
|
|
|
|
|
|
|
|
1157
|
0
|
|
|
|
|
|
XS_EUPXS(XS_MyTest__Cookbook__Derived06B_new) { xs::throw_guard(cv, [=]() |
1158
|
|
|
|
|
|
|
{ |
1159
|
0
|
|
|
|
|
|
dVAR; dXSARGS; |
1160
|
0
|
0
|
|
|
|
|
if (items != 1) |
1161
|
0
|
|
|
|
|
|
croak_xs_usage(cv, "CLASS"); |
1162
|
|
|
|
|
|
|
{ |
1163
|
|
|
|
|
|
|
Derived06B * RETVAL; |
1164
|
0
|
|
|
|
|
|
SV* CLASS = ST(0) |
1165
|
|
|
|
|
|
|
; |
1166
|
|
|
|
|
|
|
#line 56 "t/cookbook/recipe06.xsi" |
1167
|
|
|
|
|
|
|
xs::Sv PROTO; PERL_UNUSED_VAR(PROTO); |
1168
|
|
|
|
|
|
|
PROTO = CLASS; |
1169
|
|
|
|
|
|
|
RETVAL = new Derived06B(); |
1170
|
|
|
|
|
|
|
#line 1171 "t/cookbook/cookbook_xsgen.cc" |
1171
|
|
|
|
|
|
|
{ |
1172
|
|
|
|
|
|
|
SV * RETVALSV; |
1173
|
0
|
0
|
|
|
|
|
RETVALSV = xs::out(RETVAL, PROTO).detach(); |
1174
|
0
|
0
|
|
|
|
|
RETVALSV = sv_2mortal(RETVALSV); |
1175
|
0
|
|
|
|
|
|
ST(0) = RETVALSV; |
1176
|
|
|
|
|
|
|
} |
1177
|
|
|
|
|
|
|
} |
1178
|
0
|
|
|
|
|
|
XSRETURN(1); |
1179
|
0
|
0
|
|
|
|
|
}); } |
1180
|
|
|
|
|
|
|
|
1181
|
|
|
|
|
|
|
|
1182
|
|
|
|
|
|
|
|
1183
|
0
|
|
|
|
|
|
XS_EUPXS(XS_MyTest__Cookbook__Derived06B_specific_method) { xs::throw_guard(cv, [=]() |
1184
|
|
|
|
|
|
|
{ |
1185
|
0
|
|
|
|
|
|
dVAR; dXSARGS; |
1186
|
0
|
0
|
|
|
|
|
if (items != 1) |
1187
|
0
|
|
|
|
|
|
croak_xs_usage(cv, "THIS"); |
1188
|
|
|
|
|
|
|
{ |
1189
|
|
|
|
|
|
|
const char * RETVAL; |
1190
|
0
|
0
|
|
|
|
|
dXSTARG; |
|
|
0
|
|
|
|
|
|
1191
|
0
|
0
|
|
|
|
|
Derived06B* THIS = xs::in(ST(0)); if (!SvOK(ST(0))) throw "undef not allowed as THIS"; |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
1192
|
|
|
|
|
|
|
; |
1193
|
|
|
|
|
|
|
#line 58 "t/cookbook/recipe06.xsi" |
1194
|
|
|
|
|
|
|
RETVAL = THIS->specific_method(); |
1195
|
|
|
|
|
|
|
#line 1196 "t/cookbook/cookbook_xsgen.cc" |
1196
|
0
|
0
|
|
|
|
|
sv_setpv(TARG, RETVAL); XSprePUSH; PUSHTARG; |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
1197
|
|
|
|
|
|
|
} |
1198
|
0
|
|
|
|
|
|
XSRETURN(1); |
1199
|
0
|
0
|
|
|
|
|
}); } |
1200
|
|
|
|
|
|
|
|
1201
|
|
|
|
|
|
|
|
1202
|
|
|
|
|
|
|
/* INCLUDE: Returning to 'cookbook.xs' from 'recipe06.xsi' */ |
1203
|
|
|
|
|
|
|
|
1204
|
|
|
|
|
|
|
|
1205
|
|
|
|
|
|
|
/* INCLUDE: Including 'recipe07.xsi' from 'cookbook.xs' */ |
1206
|
|
|
|
|
|
|
|
1207
|
|
|
|
|
|
|
#include |
1208
|
|
|
|
|
|
|
enum class Status07 { CONNECTED = 1, AUTHORIZED = 2, NOT_AUTHORIZED = 3, DISCONNECTED = 4 }; |
1209
|
|
|
|
|
|
|
struct Client07 { |
1210
|
|
|
|
|
|
|
int id; |
1211
|
|
|
|
|
|
|
Status07 status; |
1212
|
|
|
|
|
|
|
|
1213
|
0
|
|
|
|
|
|
Client07 (int id_): id{id_}, status{Status07::CONNECTED } {} |
1214
|
0
|
|
|
|
|
|
void disconnect() { |
1215
|
0
|
|
|
|
|
|
std::cout << "disconnecting " << id << "\n"; |
1216
|
0
|
|
|
|
|
|
status = Status07::DISCONNECTED; |
1217
|
0
|
|
|
|
|
|
} |
1218
|
0
|
|
|
|
|
|
void welcome() { |
1219
|
0
|
|
|
|
|
|
std::cout << "[sending] welcome dear client " << id << "\n"; |
1220
|
0
|
|
|
|
|
|
} |
1221
|
|
|
|
|
|
|
}; |
1222
|
|
|
|
|
|
|
struct ServerBase07 { |
1223
|
0
|
|
|
|
|
|
void on_client(Client07* c) { |
1224
|
0
|
0
|
|
|
|
|
if (c->status == Status07::AUTHORIZED) c->welcome(); |
1225
|
0
|
0
|
|
|
|
|
if (c->status == Status07::NOT_AUTHORIZED) c->disconnect(); |
1226
|
0
|
|
|
|
|
|
} |
1227
|
|
|
|
|
|
|
}; |
1228
|
|
|
|
|
|
|
struct LoggerPlugin07 { |
1229
|
0
|
|
|
|
|
|
void on_client(Client07* c) { std::cout << "client " << c->id << ", status: " << (int) c->status << "\n"; } |
1230
|
|
|
|
|
|
|
}; |
1231
|
|
|
|
|
|
|
struct AuthorizerPlugin07 { |
1232
|
0
|
|
|
|
|
|
void on_client(Client07* c) { |
1233
|
0
|
0
|
|
|
|
|
c->status = (c->id < 0) ? Status07::NOT_AUTHORIZED : Status07::AUTHORIZED; |
1234
|
0
|
|
|
|
|
|
} |
1235
|
|
|
|
|
|
|
}; |
1236
|
|
|
|
|
|
|
namespace xs { |
1237
|
|
|
|
|
|
|
template <> |
1238
|
|
|
|
|
|
|
struct Typemap : TypemapObject { |
1239
|
0
|
0
|
|
|
|
|
static std::string package () { return "MyTest::Cookbook::Client07"; } |
1240
|
|
|
|
|
|
|
}; |
1241
|
|
|
|
|
|
|
|
1242
|
|
|
|
|
|
|
template <> |
1243
|
|
|
|
|
|
|
struct Typemap : TypemapObject { |
1244
|
0
|
0
|
|
|
|
|
static std::string package () { return "MyTest::Cookbook::ServerBase07"; } |
1245
|
|
|
|
|
|
|
}; |
1246
|
|
|
|
|
|
|
|
1247
|
|
|
|
|
|
|
template <> |
1248
|
|
|
|
|
|
|
struct Typemap : TypemapObject { |
1249
|
0
|
0
|
|
|
|
|
static std::string package () { return "MyTest::Cookbook::LoggerPlugin07"; } |
1250
|
|
|
|
|
|
|
}; |
1251
|
|
|
|
|
|
|
|
1252
|
|
|
|
|
|
|
template <> |
1253
|
|
|
|
|
|
|
struct Typemap : TypemapObject { |
1254
|
0
|
0
|
|
|
|
|
static std::string package () { return "MyTest::Cookbook::AuthorizerPlugin07"; } |
1255
|
|
|
|
|
|
|
}; |
1256
|
|
|
|
|
|
|
} |
1257
|
|
|
|
|
|
|
|
1258
|
|
|
|
|
|
|
|
1259
|
0
|
|
|
|
|
|
XS_EUPXS(XS_MyTest__Cookbook__Client07_disconnect) { xs::throw_guard(cv, [=]() |
1260
|
|
|
|
|
|
|
{ |
1261
|
0
|
|
|
|
|
|
dVAR; dXSARGS; |
1262
|
0
|
0
|
|
|
|
|
if (items != 1) |
1263
|
0
|
|
|
|
|
|
croak_xs_usage(cv, "THIS"); |
1264
|
|
|
|
|
|
|
PERL_UNUSED_VAR(ax); /* -Wall */ |
1265
|
0
|
|
|
|
|
|
SP -= items; |
1266
|
|
|
|
|
|
|
{ |
1267
|
0
|
0
|
|
|
|
|
Client07* THIS = xs::in(ST(0)); if (!SvOK(ST(0))) throw "undef not allowed as THIS"; |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
1268
|
|
|
|
|
|
|
; |
1269
|
|
|
|
|
|
|
#line 65 "t/cookbook/recipe07.xsi" |
1270
|
|
|
|
|
|
|
THIS->disconnect(); |
1271
|
|
|
|
|
|
|
#line 1272 "t/cookbook/cookbook_xsgen.cc" |
1272
|
0
|
|
|
|
|
|
PUTBACK; |
1273
|
0
|
|
|
|
|
|
return; |
1274
|
|
|
|
|
|
|
} |
1275
|
0
|
0
|
|
|
|
|
}); } |
1276
|
|
|
|
|
|
|
|
1277
|
|
|
|
|
|
|
|
1278
|
|
|
|
|
|
|
|
1279
|
0
|
|
|
|
|
|
XS_EUPXS(XS_MyTest__Cookbook__Client07_welcome) { xs::throw_guard(cv, [=]() |
1280
|
|
|
|
|
|
|
{ |
1281
|
0
|
|
|
|
|
|
dVAR; dXSARGS; |
1282
|
0
|
0
|
|
|
|
|
if (items != 1) |
1283
|
0
|
|
|
|
|
|
croak_xs_usage(cv, "THIS"); |
1284
|
|
|
|
|
|
|
PERL_UNUSED_VAR(ax); /* -Wall */ |
1285
|
0
|
|
|
|
|
|
SP -= items; |
1286
|
|
|
|
|
|
|
{ |
1287
|
0
|
0
|
|
|
|
|
Client07* THIS = xs::in(ST(0)); if (!SvOK(ST(0))) throw "undef not allowed as THIS"; |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
1288
|
|
|
|
|
|
|
; |
1289
|
|
|
|
|
|
|
#line 67 "t/cookbook/recipe07.xsi" |
1290
|
|
|
|
|
|
|
THIS->welcome(); |
1291
|
|
|
|
|
|
|
#line 1292 "t/cookbook/cookbook_xsgen.cc" |
1292
|
0
|
|
|
|
|
|
PUTBACK; |
1293
|
0
|
|
|
|
|
|
return; |
1294
|
|
|
|
|
|
|
} |
1295
|
0
|
0
|
|
|
|
|
}); } |
1296
|
|
|
|
|
|
|
|
1297
|
|
|
|
|
|
|
|
1298
|
|
|
|
|
|
|
|
1299
|
0
|
|
|
|
|
|
XS_EUPXS(XS_MyTest__Cookbook__Client07_new) { xs::throw_guard(cv, [=]() |
1300
|
|
|
|
|
|
|
{ |
1301
|
0
|
|
|
|
|
|
dVAR; dXSARGS; |
1302
|
0
|
0
|
|
|
|
|
if (items != 2) |
1303
|
0
|
|
|
|
|
|
croak_xs_usage(cv, "CLASS, id"); |
1304
|
|
|
|
|
|
|
{ |
1305
|
|
|
|
|
|
|
Client07 * RETVAL; |
1306
|
0
|
|
|
|
|
|
SV* CLASS = ST(0) |
1307
|
|
|
|
|
|
|
; |
1308
|
0
|
0
|
|
|
|
|
int id = (int)SvIV(ST(1)) |
|
|
0
|
|
|
|
|
|
1309
|
|
|
|
|
|
|
; |
1310
|
|
|
|
|
|
|
#line 69 "t/cookbook/recipe07.xsi" |
1311
|
|
|
|
|
|
|
xs::Sv PROTO; PERL_UNUSED_VAR(PROTO); |
1312
|
|
|
|
|
|
|
PROTO = CLASS; |
1313
|
|
|
|
|
|
|
RETVAL = new Client07(id); |
1314
|
|
|
|
|
|
|
#line 1315 "t/cookbook/cookbook_xsgen.cc" |
1315
|
|
|
|
|
|
|
{ |
1316
|
|
|
|
|
|
|
SV * RETVALSV; |
1317
|
0
|
0
|
|
|
|
|
RETVALSV = xs::out(RETVAL, PROTO).detach(); |
1318
|
0
|
0
|
|
|
|
|
RETVALSV = sv_2mortal(RETVALSV); |
1319
|
0
|
|
|
|
|
|
ST(0) = RETVALSV; |
1320
|
|
|
|
|
|
|
} |
1321
|
|
|
|
|
|
|
} |
1322
|
0
|
|
|
|
|
|
XSRETURN(1); |
1323
|
0
|
0
|
|
|
|
|
}); } |
1324
|
|
|
|
|
|
|
|
1325
|
|
|
|
|
|
|
|
1326
|
|
|
|
|
|
|
|
1327
|
0
|
|
|
|
|
|
XS_EUPXS(XS_MyTest__Cookbook__ServerBase07_on_client) { xs::throw_guard(cv, [=]() |
1328
|
|
|
|
|
|
|
{ |
1329
|
0
|
|
|
|
|
|
dVAR; dXSARGS; |
1330
|
0
|
0
|
|
|
|
|
if (items != 2) |
1331
|
0
|
|
|
|
|
|
croak_xs_usage(cv, "THIS, c"); |
1332
|
|
|
|
|
|
|
PERL_UNUSED_VAR(ax); /* -Wall */ |
1333
|
0
|
|
|
|
|
|
SP -= items; |
1334
|
|
|
|
|
|
|
{ |
1335
|
0
|
0
|
|
|
|
|
ServerBase07* THIS = xs::in(ST(0)); if (!SvOK(ST(0))) throw "undef not allowed as THIS"; |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
1336
|
|
|
|
|
|
|
; |
1337
|
0
|
|
|
|
|
|
Client07* c = xs::in(ST(1)); |
1338
|
|
|
|
|
|
|
; |
1339
|
|
|
|
|
|
|
#line 75 "t/cookbook/recipe07.xsi" |
1340
|
|
|
|
|
|
|
THIS->on_client(c); |
1341
|
|
|
|
|
|
|
#line 1342 "t/cookbook/cookbook_xsgen.cc" |
1342
|
0
|
|
|
|
|
|
PUTBACK; |
1343
|
0
|
|
|
|
|
|
return; |
1344
|
|
|
|
|
|
|
} |
1345
|
0
|
0
|
|
|
|
|
}); } |
1346
|
|
|
|
|
|
|
|
1347
|
|
|
|
|
|
|
|
1348
|
|
|
|
|
|
|
|
1349
|
0
|
|
|
|
|
|
XS_EUPXS(XS_MyTest__Cookbook__ServerBase07_new) { xs::throw_guard(cv, [=]() |
1350
|
|
|
|
|
|
|
{ |
1351
|
0
|
|
|
|
|
|
dVAR; dXSARGS; |
1352
|
0
|
0
|
|
|
|
|
if (items != 1) |
1353
|
0
|
|
|
|
|
|
croak_xs_usage(cv, "CLASS"); |
1354
|
|
|
|
|
|
|
{ |
1355
|
|
|
|
|
|
|
ServerBase07 * RETVAL; |
1356
|
0
|
|
|
|
|
|
SV* CLASS = ST(0) |
1357
|
|
|
|
|
|
|
; |
1358
|
|
|
|
|
|
|
#line 77 "t/cookbook/recipe07.xsi" |
1359
|
|
|
|
|
|
|
xs::Sv PROTO; PERL_UNUSED_VAR(PROTO); |
1360
|
|
|
|
|
|
|
PROTO = CLASS; |
1361
|
|
|
|
|
|
|
RETVAL = new ServerBase07(); |
1362
|
|
|
|
|
|
|
#line 1363 "t/cookbook/cookbook_xsgen.cc" |
1363
|
|
|
|
|
|
|
{ |
1364
|
|
|
|
|
|
|
SV * RETVALSV; |
1365
|
0
|
0
|
|
|
|
|
RETVALSV = xs::out(RETVAL, PROTO).detach(); |
1366
|
0
|
0
|
|
|
|
|
RETVALSV = sv_2mortal(RETVALSV); |
1367
|
0
|
|
|
|
|
|
ST(0) = RETVALSV; |
1368
|
|
|
|
|
|
|
} |
1369
|
|
|
|
|
|
|
} |
1370
|
0
|
|
|
|
|
|
XSRETURN(1); |
1371
|
0
|
0
|
|
|
|
|
}); } |
1372
|
|
|
|
|
|
|
|
1373
|
|
|
|
|
|
|
|
1374
|
|
|
|
|
|
|
|
1375
|
0
|
|
|
|
|
|
XS_EUPXS(XS_MyTest__Cookbook__LoggerPlugin07_on_client) { xs::throw_guard(cv, [=]() |
1376
|
|
|
|
|
|
|
{ |
1377
|
0
|
|
|
|
|
|
dVAR; dXSARGS; |
1378
|
0
|
0
|
|
|
|
|
if (items != 2) |
1379
|
0
|
|
|
|
|
|
croak_xs_usage(cv, "THIS, c"); |
1380
|
|
|
|
|
|
|
PERL_UNUSED_VAR(ax); /* -Wall */ |
1381
|
0
|
|
|
|
|
|
SP -= items; |
1382
|
|
|
|
|
|
|
{ |
1383
|
0
|
0
|
|
|
|
|
LoggerPlugin07* THIS = xs::in(ST(0)); if (!SvOK(ST(0))) throw "undef not allowed as THIS"; |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
1384
|
|
|
|
|
|
|
; |
1385
|
0
|
|
|
|
|
|
Client07* c = xs::in(ST(1)); |
1386
|
|
|
|
|
|
|
; |
1387
|
|
|
|
|
|
|
#line 83 "t/cookbook/recipe07.xsi" |
1388
|
|
|
|
|
|
|
THIS->on_client(c); |
1389
|
|
|
|
|
|
|
Object(ST(0)).call_next(cv, &ST(1), items-1); |
1390
|
|
|
|
|
|
|
THIS->on_client(c); |
1391
|
|
|
|
|
|
|
#line 1392 "t/cookbook/cookbook_xsgen.cc" |
1392
|
0
|
|
|
|
|
|
PUTBACK; |
1393
|
0
|
|
|
|
|
|
return; |
1394
|
|
|
|
|
|
|
} |
1395
|
0
|
0
|
|
|
|
|
}); } |
1396
|
|
|
|
|
|
|
|
1397
|
|
|
|
|
|
|
|
1398
|
|
|
|
|
|
|
|
1399
|
0
|
|
|
|
|
|
XS_EUPXS(XS_MyTest__Cookbook__LoggerPlugin07_new) { xs::throw_guard(cv, [=]() |
1400
|
|
|
|
|
|
|
{ |
1401
|
0
|
|
|
|
|
|
dVAR; dXSARGS; |
1402
|
0
|
0
|
|
|
|
|
if (items < 1) |
1403
|
0
|
|
|
|
|
|
croak_xs_usage(cv, "CLASS, ..."); |
1404
|
|
|
|
|
|
|
{ |
1405
|
|
|
|
|
|
|
LoggerPlugin07 * RETVAL; |
1406
|
0
|
|
|
|
|
|
SV* CLASS = ST(0) |
1407
|
|
|
|
|
|
|
; |
1408
|
|
|
|
|
|
|
#line 89 "t/cookbook/recipe07.xsi" |
1409
|
|
|
|
|
|
|
xs::Sv PROTO; PERL_UNUSED_VAR(PROTO); |
1410
|
|
|
|
|
|
|
PROTO = CLASS; |
1411
|
|
|
|
|
|
|
PROTO = Stash::from_name(CLASS).call_next(cv, &ST(1), items-1); |
1412
|
|
|
|
|
|
|
if (!PROTO.defined()) XSRETURN_UNDEF; |
1413
|
|
|
|
|
|
|
RETVAL = new LoggerPlugin07(); |
1414
|
|
|
|
|
|
|
#line 1415 "t/cookbook/cookbook_xsgen.cc" |
1415
|
|
|
|
|
|
|
{ |
1416
|
|
|
|
|
|
|
SV * RETVALSV; |
1417
|
0
|
0
|
|
|
|
|
RETVALSV = xs::out(RETVAL, PROTO).detach(); |
1418
|
0
|
0
|
|
|
|
|
RETVALSV = sv_2mortal(RETVALSV); |
1419
|
0
|
0
|
|
|
|
|
ST(0) = RETVALSV; |
1420
|
|
|
|
|
|
|
} |
1421
|
|
|
|
|
|
|
} |
1422
|
0
|
|
|
|
|
|
XSRETURN(1); |
1423
|
0
|
0
|
|
|
|
|
}); } |
1424
|
|
|
|
|
|
|
|
1425
|
|
|
|
|
|
|
|
1426
|
|
|
|
|
|
|
|
1427
|
0
|
|
|
|
|
|
XS_EUPXS(XS_MyTest__Cookbook__AuthorizerPlugin07_on_client) { xs::throw_guard(cv, [=]() |
1428
|
|
|
|
|
|
|
{ |
1429
|
0
|
|
|
|
|
|
dVAR; dXSARGS; |
1430
|
0
|
0
|
|
|
|
|
if (items != 2) |
1431
|
0
|
|
|
|
|
|
croak_xs_usage(cv, "THIS, c"); |
1432
|
|
|
|
|
|
|
PERL_UNUSED_VAR(ax); /* -Wall */ |
1433
|
0
|
|
|
|
|
|
SP -= items; |
1434
|
|
|
|
|
|
|
{ |
1435
|
0
|
0
|
|
|
|
|
AuthorizerPlugin07* THIS = xs::in(ST(0)); if (!SvOK(ST(0))) throw "undef not allowed as THIS"; |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
1436
|
|
|
|
|
|
|
; |
1437
|
0
|
|
|
|
|
|
Client07* c = xs::in(ST(1)); |
1438
|
|
|
|
|
|
|
; |
1439
|
|
|
|
|
|
|
#line 98 "t/cookbook/recipe07.xsi" |
1440
|
|
|
|
|
|
|
THIS->on_client(c); |
1441
|
|
|
|
|
|
|
Object(ST(0)).call_next(cv, &ST(1), items-1); |
1442
|
|
|
|
|
|
|
#line 1443 "t/cookbook/cookbook_xsgen.cc" |
1443
|
0
|
|
|
|
|
|
PUTBACK; |
1444
|
0
|
|
|
|
|
|
return; |
1445
|
|
|
|
|
|
|
} |
1446
|
0
|
0
|
|
|
|
|
}); } |
1447
|
|
|
|
|
|
|
|
1448
|
|
|
|
|
|
|
|
1449
|
|
|
|
|
|
|
|
1450
|
0
|
|
|
|
|
|
XS_EUPXS(XS_MyTest__Cookbook__AuthorizerPlugin07_new) { xs::throw_guard(cv, [=]() |
1451
|
|
|
|
|
|
|
{ |
1452
|
0
|
|
|
|
|
|
dVAR; dXSARGS; |
1453
|
0
|
0
|
|
|
|
|
if (items < 1) |
1454
|
0
|
|
|
|
|
|
croak_xs_usage(cv, "CLASS, ..."); |
1455
|
|
|
|
|
|
|
{ |
1456
|
|
|
|
|
|
|
AuthorizerPlugin07 * RETVAL; |
1457
|
0
|
|
|
|
|
|
SV* CLASS = ST(0) |
1458
|
|
|
|
|
|
|
; |
1459
|
|
|
|
|
|
|
#line 103 "t/cookbook/recipe07.xsi" |
1460
|
|
|
|
|
|
|
xs::Sv PROTO; PERL_UNUSED_VAR(PROTO); |
1461
|
|
|
|
|
|
|
PROTO = CLASS; |
1462
|
|
|
|
|
|
|
PROTO = Stash::from_name(CLASS).call_next(cv, &ST(1), items-1); |
1463
|
|
|
|
|
|
|
if (!PROTO.defined()) XSRETURN_UNDEF; |
1464
|
|
|
|
|
|
|
RETVAL = new AuthorizerPlugin07(); |
1465
|
|
|
|
|
|
|
#line 1466 "t/cookbook/cookbook_xsgen.cc" |
1466
|
|
|
|
|
|
|
{ |
1467
|
|
|
|
|
|
|
SV * RETVALSV; |
1468
|
0
|
0
|
|
|
|
|
RETVALSV = xs::out(RETVAL, PROTO).detach(); |
1469
|
0
|
0
|
|
|
|
|
RETVALSV = sv_2mortal(RETVALSV); |
1470
|
0
|
0
|
|
|
|
|
ST(0) = RETVALSV; |
1471
|
|
|
|
|
|
|
} |
1472
|
|
|
|
|
|
|
} |
1473
|
0
|
|
|
|
|
|
XSRETURN(1); |
1474
|
0
|
0
|
|
|
|
|
}); } |
1475
|
|
|
|
|
|
|
|
1476
|
|
|
|
|
|
|
|
1477
|
|
|
|
|
|
|
/* INCLUDE: Returning to 'cookbook.xs' from 'recipe07.xsi' */ |
1478
|
|
|
|
|
|
|
|
1479
|
|
|
|
|
|
|
|
1480
|
|
|
|
|
|
|
/* INCLUDE: Including 'recipe08.xsi' from 'cookbook.xs' */ |
1481
|
|
|
|
|
|
|
|
1482
|
|
|
|
|
|
|
#include |
1483
|
|
|
|
|
|
|
/* is able to hold only files in WAV-format */ |
1484
|
|
|
|
|
|
|
struct WAVFile { |
1485
|
0
|
|
|
|
|
|
WAVFile(const char* name): name_{name} {} |
1486
|
0
|
|
|
|
|
|
const char* name() const noexcept { return name_; } |
1487
|
|
|
|
|
|
|
private: |
1488
|
|
|
|
|
|
|
const char* name_; |
1489
|
|
|
|
|
|
|
}; |
1490
|
|
|
|
|
|
|
/* is able to hold any files only in ogg, mp3 and aac formats */ |
1491
|
|
|
|
|
|
|
struct MultimediaFile { |
1492
|
0
|
|
|
|
|
|
MultimediaFile(const char* name, const char* format): name_{name}, format_{format} {} |
1493
|
0
|
|
|
|
|
|
const char* name() const noexcept { return name_; } |
1494
|
0
|
|
|
|
|
|
const char* format() const noexcept { return format_; } |
1495
|
|
|
|
|
|
|
private: |
1496
|
|
|
|
|
|
|
const char* name_; |
1497
|
|
|
|
|
|
|
const char* format_; |
1498
|
|
|
|
|
|
|
}; |
1499
|
|
|
|
|
|
|
struct WAVPlayer { |
1500
|
0
|
|
|
|
|
|
WAVPlayer(double preferred_bitrate): preferred_bitrate_{preferred_bitrate} {} |
1501
|
0
|
|
|
|
|
|
~WAVPlayer() { std::cout << "~WAVPlayer\n"; } |
1502
|
0
|
|
|
|
|
|
std::string play_wav(WAVFile* file) { |
1503
|
0
|
0
|
|
|
|
|
std::string result = "wav-player is playing "; |
1504
|
0
|
0
|
|
|
|
|
result += file->name(); |
1505
|
0
|
0
|
|
|
|
|
result += " with bitrate "; |
1506
|
0
|
0
|
|
|
|
|
result += std::to_string(preferred_bitrate_); |
|
|
0
|
|
|
|
|
|
1507
|
0
|
|
|
|
|
|
return result; |
1508
|
|
|
|
|
|
|
} |
1509
|
0
|
|
|
|
|
|
double preferred_bitrate() const noexcept { return preferred_bitrate_; } |
1510
|
0
|
|
|
|
|
|
WAVPlayer* clone() const noexcept { return new WAVPlayer(preferred_bitrate_); } |
1511
|
|
|
|
|
|
|
private: |
1512
|
|
|
|
|
|
|
double preferred_bitrate_; |
1513
|
|
|
|
|
|
|
}; |
1514
|
|
|
|
|
|
|
struct MultimediaPlayer { |
1515
|
0
|
|
|
|
|
|
MultimediaPlayer(int quality): quality_{quality} {} |
1516
|
0
|
|
|
|
|
|
~MultimediaPlayer() { std::cout << "~MultimediaPlayer\n"; } |
1517
|
0
|
|
|
|
|
|
std::string play_file(MultimediaFile* file) { |
1518
|
0
|
0
|
|
|
|
|
std::string result = "player is playing "; |
1519
|
0
|
0
|
|
|
|
|
result += file->name(); |
1520
|
0
|
0
|
|
|
|
|
result += " ("; |
1521
|
0
|
0
|
|
|
|
|
result += file->format(); |
1522
|
0
|
0
|
|
|
|
|
result += ")"; |
1523
|
0
|
0
|
|
|
|
|
result += " with quality "; |
1524
|
0
|
0
|
|
|
|
|
result += std::to_string(quality_); |
|
|
0
|
|
|
|
|
|
1525
|
0
|
|
|
|
|
|
return result; |
1526
|
|
|
|
|
|
|
} |
1527
|
0
|
|
|
|
|
|
int quality() const noexcept { return quality_; } |
1528
|
0
|
|
|
|
|
|
MultimediaPlayer* clone() const noexcept { return new MultimediaPlayer(quality_); } |
1529
|
|
|
|
|
|
|
private: |
1530
|
|
|
|
|
|
|
int quality_; |
1531
|
|
|
|
|
|
|
}; |
1532
|
|
|
|
|
|
|
namespace xs { |
1533
|
|
|
|
|
|
|
template <> |
1534
|
|
|
|
|
|
|
struct Typemap : TypemapObject { |
1535
|
0
|
0
|
|
|
|
|
static std::string package () { return "MyTest::Cookbook::WAVFile"; } |
1536
|
|
|
|
|
|
|
}; |
1537
|
|
|
|
|
|
|
|
1538
|
|
|
|
|
|
|
template <> |
1539
|
|
|
|
|
|
|
struct Typemap : TypemapObject { |
1540
|
0
|
0
|
|
|
|
|
static std::string package () { return "MyTest::Cookbook::MultimediaFile"; } |
1541
|
|
|
|
|
|
|
}; |
1542
|
|
|
|
|
|
|
|
1543
|
|
|
|
|
|
|
template <> |
1544
|
|
|
|
|
|
|
struct Typemap : TypemapObject { |
1545
|
0
|
0
|
|
|
|
|
static std::string package () { return "MyTest::Cookbook::WAVPlayer"; } |
1546
|
|
|
|
|
|
|
}; |
1547
|
|
|
|
|
|
|
|
1548
|
|
|
|
|
|
|
template <> |
1549
|
|
|
|
|
|
|
struct Typemap : TypemapObject { |
1550
|
0
|
0
|
|
|
|
|
static std::string package () { return "MyTest::Cookbook::MultimediaPlayer"; } |
1551
|
|
|
|
|
|
|
}; |
1552
|
|
|
|
|
|
|
} |
1553
|
|
|
|
|
|
|
|
1554
|
|
|
|
|
|
|
|
1555
|
0
|
|
|
|
|
|
XS_EUPXS(XS_MyTest__Cookbook__WAVFile_name) { xs::throw_guard(cv, [=]() |
1556
|
|
|
|
|
|
|
{ |
1557
|
0
|
|
|
|
|
|
dVAR; dXSARGS; |
1558
|
0
|
0
|
|
|
|
|
if (items != 1) |
1559
|
0
|
|
|
|
|
|
croak_xs_usage(cv, "THIS"); |
1560
|
|
|
|
|
|
|
PERL_UNUSED_VAR(ax); /* -Wall */ |
1561
|
0
|
|
|
|
|
|
SP -= items; |
1562
|
|
|
|
|
|
|
{ |
1563
|
0
|
0
|
|
|
|
|
WAVFile* THIS = xs::in(ST(0)); if (!SvOK(ST(0))) throw "undef not allowed as THIS"; |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
1564
|
|
|
|
|
|
|
; |
1565
|
|
|
|
|
|
|
#line 83 "t/cookbook/recipe08.xsi" |
1566
|
|
|
|
|
|
|
THIS->name(); |
1567
|
|
|
|
|
|
|
#line 1568 "t/cookbook/cookbook_xsgen.cc" |
1568
|
0
|
|
|
|
|
|
PUTBACK; |
1569
|
0
|
|
|
|
|
|
return; |
1570
|
|
|
|
|
|
|
} |
1571
|
0
|
0
|
|
|
|
|
}); } |
1572
|
|
|
|
|
|
|
|
1573
|
|
|
|
|
|
|
|
1574
|
|
|
|
|
|
|
|
1575
|
0
|
|
|
|
|
|
XS_EUPXS(XS_MyTest__Cookbook__WAVFile_new) { xs::throw_guard(cv, [=]() |
1576
|
|
|
|
|
|
|
{ |
1577
|
0
|
|
|
|
|
|
dVAR; dXSARGS; |
1578
|
0
|
0
|
|
|
|
|
if (items != 2) |
1579
|
0
|
|
|
|
|
|
croak_xs_usage(cv, "CLASS, name"); |
1580
|
|
|
|
|
|
|
{ |
1581
|
|
|
|
|
|
|
WAVFile * RETVAL; |
1582
|
0
|
|
|
|
|
|
SV* CLASS = ST(0) |
1583
|
|
|
|
|
|
|
; |
1584
|
0
|
0
|
|
|
|
|
const char* name = (const char *)SvPV_nolen(ST(1)) |
|
|
0
|
|
|
|
|
|
1585
|
|
|
|
|
|
|
; |
1586
|
|
|
|
|
|
|
#line 85 "t/cookbook/recipe08.xsi" |
1587
|
|
|
|
|
|
|
xs::Sv PROTO; PERL_UNUSED_VAR(PROTO); |
1588
|
|
|
|
|
|
|
PROTO = CLASS; |
1589
|
|
|
|
|
|
|
RETVAL = new WAVFile(name); |
1590
|
|
|
|
|
|
|
#line 1591 "t/cookbook/cookbook_xsgen.cc" |
1591
|
|
|
|
|
|
|
{ |
1592
|
|
|
|
|
|
|
SV * RETVALSV; |
1593
|
0
|
0
|
|
|
|
|
RETVALSV = xs::out(RETVAL, PROTO).detach(); |
1594
|
0
|
0
|
|
|
|
|
RETVALSV = sv_2mortal(RETVALSV); |
1595
|
0
|
|
|
|
|
|
ST(0) = RETVALSV; |
1596
|
|
|
|
|
|
|
} |
1597
|
|
|
|
|
|
|
} |
1598
|
0
|
|
|
|
|
|
XSRETURN(1); |
1599
|
0
|
0
|
|
|
|
|
}); } |
1600
|
|
|
|
|
|
|
|
1601
|
|
|
|
|
|
|
|
1602
|
|
|
|
|
|
|
|
1603
|
0
|
|
|
|
|
|
XS_EUPXS(XS_MyTest__Cookbook__MultimediaFile_name) { xs::throw_guard(cv, [=]() |
1604
|
|
|
|
|
|
|
{ |
1605
|
0
|
|
|
|
|
|
dVAR; dXSARGS; |
1606
|
0
|
0
|
|
|
|
|
if (items != 1) |
1607
|
0
|
|
|
|
|
|
croak_xs_usage(cv, "THIS"); |
1608
|
|
|
|
|
|
|
PERL_UNUSED_VAR(ax); /* -Wall */ |
1609
|
0
|
|
|
|
|
|
SP -= items; |
1610
|
|
|
|
|
|
|
{ |
1611
|
0
|
0
|
|
|
|
|
MultimediaFile* THIS = xs::in(ST(0)); if (!SvOK(ST(0))) throw "undef not allowed as THIS"; |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
1612
|
|
|
|
|
|
|
; |
1613
|
|
|
|
|
|
|
#line 90 "t/cookbook/recipe08.xsi" |
1614
|
|
|
|
|
|
|
THIS->name(); |
1615
|
|
|
|
|
|
|
#line 1616 "t/cookbook/cookbook_xsgen.cc" |
1616
|
0
|
|
|
|
|
|
PUTBACK; |
1617
|
0
|
|
|
|
|
|
return; |
1618
|
|
|
|
|
|
|
} |
1619
|
0
|
0
|
|
|
|
|
}); } |
1620
|
|
|
|
|
|
|
|
1621
|
|
|
|
|
|
|
|
1622
|
|
|
|
|
|
|
|
1623
|
0
|
|
|
|
|
|
XS_EUPXS(XS_MyTest__Cookbook__MultimediaFile_format) { xs::throw_guard(cv, [=]() |
1624
|
|
|
|
|
|
|
{ |
1625
|
0
|
|
|
|
|
|
dVAR; dXSARGS; |
1626
|
0
|
0
|
|
|
|
|
if (items != 1) |
1627
|
0
|
|
|
|
|
|
croak_xs_usage(cv, "THIS"); |
1628
|
|
|
|
|
|
|
PERL_UNUSED_VAR(ax); /* -Wall */ |
1629
|
0
|
|
|
|
|
|
SP -= items; |
1630
|
|
|
|
|
|
|
{ |
1631
|
0
|
0
|
|
|
|
|
MultimediaFile* THIS = xs::in(ST(0)); if (!SvOK(ST(0))) throw "undef not allowed as THIS"; |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
1632
|
|
|
|
|
|
|
; |
1633
|
|
|
|
|
|
|
#line 92 "t/cookbook/recipe08.xsi" |
1634
|
|
|
|
|
|
|
THIS->format(); |
1635
|
|
|
|
|
|
|
#line 1636 "t/cookbook/cookbook_xsgen.cc" |
1636
|
0
|
|
|
|
|
|
PUTBACK; |
1637
|
0
|
|
|
|
|
|
return; |
1638
|
|
|
|
|
|
|
} |
1639
|
0
|
0
|
|
|
|
|
}); } |
1640
|
|
|
|
|
|
|
|
1641
|
|
|
|
|
|
|
|
1642
|
|
|
|
|
|
|
|
1643
|
0
|
|
|
|
|
|
XS_EUPXS(XS_MyTest__Cookbook__MultimediaFile_new) { xs::throw_guard(cv, [=]() |
1644
|
|
|
|
|
|
|
{ |
1645
|
0
|
|
|
|
|
|
dVAR; dXSARGS; |
1646
|
0
|
0
|
|
|
|
|
if (items != 3) |
1647
|
0
|
|
|
|
|
|
croak_xs_usage(cv, "CLASS, name, format"); |
1648
|
|
|
|
|
|
|
{ |
1649
|
|
|
|
|
|
|
MultimediaFile * RETVAL; |
1650
|
0
|
|
|
|
|
|
SV* CLASS = ST(0) |
1651
|
|
|
|
|
|
|
; |
1652
|
0
|
0
|
|
|
|
|
const char* name = (const char *)SvPV_nolen(ST(1)) |
|
|
0
|
|
|
|
|
|
1653
|
|
|
|
|
|
|
; |
1654
|
0
|
0
|
|
|
|
|
const char* format = (const char *)SvPV_nolen(ST(2)) |
|
|
0
|
|
|
|
|
|
1655
|
|
|
|
|
|
|
; |
1656
|
|
|
|
|
|
|
#line 94 "t/cookbook/recipe08.xsi" |
1657
|
|
|
|
|
|
|
xs::Sv PROTO; PERL_UNUSED_VAR(PROTO); |
1658
|
|
|
|
|
|
|
PROTO = CLASS; |
1659
|
|
|
|
|
|
|
RETVAL = new MultimediaFile(name, format); |
1660
|
|
|
|
|
|
|
#line 1661 "t/cookbook/cookbook_xsgen.cc" |
1661
|
|
|
|
|
|
|
{ |
1662
|
|
|
|
|
|
|
SV * RETVALSV; |
1663
|
0
|
0
|
|
|
|
|
RETVALSV = xs::out(RETVAL, PROTO).detach(); |
1664
|
0
|
0
|
|
|
|
|
RETVALSV = sv_2mortal(RETVALSV); |
1665
|
0
|
|
|
|
|
|
ST(0) = RETVALSV; |
1666
|
|
|
|
|
|
|
} |
1667
|
|
|
|
|
|
|
} |
1668
|
0
|
|
|
|
|
|
XSRETURN(1); |
1669
|
0
|
0
|
|
|
|
|
}); } |
1670
|
|
|
|
|
|
|
|
1671
|
|
|
|
|
|
|
|
1672
|
|
|
|
|
|
|
|
1673
|
0
|
|
|
|
|
|
XS_EUPXS(XS_MyTest__Cookbook__WAVPlayer_play_wav) { xs::throw_guard(cv, [=]() |
1674
|
|
|
|
|
|
|
{ |
1675
|
0
|
|
|
|
|
|
dVAR; dXSARGS; |
1676
|
0
|
0
|
|
|
|
|
if (items != 2) |
1677
|
0
|
|
|
|
|
|
croak_xs_usage(cv, "THIS, file"); |
1678
|
|
|
|
|
|
|
{ |
1679
|
0
|
|
|
|
|
|
std::string RETVAL; |
1680
|
0
|
0
|
|
|
|
|
dXSTARG; |
|
|
0
|
|
|
|
|
|
1681
|
0
|
0
|
|
|
|
|
WAVPlayer* THIS = xs::in(ST(0)); if (!SvOK(ST(0))) throw "undef not allowed as THIS"; |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
1682
|
|
|
|
|
|
|
; |
1683
|
0
|
0
|
|
|
|
|
WAVFile* file = xs::in(ST(1)); |
1684
|
|
|
|
|
|
|
; |
1685
|
|
|
|
|
|
|
#line 99 "t/cookbook/recipe08.xsi" |
1686
|
|
|
|
|
|
|
RETVAL = THIS->play_wav(file); |
1687
|
|
|
|
|
|
|
#line 1688 "t/cookbook/cookbook_xsgen.cc" |
1688
|
0
|
0
|
|
|
|
|
XSprePUSH; PUSHp(RETVAL.data(), RETVAL.length()); |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
1689
|
|
|
|
|
|
|
} |
1690
|
0
|
|
|
|
|
|
XSRETURN(1); |
1691
|
0
|
0
|
|
|
|
|
}); } |
1692
|
|
|
|
|
|
|
|
1693
|
|
|
|
|
|
|
|
1694
|
|
|
|
|
|
|
|
1695
|
0
|
|
|
|
|
|
XS_EUPXS(XS_MyTest__Cookbook__WAVPlayer_preferred_bitrate) { xs::throw_guard(cv, [=]() |
1696
|
|
|
|
|
|
|
{ |
1697
|
0
|
|
|
|
|
|
dVAR; dXSARGS; |
1698
|
0
|
0
|
|
|
|
|
if (items != 1) |
1699
|
0
|
|
|
|
|
|
croak_xs_usage(cv, "THIS"); |
1700
|
|
|
|
|
|
|
{ |
1701
|
|
|
|
|
|
|
double RETVAL; |
1702
|
0
|
0
|
|
|
|
|
dXSTARG; |
|
|
0
|
|
|
|
|
|
1703
|
0
|
0
|
|
|
|
|
WAVPlayer* THIS = xs::in(ST(0)); if (!SvOK(ST(0))) throw "undef not allowed as THIS"; |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
1704
|
|
|
|
|
|
|
; |
1705
|
|
|
|
|
|
|
#line 101 "t/cookbook/recipe08.xsi" |
1706
|
|
|
|
|
|
|
RETVAL = THIS->preferred_bitrate(); |
1707
|
|
|
|
|
|
|
#line 1708 "t/cookbook/cookbook_xsgen.cc" |
1708
|
0
|
0
|
|
|
|
|
XSprePUSH; PUSHn((double)RETVAL); |
|
|
0
|
|
|
|
|
|
1709
|
|
|
|
|
|
|
} |
1710
|
0
|
|
|
|
|
|
XSRETURN(1); |
1711
|
0
|
0
|
|
|
|
|
}); } |
1712
|
|
|
|
|
|
|
|
1713
|
|
|
|
|
|
|
|
1714
|
|
|
|
|
|
|
|
1715
|
0
|
|
|
|
|
|
XS_EUPXS(XS_MyTest__Cookbook__WAVPlayer_clone) { xs::throw_guard(cv, [=]() |
1716
|
|
|
|
|
|
|
{ |
1717
|
0
|
|
|
|
|
|
dVAR; dXSARGS; |
1718
|
0
|
0
|
|
|
|
|
if (items != 1) |
1719
|
0
|
|
|
|
|
|
croak_xs_usage(cv, "THIS"); |
1720
|
|
|
|
|
|
|
{ |
1721
|
|
|
|
|
|
|
WAVPlayer * RETVAL; |
1722
|
0
|
0
|
|
|
|
|
WAVPlayer* THIS = xs::in(ST(0)); if (!SvOK(ST(0))) throw "undef not allowed as THIS"; |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
1723
|
|
|
|
|
|
|
; |
1724
|
|
|
|
|
|
|
#line 104 "t/cookbook/recipe08.xsi" |
1725
|
|
|
|
|
|
|
xs::Sv PROTO; PERL_UNUSED_VAR(PROTO); |
1726
|
|
|
|
|
|
|
Object self{ST(0)}; |
1727
|
|
|
|
|
|
|
PROTO = self.stash(); |
1728
|
|
|
|
|
|
|
RETVAL = THIS->clone(); |
1729
|
|
|
|
|
|
|
#line 1730 "t/cookbook/cookbook_xsgen.cc" |
1730
|
|
|
|
|
|
|
{ |
1731
|
|
|
|
|
|
|
SV * RETVALSV; |
1732
|
0
|
0
|
|
|
|
|
RETVALSV = xs::out(RETVAL, PROTO).detach(); |
1733
|
0
|
0
|
|
|
|
|
RETVALSV = sv_2mortal(RETVALSV); |
1734
|
0
|
|
|
|
|
|
ST(0) = RETVALSV; |
1735
|
|
|
|
|
|
|
} |
1736
|
|
|
|
|
|
|
} |
1737
|
0
|
|
|
|
|
|
XSRETURN(1); |
1738
|
0
|
0
|
|
|
|
|
}); } |
1739
|
|
|
|
|
|
|
|
1740
|
|
|
|
|
|
|
|
1741
|
|
|
|
|
|
|
|
1742
|
0
|
|
|
|
|
|
XS_EUPXS(XS_MyTest__Cookbook__WAVPlayer_new) { xs::throw_guard(cv, [=]() |
1743
|
|
|
|
|
|
|
{ |
1744
|
0
|
|
|
|
|
|
dVAR; dXSARGS; |
1745
|
0
|
0
|
|
|
|
|
if (items != 2) |
1746
|
0
|
|
|
|
|
|
croak_xs_usage(cv, "CLASS, preferred_bitrate"); |
1747
|
|
|
|
|
|
|
{ |
1748
|
|
|
|
|
|
|
WAVPlayer * RETVAL; |
1749
|
0
|
|
|
|
|
|
SV* CLASS = ST(0) |
1750
|
|
|
|
|
|
|
; |
1751
|
0
|
0
|
|
|
|
|
double preferred_bitrate = (double)SvNV(ST(1)) |
|
|
0
|
|
|
|
|
|
1752
|
|
|
|
|
|
|
; |
1753
|
|
|
|
|
|
|
#line 109 "t/cookbook/recipe08.xsi" |
1754
|
|
|
|
|
|
|
xs::Sv PROTO; PERL_UNUSED_VAR(PROTO); |
1755
|
|
|
|
|
|
|
PROTO = CLASS; |
1756
|
|
|
|
|
|
|
RETVAL = new WAVPlayer(preferred_bitrate); |
1757
|
|
|
|
|
|
|
#line 1758 "t/cookbook/cookbook_xsgen.cc" |
1758
|
|
|
|
|
|
|
{ |
1759
|
|
|
|
|
|
|
SV * RETVALSV; |
1760
|
0
|
0
|
|
|
|
|
RETVALSV = xs::out(RETVAL, PROTO).detach(); |
1761
|
0
|
0
|
|
|
|
|
RETVALSV = sv_2mortal(RETVALSV); |
1762
|
0
|
|
|
|
|
|
ST(0) = RETVALSV; |
1763
|
|
|
|
|
|
|
} |
1764
|
|
|
|
|
|
|
} |
1765
|
0
|
|
|
|
|
|
XSRETURN(1); |
1766
|
0
|
0
|
|
|
|
|
}); } |
1767
|
|
|
|
|
|
|
|
1768
|
|
|
|
|
|
|
|
1769
|
|
|
|
|
|
|
|
1770
|
0
|
|
|
|
|
|
XS_EUPXS(XS_MyTest__Cookbook__MultimediaPlayer_new) { xs::throw_guard(cv, [=]() |
1771
|
|
|
|
|
|
|
{ |
1772
|
0
|
|
|
|
|
|
dVAR; dXSARGS; |
1773
|
0
|
0
|
|
|
|
|
if (items != 3) |
1774
|
0
|
|
|
|
|
|
croak_xs_usage(cv, "CLASS, preferred_bitrate, quality"); |
1775
|
|
|
|
|
|
|
{ |
1776
|
|
|
|
|
|
|
MultimediaPlayer * RETVAL; |
1777
|
0
|
|
|
|
|
|
SV* CLASS = ST(0) |
1778
|
|
|
|
|
|
|
; |
1779
|
0
|
0
|
|
|
|
|
double preferred_bitrate = (double)SvNV(ST(1)) |
|
|
0
|
|
|
|
|
|
1780
|
|
|
|
|
|
|
; |
1781
|
0
|
0
|
|
|
|
|
int quality = (int)SvIV(ST(2)) |
|
|
0
|
|
|
|
|
|
1782
|
|
|
|
|
|
|
; |
1783
|
|
|
|
|
|
|
#line 115 "t/cookbook/recipe08.xsi" |
1784
|
|
|
|
|
|
|
xs::Sv PROTO; PERL_UNUSED_VAR(PROTO); |
1785
|
|
|
|
|
|
|
PROTO = CLASS; |
1786
|
|
|
|
|
|
|
(void)preferred_bitrate; // silence warning |
1787
|
|
|
|
|
|
|
PROTO = Stash::from_name(CLASS).call_next(cv, &ST(1), 1); |
1788
|
|
|
|
|
|
|
if (!PROTO.defined()) XSRETURN_UNDEF; |
1789
|
|
|
|
|
|
|
RETVAL = new MultimediaPlayer(quality); |
1790
|
|
|
|
|
|
|
#line 1791 "t/cookbook/cookbook_xsgen.cc" |
1791
|
|
|
|
|
|
|
{ |
1792
|
|
|
|
|
|
|
SV * RETVALSV; |
1793
|
0
|
0
|
|
|
|
|
RETVALSV = xs::out(RETVAL, PROTO).detach(); |
1794
|
0
|
0
|
|
|
|
|
RETVALSV = sv_2mortal(RETVALSV); |
1795
|
0
|
0
|
|
|
|
|
ST(0) = RETVALSV; |
1796
|
|
|
|
|
|
|
} |
1797
|
|
|
|
|
|
|
} |
1798
|
0
|
|
|
|
|
|
XSRETURN(1); |
1799
|
0
|
0
|
|
|
|
|
}); } |
1800
|
|
|
|
|
|
|
|
1801
|
|
|
|
|
|
|
|
1802
|
|
|
|
|
|
|
|
1803
|
0
|
|
|
|
|
|
XS_EUPXS(XS_MyTest__Cookbook__MultimediaPlayer_play_file) { xs::throw_guard(cv, [=]() |
1804
|
|
|
|
|
|
|
{ |
1805
|
0
|
|
|
|
|
|
dVAR; dXSARGS; |
1806
|
0
|
0
|
|
|
|
|
if (items != 2) |
1807
|
0
|
|
|
|
|
|
croak_xs_usage(cv, "THIS, file"); |
1808
|
|
|
|
|
|
|
{ |
1809
|
0
|
|
|
|
|
|
std::string RETVAL; |
1810
|
0
|
0
|
|
|
|
|
dXSTARG; |
|
|
0
|
|
|
|
|
|
1811
|
0
|
0
|
|
|
|
|
MultimediaPlayer* THIS = xs::in(ST(0)); if (!SvOK(ST(0))) throw "undef not allowed as THIS"; |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
1812
|
|
|
|
|
|
|
; |
1813
|
0
|
0
|
|
|
|
|
MultimediaFile* file = xs::in(ST(1)); |
1814
|
|
|
|
|
|
|
; |
1815
|
|
|
|
|
|
|
#line 121 "t/cookbook/recipe08.xsi" |
1816
|
|
|
|
|
|
|
RETVAL = THIS->play_file(file); |
1817
|
|
|
|
|
|
|
#line 1818 "t/cookbook/cookbook_xsgen.cc" |
1818
|
0
|
0
|
|
|
|
|
XSprePUSH; PUSHp(RETVAL.data(), RETVAL.length()); |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
1819
|
|
|
|
|
|
|
} |
1820
|
0
|
|
|
|
|
|
XSRETURN(1); |
1821
|
0
|
0
|
|
|
|
|
}); } |
1822
|
|
|
|
|
|
|
|
1823
|
|
|
|
|
|
|
|
1824
|
|
|
|
|
|
|
|
1825
|
0
|
|
|
|
|
|
XS_EUPXS(XS_MyTest__Cookbook__MultimediaPlayer_quality) { xs::throw_guard(cv, [=]() |
1826
|
|
|
|
|
|
|
{ |
1827
|
0
|
|
|
|
|
|
dVAR; dXSARGS; |
1828
|
0
|
0
|
|
|
|
|
if (items != 1) |
1829
|
0
|
|
|
|
|
|
croak_xs_usage(cv, "THIS"); |
1830
|
|
|
|
|
|
|
{ |
1831
|
|
|
|
|
|
|
int RETVAL; |
1832
|
0
|
0
|
|
|
|
|
dXSTARG; |
|
|
0
|
|
|
|
|
|
1833
|
0
|
0
|
|
|
|
|
MultimediaPlayer* THIS = xs::in(ST(0)); if (!SvOK(ST(0))) throw "undef not allowed as THIS"; |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
1834
|
|
|
|
|
|
|
; |
1835
|
|
|
|
|
|
|
#line 123 "t/cookbook/recipe08.xsi" |
1836
|
|
|
|
|
|
|
RETVAL = THIS->quality(); |
1837
|
|
|
|
|
|
|
#line 1838 "t/cookbook/cookbook_xsgen.cc" |
1838
|
0
|
0
|
|
|
|
|
XSprePUSH; PUSHi((IV)RETVAL); |
|
|
0
|
|
|
|
|
|
1839
|
|
|
|
|
|
|
} |
1840
|
0
|
|
|
|
|
|
XSRETURN(1); |
1841
|
0
|
0
|
|
|
|
|
}); } |
1842
|
|
|
|
|
|
|
|
1843
|
|
|
|
|
|
|
|
1844
|
|
|
|
|
|
|
|
1845
|
0
|
|
|
|
|
|
XS_EUPXS(XS_MyTest__Cookbook__MultimediaPlayer_clone) { xs::throw_guard(cv, [=]() |
1846
|
|
|
|
|
|
|
{ |
1847
|
0
|
|
|
|
|
|
dVAR; dXSARGS; |
1848
|
0
|
0
|
|
|
|
|
if (items != 1) |
1849
|
0
|
|
|
|
|
|
croak_xs_usage(cv, "THIS"); |
1850
|
|
|
|
|
|
|
{ |
1851
|
|
|
|
|
|
|
MultimediaPlayer * RETVAL; |
1852
|
0
|
0
|
|
|
|
|
MultimediaPlayer* THIS = xs::in(ST(0)); if (!SvOK(ST(0))) throw "undef not allowed as THIS"; |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
1853
|
|
|
|
|
|
|
; |
1854
|
|
|
|
|
|
|
#line 126 "t/cookbook/recipe08.xsi" |
1855
|
|
|
|
|
|
|
xs::Sv PROTO; PERL_UNUSED_VAR(PROTO); |
1856
|
|
|
|
|
|
|
Object self{ST(0)}; |
1857
|
|
|
|
|
|
|
PROTO = self.call_next(cv); |
1858
|
|
|
|
|
|
|
RETVAL = THIS->clone(); |
1859
|
|
|
|
|
|
|
#line 1860 "t/cookbook/cookbook_xsgen.cc" |
1860
|
|
|
|
|
|
|
{ |
1861
|
|
|
|
|
|
|
SV * RETVALSV; |
1862
|
0
|
0
|
|
|
|
|
RETVALSV = xs::out(RETVAL, PROTO).detach(); |
1863
|
0
|
0
|
|
|
|
|
RETVALSV = sv_2mortal(RETVALSV); |
1864
|
0
|
|
|
|
|
|
ST(0) = RETVALSV; |
1865
|
|
|
|
|
|
|
} |
1866
|
|
|
|
|
|
|
} |
1867
|
0
|
|
|
|
|
|
XSRETURN(1); |
1868
|
0
|
0
|
|
|
|
|
}); } |
1869
|
|
|
|
|
|
|
|
1870
|
|
|
|
|
|
|
|
1871
|
|
|
|
|
|
|
/* INCLUDE: Returning to 'cookbook.xs' from 'recipe08.xsi' */ |
1872
|
|
|
|
|
|
|
|
1873
|
|
|
|
|
|
|
|
1874
|
|
|
|
|
|
|
/* INCLUDE: Including 'recipe09.xsi' from 'cookbook.xs' */ |
1875
|
|
|
|
|
|
|
|
1876
|
|
|
|
|
|
|
#include |
1877
|
|
|
|
|
|
|
struct Point { |
1878
|
|
|
|
|
|
|
double x; |
1879
|
|
|
|
|
|
|
double y; |
1880
|
|
|
|
|
|
|
}; |
1881
|
0
|
|
|
|
|
|
struct ShapeA { |
1882
|
0
|
|
|
|
|
|
size_t point_count() const { return points.size(); } |
1883
|
0
|
|
|
|
|
|
Point& get_point(size_t idx) { return points.at(idx); } |
1884
|
0
|
|
|
|
|
|
void add_point(const Point& pt) { points.push_back(pt); } |
1885
|
|
|
|
|
|
|
private: |
1886
|
|
|
|
|
|
|
std::vector points; |
1887
|
|
|
|
|
|
|
}; |
1888
|
0
|
|
|
|
|
|
struct XSShapeA : public ShapeA { |
1889
|
0
|
|
|
|
|
|
void add_label(SV* maybe_label = nullptr) { |
1890
|
0
|
0
|
|
|
|
|
Sv label = maybe_label ? Sv{maybe_label} : Sv::undef; |
|
|
0
|
|
|
|
|
|
1891
|
0
|
0
|
|
|
|
|
labels.push_back(Ref::create(maybe_label)); |
|
|
0
|
|
|
|
|
|
1892
|
0
|
|
|
|
|
|
} |
1893
|
0
|
|
|
|
|
|
Ref& get_ref(size_t idx) { return labels.at(idx); } |
1894
|
|
|
|
|
|
|
private: |
1895
|
|
|
|
|
|
|
std::vector[ labels; ] |
1896
|
|
|
|
|
|
|
}; |
1897
|
|
|
|
|
|
|
namespace xs { |
1898
|
|
|
|
|
|
|
template <> |
1899
|
|
|
|
|
|
|
struct Typemap : TypemapObject { |
1900
|
0
|
0
|
|
|
|
|
static std::string package () { return "MyTest::Cookbook::Point"; } |
1901
|
|
|
|
|
|
|
}; |
1902
|
|
|
|
|
|
|
|
1903
|
|
|
|
|
|
|
template |
1904
|
|
|
|
|
|
|
struct Typemap : TypemapObject { |
1905
|
0
|
0
|
|
|
|
|
static std::string package () { return "MyTest::Cookbook::ShapeA"; } |
1906
|
|
|
|
|
|
|
}; |
1907
|
|
|
|
|
|
|
|
1908
|
|
|
|
|
|
|
template <> |
1909
|
|
|
|
|
|
|
struct Typemap : Typemap { |
1910
|
0
|
0
|
|
|
|
|
static std::string package () { return "MyTest::Cookbook::ShapeB"; } |
1911
|
|
|
|
|
|
|
}; |
1912
|
|
|
|
|
|
|
} |
1913
|
|
|
|
|
|
|
static xs::Sv::payload_marker_t payload_marker_09; |
1914
|
|
|
|
|
|
|
|
1915
|
|
|
|
|
|
|
|
1916
|
0
|
|
|
|
|
|
XS_EUPXS(XS_MyTest__Cookbook__Point_x) { xs::throw_guard(cv, [=]() |
1917
|
|
|
|
|
|
|
{ |
1918
|
0
|
|
|
|
|
|
dVAR; dXSARGS; |
1919
|
0
|
|
|
|
|
|
dXSI32; |
1920
|
0
|
0
|
|
|
|
|
if (items < 1 || items > 2) |
|
|
0
|
|
|
|
|
|
1921
|
0
|
|
|
|
|
|
croak_xs_usage(cv, "THIS, new_val= nullptr"); |
1922
|
|
|
|
|
|
|
{ |
1923
|
|
|
|
|
|
|
double RETVAL; |
1924
|
0
|
0
|
|
|
|
|
dXSTARG; |
|
|
0
|
|
|
|
|
|
1925
|
0
|
0
|
|
|
|
|
Point* THIS = xs::in(ST(0)); if (!SvOK(ST(0))) throw "undef not allowed as THIS"; |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
1926
|
|
|
|
|
|
|
; |
1927
|
|
|
|
|
|
|
SV* new_val; |
1928
|
|
|
|
|
|
|
|
1929
|
0
|
0
|
|
|
|
|
if (items < 2) |
1930
|
0
|
|
|
|
|
|
new_val = nullptr; |
1931
|
|
|
|
|
|
|
else { |
1932
|
0
|
|
|
|
|
|
new_val = ST(1) |
1933
|
0
|
|
|
|
|
|
; |
1934
|
|
|
|
|
|
|
} |
1935
|
|
|
|
|
|
|
#line 53 "t/cookbook/recipe09.xsi" |
1936
|
|
|
|
|
|
|
double* val = nullptr; |
1937
|
|
|
|
|
|
|
switch(ix) { |
1938
|
|
|
|
|
|
|
case 1: val = &THIS->y; break; |
1939
|
|
|
|
|
|
|
default: val = &THIS->x; break; |
1940
|
|
|
|
|
|
|
} |
1941
|
|
|
|
|
|
|
if (new_val) { |
1942
|
|
|
|
|
|
|
*val = SvNV(new_val); |
1943
|
|
|
|
|
|
|
} |
1944
|
|
|
|
|
|
|
RETVAL = *val; |
1945
|
|
|
|
|
|
|
#line 1946 "t/cookbook/cookbook_xsgen.cc" |
1946
|
0
|
0
|
|
|
|
|
XSprePUSH; PUSHn((double)RETVAL); |
|
|
0
|
|
|
|
|
|
1947
|
|
|
|
|
|
|
} |
1948
|
0
|
|
|
|
|
|
XSRETURN(1); |
1949
|
0
|
0
|
|
|
|
|
}); } |
1950
|
|
|
|
|
|
|
|
1951
|
|
|
|
|
|
|
|
1952
|
|
|
|
|
|
|
|
1953
|
0
|
|
|
|
|
|
XS_EUPXS(XS_MyTest__Cookbook__Point_new) { xs::throw_guard(cv, [=]() |
1954
|
|
|
|
|
|
|
{ |
1955
|
0
|
|
|
|
|
|
dVAR; dXSARGS; |
1956
|
0
|
0
|
|
|
|
|
if (items < 1 || items > 3) |
|
|
0
|
|
|
|
|
|
1957
|
0
|
|
|
|
|
|
croak_xs_usage(cv, "CLASS, x= 0, y= 0"); |
1958
|
|
|
|
|
|
|
{ |
1959
|
|
|
|
|
|
|
Point * RETVAL; |
1960
|
0
|
|
|
|
|
|
SV* CLASS = ST(0) |
1961
|
|
|
|
|
|
|
; |
1962
|
|
|
|
|
|
|
double x; |
1963
|
|
|
|
|
|
|
double y; |
1964
|
|
|
|
|
|
|
|
1965
|
0
|
0
|
|
|
|
|
if (items < 2) |
1966
|
0
|
|
|
|
|
|
x = 0; |
1967
|
|
|
|
|
|
|
else { |
1968
|
0
|
|
|
|
|
|
x = (double)SvNV(ST(1)) |
1969
|
0
|
0
|
|
|
|
|
; |
|
|
0
|
|
|
|
|
|
1970
|
|
|
|
|
|
|
} |
1971
|
|
|
|
|
|
|
|
1972
|
0
|
0
|
|
|
|
|
if (items < 3) |
1973
|
0
|
|
|
|
|
|
y = 0; |
1974
|
|
|
|
|
|
|
else { |
1975
|
0
|
|
|
|
|
|
y = (double)SvNV(ST(2)) |
1976
|
0
|
0
|
|
|
|
|
; |
|
|
0
|
|
|
|
|
|
1977
|
|
|
|
|
|
|
} |
1978
|
|
|
|
|
|
|
#line 65 "t/cookbook/recipe09.xsi" |
1979
|
|
|
|
|
|
|
xs::Sv PROTO; PERL_UNUSED_VAR(PROTO); |
1980
|
|
|
|
|
|
|
PROTO = CLASS; |
1981
|
|
|
|
|
|
|
RETVAL = new Point{x, y}; |
1982
|
|
|
|
|
|
|
#line 1983 "t/cookbook/cookbook_xsgen.cc" |
1983
|
|
|
|
|
|
|
{ |
1984
|
|
|
|
|
|
|
SV * RETVALSV; |
1985
|
0
|
0
|
|
|
|
|
RETVALSV = xs::out(RETVAL, PROTO).detach(); |
1986
|
0
|
0
|
|
|
|
|
RETVALSV = sv_2mortal(RETVALSV); |
1987
|
0
|
|
|
|
|
|
ST(0) = RETVALSV; |
1988
|
|
|
|
|
|
|
} |
1989
|
|
|
|
|
|
|
} |
1990
|
0
|
|
|
|
|
|
XSRETURN(1); |
1991
|
0
|
0
|
|
|
|
|
}); } |
1992
|
|
|
|
|
|
|
|
1993
|
|
|
|
|
|
|
|
1994
|
|
|
|
|
|
|
|
1995
|
0
|
|
|
|
|
|
XS_EUPXS(XS_MyTest__Cookbook__ShapeA_point_count) { xs::throw_guard(cv, [=]() |
1996
|
|
|
|
|
|
|
{ |
1997
|
0
|
|
|
|
|
|
dVAR; dXSARGS; |
1998
|
0
|
0
|
|
|
|
|
if (items != 1) |
1999
|
0
|
|
|
|
|
|
croak_xs_usage(cv, "THIS"); |
2000
|
|
|
|
|
|
|
{ |
2001
|
|
|
|
|
|
|
size_t RETVAL; |
2002
|
0
|
0
|
|
|
|
|
dXSTARG; |
|
|
0
|
|
|
|
|
|
2003
|
0
|
0
|
|
|
|
|
ShapeA* THIS = xs::in(ST(0)); if (!SvOK(ST(0))) throw "undef not allowed as THIS"; |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
2004
|
|
|
|
|
|
|
; |
2005
|
|
|
|
|
|
|
#line 71 "t/cookbook/recipe09.xsi" |
2006
|
|
|
|
|
|
|
RETVAL = THIS->point_count(); |
2007
|
|
|
|
|
|
|
#line 2008 "t/cookbook/cookbook_xsgen.cc" |
2008
|
0
|
0
|
|
|
|
|
XSprePUSH; PUSHu((UV)RETVAL); |
|
|
0
|
|
|
|
|
|
2009
|
|
|
|
|
|
|
} |
2010
|
0
|
|
|
|
|
|
XSRETURN(1); |
2011
|
0
|
0
|
|
|
|
|
}); } |
2012
|
|
|
|
|
|
|
|
2013
|
|
|
|
|
|
|
|
2014
|
|
|
|
|
|
|
|
2015
|
0
|
|
|
|
|
|
XS_EUPXS(XS_MyTest__Cookbook__ShapeA_get_point) { xs::throw_guard(cv, [=]() |
2016
|
|
|
|
|
|
|
{ |
2017
|
0
|
|
|
|
|
|
dVAR; dXSARGS; |
2018
|
0
|
0
|
|
|
|
|
if (items != 2) |
2019
|
0
|
|
|
|
|
|
croak_xs_usage(cv, "THIS, idx"); |
2020
|
|
|
|
|
|
|
PERL_UNUSED_VAR(ax); /* -Wall */ |
2021
|
0
|
|
|
|
|
|
SP -= items; |
2022
|
|
|
|
|
|
|
{ |
2023
|
0
|
0
|
|
|
|
|
ShapeA* THIS = xs::in(ST(0)); if (!SvOK(ST(0))) throw "undef not allowed as THIS"; |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
2024
|
|
|
|
|
|
|
; |
2025
|
0
|
0
|
|
|
|
|
size_t idx = (size_t)SvUV(ST(1)) |
|
|
0
|
|
|
|
|
|
2026
|
|
|
|
|
|
|
; |
2027
|
|
|
|
|
|
|
#line 74 "t/cookbook/recipe09.xsi" |
2028
|
|
|
|
|
|
|
Object self{ST(0)}; |
2029
|
|
|
|
|
|
|
Array payload(self.payload(&payload_marker_09).obj); |
2030
|
|
|
|
|
|
|
|
2031
|
|
|
|
|
|
|
auto& pt = THIS->get_point(idx); |
2032
|
|
|
|
|
|
|
auto pt_copy = new Point{pt.x, pt.y}; |
2033
|
|
|
|
|
|
|
auto wrapped_pt = xs::out<>(pt_copy); |
2034
|
|
|
|
|
|
|
mXPUSHs(wrapped_pt.detach()); |
2035
|
|
|
|
|
|
|
|
2036
|
|
|
|
|
|
|
if (GIMME_V == G_ARRAY) { |
2037
|
|
|
|
|
|
|
auto ref = payload.at(idx); |
2038
|
|
|
|
|
|
|
Sv value = SvRV(ref); |
2039
|
|
|
|
|
|
|
mXPUSHs(value.detach()); |
2040
|
|
|
|
|
|
|
} |
2041
|
|
|
|
|
|
|
#line 2042 "t/cookbook/cookbook_xsgen.cc" |
2042
|
0
|
|
|
|
|
|
PUTBACK; |
2043
|
0
|
|
|
|
|
|
return; |
2044
|
|
|
|
|
|
|
} |
2045
|
0
|
0
|
|
|
|
|
}); } |
2046
|
|
|
|
|
|
|
|
2047
|
|
|
|
|
|
|
|
2048
|
|
|
|
|
|
|
|
2049
|
0
|
|
|
|
|
|
XS_EUPXS(XS_MyTest__Cookbook__ShapeA_add_point) { xs::throw_guard(cv, [=]() |
2050
|
|
|
|
|
|
|
{ |
2051
|
0
|
|
|
|
|
|
dVAR; dXSARGS; |
2052
|
0
|
0
|
|
|
|
|
if (items < 2 || items > 3) |
|
|
0
|
|
|
|
|
|
2053
|
0
|
|
|
|
|
|
croak_xs_usage(cv, "THIS, pt, maybe_label= nullptr"); |
2054
|
|
|
|
|
|
|
PERL_UNUSED_VAR(ax); /* -Wall */ |
2055
|
0
|
|
|
|
|
|
SP -= items; |
2056
|
|
|
|
|
|
|
{ |
2057
|
0
|
0
|
|
|
|
|
ShapeA* THIS = xs::in(ST(0)); if (!SvOK(ST(0))) throw "undef not allowed as THIS"; |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
2058
|
|
|
|
|
|
|
; |
2059
|
0
|
0
|
|
|
|
|
Point* pt = xs::in(ST(1)); |
2060
|
|
|
|
|
|
|
; |
2061
|
|
|
|
|
|
|
SV* maybe_label; |
2062
|
|
|
|
|
|
|
|
2063
|
0
|
0
|
|
|
|
|
if (items < 3) |
2064
|
0
|
|
|
|
|
|
maybe_label = nullptr; |
2065
|
|
|
|
|
|
|
else { |
2066
|
0
|
|
|
|
|
|
maybe_label = ST(2) |
2067
|
0
|
|
|
|
|
|
; |
2068
|
|
|
|
|
|
|
} |
2069
|
|
|
|
|
|
|
#line 90 "t/cookbook/recipe09.xsi" |
2070
|
|
|
|
|
|
|
THIS->add_point(*pt); |
2071
|
|
|
|
|
|
|
Object self{ST(0)}; |
2072
|
|
|
|
|
|
|
Array payload(self.payload(&payload_marker_09).obj); |
2073
|
|
|
|
|
|
|
Sv label = maybe_label ? Sv{maybe_label} : Sv::undef; |
2074
|
|
|
|
|
|
|
Sv ref = Ref::create(maybe_label); |
2075
|
|
|
|
|
|
|
payload.push(ref); |
2076
|
|
|
|
|
|
|
#line 2077 "t/cookbook/cookbook_xsgen.cc" |
2077
|
0
|
|
|
|
|
|
PUTBACK; |
2078
|
0
|
|
|
|
|
|
return; |
2079
|
|
|
|
|
|
|
} |
2080
|
0
|
0
|
|
|
|
|
}); } |
2081
|
|
|
|
|
|
|
|
2082
|
|
|
|
|
|
|
|
2083
|
|
|
|
|
|
|
|
2084
|
0
|
|
|
|
|
|
XS_EUPXS(XS_MyTest__Cookbook__ShapeA_new) { xs::throw_guard(cv, [=]() |
2085
|
|
|
|
|
|
|
{ |
2086
|
0
|
|
|
|
|
|
dVAR; dXSARGS; |
2087
|
0
|
0
|
|
|
|
|
if (items != 1) |
2088
|
0
|
|
|
|
|
|
croak_xs_usage(cv, "CLASS"); |
2089
|
|
|
|
|
|
|
{ |
2090
|
0
|
|
|
|
|
|
Sv RETVAL; |
2091
|
0
|
|
|
|
|
|
SV* CLASS = ST(0) |
2092
|
|
|
|
|
|
|
; |
2093
|
|
|
|
|
|
|
#line 99 "t/cookbook/recipe09.xsi" |
2094
|
|
|
|
|
|
|
auto shape = new ShapeA(); |
2095
|
|
|
|
|
|
|
Object obj = xs::out<>(shape, CLASS); |
2096
|
|
|
|
|
|
|
auto payload = Array::create(); |
2097
|
|
|
|
|
|
|
obj.payload_attach(payload, &payload_marker_09); |
2098
|
|
|
|
|
|
|
RETVAL = obj.ref(); |
2099
|
|
|
|
|
|
|
#line 2100 "t/cookbook/cookbook_xsgen.cc" |
2100
|
|
|
|
|
|
|
{ |
2101
|
|
|
|
|
|
|
SV * RETVALSV; |
2102
|
0
|
|
|
|
|
|
RETVALSV = NULL; |
2103
|
0
|
0
|
|
|
|
|
if (!RETVAL) XSRETURN_UNDEF; |
2104
|
0
|
0
|
|
|
|
|
if (RETVAL.is_scalar()) RETVALSV = RETVAL.detach(); |
|
|
0
|
|
|
|
|
|
2105
|
0
|
|
|
|
|
|
else switch (RETVAL.type()) { |
2106
|
0
|
0
|
|
|
|
|
case SVt_PVAV: XSRETURN(xs::Array(RETVAL.get()).push_on_stack(MARK)); |
|
|
0
|
|
|
|
|
|
2107
|
0
|
0
|
|
|
|
|
case SVt_PVHV: XSRETURN(xs::Hash(RETVAL.get()).push_on_stack(MARK)); |
|
|
0
|
|
|
|
|
|
2108
|
|
|
|
|
|
|
case SVt_PVCV: |
2109
|
|
|
|
|
|
|
case SVt_PVIO: |
2110
|
0
|
0
|
|
|
|
|
RETVALSV = newRV_noinc(RETVAL.detach()); |
2111
|
0
|
|
|
|
|
|
break; |
2112
|
0
|
|
|
|
|
|
default: throw "unknown type of Sv to return"; |
2113
|
|
|
|
|
|
|
} |
2114
|
0
|
0
|
|
|
|
|
RETVALSV = sv_2mortal(RETVALSV); |
2115
|
0
|
0
|
|
|
|
|
ST(0) = RETVALSV; |
2116
|
|
|
|
|
|
|
} |
2117
|
|
|
|
|
|
|
} |
2118
|
0
|
|
|
|
|
|
XSRETURN(1); |
2119
|
0
|
0
|
|
|
|
|
}); } |
2120
|
|
|
|
|
|
|
|
2121
|
|
|
|
|
|
|
|
2122
|
|
|
|
|
|
|
|
2123
|
0
|
|
|
|
|
|
XS_EUPXS(XS_MyTest__Cookbook__ShapeB_new) { xs::throw_guard(cv, [=]() |
2124
|
|
|
|
|
|
|
{ |
2125
|
0
|
|
|
|
|
|
dVAR; dXSARGS; |
2126
|
0
|
0
|
|
|
|
|
if (items != 1) |
2127
|
0
|
|
|
|
|
|
croak_xs_usage(cv, "CLASS"); |
2128
|
|
|
|
|
|
|
{ |
2129
|
|
|
|
|
|
|
XSShapeA * RETVAL; |
2130
|
0
|
|
|
|
|
|
SV* CLASS = ST(0) |
2131
|
|
|
|
|
|
|
; |
2132
|
|
|
|
|
|
|
#line 109 "t/cookbook/recipe09.xsi" |
2133
|
|
|
|
|
|
|
xs::Sv PROTO; PERL_UNUSED_VAR(PROTO); |
2134
|
|
|
|
|
|
|
PROTO = CLASS; |
2135
|
|
|
|
|
|
|
RETVAL = new XSShapeA(); |
2136
|
|
|
|
|
|
|
#line 2137 "t/cookbook/cookbook_xsgen.cc" |
2137
|
|
|
|
|
|
|
{ |
2138
|
|
|
|
|
|
|
SV * RETVALSV; |
2139
|
0
|
0
|
|
|
|
|
RETVALSV = xs::out(RETVAL, PROTO).detach(); |
2140
|
0
|
0
|
|
|
|
|
RETVALSV = sv_2mortal(RETVALSV); |
2141
|
0
|
|
|
|
|
|
ST(0) = RETVALSV; |
2142
|
|
|
|
|
|
|
} |
2143
|
|
|
|
|
|
|
} |
2144
|
0
|
|
|
|
|
|
XSRETURN(1); |
2145
|
0
|
0
|
|
|
|
|
}); } |
2146
|
|
|
|
|
|
|
|
2147
|
|
|
|
|
|
|
|
2148
|
|
|
|
|
|
|
|
2149
|
0
|
|
|
|
|
|
XS_EUPXS(XS_MyTest__Cookbook__ShapeB_add_point) { xs::throw_guard(cv, [=]() |
2150
|
|
|
|
|
|
|
{ |
2151
|
0
|
|
|
|
|
|
dVAR; dXSARGS; |
2152
|
0
|
0
|
|
|
|
|
if (items < 2 || items > 3) |
|
|
0
|
|
|
|
|
|
2153
|
0
|
|
|
|
|
|
croak_xs_usage(cv, "THIS, pt, maybe_label= nullptr"); |
2154
|
|
|
|
|
|
|
PERL_UNUSED_VAR(ax); /* -Wall */ |
2155
|
0
|
|
|
|
|
|
SP -= items; |
2156
|
|
|
|
|
|
|
{ |
2157
|
0
|
0
|
|
|
|
|
XSShapeA* THIS = xs::in(ST(0)); if (!SvOK(ST(0))) throw "undef not allowed as THIS"; |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
2158
|
|
|
|
|
|
|
; |
2159
|
0
|
|
|
|
|
|
Point* pt = xs::in(ST(1)); |
2160
|
|
|
|
|
|
|
; |
2161
|
|
|
|
|
|
|
SV* maybe_label; |
2162
|
|
|
|
|
|
|
|
2163
|
0
|
0
|
|
|
|
|
if (items < 3) |
2164
|
0
|
|
|
|
|
|
maybe_label = nullptr; |
2165
|
|
|
|
|
|
|
else { |
2166
|
0
|
|
|
|
|
|
maybe_label = ST(2) |
2167
|
0
|
|
|
|
|
|
; |
2168
|
|
|
|
|
|
|
} |
2169
|
|
|
|
|
|
|
#line 112 "t/cookbook/recipe09.xsi" |
2170
|
|
|
|
|
|
|
THIS->add_point(*pt); |
2171
|
|
|
|
|
|
|
THIS->add_label(maybe_label); |
2172
|
|
|
|
|
|
|
#line 2173 "t/cookbook/cookbook_xsgen.cc" |
2173
|
0
|
|
|
|
|
|
PUTBACK; |
2174
|
0
|
|
|
|
|
|
return; |
2175
|
|
|
|
|
|
|
} |
2176
|
0
|
0
|
|
|
|
|
}); } |
2177
|
|
|
|
|
|
|
|
2178
|
|
|
|
|
|
|
|
2179
|
|
|
|
|
|
|
|
2180
|
0
|
|
|
|
|
|
XS_EUPXS(XS_MyTest__Cookbook__ShapeB_get_point) { xs::throw_guard(cv, [=]() |
2181
|
|
|
|
|
|
|
{ |
2182
|
0
|
|
|
|
|
|
dVAR; dXSARGS; |
2183
|
0
|
0
|
|
|
|
|
if (items != 2) |
2184
|
0
|
|
|
|
|
|
croak_xs_usage(cv, "THIS, idx"); |
2185
|
|
|
|
|
|
|
PERL_UNUSED_VAR(ax); /* -Wall */ |
2186
|
0
|
|
|
|
|
|
SP -= items; |
2187
|
|
|
|
|
|
|
{ |
2188
|
0
|
0
|
|
|
|
|
XSShapeA* THIS = xs::in(ST(0)); if (!SvOK(ST(0))) throw "undef not allowed as THIS"; |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
2189
|
|
|
|
|
|
|
; |
2190
|
0
|
0
|
|
|
|
|
size_t idx = (size_t)SvUV(ST(1)) |
|
|
0
|
|
|
|
|
|
2191
|
|
|
|
|
|
|
; |
2192
|
|
|
|
|
|
|
#line 117 "t/cookbook/recipe09.xsi" |
2193
|
|
|
|
|
|
|
auto& pt = THIS->get_point(idx); |
2194
|
|
|
|
|
|
|
auto pt_copy = new Point{pt.x, pt.y}; |
2195
|
|
|
|
|
|
|
auto wrapped_pt = xs::out<>(pt_copy); |
2196
|
|
|
|
|
|
|
mXPUSHs(wrapped_pt.detach()); |
2197
|
|
|
|
|
|
|
if (GIMME_V == G_ARRAY) { |
2198
|
|
|
|
|
|
|
Sv value = SvRV(THIS->get_ref(idx)); |
2199
|
|
|
|
|
|
|
mXPUSHs(value.detach()); |
2200
|
|
|
|
|
|
|
} |
2201
|
|
|
|
|
|
|
#line 2202 "t/cookbook/cookbook_xsgen.cc" |
2202
|
0
|
|
|
|
|
|
PUTBACK; |
2203
|
0
|
|
|
|
|
|
return; |
2204
|
|
|
|
|
|
|
} |
2205
|
0
|
0
|
|
|
|
|
}); } |
2206
|
|
|
|
|
|
|
|
2207
|
|
|
|
|
|
|
|
2208
|
|
|
|
|
|
|
/* INCLUDE: Returning to 'cookbook.xs' from 'recipe09.xsi' */ |
2209
|
|
|
|
|
|
|
|
2210
|
|
|
|
|
|
|
|
2211
|
|
|
|
|
|
|
/* INCLUDE: Including 'recipe10.xsi' from 'cookbook.xs' */ |
2212
|
|
|
|
|
|
|
|
2213
|
|
|
|
|
|
|
#include |
2214
|
|
|
|
|
|
|
struct DateRecipe10; |
2215
|
0
|
|
|
|
|
|
struct TimezoneRecipe10 { |
2216
|
0
|
|
|
|
|
|
const char* get_name() const { return name.c_str(); } |
2217
|
|
|
|
|
|
|
private: |
2218
|
0
|
0
|
|
|
|
|
TimezoneRecipe10(const char* name_): name{name_} { } |
2219
|
|
|
|
|
|
|
std::string name; |
2220
|
|
|
|
|
|
|
friend struct DateRecipe10; |
2221
|
|
|
|
|
|
|
}; |
2222
|
|
|
|
|
|
|
struct DateRecipe10 { |
2223
|
0
|
|
|
|
|
|
DateRecipe10(const char* tz_ = "Europe/Minsk"): tz(tz_) { update(); } |
2224
|
0
|
|
|
|
|
|
~DateRecipe10() { std::cout << "~DateRecipe10()\n"; } |
2225
|
0
|
|
|
|
|
|
void update() { epoch = std::time(nullptr); } |
2226
|
|
|
|
|
|
|
|
2227
|
0
|
|
|
|
|
|
int get_epoch() const { return epoch; } |
2228
|
0
|
|
|
|
|
|
TimezoneRecipe10& get_timezone() { return tz; } |
2229
|
|
|
|
|
|
|
private: |
2230
|
|
|
|
|
|
|
std::time_t epoch; |
2231
|
|
|
|
|
|
|
TimezoneRecipe10 tz; |
2232
|
|
|
|
|
|
|
}; |
2233
|
|
|
|
|
|
|
namespace xs { |
2234
|
|
|
|
|
|
|
template <> |
2235
|
|
|
|
|
|
|
struct Typemap : TypemapObject { |
2236
|
0
|
0
|
|
|
|
|
static std::string package () { return "MyTest::Cookbook::DateRecipe10"; } |
2237
|
|
|
|
|
|
|
}; |
2238
|
|
|
|
|
|
|
|
2239
|
|
|
|
|
|
|
template <> |
2240
|
|
|
|
|
|
|
struct Typemap : TypemapObject { |
2241
|
0
|
0
|
|
|
|
|
static std::string package () { return "MyTest::Cookbook::TimezoneRecipe10"; } |
2242
|
|
|
|
|
|
|
}; |
2243
|
|
|
|
|
|
|
}; |
2244
|
|
|
|
|
|
|
static xs::Sv::payload_marker_t payload_marker_10; |
2245
|
|
|
|
|
|
|
|
2246
|
|
|
|
|
|
|
|
2247
|
0
|
|
|
|
|
|
XS_EUPXS(XS_MyTest__Cookbook__TimezoneRecipe10_get_name) { xs::throw_guard(cv, [=]() |
2248
|
|
|
|
|
|
|
{ |
2249
|
0
|
|
|
|
|
|
dVAR; dXSARGS; |
2250
|
0
|
0
|
|
|
|
|
if (items != 1) |
2251
|
0
|
|
|
|
|
|
croak_xs_usage(cv, "THIS"); |
2252
|
|
|
|
|
|
|
{ |
2253
|
|
|
|
|
|
|
const char * RETVAL; |
2254
|
0
|
0
|
|
|
|
|
dXSTARG; |
|
|
0
|
|
|
|
|
|
2255
|
0
|
0
|
|
|
|
|
TimezoneRecipe10* THIS = xs::in(ST(0)); if (!SvOK(ST(0))) throw "undef not allowed as THIS"; |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
2256
|
|
|
|
|
|
|
; |
2257
|
|
|
|
|
|
|
#line 45 "t/cookbook/recipe10.xsi" |
2258
|
|
|
|
|
|
|
RETVAL = THIS->get_name(); |
2259
|
|
|
|
|
|
|
#line 2260 "t/cookbook/cookbook_xsgen.cc" |
2260
|
0
|
0
|
|
|
|
|
sv_setpv(TARG, RETVAL); XSprePUSH; PUSHTARG; |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
2261
|
|
|
|
|
|
|
} |
2262
|
0
|
|
|
|
|
|
XSRETURN(1); |
2263
|
0
|
0
|
|
|
|
|
}); } |
2264
|
|
|
|
|
|
|
|
2265
|
|
|
|
|
|
|
|
2266
|
|
|
|
|
|
|
|
2267
|
0
|
|
|
|
|
|
XS_EUPXS(XS_MyTest__Cookbook__DateRecipe10_new) { xs::throw_guard(cv, [=]() |
2268
|
|
|
|
|
|
|
{ |
2269
|
0
|
|
|
|
|
|
dVAR; dXSARGS; |
2270
|
0
|
0
|
|
|
|
|
if (items != 2) |
2271
|
0
|
|
|
|
|
|
croak_xs_usage(cv, "CLASS, name"); |
2272
|
|
|
|
|
|
|
{ |
2273
|
|
|
|
|
|
|
DateRecipe10 * RETVAL; |
2274
|
0
|
|
|
|
|
|
SV* CLASS = ST(0) |
2275
|
|
|
|
|
|
|
; |
2276
|
0
|
0
|
|
|
|
|
const char* name = (const char *)SvPV_nolen(ST(1)) |
|
|
0
|
|
|
|
|
|
2277
|
|
|
|
|
|
|
; |
2278
|
|
|
|
|
|
|
#line 50 "t/cookbook/recipe10.xsi" |
2279
|
|
|
|
|
|
|
xs::Sv PROTO; PERL_UNUSED_VAR(PROTO); |
2280
|
|
|
|
|
|
|
PROTO = CLASS; |
2281
|
|
|
|
|
|
|
RETVAL = new DateRecipe10(name); |
2282
|
|
|
|
|
|
|
#line 2283 "t/cookbook/cookbook_xsgen.cc" |
2283
|
|
|
|
|
|
|
{ |
2284
|
|
|
|
|
|
|
SV * RETVALSV; |
2285
|
0
|
0
|
|
|
|
|
RETVALSV = xs::out(RETVAL, PROTO).detach(); |
2286
|
0
|
0
|
|
|
|
|
RETVALSV = sv_2mortal(RETVALSV); |
2287
|
0
|
|
|
|
|
|
ST(0) = RETVALSV; |
2288
|
|
|
|
|
|
|
} |
2289
|
|
|
|
|
|
|
} |
2290
|
0
|
|
|
|
|
|
XSRETURN(1); |
2291
|
0
|
0
|
|
|
|
|
}); } |
2292
|
|
|
|
|
|
|
|
2293
|
|
|
|
|
|
|
|
2294
|
|
|
|
|
|
|
|
2295
|
0
|
|
|
|
|
|
XS_EUPXS(XS_MyTest__Cookbook__DateRecipe10_update) { xs::throw_guard(cv, [=]() |
2296
|
|
|
|
|
|
|
{ |
2297
|
0
|
|
|
|
|
|
dVAR; dXSARGS; |
2298
|
0
|
0
|
|
|
|
|
if (items != 1) |
2299
|
0
|
|
|
|
|
|
croak_xs_usage(cv, "THIS"); |
2300
|
|
|
|
|
|
|
PERL_UNUSED_VAR(ax); /* -Wall */ |
2301
|
0
|
|
|
|
|
|
SP -= items; |
2302
|
|
|
|
|
|
|
{ |
2303
|
0
|
0
|
|
|
|
|
DateRecipe10* THIS = xs::in(ST(0)); if (!SvOK(ST(0))) throw "undef not allowed as THIS"; |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
2304
|
|
|
|
|
|
|
; |
2305
|
|
|
|
|
|
|
#line 52 "t/cookbook/recipe10.xsi" |
2306
|
|
|
|
|
|
|
THIS->update(); |
2307
|
|
|
|
|
|
|
#line 2308 "t/cookbook/cookbook_xsgen.cc" |
2308
|
0
|
|
|
|
|
|
PUTBACK; |
2309
|
0
|
|
|
|
|
|
return; |
2310
|
|
|
|
|
|
|
} |
2311
|
0
|
0
|
|
|
|
|
}); } |
2312
|
|
|
|
|
|
|
|
2313
|
|
|
|
|
|
|
|
2314
|
|
|
|
|
|
|
|
2315
|
0
|
|
|
|
|
|
XS_EUPXS(XS_MyTest__Cookbook__DateRecipe10_get_epoch) { xs::throw_guard(cv, [=]() |
2316
|
|
|
|
|
|
|
{ |
2317
|
0
|
|
|
|
|
|
dVAR; dXSARGS; |
2318
|
0
|
0
|
|
|
|
|
if (items != 1) |
2319
|
0
|
|
|
|
|
|
croak_xs_usage(cv, "THIS"); |
2320
|
|
|
|
|
|
|
{ |
2321
|
|
|
|
|
|
|
std::time_t RETVAL; |
2322
|
0
|
0
|
|
|
|
|
DateRecipe10* THIS = xs::in(ST(0)); if (!SvOK(ST(0))) throw "undef not allowed as THIS"; |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
2323
|
|
|
|
|
|
|
; |
2324
|
|
|
|
|
|
|
#line 54 "t/cookbook/recipe10.xsi" |
2325
|
|
|
|
|
|
|
xs::Sv PROTO; PERL_UNUSED_VAR(PROTO); |
2326
|
|
|
|
|
|
|
RETVAL = THIS->get_epoch(); |
2327
|
|
|
|
|
|
|
#line 2328 "t/cookbook/cookbook_xsgen.cc" |
2328
|
|
|
|
|
|
|
{ |
2329
|
|
|
|
|
|
|
SV * RETVALSV; |
2330
|
0
|
0
|
|
|
|
|
RETVALSV = xs::out(RETVAL, PROTO).detach(); |
2331
|
0
|
0
|
|
|
|
|
RETVALSV = sv_2mortal(RETVALSV); |
2332
|
0
|
|
|
|
|
|
ST(0) = RETVALSV; |
2333
|
|
|
|
|
|
|
} |
2334
|
|
|
|
|
|
|
} |
2335
|
0
|
|
|
|
|
|
XSRETURN(1); |
2336
|
0
|
0
|
|
|
|
|
}); } |
2337
|
|
|
|
|
|
|
|
2338
|
|
|
|
|
|
|
|
2339
|
|
|
|
|
|
|
|
2340
|
0
|
|
|
|
|
|
XS_EUPXS(XS_MyTest__Cookbook__DateRecipe10_get_timezone) { xs::throw_guard(cv, [=]() |
2341
|
|
|
|
|
|
|
{ |
2342
|
0
|
|
|
|
|
|
dVAR; dXSARGS; |
2343
|
0
|
0
|
|
|
|
|
if (items != 1) |
2344
|
0
|
|
|
|
|
|
croak_xs_usage(cv, "THIS"); |
2345
|
|
|
|
|
|
|
{ |
2346
|
0
|
|
|
|
|
|
Sv RETVAL; |
2347
|
0
|
0
|
|
|
|
|
DateRecipe10* THIS = xs::in(ST(0)); if (!SvOK(ST(0))) throw "undef not allowed as THIS"; |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
2348
|
|
|
|
|
|
|
; |
2349
|
|
|
|
|
|
|
#line 57 "t/cookbook/recipe10.xsi" |
2350
|
|
|
|
|
|
|
Object self {ST(0)}; |
2351
|
|
|
|
|
|
|
Object tz = xs::out<>(&THIS->get_timezone()); |
2352
|
|
|
|
|
|
|
auto self_ref = Ref::create(self); |
2353
|
|
|
|
|
|
|
tz.payload_attach(self_ref, &payload_marker_10); |
2354
|
|
|
|
|
|
|
RETVAL = tz.ref(); |
2355
|
|
|
|
|
|
|
#line 2356 "t/cookbook/cookbook_xsgen.cc" |
2356
|
|
|
|
|
|
|
{ |
2357
|
|
|
|
|
|
|
SV * RETVALSV; |
2358
|
0
|
|
|
|
|
|
RETVALSV = NULL; |
2359
|
0
|
0
|
|
|
|
|
if (!RETVAL) XSRETURN_UNDEF; |
2360
|
0
|
0
|
|
|
|
|
if (RETVAL.is_scalar()) RETVALSV = RETVAL.detach(); |
|
|
0
|
|
|
|
|
|
2361
|
0
|
|
|
|
|
|
else switch (RETVAL.type()) { |
2362
|
0
|
0
|
|
|
|
|
case SVt_PVAV: XSRETURN(xs::Array(RETVAL.get()).push_on_stack(MARK)); |
|
|
0
|
|
|
|
|
|
2363
|
0
|
0
|
|
|
|
|
case SVt_PVHV: XSRETURN(xs::Hash(RETVAL.get()).push_on_stack(MARK)); |
|
|
0
|
|
|
|
|
|
2364
|
|
|
|
|
|
|
case SVt_PVCV: |
2365
|
|
|
|
|
|
|
case SVt_PVIO: |
2366
|
0
|
0
|
|
|
|
|
RETVALSV = newRV_noinc(RETVAL.detach()); |
2367
|
0
|
|
|
|
|
|
break; |
2368
|
0
|
|
|
|
|
|
default: throw "unknown type of Sv to return"; |
2369
|
|
|
|
|
|
|
} |
2370
|
0
|
0
|
|
|
|
|
RETVALSV = sv_2mortal(RETVALSV); |
2371
|
0
|
0
|
|
|
|
|
ST(0) = RETVALSV; |
2372
|
|
|
|
|
|
|
} |
2373
|
|
|
|
|
|
|
} |
2374
|
0
|
|
|
|
|
|
XSRETURN(1); |
2375
|
0
|
0
|
|
|
|
|
}); } |
2376
|
|
|
|
|
|
|
|
2377
|
|
|
|
|
|
|
|
2378
|
|
|
|
|
|
|
/* INCLUDE: Returning to 'cookbook.xs' from 'recipe10.xsi' */ |
2379
|
|
|
|
|
|
|
|
2380
|
|
|
|
|
|
|
|
2381
|
|
|
|
|
|
|
/* INCLUDE: Including 'recipe11.xsi' from 'cookbook.xs' */ |
2382
|
|
|
|
|
|
|
|
2383
|
|
|
|
|
|
|
struct DateRecipe11; |
2384
|
0
|
0
|
|
|
|
|
struct TimezoneRecipe11: public panda::Refcnt { |
2385
|
0
|
|
|
|
|
|
const char* get_name() const { return name.c_str(); } |
2386
|
|
|
|
|
|
|
private: |
2387
|
0
|
0
|
|
|
|
|
TimezoneRecipe11(const char* name_): name{name_} { } |
2388
|
|
|
|
|
|
|
std::string name; |
2389
|
|
|
|
|
|
|
friend struct DateRecipe11; |
2390
|
|
|
|
|
|
|
}; |
2391
|
|
|
|
|
|
|
using TimezoneRecipe11SP = panda::iptr; |
2392
|
0
|
0
|
|
|
|
|
struct DateRecipe11: public panda::Refcnt { |
2393
|
0
|
0
|
|
|
|
|
DateRecipe11(const char* tz_ = "Europe/Minsk"): tz(new TimezoneRecipe11(tz_)) { update(); } |
|
|
0
|
|
|
|
|
|
2394
|
0
|
|
|
|
|
|
void update() { epoch = std::time(nullptr); } |
2395
|
|
|
|
|
|
|
|
2396
|
0
|
|
|
|
|
|
int get_epoch() const { return epoch; } |
2397
|
0
|
|
|
|
|
|
TimezoneRecipe11SP get_timezone() { return tz; } |
2398
|
|
|
|
|
|
|
private: |
2399
|
|
|
|
|
|
|
std::time_t epoch; |
2400
|
|
|
|
|
|
|
TimezoneRecipe11SP tz; |
2401
|
|
|
|
|
|
|
}; |
2402
|
|
|
|
|
|
|
namespace xs { |
2403
|
|
|
|
|
|
|
template <> |
2404
|
|
|
|
|
|
|
struct Typemap : TypemapObject { |
2405
|
0
|
0
|
|
|
|
|
static std::string package () { return "MyTest::Cookbook::DateRecipe11"; } |
2406
|
|
|
|
|
|
|
}; |
2407
|
|
|
|
|
|
|
|
2408
|
|
|
|
|
|
|
template <> |
2409
|
|
|
|
|
|
|
struct Typemap : TypemapObject { |
2410
|
0
|
0
|
|
|
|
|
static std::string package () { return "MyTest::Cookbook::TimezoneRecipe11"; } |
2411
|
|
|
|
|
|
|
}; |
2412
|
|
|
|
|
|
|
}; |
2413
|
|
|
|
|
|
|
|
2414
|
|
|
|
|
|
|
|
2415
|
0
|
|
|
|
|
|
XS_EUPXS(XS_MyTest__Cookbook__TimezoneRecipe11_get_name) { xs::throw_guard(cv, [=]() |
2416
|
|
|
|
|
|
|
{ |
2417
|
0
|
|
|
|
|
|
dVAR; dXSARGS; |
2418
|
0
|
0
|
|
|
|
|
if (items != 1) |
2419
|
0
|
|
|
|
|
|
croak_xs_usage(cv, "THIS"); |
2420
|
|
|
|
|
|
|
{ |
2421
|
|
|
|
|
|
|
const char * RETVAL; |
2422
|
0
|
0
|
|
|
|
|
dXSTARG; |
|
|
0
|
|
|
|
|
|
2423
|
0
|
0
|
|
|
|
|
TimezoneRecipe11* THIS = xs::in(ST(0)); if (!SvOK(ST(0))) throw "undef not allowed as THIS"; |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
2424
|
|
|
|
|
|
|
; |
2425
|
|
|
|
|
|
|
#line 41 "t/cookbook/recipe11.xsi" |
2426
|
|
|
|
|
|
|
RETVAL = THIS->get_name(); |
2427
|
|
|
|
|
|
|
#line 2428 "t/cookbook/cookbook_xsgen.cc" |
2428
|
0
|
0
|
|
|
|
|
sv_setpv(TARG, RETVAL); XSprePUSH; PUSHTARG; |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
2429
|
|
|
|
|
|
|
} |
2430
|
0
|
|
|
|
|
|
XSRETURN(1); |
2431
|
0
|
0
|
|
|
|
|
}); } |
2432
|
|
|
|
|
|
|
|
2433
|
|
|
|
|
|
|
|
2434
|
|
|
|
|
|
|
|
2435
|
0
|
|
|
|
|
|
XS_EUPXS(XS_MyTest__Cookbook__DateRecipe11_new) { xs::throw_guard(cv, [=]() |
2436
|
|
|
|
|
|
|
{ |
2437
|
0
|
|
|
|
|
|
dVAR; dXSARGS; |
2438
|
0
|
0
|
|
|
|
|
if (items != 2) |
2439
|
0
|
|
|
|
|
|
croak_xs_usage(cv, "CLASS, name"); |
2440
|
|
|
|
|
|
|
{ |
2441
|
|
|
|
|
|
|
DateRecipe11 * RETVAL; |
2442
|
0
|
|
|
|
|
|
SV* CLASS = ST(0) |
2443
|
|
|
|
|
|
|
; |
2444
|
0
|
0
|
|
|
|
|
const char* name = (const char *)SvPV_nolen(ST(1)) |
|
|
0
|
|
|
|
|
|
2445
|
|
|
|
|
|
|
; |
2446
|
|
|
|
|
|
|
#line 46 "t/cookbook/recipe11.xsi" |
2447
|
|
|
|
|
|
|
xs::Sv PROTO; PERL_UNUSED_VAR(PROTO); |
2448
|
|
|
|
|
|
|
PROTO = CLASS; |
2449
|
|
|
|
|
|
|
RETVAL = new DateRecipe11(name); |
2450
|
|
|
|
|
|
|
#line 2451 "t/cookbook/cookbook_xsgen.cc" |
2451
|
|
|
|
|
|
|
{ |
2452
|
|
|
|
|
|
|
SV * RETVALSV; |
2453
|
0
|
0
|
|
|
|
|
RETVALSV = xs::out(RETVAL, PROTO).detach(); |
2454
|
0
|
0
|
|
|
|
|
RETVALSV = sv_2mortal(RETVALSV); |
2455
|
0
|
|
|
|
|
|
ST(0) = RETVALSV; |
2456
|
|
|
|
|
|
|
} |
2457
|
|
|
|
|
|
|
} |
2458
|
0
|
|
|
|
|
|
XSRETURN(1); |
2459
|
0
|
0
|
|
|
|
|
}); } |
2460
|
|
|
|
|
|
|
|
2461
|
|
|
|
|
|
|
|
2462
|
|
|
|
|
|
|
|
2463
|
0
|
|
|
|
|
|
XS_EUPXS(XS_MyTest__Cookbook__DateRecipe11_update) { xs::throw_guard(cv, [=]() |
2464
|
|
|
|
|
|
|
{ |
2465
|
0
|
|
|
|
|
|
dVAR; dXSARGS; |
2466
|
0
|
0
|
|
|
|
|
if (items != 1) |
2467
|
0
|
|
|
|
|
|
croak_xs_usage(cv, "THIS"); |
2468
|
|
|
|
|
|
|
PERL_UNUSED_VAR(ax); /* -Wall */ |
2469
|
0
|
|
|
|
|
|
SP -= items; |
2470
|
|
|
|
|
|
|
{ |
2471
|
0
|
0
|
|
|
|
|
DateRecipe11* THIS = xs::in(ST(0)); if (!SvOK(ST(0))) throw "undef not allowed as THIS"; |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
2472
|
|
|
|
|
|
|
; |
2473
|
|
|
|
|
|
|
#line 48 "t/cookbook/recipe11.xsi" |
2474
|
|
|
|
|
|
|
THIS->update(); |
2475
|
|
|
|
|
|
|
#line 2476 "t/cookbook/cookbook_xsgen.cc" |
2476
|
0
|
|
|
|
|
|
PUTBACK; |
2477
|
0
|
|
|
|
|
|
return; |
2478
|
|
|
|
|
|
|
} |
2479
|
0
|
0
|
|
|
|
|
}); } |
2480
|
|
|
|
|
|
|
|
2481
|
|
|
|
|
|
|
|
2482
|
|
|
|
|
|
|
|
2483
|
0
|
|
|
|
|
|
XS_EUPXS(XS_MyTest__Cookbook__DateRecipe11_get_epoch) { xs::throw_guard(cv, [=]() |
2484
|
|
|
|
|
|
|
{ |
2485
|
0
|
|
|
|
|
|
dVAR; dXSARGS; |
2486
|
0
|
0
|
|
|
|
|
if (items != 1) |
2487
|
0
|
|
|
|
|
|
croak_xs_usage(cv, "THIS"); |
2488
|
|
|
|
|
|
|
{ |
2489
|
|
|
|
|
|
|
std::time_t RETVAL; |
2490
|
0
|
0
|
|
|
|
|
DateRecipe11* THIS = xs::in(ST(0)); if (!SvOK(ST(0))) throw "undef not allowed as THIS"; |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
2491
|
|
|
|
|
|
|
; |
2492
|
|
|
|
|
|
|
#line 50 "t/cookbook/recipe11.xsi" |
2493
|
|
|
|
|
|
|
xs::Sv PROTO; PERL_UNUSED_VAR(PROTO); |
2494
|
|
|
|
|
|
|
RETVAL = THIS->get_epoch(); |
2495
|
|
|
|
|
|
|
#line 2496 "t/cookbook/cookbook_xsgen.cc" |
2496
|
|
|
|
|
|
|
{ |
2497
|
|
|
|
|
|
|
SV * RETVALSV; |
2498
|
0
|
0
|
|
|
|
|
RETVALSV = xs::out(RETVAL, PROTO).detach(); |
2499
|
0
|
0
|
|
|
|
|
RETVALSV = sv_2mortal(RETVALSV); |
2500
|
0
|
|
|
|
|
|
ST(0) = RETVALSV; |
2501
|
|
|
|
|
|
|
} |
2502
|
|
|
|
|
|
|
} |
2503
|
0
|
|
|
|
|
|
XSRETURN(1); |
2504
|
0
|
0
|
|
|
|
|
}); } |
2505
|
|
|
|
|
|
|
|
2506
|
|
|
|
|
|
|
|
2507
|
|
|
|
|
|
|
|
2508
|
0
|
|
|
|
|
|
XS_EUPXS(XS_MyTest__Cookbook__DateRecipe11_get_timezone) { xs::throw_guard(cv, [=]() |
2509
|
|
|
|
|
|
|
{ |
2510
|
0
|
|
|
|
|
|
dVAR; dXSARGS; |
2511
|
0
|
0
|
|
|
|
|
if (items != 1) |
2512
|
0
|
|
|
|
|
|
croak_xs_usage(cv, "THIS"); |
2513
|
|
|
|
|
|
|
{ |
2514
|
0
|
|
|
|
|
|
TimezoneRecipe11SP RETVAL; |
2515
|
0
|
0
|
|
|
|
|
DateRecipe11* THIS = xs::in(ST(0)); if (!SvOK(ST(0))) throw "undef not allowed as THIS"; |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
2516
|
|
|
|
|
|
|
; |
2517
|
|
|
|
|
|
|
#line 52 "t/cookbook/recipe11.xsi" |
2518
|
|
|
|
|
|
|
xs::Sv PROTO; PERL_UNUSED_VAR(PROTO); |
2519
|
|
|
|
|
|
|
RETVAL = THIS->get_timezone(); |
2520
|
|
|
|
|
|
|
#line 2521 "t/cookbook/cookbook_xsgen.cc" |
2521
|
|
|
|
|
|
|
{ |
2522
|
|
|
|
|
|
|
SV * RETVALSV; |
2523
|
0
|
0
|
|
|
|
|
RETVALSV = xs::out(RETVAL, PROTO).detach(); |
2524
|
0
|
0
|
|
|
|
|
RETVALSV = sv_2mortal(RETVALSV); |
2525
|
0
|
|
|
|
|
|
ST(0) = RETVALSV; |
2526
|
|
|
|
|
|
|
} |
2527
|
|
|
|
|
|
|
} |
2528
|
0
|
|
|
|
|
|
XSRETURN(1); |
2529
|
0
|
0
|
|
|
|
|
}); } |
2530
|
|
|
|
|
|
|
|
2531
|
|
|
|
|
|
|
|
2532
|
|
|
|
|
|
|
/* INCLUDE: Returning to 'cookbook.xs' from 'recipe11.xsi' */ |
2533
|
|
|
|
|
|
|
|
2534
|
|
|
|
|
|
|
|
2535
|
|
|
|
|
|
|
/* INCLUDE: Including 'recipe12.xsi' from 'cookbook.xs' */ |
2536
|
|
|
|
|
|
|
|
2537
|
|
|
|
|
|
|
#include |
2538
|
|
|
|
|
|
|
#include |
2539
|
|
|
|
|
|
|
struct PointRecipe12 { |
2540
|
|
|
|
|
|
|
double x; |
2541
|
|
|
|
|
|
|
double y; |
2542
|
|
|
|
|
|
|
}; |
2543
|
0
|
|
|
|
|
|
double distance(const PointRecipe12& pt_a, const PointRecipe12& pt_b) { |
2544
|
0
|
|
|
|
|
|
auto dx = pt_a.x - pt_a.x; |
2545
|
0
|
|
|
|
|
|
auto dy = pt_a.y - pt_b.y; |
2546
|
0
|
|
|
|
|
|
return std::sqrt(dx * dx + dy * dy); |
2547
|
|
|
|
|
|
|
} |
2548
|
|
|
|
|
|
|
struct StatisticsRecipe12 { |
2549
|
0
|
|
|
|
|
|
StatisticsRecipe12(const PointRecipe12& interest_, const std::vector& points_): interest{interest_}, points{points_} { |
2550
|
0
|
0
|
|
|
|
|
if(points.empty()) throw std::runtime_error("points cannot be empty"); |
|
|
0
|
|
|
|
|
|
2551
|
0
|
|
|
|
|
|
} |
2552
|
|
|
|
|
|
|
|
2553
|
0
|
|
|
|
|
|
const PointRecipe12& nearest() const { |
2554
|
0
|
0
|
|
|
|
|
return select([](const double& prev_dist, const double& new_dist) { return new_dist < prev_dist; } ); |
2555
|
|
|
|
|
|
|
} |
2556
|
|
|
|
|
|
|
|
2557
|
0
|
|
|
|
|
|
const PointRecipe12& farest() const { |
2558
|
0
|
0
|
|
|
|
|
return select([](const double& prev_dist, const double& new_dist) { return new_dist > prev_dist; } ); |
2559
|
|
|
|
|
|
|
} |
2560
|
|
|
|
|
|
|
private: |
2561
|
|
|
|
|
|
|
template |
2562
|
0
|
|
|
|
|
|
const PointRecipe12& select(F&& fn) const { |
2563
|
0
|
|
|
|
|
|
const PointRecipe12* pt = &points.front(); |
2564
|
0
|
0
|
|
|
|
|
auto best_distance = distance(interest, *pt); |
|
|
0
|
|
|
|
|
|
2565
|
0
|
0
|
|
|
|
|
for(auto it = points.cbegin() + 1; it != points.cend(); ++it) { |
|
|
0
|
|
|
|
|
|
2566
|
0
|
0
|
|
|
|
|
auto new_distance = distance(interest, *it); |
|
|
0
|
|
|
|
|
|
2567
|
0
|
0
|
|
|
|
|
if(fn(best_distance, new_distance)) { |
|
|
0
|
|
|
|
|
|
2568
|
0
|
|
|
|
|
|
pt = &*it; |
2569
|
0
|
|
|
|
|
|
best_distance = new_distance; |
2570
|
|
|
|
|
|
|
} |
2571
|
|
|
|
|
|
|
} |
2572
|
0
|
|
|
|
|
|
return *pt; |
2573
|
|
|
|
|
|
|
} |
2574
|
|
|
|
|
|
|
|
2575
|
|
|
|
|
|
|
const PointRecipe12& interest; |
2576
|
|
|
|
|
|
|
const std::vector& points; |
2577
|
|
|
|
|
|
|
}; |
2578
|
|
|
|
|
|
|
namespace xs { |
2579
|
|
|
|
|
|
|
template <> |
2580
|
|
|
|
|
|
|
struct Typemap : TypemapObject { |
2581
|
0
|
0
|
|
|
|
|
static std::string package () { return "MyTest::Cookbook::PointRecipe12"; } |
2582
|
|
|
|
|
|
|
}; |
2583
|
|
|
|
|
|
|
|
2584
|
|
|
|
|
|
|
|
2585
|
|
|
|
|
|
|
template <> |
2586
|
|
|
|
|
|
|
struct Typemap : TypemapObject { |
2587
|
0
|
0
|
|
|
|
|
static std::string package () { return "MyTest::Cookbook::StatisticsRecipe12"; } |
2588
|
|
|
|
|
|
|
}; |
2589
|
|
|
|
|
|
|
} |
2590
|
|
|
|
|
|
|
static xs::Sv::payload_marker_t payload_marker_12; |
2591
|
|
|
|
|
|
|
struct StatisticsRecipe12_payload { |
2592
|
|
|
|
|
|
|
PointRecipe12 interest; |
2593
|
|
|
|
|
|
|
std::vector points; |
2594
|
0
|
|
|
|
|
|
~StatisticsRecipe12_payload() { std::cout << "~StatisticsRecipe12_payload\n"; } |
2595
|
|
|
|
|
|
|
}; |
2596
|
0
|
|
|
|
|
|
static int payload_marker_IntersectionFinderAdder_free(pTHX_ SV*, MAGIC* mg) { |
2597
|
0
|
0
|
|
|
|
|
if (mg->mg_virtual == &payload_marker_12) { |
2598
|
0
|
|
|
|
|
|
auto* payload = static_cast((void*)mg->mg_ptr); |
2599
|
0
|
0
|
|
|
|
|
delete payload; |
2600
|
|
|
|
|
|
|
} |
2601
|
0
|
|
|
|
|
|
return 0; |
2602
|
|
|
|
|
|
|
} |
2603
|
|
|
|
|
|
|
|
2604
|
|
|
|
|
|
|
|
2605
|
0
|
|
|
|
|
|
XS_EUPXS(XS_MyTest__Cookbook__PointRecipe12_x) { xs::throw_guard(cv, [=]() |
2606
|
|
|
|
|
|
|
{ |
2607
|
0
|
|
|
|
|
|
dVAR; dXSARGS; |
2608
|
0
|
|
|
|
|
|
dXSI32; |
2609
|
0
|
0
|
|
|
|
|
if (items < 1 || items > 2) |
|
|
0
|
|
|
|
|
|
2610
|
0
|
|
|
|
|
|
croak_xs_usage(cv, "THIS, new_val= nullptr"); |
2611
|
|
|
|
|
|
|
{ |
2612
|
|
|
|
|
|
|
double RETVAL; |
2613
|
0
|
0
|
|
|
|
|
dXSTARG; |
|
|
0
|
|
|
|
|
|
2614
|
0
|
0
|
|
|
|
|
PointRecipe12* THIS = xs::in(ST(0)); if (!SvOK(ST(0))) throw "undef not allowed as THIS"; |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
2615
|
|
|
|
|
|
|
; |
2616
|
|
|
|
|
|
|
SV* new_val; |
2617
|
|
|
|
|
|
|
|
2618
|
0
|
0
|
|
|
|
|
if (items < 2) |
2619
|
0
|
|
|
|
|
|
new_val = nullptr; |
2620
|
|
|
|
|
|
|
else { |
2621
|
0
|
|
|
|
|
|
new_val = ST(1) |
2622
|
0
|
|
|
|
|
|
; |
2623
|
|
|
|
|
|
|
} |
2624
|
|
|
|
|
|
|
#line 83 "t/cookbook/recipe12.xsi" |
2625
|
|
|
|
|
|
|
double* val = nullptr; |
2626
|
|
|
|
|
|
|
switch(ix) { |
2627
|
|
|
|
|
|
|
case 1: val = &THIS->y; break; |
2628
|
|
|
|
|
|
|
default: val = &THIS->x; break; |
2629
|
|
|
|
|
|
|
} |
2630
|
|
|
|
|
|
|
if (new_val) { |
2631
|
|
|
|
|
|
|
*val = SvNV(new_val); |
2632
|
|
|
|
|
|
|
} |
2633
|
|
|
|
|
|
|
RETVAL = *val; |
2634
|
|
|
|
|
|
|
#line 2635 "t/cookbook/cookbook_xsgen.cc" |
2635
|
0
|
0
|
|
|
|
|
XSprePUSH; PUSHn((double)RETVAL); |
|
|
0
|
|
|
|
|
|
2636
|
|
|
|
|
|
|
} |
2637
|
0
|
|
|
|
|
|
XSRETURN(1); |
2638
|
0
|
0
|
|
|
|
|
}); } |
2639
|
|
|
|
|
|
|
|
2640
|
|
|
|
|
|
|
|
2641
|
|
|
|
|
|
|
|
2642
|
0
|
|
|
|
|
|
XS_EUPXS(XS_MyTest__Cookbook__PointRecipe12_new) { xs::throw_guard(cv, [=]() |
2643
|
|
|
|
|
|
|
{ |
2644
|
0
|
|
|
|
|
|
dVAR; dXSARGS; |
2645
|
0
|
0
|
|
|
|
|
if (items < 1 || items > 3) |
|
|
0
|
|
|
|
|
|
2646
|
0
|
|
|
|
|
|
croak_xs_usage(cv, "CLASS, x= 0, y= 0"); |
2647
|
|
|
|
|
|
|
{ |
2648
|
|
|
|
|
|
|
PointRecipe12 * RETVAL; |
2649
|
0
|
|
|
|
|
|
SV* CLASS = ST(0) |
2650
|
|
|
|
|
|
|
; |
2651
|
|
|
|
|
|
|
double x; |
2652
|
|
|
|
|
|
|
double y; |
2653
|
|
|
|
|
|
|
|
2654
|
0
|
0
|
|
|
|
|
if (items < 2) |
2655
|
0
|
|
|
|
|
|
x = 0; |
2656
|
|
|
|
|
|
|
else { |
2657
|
0
|
|
|
|
|
|
x = (double)SvNV(ST(1)) |
2658
|
0
|
0
|
|
|
|
|
; |
|
|
0
|
|
|
|
|
|
2659
|
|
|
|
|
|
|
} |
2660
|
|
|
|
|
|
|
|
2661
|
0
|
0
|
|
|
|
|
if (items < 3) |
2662
|
0
|
|
|
|
|
|
y = 0; |
2663
|
|
|
|
|
|
|
else { |
2664
|
0
|
|
|
|
|
|
y = (double)SvNV(ST(2)) |
2665
|
0
|
0
|
|
|
|
|
; |
|
|
0
|
|
|
|
|
|
2666
|
|
|
|
|
|
|
} |
2667
|
|
|
|
|
|
|
#line 95 "t/cookbook/recipe12.xsi" |
2668
|
|
|
|
|
|
|
xs::Sv PROTO; PERL_UNUSED_VAR(PROTO); |
2669
|
|
|
|
|
|
|
PROTO = CLASS; |
2670
|
|
|
|
|
|
|
RETVAL = new PointRecipe12{x, y}; |
2671
|
|
|
|
|
|
|
#line 2672 "t/cookbook/cookbook_xsgen.cc" |
2672
|
|
|
|
|
|
|
{ |
2673
|
|
|
|
|
|
|
SV * RETVALSV; |
2674
|
0
|
0
|
|
|
|
|
RETVALSV = xs::out(RETVAL, PROTO).detach(); |
2675
|
0
|
0
|
|
|
|
|
RETVALSV = sv_2mortal(RETVALSV); |
2676
|
0
|
|
|
|
|
|
ST(0) = RETVALSV; |
2677
|
|
|
|
|
|
|
} |
2678
|
|
|
|
|
|
|
} |
2679
|
0
|
|
|
|
|
|
XSRETURN(1); |
2680
|
0
|
0
|
|
|
|
|
}); } |
2681
|
|
|
|
|
|
|
|
2682
|
|
|
|
|
|
|
|
2683
|
|
|
|
|
|
|
|
2684
|
0
|
|
|
|
|
|
XS_EUPXS(XS_MyTest__Cookbook__StatisticsRecipe12_nearest) { xs::throw_guard(cv, [=]() |
2685
|
|
|
|
|
|
|
{ |
2686
|
0
|
|
|
|
|
|
dVAR; dXSARGS; |
2687
|
0
|
0
|
|
|
|
|
if (items != 1) |
2688
|
0
|
|
|
|
|
|
croak_xs_usage(cv, "THIS"); |
2689
|
|
|
|
|
|
|
{ |
2690
|
|
|
|
|
|
|
PointRecipe12 * RETVAL; |
2691
|
0
|
0
|
|
|
|
|
StatisticsRecipe12* THIS = xs::in(ST(0)); if (!SvOK(ST(0))) throw "undef not allowed as THIS"; |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
2692
|
|
|
|
|
|
|
; |
2693
|
|
|
|
|
|
|
#line 103 "t/cookbook/recipe12.xsi" |
2694
|
|
|
|
|
|
|
xs::Sv PROTO; PERL_UNUSED_VAR(PROTO); |
2695
|
|
|
|
|
|
|
RETVAL = new PointRecipe12(THIS->nearest()); |
2696
|
|
|
|
|
|
|
#line 2697 "t/cookbook/cookbook_xsgen.cc" |
2697
|
|
|
|
|
|
|
{ |
2698
|
|
|
|
|
|
|
SV * RETVALSV; |
2699
|
0
|
0
|
|
|
|
|
RETVALSV = xs::out(RETVAL, PROTO).detach(); |
2700
|
0
|
0
|
|
|
|
|
RETVALSV = sv_2mortal(RETVALSV); |
2701
|
0
|
|
|
|
|
|
ST(0) = RETVALSV; |
2702
|
|
|
|
|
|
|
} |
2703
|
|
|
|
|
|
|
} |
2704
|
0
|
|
|
|
|
|
XSRETURN(1); |
2705
|
0
|
0
|
|
|
|
|
}); } |
2706
|
|
|
|
|
|
|
|
2707
|
|
|
|
|
|
|
|
2708
|
|
|
|
|
|
|
|
2709
|
0
|
|
|
|
|
|
XS_EUPXS(XS_MyTest__Cookbook__StatisticsRecipe12_farest) { xs::throw_guard(cv, [=]() |
2710
|
|
|
|
|
|
|
{ |
2711
|
0
|
|
|
|
|
|
dVAR; dXSARGS; |
2712
|
0
|
0
|
|
|
|
|
if (items != 1) |
2713
|
0
|
|
|
|
|
|
croak_xs_usage(cv, "THIS"); |
2714
|
|
|
|
|
|
|
{ |
2715
|
|
|
|
|
|
|
PointRecipe12 * RETVAL; |
2716
|
0
|
0
|
|
|
|
|
StatisticsRecipe12* THIS = xs::in(ST(0)); if (!SvOK(ST(0))) throw "undef not allowed as THIS"; |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
2717
|
|
|
|
|
|
|
; |
2718
|
|
|
|
|
|
|
#line 107 "t/cookbook/recipe12.xsi" |
2719
|
|
|
|
|
|
|
xs::Sv PROTO; PERL_UNUSED_VAR(PROTO); |
2720
|
|
|
|
|
|
|
RETVAL = new PointRecipe12(THIS->farest()); |
2721
|
|
|
|
|
|
|
#line 2722 "t/cookbook/cookbook_xsgen.cc" |
2722
|
|
|
|
|
|
|
{ |
2723
|
|
|
|
|
|
|
SV * RETVALSV; |
2724
|
0
|
0
|
|
|
|
|
RETVALSV = xs::out(RETVAL, PROTO).detach(); |
2725
|
0
|
0
|
|
|
|
|
RETVALSV = sv_2mortal(RETVALSV); |
2726
|
0
|
|
|
|
|
|
ST(0) = RETVALSV; |
2727
|
|
|
|
|
|
|
} |
2728
|
|
|
|
|
|
|
} |
2729
|
0
|
|
|
|
|
|
XSRETURN(1); |
2730
|
0
|
0
|
|
|
|
|
}); } |
2731
|
|
|
|
|
|
|
|
2732
|
|
|
|
|
|
|
|
2733
|
|
|
|
|
|
|
|
2734
|
0
|
|
|
|
|
|
XS_EUPXS(XS_MyTest__Cookbook__StatisticsRecipe12_new) { xs::throw_guard(cv, [=]() |
2735
|
|
|
|
|
|
|
{ |
2736
|
0
|
|
|
|
|
|
dVAR; dXSARGS; |
2737
|
0
|
0
|
|
|
|
|
if (items != 3) |
2738
|
0
|
|
|
|
|
|
croak_xs_usage(cv, "CLASS, interest, pts"); |
2739
|
|
|
|
|
|
|
{ |
2740
|
0
|
|
|
|
|
|
Sv RETVAL; |
2741
|
0
|
|
|
|
|
|
SV* CLASS = ST(0) |
2742
|
|
|
|
|
|
|
; |
2743
|
0
|
0
|
|
|
|
|
PointRecipe12* interest = xs::in(ST(1)); |
2744
|
|
|
|
|
|
|
; |
2745
|
0
|
0
|
|
|
|
|
Array pts = ST(2); |
|
|
0
|
|
|
|
|
|
2746
|
0
|
0
|
|
|
|
|
if (!pts && SvOK(ST(2))) throw "arg is not a 'Array' reference" |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
2747
|
0
|
|
|
|
|
|
; |
2748
|
|
|
|
|
|
|
#line 111 "t/cookbook/recipe12.xsi" |
2749
|
|
|
|
|
|
|
using payload_ptr_t = std::unique_ptr; |
2750
|
|
|
|
|
|
|
using stats_ptr_t = std::unique_ptr; |
2751
|
|
|
|
|
|
|
|
2752
|
|
|
|
|
|
|
std::vector points; |
2753
|
|
|
|
|
|
|
for(auto it: pts) { |
2754
|
|
|
|
|
|
|
points.push_back(*(xs::in(it))); |
2755
|
|
|
|
|
|
|
} |
2756
|
|
|
|
|
|
|
|
2757
|
|
|
|
|
|
|
// better to use std::make_unique from C++ 14, if available. |
2758
|
|
|
|
|
|
|
auto payload_holder = payload_ptr_t{new StatisticsRecipe12_payload{ *interest, std::move(points) }}; |
2759
|
|
|
|
|
|
|
auto self_holder = stats_ptr_t{new StatisticsRecipe12{ payload_holder->interest, payload_holder->points }}; |
2760
|
|
|
|
|
|
|
|
2761
|
|
|
|
|
|
|
Object self = xs::out(self_holder.get(), CLASS); |
2762
|
|
|
|
|
|
|
self.payload_attach((void*)payload_holder.get(), &payload_marker_12); |
2763
|
|
|
|
|
|
|
|
2764
|
|
|
|
|
|
|
payload_holder.release(); |
2765
|
|
|
|
|
|
|
self_holder.release(); |
2766
|
|
|
|
|
|
|
|
2767
|
|
|
|
|
|
|
RETVAL = self.ref(); |
2768
|
|
|
|
|
|
|
#line 2769 "t/cookbook/cookbook_xsgen.cc" |
2769
|
|
|
|
|
|
|
{ |
2770
|
|
|
|
|
|
|
SV * RETVALSV; |
2771
|
0
|
|
|
|
|
|
RETVALSV = NULL; |
2772
|
0
|
0
|
|
|
|
|
if (!RETVAL) XSRETURN_UNDEF; |
2773
|
0
|
0
|
|
|
|
|
if (RETVAL.is_scalar()) RETVALSV = RETVAL.detach(); |
|
|
0
|
|
|
|
|
|
2774
|
0
|
|
|
|
|
|
else switch (RETVAL.type()) { |
2775
|
0
|
0
|
|
|
|
|
case SVt_PVAV: XSRETURN(xs::Array(RETVAL.get()).push_on_stack(MARK)); |
|
|
0
|
|
|
|
|
|
2776
|
0
|
0
|
|
|
|
|
case SVt_PVHV: XSRETURN(xs::Hash(RETVAL.get()).push_on_stack(MARK)); |
|
|
0
|
|
|
|
|
|
2777
|
|
|
|
|
|
|
case SVt_PVCV: |
2778
|
|
|
|
|
|
|
case SVt_PVIO: |
2779
|
0
|
0
|
|
|
|
|
RETVALSV = newRV_noinc(RETVAL.detach()); |
2780
|
0
|
|
|
|
|
|
break; |
2781
|
0
|
|
|
|
|
|
default: throw "unknown type of Sv to return"; |
2782
|
|
|
|
|
|
|
} |
2783
|
0
|
0
|
|
|
|
|
RETVALSV = sv_2mortal(RETVALSV); |
2784
|
0
|
0
|
|
|
|
|
ST(0) = RETVALSV; |
2785
|
|
|
|
|
|
|
} |
2786
|
|
|
|
|
|
|
} |
2787
|
0
|
|
|
|
|
|
XSRETURN(1); |
2788
|
0
|
0
|
|
|
|
|
}); } |
2789
|
|
|
|
|
|
|
|
2790
|
|
|
|
|
|
|
|
2791
|
|
|
|
|
|
|
/* INCLUDE: Returning to 'cookbook.xs' from 'recipe12.xsi' */ |
2792
|
|
|
|
|
|
|
|
2793
|
|
|
|
|
|
|
|
2794
|
|
|
|
|
|
|
/* INCLUDE: Including 'recipe13.xsi' from 'cookbook.xs' */ |
2795
|
|
|
|
|
|
|
|
2796
|
|
|
|
|
|
|
#include |
2797
|
|
|
|
|
|
|
#include |
2798
|
0
|
0
|
|
|
|
|
struct PointRecipe13: public panda::Refcnt { |
2799
|
|
|
|
|
|
|
double x; |
2800
|
|
|
|
|
|
|
double y; |
2801
|
0
|
|
|
|
|
|
PointRecipe13(double xx, double yy): x{xx}, y{yy}{} |
2802
|
|
|
|
|
|
|
}; |
2803
|
|
|
|
|
|
|
using PointRecipe13SP = panda::iptr; |
2804
|
0
|
0
|
|
|
|
|
struct Shape13: public panda::Refcnt { |
2805
|
0
|
|
|
|
|
|
size_t point_count() const { return points.size(); } |
2806
|
0
|
|
|
|
|
|
PointRecipe13SP get_point(size_t idx) { return points.at(idx); } |
2807
|
0
|
|
|
|
|
|
void add_point(PointRecipe13SP pt) { points.push_back(pt); } |
2808
|
|
|
|
|
|
|
private: |
2809
|
|
|
|
|
|
|
std::vector points; |
2810
|
|
|
|
|
|
|
}; |
2811
|
|
|
|
|
|
|
namespace xs { |
2812
|
|
|
|
|
|
|
template <> |
2813
|
|
|
|
|
|
|
struct Typemap : TypemapObject { |
2814
|
0
|
0
|
|
|
|
|
static std::string package () { return "MyTest::Cookbook::PointRecipe13"; } |
2815
|
|
|
|
|
|
|
}; |
2816
|
|
|
|
|
|
|
|
2817
|
|
|
|
|
|
|
template <> |
2818
|
|
|
|
|
|
|
struct Typemap : TypemapObject { |
2819
|
0
|
0
|
|
|
|
|
static std::string package () { return "MyTest::Cookbook::Shape13"; } |
2820
|
|
|
|
|
|
|
}; |
2821
|
|
|
|
|
|
|
} |
2822
|
|
|
|
|
|
|
|
2823
|
|
|
|
|
|
|
|
2824
|
0
|
|
|
|
|
|
XS_EUPXS(XS_MyTest__Cookbook__PointRecipe13_x) { xs::throw_guard(cv, [=]() |
2825
|
|
|
|
|
|
|
{ |
2826
|
0
|
|
|
|
|
|
dVAR; dXSARGS; |
2827
|
0
|
|
|
|
|
|
dXSI32; |
2828
|
0
|
0
|
|
|
|
|
if (items < 1 || items > 2) |
|
|
0
|
|
|
|
|
|
2829
|
0
|
|
|
|
|
|
croak_xs_usage(cv, "THIS, new_val= nullptr"); |
2830
|
|
|
|
|
|
|
{ |
2831
|
|
|
|
|
|
|
double RETVAL; |
2832
|
0
|
0
|
|
|
|
|
dXSTARG; |
|
|
0
|
|
|
|
|
|
2833
|
0
|
0
|
|
|
|
|
PointRecipe13* THIS = xs::in(ST(0)); if (!SvOK(ST(0))) throw "undef not allowed as THIS"; |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
2834
|
|
|
|
|
|
|
; |
2835
|
|
|
|
|
|
|
SV* new_val; |
2836
|
|
|
|
|
|
|
|
2837
|
0
|
0
|
|
|
|
|
if (items < 2) |
2838
|
0
|
|
|
|
|
|
new_val = nullptr; |
2839
|
|
|
|
|
|
|
else { |
2840
|
0
|
|
|
|
|
|
new_val = ST(1) |
2841
|
0
|
|
|
|
|
|
; |
2842
|
|
|
|
|
|
|
} |
2843
|
|
|
|
|
|
|
#line 38 "t/cookbook/recipe13.xsi" |
2844
|
|
|
|
|
|
|
double* val = nullptr; |
2845
|
|
|
|
|
|
|
switch(ix) { |
2846
|
|
|
|
|
|
|
case 1: val = &THIS->y; break; |
2847
|
|
|
|
|
|
|
default: val = &THIS->x; break; |
2848
|
|
|
|
|
|
|
} |
2849
|
|
|
|
|
|
|
if (new_val) { |
2850
|
|
|
|
|
|
|
*val = SvNV(new_val); |
2851
|
|
|
|
|
|
|
} |
2852
|
|
|
|
|
|
|
RETVAL = *val; |
2853
|
|
|
|
|
|
|
#line 2854 "t/cookbook/cookbook_xsgen.cc" |
2854
|
0
|
0
|
|
|
|
|
XSprePUSH; PUSHn((double)RETVAL); |
|
|
0
|
|
|
|
|
|
2855
|
|
|
|
|
|
|
} |
2856
|
0
|
|
|
|
|
|
XSRETURN(1); |
2857
|
0
|
0
|
|
|
|
|
}); } |
2858
|
|
|
|
|
|
|
|
2859
|
|
|
|
|
|
|
|
2860
|
|
|
|
|
|
|
|
2861
|
0
|
|
|
|
|
|
XS_EUPXS(XS_MyTest__Cookbook__PointRecipe13_new) { xs::throw_guard(cv, [=]() |
2862
|
|
|
|
|
|
|
{ |
2863
|
0
|
|
|
|
|
|
dVAR; dXSARGS; |
2864
|
0
|
0
|
|
|
|
|
if (items < 1 || items > 3) |
|
|
0
|
|
|
|
|
|
2865
|
0
|
|
|
|
|
|
croak_xs_usage(cv, "CLASS, x= 0, y= 0"); |
2866
|
|
|
|
|
|
|
{ |
2867
|
|
|
|
|
|
|
PointRecipe13 * RETVAL; |
2868
|
0
|
|
|
|
|
|
SV* CLASS = ST(0) |
2869
|
|
|
|
|
|
|
; |
2870
|
|
|
|
|
|
|
double x; |
2871
|
|
|
|
|
|
|
double y; |
2872
|
|
|
|
|
|
|
|
2873
|
0
|
0
|
|
|
|
|
if (items < 2) |
2874
|
0
|
|
|
|
|
|
x = 0; |
2875
|
|
|
|
|
|
|
else { |
2876
|
0
|
|
|
|
|
|
x = (double)SvNV(ST(1)) |
2877
|
0
|
0
|
|
|
|
|
; |
|
|
0
|
|
|
|
|
|
2878
|
|
|
|
|
|
|
} |
2879
|
|
|
|
|
|
|
|
2880
|
0
|
0
|
|
|
|
|
if (items < 3) |
2881
|
0
|
|
|
|
|
|
y = 0; |
2882
|
|
|
|
|
|
|
else { |
2883
|
0
|
|
|
|
|
|
y = (double)SvNV(ST(2)) |
2884
|
0
|
0
|
|
|
|
|
; |
|
|
0
|
|
|
|
|
|
2885
|
|
|
|
|
|
|
} |
2886
|
|
|
|
|
|
|
#line 50 "t/cookbook/recipe13.xsi" |
2887
|
|
|
|
|
|
|
xs::Sv PROTO; PERL_UNUSED_VAR(PROTO); |
2888
|
|
|
|
|
|
|
PROTO = CLASS; |
2889
|
|
|
|
|
|
|
RETVAL = make_backref(x, y); |
2890
|
|
|
|
|
|
|
//RETVAL = new PointRecipe13(x, y); |
2891
|
|
|
|
|
|
|
#line 2892 "t/cookbook/cookbook_xsgen.cc" |
2892
|
|
|
|
|
|
|
{ |
2893
|
|
|
|
|
|
|
SV * RETVALSV; |
2894
|
0
|
0
|
|
|
|
|
RETVALSV = xs::out(RETVAL, PROTO).detach(); |
2895
|
0
|
0
|
|
|
|
|
RETVALSV = sv_2mortal(RETVALSV); |
2896
|
0
|
|
|
|
|
|
ST(0) = RETVALSV; |
2897
|
|
|
|
|
|
|
} |
2898
|
|
|
|
|
|
|
} |
2899
|
0
|
|
|
|
|
|
XSRETURN(1); |
2900
|
0
|
0
|
|
|
|
|
}); } |
2901
|
|
|
|
|
|
|
|
2902
|
|
|
|
|
|
|
|
2903
|
|
|
|
|
|
|
|
2904
|
0
|
|
|
|
|
|
XS_EUPXS(XS_MyTest__Cookbook__Shape13_point_count) { xs::throw_guard(cv, [=]() |
2905
|
|
|
|
|
|
|
{ |
2906
|
0
|
|
|
|
|
|
dVAR; dXSARGS; |
2907
|
0
|
0
|
|
|
|
|
if (items != 1) |
2908
|
0
|
|
|
|
|
|
croak_xs_usage(cv, "THIS"); |
2909
|
|
|
|
|
|
|
{ |
2910
|
|
|
|
|
|
|
size_t RETVAL; |
2911
|
0
|
0
|
|
|
|
|
dXSTARG; |
|
|
0
|
|
|
|
|
|
2912
|
0
|
0
|
|
|
|
|
Shape13* THIS = xs::in(ST(0)); if (!SvOK(ST(0))) throw "undef not allowed as THIS"; |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
2913
|
|
|
|
|
|
|
; |
2914
|
|
|
|
|
|
|
#line 57 "t/cookbook/recipe13.xsi" |
2915
|
|
|
|
|
|
|
RETVAL = THIS->point_count(); |
2916
|
|
|
|
|
|
|
#line 2917 "t/cookbook/cookbook_xsgen.cc" |
2917
|
0
|
0
|
|
|
|
|
XSprePUSH; PUSHu((UV)RETVAL); |
|
|
0
|
|
|
|
|
|
2918
|
|
|
|
|
|
|
} |
2919
|
0
|
|
|
|
|
|
XSRETURN(1); |
2920
|
0
|
0
|
|
|
|
|
}); } |
2921
|
|
|
|
|
|
|
|
2922
|
|
|
|
|
|
|
|
2923
|
|
|
|
|
|
|
|
2924
|
0
|
|
|
|
|
|
XS_EUPXS(XS_MyTest__Cookbook__Shape13_add_point) { xs::throw_guard(cv, [=]() |
2925
|
|
|
|
|
|
|
{ |
2926
|
0
|
|
|
|
|
|
dVAR; dXSARGS; |
2927
|
0
|
0
|
|
|
|
|
if (items != 2) |
2928
|
0
|
|
|
|
|
|
croak_xs_usage(cv, "THIS, pt"); |
2929
|
|
|
|
|
|
|
PERL_UNUSED_VAR(ax); /* -Wall */ |
2930
|
0
|
|
|
|
|
|
SP -= items; |
2931
|
|
|
|
|
|
|
{ |
2932
|
0
|
0
|
|
|
|
|
Shape13* THIS = xs::in(ST(0)); if (!SvOK(ST(0))) throw "undef not allowed as THIS"; |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
2933
|
|
|
|
|
|
|
; |
2934
|
0
|
0
|
|
|
|
|
PointRecipe13SP pt = xs::in(ST(1)); |
2935
|
|
|
|
|
|
|
; |
2936
|
|
|
|
|
|
|
#line 59 "t/cookbook/recipe13.xsi" |
2937
|
|
|
|
|
|
|
THIS->add_point(pt); |
2938
|
|
|
|
|
|
|
#line 2939 "t/cookbook/cookbook_xsgen.cc" |
2939
|
0
|
|
|
|
|
|
PUTBACK; |
2940
|
0
|
|
|
|
|
|
return; |
2941
|
|
|
|
|
|
|
} |
2942
|
0
|
0
|
|
|
|
|
}); } |
2943
|
|
|
|
|
|
|
|
2944
|
|
|
|
|
|
|
|
2945
|
|
|
|
|
|
|
|
2946
|
0
|
|
|
|
|
|
XS_EUPXS(XS_MyTest__Cookbook__Shape13_get_point) { xs::throw_guard(cv, [=]() |
2947
|
|
|
|
|
|
|
{ |
2948
|
0
|
|
|
|
|
|
dVAR; dXSARGS; |
2949
|
0
|
0
|
|
|
|
|
if (items != 2) |
2950
|
0
|
|
|
|
|
|
croak_xs_usage(cv, "THIS, idx"); |
2951
|
|
|
|
|
|
|
{ |
2952
|
0
|
|
|
|
|
|
PointRecipe13SP RETVAL; |
2953
|
0
|
0
|
|
|
|
|
Shape13* THIS = xs::in(ST(0)); if (!SvOK(ST(0))) throw "undef not allowed as THIS"; |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
2954
|
|
|
|
|
|
|
; |
2955
|
0
|
0
|
|
|
|
|
size_t idx = (size_t)SvUV(ST(1)) |
|
|
0
|
|
|
|
|
|
2956
|
|
|
|
|
|
|
; |
2957
|
|
|
|
|
|
|
#line 61 "t/cookbook/recipe13.xsi" |
2958
|
|
|
|
|
|
|
xs::Sv PROTO; PERL_UNUSED_VAR(PROTO); |
2959
|
|
|
|
|
|
|
RETVAL = THIS->get_point(idx); |
2960
|
|
|
|
|
|
|
#line 2961 "t/cookbook/cookbook_xsgen.cc" |
2961
|
|
|
|
|
|
|
{ |
2962
|
|
|
|
|
|
|
SV * RETVALSV; |
2963
|
0
|
0
|
|
|
|
|
RETVALSV = xs::out(RETVAL, PROTO).detach(); |
2964
|
0
|
0
|
|
|
|
|
RETVALSV = sv_2mortal(RETVALSV); |
2965
|
0
|
|
|
|
|
|
ST(0) = RETVALSV; |
2966
|
|
|
|
|
|
|
} |
2967
|
|
|
|
|
|
|
} |
2968
|
0
|
|
|
|
|
|
XSRETURN(1); |
2969
|
0
|
0
|
|
|
|
|
}); } |
2970
|
|
|
|
|
|
|
|
2971
|
|
|
|
|
|
|
|
2972
|
|
|
|
|
|
|
|
2973
|
0
|
|
|
|
|
|
XS_EUPXS(XS_MyTest__Cookbook__Shape13_new) { xs::throw_guard(cv, [=]() |
2974
|
|
|
|
|
|
|
{ |
2975
|
0
|
|
|
|
|
|
dVAR; dXSARGS; |
2976
|
0
|
0
|
|
|
|
|
if (items < 1) |
2977
|
0
|
|
|
|
|
|
croak_xs_usage(cv, "CLASS, ..."); |
2978
|
|
|
|
|
|
|
{ |
2979
|
|
|
|
|
|
|
Shape13 * RETVAL; |
2980
|
0
|
|
|
|
|
|
SV* CLASS = ST(0) |
2981
|
|
|
|
|
|
|
; |
2982
|
|
|
|
|
|
|
#line 63 "t/cookbook/recipe13.xsi" |
2983
|
|
|
|
|
|
|
xs::Sv PROTO; PERL_UNUSED_VAR(PROTO); |
2984
|
|
|
|
|
|
|
PROTO = CLASS; |
2985
|
|
|
|
|
|
|
RETVAL = new Shape13(); |
2986
|
|
|
|
|
|
|
#line 2987 "t/cookbook/cookbook_xsgen.cc" |
2987
|
|
|
|
|
|
|
{ |
2988
|
|
|
|
|
|
|
SV * RETVALSV; |
2989
|
0
|
0
|
|
|
|
|
RETVALSV = xs::out(RETVAL, PROTO).detach(); |
2990
|
0
|
0
|
|
|
|
|
RETVALSV = sv_2mortal(RETVALSV); |
2991
|
0
|
|
|
|
|
|
ST(0) = RETVALSV; |
2992
|
|
|
|
|
|
|
} |
2993
|
|
|
|
|
|
|
} |
2994
|
0
|
|
|
|
|
|
XSRETURN(1); |
2995
|
0
|
0
|
|
|
|
|
}); } |
2996
|
|
|
|
|
|
|
|
2997
|
|
|
|
|
|
|
|
2998
|
|
|
|
|
|
|
/* INCLUDE: Returning to 'cookbook.xs' from 'recipe13.xsi' */ |
2999
|
|
|
|
|
|
|
|
3000
|
|
|
|
|
|
|
#ifdef __cplusplus |
3001
|
|
|
|
|
|
|
extern "C" |
3002
|
|
|
|
|
|
|
#endif |
3003
|
|
|
|
|
|
|
|
3004
|
68
|
|
|
|
|
|
XS_EXTERNAL(boot_MyTest__Cookbook) { xs::throw_guard(cv, [=]() mutable |
3005
|
|
|
|
|
|
|
{ |
3006
|
|
|
|
|
|
|
#if PERL_VERSION_LE(5, 21, 5) |
3007
|
|
|
|
|
|
|
dVAR; dXSARGS; |
3008
|
|
|
|
|
|
|
#else |
3009
|
34
|
50
|
|
|
|
|
dVAR; dXSBOOTARGSXSAPIVERCHK; |
|
|
50
|
|
|
|
|
|
3010
|
|
|
|
|
|
|
#endif |
3011
|
|
|
|
|
|
|
#if (PERL_REVISION == 5 && PERL_VERSION < 9) |
3012
|
|
|
|
|
|
|
char* file = __FILE__; |
3013
|
|
|
|
|
|
|
#else |
3014
|
34
|
|
|
|
|
|
const char* file = __FILE__; |
3015
|
|
|
|
|
|
|
#endif |
3016
|
|
|
|
|
|
|
|
3017
|
|
|
|
|
|
|
PERL_UNUSED_VAR(file); |
3018
|
|
|
|
|
|
|
|
3019
|
|
|
|
|
|
|
PERL_UNUSED_VAR(cv); /* -W */ |
3020
|
|
|
|
|
|
|
PERL_UNUSED_VAR(items); /* -W */ |
3021
|
|
|
|
|
|
|
#if PERL_VERSION_LE(5, 21, 5) |
3022
|
|
|
|
|
|
|
XS_VERSION_BOOTCHECK; |
3023
|
|
|
|
|
|
|
# ifdef XS_APIVERSION_BOOTCHECK |
3024
|
|
|
|
|
|
|
XS_APIVERSION_BOOTCHECK; |
3025
|
|
|
|
|
|
|
# endif |
3026
|
|
|
|
|
|
|
#endif |
3027
|
|
|
|
|
|
|
|
3028
|
34
|
|
|
|
|
|
newXS_deffile("MyTest::Cookbook::DateRecipe01a::new", XS_MyTest__Cookbook__DateRecipe01a_new); |
3029
|
34
|
|
|
|
|
|
newXS_deffile("MyTest::Cookbook::DateRecipe01a::update", XS_MyTest__Cookbook__DateRecipe01a_update); |
3030
|
34
|
|
|
|
|
|
newXS_deffile("MyTest::Cookbook::DateRecipe01a::get_epoch", XS_MyTest__Cookbook__DateRecipe01a_get_epoch); |
3031
|
34
|
|
|
|
|
|
newXS_deffile("MyTest::Cookbook::DateRecipe01a::DESTROY", XS_MyTest__Cookbook__DateRecipe01a_DESTROY); |
3032
|
34
|
|
|
|
|
|
newXS_deffile("MyTest::Cookbook::DateRecipe01b::new", XS_MyTest__Cookbook__DateRecipe01b_new); |
3033
|
34
|
|
|
|
|
|
newXS_deffile("MyTest::Cookbook::DateRecipe01b::update", XS_MyTest__Cookbook__DateRecipe01b_update); |
3034
|
34
|
|
|
|
|
|
newXS_deffile("MyTest::Cookbook::DateRecipe01b::get_epoch", XS_MyTest__Cookbook__DateRecipe01b_get_epoch); |
3035
|
34
|
|
|
|
|
|
newXS_deffile("MyTest::Cookbook::DateRecipe02a::new", XS_MyTest__Cookbook__DateRecipe02a_new); |
3036
|
34
|
|
|
|
|
|
newXS_deffile("MyTest::Cookbook::DateRecipe02a::update", XS_MyTest__Cookbook__DateRecipe02a_update); |
3037
|
34
|
|
|
|
|
|
newXS_deffile("MyTest::Cookbook::DateRecipe02a::get_epoch", XS_MyTest__Cookbook__DateRecipe02a_get_epoch); |
3038
|
34
|
|
|
|
|
|
newXS_deffile("MyTest::Cookbook::DateRecipe02a::DESTROY", XS_MyTest__Cookbook__DateRecipe02a_DESTROY); |
3039
|
34
|
|
|
|
|
|
newXS_deffile("MyTest::Cookbook::DateRecipe02b::new", XS_MyTest__Cookbook__DateRecipe02b_new); |
3040
|
34
|
|
|
|
|
|
newXS_deffile("MyTest::Cookbook::DateRecipe02b::update", XS_MyTest__Cookbook__DateRecipe02b_update); |
3041
|
34
|
|
|
|
|
|
newXS_deffile("MyTest::Cookbook::DateRecipe02b::get_epoch", XS_MyTest__Cookbook__DateRecipe02b_get_epoch); |
3042
|
34
|
|
|
|
|
|
newXS_deffile("MyTest::Cookbook::TimezoneRecipe03::get_name", XS_MyTest__Cookbook__TimezoneRecipe03_get_name); |
3043
|
34
|
|
|
|
|
|
newXS_deffile("MyTest::Cookbook::TimezoneRecipe03::get_instance", XS_MyTest__Cookbook__TimezoneRecipe03_get_instance); |
3044
|
34
|
|
|
|
|
|
newXS_deffile("MyTest::Cookbook::TimezoneRecipe04::get_name", XS_MyTest__Cookbook__TimezoneRecipe04_get_name); |
3045
|
34
|
|
|
|
|
|
newXS_deffile("MyTest::Cookbook::TimezoneRecipe04::create", XS_MyTest__Cookbook__TimezoneRecipe04_create); |
3046
|
34
|
|
|
|
|
|
newXS_deffile("MyTest::Cookbook::DateRecipe04::new", XS_MyTest__Cookbook__DateRecipe04_new); |
3047
|
34
|
|
|
|
|
|
newXS_deffile("MyTest::Cookbook::DateRecipe04::update", XS_MyTest__Cookbook__DateRecipe04_update); |
3048
|
34
|
|
|
|
|
|
newXS_deffile("MyTest::Cookbook::DateRecipe04::get_epoch", XS_MyTest__Cookbook__DateRecipe04_get_epoch); |
3049
|
34
|
|
|
|
|
|
newXS_deffile("MyTest::Cookbook::DateRecipe04::get_timezone", XS_MyTest__Cookbook__DateRecipe04_get_timezone); |
3050
|
34
|
|
|
|
|
|
newXS_deffile("MyTest::Cookbook::DateRecipe04::set_timezone", XS_MyTest__Cookbook__DateRecipe04_set_timezone); |
3051
|
34
|
|
|
|
|
|
newXS_deffile("MyTest::Cookbook::TimezoneRecipe05::get_name", XS_MyTest__Cookbook__TimezoneRecipe05_get_name); |
3052
|
34
|
|
|
|
|
|
newXS_deffile("MyTest::Cookbook::TimezoneRecipe05::create", XS_MyTest__Cookbook__TimezoneRecipe05_create); |
3053
|
34
|
|
|
|
|
|
newXS_deffile("MyTest::Cookbook::DateRecipe05::new", XS_MyTest__Cookbook__DateRecipe05_new); |
3054
|
34
|
|
|
|
|
|
newXS_deffile("MyTest::Cookbook::DateRecipe05::update", XS_MyTest__Cookbook__DateRecipe05_update); |
3055
|
34
|
|
|
|
|
|
newXS_deffile("MyTest::Cookbook::DateRecipe05::get_epoch", XS_MyTest__Cookbook__DateRecipe05_get_epoch); |
3056
|
34
|
|
|
|
|
|
newXS_deffile("MyTest::Cookbook::DateRecipe05::get_timezone", XS_MyTest__Cookbook__DateRecipe05_get_timezone); |
3057
|
34
|
|
|
|
|
|
newXS_deffile("MyTest::Cookbook::DateRecipe05::set_timezone", XS_MyTest__Cookbook__DateRecipe05_set_timezone); |
3058
|
34
|
|
|
|
|
|
newXS_deffile("MyTest::Cookbook::Base06::method", XS_MyTest__Cookbook__Base06_method); |
3059
|
34
|
|
|
|
|
|
newXS_deffile("MyTest::Cookbook::Base06::new", XS_MyTest__Cookbook__Base06_new); |
3060
|
34
|
|
|
|
|
|
newXS_deffile("MyTest::Cookbook::Derived06A::new", XS_MyTest__Cookbook__Derived06A_new); |
3061
|
34
|
|
|
|
|
|
newXS_deffile("MyTest::Cookbook::Derived06A::specific_method", XS_MyTest__Cookbook__Derived06A_specific_method); |
3062
|
34
|
|
|
|
|
|
newXS_deffile("MyTest::Cookbook::Derived06B::new", XS_MyTest__Cookbook__Derived06B_new); |
3063
|
34
|
|
|
|
|
|
newXS_deffile("MyTest::Cookbook::Derived06B::specific_method", XS_MyTest__Cookbook__Derived06B_specific_method); |
3064
|
34
|
|
|
|
|
|
newXS_deffile("MyTest::Cookbook::Client07::disconnect", XS_MyTest__Cookbook__Client07_disconnect); |
3065
|
34
|
|
|
|
|
|
newXS_deffile("MyTest::Cookbook::Client07::welcome", XS_MyTest__Cookbook__Client07_welcome); |
3066
|
34
|
|
|
|
|
|
newXS_deffile("MyTest::Cookbook::Client07::new", XS_MyTest__Cookbook__Client07_new); |
3067
|
34
|
|
|
|
|
|
newXS_deffile("MyTest::Cookbook::ServerBase07::on_client", XS_MyTest__Cookbook__ServerBase07_on_client); |
3068
|
34
|
|
|
|
|
|
newXS_deffile("MyTest::Cookbook::ServerBase07::new", XS_MyTest__Cookbook__ServerBase07_new); |
3069
|
34
|
|
|
|
|
|
newXS_deffile("MyTest::Cookbook::LoggerPlugin07::on_client", XS_MyTest__Cookbook__LoggerPlugin07_on_client); |
3070
|
34
|
|
|
|
|
|
newXS_deffile("MyTest::Cookbook::LoggerPlugin07::new", XS_MyTest__Cookbook__LoggerPlugin07_new); |
3071
|
34
|
|
|
|
|
|
newXS_deffile("MyTest::Cookbook::AuthorizerPlugin07::on_client", XS_MyTest__Cookbook__AuthorizerPlugin07_on_client); |
3072
|
34
|
|
|
|
|
|
newXS_deffile("MyTest::Cookbook::AuthorizerPlugin07::new", XS_MyTest__Cookbook__AuthorizerPlugin07_new); |
3073
|
34
|
|
|
|
|
|
newXS_deffile("MyTest::Cookbook::WAVFile::name", XS_MyTest__Cookbook__WAVFile_name); |
3074
|
34
|
|
|
|
|
|
newXS_deffile("MyTest::Cookbook::WAVFile::new", XS_MyTest__Cookbook__WAVFile_new); |
3075
|
34
|
|
|
|
|
|
newXS_deffile("MyTest::Cookbook::MultimediaFile::name", XS_MyTest__Cookbook__MultimediaFile_name); |
3076
|
34
|
|
|
|
|
|
newXS_deffile("MyTest::Cookbook::MultimediaFile::format", XS_MyTest__Cookbook__MultimediaFile_format); |
3077
|
34
|
|
|
|
|
|
newXS_deffile("MyTest::Cookbook::MultimediaFile::new", XS_MyTest__Cookbook__MultimediaFile_new); |
3078
|
34
|
|
|
|
|
|
newXS_deffile("MyTest::Cookbook::WAVPlayer::play_wav", XS_MyTest__Cookbook__WAVPlayer_play_wav); |
3079
|
34
|
|
|
|
|
|
newXS_deffile("MyTest::Cookbook::WAVPlayer::preferred_bitrate", XS_MyTest__Cookbook__WAVPlayer_preferred_bitrate); |
3080
|
34
|
|
|
|
|
|
newXS_deffile("MyTest::Cookbook::WAVPlayer::clone", XS_MyTest__Cookbook__WAVPlayer_clone); |
3081
|
34
|
|
|
|
|
|
newXS_deffile("MyTest::Cookbook::WAVPlayer::new", XS_MyTest__Cookbook__WAVPlayer_new); |
3082
|
34
|
|
|
|
|
|
newXS_deffile("MyTest::Cookbook::MultimediaPlayer::new", XS_MyTest__Cookbook__MultimediaPlayer_new); |
3083
|
34
|
|
|
|
|
|
newXS_deffile("MyTest::Cookbook::MultimediaPlayer::play_file", XS_MyTest__Cookbook__MultimediaPlayer_play_file); |
3084
|
34
|
|
|
|
|
|
newXS_deffile("MyTest::Cookbook::MultimediaPlayer::quality", XS_MyTest__Cookbook__MultimediaPlayer_quality); |
3085
|
34
|
|
|
|
|
|
newXS_deffile("MyTest::Cookbook::MultimediaPlayer::clone", XS_MyTest__Cookbook__MultimediaPlayer_clone); |
3086
|
34
|
|
|
|
|
|
cv = newXS_deffile("MyTest::Cookbook::Point::x", XS_MyTest__Cookbook__Point_x); |
3087
|
34
|
|
|
|
|
|
XSANY.any_i32 = 0; |
3088
|
34
|
|
|
|
|
|
cv = newXS_deffile("MyTest::Cookbook::Point::y", XS_MyTest__Cookbook__Point_x); |
3089
|
34
|
|
|
|
|
|
XSANY.any_i32 = 1; |
3090
|
34
|
|
|
|
|
|
newXS_deffile("MyTest::Cookbook::Point::new", XS_MyTest__Cookbook__Point_new); |
3091
|
34
|
|
|
|
|
|
newXS_deffile("MyTest::Cookbook::ShapeA::point_count", XS_MyTest__Cookbook__ShapeA_point_count); |
3092
|
34
|
|
|
|
|
|
newXS_deffile("MyTest::Cookbook::ShapeA::get_point", XS_MyTest__Cookbook__ShapeA_get_point); |
3093
|
34
|
|
|
|
|
|
newXS_deffile("MyTest::Cookbook::ShapeA::add_point", XS_MyTest__Cookbook__ShapeA_add_point); |
3094
|
34
|
|
|
|
|
|
newXS_deffile("MyTest::Cookbook::ShapeA::new", XS_MyTest__Cookbook__ShapeA_new); |
3095
|
34
|
|
|
|
|
|
newXS_deffile("MyTest::Cookbook::ShapeB::new", XS_MyTest__Cookbook__ShapeB_new); |
3096
|
34
|
|
|
|
|
|
newXS_deffile("MyTest::Cookbook::ShapeB::add_point", XS_MyTest__Cookbook__ShapeB_add_point); |
3097
|
34
|
|
|
|
|
|
newXS_deffile("MyTest::Cookbook::ShapeB::get_point", XS_MyTest__Cookbook__ShapeB_get_point); |
3098
|
34
|
|
|
|
|
|
newXS_deffile("MyTest::Cookbook::TimezoneRecipe10::get_name", XS_MyTest__Cookbook__TimezoneRecipe10_get_name); |
3099
|
34
|
|
|
|
|
|
newXS_deffile("MyTest::Cookbook::DateRecipe10::new", XS_MyTest__Cookbook__DateRecipe10_new); |
3100
|
34
|
|
|
|
|
|
newXS_deffile("MyTest::Cookbook::DateRecipe10::update", XS_MyTest__Cookbook__DateRecipe10_update); |
3101
|
34
|
|
|
|
|
|
newXS_deffile("MyTest::Cookbook::DateRecipe10::get_epoch", XS_MyTest__Cookbook__DateRecipe10_get_epoch); |
3102
|
34
|
|
|
|
|
|
newXS_deffile("MyTest::Cookbook::DateRecipe10::get_timezone", XS_MyTest__Cookbook__DateRecipe10_get_timezone); |
3103
|
34
|
|
|
|
|
|
newXS_deffile("MyTest::Cookbook::TimezoneRecipe11::get_name", XS_MyTest__Cookbook__TimezoneRecipe11_get_name); |
3104
|
34
|
|
|
|
|
|
newXS_deffile("MyTest::Cookbook::DateRecipe11::new", XS_MyTest__Cookbook__DateRecipe11_new); |
3105
|
34
|
|
|
|
|
|
newXS_deffile("MyTest::Cookbook::DateRecipe11::update", XS_MyTest__Cookbook__DateRecipe11_update); |
3106
|
34
|
|
|
|
|
|
newXS_deffile("MyTest::Cookbook::DateRecipe11::get_epoch", XS_MyTest__Cookbook__DateRecipe11_get_epoch); |
3107
|
34
|
|
|
|
|
|
newXS_deffile("MyTest::Cookbook::DateRecipe11::get_timezone", XS_MyTest__Cookbook__DateRecipe11_get_timezone); |
3108
|
34
|
|
|
|
|
|
cv = newXS_deffile("MyTest::Cookbook::PointRecipe12::x", XS_MyTest__Cookbook__PointRecipe12_x); |
3109
|
34
|
|
|
|
|
|
XSANY.any_i32 = 0; |
3110
|
34
|
|
|
|
|
|
cv = newXS_deffile("MyTest::Cookbook::PointRecipe12::y", XS_MyTest__Cookbook__PointRecipe12_x); |
3111
|
34
|
|
|
|
|
|
XSANY.any_i32 = 1; |
3112
|
34
|
|
|
|
|
|
newXS_deffile("MyTest::Cookbook::PointRecipe12::new", XS_MyTest__Cookbook__PointRecipe12_new); |
3113
|
34
|
|
|
|
|
|
newXS_deffile("MyTest::Cookbook::StatisticsRecipe12::nearest", XS_MyTest__Cookbook__StatisticsRecipe12_nearest); |
3114
|
34
|
|
|
|
|
|
newXS_deffile("MyTest::Cookbook::StatisticsRecipe12::farest", XS_MyTest__Cookbook__StatisticsRecipe12_farest); |
3115
|
34
|
|
|
|
|
|
newXS_deffile("MyTest::Cookbook::StatisticsRecipe12::new", XS_MyTest__Cookbook__StatisticsRecipe12_new); |
3116
|
34
|
|
|
|
|
|
cv = newXS_deffile("MyTest::Cookbook::PointRecipe13::x", XS_MyTest__Cookbook__PointRecipe13_x); |
3117
|
34
|
|
|
|
|
|
XSANY.any_i32 = 0; |
3118
|
34
|
|
|
|
|
|
cv = newXS_deffile("MyTest::Cookbook::PointRecipe13::y", XS_MyTest__Cookbook__PointRecipe13_x); |
3119
|
34
|
|
|
|
|
|
XSANY.any_i32 = 1; |
3120
|
34
|
|
|
|
|
|
newXS_deffile("MyTest::Cookbook::PointRecipe13::new", XS_MyTest__Cookbook__PointRecipe13_new); |
3121
|
34
|
|
|
|
|
|
newXS_deffile("MyTest::Cookbook::Shape13::point_count", XS_MyTest__Cookbook__Shape13_point_count); |
3122
|
34
|
|
|
|
|
|
newXS_deffile("MyTest::Cookbook::Shape13::add_point", XS_MyTest__Cookbook__Shape13_add_point); |
3123
|
34
|
|
|
|
|
|
newXS_deffile("MyTest::Cookbook::Shape13::get_point", XS_MyTest__Cookbook__Shape13_get_point); |
3124
|
34
|
|
|
|
|
|
newXS_deffile("MyTest::Cookbook::Shape13::new", XS_MyTest__Cookbook__Shape13_new); |
3125
|
|
|
|
|
|
|
|
3126
|
|
|
|
|
|
|
/* Initialisation Section */ |
3127
|
|
|
|
|
|
|
|
3128
|
|
|
|
|
|
|
#line 7 "t/cookbook/cookbook.xs" |
3129
|
|
|
|
|
|
|
{ |
3130
|
|
|
|
|
|
|
Stash("MyTest::Cookbook", GV_ADD).mark_as_loaded("MyTest"); |
3131
|
|
|
|
|
|
|
} |
3132
|
|
|
|
|
|
|
|
3133
|
|
|
|
|
|
|
#line 47 "t/cookbook/recipe02.xsi" |
3134
|
|
|
|
|
|
|
{ |
3135
|
|
|
|
|
|
|
Stash("MyTest::Cookbook::DateRecipe02a", GV_ADD).mark_as_loaded("MyTest::Cookbook"); |
3136
|
|
|
|
|
|
|
} |
3137
|
|
|
|
|
|
|
|
3138
|
|
|
|
|
|
|
#line 63 "t/cookbook/recipe02.xsi" |
3139
|
|
|
|
|
|
|
{ |
3140
|
|
|
|
|
|
|
Stash("MyTest::Cookbook::DateRecipe02b", GV_ADD).mark_as_loaded("MyTest::Cookbook"); |
3141
|
|
|
|
|
|
|
} |
3142
|
|
|
|
|
|
|
|
3143
|
|
|
|
|
|
|
#line 49 "t/cookbook/recipe06.xsi" |
3144
|
|
|
|
|
|
|
{ |
3145
|
|
|
|
|
|
|
Stash("MyTest::Cookbook::Derived06A").inherit("MyTest::Cookbook::Base06"); |
3146
|
|
|
|
|
|
|
} |
3147
|
|
|
|
|
|
|
|
3148
|
|
|
|
|
|
|
#line 60 "t/cookbook/recipe06.xsi" |
3149
|
|
|
|
|
|
|
{ |
3150
|
|
|
|
|
|
|
Stash("MyTest::Cookbook::Derived06B").inherit("MyTest::Cookbook::Base06"); |
3151
|
|
|
|
|
|
|
} |
3152
|
|
|
|
|
|
|
|
3153
|
|
|
|
|
|
|
#line 111 "t/cookbook/recipe07.xsi" |
3154
|
|
|
|
|
|
|
{ |
3155
|
|
|
|
|
|
|
auto stash = Stash("MyTest::Cookbook::Server07", GV_ADD); |
3156
|
|
|
|
|
|
|
stash.inherit("MyTest::Cookbook::LoggerPlugin07"); |
3157
|
|
|
|
|
|
|
stash.inherit("MyTest::Cookbook::AuthorizerPlugin07"); |
3158
|
|
|
|
|
|
|
stash.inherit("MyTest::Cookbook::ServerBase07"); |
3159
|
|
|
|
|
|
|
} |
3160
|
|
|
|
|
|
|
|
3161
|
|
|
|
|
|
|
#line 131 "t/cookbook/recipe08.xsi" |
3162
|
|
|
|
|
|
|
{ |
3163
|
|
|
|
|
|
|
auto stash = Stash("MyTest::Cookbook::MultimediaPlayer", GV_ADD); |
3164
|
|
|
|
|
|
|
stash.inherit("MyTest::Cookbook::WAVPlayer"); |
3165
|
|
|
|
|
|
|
} |
3166
|
|
|
|
|
|
|
|
3167
|
|
|
|
|
|
|
#line 127 "t/cookbook/recipe09.xsi" |
3168
|
|
|
|
|
|
|
{ |
3169
|
|
|
|
|
|
|
auto stash = Stash("MyTest::Cookbook::ShapeB", GV_ADD); |
3170
|
|
|
|
|
|
|
stash.inherit("MyTest::Cookbook::ShapeA"); |
3171
|
|
|
|
|
|
|
} |
3172
|
|
|
|
|
|
|
|
3173
|
|
|
|
|
|
|
#line 132 "t/cookbook/recipe12.xsi" |
3174
|
|
|
|
|
|
|
{ |
3175
|
|
|
|
|
|
|
payload_marker_12.svt_free = payload_marker_IntersectionFinderAdder_free; |
3176
|
|
|
|
|
|
|
} |
3177
|
|
|
|
|
|
|
|
3178
|
|
|
|
|
|
|
#line 3179 "t/cookbook/cookbook_xsgen.cc" |
3179
|
|
|
|
|
|
|
|
3180
|
|
|
|
|
|
|
/* End of Initialisation Section */ |
3181
|
|
|
|
|
|
|
|
3182
|
|
|
|
|
|
|
#if PERL_VERSION_LE(5, 21, 5) |
3183
|
|
|
|
|
|
|
# if PERL_VERSION_GE(5, 9, 0) |
3184
|
|
|
|
|
|
|
if (PL_unitcheckav) |
3185
|
|
|
|
|
|
|
call_list(PL_scopestack_ix, PL_unitcheckav); |
3186
|
|
|
|
|
|
|
# endif |
3187
|
|
|
|
|
|
|
XSRETURN_YES; |
3188
|
|
|
|
|
|
|
#else |
3189
|
34
|
|
|
|
|
|
Perl_xs_boot_epilog(aTHX_ ax); |
3190
|
|
|
|
|
|
|
#endif |
3191
|
204
|
50
|
|
|
|
|
}); } |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
3192
|
|
|
|
|
|
|
|