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. |
… | |
… | |
35 | #include "rxvtutil.h" |
35 | #include "rxvtutil.h" |
36 | #include "rxvtperl.h" |
36 | #include "rxvtperl.h" |
37 | |
37 | |
38 | #include "perlxsi.c" |
38 | #include "perlxsi.c" |
39 | |
39 | |
|
|
40 | #undef LINENO |
|
|
41 | #define LINENO(n) MOD (THIS->term_start + int(n), THIS->total_rows) |
|
|
42 | #undef ROW |
|
|
43 | #define ROW(n) THIS->row_buf [LINENO (n)] |
|
|
44 | |
40 | ///////////////////////////////////////////////////////////////////////////// |
45 | ///////////////////////////////////////////////////////////////////////////// |
41 | |
46 | |
42 | static wchar_t * |
47 | static wchar_t * |
43 | sv2wcs (SV *sv) |
48 | sv2wcs (SV *sv) |
44 | { |
49 | { |
… | |
… | |
46 | char *str = SvPVutf8 (sv, len); |
51 | char *str = SvPVutf8 (sv, len); |
47 | return rxvt_utf8towcs (str, len); |
52 | return rxvt_utf8towcs (str, len); |
48 | } |
53 | } |
49 | |
54 | |
50 | static SV * |
55 | static SV * |
|
|
56 | wcs2sv (wchar_t *wstr, int len = -1) |
|
|
57 | { |
|
|
58 | char *str = rxvt_wcstoutf8 (wstr, len); |
|
|
59 | |
|
|
60 | SV *sv = newSVpv (str, 0); |
|
|
61 | SvUTF8_on (sv); |
|
|
62 | free (str); |
|
|
63 | |
|
|
64 | return sv; |
|
|
65 | } |
|
|
66 | |
|
|
67 | static SV * |
51 | new_ref (HV *hv, const char *klass) |
68 | new_ref (HV *hv, const char *klass) |
52 | { |
69 | { |
53 | return sv_bless (newRV ((SV *)hv), gv_stashpv (klass, 1)); |
70 | return sv_bless (newRV ((SV *)hv), gv_stashpv (klass, 1)); |
54 | } |
71 | } |
55 | |
72 | |
56 | //TODO: use magic |
73 | //TODO: use magic |
57 | static SV * |
74 | static SV * |
58 | newSVptr (void *ptr, const char *klass) |
75 | newSVptr (void *ptr, const char *klass) |
59 | { |
76 | { |
60 | HV *hv = newHV (); |
77 | HV *hv = newHV (); |
61 | hv_store (hv, "_ptr", 4, newSViv ((long)ptr), 0); |
78 | sv_magic ((SV *)hv, 0, PERL_MAGIC_ext, (char *)ptr, 0); |
62 | return sv_bless (newRV_noinc ((SV *)hv), gv_stashpv (klass, 1)); |
79 | return sv_bless (newRV_noinc ((SV *)hv), gv_stashpv (klass, 1)); |
|
|
80 | } |
|
|
81 | |
|
|
82 | static void |
|
|
83 | clearSVptr (SV *sv) |
|
|
84 | { |
|
|
85 | if (SvROK (sv)) |
|
|
86 | sv = SvRV (sv); |
|
|
87 | |
|
|
88 | hv_clear ((HV *)sv); |
|
|
89 | sv_unmagic (sv, PERL_MAGIC_ext); |
63 | } |
90 | } |
64 | |
91 | |
65 | static long |
92 | static long |
66 | SvPTR (SV *sv, const char *klass) |
93 | SvPTR (SV *sv, const char *klass) |
67 | { |
94 | { |
68 | if (!sv_derived_from (sv, klass)) |
95 | if (!sv_derived_from (sv, klass)) |
69 | croak ("object of type %s expected", klass); |
96 | croak ("object of type %s expected", klass); |
70 | |
97 | |
71 | IV iv = SvIV (*hv_fetch ((HV *)SvRV (sv), "_ptr", 4, 1)); |
98 | MAGIC *mg = mg_find (SvRV (sv), PERL_MAGIC_ext); |
72 | |
99 | |
73 | if (!iv) |
100 | if (!mg) |
74 | croak ("perl code used %s object, but C++ object is already destroyed, caught", klass); |
101 | croak ("perl code used %s object, but C++ object is already destroyed, caught", klass); |
75 | |
102 | |
76 | return (long)iv; |
103 | return (long)mg->mg_ptr; |
77 | } |
104 | } |
78 | |
105 | |
79 | #define newSVterm(term) SvREFCNT_inc ((SV *)term->self) |
106 | #define newSVterm(term) SvREFCNT_inc ((SV *)term->self) |
80 | #define SvTERM(sv) (rxvt_term *)SvPTR (sv, "urxvt::term") |
107 | #define SvTERM(sv) (rxvt_term *)SvPTR (sv, "urxvt::term") |
81 | |
108 | |
… | |
… | |
134 | #define newSVtimer(timer) new_ref (timer->self, "urxvt::timer") |
161 | #define newSVtimer(timer) new_ref (timer->self, "urxvt::timer") |
135 | #define SvTIMER(sv) (timer *)SvPTR (sv, "urxvt::timer") |
162 | #define SvTIMER(sv) (timer *)SvPTR (sv, "urxvt::timer") |
136 | |
163 | |
137 | struct timer : time_watcher, perl_watcher |
164 | struct timer : time_watcher, perl_watcher |
138 | { |
165 | { |
|
|
166 | tstamp interval; |
|
|
167 | |
139 | timer () |
168 | timer () |
140 | : time_watcher (this, &timer::execute) |
169 | : time_watcher (this, &timer::execute) |
141 | { |
170 | { |
142 | } |
171 | } |
143 | |
172 | |
144 | void execute (time_watcher &w) |
173 | void execute (time_watcher &w) |
145 | { |
174 | { |
|
|
175 | if (interval) |
|
|
176 | start (at + interval); |
|
|
177 | |
146 | invoke ("urxvt::timer", newSVtimer (this)); |
178 | invoke ("urxvt::timer", newSVtimer (this)); |
147 | } |
179 | } |
148 | }; |
180 | }; |
149 | |
181 | |
150 | #define newSViow(iow) new_ref (iow->self, "urxvt::iow") |
182 | #define newSViow(iow) new_ref (iow->self, "urxvt::iow") |
… | |
… | |
160 | void execute (io_watcher &w, short revents) |
192 | void execute (io_watcher &w, short revents) |
161 | { |
193 | { |
162 | invoke ("urxvt::iow", newSViow (this), revents); |
194 | invoke ("urxvt::iow", newSViow (this), revents); |
163 | } |
195 | } |
164 | }; |
196 | }; |
|
|
197 | |
|
|
198 | ///////////////////////////////////////////////////////////////////////////// |
|
|
199 | |
|
|
200 | #define SvOVERLAY(sv) (overlay *)SvPTR (sv, "urxvt::overlay") |
|
|
201 | |
|
|
202 | struct overlay { |
|
|
203 | HV *self; |
|
|
204 | rxvt_term *THIS; |
|
|
205 | int x, y, w, h; |
|
|
206 | int border; |
|
|
207 | text_t **text; |
|
|
208 | rend_t **rend; |
|
|
209 | |
|
|
210 | overlay (rxvt_term *THIS, int x_, int y_, int w_, int h_, rend_t rstyle, int border); |
|
|
211 | ~overlay (); |
|
|
212 | |
|
|
213 | void show (); |
|
|
214 | void hide (); |
|
|
215 | |
|
|
216 | void swap (); |
|
|
217 | |
|
|
218 | void set (int x, int y, SV *str, SV *rend); |
|
|
219 | }; |
|
|
220 | |
|
|
221 | overlay::overlay (rxvt_term *THIS, int x_, int y_, int w_, int h_, rend_t rstyle, int border) |
|
|
222 | : THIS(THIS), x(x_), y(y_), w(w_), h(h_), border(border == 2) |
|
|
223 | { |
|
|
224 | if (border == 2) |
|
|
225 | { |
|
|
226 | w += 2; |
|
|
227 | h += 2; |
|
|
228 | } |
|
|
229 | |
|
|
230 | text = new text_t *[h]; |
|
|
231 | rend = new rend_t *[h]; |
|
|
232 | |
|
|
233 | for (int y = 0; y < h; y++) |
|
|
234 | { |
|
|
235 | text_t *tp = text[y] = new text_t[w]; |
|
|
236 | rend_t *rp = rend[y] = new rend_t[w]; |
|
|
237 | |
|
|
238 | text_t t0, t1, t2; |
|
|
239 | rend_t r = rstyle; |
|
|
240 | |
|
|
241 | if (border == 2) |
|
|
242 | { |
|
|
243 | if (y == 0) |
|
|
244 | t0 = 0x2554, t1 = 0x2550, t2 = 0x2557; |
|
|
245 | else if (y < h - 1) |
|
|
246 | t0 = 0x2551, t1 = 0x0020, t2 = 0x2551; |
|
|
247 | else |
|
|
248 | t0 = 0x255a, t1 = 0x2550, t2 = 0x255d; |
|
|
249 | |
|
|
250 | *tp++ = t0; |
|
|
251 | *rp++ = r; |
|
|
252 | |
|
|
253 | for (int x = w - 2; x-- > 0; ) |
|
|
254 | { |
|
|
255 | *tp++ = t1; |
|
|
256 | *rp++ = r; |
|
|
257 | } |
|
|
258 | |
|
|
259 | *tp = t2; |
|
|
260 | *rp = r; |
|
|
261 | } |
|
|
262 | else |
|
|
263 | for (int x = w; x-- > 0; ) |
|
|
264 | { |
|
|
265 | *tp++ = 0x0020; |
|
|
266 | *rp++ = r; |
|
|
267 | } |
|
|
268 | } |
|
|
269 | |
|
|
270 | show (); |
|
|
271 | THIS->want_refresh = 1; |
|
|
272 | } |
|
|
273 | |
|
|
274 | overlay::~overlay () |
|
|
275 | { |
|
|
276 | hide (); |
|
|
277 | |
|
|
278 | for (int y = h; y--; ) |
|
|
279 | { |
|
|
280 | delete [] text[y]; |
|
|
281 | delete [] rend[y]; |
|
|
282 | } |
|
|
283 | |
|
|
284 | delete [] text; |
|
|
285 | delete [] rend; |
|
|
286 | |
|
|
287 | THIS->want_refresh = 1; |
|
|
288 | } |
|
|
289 | |
|
|
290 | void |
|
|
291 | overlay::show () |
|
|
292 | { |
|
|
293 | char key[33]; sprintf (key, "%32lx", (long)this); |
|
|
294 | |
|
|
295 | HV *hv = (HV *)SvRV (*hv_fetch ((HV *)SvRV ((SV *)THIS->self), "_overlay", 8, 0)); |
|
|
296 | hv_store (hv, key, 32, newSViv ((long)this), 0); |
|
|
297 | } |
|
|
298 | |
|
|
299 | void |
|
|
300 | overlay::hide () |
|
|
301 | { |
|
|
302 | SV **ovs = hv_fetch ((HV *)SvRV ((SV *)THIS->self), "_overlay", 8, 0); |
|
|
303 | |
|
|
304 | if (ovs) |
|
|
305 | { |
|
|
306 | char key[33]; sprintf (key, "%32lx", (long)this); |
|
|
307 | |
|
|
308 | HV *hv = (HV *)SvRV (*ovs); |
|
|
309 | hv_delete (hv, key, 32, G_DISCARD); |
|
|
310 | } |
|
|
311 | } |
|
|
312 | |
|
|
313 | void overlay::swap () |
|
|
314 | { |
|
|
315 | int ov_x = max (0, min (MOD (x, THIS->ncol), THIS->ncol - w)); |
|
|
316 | int ov_y = max (0, min (MOD (y, THIS->nrow), THIS->nrow - h)); |
|
|
317 | |
|
|
318 | int ov_w = min (w, THIS->ncol - ov_x); |
|
|
319 | int ov_h = min (h, THIS->nrow - ov_y); |
|
|
320 | |
|
|
321 | for (int y = ov_h; y--; ) |
|
|
322 | { |
|
|
323 | text_t *t1 = text [y]; |
|
|
324 | rend_t *r1 = rend [y]; |
|
|
325 | |
|
|
326 | text_t *t2 = ROW(y + ov_y - THIS->view_start).t + ov_x; |
|
|
327 | rend_t *r2 = ROW(y + ov_y - THIS->view_start).r + ov_x; |
|
|
328 | |
|
|
329 | for (int x = ov_w; x--; ) |
|
|
330 | { |
|
|
331 | text_t t = *t1; *t1++ = *t2; *t2++ = t; |
|
|
332 | rend_t r = *r1; *r1++ = *r2; *r2++ = SET_FONT (r, THIS->fontset [GET_STYLE (r)]->find_font (t)); |
|
|
333 | } |
|
|
334 | } |
|
|
335 | |
|
|
336 | } |
|
|
337 | |
|
|
338 | void overlay::set (int x, int y, SV *text, SV *rend) |
|
|
339 | { |
|
|
340 | x += border; |
|
|
341 | y += border; |
|
|
342 | |
|
|
343 | if (!IN_RANGE_EXC (y, 0, h - border)) |
|
|
344 | return; |
|
|
345 | |
|
|
346 | wchar_t *wtext = sv2wcs (text); |
|
|
347 | |
|
|
348 | for (int col = min (wcslen (wtext), w - x - border); col--; ) |
|
|
349 | this->text [y][x + col] = wtext [col]; |
|
|
350 | |
|
|
351 | free (wtext); |
|
|
352 | |
|
|
353 | if (rend) |
|
|
354 | { |
|
|
355 | if (!SvROK (rend) || SvTYPE (SvRV (rend)) != SVt_PVAV) |
|
|
356 | croak ("rend must be arrayref"); |
|
|
357 | |
|
|
358 | AV *av = (AV *)SvRV (rend); |
|
|
359 | |
|
|
360 | for (int col = min (av_len (av) + 1, w - x - border); col--; ) |
|
|
361 | this->rend [y][x + col] = SvIV (*av_fetch (av, col, 1)); |
|
|
362 | } |
|
|
363 | |
|
|
364 | THIS->want_refresh = 1; |
|
|
365 | } |
|
|
366 | |
165 | |
367 | |
166 | ///////////////////////////////////////////////////////////////////////////// |
368 | ///////////////////////////////////////////////////////////////////////////// |
167 | |
369 | |
168 | struct rxvt_perl_interp rxvt_perl; |
370 | struct rxvt_perl_interp rxvt_perl; |
169 | |
371 | |
… | |
… | |
212 | { |
414 | { |
213 | if (!perl) |
415 | if (!perl) |
214 | return false; |
416 | return false; |
215 | |
417 | |
216 | if (htype == HOOK_INIT) // first hook ever called |
418 | if (htype == HOOK_INIT) // first hook ever called |
|
|
419 | { |
217 | term->self = (void *)newSVptr ((void *)term, "urxvt::term"); |
420 | term->self = (void *)newSVptr ((void *)term, "urxvt::term"); |
|
|
421 | hv_store ((HV *)SvRV ((SV *)term->self), "_overlay", 8, newRV_noinc ((SV *)newHV ()), 0); |
|
|
422 | } |
|
|
423 | else if (!term->self) |
|
|
424 | return false; // perl not initialized for this instance |
218 | else if (htype == HOOK_DESTROY) |
425 | else if (htype == HOOK_DESTROY) |
219 | { |
426 | { |
220 | // TODO: clear magic |
427 | // handled later |
221 | hv_clear ((HV *)SvRV ((SV *)term->self)); |
|
|
222 | SvREFCNT_dec ((SV *)term->self); |
|
|
223 | } |
428 | } |
|
|
429 | else if (htype == HOOK_REFRESH_BEGIN || htype == HOOK_REFRESH_END) |
|
|
430 | { |
|
|
431 | HV *hv = (HV *)SvRV (*hv_fetch ((HV *)SvRV ((SV *)term->self), "_overlay", 8, 0)); |
224 | |
432 | |
|
|
433 | if (HvKEYS (hv)) |
|
|
434 | { |
|
|
435 | hv_iterinit (hv); |
|
|
436 | |
|
|
437 | while (HE *he = hv_iternext (hv)) |
|
|
438 | ((overlay *)SvIV (hv_iterval (hv, he)))->swap (); |
|
|
439 | } |
|
|
440 | } |
225 | if (!should_invoke [htype]) |
441 | else if (!should_invoke [htype]) |
226 | return false; |
442 | return false; |
227 | |
443 | |
228 | dSP; |
444 | dSP; |
229 | va_list ap; |
445 | va_list ap; |
230 | |
446 | |
231 | va_start (ap, htype); |
447 | va_start (ap, htype); |
232 | |
448 | |
… | |
… | |
249 | |
465 | |
250 | case DT_LONG: |
466 | case DT_LONG: |
251 | XPUSHs (sv_2mortal (newSViv (va_arg (ap, long)))); |
467 | XPUSHs (sv_2mortal (newSViv (va_arg (ap, long)))); |
252 | break; |
468 | break; |
253 | |
469 | |
|
|
470 | case DT_STRING: |
|
|
471 | XPUSHs (sv_2mortal (newSVpv (va_arg (ap, char *), 0))); |
|
|
472 | break; |
|
|
473 | |
|
|
474 | case DT_STRING_LEN: |
|
|
475 | { |
|
|
476 | char *str = va_arg (ap, char *); |
|
|
477 | int len = va_arg (ap, int); |
|
|
478 | |
|
|
479 | XPUSHs (sv_2mortal (newSVpvn (str, len))); |
|
|
480 | } |
|
|
481 | break; |
|
|
482 | |
|
|
483 | case DT_XEVENT: |
|
|
484 | { |
|
|
485 | XEvent *xe = va_arg (ap, XEvent *); |
|
|
486 | HV *hv = newHV (); |
|
|
487 | |
|
|
488 | # define set(name, sv) hv_store (hv, # name, sizeof (# name) - 1, sv, 0) |
|
|
489 | # define setiv(name, val) hv_store (hv, # name, sizeof (# name) - 1, newSViv (val), 0) |
|
|
490 | # undef set |
|
|
491 | |
|
|
492 | setiv (type, xe->type); |
|
|
493 | setiv (send_event, xe->xany.send_event); |
|
|
494 | setiv (serial, xe->xany.serial); |
|
|
495 | |
|
|
496 | switch (xe->type) |
|
|
497 | { |
|
|
498 | case KeyPress: |
|
|
499 | case KeyRelease: |
|
|
500 | case ButtonPress: |
|
|
501 | case ButtonRelease: |
|
|
502 | case MotionNotify: |
|
|
503 | setiv (time, xe->xmotion.time); |
|
|
504 | setiv (x, xe->xmotion.x); |
|
|
505 | setiv (y, xe->xmotion.y); |
|
|
506 | setiv (row, xe->xmotion.y / term->fheight); |
|
|
507 | setiv (col, xe->xmotion.x / term->fwidth); |
|
|
508 | setiv (x_root, xe->xmotion.x_root); |
|
|
509 | setiv (y_root, xe->xmotion.y_root); |
|
|
510 | setiv (state, xe->xmotion.state); |
|
|
511 | break; |
|
|
512 | } |
|
|
513 | |
|
|
514 | switch (xe->type) |
|
|
515 | { |
|
|
516 | case KeyPress: |
|
|
517 | case KeyRelease: |
|
|
518 | setiv (keycode, xe->xkey.keycode); |
|
|
519 | break; |
|
|
520 | |
|
|
521 | case ButtonPress: |
|
|
522 | case ButtonRelease: |
|
|
523 | setiv (button, xe->xbutton.button); |
|
|
524 | break; |
|
|
525 | |
|
|
526 | case MotionNotify: |
|
|
527 | setiv (is_hint, xe->xmotion.is_hint); |
|
|
528 | break; |
|
|
529 | } |
|
|
530 | |
|
|
531 | XPUSHs (sv_2mortal (newRV_noinc ((SV *)hv))); |
|
|
532 | } |
|
|
533 | break; |
|
|
534 | |
|
|
535 | case DT_USTRING_LEN: |
|
|
536 | { |
|
|
537 | unicode_t *ustr = va_arg (ap, unicode_t *); |
|
|
538 | int ulen = va_arg (ap, int); |
|
|
539 | wchar_t *wstr = new wchar_t [ulen]; |
|
|
540 | |
|
|
541 | for (int i = ulen; i--; ) |
|
|
542 | wstr [i] = ustr [i]; |
|
|
543 | |
|
|
544 | XPUSHs (sv_2mortal (wcs2sv (wstr, ulen))); |
|
|
545 | |
|
|
546 | delete [] wstr; |
|
|
547 | } |
|
|
548 | |
254 | case DT_END: |
549 | case DT_END: |
255 | { |
550 | { |
256 | va_end (ap); |
551 | va_end (ap); |
257 | |
552 | |
258 | PUTBACK; |
553 | PUTBACK; |
… | |
… | |
270 | LEAVE; |
565 | LEAVE; |
271 | |
566 | |
272 | if (SvTRUE (ERRSV)) |
567 | if (SvTRUE (ERRSV)) |
273 | rxvt_warn ("perl hook %d evaluation error: %s", htype, SvPV_nolen (ERRSV)); |
568 | rxvt_warn ("perl hook %d evaluation error: %s", htype, SvPV_nolen (ERRSV)); |
274 | |
569 | |
|
|
570 | if (htype == HOOK_DESTROY) |
|
|
571 | { |
|
|
572 | clearSVptr ((SV *)term->self); |
|
|
573 | SvREFCNT_dec ((SV *)term->self); |
|
|
574 | } |
|
|
575 | |
275 | return count; |
576 | return count; |
276 | } |
577 | } |
277 | |
578 | |
278 | default: |
579 | default: |
279 | rxvt_fatal ("FATAL: unable to pass data type %d\n", dt); |
580 | rxvt_fatal ("FATAL: unable to pass data type %d\n", dt); |
… | |
… | |
287 | |
588 | |
288 | PROTOTYPES: ENABLE |
589 | PROTOTYPES: ENABLE |
289 | |
590 | |
290 | BOOT: |
591 | BOOT: |
291 | { |
592 | { |
292 | # define set_hookname(sym) av_store (hookname, PP_CONCAT(HOOK_, sym), newSVpv (PP_STRINGIFY(sym), 0)) |
593 | # define export_const(name) newCONSTSUB (gv_stashpv ("urxvt", 1), # name, newSViv (name)); |
293 | AV *hookname = get_av ("urxvt::HOOKNAME", 1); |
594 | AV *hookname = get_av ("urxvt::HOOKNAME", 1); |
294 | set_hookname (LOAD); |
595 | # define def(sym) av_store (hookname, HOOK_ ## sym, newSVpv (# sym, 0)); |
295 | set_hookname (INIT); |
596 | # include "hookinc.h" |
296 | set_hookname (RESET); |
597 | # undef def |
297 | set_hookname (START); |
598 | |
298 | set_hookname (DESTROY); |
599 | export_const (DEFAULT_RSTYLE); |
299 | set_hookname (SEL_BEGIN); |
600 | export_const (OVERLAY_RSTYLE); |
300 | set_hookname (SEL_EXTEND); |
601 | export_const (RS_Bold); |
301 | set_hookname (SEL_MAKE); |
602 | export_const (RS_Italic); |
302 | set_hookname (SEL_GRAB); |
603 | export_const (RS_Blink); |
303 | set_hookname (FOCUS_IN); |
604 | export_const (RS_RVid); |
304 | set_hookname (FOCUS_OUT); |
605 | export_const (RS_Uline); |
305 | set_hookname (VIEW_CHANGE); |
|
|
306 | set_hookname (SCROLL_BACK); |
|
|
307 | set_hookname (TTY_ACTIVITY); |
|
|
308 | set_hookname (REFRESH_BEGIN); |
|
|
309 | set_hookname (REFRESH_END); |
|
|
310 | |
606 | |
311 | sv_setpv (get_sv ("urxvt::LIBDIR", 1), LIBDIR); |
607 | sv_setpv (get_sv ("urxvt::LIBDIR", 1), LIBDIR); |
312 | } |
608 | } |
|
|
609 | |
|
|
610 | SV * |
|
|
611 | new (...) |
|
|
612 | CODE: |
|
|
613 | { |
|
|
614 | stringvec *argv = new stringvec; |
|
|
615 | bool success; |
|
|
616 | |
|
|
617 | for (int i = 0; i < items ;i++) |
|
|
618 | argv->push_back (strdup (SvPVbyte_nolen (ST (i)))); |
|
|
619 | |
|
|
620 | rxvt_term *term = new rxvt_term; |
|
|
621 | |
|
|
622 | term->argv = argv; |
|
|
623 | |
|
|
624 | try |
|
|
625 | { |
|
|
626 | if (!term->init (argv->size (), argv->begin ())) |
|
|
627 | term = 0; |
|
|
628 | } |
|
|
629 | catch (const class rxvt_failure_exception &e) |
|
|
630 | { |
|
|
631 | term->destroy (); |
|
|
632 | croak ("exception caught while initializing new terminal instance"); |
|
|
633 | } |
|
|
634 | |
|
|
635 | RETVAL = term && term->self ? newSVterm (term) : &PL_sv_undef; |
|
|
636 | } |
|
|
637 | OUTPUT: |
|
|
638 | RETVAL |
313 | |
639 | |
314 | void |
640 | void |
315 | set_should_invoke (int htype, int value) |
641 | set_should_invoke (int htype, int value) |
316 | CODE: |
642 | CODE: |
317 | rxvt_perl.should_invoke [htype] = value; |
643 | rxvt_perl.should_invoke [htype] = value; |
… | |
… | |
331 | CODE: |
657 | CODE: |
332 | RETVAL = NOW; |
658 | RETVAL = NOW; |
333 | OUTPUT: |
659 | OUTPUT: |
334 | RETVAL |
660 | RETVAL |
335 | |
661 | |
|
|
662 | int |
|
|
663 | GET_BASEFG (int rend) |
|
|
664 | CODE: |
|
|
665 | RETVAL = GET_BASEFG (rend); |
|
|
666 | OUTPUT: |
|
|
667 | RETVAL |
|
|
668 | |
|
|
669 | int |
|
|
670 | GET_BASEBG (int rend) |
|
|
671 | CODE: |
|
|
672 | RETVAL = GET_BASEBG (rend); |
|
|
673 | OUTPUT: |
|
|
674 | RETVAL |
|
|
675 | |
|
|
676 | int |
|
|
677 | SET_FGCOLOR (int rend, int new_color) |
|
|
678 | CODE: |
|
|
679 | RETVAL = SET_FGCOLOR (rend, new_color); |
|
|
680 | OUTPUT: |
|
|
681 | RETVAL |
|
|
682 | |
|
|
683 | int |
|
|
684 | SET_BGCOLOR (int rend, int new_color) |
|
|
685 | CODE: |
|
|
686 | RETVAL = SET_BGCOLOR (rend, new_color); |
|
|
687 | OUTPUT: |
|
|
688 | RETVAL |
|
|
689 | |
|
|
690 | int |
|
|
691 | GET_CUSTOM (int rend) |
|
|
692 | CODE: |
|
|
693 | RETVAL = (rend && RS_customMask) >> RS_customShift; |
|
|
694 | OUTPUT: |
|
|
695 | RETVAL |
|
|
696 | |
|
|
697 | int |
|
|
698 | SET_CUSTOM (int rend, int new_value) |
|
|
699 | CODE: |
|
|
700 | { |
|
|
701 | if (!IN_RANGE_EXC (new_value, 0, RS_customCount)) |
|
|
702 | croak ("custom value out of range, must be 0..%d", RS_customCount - 1); |
|
|
703 | |
|
|
704 | RETVAL = (rend & ~RS_customMask) |
|
|
705 | | ((new_value << RS_customShift) & RS_customMask); |
|
|
706 | } |
|
|
707 | OUTPUT: |
|
|
708 | RETVAL |
|
|
709 | |
336 | MODULE = urxvt PACKAGE = urxvt::term |
710 | MODULE = urxvt PACKAGE = urxvt::term |
|
|
711 | |
|
|
712 | void |
|
|
713 | rxvt_term::destroy () |
337 | |
714 | |
338 | int |
715 | int |
339 | rxvt_term::strwidth (SV *str) |
716 | rxvt_term::strwidth (SV *str) |
340 | CODE: |
717 | CODE: |
341 | { |
718 | { |
… | |
… | |
377 | |
754 | |
378 | rxvt_push_locale (THIS->locale); |
755 | rxvt_push_locale (THIS->locale); |
379 | wchar_t *wstr = rxvt_mbstowcs (data, len); |
756 | wchar_t *wstr = rxvt_mbstowcs (data, len); |
380 | rxvt_pop_locale (); |
757 | rxvt_pop_locale (); |
381 | |
758 | |
382 | char *str = rxvt_wcstoutf8 (wstr); |
759 | RETVAL = wcs2sv (wstr); |
383 | free (wstr); |
760 | free (wstr); |
384 | |
|
|
385 | RETVAL = newSVpv (str, 0); |
|
|
386 | SvUTF8_on (RETVAL); |
|
|
387 | free (str); |
|
|
388 | } |
761 | } |
389 | OUTPUT: |
762 | OUTPUT: |
390 | RETVAL |
763 | RETVAL |
|
|
764 | |
|
|
765 | # very portable, especially on objects as opposed to pods |
|
|
766 | #define TERM_OFFSET(sym) (((char *)&((TermWin_t *)0)->sym) - (char *)(TermWin_t *)0) |
|
|
767 | |
|
|
768 | #define TERM_OFFSET_width TERM_OFFSET(width) |
|
|
769 | #define TERM_OFFSET_height TERM_OFFSET(height) |
|
|
770 | #define TERM_OFFSET_fwidth TERM_OFFSET(fwidth) |
|
|
771 | #define TERM_OFFSET_fheight TERM_OFFSET(fheight) |
|
|
772 | #define TERM_OFFSET_fbase TERM_OFFSET(fbase) |
|
|
773 | #define TERM_OFFSET_nrow TERM_OFFSET(nrow) |
|
|
774 | #define TERM_OFFSET_ncol TERM_OFFSET(ncol) |
|
|
775 | #define TERM_OFFSET_focus TERM_OFFSET(focus) |
|
|
776 | #define TERM_OFFSET_mapped TERM_OFFSET(mapped) |
|
|
777 | #define TERM_OFFSET_saveLines TERM_OFFSET(saveLines) |
|
|
778 | #define TERM_OFFSET_total_rows TERM_OFFSET(total_rows) |
|
|
779 | #define TERM_OFFSET_nsaved TERM_OFFSET(nsaved) |
|
|
780 | |
|
|
781 | int |
|
|
782 | rxvt_term::width () |
|
|
783 | ALIAS: |
|
|
784 | width = TERM_OFFSET_width |
|
|
785 | height = TERM_OFFSET_height |
|
|
786 | fwidth = TERM_OFFSET_fwidth |
|
|
787 | fheight = TERM_OFFSET_fheight |
|
|
788 | fbase = TERM_OFFSET_fbase |
|
|
789 | nrow = TERM_OFFSET_nrow |
|
|
790 | ncol = TERM_OFFSET_ncol |
|
|
791 | focus = TERM_OFFSET_focus |
|
|
792 | mapped = TERM_OFFSET_mapped |
|
|
793 | saveLines = TERM_OFFSET_saveLines |
|
|
794 | total_rows = TERM_OFFSET_total_rows |
|
|
795 | nsaved = TERM_OFFSET_nsaved |
|
|
796 | CODE: |
|
|
797 | RETVAL = *(int *)((char *)THIS + ix); |
|
|
798 | OUTPUT: |
|
|
799 | RETVAL |
|
|
800 | |
|
|
801 | U32 |
|
|
802 | rxvt_term::parent () |
|
|
803 | CODE: |
|
|
804 | RETVAL = (U32)THIS->parent [0]; |
|
|
805 | OUTPUT: |
|
|
806 | RETVAL |
|
|
807 | |
|
|
808 | U32 |
|
|
809 | rxvt_term::vt () |
|
|
810 | CODE: |
|
|
811 | RETVAL = (U32)THIS->vt; |
|
|
812 | OUTPUT: |
|
|
813 | RETVAL |
|
|
814 | |
|
|
815 | U32 |
|
|
816 | rxvt_term::rstyle (U32 new_rstyle = THIS->rstyle) |
|
|
817 | CODE: |
|
|
818 | { |
|
|
819 | RETVAL = THIS->rstyle; |
|
|
820 | THIS->rstyle = new_rstyle; |
|
|
821 | } |
|
|
822 | OUTPUT: |
|
|
823 | RETVAL |
|
|
824 | |
|
|
825 | int |
|
|
826 | rxvt_term::view_start (int newval = -1) |
|
|
827 | CODE: |
|
|
828 | { |
|
|
829 | RETVAL = THIS->view_start; |
|
|
830 | |
|
|
831 | if (newval >= 0) |
|
|
832 | { |
|
|
833 | THIS->view_start = min (newval, THIS->nsaved); |
|
|
834 | THIS->scr_changeview (RETVAL); |
|
|
835 | } |
|
|
836 | } |
|
|
837 | OUTPUT: |
|
|
838 | RETVAL |
|
|
839 | |
|
|
840 | void |
|
|
841 | rxvt_term::want_refresh () |
|
|
842 | CODE: |
|
|
843 | THIS->want_refresh = 1; |
|
|
844 | |
|
|
845 | void |
|
|
846 | rxvt_term::ROW_t (int row_number, SV *new_text = 0, int start_col = 0, int start_ofs = 0, int max_len = MAX_COLS) |
|
|
847 | PPCODE: |
|
|
848 | { |
|
|
849 | if (!IN_RANGE_EXC (row_number, -THIS->nsaved, THIS->nrow)) |
|
|
850 | XSRETURN_EMPTY; |
|
|
851 | |
|
|
852 | line_t &l = ROW(row_number); |
|
|
853 | |
|
|
854 | if (GIMME_V != G_VOID) |
|
|
855 | { |
|
|
856 | wchar_t *wstr = new wchar_t [THIS->ncol]; |
|
|
857 | |
|
|
858 | for (int col = 0; col <THIS->ncol; col++) |
|
|
859 | wstr [col] = l.t [col]; |
|
|
860 | |
|
|
861 | XPUSHs (sv_2mortal (wcs2sv (wstr))); |
|
|
862 | |
|
|
863 | delete [] wstr; |
|
|
864 | } |
|
|
865 | |
|
|
866 | if (new_text) |
|
|
867 | { |
|
|
868 | wchar_t *wstr = sv2wcs (new_text); |
|
|
869 | |
|
|
870 | int len = min (wcslen (wstr) - start_ofs, max_len); |
|
|
871 | |
|
|
872 | if (!IN_RANGE_INC (start_col, 0, THIS->ncol - len)) |
|
|
873 | { |
|
|
874 | free (wstr); |
|
|
875 | croak ("new_text extends beyond horizontal margins"); |
|
|
876 | } |
|
|
877 | |
|
|
878 | for (int col = start_col; col < start_col + len; col++) |
|
|
879 | { |
|
|
880 | l.t [col] = wstr [start_ofs + col - start_col]; |
|
|
881 | l.r [col] = SET_FONT (l.r [col], THIS->fontset [GET_STYLE (l.r [col])]->find_font (l.t [col])); |
|
|
882 | } |
|
|
883 | |
|
|
884 | free (wstr); |
|
|
885 | } |
|
|
886 | } |
|
|
887 | |
|
|
888 | void |
|
|
889 | rxvt_term::ROW_r (int row_number, SV *new_rend = 0, int start_col = 0, int start_ofs = 0, int max_len = MAX_COLS) |
|
|
890 | PPCODE: |
|
|
891 | { |
|
|
892 | if (!IN_RANGE_EXC (row_number, -THIS->nsaved, THIS->nrow)) |
|
|
893 | XSRETURN_EMPTY; |
|
|
894 | |
|
|
895 | line_t &l = ROW(row_number); |
|
|
896 | |
|
|
897 | if (GIMME_V != G_VOID) |
|
|
898 | { |
|
|
899 | AV *av = newAV (); |
|
|
900 | |
|
|
901 | av_extend (av, THIS->ncol - 1); |
|
|
902 | for (int col = 0; col < THIS->ncol; col++) |
|
|
903 | av_store (av, col, newSViv (l.r [col])); |
|
|
904 | |
|
|
905 | XPUSHs (sv_2mortal (newRV_noinc ((SV *)av))); |
|
|
906 | } |
|
|
907 | |
|
|
908 | if (new_rend) |
|
|
909 | { |
|
|
910 | if (!SvROK (new_rend) || SvTYPE (SvRV (new_rend)) != SVt_PVAV) |
|
|
911 | croak ("new_rend must be arrayref"); |
|
|
912 | |
|
|
913 | AV *av = (AV *)SvRV (new_rend); |
|
|
914 | int len = min (av_len (av) + 1 - start_ofs, max_len); |
|
|
915 | |
|
|
916 | if (!IN_RANGE_INC (start_col, 0, THIS->ncol - len)) |
|
|
917 | croak ("new_rend array extends beyond horizontal margins"); |
|
|
918 | |
|
|
919 | for (int col = start_col; col < start_col + len; col++) |
|
|
920 | { |
|
|
921 | rend_t r = SvIV (*av_fetch (av, start_ofs + col - start_col, 1)) & ~RS_fontMask; |
|
|
922 | |
|
|
923 | l.r [col] = SET_FONT (r, THIS->fontset [GET_STYLE (r)]->find_font (l.t [col])); |
|
|
924 | } |
|
|
925 | } |
|
|
926 | } |
|
|
927 | |
|
|
928 | int |
|
|
929 | rxvt_term::ROW_l (int row_number, int new_length = -1) |
|
|
930 | CODE: |
|
|
931 | { |
|
|
932 | if (!IN_RANGE_EXC (row_number, -THIS->nsaved, THIS->nrow)) |
|
|
933 | XSRETURN_EMPTY; |
|
|
934 | |
|
|
935 | line_t &l = ROW(row_number); |
|
|
936 | RETVAL = l.l; |
|
|
937 | |
|
|
938 | if (new_length >= 0) |
|
|
939 | l.l = new_length; |
|
|
940 | } |
|
|
941 | OUTPUT: |
|
|
942 | RETVAL |
|
|
943 | |
|
|
944 | bool |
|
|
945 | rxvt_term::ROW_is_longer (int row_number, int new_is_longer = -1) |
|
|
946 | CODE: |
|
|
947 | { |
|
|
948 | if (!IN_RANGE_EXC (row_number, -THIS->nsaved, THIS->nrow)) |
|
|
949 | XSRETURN_EMPTY; |
|
|
950 | |
|
|
951 | line_t &l = ROW(row_number); |
|
|
952 | RETVAL = l.is_longer (); |
|
|
953 | |
|
|
954 | if (new_is_longer >= 0) |
|
|
955 | l.is_longer (new_is_longer); |
|
|
956 | } |
|
|
957 | OUTPUT: |
|
|
958 | RETVAL |
|
|
959 | |
|
|
960 | SV * |
|
|
961 | rxvt_term::special_encode (SV *str) |
|
|
962 | CODE: |
|
|
963 | abort ();//TODO |
|
|
964 | |
|
|
965 | SV * |
|
|
966 | rxvt_term::special_decode (SV *str) |
|
|
967 | CODE: |
|
|
968 | abort ();//TODO |
391 | |
969 | |
392 | void |
970 | void |
393 | rxvt_term::_resource (char *name, int index, SV *newval = 0) |
971 | rxvt_term::_resource (char *name, int index, SV *newval = 0) |
394 | PPCODE: |
972 | PPCODE: |
395 | { |
973 | { |
396 | struct resval { const char *name; int value; } rslist [] = { |
974 | struct resval { const char *name; int value; } rslist [] = { |
397 | # define Rs_def(name) { # name, Rs_ ## name }, |
975 | # define def(name) { # name, Rs_ ## name }, |
398 | # define Rs_reserve(name,count) |
976 | # define reserve(name,count) |
399 | # include "rsinc.h" |
977 | # include "rsinc.h" |
400 | # undef Rs_def |
978 | # undef def |
401 | # undef Rs_reserve |
979 | # undef reserve |
402 | }; |
980 | }; |
403 | |
981 | |
404 | struct resval *rs = rslist + sizeof (rslist) / sizeof (rslist [0]); |
982 | struct resval *rs = rslist + sizeof (rslist) / sizeof (rslist [0]); |
405 | |
983 | |
406 | do { |
984 | do { |
… | |
… | |
428 | THIS->rs [index] = 0; |
1006 | THIS->rs [index] = 0; |
429 | } |
1007 | } |
430 | } |
1008 | } |
431 | |
1009 | |
432 | void |
1010 | void |
433 | rxvt_term::selection_mark (...) |
1011 | rxvt_term::cur (...) |
434 | PROTOTYPE: $;$$ |
1012 | PROTOTYPE: $;$$ |
435 | ALIAS: |
1013 | ALIAS: |
|
|
1014 | screen_cur = 0 |
436 | selection_beg = 1 |
1015 | selection_beg = 1 |
437 | selection_end = 2 |
1016 | selection_end = 2 |
|
|
1017 | selection_mark = 3 |
438 | PPCODE: |
1018 | PPCODE: |
439 | { |
1019 | { |
440 | row_col_t &sel = ix == 1 ? THIS->selection.beg |
1020 | row_col_t &rc = ix == 0 ? THIS->screen.cur |
|
|
1021 | : ix == 1 ? THIS->selection.beg |
441 | : ix == 2 ? THIS->selection.end |
1022 | : ix == 2 ? THIS->selection.end |
442 | : THIS->selection.mark; |
1023 | : THIS->selection.mark; |
443 | |
1024 | |
444 | if (GIMME_V != G_VOID) |
1025 | if (GIMME_V != G_VOID) |
445 | { |
1026 | { |
446 | EXTEND (SP, 2); |
1027 | EXTEND (SP, 2); |
447 | PUSHs (sv_2mortal (newSViv (sel.row))); |
1028 | PUSHs (sv_2mortal (newSViv (rc.row))); |
448 | PUSHs (sv_2mortal (newSViv (sel.col))); |
1029 | PUSHs (sv_2mortal (newSViv (rc.col))); |
449 | } |
1030 | } |
450 | |
1031 | |
451 | if (items == 3) |
1032 | if (items == 3) |
452 | { |
1033 | { |
453 | sel.row = clamp (SvIV (ST (1)), -THIS->nsaved, THIS->nrow - 1); |
1034 | rc.row = clamp (SvIV (ST (1)), -THIS->nsaved, THIS->nrow - 1); |
454 | sel.col = clamp (SvIV (ST (2)), 0, THIS->ncol - 1); |
1035 | rc.col = clamp (SvIV (ST (2)), 0, THIS->ncol - 1); |
455 | |
1036 | |
456 | if (ix) |
1037 | if (ix) |
457 | THIS->want_refresh = 1; |
1038 | THIS->want_refresh = 1; |
458 | } |
1039 | } |
459 | } |
1040 | } |
460 | |
1041 | |
461 | int |
1042 | int |
462 | rxvt_term::selection_grab (int eventtime) |
1043 | rxvt_term::selection_grab (int eventtime = CurrentTime) |
463 | |
1044 | |
464 | void |
1045 | void |
465 | rxvt_term::selection (SV *newtext = 0) |
1046 | rxvt_term::selection (SV *newtext = 0) |
466 | PPCODE: |
1047 | PPCODE: |
467 | { |
1048 | { |
468 | if (GIMME_V != G_VOID) |
1049 | if (GIMME_V != G_VOID) |
469 | { |
1050 | XPUSHs (sv_2mortal (wcs2sv (THIS->selection.text, THIS->selection.len))); |
470 | char *sel = rxvt_wcstoutf8 (THIS->selection.text, THIS->selection.len); |
|
|
471 | SV *sv = newSVpv (sel, 0); |
|
|
472 | SvUTF8_on (sv); |
|
|
473 | free (sel); |
|
|
474 | XPUSHs (sv_2mortal (sv)); |
|
|
475 | } |
|
|
476 | |
1051 | |
477 | if (newtext) |
1052 | if (newtext) |
478 | { |
1053 | { |
479 | free (THIS->selection.text); |
1054 | free (THIS->selection.text); |
480 | |
1055 | |
481 | THIS->selection.text = sv2wcs (newtext); |
1056 | THIS->selection.text = sv2wcs (newtext); |
482 | THIS->selection.len = wcslen (THIS->selection.text); |
1057 | THIS->selection.len = wcslen (THIS->selection.text); |
483 | } |
1058 | } |
484 | } |
1059 | } |
|
|
1060 | |
|
|
1061 | void |
|
|
1062 | rxvt_term::scr_add_lines (SV *string) |
|
|
1063 | CODE: |
|
|
1064 | { |
|
|
1065 | wchar_t *wstr = sv2wcs (string); |
|
|
1066 | int wlen = wcslen (wstr); |
|
|
1067 | unicode_t *ustr = new unicode_t [wlen]; |
|
|
1068 | int nlines = 0; |
|
|
1069 | |
|
|
1070 | for (int i = wlen; i--; ) |
485 | |
1071 | { |
486 | void |
1072 | ustr [i] = wstr [i]; |
487 | rxvt_term::scr_overlay_new (int x, int y, int w, int h) |
1073 | nlines += ustr [i] == '\012'; |
|
|
1074 | } |
488 | |
1075 | |
489 | void |
1076 | THIS->scr_add_lines (ustr, nlines, wlen); |
490 | rxvt_term::scr_overlay_off () |
|
|
491 | |
1077 | |
492 | void |
|
|
493 | rxvt_term::scr_overlay_set_char (int x, int y, U32 text, U32 rend = OVERLAY_RSTYLE) |
|
|
494 | CODE: |
|
|
495 | THIS->scr_overlay_set (x, y, text, rend); |
|
|
496 | |
|
|
497 | void |
|
|
498 | rxvt_term::scr_overlay_set (int x, int y, SV *text) |
|
|
499 | CODE: |
|
|
500 | { |
|
|
501 | wchar_t *wtext = sv2wcs (text); |
|
|
502 | THIS->scr_overlay_set (x, y, wtext); |
|
|
503 | free (wtext); |
1078 | free (wstr); |
|
|
1079 | delete [] ustr; |
504 | } |
1080 | } |
505 | |
1081 | |
506 | void |
1082 | void |
507 | rxvt_term::tt_write (SV *octets) |
1083 | rxvt_term::tt_write (SV *octets) |
508 | INIT: |
1084 | INIT: |
509 | STRLEN len; |
1085 | STRLEN len; |
510 | char *str = SvPVbyte (octets, len); |
1086 | char *str = SvPVbyte (octets, len); |
511 | C_ARGS: |
1087 | C_ARGS: |
512 | (unsigned char *)str, len |
1088 | str, len |
|
|
1089 | |
|
|
1090 | void |
|
|
1091 | rxvt_term::cmd_parse (SV *octets) |
|
|
1092 | CODE: |
|
|
1093 | { |
|
|
1094 | STRLEN len; |
|
|
1095 | char *str = SvPVbyte (octets, len); |
|
|
1096 | |
|
|
1097 | char *old_cmdbuf_ptr = THIS->cmdbuf_ptr; |
|
|
1098 | char *old_cmdbuf_endp = THIS->cmdbuf_endp; |
|
|
1099 | |
|
|
1100 | THIS->cmdbuf_ptr = str; |
|
|
1101 | THIS->cmdbuf_endp = str + len; |
|
|
1102 | |
|
|
1103 | THIS->cmd_parse (); |
|
|
1104 | |
|
|
1105 | THIS->cmdbuf_ptr = old_cmdbuf_ptr; |
|
|
1106 | THIS->cmdbuf_endp = old_cmdbuf_endp; |
|
|
1107 | } |
|
|
1108 | |
|
|
1109 | SV * |
|
|
1110 | rxvt_term::overlay (int x, int y, int w, int h, int rstyle = OVERLAY_RSTYLE, int border = 2) |
|
|
1111 | CODE: |
|
|
1112 | { |
|
|
1113 | overlay *o = new overlay (THIS, x, y, w, h, rstyle, border); |
|
|
1114 | RETVAL = newSVptr ((void *)o, "urxvt::overlay"); |
|
|
1115 | o->self = (HV *)SvRV (RETVAL); |
|
|
1116 | } |
|
|
1117 | OUTPUT: |
|
|
1118 | RETVAL |
|
|
1119 | |
|
|
1120 | MODULE = urxvt PACKAGE = urxvt::overlay |
|
|
1121 | |
|
|
1122 | void |
|
|
1123 | overlay::set (int x, int y, SV *text, SV *rend = 0) |
|
|
1124 | |
|
|
1125 | void |
|
|
1126 | overlay::show () |
|
|
1127 | |
|
|
1128 | void |
|
|
1129 | overlay::hide () |
|
|
1130 | |
|
|
1131 | void |
|
|
1132 | overlay::DESTROY () |
513 | |
1133 | |
514 | MODULE = urxvt PACKAGE = urxvt::timer |
1134 | MODULE = urxvt PACKAGE = urxvt::timer |
515 | |
1135 | |
516 | SV * |
1136 | SV * |
517 | timer::new () |
1137 | timer::new () |
518 | CODE: |
1138 | CODE: |
519 | timer *w = new timer; |
1139 | timer *w = new timer; |
|
|
1140 | w->start (NOW); |
520 | RETVAL = newSVptr ((void *)w, "urxvt::timer"); |
1141 | RETVAL = newSVptr ((void *)w, "urxvt::timer"); |
521 | w->self = (HV *)SvRV (RETVAL); |
1142 | w->self = (HV *)SvRV (RETVAL); |
522 | OUTPUT: |
1143 | OUTPUT: |
523 | RETVAL |
1144 | RETVAL |
524 | |
1145 | |
… | |
… | |
532 | |
1153 | |
533 | NV |
1154 | NV |
534 | timer::at () |
1155 | timer::at () |
535 | CODE: |
1156 | CODE: |
536 | RETVAL = THIS->at; |
1157 | RETVAL = THIS->at; |
|
|
1158 | OUTPUT: |
|
|
1159 | RETVAL |
|
|
1160 | |
|
|
1161 | timer * |
|
|
1162 | timer::interval (NV interval) |
|
|
1163 | CODE: |
|
|
1164 | THIS->interval = interval; |
|
|
1165 | RETVAL = THIS; |
537 | OUTPUT: |
1166 | OUTPUT: |
538 | RETVAL |
1167 | RETVAL |
539 | |
1168 | |
540 | timer * |
1169 | timer * |
541 | timer::set (NV tstamp) |
1170 | timer::set (NV tstamp) |