line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#pragma once
|
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
#include
|
4
|
|
|
|
|
|
|
#include
|
5
|
|
|
|
|
|
|
#include
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
namespace xs {
|
8
|
|
|
|
|
|
|
namespace lib {
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
using XSCallbackDispatcher = panda::CallbackDispatcher;
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
using xs::my_perl;
|
13
|
|
|
|
|
|
|
|
14
|
42
|
|
|
|
|
|
struct CallbackCVWrapperBase {
|
15
|
14
|
|
|
|
|
|
CallbackCVWrapperBase(CV* cv) : cv(cv) {};
|
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
SvIntrPtr cv;
|
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
bool operator ==(CV* oth) const{
|
20
|
|
|
|
|
|
|
return cv.get() == oth;
|
21
|
|
|
|
|
|
|
}
|
22
|
|
|
|
|
|
|
|
23
|
4
|
|
|
|
|
|
bool operator ==(const CallbackCVWrapperBase& oth) const {
|
24
|
4
|
|
|
|
|
|
return cv.get() == oth.cv.get();
|
25
|
|
|
|
|
|
|
}
|
26
|
|
|
|
|
|
|
};
|
27
|
|
|
|
|
|
|
|
28
|
24
|
|
|
|
|
|
struct CallbackCVWrapperSimple : CallbackCVWrapperBase {
|
29
|
8
|
|
|
|
|
|
using CallbackCVWrapperBase::CallbackCVWrapperBase;
|
30
|
|
|
|
|
|
|
|
31
|
8
|
|
|
|
|
|
SV* operator()(SV** args, size_t items) {
|
32
|
8
|
|
|
|
|
|
return xs::call_sub_scalar(aTHX_ cv.get(), args, items);
|
33
|
|
|
|
|
|
|
}
|
34
|
|
|
|
|
|
|
};
|
35
|
|
|
|
|
|
|
|
36
|
15
|
50
|
|
|
|
|
struct CallbackCVWrapperExt : CallbackCVWrapperBase{
|
37
|
|
|
|
|
|
|
template
|
38
|
3
|
|
|
|
|
|
CallbackCVWrapperExt(T&& lambda, CV* cv)
|
39
|
|
|
|
|
|
|
: CallbackCVWrapperBase(cv)
|
40
|
3
|
50
|
|
|
|
|
, lambda(std::forward(lambda))
|
|
|
50
|
|
|
|
|
|
41
|
3
|
|
|
|
|
|
{}
|
42
|
|
|
|
|
|
|
|
43
|
1
|
|
|
|
|
|
panda::optional operator()(XSCallbackDispatcher::Event& e, SV** args, size_t items) {
|
44
|
1
|
|
|
|
|
|
return lambda(e, args, items);
|
45
|
|
|
|
|
|
|
}
|
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
XSCallbackDispatcher::Callback lambda;
|
48
|
|
|
|
|
|
|
};
|
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
}//lib
|
51
|
|
|
|
|
|
|
}//xs
|
52
|
|
|
|
|
|
|
|