… | |
… | |
4 | |
4 | |
5 | #ifndef RXVTPERL_H_ |
5 | #ifndef RXVTPERL_H_ |
6 | #define RXVTPERL_H_ |
6 | #define RXVTPERL_H_ |
7 | |
7 | |
8 | #if ENABLE_PERL |
8 | #if ENABLE_PERL |
|
|
9 | # define SHOULD_INVOKE(htype) \ |
|
|
10 | ( (htype) == HOOK_INIT \ |
|
|
11 | || (htype) == HOOK_DESTROY \ |
|
|
12 | || (htype) == HOOK_REFRESH_BEGIN \ |
|
|
13 | || (htype) == HOOK_REFRESH_END \ |
|
|
14 | || perl.should_invoke [htype]) |
|
|
15 | # define HOOK_INVOKE(args) rxvt_perl.invoke args |
9 | |
16 | |
10 | #include "rxvt.h" |
17 | #include "rxvt.h" |
11 | |
18 | |
12 | #define PERL_INVOKE(args) rxvt_perl.invoke args |
|
|
13 | |
|
|
14 | enum data_type { |
19 | enum data_type { |
15 | DT_END, |
20 | DT_END, // no further arguments |
16 | DT_INT, |
21 | DT_INT, |
17 | DT_LONG, |
22 | DT_LONG, |
18 | DT_STRING, |
23 | DT_STR, // 0-terminates string |
|
|
24 | DT_STR_LEN, // string + length |
|
|
25 | DT_WCS_LEN, // wchar_t* + length |
|
|
26 | DT_LCS_LEN, // long* + length |
19 | DT_XEVENT, |
27 | DT_XEVENT, |
20 | }; |
28 | }; |
21 | |
29 | |
22 | enum hook_type { |
30 | enum hook_type { |
23 | HOOK_INIT = 0, // special, hardcoded |
31 | # define def(sym) HOOK_ ## sym, |
24 | HOOK_DESTROY = 1, // values in urxvt.pm |
32 | # include "hookinc.h" |
25 | HOOK_RESET, |
33 | # undef def |
26 | HOOK_START, |
34 | HOOK_NUM, |
|
|
35 | }; |
27 | |
36 | |
28 | HOOK_SEL_BEGIN, |
37 | struct rxvt_perl_term |
29 | HOOK_SEL_EXTEND, |
38 | { |
30 | HOOK_SEL_MAKE, |
39 | void *self; |
31 | HOOK_SEL_GRAB, |
40 | unsigned long grabtime; |
32 | |
41 | uint8_t should_invoke[HOOK_NUM]; |
33 | HOOK_SEL_CLICK, |
|
|
34 | |
|
|
35 | HOOK_FOCUS_IN, |
|
|
36 | HOOK_FOCUS_OUT, |
|
|
37 | |
|
|
38 | HOOK_VIEW_CHANGE, |
|
|
39 | HOOK_SCROLL_BACK, |
|
|
40 | HOOK_TTY_ACTIVITY, |
|
|
41 | |
|
|
42 | HOOK_REFRESH_BEGIN, |
|
|
43 | HOOK_REFRESH_END, |
|
|
44 | |
|
|
45 | HOOK_KEYBOARD_COMMAND, |
|
|
46 | |
|
|
47 | HOOK_MOUSE_CLICK, |
|
|
48 | HOOK_MOUSE_MOVE, |
|
|
49 | |
|
|
50 | HOOK_NUM, |
|
|
51 | }; |
42 | }; |
52 | |
43 | |
53 | struct rxvt_perl_interp |
44 | struct rxvt_perl_interp |
54 | { |
45 | { |
55 | rxvt_perl_interp (); |
46 | char **perl_environ; |
|
|
47 | |
56 | ~rxvt_perl_interp (); |
48 | ~rxvt_perl_interp (); |
57 | |
49 | |
58 | bool should_invoke[HOOK_NUM]; |
50 | void init (rxvt_term *term); |
59 | |
|
|
60 | void init (); |
|
|
61 | bool invoke (rxvt_term *term, hook_type htype, ...); |
51 | bool invoke (rxvt_term *term, hook_type htype, ...); |
|
|
52 | void line_update (rxvt_term *term); |
62 | }; |
53 | }; |
63 | |
54 | |
64 | extern struct rxvt_perl_interp rxvt_perl; |
55 | extern struct rxvt_perl_interp rxvt_perl; |
65 | |
56 | |
66 | #else |
57 | #else |
|
|
58 | # define SHOULD_INVOKE(htype) false |
67 | # define PERL_INVOKE(args) false |
59 | # define HOOK_INVOKE(args) false |
68 | #endif |
60 | #endif |
69 | |
61 | |
70 | #endif |
62 | #endif |
71 | |
63 | |