XLog_xsgen.cc

filter: Statementstmt 86.0% 464 / 539 Branchbran 46.9% 246 / 524 Conditioncond n/a MC/DCmcdc n/a Subroutinesub n/a Podpod n/a totaltotal 66.7% 710 / 1063 CC 0 SCAR 0
CC
0
Cov
0%
CRAP 0
« xs/Multi.xsi ↑ Summary t/lib/MyTest.xs »
1 /*
2 * This file was generated automatically by XS::Install::FrozenShit::ParseXS version 3.57 from the
3 * contents of XLog.xs. Do not edit this file, edit XLog.xs instead.
4 *
5 * ANY CHANGES MADE HERE WILL BE LOST!
6 *
7 */
8  
9 #line 1 "XLog.xs"
10 #include <xs/xlog.h>
11 #include <xs/export.h>
12  
13 using namespace xs;
14 using namespace panda;
15 using namespace panda::log;
16  
17 #line 18 "XLog_xsgen.cc"
18 #ifndef PERL_UNUSED_VAR
19 # define PERL_UNUSED_VAR(var) if (0) var = var
20 #endif
21  
22 #ifndef dVAR
23 # define dVAR dNOOP
24 #endif
25  
26  
27 /* This stuff is not part of the API! You have been warned. */
28 #ifndef PERL_VERSION_DECIMAL
29 # define PERL_VERSION_DECIMAL(r,v,s) (r*1000000 + v*1000 + s)
30 #endif
31 #ifndef PERL_DECIMAL_VERSION
32 # define PERL_DECIMAL_VERSION \
33 PERL_VERSION_DECIMAL(PERL_REVISION,PERL_VERSION,PERL_SUBVERSION)
34 #endif
35 #ifndef PERL_VERSION_GE
36 # define PERL_VERSION_GE(r,v,s) \
37 (PERL_DECIMAL_VERSION >= PERL_VERSION_DECIMAL(r,v,s))
38 #endif
39 #ifndef PERL_VERSION_LE
40 # define PERL_VERSION_LE(r,v,s) \
41 (PERL_DECIMAL_VERSION <= PERL_VERSION_DECIMAL(r,v,s))
42 #endif
43  
44 /* XS_INTERNAL is the explicit static-linkage variant of the default
45 * XS macro.
46 *
47 * XS_EXTERNAL is the same as XS_INTERNAL except it does not include
48 * "STATIC", ie. it exports XSUB symbols. You probably don't want that
49 * for anything but the BOOT XSUB.
50 *
51 * See XSUB.h in core!
52 */
53  
54  
55 /* TODO: This might be compatible further back than 5.10.0. */
56 #if PERL_VERSION_GE(5, 10, 0) && PERL_VERSION_LE(5, 15, 1)
57 # undef XS_EXTERNAL
58 # undef XS_INTERNAL
59 # if defined(__CYGWIN__) && defined(USE_DYNAMIC_LOADING)
60 # define XS_EXTERNAL(name) __declspec(dllexport) XSPROTO(name)
61 # define XS_INTERNAL(name) STATIC XSPROTO(name)
62 # endif
63 # if defined(__SYMBIAN32__)
64 # define XS_EXTERNAL(name) EXPORT_C XSPROTO(name)
65 # define XS_INTERNAL(name) EXPORT_C STATIC XSPROTO(name)
66 # endif
67 # ifndef XS_EXTERNAL
68 # if defined(HASATTRIBUTE_UNUSED) && !defined(__cplusplus)
69 # define XS_EXTERNAL(name) void name(pTHX_ CV* cv __attribute__unused__)
70 # define XS_INTERNAL(name) STATIC void name(pTHX_ CV* cv __attribute__unused__)
71 # else
72 # ifdef __cplusplus
73 # define XS_EXTERNAL(name) extern "C" XSPROTO(name)
74 # define XS_INTERNAL(name) static XSPROTO(name)
75 # else
76 # define XS_EXTERNAL(name) XSPROTO(name)
77 # define XS_INTERNAL(name) STATIC XSPROTO(name)
78 # endif
79 # endif
80 # endif
81 #endif
82  
83 /* perl >= 5.10.0 && perl <= 5.15.1 */
84  
85  
86 /* The XS_EXTERNAL macro is used for functions that must not be static
87 * like the boot XSUB of a module. If perl didn't have an XS_EXTERNAL
88 * macro defined, the best we can do is assume XS is the same.
89 * Dito for XS_INTERNAL.
90 */
91 #ifndef XS_EXTERNAL
92 # define XS_EXTERNAL(name) XS(name)
93 #endif
94 #ifndef XS_INTERNAL
95 # define XS_INTERNAL(name) XS(name)
96 #endif
97  
98 /* Now, finally, after all this mess, we want an XS::Install::FrozenShit::ParseXS
99 * internal macro that we're free to redefine for varying linkage due
100 * to the EXPORT_XSUB_SYMBOLS XS keyword. This is internal, use
101 * XS_EXTERNAL(name) or XS_INTERNAL(name) in your code if you need to!
102 */
103  
104 #undef XS_EUPXS
105 #if defined(PERL_EUPXS_ALWAYS_EXPORT)
106 # define XS_EUPXS(name) XS_EXTERNAL(name)
107 #else
108 /* default to internal */
109 # define XS_EUPXS(name) XS_INTERNAL(name)
110 #endif
111  
112 #ifndef PERL_ARGS_ASSERT_CROAK_XS_USAGE
113 #define PERL_ARGS_ASSERT_CROAK_XS_USAGE assert(cv); assert(params)
114  
115 /* prototype to pass -Wmissing-prototypes */
116 STATIC void
117 S_croak_xs_usage(const CV *const cv, const char *const params);
118  
119 STATIC void
120 S_croak_xs_usage(const CV *const cv, const char *const params)
121 {
122 const GV *const gv = CvGV(cv);
123  
124 PERL_ARGS_ASSERT_CROAK_XS_USAGE;
125  
126 if (gv) {
127 const char *const gvname = GvNAME(gv);
128 const HV *const stash = GvSTASH(gv);
129 const char *const hvname = stash ? HvNAME(stash) : NULL;
130  
131 if (hvname)
132 Perl_croak_nocontext("Usage: %s::%s(%s)", hvname, gvname, params);
133 else
134 Perl_croak_nocontext("Usage: %s(%s)", gvname, params);
135 } else {
136 /* Pants. I don't think that it should be possible to get here. */
137 Perl_croak_nocontext("Usage: CODE(0x%" UVxf ")(%s)", PTR2UV(cv), params);
138 }
139 }
140 #undef PERL_ARGS_ASSERT_CROAK_XS_USAGE
141  
142 #define croak_xs_usage S_croak_xs_usage
143  
144 #endif
145  
146 /* NOTE: the prototype of newXSproto() is different in versions of perls,
147 * so we define a portable version of newXSproto()
148 */
149 #ifdef newXS_flags
150 #define newXSproto_portable(name, c_impl, file, proto) newXS_flags(name, c_impl, file, proto, 0)
151 #else
152 #define newXSproto_portable(name, c_impl, file, proto) (PL_Sv=(SV*)newXS(name, c_impl, file), sv_setpv(PL_Sv, proto), (CV*)PL_Sv)
153 #endif /* !defined(newXS_flags) */
154  
155 #if PERL_VERSION_LE(5, 21, 5)
156 # define newXS_deffile(a,b) Perl_newXS(aTHX_ a,b,file)
157 #else
158 # define newXS_deffile(a,b) Perl_newXS_deffile(aTHX_ a,b)
159 #endif
160  
161 /* simple backcompat versions of the TARGx() macros with no optimisation */
162 #ifndef TARGi
163 # define TARGi(iv, do_taint) sv_setiv_mg(TARG, iv)
164 # define TARGu(uv, do_taint) sv_setuv_mg(TARG, uv)
165 # define TARGn(nv, do_taint) sv_setnv_mg(TARG, nv)
166 #endif
167  
168 #line 169 "XLog_xsgen.cc"
169  
170 /* INCLUDE: Including 'xs/XLog.xsi' from 'XLog.xs' */
171  
172 #include "util.h"
173 using namespace xs::xlog;
174 namespace {
175 static bool no_format_warnings;
176  
177 struct PerlObjectFormatter : IFormatter, Backref {
178 1 string format (std::string& msg, const Info& i) const override {
179 1 ▶ if (!is_perl_thread()) throw std::logic_error("can't call pure-perl formatting callback: log() called from perl-foreign thread");
Branch: 3 branches
BranchTrueFalseTotal
if (!is_perl_thread()) throw std::logic_error("can't call pure-perl formatting callback: log() called from perl-foreign thread"); 1 0 1
if (!is_perl_thread()) throw std::logic_error("can't call pure-perl formatting callback: log() called from perl-foreign thread"); 0 1 1
if (!is_perl_thread()) throw std::logic_error("can't call pure-perl formatting callback: log() called from perl-foreign thread"); 0 0 0
180 1 ▶ Object o = xs::out(this);
Branch: 2 branches
BranchTrueFalseTotal
Object o = xs::out(this); 1 0 1
Object o = xs::out(this); 1 0 1
181 1 ▶ auto ret = o.call("format", xs::out(msg), xs::out(i.level), xs::out(i.module->name()), xs::out(i.file), xs::out(i.line), xs::out(i.func));
Branch: 8 branches
BranchTrueFalseTotal
auto ret = o.call("format", xs::out(msg), xs::out(i.level), xs::out(i.module->name()), xs::out(i.file), xs::out(i.line), xs::out(i.func)); 1 0 1
auto ret = o.call("format", xs::out(msg), xs::out(i.level), xs::out(i.module->name()), xs::out(i.file), xs::out(i.line), xs::out(i.func)); 1 0 1
auto ret = o.call("format", xs::out(msg), xs::out(i.level), xs::out(i.module->name()), xs::out(i.file), xs::out(i.line), xs::out(i.func)); 1 0 1
auto ret = o.call("format", xs::out(msg), xs::out(i.level), xs::out(i.module->name()), xs::out(i.file), xs::out(i.line), xs::out(i.func)); 1 0 1
auto ret = o.call("format", xs::out(msg), xs::out(i.level), xs::out(i.module->name()), xs::out(i.file), xs::out(i.line), xs::out(i.func)); 1 0 1
auto ret = o.call("format", xs::out(msg), xs::out(i.level), xs::out(i.module->name()), xs::out(i.file), xs::out(i.line), xs::out(i.func)); 1 0 1
auto ret = o.call("format", xs::out(msg), xs::out(i.level), xs::out(i.module->name()), xs::out(i.file), xs::out(i.line), xs::out(i.func)); 1 0 1
auto ret = o.call("format", xs::out(msg), xs::out(i.level), xs::out(i.module->name()), xs::out(i.file), xs::out(i.line), xs::out(i.func)); 1 0 1
182 2 ▶ return xs::in<string>(ret);
Branch: 1 branch
BranchTrueFalseTotal
return xs::in<string>(ret); 1 0 1
183 1 }
184  
185 2 ~PerlObjectFormatter () { Backref::dtor(); }
186 };
187  
188 struct PerlObjectLogger : ILogger, Backref {
189 123 void log_format (std::string& msg, const Info& i, const IFormatter& fmt) override {
190 123 ▶ if (!is_perl_thread()) throw std::logic_error("can't call pure-perl logging callback: log() called from perl-foreign thread");
Branch: 3 branches
BranchTrueFalseTotal
if (!is_perl_thread()) throw std::logic_error("can't call pure-perl logging callback: log() called from perl-foreign thread"); 123 0 123
if (!is_perl_thread()) throw std::logic_error("can't call pure-perl logging callback: log() called from perl-foreign thread"); 0 123 123
if (!is_perl_thread()) throw std::logic_error("can't call pure-perl logging callback: log() called from perl-foreign thread"); 0 0 0
191 123 ▶ Object o = xs::out(this);
Branch: 2 branches
BranchTrueFalseTotal
Object o = xs::out(this); 123 0 123
Object o = xs::out(this); 123 0 123
192 123 ▶ auto sub = o.method("log_format");
Branch: 1 branch
BranchTrueFalseTotal
auto sub = o.method("log_format"); 123 0 123
193 123 ▶ if (!sub) return ILogger::log_format(msg, i, fmt);
Branch: 2 branches
BranchTrueFalseTotal
if (!sub) return ILogger::log_format(msg, i, fmt); 1 122 123
if (!sub) return ILogger::log_format(msg, i, fmt); 1 0 1
194 122 ▶ sub.call(o.ref(), xs::out(msg), xs::out(i.level), xs::out(i.module->name()), xs::out(i.file), xs::out(i.line), xs::out(i.func), xs::out(&fmt));
Branch: 10 branches
BranchTrueFalseTotal
sub.call(o.ref(), xs::out(msg), xs::out(i.level), xs::out(i.module->name()), xs::out(i.file), xs::out(i.line), xs::out(i.func), xs::out(&fmt)); 122 0 122
sub.call(o.ref(), xs::out(msg), xs::out(i.level), xs::out(i.module->name()), xs::out(i.file), xs::out(i.line), xs::out(i.func), xs::out(&fmt)); 122 0 122
sub.call(o.ref(), xs::out(msg), xs::out(i.level), xs::out(i.module->name()), xs::out(i.file), xs::out(i.line), xs::out(i.func), xs::out(&fmt)); 122 0 122
sub.call(o.ref(), xs::out(msg), xs::out(i.level), xs::out(i.module->name()), xs::out(i.file), xs::out(i.line), xs::out(i.func), xs::out(&fmt)); 122 0 122
sub.call(o.ref(), xs::out(msg), xs::out(i.level), xs::out(i.module->name()), xs::out(i.file), xs::out(i.line), xs::out(i.func), xs::out(&fmt)); 122 0 122
sub.call(o.ref(), xs::out(msg), xs::out(i.level), xs::out(i.module->name()), xs::out(i.file), xs::out(i.line), xs::out(i.func), xs::out(&fmt)); 122 0 122
sub.call(o.ref(), xs::out(msg), xs::out(i.level), xs::out(i.module->name()), xs::out(i.file), xs::out(i.line), xs::out(i.func), xs::out(&fmt)); 122 0 122
sub.call(o.ref(), xs::out(msg), xs::out(i.level), xs::out(i.module->name()), xs::out(i.file), xs::out(i.line), xs::out(i.func), xs::out(&fmt)); 122 0 122
sub.call(o.ref(), xs::out(msg), xs::out(i.level), xs::out(i.module->name()), xs::out(i.file), xs::out(i.line), xs::out(i.func), xs::out(&fmt)); 122 0 122
sub.call(o.ref(), xs::out(msg), xs::out(i.level), xs::out(i.module->name()), xs::out(i.file), xs::out(i.line), xs::out(i.func), xs::out(&fmt)); 122 0 122
195 124 ▶ }
Branch: 2 branches
BranchTrueFalseTotal
} 122 1 123
} 122 1 123
196  
197 1 void log (const string& msg, const Info& info) override {
198 1 ▶ if (!is_perl_thread()) throw std::logic_error("can't call pure-perl logging callback: log() called from perl-foreign thread");
Branch: 3 branches
BranchTrueFalseTotal
if (!is_perl_thread()) throw std::logic_error("can't call pure-perl logging callback: log() called from perl-foreign thread"); 1 0 1
if (!is_perl_thread()) throw std::logic_error("can't call pure-perl logging callback: log() called from perl-foreign thread"); 0 1 1
if (!is_perl_thread()) throw std::logic_error("can't call pure-perl logging callback: log() called from perl-foreign thread"); 0 0 0
199 1 ▶ Object o = xs::out(this);
Branch: 2 branches
BranchTrueFalseTotal
Object o = xs::out(this); 1 0 1
Object o = xs::out(this); 1 0 1
200 1 ▶ o.call("log", xs::out(msg), xs::out(info.level));
Branch: 3 branches
BranchTrueFalseTotal
o.call("log", xs::out(msg), xs::out(info.level)); 1 0 1
o.call("log", xs::out(msg), xs::out(info.level)); 1 0 1
o.call("log", xs::out(msg), xs::out(info.level)); 1 0 1
201 1 }
202  
203 50 ~PerlObjectLogger () { Backref::dtor(); }
204 };
205  
206 struct NoWarningsGuard {
207 7 NoWarningsGuard (bool enabled) : _enabled(enabled), _cop_warnings(), _dowarn() {
208 7 ▶ if (!_enabled) return;
Branch: 1 branch
BranchTrueFalseTotal
if (!_enabled) return; 6 1 7
209 1 _cop_warnings = PL_curcop->cop_warnings;
210 1 _dowarn = PL_dowarn;
211 1 PL_curcop->cop_warnings = pWARN_STD;
212 1 PL_dowarn &= ~G_WARN_ON;
213 }
214  
215 6 ~NoWarningsGuard () {
216 5 ▶ if (!_enabled) return;
Branch: 1 branch
BranchTrueFalseTotal
if (!_enabled) return; 4 1 5
217 1 PL_curcop->cop_warnings = _cop_warnings;
218 1 PL_dowarn = _dowarn;
219 5 }
220  
221 private:
222 bool _enabled;
223 decltype(PL_curcop->cop_warnings) _cop_warnings;
224 U8 _dowarn;
225 };
226 }
227 namespace xs {
228 template <class TYPE> struct Typemap<PerlObjectLogger*, TYPE> : Typemap<ILogger*, TYPE> {};
229 template <class TYPE> struct Typemap<PerlObjectFormatter*, TYPE> : Typemap<IFormatter*, TYPE> {};
230 }
231 #undef PANDA_LOG_CODE_POINT
232 #define PANDA_LOG_CODE_POINT make_code_point()
233 138 static inline CV* get_context_sub () {
234 138 int depth = 0;
235 138 auto ctx = caller_cx(depth, nullptr);
236 139 ▶ while (ctx) {
Branch: 1 branch
BranchTrueFalseTotal
while (ctx) { 138 1 139
237 138 ▶ if (CxTYPE(ctx) == CXt_SUB) return ctx->blk_sub.cv;
Branch: 1 branch
BranchTrueFalseTotal
if (CxTYPE(ctx) == CXt_SUB) return ctx->blk_sub.cv; 137 1 138
238 1 ctx = caller_cx(++depth, nullptr);
239 }
240 1 return nullptr;
241 }
242 138 static inline CodePoint make_code_point () {
243 138 auto cop = PL_curcop;
244  
245 138 string_view func;
246 138 ▶ auto cv = get_context_sub();
Branch: 1 branch
BranchTrueFalseTotal
auto cv = get_context_sub(); 138 0 138
247 138 ▶ if (cv) {
Branch: 1 branch
BranchTrueFalseTotal
if (cv) { 137 1 138
248 137 ▶ GV* gv = CvGV(cv);
Branch: 1 branch
BranchTrueFalseTotal
GV* gv = CvGV(cv); 137 0 137
249 137 ▶ if (gv) func = string_view(GvNAME(gv), GvNAMELEN(gv));
Branch: 1 branch
BranchTrueFalseTotal
if (gv) func = string_view(GvNAME(gv), GvNAMELEN(gv)); 137 0 137
250 }
251  
252 138 ▶ return CodePoint{CopFILE(cop), CopLINE(cop), func};
Branch: 1 branch
BranchTrueFalseTotal
return CodePoint{CopFILE(cop), CopLINE(cop), func}; 138 0 138
253 }
254 140 static inline Sv format_args (SV** args, int items) {
255 140 ▶ if (!items) return Simple(default_message);
Branch: 2 branches
BranchTrueFalseTotal
if (!items) return Simple(default_message); 25 115 140
if (!items) return Simple(default_message); 25 0 25
256  
257 115 ▶ if (items == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (items == 1) { 108 7 115
258 108 Sv arg(args[0]);
259 108 ▶ if (arg.is_simple()) { return arg; }
Branch: 1 branch
BranchTrueFalseTotal
if (arg.is_simple()) { return arg; } 104 4 108
260 8 ▶ else { return Simple(SvPV_nolen(args[0])); }
Branch: 1 branch
BranchTrueFalseTotal
else { return Simple(SvPV_nolen(args[0])); } 4 0 4
261 108 }
262  
263 7 NoWarningsGuard g(no_format_warnings); (void)g;
264  
265 STRLEN patlen;
266 7 auto pat = SvPV(args[0], patlen);
267 7 ▶ Sv ret = Simple::create(patlen * 1.5);
Branch: 1 branch
BranchTrueFalseTotal
Sv ret = Simple::create(patlen * 1.5); 7 0 7
268 7 bool stub = false;
269 7 ▶ sv_vcatpvfn(ret, pat, patlen, nullptr, args + 1, items - 1, &stub);
Branch: 1 branch
BranchTrueFalseTotal
sv_vcatpvfn(ret, pat, patlen, nullptr, args + 1, items - 1, &stub); 5 0 5
270 5 return ret;
271 5 }
272 198 static inline void peep_args (SV**& args, I32& items, const Module*& module, Sub& sub) {
273 198 ▶ if (items && SvROK(args[0])) {
Branch: 2 branches
BranchTrueFalseTotal
if (items && SvROK(args[0])) { 160 38 198
if (items && SvROK(args[0])) { 66 94 160
274 66 auto first = SvRV(args[0]);
275 66 ▶ if (has_module(first)) {
Branch: 1 branch
BranchTrueFalseTotal
if (has_module(first)) { 59 7 66
276 59 module = xs::in<Module*>(first);
277 56 ++args;
278 56 --items;
279 }
280 7 ▶ else if (SvTYPE(first) == SVt_PVCV) {
Branch: 1 branch
BranchTrueFalseTotal
else if (SvTYPE(first) == SVt_PVCV) { 5 2 7
281 5 ▶ if (items > 1) throw exception("no arguments should follow subref when logging");
Branch: 1 branch
BranchTrueFalseTotal
if (items > 1) throw exception("no arguments should follow subref when logging"); 0 5 5
282 5 sub = first;
283 }
284 }
285  
286 195 ▶ if (!module) module = resolve_module(0); // auto detect module by namespace
Branch: 1 branch
BranchTrueFalseTotal
if (!module) module = resolve_module(0); // auto detect module by namespace 139 56 195
287 195 }
288 template<typename Log>
289 140 void forward(Log&& log, SV**& args, I32& items, Sub& sub) {
290 140 Simple msg;
291 140 ▶ if (sub) {
Branch: 1 branch
BranchTrueFalseTotal
if (sub) { 5 135 140
292 5 ▶ Sv ret = sub.call();
Branch: 1 branch
BranchTrueFalseTotal
Sv ret = sub.call(); 5 0 5
293 5 SV* sv = ret;
294 5 ▶ msg = format_args(&sv, 1);
Branch: 2 branches
BranchTrueFalseTotal
msg = format_args(&sv, 1); 5 0 5
msg = format_args(&sv, 1); 5 0 5
295 5 }
296 else {
297 135 ▶ msg = format_args(args, items);
Branch: 2 branches
BranchTrueFalseTotal
msg = format_args(args, items); 133 0 133
msg = format_args(args, items); 133 0 133
298 }
299 138 ▶ log << msg.as_string<string_view>();
Branch: 2 branches
BranchTrueFalseTotal
log << msg.as_string<string_view>(); 138 0 138
log << msg.as_string<string_view>(); 138 0 138
300 138 }
301 198 static void xslog (Level level, SV** args, I32 items) {
302 198 const Module* module = nullptr;
303 198 Sub sub;
304 198 ▶ peep_args(args, items, module, sub);
Branch: 1 branch
BranchTrueFalseTotal
peep_args(args, items, module, sub); 195 3 198
305 335 ▶ panda_log(level, *module, [&]{ forward(log, args, items, sub); });
Branch: 6 branches
BranchTrueFalseTotal
panda_log(level, *module, [&]{ forward(log, args, items, sub); }); 195 0 195
panda_log(level, *module, [&]{ forward(log, args, items, sub); }); 140 55 195
panda_log(level, *module, [&]{ forward(log, args, items, sub); }); 140 0 140
panda_log(level, *module, [&]{ forward(log, args, items, sub); }); 138 0 138
panda_log(level, *module, [&]{ forward(log, args, items, sub); }); 138 0 138
panda_log(level, *module, [&]{ forward(log, args, items, sub); }); 138 0 138
306 196 }
307  
308  
309 62 ▶XS_EUPXS(XS_XLog_set_level) { xs::throw_guard(cv, [=]()
Branch: 1 branch
BranchTrueFalseTotal
XS_EUPXS(XS_XLog_set_level) { xs::throw_guard(cv, [=]() 31 0 31
310 {
311 31 dVAR; dXSARGS;
312 31 ▶ if (items < 1 || items > 2)
Branch: 2 branches
BranchTrueFalseTotal
if (items < 1 || items > 2) 31 0 31
if (items < 1 || items > 2) 0 31 31
313 0 croak_xs_usage(cv, "level, module= {}");
314 PERL_UNUSED_VAR(ax); /* -Wall */
315 31 SP -= items;
316 {
317 31 ▶ Level level = xs::in<Level>(ST(0));
Branch: 1 branch
BranchTrueFalseTotal
Level level = xs::in<Level>(ST(0)); 31 0 31
318 ;
319 31 string_view module;
320  
321 31 ▶ if (items < 2)
Branch: 1 branch
BranchTrueFalseTotal
if (items < 2) 31 0 31
322 31 module = {};
323 else {
324 { STRLEN __module_len;
325 0 const char* __module_buf = SvPV(ST(1), __module_len);
326 0 module = decltype(module)(__module_buf, __module_len); }
327 ;
328 }
329 #line 177 "./xs/XLog.xsi"
330 set_level(level, module);
331 #line 332 "XLog_xsgen.cc"
332 31 PUTBACK;
333 62 return;
334 }
335 31 }); }
336  
337  
338  
339 110 ▶XS_EUPXS(XS_XLog_set_logger) { xs::throw_guard(cv, [=]()
Branch: 1 branch
BranchTrueFalseTotal
XS_EUPXS(XS_XLog_set_logger) { xs::throw_guard(cv, [=]() 55 0 55
340 {
341 55 dVAR; dXSARGS;
342 55 ▶ if (items != 1)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 1) 0 55 55
343 0 croak_xs_usage(cv, "logger");
344 PERL_UNUSED_VAR(ax); /* -Wall */
345 55 SP -= items;
346 {
347 55 ▶ ILoggerSP logger = xs::in<ILoggerSP>(ST(0));
Branch: 1 branch
BranchTrueFalseTotal
ILoggerSP logger = xs::in<ILoggerSP>(ST(0)); 55 0 55
348 ;
349 #line 179 "./xs/XLog.xsi"
350 set_logger(logger);
351 #line 352 "XLog_xsgen.cc"
352 55 PUTBACK;
353 110 return;
354 55 }
355 55 }); }
356  
357  
358  
359 104 ▶XS_EUPXS(XS_XLog_set_formatter) { xs::throw_guard(cv, [=]()
Branch: 1 branch
BranchTrueFalseTotal
XS_EUPXS(XS_XLog_set_formatter) { xs::throw_guard(cv, [=]() 52 0 52
360 {
361 52 dVAR; dXSARGS;
362 52 dXSI32;
363 52 ▶ if (items != 1)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 1) 0 52 52
364 0 croak_xs_usage(cv, "fmt");
365 PERL_UNUSED_VAR(ax); /* -Wall */
366 52 SP -= items;
367 {
368 52 ▶ IFormatterSP fmt = xs::in<IFormatterSP>(ST(0));
Branch: 1 branch
BranchTrueFalseTotal
IFormatterSP fmt = xs::in<IFormatterSP>(ST(0)); 52 0 52
369 ;
370 #line 182 "./xs/XLog.xsi"
371 (void)ix;
372 set_formatter(fmt);
373 #line 374 "XLog_xsgen.cc"
374 52 PUTBACK;
375 104 return;
376 52 }
377 52 }); }
378  
379  
380  
381 2 ▶XS_EUPXS(XS_XLog_get_logger) { xs::throw_guard(cv, [=]()
Branch: 1 branch
BranchTrueFalseTotal
XS_EUPXS(XS_XLog_get_logger) { xs::throw_guard(cv, [=]() 1 0 1
382 {
383 1 dVAR; dXSARGS;
384 1 ▶ if (items != 0)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 0) 0 1 1
385 0 croak_xs_usage(cv, "");
386 {
387 1 ILoggerSP RETVAL;
388 #line 186 "./xs/XLog.xsi"
389 xs::Sv PROTO; PERL_UNUSED_VAR(PROTO);
390 RETVAL = get_logger();
391 #line 392 "XLog_xsgen.cc"
392 {
393 SV * RETVALSV;
394 1 ▶ RETVALSV = xs::out(RETVAL, PROTO).detach();
Branch: 1 branch
BranchTrueFalseTotal
RETVALSV = xs::out(RETVAL, PROTO).detach(); 1 0 1
395 1 ▶ RETVALSV = sv_2mortal(RETVALSV);
Branch: 1 branch
BranchTrueFalseTotal
RETVALSV = sv_2mortal(RETVALSV); 1 0 1
396 1 ST(0) = RETVALSV;
397 }
398 1 }
399 1 XSRETURN(1);
400 1 }); }
401  
402  
403  
404 2 ▶XS_EUPXS(XS_XLog_get_formatter) { xs::throw_guard(cv, [=]()
Branch: 1 branch
BranchTrueFalseTotal
XS_EUPXS(XS_XLog_get_formatter) { xs::throw_guard(cv, [=]() 1 0 1
405 {
406 1 dVAR; dXSARGS;
407 1 ▶ if (items != 0)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 0) 0 1 1
408 0 croak_xs_usage(cv, "");
409 {
410 1 IFormatterSP RETVAL;
411 #line 188 "./xs/XLog.xsi"
412 xs::Sv PROTO; PERL_UNUSED_VAR(PROTO);
413 RETVAL = get_formatter();
414 #line 415 "XLog_xsgen.cc"
415 {
416 SV * RETVALSV;
417 1 ▶ RETVALSV = xs::out(RETVAL, PROTO).detach();
Branch: 1 branch
BranchTrueFalseTotal
RETVALSV = xs::out(RETVAL, PROTO).detach(); 1 0 1
418 1 ▶ RETVALSV = sv_2mortal(RETVALSV);
Branch: 1 branch
BranchTrueFalseTotal
RETVALSV = sv_2mortal(RETVALSV); 1 0 1
419 1 ST(0) = RETVALSV;
420 }
421 1 }
422 1 XSRETURN(1);
423 1 }); }
424  
425  
426  
427 6 ▶XS_EUPXS(XS_XLog_get_module) { xs::throw_guard(cv, [=]()
Branch: 1 branch
BranchTrueFalseTotal
XS_EUPXS(XS_XLog_get_module) { xs::throw_guard(cv, [=]() 3 0 3
428 {
429 3 dVAR; dXSARGS;
430 3 ▶ if (items != 1)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 1) 0 3 3
431 0 croak_xs_usage(cv, "name");
432 {
433 Module * RETVAL;
434 3 string_view name;
435  
436 { STRLEN __name_len;
437 3 const char* __name_buf = SvPV(ST(0), __name_len);
438 3 name = decltype(name)(__name_buf, __name_len); }
439 ;
440 #line 190 "./xs/XLog.xsi"
441 xs::Sv PROTO; PERL_UNUSED_VAR(PROTO);
442 RETVAL = get_module(name);
443 #line 444 "XLog_xsgen.cc"
444 {
445 SV * RETVALSV;
446 3 ▶ RETVALSV = xs::out(RETVAL, PROTO).detach();
Branch: 1 branch
BranchTrueFalseTotal
RETVALSV = xs::out(RETVAL, PROTO).detach(); 3 0 3
447 3 ▶ RETVALSV = sv_2mortal(RETVALSV);
Branch: 1 branch
BranchTrueFalseTotal
RETVALSV = sv_2mortal(RETVALSV); 3 0 3
448 3 ST(0) = RETVALSV;
449 }
450 3 }
451 3 XSRETURN(1);
452 3 }); }
453  
454  
455  
456 168 ▶XS_EUPXS(XS_XLog_log) { xs::throw_guard(cv, [=]()
Branch: 1 branch
BranchTrueFalseTotal
XS_EUPXS(XS_XLog_log) { xs::throw_guard(cv, [=]() 81 0 81
457 {
458 84 dVAR; dXSARGS;
459 84 ▶ if (items < 1)
Branch: 1 branch
BranchTrueFalseTotal
if (items < 1) 0 84 84
460 0 croak_xs_usage(cv, "level, ...");
461 PERL_UNUSED_VAR(ax); /* -Wall */
462 84 SP -= items;
463 {
464 84 Level level = xs::in<Level>(ST(0));
465 ;
466 #line 193 "./xs/XLog.xsi"
467 xslog(level, &ST(1), items-1);
468 if (!(PL_op->op_spare & 1)) xlog::optimize();
469 #line 470 "XLog_xsgen.cc"
470 81 PUTBACK;
471 81 return;
472 }
473 81 }); }
474  
475  
476  
477 40 ▶XS_EUPXS(XS_XLog_resolve_module) { xs::throw_guard(cv, [=]()
Branch: 1 branch
BranchTrueFalseTotal
XS_EUPXS(XS_XLog_resolve_module) { xs::throw_guard(cv, [=]() 20 0 20
478 {
479 20 dVAR; dXSARGS;
480 20 ▶ if (items < 0 || items > 1)
Branch: 2 branches
BranchTrueFalseTotal
if (items < 0 || items > 1) 20 0 20
if (items < 0 || items > 1) 0 20 20
481 0 croak_xs_usage(cv, "depth= 0");
482 {
483 Module * RETVAL;
484 size_t depth;
485  
486 20 ▶ if (items < 1)
Branch: 1 branch
BranchTrueFalseTotal
if (items < 1) 0 20 20
487 0 depth = 0;
488 else {
489 20 ▶ depth = (size_t)SvUV(ST(0))
Branch: 1 branch
BranchTrueFalseTotal
depth = (size_t)SvUV(ST(0)) 20 0 20
490 ;
491 }
492 #line 198 "./xs/XLog.xsi"
493 xs::Sv PROTO; PERL_UNUSED_VAR(PROTO);
494 RETVAL = resolve_module(depth);
495 #line 496 "XLog_xsgen.cc"
496 {
497 SV * RETVALSV;
498 20 ▶ RETVALSV = xs::out(RETVAL, PROTO).detach();
Branch: 1 branch
BranchTrueFalseTotal
RETVALSV = xs::out(RETVAL, PROTO).detach(); 20 0 20
499 20 ▶ RETVALSV = sv_2mortal(RETVALSV);
Branch: 1 branch
BranchTrueFalseTotal
RETVALSV = sv_2mortal(RETVALSV); 20 0 20
500 20 ST(0) = RETVALSV;
501 }
502 20 }
503 20 XSRETURN(1);
504 20 }); }
505  
506  
507  
508 4 ▶XS_EUPXS(XS_XLog_disable_format_warnings) { xs::throw_guard(cv, [=]()
Branch: 1 branch
BranchTrueFalseTotal
XS_EUPXS(XS_XLog_disable_format_warnings) { xs::throw_guard(cv, [=]() 2 0 2
509 {
510 2 dVAR; dXSARGS;
511 2 dXSI32;
512 2 ▶ if (items != 0)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 0) 0 2 2
513 0 croak_xs_usage(cv, "");
514 PERL_UNUSED_VAR(ax); /* -Wall */
515 2 SP -= items;
516 {
517 #line 202 "./xs/XLog.xsi"
518 no_format_warnings = !ix;
519 #line 520 "XLog_xsgen.cc"
520 2 PUTBACK;
521 2 return;
522 }
523 2 }); }
524  
525  
526  
527 228 ▶XS_EUPXS(XS_XLog___logXXX) { xs::throw_guard(cv, [=]()
Branch: 1 branch
BranchTrueFalseTotal
XS_EUPXS(XS_XLog___logXXX) { xs::throw_guard(cv, [=]() 112 0 112
528 {
529 114 dVAR; dXSARGS;
530 114 dXSI32;
531 PERL_UNUSED_VAR(cv); /* -W */
532 PERL_UNUSED_VAR(items); /* -W */
533 PERL_UNUSED_VAR(ax); /* -Wall */
534 114 SP -= items;
535 {
536 #line 206 "./xs/XLog.xsi"
537 Level level = Level((int)Level::VerboseDebug + ix);
538 xslog(level, &ST(0), items);
539 if (!(PL_op->op_spare & 1)) xlog::optimize(level);
540 #line 541 "XLog_xsgen.cc"
541 112 PUTBACK;
542 112 return;
543 }
544 112 }); }
545  
546  
547 /* INCLUDE: Returning to 'XLog.xs' from 'xs/XLog.xsi' */
548  
549  
550 /* INCLUDE: Including 'xs/Logger.xsi' from 'XLog.xs' */
551  
552  
553  
554 50 ▶XS_EUPXS(XS_XLog__Logger_new) { xs::throw_guard(cv, [=]()
Branch: 1 branch
BranchTrueFalseTotal
XS_EUPXS(XS_XLog__Logger_new) { xs::throw_guard(cv, [=]() 25 0 25
555 {
556 25 dVAR; dXSARGS;
557 25 ▶ if (items != 1)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 1) 0 25 25
558 0 croak_xs_usage(cv, "CLASS");
559 {
560 PerlObjectLogger * RETVAL;
561 25 SV* CLASS = ST(0)
562 ;
563 #line 9 "./xs/Logger.xsi"
564 xs::Sv PROTO; PERL_UNUSED_VAR(PROTO);
565 PROTO = CLASS;
566 PROTO = Stash::from_name(CLASS).bless(Hash::create());
567 RETVAL = new PerlObjectLogger();
568 #line 569 "XLog_xsgen.cc"
569 {
570 SV * RETVALSV;
571 25 ▶ RETVALSV = xs::out(RETVAL, PROTO).detach();
Branch: 1 branch
BranchTrueFalseTotal
RETVALSV = xs::out(RETVAL, PROTO).detach(); 25 0 25
572 25 ▶ RETVALSV = sv_2mortal(RETVALSV);
Branch: 1 branch
BranchTrueFalseTotal
RETVALSV = sv_2mortal(RETVALSV); 25 0 25
573 25 ST(0) = RETVALSV;
574 }
575 25 }
576 25 XSRETURN(1);
577 25 }); }
578  
579  
580 /* INCLUDE: Returning to 'XLog.xs' from 'xs/Logger.xsi' */
581  
582  
583 /* INCLUDE: Including 'xs/Formatter.xsi' from 'XLog.xs' */
584  
585  
586  
587 2 ▶XS_EUPXS(XS_XLog__Formatter_new) { xs::throw_guard(cv, [=]()
Branch: 1 branch
BranchTrueFalseTotal
XS_EUPXS(XS_XLog__Formatter_new) { xs::throw_guard(cv, [=]() 1 0 1
588 {
589 1 dVAR; dXSARGS;
590 1 ▶ if (items != 1)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 1) 0 1 1
591 0 croak_xs_usage(cv, "CLASS");
592 {
593 PerlObjectFormatter * RETVAL;
594 1 SV* CLASS = ST(0)
595 ;
596 #line 5 "./xs/Formatter.xsi"
597 xs::Sv PROTO; PERL_UNUSED_VAR(PROTO);
598 PROTO = CLASS;
599 PROTO = Stash::from_name(CLASS).bless(Hash::create());
600 RETVAL = new PerlObjectFormatter();
601 #line 602 "XLog_xsgen.cc"
602 {
603 SV * RETVALSV;
604 1 ▶ RETVALSV = xs::out(RETVAL, PROTO).detach();
Branch: 1 branch
BranchTrueFalseTotal
RETVALSV = xs::out(RETVAL, PROTO).detach(); 1 0 1
605 1 ▶ RETVALSV = sv_2mortal(RETVALSV);
Branch: 1 branch
BranchTrueFalseTotal
RETVALSV = sv_2mortal(RETVALSV); 1 0 1
606 1 ST(0) = RETVALSV;
607 }
608 1 }
609 1 XSRETURN(1);
610 1 }); }
611  
612 static const char* DECORATOR_KEY = "_decorator";
613 // let it be only script basename, without file
614 8 static string decorate_default(const char* name) {
615 8 string in(name);
616 8 ▶ auto pos = in.find_last_of("/\\");
Branch: 1 branch
BranchTrueFalseTotal
auto pos = in.find_last_of("/\\"); 8 0 8
617 8 ▶ if (pos == string::npos) {
Branch: 1 branch
BranchTrueFalseTotal
if (pos == string::npos) { 0 8 8
618 0 ▶ return in;
Branch: 1 branch
BranchTrueFalseTotal
return in; 0 0 0
619 }
620 8 ▶ return in.substr(pos + 1);
Branch: 1 branch
BranchTrueFalseTotal
return in.substr(pos + 1); 8 0 8
621 8 }
622 static xs::Sv::payload_marker_t spy_$0_marker{};
623 1 static int spy_$0(pTHX_ SV* sv, MAGIC* mg) {
624 1 ▶ if (mg->mg_virtual == &spy_$0_marker) {
Branch: 1 branch
BranchTrueFalseTotal
if (mg->mg_virtual == &spy_$0_marker) { 1 0 1
625 1 ▶ Stash stash("XLog::Formatter::Pattern");
Branch: 1 branch
BranchTrueFalseTotal
Stash stash("XLog::Formatter::Pattern"); 1 0 1
626 1 ▶ auto decorator = stash.sub(DECORATOR_KEY);
Branch: 1 branch
BranchTrueFalseTotal
auto decorator = stash.sub(DECORATOR_KEY); 1 0 1
627 1 string $0;
628 1 ▶ if (decorator) {
Branch: 1 branch
BranchTrueFalseTotal
if (decorator) { 1 0 1
629 1 ▶ auto decorated = decorator.call(sv);
Branch: 1 branch
BranchTrueFalseTotal
auto decorated = decorator.call(sv); 1 0 1
630 2 ▶ $0 = SvPV_nolen(decorated);
Branch: 1 branch
BranchTrueFalseTotal
$0 = SvPV_nolen(decorated); 1 0 1
631 1 }
632 else {
633 0 ▶ $0 = decorate_default(SvPV_nolen(sv));
Branch: 2 branches
BranchTrueFalseTotal
$0 = decorate_default(SvPV_nolen(sv)); 0 0 0
$0 = decorate_default(SvPV_nolen(sv)); 0 0 0
634 }
635 1 set_program_name($0);
636 1 }
637 1 return 0;
638 }
639  
640  
641 2 ▶XS_EUPXS(XS_XLog__Formatter__Pattern_new) { xs::throw_guard(cv, [=]()
Branch: 1 branch
BranchTrueFalseTotal
XS_EUPXS(XS_XLog__Formatter__Pattern_new) { xs::throw_guard(cv, [=]() 1 0 1
642 {
643 1 dVAR; dXSARGS;
644 1 ▶ if (items != 2)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 2) 0 1 1
645 0 croak_xs_usage(cv, "CLASS, fmt");
646 {
647 IFormatter * RETVAL;
648 1 SV* CLASS = ST(0)
649 ;
650 1 string_view fmt;
651  
652 { STRLEN __fmt_len;
653 1 const char* __fmt_buf = SvPV(ST(1), __fmt_len);
654 1 fmt = decltype(fmt)(__fmt_buf, __fmt_len); }
655 ;
656 #line 67 "./xs/Formatter.xsi"
657 xs::Sv PROTO; PERL_UNUSED_VAR(PROTO);
658 PROTO = CLASS;
659 RETVAL = new PatternFormatter(fmt);
660 #line 661 "XLog_xsgen.cc"
661 {
662 SV * RETVALSV;
663 1 ▶ RETVALSV = xs::out(RETVAL, PROTO).detach();
Branch: 1 branch
BranchTrueFalseTotal
RETVALSV = xs::out(RETVAL, PROTO).detach(); 1 0 1
664 1 ▶ RETVALSV = sv_2mortal(RETVALSV);
Branch: 1 branch
BranchTrueFalseTotal
RETVALSV = sv_2mortal(RETVALSV); 1 0 1
665 1 ST(0) = RETVALSV;
666 }
667 1 }
668 1 XSRETURN(1);
669 1 }); }
670  
671  
672  
673 2 ▶XS_EUPXS(XS_XLog__Formatter__Pattern_set_program_decorator) { xs::throw_guard(cv, [=]()
Branch: 1 branch
BranchTrueFalseTotal
XS_EUPXS(XS_XLog__Formatter__Pattern_set_program_decorator) { xs::throw_guard(cv, [=]() 1 0 1
674 {
675 1 dVAR; dXSARGS;
676 1 ▶ if (items != 1)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 1) 0 1 1
677 0 croak_xs_usage(cv, "callback");
678 PERL_UNUSED_VAR(ax); /* -Wall */
679 1 SP -= items;
680 {
681 1 ▶ Sub callback = ST(0);
Branch: 1 branch
BranchTrueFalseTotal
Sub callback = ST(0); 1 0 1
682 1 ▶ if (!callback && SvOK(ST(0))) throw "arg is not a 'Sub' reference"
Branch: 3 branches
BranchTrueFalseTotal
if (!callback && SvOK(ST(0))) throw "arg is not a 'Sub' reference" 0 1 1
if (!callback && SvOK(ST(0))) throw "arg is not a 'Sub' reference" 0 0 0
if (!callback && SvOK(ST(0))) throw "arg is not a 'Sub' reference" 0 1 1
683 ;
684 #line 70 "./xs/Formatter.xsi"
685 Stash stash("XLog::Formatter::Pattern");
686 stash.store(DECORATOR_KEY, callback);
687 #line 688 "XLog_xsgen.cc"
688 1 PUTBACK;
689 2 return;
690 1 }
691 1 }); }
692  
693  
694 /* INCLUDE: Returning to 'XLog.xs' from 'xs/Formatter.xsi' */
695  
696  
697 /* INCLUDE: Including 'xs/Module.xsi' from 'XLog.xs' */
698  
699  
700  
701 48 ▶XS_EUPXS(XS_XLog__Module_new) { xs::throw_guard(cv, [=]()
Branch: 1 branch
BranchTrueFalseTotal
XS_EUPXS(XS_XLog__Module_new) { xs::throw_guard(cv, [=]() 24 0 24
702 {
703 24 dVAR; dXSARGS;
704 24 ▶ if (items < 2 || items > 4)
Branch: 2 branches
BranchTrueFalseTotal
if (items < 2 || items > 4) 24 0 24
if (items < 2 || items > 4) 0 24 24
705 0 croak_xs_usage(cv, "cls, name, arg1= {}, arg2= {}");
706 {
707 24 Sv RETVAL;
708 24 SV* cls = ST(0)
709 ;
710 24 string name;
711 24 Sv arg1;
712 24 Sv arg2;
713  
714 { STRLEN __name_len;
715 24 const char* __name_buf = SvPV(ST(1), __name_len);
716 24 ▶ name.assign(__name_buf, __name_len); }
Branch: 1 branch
BranchTrueFalseTotal
name.assign(__name_buf, __name_len); } 24 0 24
717 ;
718  
719 24 ▶ if (items < 3)
Branch: 1 branch
BranchTrueFalseTotal
if (items < 3) 8 16 24
720 8 arg1 = {};
721 else {
722 16 ▶ arg1 = ST(2)
Branch: 1 branch
BranchTrueFalseTotal
arg1 = ST(2) 16 0 16
723 ;
724 }
725  
726 24 ▶ if (items < 4)
Branch: 1 branch
BranchTrueFalseTotal
if (items < 4) 23 1 24
727 23 arg2 = {};
728 else {
729 1 ▶ arg2 = ST(3)
Branch: 1 branch
BranchTrueFalseTotal
arg2 = ST(3) 1 0 1
730 ;
731 }
732 #line 7 "./xs/Module.xsi"
733 --items;
734 Module* module;
735 if (items == 1) {
736 module = new Module(name);
737 }
738 else if (items == 2) {
739 if (!arg1.defined() || arg1.is_object_ref()) module = new Module(name, xs::in<Module*>(arg1));
740 else module = new Module(name, xs::in<Level>(arg1));
741 } else {
742 module = new Module(name, xs::in<Module*>(arg1), xs::in<Level>(arg2));
743 }
744  
745 // Module* has non-owning ptr typemap. In case of creating object from perl we must switch to "owning" behaviour
746 // so we need to hook sv destruction and delete the object if we created it in this method.
747 static Sv::payload_marker_t module_dtor_marker;
748 module_dtor_marker.svt_free = [](pTHX_ SV*, MAGIC* mg) {
749 delete (Module*)mg->mg_ptr;
750 return 0;
751 };
752  
753 Object o = xs::out(module, cls);
754 o.payload_attach(module, &module_dtor_marker);
755  
756 RETVAL = o.ref();
757 #line 758 "XLog_xsgen.cc"
758 {
759 SV * RETVALSV;
760 24 RETVALSV = NULL;
761 24 ▶ if (!RETVAL) XSRETURN_UNDEF;
Branch: 1 branch
BranchTrueFalseTotal
if (!RETVAL) XSRETURN_UNDEF; 0 24 24
762 24 ▶ if (RETVAL.is_scalar()) RETVALSV = RETVAL.detach();
Branch: 2 branches
BranchTrueFalseTotal
if (RETVAL.is_scalar()) RETVALSV = RETVAL.detach(); 24 0 24
if (RETVAL.is_scalar()) RETVALSV = RETVAL.detach(); 24 0 24
763 0 else switch (RETVAL.type()) {
764 0 ▶ case SVt_PVAV: XSRETURN(xs::Array(RETVAL.get<AV>()).push_on_stack(MARK));
Branch: 2 branches
BranchTrueFalseTotal
case SVt_PVAV: XSRETURN(xs::Array(RETVAL.get<AV>()).push_on_stack(MARK)); 0 0 0
case SVt_PVAV: XSRETURN(xs::Array(RETVAL.get<AV>()).push_on_stack(MARK)); 0 0 0
765 0 ▶ case SVt_PVHV: XSRETURN(xs::Hash(RETVAL.get<HV>()).push_on_stack(MARK));
Branch: 2 branches
BranchTrueFalseTotal
case SVt_PVHV: XSRETURN(xs::Hash(RETVAL.get<HV>()).push_on_stack(MARK)); 0 0 0
case SVt_PVHV: XSRETURN(xs::Hash(RETVAL.get<HV>()).push_on_stack(MARK)); 0 0 0
766 0 case SVt_PVCV:
767 case SVt_PVIO:
768 0 ▶ RETVALSV = newRV_noinc(RETVAL.detach());
Branch: 1 branch
BranchTrueFalseTotal
RETVALSV = newRV_noinc(RETVAL.detach()); 0 0 0
769 0 break;
770 0 default: throw "unknown type of Sv to return";
771 }
772 24 ▶ RETVALSV = sv_2mortal(RETVALSV);
Branch: 1 branch
BranchTrueFalseTotal
RETVALSV = sv_2mortal(RETVALSV); 24 0 24
773 24 ST(0) = RETVALSV;
774 }
775 24 ▶ }
Branch: 5 branches
BranchTrueFalseTotal
} 24 0 24
} 24 0 24
} 24 0 24
} 24 0 24
} 24 0 24
776 24 XSRETURN(1);
777 24 }); }
778  
779  
780  
781 8 ▶XS_EUPXS(XS_XLog__Module_name) { xs::throw_guard(cv, [=]()
Branch: 1 branch
BranchTrueFalseTotal
XS_EUPXS(XS_XLog__Module_name) { xs::throw_guard(cv, [=]() 4 0 4
782 {
783 4 dVAR; dXSARGS;
784 4 ▶ if (items != 1)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 1) 0 4 4
785 0 croak_xs_usage(cv, "THIS");
786 {
787 4 string RETVAL;
788 4 ▶ dXSTARG;
Branch: 2 branches
BranchTrueFalseTotal
dXSTARG; 4 0 4
dXSTARG; 0 0 0
789 4 ▶ Module* THIS = xs::in<Module *>(ST(0)); if (!SvOK(ST(0))) throw "undef not allowed as THIS";
Branch: 2 branches
BranchTrueFalseTotal
Module* THIS = xs::in<Module *>(ST(0)); if (!SvOK(ST(0))) throw "undef not allowed as THIS"; 4 0 4
Module* THIS = xs::in<Module *>(ST(0)); if (!SvOK(ST(0))) throw "undef not allowed as THIS"; 0 4 4
790 ;
791 #line 33 "./xs/Module.xsi"
792 RETVAL = THIS->name();
793 #line 794 "XLog_xsgen.cc"
794 4 ▶ sv_setpvn((SV*)TARG, RETVAL.data(), RETVAL.length());
Branch: 1 branch
BranchTrueFalseTotal
sv_setpvn((SV*)TARG, RETVAL.data(), RETVAL.length()); 4 0 4
795 4 ST(0) = TARG;
796 4 }
797 4 XSRETURN(1);
798 4 }); }
799  
800  
801  
802 10 ▶XS_EUPXS(XS_XLog__Module_level) { xs::throw_guard(cv, [=]()
Branch: 1 branch
BranchTrueFalseTotal
XS_EUPXS(XS_XLog__Module_level) { xs::throw_guard(cv, [=]() 5 0 5
803 {
804 5 dVAR; dXSARGS;
805 5 ▶ if (items != 1)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 1) 0 5 5
806 0 croak_xs_usage(cv, "THIS");
807 {
808 Level RETVAL;
809 5 ▶ Module* THIS = xs::in<Module *>(ST(0)); if (!SvOK(ST(0))) throw "undef not allowed as THIS";
Branch: 2 branches
BranchTrueFalseTotal
Module* THIS = xs::in<Module *>(ST(0)); if (!SvOK(ST(0))) throw "undef not allowed as THIS"; 5 0 5
Module* THIS = xs::in<Module *>(ST(0)); if (!SvOK(ST(0))) throw "undef not allowed as THIS"; 0 5 5
810 ;
811 #line 35 "./xs/Module.xsi"
812 xs::Sv PROTO; PERL_UNUSED_VAR(PROTO);
813 RETVAL = THIS->level();
814 #line 815 "XLog_xsgen.cc"
815 {
816 SV * RETVALSV;
817 5 ▶ RETVALSV = xs::out(RETVAL, PROTO).detach();
Branch: 1 branch
BranchTrueFalseTotal
RETVALSV = xs::out(RETVAL, PROTO).detach(); 5 0 5
818 5 ▶ RETVALSV = sv_2mortal(RETVALSV);
Branch: 1 branch
BranchTrueFalseTotal
RETVALSV = sv_2mortal(RETVALSV); 5 0 5
819 5 ST(0) = RETVALSV;
820 }
821 5 }
822 5 XSRETURN(1);
823 5 }); }
824  
825  
826  
827 0 ▶XS_EUPXS(XS_XLog__Module_passthrough) { xs::throw_guard(cv, [=]()
Branch: 1 branch
BranchTrueFalseTotal
XS_EUPXS(XS_XLog__Module_passthrough) { xs::throw_guard(cv, [=]() 0 0 0
828 {
829 0 dVAR; dXSARGS;
830 0 ▶ if (items != 1)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 1) 0 0 0
831 0 croak_xs_usage(cv, "THIS");
832 {
833 bool RETVAL;
834 0 ▶ Module* THIS = xs::in<Module *>(ST(0)); if (!SvOK(ST(0))) throw "undef not allowed as THIS";
Branch: 1 branch
BranchTrueFalseTotal
Module* THIS = xs::in<Module *>(ST(0)); if (!SvOK(ST(0))) throw "undef not allowed as THIS"; 0 0 0
835 ;
836 #line 37 "./xs/Module.xsi"
837 RETVAL = THIS->passthrough();
838 #line 839 "XLog_xsgen.cc"
839 0 ▶ ST(0) = boolSV(RETVAL);
Branch: 1 branch
BranchTrueFalseTotal
ST(0) = boolSV(RETVAL); 0 0 0
840 }
841 0 XSRETURN(1);
842 0 }); }
843  
844  
845  
846 4 ▶XS_EUPXS(XS_XLog__Module_set_level) { xs::throw_guard(cv, [=]()
Branch: 1 branch
BranchTrueFalseTotal
XS_EUPXS(XS_XLog__Module_set_level) { xs::throw_guard(cv, [=]() 2 0 2
847 {
848 2 dVAR; dXSARGS;
849 2 ▶ if (items != 2)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 2) 0 2 2
850 0 croak_xs_usage(cv, "THIS, level");
851 PERL_UNUSED_VAR(ax); /* -Wall */
852 2 SP -= items;
853 {
854 2 ▶ Module* THIS = xs::in<Module *>(ST(0)); if (!SvOK(ST(0))) throw "undef not allowed as THIS";
Branch: 1 branch
BranchTrueFalseTotal
Module* THIS = xs::in<Module *>(ST(0)); if (!SvOK(ST(0))) throw "undef not allowed as THIS"; 0 2 2
855 ;
856 2 Level level = xs::in<Level>(ST(1));
857 ;
858 #line 39 "./xs/Module.xsi"
859 THIS->set_level(level);
860 #line 861 "XLog_xsgen.cc"
861 2 PUTBACK;
862 2 return;
863 }
864 2 }); }
865  
866  
867  
868 8 ▶XS_EUPXS(XS_XLog__Module_set_logger) { xs::throw_guard(cv, [=]()
Branch: 1 branch
BranchTrueFalseTotal
XS_EUPXS(XS_XLog__Module_set_logger) { xs::throw_guard(cv, [=]() 4 0 4
869 {
870 4 dVAR; dXSARGS;
871 4 ▶ if (items < 2 || items > 3)
Branch: 2 branches
BranchTrueFalseTotal
if (items < 2 || items > 3) 4 0 4
if (items < 2 || items > 3) 0 4 4
872 0 croak_xs_usage(cv, "THIS, logger, passthrough= false");
873 PERL_UNUSED_VAR(ax); /* -Wall */
874 4 SP -= items;
875 {
876 4 ▶ Module* THIS = xs::in<Module *>(ST(0)); if (!SvOK(ST(0))) throw "undef not allowed as THIS";
Branch: 2 branches
BranchTrueFalseTotal
Module* THIS = xs::in<Module *>(ST(0)); if (!SvOK(ST(0))) throw "undef not allowed as THIS"; 4 0 4
Module* THIS = xs::in<Module *>(ST(0)); if (!SvOK(ST(0))) throw "undef not allowed as THIS"; 0 4 4
877 ;
878 4 ▶ ILoggerSP logger = xs::in<ILoggerSP>(ST(1));
Branch: 1 branch
BranchTrueFalseTotal
ILoggerSP logger = xs::in<ILoggerSP>(ST(1)); 4 0 4
879 ;
880 bool passthrough;
881  
882 4 ▶ if (items < 3)
Branch: 1 branch
BranchTrueFalseTotal
if (items < 3) 3 1 4
883 3 passthrough = false;
884 else {
885 1 ▶ passthrough = (bool)SvTRUE(ST(2))
Branch: 1 branch
BranchTrueFalseTotal
passthrough = (bool)SvTRUE(ST(2)) 1 0 1
886 ;
887 }
888 #line 41 "./xs/Module.xsi"
889 THIS->set_logger(logger, passthrough);
890 #line 891 "XLog_xsgen.cc"
891 4 PUTBACK;
892 8 return;
893 4 }
894 4 }); }
895  
896  
897  
898 4 ▶XS_EUPXS(XS_XLog__Module_set_formatter) { xs::throw_guard(cv, [=]()
Branch: 1 branch
BranchTrueFalseTotal
XS_EUPXS(XS_XLog__Module_set_formatter) { xs::throw_guard(cv, [=]() 2 0 2
899 {
900 2 dVAR; dXSARGS;
901 2 ▶ if (items != 2)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 2) 0 2 2
902 0 croak_xs_usage(cv, "THIS, formatter");
903 PERL_UNUSED_VAR(ax); /* -Wall */
904 2 SP -= items;
905 {
906 2 ▶ Module* THIS = xs::in<Module *>(ST(0)); if (!SvOK(ST(0))) throw "undef not allowed as THIS";
Branch: 2 branches
BranchTrueFalseTotal
Module* THIS = xs::in<Module *>(ST(0)); if (!SvOK(ST(0))) throw "undef not allowed as THIS"; 2 0 2
Module* THIS = xs::in<Module *>(ST(0)); if (!SvOK(ST(0))) throw "undef not allowed as THIS"; 0 2 2
907 ;
908 2 ▶ IFormatterSP formatter = xs::in<IFormatterSP>(ST(1));
Branch: 1 branch
BranchTrueFalseTotal
IFormatterSP formatter = xs::in<IFormatterSP>(ST(1)); 2 0 2
909 ;
910 #line 43 "./xs/Module.xsi"
911 THIS->set_formatter(formatter);
912 #line 913 "XLog_xsgen.cc"
913 2 PUTBACK;
914 4 return;
915 2 }
916 2 }); }
917  
918  
919  
920 0 ▶XS_EUPXS(XS_XLog__Module_get_logger) { xs::throw_guard(cv, [=]()
Branch: 1 branch
BranchTrueFalseTotal
XS_EUPXS(XS_XLog__Module_get_logger) { xs::throw_guard(cv, [=]() 0 0 0
921 {
922 0 dVAR; dXSARGS;
923 0 ▶ if (items != 1)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 1) 0 0 0
924 0 croak_xs_usage(cv, "THIS");
925 {
926 0 ILoggerSP RETVAL;
927 0 ▶ Module* THIS = xs::in<Module *>(ST(0)); if (!SvOK(ST(0))) throw "undef not allowed as THIS";
Branch: 2 branches
BranchTrueFalseTotal
Module* THIS = xs::in<Module *>(ST(0)); if (!SvOK(ST(0))) throw "undef not allowed as THIS"; 0 0 0
Module* THIS = xs::in<Module *>(ST(0)); if (!SvOK(ST(0))) throw "undef not allowed as THIS"; 0 0 0
928 ;
929 #line 45 "./xs/Module.xsi"
930 xs::Sv PROTO; PERL_UNUSED_VAR(PROTO);
931 RETVAL = THIS->get_logger();
932 #line 933 "XLog_xsgen.cc"
933 {
934 SV * RETVALSV;
935 0 ▶ RETVALSV = xs::out(RETVAL, PROTO).detach();
Branch: 1 branch
BranchTrueFalseTotal
RETVALSV = xs::out(RETVAL, PROTO).detach(); 0 0 0
936 0 ▶ RETVALSV = sv_2mortal(RETVALSV);
Branch: 1 branch
BranchTrueFalseTotal
RETVALSV = sv_2mortal(RETVALSV); 0 0 0
937 0 ST(0) = RETVALSV;
938 }
939 0 }
940 0 XSRETURN(1);
941 0 }); }
942  
943  
944  
945 0 ▶XS_EUPXS(XS_XLog__Module_get_formatter) { xs::throw_guard(cv, [=]()
Branch: 1 branch
BranchTrueFalseTotal
XS_EUPXS(XS_XLog__Module_get_formatter) { xs::throw_guard(cv, [=]() 0 0 0
946 {
947 0 dVAR; dXSARGS;
948 0 ▶ if (items != 1)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 1) 0 0 0
949 0 croak_xs_usage(cv, "THIS");
950 {
951 0 IFormatterSP RETVAL;
952 0 ▶ Module* THIS = xs::in<Module *>(ST(0)); if (!SvOK(ST(0))) throw "undef not allowed as THIS";
Branch: 2 branches
BranchTrueFalseTotal
Module* THIS = xs::in<Module *>(ST(0)); if (!SvOK(ST(0))) throw "undef not allowed as THIS"; 0 0 0
Module* THIS = xs::in<Module *>(ST(0)); if (!SvOK(ST(0))) throw "undef not allowed as THIS"; 0 0 0
953 ;
954 #line 47 "./xs/Module.xsi"
955 xs::Sv PROTO; PERL_UNUSED_VAR(PROTO);
956 RETVAL = THIS->get_formatter();
957 #line 958 "XLog_xsgen.cc"
958 {
959 SV * RETVALSV;
960 0 ▶ RETVALSV = xs::out(RETVAL, PROTO).detach();
Branch: 1 branch
BranchTrueFalseTotal
RETVALSV = xs::out(RETVAL, PROTO).detach(); 0 0 0
961 0 ▶ RETVALSV = sv_2mortal(RETVALSV);
Branch: 1 branch
BranchTrueFalseTotal
RETVALSV = sv_2mortal(RETVALSV); 0 0 0
962 0 ST(0) = RETVALSV;
963 }
964 0 }
965 0 XSRETURN(1);
966 0 }); }
967  
968  
969 /* INCLUDE: Returning to 'XLog.xs' from 'xs/Module.xsi' */
970  
971  
972 /* INCLUDE: Including 'xs/Console.xsi' from 'XLog.xs' */
973  
974 #include <panda/log/console.h>
975 struct XSConsoleLogger : ConsoleLogger {
976 using ConsoleLogger::ConsoleLogger;
977  
978 1 void log (const string& msg, const Info&) override {
979 1 ▶ Io io = PL_defoutgv;
Branch: 1 branch
BranchTrueFalseTotal
Io io = PL_defoutgv; 1 0 1
980 1 ▶ if (!io) return;
Branch: 1 branch
BranchTrueFalseTotal
if (!io) return; 0 1 1
981 1 auto fp = io.ofp();
982 1 ▶ if (!fp) return;
Branch: 1 branch
BranchTrueFalseTotal
if (!fp) return; 0 1 1
983 1 ▶ PerlIO_write(fp, msg.data(), msg.length());
Branch: 1 branch
BranchTrueFalseTotal
PerlIO_write(fp, msg.data(), msg.length()); 1 0 1
984 1 ▶ PerlIO_write(fp, "\n", 1);
Branch: 1 branch
BranchTrueFalseTotal
PerlIO_write(fp, "\n", 1); 1 0 1
985 1 ▶ }
Branch: 1 branch
BranchTrueFalseTotal
} 1 0 1
986 };
987 namespace xs {
988 template <class TYPE> struct Typemap<ConsoleLogger*, TYPE> : Typemap<ILogger*, TYPE> {
989 0 static string package () { return "XLog::Console"; }
990 };
991 template <> struct Typemap<XSConsoleLogger*> : Typemap<ConsoleLogger*, XSConsoleLogger*> {};
992 }
993  
994  
995 2 ▶XS_EUPXS(XS_XLog__Console_new) { xs::throw_guard(cv, [=]()
Branch: 1 branch
BranchTrueFalseTotal
XS_EUPXS(XS_XLog__Console_new) { xs::throw_guard(cv, [=]() 1 0 1
996 {
997 1 dVAR; dXSARGS;
998 1 ▶ if (items != 1)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 1) 0 1 1
999 0 croak_xs_usage(cv, "CLASS");
1000 {
1001 XSConsoleLogger * RETVAL;
1002 1 SV* CLASS = ST(0)
1003 ;
1004 #line 31 "./xs/Console.xsi"
1005 xs::Sv PROTO; PERL_UNUSED_VAR(PROTO);
1006 PROTO = CLASS;
1007 RETVAL = new XSConsoleLogger();
1008 #line 1009 "XLog_xsgen.cc"
1009 {
1010 SV * RETVALSV;
1011 1 ▶ RETVALSV = xs::out(RETVAL, PROTO).detach();
Branch: 1 branch
BranchTrueFalseTotal
RETVALSV = xs::out(RETVAL, PROTO).detach(); 1 0 1
1012 1 ▶ RETVALSV = sv_2mortal(RETVALSV);
Branch: 1 branch
BranchTrueFalseTotal
RETVALSV = sv_2mortal(RETVALSV); 1 0 1
1013 1 ST(0) = RETVALSV;
1014 }
1015 1 }
1016 1 XSRETURN(1);
1017 1 }); }
1018  
1019  
1020 /* INCLUDE: Returning to 'XLog.xs' from 'xs/Console.xsi' */
1021  
1022  
1023 /* INCLUDE: Including 'xs/Multi.xsi' from 'XLog.xs' */
1024  
1025 #include <panda/log/multi.h>
1026 namespace xs {
1027 template <> struct Typemap<MultiLogger::Channel> : TypemapBase<MultiLogger::Channel> {
1028 8 static MultiLogger::Channel in (const Hash& h) {
1029 8 ▶ auto ret = MultiLogger::Channel(xs::in<ILoggerSP>(h.fetch("logger")));
Branch: 5 branches
BranchTrueFalseTotal
auto ret = MultiLogger::Channel(xs::in<ILoggerSP>(h.fetch("logger"))); 8 0 8
auto ret = MultiLogger::Channel(xs::in<ILoggerSP>(h.fetch("logger"))); 8 0 8
auto ret = MultiLogger::Channel(xs::in<ILoggerSP>(h.fetch("logger"))); 8 0 8
auto ret = MultiLogger::Channel(xs::in<ILoggerSP>(h.fetch("logger"))); 8 0 8
auto ret = MultiLogger::Channel(xs::in<ILoggerSP>(h.fetch("logger"))); 8 0 8
1030 8 Sv val;
1031 8 ▶ if ((val = h.fetch("min_level"))) ret.min_level = xs::in<Level>(val);
Branch: 3 branches
BranchTrueFalseTotal
if ((val = h.fetch("min_level"))) ret.min_level = xs::in<Level>(val); 8 0 8
if ((val = h.fetch("min_level"))) ret.min_level = xs::in<Level>(val); 8 0 8
if ((val = h.fetch("min_level"))) ret.min_level = xs::in<Level>(val); 8 0 8
1032 8 ▶ if ((val = h.fetch("formatter"))) ret.formatter = xs::in<IFormatterSP>(val);
Branch: 3 branches
BranchTrueFalseTotal
if ((val = h.fetch("formatter"))) ret.formatter = xs::in<IFormatterSP>(val); 8 0 8
if ((val = h.fetch("formatter"))) ret.formatter = xs::in<IFormatterSP>(val); 4 4 8
if ((val = h.fetch("formatter"))) ret.formatter = xs::in<IFormatterSP>(val); 4 0 4
1033 8 ▶ if ((val = h.fetch("format")) && val.defined()) {
Branch: 7 branches
BranchTrueFalseTotal
if ((val = h.fetch("format")) && val.defined()) { 8 0 8
if ((val = h.fetch("format")) && val.defined()) { 0 8 8
if ((val = h.fetch("format")) && val.defined()) { 0 0 0
if ((val = h.fetch("format")) && val.defined()) { 0 0 0
if ((val = h.fetch("format")) && val.defined()) { 8 0 8
if ((val = h.fetch("format")) && val.defined()) { 0 8 8
if ((val = h.fetch("format")) && val.defined()) { 0 0 0
1034 0 ▶ auto fmt = xs::in<string_view>(val);
Branch: 1 branch
BranchTrueFalseTotal
auto fmt = xs::in<string_view>(val); 0 0 0
1035 0 ▶ if (fmt.length()) ret.formatter = new PatternFormatter(fmt);
Branch: 4 branches
BranchTrueFalseTotal
if (fmt.length()) ret.formatter = new PatternFormatter(fmt); 0 0 0
if (fmt.length()) ret.formatter = new PatternFormatter(fmt); 0 0 0
if (fmt.length()) ret.formatter = new PatternFormatter(fmt); 0 0 0
if (fmt.length()) ret.formatter = new PatternFormatter(fmt); 0 0 0
1036 }
1037 16 return ret;
1038 8 }
1039 };
1040  
1041 template <> struct Typemap<MultiLogger*> : Typemap<ILogger*, MultiLogger*> {
1042 0 static string package () { return "XLog::Multi"; }
1043 };
1044 }
1045  
1046  
1047 4 ▶XS_EUPXS(XS_XLog__Multi_new) { xs::throw_guard(cv, [=]()
Branch: 1 branch
BranchTrueFalseTotal
XS_EUPXS(XS_XLog__Multi_new) { xs::throw_guard(cv, [=]() 2 0 2
1048 {
1049 2 dVAR; dXSARGS;
1050 2 ▶ if (items != 2)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 2) 0 2 2
1051 0 croak_xs_usage(cv, "CLASS, list");
1052 {
1053 MultiLogger * RETVAL;
1054 2 SV* CLASS = ST(0)
1055 ;
1056 2 ▶ MultiLogger::Channels list = xs::in<MultiLogger::Channels>(ST(1));
Branch: 1 branch
BranchTrueFalseTotal
MultiLogger::Channels list = xs::in<MultiLogger::Channels>(ST(1)); 2 0 2
1057 ;
1058 #line 31 "./xs/Multi.xsi"
1059 xs::Sv PROTO; PERL_UNUSED_VAR(PROTO);
1060 PROTO = CLASS;
1061 RETVAL = new MultiLogger(list);
1062 #line 1063 "XLog_xsgen.cc"
1063 {
1064 SV * RETVALSV;
1065 2 ▶ RETVALSV = xs::out(RETVAL, PROTO).detach();
Branch: 1 branch
BranchTrueFalseTotal
RETVALSV = xs::out(RETVAL, PROTO).detach(); 2 0 2
1066 2 ▶ RETVALSV = sv_2mortal(RETVALSV);
Branch: 1 branch
BranchTrueFalseTotal
RETVALSV = sv_2mortal(RETVALSV); 2 0 2
1067 2 ST(0) = RETVALSV;
1068 }
1069 2 }
1070 2 XSRETURN(1);
1071 2 }); }
1072  
1073  
1074 /* INCLUDE: Returning to 'XLog.xs' from 'xs/Multi.xsi' */
1075  
1076 #ifdef __cplusplus
1077 extern "C" {
1078 #endif
1079  
1080 16 ▶XS_EXTERNAL(boot_XLog) { xs::throw_guard(cv, [=]() mutable
Branch: 1 branch
BranchTrueFalseTotal
XS_EXTERNAL(boot_XLog) { xs::throw_guard(cv, [=]() mutable 8 0 8
1081 {
1082 #if PERL_VERSION_LE(5, 21, 5)
1083 dVAR; dXSARGS;
1084 #else
1085 8 dVAR; dXSBOOTARGSXSAPIVERCHK;
1086 #endif
1087 #if PERL_VERSION_LE(5, 8, 999) /* PERL_VERSION_LT is 5.33+ */
1088 char* file = __FILE__;
1089 #else
1090 8 const char* file = __FILE__;
1091 #endif
1092  
1093 PERL_UNUSED_VAR(file);
1094  
1095 PERL_UNUSED_VAR(cv); /* -W */
1096 PERL_UNUSED_VAR(items); /* -W */
1097 #if PERL_VERSION_LE(5, 21, 5)
1098 XS_VERSION_BOOTCHECK;
1099 # ifdef XS_APIVERSION_BOOTCHECK
1100 XS_APIVERSION_BOOTCHECK;
1101 # endif
1102 #endif
1103  
1104 8 newXS_deffile("XLog::set_level", XS_XLog_set_level);
1105 8 newXS_deffile("XLog::set_logger", XS_XLog_set_logger);
1106 8 cv = newXS_deffile("XLog::set_format", XS_XLog_set_formatter);
1107 8 XSANY.any_i32 = 1;
1108 8 cv = newXS_deffile("XLog::set_formatter", XS_XLog_set_formatter);
1109 8 XSANY.any_i32 = 0;
1110 8 newXS_deffile("XLog::get_logger", XS_XLog_get_logger);
1111 8 newXS_deffile("XLog::get_formatter", XS_XLog_get_formatter);
1112 8 newXS_deffile("XLog::get_module", XS_XLog_get_module);
1113 8 newXS_deffile("XLog::log", XS_XLog_log);
1114 8 newXS_deffile("XLog::resolve_module", XS_XLog_resolve_module);
1115 8 cv = newXS_deffile("XLog::disable_format_warnings", XS_XLog_disable_format_warnings);
1116 8 XSANY.any_i32 = 0;
1117 8 cv = newXS_deffile("XLog::enable_format_warnings", XS_XLog_disable_format_warnings);
1118 8 XSANY.any_i32 = 1;
1119 8 cv = newXS_deffile("XLog::__logXXX", XS_XLog___logXXX);
1120 8 XSANY.any_i32 = 0;
1121 8 cv = newXS_deffile("XLog::alert", XS_XLog___logXXX);
1122 8 XSANY.any_i32 = 7;
1123 8 cv = newXS_deffile("XLog::critical", XS_XLog___logXXX);
1124 8 XSANY.any_i32 = 6;
1125 8 cv = newXS_deffile("XLog::debug", XS_XLog___logXXX);
1126 8 XSANY.any_i32 = 1;
1127 8 cv = newXS_deffile("XLog::emergency", XS_XLog___logXXX);
1128 8 XSANY.any_i32 = 8;
1129 8 cv = newXS_deffile("XLog::error", XS_XLog___logXXX);
1130 8 XSANY.any_i32 = 5;
1131 8 cv = newXS_deffile("XLog::info", XS_XLog___logXXX);
1132 8 XSANY.any_i32 = 2;
1133 8 cv = newXS_deffile("XLog::notice", XS_XLog___logXXX);
1134 8 XSANY.any_i32 = 3;
1135 8 cv = newXS_deffile("XLog::verbose_debug", XS_XLog___logXXX);
1136 8 XSANY.any_i32 = 0;
1137 8 cv = newXS_deffile("XLog::warning", XS_XLog___logXXX);
1138 8 XSANY.any_i32 = 4;
1139 8 newXS_deffile("XLog::Logger::new", XS_XLog__Logger_new);
1140 8 newXS_deffile("XLog::Formatter::new", XS_XLog__Formatter_new);
1141 8 newXS_deffile("XLog::Formatter::Pattern::new", XS_XLog__Formatter__Pattern_new);
1142 8 newXS_deffile("XLog::Formatter::Pattern::set_program_decorator", XS_XLog__Formatter__Pattern_set_program_decorator);
1143 8 newXS_deffile("XLog::Module::new", XS_XLog__Module_new);
1144 8 newXS_deffile("XLog::Module::name", XS_XLog__Module_name);
1145 8 newXS_deffile("XLog::Module::level", XS_XLog__Module_level);
1146 8 newXS_deffile("XLog::Module::passthrough", XS_XLog__Module_passthrough);
1147 8 newXS_deffile("XLog::Module::set_level", XS_XLog__Module_set_level);
1148 8 newXS_deffile("XLog::Module::set_logger", XS_XLog__Module_set_logger);
1149 8 newXS_deffile("XLog::Module::set_formatter", XS_XLog__Module_set_formatter);
1150 8 newXS_deffile("XLog::Module::get_logger", XS_XLog__Module_get_logger);
1151 8 newXS_deffile("XLog::Module::get_formatter", XS_XLog__Module_get_formatter);
1152 8 newXS_deffile("XLog::Console::new", XS_XLog__Console_new);
1153 8 newXS_deffile("XLog::Multi::new", XS_XLog__Multi_new);
1154  
1155 /* Initialisation Section */
1156  
1157 #line 150 "./xs/XLog.xsi"
1158 {
1159 Stash stash("XLog");
1160  
1161 xs::exp::create_constants(stash, {
1162 {"VERBOSE_DEBUG", (int)Level::VerboseDebug},
1163 {"DEBUG", (int)Level::Debug},
1164 {"INFO", (int)Level::Info},
1165 {"NOTICE", (int)Level::Notice},
1166 {"WARNING", (int)Level::Warning},
1167 {"ERROR", (int)Level::Error},
1168 {"CRITICAL", (int)Level::Critical},
1169 {"ALERT", (int)Level::Alert},
1170 {"EMERGENCY", (int)Level::Emergency},
1171 });
1172  
1173 auto root_module = xs::out(&::panda_log_module);
1174 root_module.readonly(1);
1175 stash.add_const_sub("default_format", xs::out(default_format));
1176 stash.add_const_sub("root", root_module);
1177 stash.store("root_module", root_module);
1178  
1179 xs::at_perl_destroy([]{
1180 if (dyn_cast<PerlObjectLogger*>(get_logger().get())) set_logger(nullptr);
1181 if (dyn_cast<PerlObjectFormatter*>(get_formatter().get())) set_formatter(nullptr);
1182 });
1183 }
1184  
1185 #line 4 "./xs/Logger.xsi"
1186 {
1187 Stash("XLog::Logger").inherit("XLog::ILogger");
1188 }
1189  
1190 #line 45 "./xs/Formatter.xsi"
1191 {
1192 Stash("XLog::Formatter::Pattern").inherit("XLog::IFormatter");
1193  
1194 spy_$0_marker.svt_set = spy_$0;
1195  
1196 auto $0_sv = get_sv("0", 0);
1197 MAGIC* mg;
1198 Newx(mg, 1, MAGIC);
1199 mg->mg_moremagic = SvMAGIC($0_sv);
1200 SvMAGIC_set($0_sv, mg);
1201 mg->mg_virtual = const_cast<xs::Sv::payload_marker_t*>(&spy_$0_marker);
1202 mg->mg_type = PERL_MAGIC_ext;
1203 mg->mg_len = 0;
1204 mg->mg_private = 0;
1205 mg->mg_flags = 0;
1206 mg->mg_ptr = NULL;
1207 mg->mg_obj = NULL;
1208  
1209 auto $0 = SvPV_nolen($0_sv);
1210 set_program_name(decorate_default($0));
1211 }
1212  
1213 #line 27 "./xs/Console.xsi"
1214 {
1215 Stash("XLog::Console").inherit("XLog::ILogger");
1216 }
1217  
1218 #line 27 "./xs/Multi.xsi"
1219 {
1220 Stash("XLog::Multi").inherit("XLog::ILogger");
1221 }
1222  
1223 #line 1224 "XLog_xsgen.cc"
1224  
1225 /* End of Initialisation Section */
1226  
1227 #if PERL_VERSION_LE(5, 21, 5)
1228 # if PERL_VERSION_GE(5, 9, 0)
1229 if (PL_unitcheckav)
1230 call_list(PL_scopestack_ix, PL_unitcheckav);
1231 # endif
1232 XSRETURN_YES;
1233 #else
1234 8 Perl_xs_boot_epilog(aTHX_ ax);
1235 #endif
1236 32 ▶}); }
Branch: 12 branches
BranchTrueFalseTotal
}); } 8 0 8
}); } 8 0 8
}); } 8 0 8
}); } 8 0 8
}); } 8 0 8
}); } 8 0 8
}); } 8 0 8
}); } 8 0 8
}); } 8 0 8
}); } 8 0 8
}); } 0 0 0
}); } 0 0 0
1237  
1238 #ifdef __cplusplus
1239 }
1240 #endif
« xs/Multi.xsi ↑ Summary t/lib/MyTest.xs »