Add first XS implementation
[gitmo/Mouse.git] / mouse.h
1 #ifndef MOUSE_H
2 #define MOUSE_H
3
4 #define PERL_NO_GET_CONTEXT
5 #include <EXTERN.h>
6 #include <perl.h>
7 #include <XSUB.h>
8
9 #include "ppport.h"
10
11 #define is_class_loaded(sv) mouse_is_class_loaded(aTHX_ sv)
12 bool mouse_is_class_loaded(pTHX_ SV*);
13
14 #define is_instance_of(sv, klass) mouse_is_instance_of(aTHX_ sv, klass)
15 bool mouse_is_instance_of(pTHX_ SV* const sv, SV* const klass);
16
17 #define IsObject(sv) (SvROK(sv) && SvOBJECT(SvRV(sv)))
18
19 #define mcall0(invocant, m)        mouse_call0(aTHX_ (invocant), (m))
20 #define mcall1(invocant, m, arg1)  mouse_call1(aTHX_ (invocant), (m), (arg1))
21 #define mcall0s(invocant, m)       mcall0((invocant), newSVpvs_flags(m, SVs_TEMP))
22 #define mcall1s(invocant, m, arg1) mcall1((invocant), newSVpvs_flags(m, SVs_TEMP), (arg1))
23
24 SV* mouse_call0(pTHX_ SV *const self, SV *const method);
25 SV* mouse_call1(pTHX_ SV *const self, SV *const method, SV* const arg1);
26
27
28 #endif /* !MOUSE_H */
29