1 | /*----------------------------------------------------------------------* |
1 | /*----------------------------------------------------------------------* |
2 | * File: rxvtperl.xs |
2 | * File: rxvtperl.xs |
3 | *----------------------------------------------------------------------* |
3 | *----------------------------------------------------------------------* |
4 | * |
4 | * |
5 | * All portions of code are copyright by their respective author/s. |
5 | * All portions of code are copyright by their respective author/s. |
6 | * Copyright (c) 2005-2005 Marc Lehmann <pcg@goof.com> |
6 | * Copyright (c) 2005-2006 Marc Lehmann <pcg@goof.com> |
7 | * |
7 | * |
8 | * This program is free software; you can redistribute it and/or modify |
8 | * This program is free software; you can redistribute it and/or modify |
9 | * it under the terms of the GNU General Public License as published by |
9 | * it under the terms of the GNU General Public License as published by |
10 | * the Free Software Foundation; either version 2 of the License, or |
10 | * the Free Software Foundation; either version 2 of the License, or |
11 | * (at your option) any later version. |
11 | * (at your option) any later version. |
… | |
… | |
26 | #include <XSUB.h> |
26 | #include <XSUB.h> |
27 | #undef line_t |
27 | #undef line_t |
28 | |
28 | |
29 | #include "../config.h" |
29 | #include "../config.h" |
30 | |
30 | |
|
|
31 | #include <cstddef> |
31 | #include <cstdarg> |
32 | #include <cstdarg> |
32 | |
33 | |
|
|
34 | #include "iom.h" |
33 | #include "rxvt.h" |
35 | #include "rxvt.h" |
34 | #include "iom.h" |
36 | #include "keyboard.h" |
35 | #include "rxvtutil.h" |
37 | #include "rxvtutil.h" |
36 | #include "rxvtperl.h" |
38 | #include "rxvtperl.h" |
37 | |
39 | |
38 | #include "perlxsi.c" |
40 | #include "perlxsi.c" |
39 | |
41 | |
|
|
42 | #if defined(HAVE_SCROLLBARS) || defined(MENUBAR) |
|
|
43 | # define GRAB_CURSOR THIS->leftptr_cursor |
|
|
44 | #else |
|
|
45 | # define GRAB_CURSOR None |
|
|
46 | #endif |
|
|
47 | |
|
|
48 | #undef LINENO |
|
|
49 | #define LINENO(n) MOD (THIS->term_start + int(n), THIS->total_rows) |
|
|
50 | #undef ROW |
|
|
51 | #define ROW(n) THIS->row_buf [LINENO (n)] |
|
|
52 | |
40 | ///////////////////////////////////////////////////////////////////////////// |
53 | ///////////////////////////////////////////////////////////////////////////// |
|
|
54 | |
|
|
55 | static SV * |
|
|
56 | taint (SV *sv) |
|
|
57 | { |
|
|
58 | SvTAINT (sv); |
|
|
59 | return sv; |
|
|
60 | } |
|
|
61 | |
|
|
62 | static SV * |
|
|
63 | taint_if (SV *sv, SV *src) |
|
|
64 | { |
|
|
65 | if (SvTAINTED (src)) |
|
|
66 | SvTAINT (sv); |
|
|
67 | |
|
|
68 | return sv; |
|
|
69 | } |
41 | |
70 | |
42 | static wchar_t * |
71 | static wchar_t * |
43 | sv2wcs (SV *sv) |
72 | sv2wcs (SV *sv) |
44 | { |
73 | { |
45 | STRLEN len; |
74 | STRLEN len; |
46 | char *str = SvPVutf8 (sv, len); |
75 | char *str = SvPVutf8 (sv, len); |
47 | return rxvt_utf8towcs (str, len); |
76 | return rxvt_utf8towcs (str, len); |
48 | } |
77 | } |
49 | |
78 | |
50 | static SV * |
79 | static SV * |
|
|
80 | wcs2sv (wchar_t *wstr, int len = -1) |
|
|
81 | { |
|
|
82 | char *str = rxvt_wcstoutf8 (wstr, len); |
|
|
83 | |
|
|
84 | SV *sv = newSVpv (str, 0); |
|
|
85 | SvUTF8_on (sv); |
|
|
86 | free (str); |
|
|
87 | |
|
|
88 | return sv; |
|
|
89 | } |
|
|
90 | |
|
|
91 | static SV * |
51 | new_ref (HV *hv, const char *klass) |
92 | new_ref (HV *hv, const char *klass) |
52 | { |
93 | { |
53 | return sv_bless (newRV ((SV *)hv), gv_stashpv (klass, 1)); |
94 | return sv_bless (newRV ((SV *)hv), gv_stashpv (klass, 1)); |
54 | } |
95 | } |
55 | |
96 | |
56 | //TODO: use magic |
97 | //TODO: use magic |
57 | static SV * |
98 | static SV * |
58 | newSVptr (void *ptr, const char *klass) |
99 | newSVptr (void *ptr, const char *klass) |
59 | { |
100 | { |
60 | HV *hv = newHV (); |
101 | HV *hv = newHV (); |
61 | hv_store (hv, "_ptr", 4, newSViv ((long)ptr), 0); |
102 | sv_magic ((SV *)hv, 0, PERL_MAGIC_ext, (char *)ptr, 0); |
62 | return sv_bless (newRV_noinc ((SV *)hv), gv_stashpv (klass, 1)); |
103 | return sv_bless (newRV_noinc ((SV *)hv), gv_stashpv (klass, 1)); |
|
|
104 | } |
|
|
105 | |
|
|
106 | static void |
|
|
107 | clearSVptr (SV *sv) |
|
|
108 | { |
|
|
109 | if (SvROK (sv)) |
|
|
110 | sv = SvRV (sv); |
|
|
111 | |
|
|
112 | hv_clear ((HV *)sv); |
|
|
113 | sv_unmagic (sv, PERL_MAGIC_ext); |
63 | } |
114 | } |
64 | |
115 | |
65 | static long |
116 | static long |
66 | SvPTR (SV *sv, const char *klass) |
117 | SvPTR (SV *sv, const char *klass) |
67 | { |
118 | { |
68 | if (!sv_derived_from (sv, klass)) |
119 | if (!sv_derived_from (sv, klass)) |
69 | croak ("object of type %s expected", klass); |
120 | croak ("object of type %s expected", klass); |
70 | |
121 | |
71 | IV iv = SvIV (*hv_fetch ((HV *)SvRV (sv), "_ptr", 4, 1)); |
122 | MAGIC *mg = mg_find (SvRV (sv), PERL_MAGIC_ext); |
72 | |
123 | |
73 | if (!iv) |
124 | if (!mg) |
74 | croak ("perl code used %s object, but C++ object is already destroyed, caught", klass); |
125 | croak ("perl code used %s object, but C++ object is already destroyed, caught", klass); |
75 | |
126 | |
76 | return (long)iv; |
127 | return (long)mg->mg_ptr; |
77 | } |
128 | } |
78 | |
129 | |
79 | #define newSVterm(term) SvREFCNT_inc ((SV *)term->self) |
130 | #define newSVterm(term) SvREFCNT_inc ((SV *)term->perl.self) |
80 | #define SvTERM(sv) (rxvt_term *)SvPTR (sv, "urxvt::term") |
131 | #define SvTERM(sv) (rxvt_term *)SvPTR (sv, "urxvt::term") |
81 | |
132 | |
82 | ///////////////////////////////////////////////////////////////////////////// |
133 | ///////////////////////////////////////////////////////////////////////////// |
83 | |
134 | |
84 | struct perl_watcher |
135 | struct perl_watcher |
… | |
… | |
134 | #define newSVtimer(timer) new_ref (timer->self, "urxvt::timer") |
185 | #define newSVtimer(timer) new_ref (timer->self, "urxvt::timer") |
135 | #define SvTIMER(sv) (timer *)SvPTR (sv, "urxvt::timer") |
186 | #define SvTIMER(sv) (timer *)SvPTR (sv, "urxvt::timer") |
136 | |
187 | |
137 | struct timer : time_watcher, perl_watcher |
188 | struct timer : time_watcher, perl_watcher |
138 | { |
189 | { |
|
|
190 | tstamp interval; |
|
|
191 | |
139 | timer () |
192 | timer () |
140 | : time_watcher (this, &timer::execute) |
193 | : time_watcher (this, &timer::execute) |
141 | { |
194 | { |
142 | } |
195 | } |
143 | |
196 | |
144 | void execute (time_watcher &w) |
197 | void execute (time_watcher &w) |
145 | { |
198 | { |
|
|
199 | if (interval) |
|
|
200 | start (at + interval); |
|
|
201 | |
146 | invoke ("urxvt::timer", newSVtimer (this)); |
202 | invoke ("urxvt::timer", newSVtimer (this)); |
147 | } |
203 | } |
148 | }; |
204 | }; |
149 | |
205 | |
150 | #define newSViow(iow) new_ref (iow->self, "urxvt::iow") |
206 | #define newSViow(iow) new_ref (iow->self, "urxvt::iow") |
… | |
… | |
163 | } |
219 | } |
164 | }; |
220 | }; |
165 | |
221 | |
166 | ///////////////////////////////////////////////////////////////////////////// |
222 | ///////////////////////////////////////////////////////////////////////////// |
167 | |
223 | |
|
|
224 | #define SvOVERLAY(sv) (overlay *)SvPTR (sv, "urxvt::overlay") |
|
|
225 | |
|
|
226 | struct overlay { |
|
|
227 | HV *self; |
|
|
228 | rxvt_term *THIS; |
|
|
229 | int x, y, w, h; |
|
|
230 | int border; |
|
|
231 | text_t **text; |
|
|
232 | rend_t **rend; |
|
|
233 | |
|
|
234 | overlay (rxvt_term *THIS, int x_, int y_, int w_, int h_, rend_t rstyle, int border); |
|
|
235 | ~overlay (); |
|
|
236 | |
|
|
237 | void show (); |
|
|
238 | void hide (); |
|
|
239 | |
|
|
240 | void swap (); |
|
|
241 | |
|
|
242 | void set (int x, int y, SV *str, SV *rend); |
|
|
243 | }; |
|
|
244 | |
|
|
245 | overlay::overlay (rxvt_term *THIS, int x_, int y_, int w_, int h_, rend_t rstyle, int border) |
|
|
246 | : THIS(THIS), x(x_), y(y_), w(w_), h(h_), border(border == 2) |
|
|
247 | { |
|
|
248 | if (border == 2) |
|
|
249 | { |
|
|
250 | w += 2; |
|
|
251 | h += 2; |
|
|
252 | } |
|
|
253 | |
|
|
254 | text = new text_t *[h]; |
|
|
255 | rend = new rend_t *[h]; |
|
|
256 | |
|
|
257 | for (int y = 0; y < h; y++) |
|
|
258 | { |
|
|
259 | text_t *tp = text[y] = new text_t[w]; |
|
|
260 | rend_t *rp = rend[y] = new rend_t[w]; |
|
|
261 | |
|
|
262 | text_t t0, t1, t2; |
|
|
263 | rend_t r = rstyle; |
|
|
264 | |
|
|
265 | if (border == 2) |
|
|
266 | { |
|
|
267 | if (y == 0) |
|
|
268 | t0 = 0x2554, t1 = 0x2550, t2 = 0x2557; |
|
|
269 | else if (y < h - 1) |
|
|
270 | t0 = 0x2551, t1 = 0x0020, t2 = 0x2551; |
|
|
271 | else |
|
|
272 | t0 = 0x255a, t1 = 0x2550, t2 = 0x255d; |
|
|
273 | |
|
|
274 | *tp++ = t0; |
|
|
275 | *rp++ = r; |
|
|
276 | |
|
|
277 | for (int x = w - 2; x-- > 0; ) |
|
|
278 | { |
|
|
279 | *tp++ = t1; |
|
|
280 | *rp++ = r; |
|
|
281 | } |
|
|
282 | |
|
|
283 | *tp = t2; |
|
|
284 | *rp = r; |
|
|
285 | } |
|
|
286 | else |
|
|
287 | for (int x = w; x-- > 0; ) |
|
|
288 | { |
|
|
289 | *tp++ = 0x0020; |
|
|
290 | *rp++ = r; |
|
|
291 | } |
|
|
292 | } |
|
|
293 | |
|
|
294 | show (); |
|
|
295 | THIS->want_refresh = 1; |
|
|
296 | } |
|
|
297 | |
|
|
298 | overlay::~overlay () |
|
|
299 | { |
|
|
300 | hide (); |
|
|
301 | |
|
|
302 | for (int y = h; y--; ) |
|
|
303 | { |
|
|
304 | delete [] text[y]; |
|
|
305 | delete [] rend[y]; |
|
|
306 | } |
|
|
307 | |
|
|
308 | delete [] text; |
|
|
309 | delete [] rend; |
|
|
310 | |
|
|
311 | THIS->want_refresh = 1; |
|
|
312 | } |
|
|
313 | |
|
|
314 | void |
|
|
315 | overlay::show () |
|
|
316 | { |
|
|
317 | char key[33]; sprintf (key, "%32lx", (long)this); |
|
|
318 | |
|
|
319 | HV *hv = (HV *)SvRV (*hv_fetch ((HV *)SvRV ((SV *)THIS->perl.self), "_overlay", 8, 0)); |
|
|
320 | hv_store (hv, key, 32, newSViv ((long)this), 0); |
|
|
321 | } |
|
|
322 | |
|
|
323 | void |
|
|
324 | overlay::hide () |
|
|
325 | { |
|
|
326 | SV **ovs = hv_fetch ((HV *)SvRV ((SV *)THIS->perl.self), "_overlay", 8, 0); |
|
|
327 | |
|
|
328 | if (ovs) |
|
|
329 | { |
|
|
330 | char key[33]; sprintf (key, "%32lx", (long)this); |
|
|
331 | |
|
|
332 | HV *hv = (HV *)SvRV (*ovs); |
|
|
333 | hv_delete (hv, key, 32, G_DISCARD); |
|
|
334 | } |
|
|
335 | } |
|
|
336 | |
|
|
337 | void overlay::swap () |
|
|
338 | { |
|
|
339 | int ov_x = max (0, min (MOD (x, THIS->ncol), THIS->ncol - w)); |
|
|
340 | int ov_y = max (0, min (MOD (y, THIS->nrow), THIS->nrow - h)); |
|
|
341 | |
|
|
342 | int ov_w = min (w, THIS->ncol - ov_x); |
|
|
343 | int ov_h = min (h, THIS->nrow - ov_y); |
|
|
344 | |
|
|
345 | for (int y = ov_h; y--; ) |
|
|
346 | { |
|
|
347 | text_t *t1 = text [y]; |
|
|
348 | rend_t *r1 = rend [y]; |
|
|
349 | |
|
|
350 | text_t *t2 = ROW(y + ov_y - THIS->view_start).t + ov_x; |
|
|
351 | rend_t *r2 = ROW(y + ov_y - THIS->view_start).r + ov_x; |
|
|
352 | |
|
|
353 | for (int x = ov_w; x--; ) |
|
|
354 | { |
|
|
355 | text_t t = *t1; *t1++ = *t2; *t2++ = t; |
|
|
356 | rend_t r = *r1; *r1++ = *r2; *r2++ = SET_FONT (r, THIS->fontset [GET_STYLE (r)]->find_font (t)); |
|
|
357 | } |
|
|
358 | } |
|
|
359 | |
|
|
360 | } |
|
|
361 | |
|
|
362 | void overlay::set (int x, int y, SV *text, SV *rend) |
|
|
363 | { |
|
|
364 | x += border; |
|
|
365 | y += border; |
|
|
366 | |
|
|
367 | if (!IN_RANGE_EXC (y, 0, h - border)) |
|
|
368 | return; |
|
|
369 | |
|
|
370 | wchar_t *wtext = sv2wcs (text); |
|
|
371 | |
|
|
372 | for (int col = min (wcslen (wtext), w - x - border); col--; ) |
|
|
373 | this->text [y][x + col] = wtext [col]; |
|
|
374 | |
|
|
375 | free (wtext); |
|
|
376 | |
|
|
377 | if (rend) |
|
|
378 | { |
|
|
379 | if (!SvROK (rend) || SvTYPE (SvRV (rend)) != SVt_PVAV) |
|
|
380 | croak ("rend must be arrayref"); |
|
|
381 | |
|
|
382 | AV *av = (AV *)SvRV (rend); |
|
|
383 | |
|
|
384 | for (int col = min (av_len (av) + 1, w - x - border); col--; ) |
|
|
385 | this->rend [y][x + col] = SvIV (*av_fetch (av, col, 1)); |
|
|
386 | } |
|
|
387 | |
|
|
388 | THIS->want_refresh = 1; |
|
|
389 | } |
|
|
390 | |
|
|
391 | |
|
|
392 | ///////////////////////////////////////////////////////////////////////////// |
|
|
393 | |
168 | struct rxvt_perl_interp rxvt_perl; |
394 | struct rxvt_perl_interp rxvt_perl; |
169 | |
395 | |
170 | static PerlInterpreter *perl; |
396 | static PerlInterpreter *perl; |
171 | |
397 | |
172 | rxvt_perl_interp::rxvt_perl_interp () |
398 | rxvt_perl_interp::rxvt_perl_interp () |
… | |
… | |
185 | void |
411 | void |
186 | rxvt_perl_interp::init () |
412 | rxvt_perl_interp::init () |
187 | { |
413 | { |
188 | if (!perl) |
414 | if (!perl) |
189 | { |
415 | { |
|
|
416 | perl_environ = rxvt_environ; |
|
|
417 | swap (perl_environ, environ); |
|
|
418 | |
190 | char *argv[] = { |
419 | char *argv[] = { |
191 | "", |
420 | "", |
|
|
421 | "-T", |
192 | "-edo '" LIBDIR "/urxvt.pm' or ($@ and die $@) or exit 1", |
422 | "-edo '" LIBDIR "/urxvt.pm' or ($@ and die $@) or exit 1", |
193 | }; |
423 | }; |
194 | |
424 | |
195 | perl = perl_alloc (); |
425 | perl = perl_alloc (); |
196 | perl_construct (perl); |
426 | perl_construct (perl); |
197 | |
427 | |
198 | if (perl_parse (perl, xs_init, 2, argv, (char **)NULL) |
428 | if (perl_parse (perl, xs_init, 3, argv, (char **)NULL) |
199 | || perl_run (perl)) |
429 | || perl_run (perl)) |
200 | { |
430 | { |
201 | rxvt_warn ("unable to initialize perl-interpreter, continuing without.\n"); |
431 | rxvt_warn ("unable to initialize perl-interpreter, continuing without.\n"); |
202 | |
432 | |
203 | perl_destruct (perl); |
433 | perl_destruct (perl); |
204 | perl_free (perl); |
434 | perl_free (perl); |
205 | perl = 0; |
435 | perl = 0; |
206 | } |
436 | } |
|
|
437 | |
|
|
438 | swap (perl_environ, environ); |
|
|
439 | } |
|
|
440 | } |
|
|
441 | |
|
|
442 | static void |
|
|
443 | ungrab (rxvt_term *THIS) |
|
|
444 | { |
|
|
445 | if (THIS->perl.grabtime) |
|
|
446 | { |
|
|
447 | XUngrabKeyboard (THIS->display->display, THIS->perl.grabtime); |
|
|
448 | XUngrabPointer (THIS->display->display, THIS->perl.grabtime); |
|
|
449 | THIS->perl.grabtime = 0; |
207 | } |
450 | } |
208 | } |
451 | } |
209 | |
452 | |
210 | bool |
453 | bool |
211 | rxvt_perl_interp::invoke (rxvt_term *term, hook_type htype, ...) |
454 | rxvt_perl_interp::invoke (rxvt_term *term, hook_type htype, ...) |
212 | { |
455 | { |
213 | if (!perl |
456 | if (!perl) |
214 | || (!should_invoke [htype] && htype != HOOK_INIT && htype != HOOK_DESTROY)) |
|
|
215 | return false; |
457 | return false; |
216 | |
458 | |
217 | if (htype == HOOK_INIT) // first hook ever called |
459 | if (htype == HOOK_INIT) // first hook ever called |
|
|
460 | { |
218 | term->self = (void *)newSVptr ((void *)term, "urxvt::term"); |
461 | term->perl.self = (void *)newSVptr ((void *)term, "urxvt::term"); |
|
|
462 | hv_store ((HV *)SvRV ((SV *)term->perl.self), "_overlay", 8, newRV_noinc ((SV *)newHV ()), 0); |
|
|
463 | } |
|
|
464 | else if (!term->perl.self) |
|
|
465 | return false; // perl not initialized for this instance |
|
|
466 | else if (htype == HOOK_DESTROY) |
|
|
467 | { |
|
|
468 | // handled later |
|
|
469 | } |
|
|
470 | else |
|
|
471 | { |
|
|
472 | if (htype == HOOK_REFRESH_BEGIN || htype == HOOK_REFRESH_END) |
|
|
473 | { |
|
|
474 | HV *hv = (HV *)SvRV (*hv_fetch ((HV *)SvRV ((SV *)term->perl.self), "_overlay", 8, 0)); |
219 | |
475 | |
|
|
476 | if (HvKEYS (hv)) |
|
|
477 | { |
|
|
478 | hv_iterinit (hv); |
|
|
479 | |
|
|
480 | while (HE *he = hv_iternext (hv)) |
|
|
481 | ((overlay *)SvIV (hv_iterval (hv, he)))->swap (); |
|
|
482 | } |
|
|
483 | |
|
|
484 | } |
|
|
485 | |
|
|
486 | if (!should_invoke [htype]) |
|
|
487 | return false; |
|
|
488 | } |
|
|
489 | |
|
|
490 | swap (perl_environ, environ); |
|
|
491 | |
|
|
492 | try |
|
|
493 | { |
220 | dSP; |
494 | dSP; |
221 | va_list ap; |
495 | va_list ap; |
222 | |
496 | |
223 | va_start (ap, htype); |
497 | va_start (ap, htype); |
224 | |
498 | |
225 | ENTER; |
499 | ENTER; |
226 | SAVETMPS; |
500 | SAVETMPS; |
227 | |
501 | |
228 | PUSHMARK (SP); |
502 | PUSHMARK (SP); |
229 | |
503 | |
230 | XPUSHs (sv_2mortal (newSVterm (term))); |
504 | XPUSHs (sv_2mortal (newSVterm (term))); |
231 | XPUSHs (sv_2mortal (newSViv (htype))); |
505 | XPUSHs (sv_2mortal (newSViv (htype))); |
232 | |
506 | |
233 | for (;;) { |
507 | for (;;) { |
234 | data_type dt = (data_type)va_arg (ap, int); |
508 | data_type dt = (data_type)va_arg (ap, int); |
235 | |
509 | |
236 | switch (dt) |
510 | switch (dt) |
237 | { |
511 | { |
238 | case DT_INT: |
512 | case DT_INT: |
239 | XPUSHs (sv_2mortal (newSViv (va_arg (ap, int)))); |
513 | XPUSHs (sv_2mortal (newSViv (va_arg (ap, int)))); |
240 | break; |
514 | break; |
241 | |
515 | |
242 | case DT_LONG: |
516 | case DT_LONG: |
243 | XPUSHs (sv_2mortal (newSViv (va_arg (ap, long)))); |
517 | XPUSHs (sv_2mortal (newSViv (va_arg (ap, long)))); |
244 | break; |
518 | break; |
245 | |
519 | |
246 | case DT_STRING: |
520 | case DT_STR: |
247 | XPUSHs (sv_2mortal (newSVpv (va_arg (ap, char *), 0))); |
521 | XPUSHs (taint (sv_2mortal (newSVpv (va_arg (ap, char *), 0)))); |
248 | break; |
522 | break; |
249 | |
523 | |
250 | case DT_END: |
524 | case DT_STR_LEN: |
251 | { |
|
|
252 | va_end (ap); |
|
|
253 | |
|
|
254 | PUTBACK; |
|
|
255 | int count = call_pv ("urxvt::invoke", G_ARRAY | G_EVAL); |
|
|
256 | SPAGAIN; |
|
|
257 | |
|
|
258 | if (count) |
|
|
259 | { |
525 | { |
260 | SV *status = POPs; |
526 | char *str = va_arg (ap, char *); |
261 | count = SvTRUE (status); |
527 | int len = va_arg (ap, int); |
|
|
528 | |
|
|
529 | XPUSHs (taint (sv_2mortal (newSVpvn (str, len)))); |
262 | } |
530 | } |
|
|
531 | break; |
263 | |
532 | |
264 | PUTBACK; |
533 | case DT_WCS_LEN: |
265 | FREETMPS; |
|
|
266 | LEAVE; |
|
|
267 | |
|
|
268 | if (SvTRUE (ERRSV)) |
|
|
269 | rxvt_warn ("perl hook %d evaluation error: %s", htype, SvPV_nolen (ERRSV)); |
|
|
270 | |
|
|
271 | if (htype == HOOK_DESTROY) |
|
|
272 | { |
534 | { |
273 | // TODO: clear magic |
535 | wchar_t *wstr = va_arg (ap, wchar_t *); |
274 | hv_clear ((HV *)SvRV ((SV *)term->self)); |
536 | int wlen = va_arg (ap, int); |
275 | SvREFCNT_dec ((SV *)term->self); |
537 | |
|
|
538 | XPUSHs (taint (sv_2mortal (wcs2sv (wstr, wlen)))); |
276 | } |
539 | } |
|
|
540 | break; |
277 | |
541 | |
|
|
542 | case DT_XEVENT: |
|
|
543 | { |
|
|
544 | XEvent *xe = va_arg (ap, XEvent *); |
|
|
545 | HV *hv = newHV (); |
|
|
546 | |
|
|
547 | # define set(name, sv) hv_store (hv, # name, sizeof (# name) - 1, sv, 0) |
|
|
548 | # define setiv(name, val) hv_store (hv, # name, sizeof (# name) - 1, newSViv (val), 0) |
|
|
549 | # undef set |
|
|
550 | |
|
|
551 | setiv (type, xe->type); |
|
|
552 | setiv (send_event, xe->xany.send_event); |
|
|
553 | setiv (serial, xe->xany.serial); |
|
|
554 | |
|
|
555 | switch (xe->type) |
|
|
556 | { |
|
|
557 | case KeyPress: |
|
|
558 | case KeyRelease: |
|
|
559 | case ButtonPress: |
|
|
560 | case ButtonRelease: |
|
|
561 | case MotionNotify: |
|
|
562 | setiv (time, xe->xmotion.time); |
|
|
563 | setiv (x, xe->xmotion.x); |
|
|
564 | setiv (y, xe->xmotion.y); |
|
|
565 | setiv (row, xe->xmotion.y / term->fheight); |
|
|
566 | setiv (col, xe->xmotion.x / term->fwidth); |
|
|
567 | setiv (x_root, xe->xmotion.x_root); |
|
|
568 | setiv (y_root, xe->xmotion.y_root); |
|
|
569 | setiv (state, xe->xmotion.state); |
|
|
570 | break; |
|
|
571 | } |
|
|
572 | |
|
|
573 | switch (xe->type) |
|
|
574 | { |
|
|
575 | case KeyPress: |
|
|
576 | case KeyRelease: |
|
|
577 | setiv (keycode, xe->xkey.keycode); |
|
|
578 | break; |
|
|
579 | |
|
|
580 | case ButtonPress: |
|
|
581 | case ButtonRelease: |
|
|
582 | setiv (button, xe->xbutton.button); |
|
|
583 | break; |
|
|
584 | |
|
|
585 | case MotionNotify: |
|
|
586 | setiv (is_hint, xe->xmotion.is_hint); |
|
|
587 | break; |
|
|
588 | } |
|
|
589 | |
|
|
590 | XPUSHs (sv_2mortal (newRV_noinc ((SV *)hv))); |
|
|
591 | } |
|
|
592 | break; |
|
|
593 | |
|
|
594 | case DT_END: |
|
|
595 | { |
|
|
596 | va_end (ap); |
|
|
597 | |
|
|
598 | PUTBACK; |
|
|
599 | int count = call_pv ("urxvt::invoke", G_ARRAY | G_EVAL); |
|
|
600 | SPAGAIN; |
|
|
601 | |
|
|
602 | if (count) |
|
|
603 | { |
|
|
604 | SV *status = POPs; |
|
|
605 | count = SvTRUE (status); |
|
|
606 | } |
|
|
607 | |
|
|
608 | PUTBACK; |
|
|
609 | FREETMPS; |
|
|
610 | LEAVE; |
|
|
611 | |
|
|
612 | if (SvTRUE (ERRSV)) |
|
|
613 | { |
|
|
614 | rxvt_warn ("perl hook %d evaluation error: %s", htype, SvPV_nolen (ERRSV)); |
|
|
615 | ungrab (term); // better lose the grab than the session |
|
|
616 | } |
|
|
617 | |
|
|
618 | if (htype == HOOK_DESTROY) |
|
|
619 | { |
|
|
620 | clearSVptr ((SV *)term->perl.self); |
|
|
621 | SvREFCNT_dec ((SV *)term->perl.self); |
|
|
622 | } |
|
|
623 | |
|
|
624 | swap (perl_environ, environ); |
278 | return count; |
625 | return count; |
279 | } |
626 | } |
280 | |
627 | |
281 | default: |
628 | default: |
282 | rxvt_fatal ("FATAL: unable to pass data type %d\n", dt); |
629 | rxvt_fatal ("FATAL: unable to pass data type %d\n", dt); |
|
|
630 | } |
283 | } |
631 | } |
284 | } |
632 | } |
|
|
633 | catch (...) |
|
|
634 | { |
|
|
635 | swap (perl_environ, environ); |
|
|
636 | throw; |
|
|
637 | } |
285 | } |
638 | } |
286 | |
639 | |
287 | ///////////////////////////////////////////////////////////////////////////// |
640 | ///////////////////////////////////////////////////////////////////////////// |
288 | |
641 | |
289 | MODULE = urxvt PACKAGE = urxvt |
642 | MODULE = urxvt PACKAGE = urxvt |
290 | |
643 | |
291 | PROTOTYPES: ENABLE |
644 | PROTOTYPES: ENABLE |
292 | |
645 | |
293 | BOOT: |
646 | BOOT: |
294 | { |
647 | { |
295 | # define set_hookname(sym) av_store (hookname, PP_CONCAT(HOOK_, sym), newSVpv (PP_STRINGIFY(sym), 0)) |
648 | sv_setsv (get_sv ("urxvt::LIBDIR", 1), newSVpvn (LIBDIR, sizeof (LIBDIR) - 1)); |
|
|
649 | sv_setsv (get_sv ("urxvt::RESNAME", 1), newSVpvn (RESNAME, sizeof (RESNAME) - 1)); |
|
|
650 | sv_setsv (get_sv ("urxvt::RESCLASS", 1), newSVpvn (RESCLASS, sizeof (RESCLASS) - 1)); |
|
|
651 | sv_setsv (get_sv ("urxvt::RXVTNAME", 1), newSVpvn (RXVTNAME, sizeof (RXVTNAME) - 1)); |
|
|
652 | |
296 | AV *hookname = get_av ("urxvt::HOOKNAME", 1); |
653 | AV *hookname = get_av ("urxvt::HOOKNAME", 1); |
297 | set_hookname (INIT); |
654 | # define def(sym) av_store (hookname, HOOK_ ## sym, newSVpv (# sym, 0)); |
298 | set_hookname (RESET); |
655 | # include "hookinc.h" |
299 | set_hookname (START); |
656 | # undef def |
300 | set_hookname (DESTROY); |
|
|
301 | set_hookname (SEL_BEGIN); |
|
|
302 | set_hookname (SEL_EXTEND); |
|
|
303 | set_hookname (SEL_MAKE); |
|
|
304 | set_hookname (SEL_GRAB); |
|
|
305 | set_hookname (FOCUS_IN); |
|
|
306 | set_hookname (FOCUS_OUT); |
|
|
307 | set_hookname (VIEW_CHANGE); |
|
|
308 | set_hookname (SCROLL_BACK); |
|
|
309 | set_hookname (TTY_ACTIVITY); |
|
|
310 | set_hookname (REFRESH_BEGIN); |
|
|
311 | set_hookname (REFRESH_END); |
|
|
312 | set_hookname (KEYBOARD_COMMAND); |
|
|
313 | |
657 | |
314 | sv_setpv (get_sv ("urxvt::LIBDIR", 1), LIBDIR); |
658 | HV *option = get_hv ("urxvt::OPTION", 1); |
|
|
659 | # define def(name,val) hv_store (option, # name, sizeof (# name) - 1, newSVuv (Opt_ ## name), 0); |
|
|
660 | # define nodef(name) |
|
|
661 | # include "optinc.h" |
|
|
662 | # undef nodef |
|
|
663 | # undef def |
|
|
664 | |
|
|
665 | HV *stash = gv_stashpv ("urxvt", 1); |
|
|
666 | # define export_const_iv(name) newCONSTSUB (stash, # name, newSViv (name)); |
|
|
667 | export_const_iv (DEFAULT_RSTYLE); |
|
|
668 | export_const_iv (OVERLAY_RSTYLE); |
|
|
669 | export_const_iv (RS_Bold); |
|
|
670 | export_const_iv (RS_Italic); |
|
|
671 | export_const_iv (RS_Blink); |
|
|
672 | export_const_iv (RS_RVid); |
|
|
673 | export_const_iv (RS_Uline); |
|
|
674 | |
|
|
675 | export_const_iv (CurrentTime); |
|
|
676 | export_const_iv (ShiftMask); |
|
|
677 | export_const_iv (LockMask); |
|
|
678 | export_const_iv (ControlMask); |
|
|
679 | export_const_iv (Mod1Mask); |
|
|
680 | export_const_iv (Mod2Mask); |
|
|
681 | export_const_iv (Mod3Mask); |
|
|
682 | export_const_iv (Mod4Mask); |
|
|
683 | export_const_iv (Mod5Mask); |
|
|
684 | export_const_iv (Button1Mask); |
|
|
685 | export_const_iv (Button2Mask); |
|
|
686 | export_const_iv (Button3Mask); |
|
|
687 | export_const_iv (Button4Mask); |
|
|
688 | export_const_iv (Button5Mask); |
|
|
689 | export_const_iv (AnyModifier); |
|
|
690 | |
|
|
691 | export_const_iv (EVENT_NONE); |
|
|
692 | export_const_iv (EVENT_READ); |
|
|
693 | export_const_iv (EVENT_WRITE); |
315 | } |
694 | } |
316 | |
695 | |
317 | void |
696 | void |
318 | set_should_invoke (int htype, int value) |
697 | set_should_invoke (int htype, int value) |
319 | CODE: |
698 | CODE: |
… | |
… | |
326 | |
705 | |
327 | void |
706 | void |
328 | fatal (const char *msg) |
707 | fatal (const char *msg) |
329 | CODE: |
708 | CODE: |
330 | rxvt_fatal ("%s", msg); |
709 | rxvt_fatal ("%s", msg); |
|
|
710 | |
|
|
711 | SV * |
|
|
712 | untaint (SV *sv) |
|
|
713 | CODE: |
|
|
714 | RETVAL = newSVsv (sv); |
|
|
715 | SvTAINTED_off (RETVAL); |
|
|
716 | OUTPUT: |
|
|
717 | RETVAL |
|
|
718 | |
|
|
719 | bool |
|
|
720 | safe () |
|
|
721 | CODE: |
|
|
722 | RETVAL = !rxvt_tainted (); |
|
|
723 | OUTPUT: |
|
|
724 | RETVAL |
331 | |
725 | |
332 | NV |
726 | NV |
333 | NOW () |
727 | NOW () |
334 | CODE: |
728 | CODE: |
335 | RETVAL = NOW; |
729 | RETVAL = NOW; |
336 | OUTPUT: |
730 | OUTPUT: |
337 | RETVAL |
731 | RETVAL |
338 | |
732 | |
|
|
733 | int |
|
|
734 | GET_BASEFG (int rend) |
|
|
735 | CODE: |
|
|
736 | RETVAL = GET_BASEFG (rend); |
|
|
737 | OUTPUT: |
|
|
738 | RETVAL |
|
|
739 | |
|
|
740 | int |
|
|
741 | GET_BASEBG (int rend) |
|
|
742 | CODE: |
|
|
743 | RETVAL = GET_BASEBG (rend); |
|
|
744 | OUTPUT: |
|
|
745 | RETVAL |
|
|
746 | |
|
|
747 | int |
|
|
748 | SET_FGCOLOR (int rend, int new_color) |
|
|
749 | CODE: |
|
|
750 | RETVAL = SET_FGCOLOR (rend, new_color); |
|
|
751 | OUTPUT: |
|
|
752 | RETVAL |
|
|
753 | |
|
|
754 | int |
|
|
755 | SET_BGCOLOR (int rend, int new_color) |
|
|
756 | CODE: |
|
|
757 | RETVAL = SET_BGCOLOR (rend, new_color); |
|
|
758 | OUTPUT: |
|
|
759 | RETVAL |
|
|
760 | |
|
|
761 | int |
|
|
762 | GET_CUSTOM (int rend) |
|
|
763 | CODE: |
|
|
764 | RETVAL = (rend && RS_customMask) >> RS_customShift; |
|
|
765 | OUTPUT: |
|
|
766 | RETVAL |
|
|
767 | |
|
|
768 | int |
|
|
769 | SET_CUSTOM (int rend, int new_value) |
|
|
770 | CODE: |
|
|
771 | { |
|
|
772 | if (!IN_RANGE_EXC (new_value, 0, RS_customCount)) |
|
|
773 | croak ("custom value out of range, must be 0..%d", RS_customCount - 1); |
|
|
774 | |
|
|
775 | RETVAL = (rend & ~RS_customMask) |
|
|
776 | | ((new_value << RS_customShift) & RS_customMask); |
|
|
777 | } |
|
|
778 | OUTPUT: |
|
|
779 | RETVAL |
|
|
780 | |
339 | MODULE = urxvt PACKAGE = urxvt::term |
781 | MODULE = urxvt PACKAGE = urxvt::term |
|
|
782 | |
|
|
783 | SV * |
|
|
784 | _new (...) |
|
|
785 | CODE: |
|
|
786 | { |
|
|
787 | if (items < 1 || !SvROK (ST (0)) || SvTYPE (SvRV (ST (0))) != SVt_PVAV) |
|
|
788 | croak ("first argument to urxvt::term->_new must be arrayref"); |
|
|
789 | |
|
|
790 | rxvt_term *term = new rxvt_term; |
|
|
791 | |
|
|
792 | term->argv = new stringvec; |
|
|
793 | term->envv = new stringvec; |
|
|
794 | |
|
|
795 | for (int i = 1; i < items; i++) |
|
|
796 | term->argv->push_back (strdup (SvPVbyte_nolen (ST (i)))); |
|
|
797 | |
|
|
798 | AV *envv = (AV *)SvRV (ST (0)); |
|
|
799 | for (int i = av_len (envv) + 1; i--; ) |
|
|
800 | term->envv->push_back (strdup (SvPVbyte_nolen (*av_fetch (envv, i, 1)))); |
|
|
801 | |
|
|
802 | term->envv->push_back (0); |
|
|
803 | |
|
|
804 | bool success; |
|
|
805 | |
|
|
806 | try |
|
|
807 | { |
|
|
808 | success = term->init (term->argv->size (), term->argv->begin ()); |
|
|
809 | } |
|
|
810 | catch (const class rxvt_failure_exception &e) |
|
|
811 | { |
|
|
812 | success = false; |
|
|
813 | } |
|
|
814 | |
|
|
815 | if (!success) |
|
|
816 | { |
|
|
817 | term->destroy (); |
|
|
818 | croak ("error while initializing new terminal instance"); |
|
|
819 | } |
|
|
820 | |
|
|
821 | RETVAL = term && term->perl.self |
|
|
822 | ? newSVterm (term) : &PL_sv_undef; |
|
|
823 | } |
|
|
824 | OUTPUT: |
|
|
825 | RETVAL |
|
|
826 | |
|
|
827 | void |
|
|
828 | rxvt_term::destroy () |
|
|
829 | |
|
|
830 | void |
|
|
831 | rxvt_term::grab_button (int button, U32 modifiers) |
|
|
832 | CODE: |
|
|
833 | XGrabButton (THIS->display->display, button, modifiers, THIS->vt, 1, |
|
|
834 | ButtonPressMask | ButtonReleaseMask | EnterWindowMask | LeaveWindowMask | PointerMotionMask, |
|
|
835 | GrabModeSync, GrabModeSync, None, GRAB_CURSOR); |
|
|
836 | |
|
|
837 | bool |
|
|
838 | rxvt_term::grab (U32 eventtime, int sync = 0) |
|
|
839 | CODE: |
|
|
840 | { |
|
|
841 | int mode = sync ? GrabModeSync : GrabModeAsync; |
|
|
842 | |
|
|
843 | THIS->perl.grabtime = 0; |
|
|
844 | |
|
|
845 | if (!XGrabPointer (THIS->display->display, THIS->vt, 0, |
|
|
846 | ButtonPressMask | ButtonReleaseMask | EnterWindowMask | LeaveWindowMask | PointerMotionMask, |
|
|
847 | mode, mode, None, GRAB_CURSOR, eventtime)) |
|
|
848 | if (!XGrabKeyboard (THIS->display->display, THIS->vt, 0, mode, mode, eventtime)) |
|
|
849 | THIS->perl.grabtime = eventtime; |
|
|
850 | else |
|
|
851 | XUngrabPointer (THIS->display->display, eventtime); |
|
|
852 | |
|
|
853 | RETVAL = !!THIS->perl.grabtime; |
|
|
854 | } |
|
|
855 | OUTPUT: |
|
|
856 | RETVAL |
|
|
857 | |
|
|
858 | void |
|
|
859 | rxvt_term::allow_events_async () |
|
|
860 | CODE: |
|
|
861 | XAllowEvents (THIS->display->display, AsyncBoth, THIS->perl.grabtime); |
|
|
862 | |
|
|
863 | void |
|
|
864 | rxvt_term::allow_events_sync () |
|
|
865 | CODE: |
|
|
866 | XAllowEvents (THIS->display->display, SyncBoth, THIS->perl.grabtime); |
|
|
867 | |
|
|
868 | void |
|
|
869 | rxvt_term::allow_events_replay () |
|
|
870 | CODE: |
|
|
871 | XAllowEvents (THIS->display->display, ReplayPointer, THIS->perl.grabtime); |
|
|
872 | XAllowEvents (THIS->display->display, ReplayKeyboard, THIS->perl.grabtime); |
|
|
873 | |
|
|
874 | void |
|
|
875 | rxvt_term::ungrab () |
|
|
876 | CODE: |
|
|
877 | ungrab (THIS); |
340 | |
878 | |
341 | int |
879 | int |
342 | rxvt_term::strwidth (SV *str) |
880 | rxvt_term::strwidth (SV *str) |
343 | CODE: |
881 | CODE: |
344 | { |
882 | { |
… | |
… | |
363 | char *mbstr = rxvt_wcstombs (wstr); |
901 | char *mbstr = rxvt_wcstombs (wstr); |
364 | rxvt_pop_locale (); |
902 | rxvt_pop_locale (); |
365 | |
903 | |
366 | free (wstr); |
904 | free (wstr); |
367 | |
905 | |
368 | RETVAL = newSVpv (mbstr, 0); |
906 | RETVAL = taint_if (newSVpv (mbstr, 0), str); |
369 | free (mbstr); |
907 | free (mbstr); |
370 | } |
908 | } |
371 | OUTPUT: |
909 | OUTPUT: |
372 | RETVAL |
910 | RETVAL |
373 | |
911 | |
… | |
… | |
380 | |
918 | |
381 | rxvt_push_locale (THIS->locale); |
919 | rxvt_push_locale (THIS->locale); |
382 | wchar_t *wstr = rxvt_mbstowcs (data, len); |
920 | wchar_t *wstr = rxvt_mbstowcs (data, len); |
383 | rxvt_pop_locale (); |
921 | rxvt_pop_locale (); |
384 | |
922 | |
385 | char *str = rxvt_wcstoutf8 (wstr); |
923 | RETVAL = taint_if (wcs2sv (wstr), octets); |
386 | free (wstr); |
924 | free (wstr); |
387 | |
|
|
388 | RETVAL = newSVpv (str, 0); |
|
|
389 | SvUTF8_on (RETVAL); |
|
|
390 | free (str); |
|
|
391 | } |
925 | } |
392 | OUTPUT: |
926 | OUTPUT: |
393 | RETVAL |
927 | RETVAL |
|
|
928 | |
|
|
929 | #define TERM_OFFSET(sym) offsetof (TermWin_t, sym) |
|
|
930 | |
|
|
931 | #define TERM_OFFSET_width TERM_OFFSET(width) |
|
|
932 | #define TERM_OFFSET_height TERM_OFFSET(height) |
|
|
933 | #define TERM_OFFSET_fwidth TERM_OFFSET(fwidth) |
|
|
934 | #define TERM_OFFSET_fheight TERM_OFFSET(fheight) |
|
|
935 | #define TERM_OFFSET_fbase TERM_OFFSET(fbase) |
|
|
936 | #define TERM_OFFSET_nrow TERM_OFFSET(nrow) |
|
|
937 | #define TERM_OFFSET_ncol TERM_OFFSET(ncol) |
|
|
938 | #define TERM_OFFSET_focus TERM_OFFSET(focus) |
|
|
939 | #define TERM_OFFSET_mapped TERM_OFFSET(mapped) |
|
|
940 | #define TERM_OFFSET_saveLines TERM_OFFSET(saveLines) |
|
|
941 | #define TERM_OFFSET_total_rows TERM_OFFSET(total_rows) |
|
|
942 | #define TERM_OFFSET_nsaved TERM_OFFSET(nsaved) |
394 | |
943 | |
395 | int |
944 | int |
|
|
945 | rxvt_term::width () |
|
|
946 | ALIAS: |
|
|
947 | width = TERM_OFFSET_width |
|
|
948 | height = TERM_OFFSET_height |
|
|
949 | fwidth = TERM_OFFSET_fwidth |
|
|
950 | fheight = TERM_OFFSET_fheight |
|
|
951 | fbase = TERM_OFFSET_fbase |
|
|
952 | nrow = TERM_OFFSET_nrow |
|
|
953 | ncol = TERM_OFFSET_ncol |
|
|
954 | focus = TERM_OFFSET_focus |
|
|
955 | mapped = TERM_OFFSET_mapped |
|
|
956 | saveLines = TERM_OFFSET_saveLines |
|
|
957 | total_rows = TERM_OFFSET_total_rows |
|
|
958 | nsaved = TERM_OFFSET_nsaved |
|
|
959 | CODE: |
|
|
960 | RETVAL = *(int *)((char *)THIS + ix); |
|
|
961 | OUTPUT: |
|
|
962 | RETVAL |
|
|
963 | |
|
|
964 | unsigned int |
|
|
965 | rxvt_term::ModLevel3Mask () |
|
|
966 | ALIAS: |
|
|
967 | ModLevel3Mask = 0 |
|
|
968 | ModMetaMask = 1 |
|
|
969 | ModNumLockMask = 2 |
|
|
970 | CODE: |
|
|
971 | switch (ix) |
|
|
972 | { |
|
|
973 | case 0: RETVAL = THIS->ModLevel3Mask; break; |
|
|
974 | case 1: RETVAL = THIS->ModMetaMask; break; |
|
|
975 | case 2: RETVAL = THIS->ModNumLockMask; break; |
|
|
976 | } |
|
|
977 | OUTPUT: |
|
|
978 | RETVAL |
|
|
979 | |
|
|
980 | char * |
|
|
981 | rxvt_term::display_id () |
|
|
982 | ALIAS: |
|
|
983 | display_id = 0 |
|
|
984 | locale = 1 |
|
|
985 | CODE: |
|
|
986 | switch (ix) |
|
|
987 | { |
|
|
988 | case 0: RETVAL = THIS->display->id; break; |
|
|
989 | case 1: RETVAL = THIS->locale; break; |
|
|
990 | } |
|
|
991 | OUTPUT: |
|
|
992 | RETVAL |
|
|
993 | |
|
|
994 | SV * |
396 | rxvt_term::nsaved () |
995 | rxvt_term::_env () |
397 | CODE: |
996 | CODE: |
|
|
997 | { |
|
|
998 | if (THIS->envv) |
|
|
999 | { |
|
|
1000 | AV *av = newAV (); |
|
|
1001 | |
|
|
1002 | for (char **i = THIS->envv->begin (); i != THIS->envv->end (); ++i) |
|
|
1003 | if (*i) |
|
|
1004 | av_push (av, newSVpv (*i, 0)); |
|
|
1005 | |
|
|
1006 | RETVAL = newRV_noinc ((SV *)av); |
|
|
1007 | } |
|
|
1008 | else |
|
|
1009 | RETVAL = &PL_sv_undef; |
|
|
1010 | } |
|
|
1011 | OUTPUT: |
|
|
1012 | RETVAL |
|
|
1013 | |
|
|
1014 | int |
|
|
1015 | rxvt_term::pty_ev_events (int events = EVENT_UNDEF) |
|
|
1016 | CODE: |
|
|
1017 | RETVAL = THIS->pty_ev.events; |
|
|
1018 | if (events != EVENT_UNDEF) |
|
|
1019 | THIS->pty_ev.set (events); |
|
|
1020 | OUTPUT: |
|
|
1021 | RETVAL |
|
|
1022 | |
|
|
1023 | U32 |
|
|
1024 | rxvt_term::parent () |
|
|
1025 | CODE: |
|
|
1026 | RETVAL = (U32)THIS->parent [0]; |
|
|
1027 | OUTPUT: |
|
|
1028 | RETVAL |
|
|
1029 | |
|
|
1030 | U32 |
|
|
1031 | rxvt_term::vt () |
|
|
1032 | CODE: |
|
|
1033 | RETVAL = (U32)THIS->vt; |
|
|
1034 | OUTPUT: |
|
|
1035 | RETVAL |
|
|
1036 | |
|
|
1037 | U32 |
|
|
1038 | rxvt_term::rstyle (U32 new_rstyle = THIS->rstyle) |
|
|
1039 | CODE: |
|
|
1040 | { |
398 | RETVAL = THIS->nsaved; |
1041 | RETVAL = THIS->rstyle; |
|
|
1042 | THIS->rstyle = new_rstyle; |
|
|
1043 | } |
399 | OUTPUT: |
1044 | OUTPUT: |
400 | RETVAL |
1045 | RETVAL |
401 | |
1046 | |
402 | int |
1047 | int |
403 | rxvt_term::view_start (int newval = -1) |
1048 | rxvt_term::view_start (int newval = -1) |
404 | CODE: |
1049 | CODE: |
405 | { |
1050 | { |
… | |
… | |
413 | } |
1058 | } |
414 | OUTPUT: |
1059 | OUTPUT: |
415 | RETVAL |
1060 | RETVAL |
416 | |
1061 | |
417 | void |
1062 | void |
|
|
1063 | rxvt_term::want_refresh () |
|
|
1064 | CODE: |
|
|
1065 | THIS->want_refresh = 1; |
|
|
1066 | |
|
|
1067 | void |
|
|
1068 | rxvt_term::ROW_t (int row_number, SV *new_text = 0, int start_col = 0, int start_ofs = 0, int max_len = MAX_COLS) |
|
|
1069 | PPCODE: |
|
|
1070 | { |
|
|
1071 | if (!IN_RANGE_EXC (row_number, -THIS->nsaved, THIS->nrow)) |
|
|
1072 | XSRETURN_EMPTY; |
|
|
1073 | |
|
|
1074 | line_t &l = ROW(row_number); |
|
|
1075 | |
|
|
1076 | if (GIMME_V != G_VOID) |
|
|
1077 | { |
|
|
1078 | wchar_t *wstr = new wchar_t [THIS->ncol]; |
|
|
1079 | |
|
|
1080 | for (int col = 0; col < THIS->ncol; col++) |
|
|
1081 | wstr [col] = l.t [col]; |
|
|
1082 | |
|
|
1083 | XPUSHs (taint (sv_2mortal (wcs2sv (wstr, THIS->ncol)))); |
|
|
1084 | |
|
|
1085 | delete [] wstr; |
|
|
1086 | } |
|
|
1087 | |
|
|
1088 | if (new_text) |
|
|
1089 | { |
|
|
1090 | wchar_t *wstr = sv2wcs (new_text); |
|
|
1091 | |
|
|
1092 | int len = min (wcslen (wstr) - start_ofs, max_len); |
|
|
1093 | |
|
|
1094 | if (!IN_RANGE_INC (start_col, 0, THIS->ncol - len)) |
|
|
1095 | { |
|
|
1096 | free (wstr); |
|
|
1097 | croak ("new_text extends beyond horizontal margins"); |
|
|
1098 | } |
|
|
1099 | |
|
|
1100 | for (int col = start_col; col < start_col + len; col++) |
|
|
1101 | { |
|
|
1102 | l.t [col] = wstr [start_ofs + col - start_col]; |
|
|
1103 | l.r [col] = SET_FONT (l.r [col], THIS->fontset [GET_STYLE (l.r [col])]->find_font (l.t [col])); |
|
|
1104 | } |
|
|
1105 | |
|
|
1106 | free (wstr); |
|
|
1107 | } |
|
|
1108 | } |
|
|
1109 | |
|
|
1110 | void |
|
|
1111 | rxvt_term::ROW_r (int row_number, SV *new_rend = 0, int start_col = 0, int start_ofs = 0, int max_len = MAX_COLS) |
|
|
1112 | PPCODE: |
|
|
1113 | { |
|
|
1114 | if (!IN_RANGE_EXC (row_number, -THIS->nsaved, THIS->nrow)) |
|
|
1115 | XSRETURN_EMPTY; |
|
|
1116 | |
|
|
1117 | line_t &l = ROW(row_number); |
|
|
1118 | |
|
|
1119 | if (GIMME_V != G_VOID) |
|
|
1120 | { |
|
|
1121 | AV *av = newAV (); |
|
|
1122 | |
|
|
1123 | av_extend (av, THIS->ncol - 1); |
|
|
1124 | for (int col = 0; col < THIS->ncol; col++) |
|
|
1125 | av_store (av, col, newSViv (l.r [col])); |
|
|
1126 | |
|
|
1127 | XPUSHs (sv_2mortal (newRV_noinc ((SV *)av))); |
|
|
1128 | } |
|
|
1129 | |
|
|
1130 | if (new_rend) |
|
|
1131 | { |
|
|
1132 | if (!SvROK (new_rend) || SvTYPE (SvRV (new_rend)) != SVt_PVAV) |
|
|
1133 | croak ("new_rend must be arrayref"); |
|
|
1134 | |
|
|
1135 | AV *av = (AV *)SvRV (new_rend); |
|
|
1136 | int len = min (av_len (av) + 1 - start_ofs, max_len); |
|
|
1137 | |
|
|
1138 | if (!IN_RANGE_INC (start_col, 0, THIS->ncol - len)) |
|
|
1139 | croak ("new_rend array extends beyond horizontal margins"); |
|
|
1140 | |
|
|
1141 | for (int col = start_col; col < start_col + len; col++) |
|
|
1142 | { |
|
|
1143 | rend_t r = SvIV (*av_fetch (av, start_ofs + col - start_col, 1)) & ~RS_fontMask; |
|
|
1144 | |
|
|
1145 | l.r [col] = SET_FONT (r, THIS->fontset [GET_STYLE (r)]->find_font (l.t [col])); |
|
|
1146 | } |
|
|
1147 | } |
|
|
1148 | } |
|
|
1149 | |
|
|
1150 | int |
|
|
1151 | rxvt_term::ROW_l (int row_number, int new_length = -1) |
|
|
1152 | CODE: |
|
|
1153 | { |
|
|
1154 | if (!IN_RANGE_EXC (row_number, -THIS->nsaved, THIS->nrow)) |
|
|
1155 | XSRETURN_EMPTY; |
|
|
1156 | |
|
|
1157 | line_t &l = ROW(row_number); |
|
|
1158 | RETVAL = l.l; |
|
|
1159 | |
|
|
1160 | if (new_length >= 0) |
|
|
1161 | l.l = new_length; |
|
|
1162 | } |
|
|
1163 | OUTPUT: |
|
|
1164 | RETVAL |
|
|
1165 | |
|
|
1166 | bool |
|
|
1167 | rxvt_term::ROW_is_longer (int row_number, int new_is_longer = -1) |
|
|
1168 | CODE: |
|
|
1169 | { |
|
|
1170 | if (!IN_RANGE_EXC (row_number, -THIS->nsaved, THIS->nrow)) |
|
|
1171 | XSRETURN_EMPTY; |
|
|
1172 | |
|
|
1173 | line_t &l = ROW(row_number); |
|
|
1174 | RETVAL = l.is_longer (); |
|
|
1175 | |
|
|
1176 | if (new_is_longer >= 0) |
|
|
1177 | l.is_longer (new_is_longer); |
|
|
1178 | } |
|
|
1179 | OUTPUT: |
|
|
1180 | RETVAL |
|
|
1181 | |
|
|
1182 | SV * |
|
|
1183 | rxvt_term::special_encode (SV *string) |
|
|
1184 | CODE: |
|
|
1185 | { |
|
|
1186 | wchar_t *wstr = sv2wcs (string); |
|
|
1187 | int wlen = wcslen (wstr); |
|
|
1188 | wchar_t *rstr = new wchar_t [wlen]; // cannot become longer |
|
|
1189 | |
|
|
1190 | rxvt_push_locale (THIS->locale); |
|
|
1191 | |
|
|
1192 | wchar_t *r = rstr; |
|
|
1193 | for (wchar_t *s = wstr; *s; s++) |
|
|
1194 | if (wcwidth (*s) == 0) |
|
|
1195 | { |
|
|
1196 | if (r == rstr) |
|
|
1197 | croak ("leading combining character unencodable"); |
|
|
1198 | |
|
|
1199 | unicode_t n = rxvt_compose (r[-1], *s); |
|
|
1200 | if (n == NOCHAR) |
|
|
1201 | n = rxvt_composite.compose (r[-1], *s); |
|
|
1202 | |
|
|
1203 | r[-1] = n; |
|
|
1204 | } |
|
|
1205 | #if !UNICODE_3 |
|
|
1206 | else if (*s >= 0x10000) |
|
|
1207 | *r++ = rxvt_composite.compose (*s); |
|
|
1208 | #endif |
|
|
1209 | else |
|
|
1210 | *r++ = *s; |
|
|
1211 | |
|
|
1212 | rxvt_pop_locale (); |
|
|
1213 | |
|
|
1214 | RETVAL = taint_if (wcs2sv (rstr, r - rstr), string); |
|
|
1215 | |
|
|
1216 | delete [] rstr; |
|
|
1217 | } |
|
|
1218 | OUTPUT: |
|
|
1219 | RETVAL |
|
|
1220 | |
|
|
1221 | SV * |
|
|
1222 | rxvt_term::special_decode (SV *text) |
|
|
1223 | CODE: |
|
|
1224 | { |
|
|
1225 | wchar_t *wstr = sv2wcs (text); |
|
|
1226 | int wlen = wcslen (wstr); |
|
|
1227 | int dlen = 0; |
|
|
1228 | |
|
|
1229 | // find length |
|
|
1230 | for (wchar_t *s = wstr; *s; s++) |
|
|
1231 | if (*s == NOCHAR) |
|
|
1232 | ; |
|
|
1233 | else if (IS_COMPOSE (*s)) |
|
|
1234 | dlen += rxvt_composite.expand (*s, 0); |
|
|
1235 | else |
|
|
1236 | dlen++; |
|
|
1237 | |
|
|
1238 | wchar_t *rstr = new wchar_t [dlen]; |
|
|
1239 | |
|
|
1240 | // decode |
|
|
1241 | wchar_t *r = rstr; |
|
|
1242 | for (wchar_t *s = wstr; *s; s++) |
|
|
1243 | if (*s == NOCHAR) |
|
|
1244 | ; |
|
|
1245 | else if (IS_COMPOSE (*s)) |
|
|
1246 | r += rxvt_composite.expand (*s, r); |
|
|
1247 | else |
|
|
1248 | *r++ = *s; |
|
|
1249 | |
|
|
1250 | RETVAL = taint_if (wcs2sv (rstr, r - rstr), text); |
|
|
1251 | |
|
|
1252 | delete [] rstr; |
|
|
1253 | } |
|
|
1254 | OUTPUT: |
|
|
1255 | RETVAL |
|
|
1256 | |
|
|
1257 | void |
418 | rxvt_term::_resource (char *name, int index, SV *newval = 0) |
1258 | rxvt_term::_resource (char *name, int index, SV *newval = 0) |
419 | PPCODE: |
1259 | PPCODE: |
420 | { |
1260 | { |
421 | struct resval { const char *name; int value; } rslist [] = { |
1261 | struct resval { const char *name; int value; } rslist [] = { |
422 | # define Rs_def(name) { # name, Rs_ ## name }, |
1262 | # define def(name) { # name, Rs_ ## name }, |
423 | # define Rs_reserve(name,count) |
1263 | # define reserve(name,count) |
424 | # include "rsinc.h" |
1264 | # include "rsinc.h" |
425 | # undef Rs_def |
1265 | # undef def |
426 | # undef Rs_reserve |
1266 | # undef reserve |
427 | }; |
1267 | }; |
428 | |
1268 | |
429 | struct resval *rs = rslist + sizeof (rslist) / sizeof (rslist [0]); |
1269 | struct resval *rs = rslist + sizeof (rslist) / sizeof (rslist [0]); |
430 | |
1270 | |
431 | do { |
1271 | do { |
… | |
… | |
437 | |
1277 | |
438 | if (!IN_RANGE_EXC (index, 0, NUM_RESOURCES)) |
1278 | if (!IN_RANGE_EXC (index, 0, NUM_RESOURCES)) |
439 | croak ("requested out-of-bound resource %s+%d,", name, index - rs->value); |
1279 | croak ("requested out-of-bound resource %s+%d,", name, index - rs->value); |
440 | |
1280 | |
441 | if (GIMME_V != G_VOID) |
1281 | if (GIMME_V != G_VOID) |
442 | XPUSHs (THIS->rs [index] ? sv_2mortal (newSVpv (THIS->rs [index], 0)) : &PL_sv_undef); |
1282 | XPUSHs (THIS->rs [index] ? sv_2mortal (taint (newSVpv (THIS->rs [index], 0))) : &PL_sv_undef); |
443 | |
1283 | |
444 | if (newval) |
1284 | if (newval) |
445 | { |
1285 | { |
446 | if (SvOK (newval)) |
1286 | if (SvOK (newval)) |
447 | { |
1287 | { |
… | |
… | |
452 | else |
1292 | else |
453 | THIS->rs [index] = 0; |
1293 | THIS->rs [index] = 0; |
454 | } |
1294 | } |
455 | } |
1295 | } |
456 | |
1296 | |
|
|
1297 | const char * |
|
|
1298 | rxvt_term::x_resource (const char *name) |
|
|
1299 | CLEANUP: |
|
|
1300 | SvTAINTED_on (ST (0)); |
|
|
1301 | |
|
|
1302 | bool |
|
|
1303 | rxvt_term::option (U32 optval, int set = -1) |
|
|
1304 | CODE: |
|
|
1305 | { |
|
|
1306 | RETVAL = THIS->options & optval; |
|
|
1307 | |
|
|
1308 | if (set >= 0) |
|
|
1309 | { |
|
|
1310 | if (set) |
|
|
1311 | THIS->options |= optval; |
|
|
1312 | else |
|
|
1313 | THIS->options &= ~optval; |
|
|
1314 | |
|
|
1315 | switch (optval) |
|
|
1316 | { |
|
|
1317 | case Opt_skipBuiltinGlyphs: |
|
|
1318 | THIS->set_fonts (); |
|
|
1319 | THIS->scr_remap_chars (); |
|
|
1320 | THIS->scr_touch (true); |
|
|
1321 | THIS->want_refresh = 1; |
|
|
1322 | break; |
|
|
1323 | |
|
|
1324 | case Opt_cursorUnderline: |
|
|
1325 | THIS->want_refresh = 1; |
|
|
1326 | break; |
|
|
1327 | |
|
|
1328 | # case Opt_scrollBar_floating: |
|
|
1329 | # case Opt_scrollBar_right: |
|
|
1330 | # THIS->resize_all_windows (THIS->width, THIS->height, 1); |
|
|
1331 | # break; |
|
|
1332 | } |
|
|
1333 | } |
|
|
1334 | } |
|
|
1335 | OUTPUT: |
|
|
1336 | RETVAL |
|
|
1337 | |
|
|
1338 | bool |
|
|
1339 | rxvt_term::parse_keysym (char *keysym, char *str) |
|
|
1340 | CODE: |
|
|
1341 | RETVAL = 0 < THIS->parse_keysym (keysym, str); |
|
|
1342 | THIS->keyboard->register_done (); |
|
|
1343 | OUTPUT: |
|
|
1344 | RETVAL |
|
|
1345 | |
457 | void |
1346 | void |
458 | rxvt_term::selection_mark (...) |
1347 | rxvt_term::screen_cur (...) |
459 | PROTOTYPE: $;$$ |
1348 | PROTOTYPE: $;$$ |
460 | ALIAS: |
1349 | ALIAS: |
|
|
1350 | screen_cur = 0 |
461 | selection_beg = 1 |
1351 | selection_beg = 1 |
462 | selection_end = 2 |
1352 | selection_end = 2 |
|
|
1353 | selection_mark = 3 |
463 | PPCODE: |
1354 | PPCODE: |
464 | { |
1355 | { |
465 | row_col_t &sel = ix == 1 ? THIS->selection.beg |
1356 | row_col_t &rc = ix == 0 ? THIS->screen.cur |
|
|
1357 | : ix == 1 ? THIS->selection.beg |
466 | : ix == 2 ? THIS->selection.end |
1358 | : ix == 2 ? THIS->selection.end |
467 | : THIS->selection.mark; |
1359 | : THIS->selection.mark; |
468 | |
1360 | |
469 | if (GIMME_V != G_VOID) |
1361 | if (GIMME_V != G_VOID) |
470 | { |
1362 | { |
471 | EXTEND (SP, 2); |
1363 | EXTEND (SP, 2); |
472 | PUSHs (sv_2mortal (newSViv (sel.row))); |
1364 | PUSHs (sv_2mortal (newSViv (rc.row))); |
473 | PUSHs (sv_2mortal (newSViv (sel.col))); |
1365 | PUSHs (sv_2mortal (newSViv (rc.col))); |
474 | } |
1366 | } |
475 | |
1367 | |
476 | if (items == 3) |
1368 | if (items == 3) |
477 | { |
1369 | { |
478 | sel.row = clamp (SvIV (ST (1)), -THIS->nsaved, THIS->nrow - 1); |
1370 | rc.row = clamp (SvIV (ST (1)), -THIS->nsaved, THIS->nrow - 1); |
479 | sel.col = clamp (SvIV (ST (2)), 0, THIS->ncol - 1); |
1371 | rc.col = clamp (SvIV (ST (2)), 0, THIS->ncol - 1); |
480 | |
1372 | |
481 | if (ix) |
1373 | if (ix) |
482 | THIS->want_refresh = 1; |
1374 | THIS->want_refresh = 1; |
483 | } |
1375 | } |
484 | } |
1376 | } |
485 | |
1377 | |
|
|
1378 | char |
|
|
1379 | rxvt_term::cur_charset () |
|
|
1380 | CODE: |
|
|
1381 | RETVAL = THIS->charsets [THIS->screen.charset]; |
|
|
1382 | OUTPUT: |
|
|
1383 | RETVAL |
|
|
1384 | |
486 | int |
1385 | int |
487 | rxvt_term::selection_grab (int eventtime) |
1386 | rxvt_term::selection_grab (U32 eventtime) |
488 | |
1387 | |
489 | void |
1388 | void |
490 | rxvt_term::selection (SV *newtext = 0) |
1389 | rxvt_term::selection (SV *newtext = 0) |
491 | PPCODE: |
1390 | PPCODE: |
492 | { |
1391 | { |
493 | if (GIMME_V != G_VOID) |
1392 | if (GIMME_V != G_VOID) |
494 | { |
1393 | XPUSHs (THIS->selection.text |
495 | char *sel = rxvt_wcstoutf8 (THIS->selection.text, THIS->selection.len); |
1394 | ? taint (sv_2mortal (wcs2sv (THIS->selection.text, THIS->selection.len))) |
496 | SV *sv = newSVpv (sel, 0); |
1395 | : &PL_sv_undef); |
497 | SvUTF8_on (sv); |
|
|
498 | free (sel); |
|
|
499 | XPUSHs (sv_2mortal (sv)); |
|
|
500 | } |
|
|
501 | |
1396 | |
502 | if (newtext) |
1397 | if (newtext) |
503 | { |
1398 | { |
504 | free (THIS->selection.text); |
1399 | free (THIS->selection.text); |
505 | |
1400 | |
506 | THIS->selection.text = sv2wcs (newtext); |
1401 | THIS->selection.text = sv2wcs (newtext); |
507 | THIS->selection.len = wcslen (THIS->selection.text); |
1402 | THIS->selection.len = wcslen (THIS->selection.text); |
508 | } |
1403 | } |
509 | } |
1404 | } |
510 | |
|
|
511 | void |
|
|
512 | rxvt_term::scr_overlay_new (int x, int y, int w, int h) |
|
|
513 | |
1405 | |
514 | void |
1406 | void |
|
|
1407 | rxvt_term::scr_xor_rect (int beg_row, int beg_col, int end_row, int end_col, U32 rstyle1 = RS_RVid, U32 rstyle2 = RS_RVid | RS_Uline) |
|
|
1408 | |
|
|
1409 | void |
|
|
1410 | rxvt_term::scr_xor_span (int beg_row, int beg_col, int end_row, int end_col, U32 rstyle = RS_RVid) |
|
|
1411 | |
|
|
1412 | void |
515 | rxvt_term::scr_overlay_off () |
1413 | rxvt_term::scr_bell () |
516 | |
1414 | |
517 | void |
1415 | void |
518 | rxvt_term::scr_overlay_set_char (int x, int y, U32 text, U32 rend = OVERLAY_RSTYLE) |
1416 | rxvt_term::scr_add_lines (SV *string) |
519 | CODE: |
1417 | CODE: |
520 | THIS->scr_overlay_set (x, y, text, rend); |
|
|
521 | |
|
|
522 | void |
|
|
523 | rxvt_term::scr_overlay_set (int x, int y, SV *text) |
|
|
524 | CODE: |
|
|
525 | { |
1418 | { |
526 | wchar_t *wtext = sv2wcs (text); |
1419 | wchar_t *wstr = sv2wcs (string); |
527 | THIS->scr_overlay_set (x, y, wtext); |
1420 | THIS->scr_add_lines (wstr, wcslen (wstr)); |
528 | free (wtext); |
1421 | free (wstr); |
529 | } |
1422 | } |
530 | |
1423 | |
531 | void |
1424 | void |
532 | rxvt_term::tt_write (SV *octets) |
1425 | rxvt_term::tt_write (SV *octets) |
533 | INIT: |
1426 | INIT: |
534 | STRLEN len; |
1427 | STRLEN len; |
535 | char *str = SvPVbyte (octets, len); |
1428 | char *str = SvPVbyte (octets, len); |
536 | C_ARGS: |
1429 | C_ARGS: |
537 | (unsigned char *)str, len |
1430 | str, len |
|
|
1431 | |
|
|
1432 | void |
|
|
1433 | rxvt_term::cmd_parse (SV *octets) |
|
|
1434 | CODE: |
|
|
1435 | { |
|
|
1436 | STRLEN len; |
|
|
1437 | char *str = SvPVbyte (octets, len); |
|
|
1438 | |
|
|
1439 | char *old_cmdbuf_ptr = THIS->cmdbuf_ptr; |
|
|
1440 | char *old_cmdbuf_endp = THIS->cmdbuf_endp; |
|
|
1441 | |
|
|
1442 | THIS->cmdbuf_ptr = str; |
|
|
1443 | THIS->cmdbuf_endp = str + len; |
|
|
1444 | |
|
|
1445 | rxvt_push_locale (THIS->locale); |
|
|
1446 | THIS->cmd_parse (); |
|
|
1447 | rxvt_pop_locale (); |
|
|
1448 | |
|
|
1449 | THIS->cmdbuf_ptr = old_cmdbuf_ptr; |
|
|
1450 | THIS->cmdbuf_endp = old_cmdbuf_endp; |
|
|
1451 | } |
|
|
1452 | |
|
|
1453 | SV * |
|
|
1454 | rxvt_term::overlay (int x, int y, int w, int h, int rstyle = OVERLAY_RSTYLE, int border = 2) |
|
|
1455 | CODE: |
|
|
1456 | { |
|
|
1457 | overlay *o = new overlay (THIS, x, y, w, h, rstyle, border); |
|
|
1458 | RETVAL = newSVptr ((void *)o, "urxvt::overlay"); |
|
|
1459 | o->self = (HV *)SvRV (RETVAL); |
|
|
1460 | } |
|
|
1461 | OUTPUT: |
|
|
1462 | RETVAL |
|
|
1463 | |
|
|
1464 | MODULE = urxvt PACKAGE = urxvt::overlay |
|
|
1465 | |
|
|
1466 | void |
|
|
1467 | overlay::set (int x, int y, SV *text, SV *rend = 0) |
|
|
1468 | |
|
|
1469 | void |
|
|
1470 | overlay::show () |
|
|
1471 | |
|
|
1472 | void |
|
|
1473 | overlay::hide () |
|
|
1474 | |
|
|
1475 | void |
|
|
1476 | overlay::DESTROY () |
538 | |
1477 | |
539 | MODULE = urxvt PACKAGE = urxvt::timer |
1478 | MODULE = urxvt PACKAGE = urxvt::timer |
540 | |
1479 | |
541 | SV * |
1480 | SV * |
542 | timer::new () |
1481 | timer::new () |
543 | CODE: |
1482 | CODE: |
544 | timer *w = new timer; |
1483 | timer *w = new timer; |
|
|
1484 | w->start (NOW); |
545 | RETVAL = newSVptr ((void *)w, "urxvt::timer"); |
1485 | RETVAL = newSVptr ((void *)w, "urxvt::timer"); |
546 | w->self = (HV *)SvRV (RETVAL); |
1486 | w->self = (HV *)SvRV (RETVAL); |
547 | OUTPUT: |
1487 | OUTPUT: |
548 | RETVAL |
1488 | RETVAL |
549 | |
1489 | |
… | |
… | |
557 | |
1497 | |
558 | NV |
1498 | NV |
559 | timer::at () |
1499 | timer::at () |
560 | CODE: |
1500 | CODE: |
561 | RETVAL = THIS->at; |
1501 | RETVAL = THIS->at; |
|
|
1502 | OUTPUT: |
|
|
1503 | RETVAL |
|
|
1504 | |
|
|
1505 | timer * |
|
|
1506 | timer::interval (NV interval) |
|
|
1507 | CODE: |
|
|
1508 | THIS->interval = interval; |
|
|
1509 | RETVAL = THIS; |
562 | OUTPUT: |
1510 | OUTPUT: |
563 | RETVAL |
1511 | RETVAL |
564 | |
1512 | |
565 | timer * |
1513 | timer * |
566 | timer::set (NV tstamp) |
1514 | timer::set (NV tstamp) |