1 |
/*----------------------------------------------------------------------* |
2 |
* File: rxvtperl.xs |
3 |
*----------------------------------------------------------------------* |
4 |
* |
5 |
* All portions of code are copyright by their respective author/s. |
6 |
* Copyright (c) 2005-2006 Marc Lehmann <pcg@goof.com> |
7 |
* |
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 |
10 |
* the Free Software Foundation; either version 2 of the License, or |
11 |
* (at your option) any later version. |
12 |
* |
13 |
* This program is distributed in the hope that it will be useful, |
14 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16 |
* GNU General Public License for more details. |
17 |
* |
18 |
* You should have received a copy of the GNU General Public License |
19 |
* along with this program; if not, write to the Free Software |
20 |
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
21 |
*----------------------------------------------------------------------*/ |
22 |
|
23 |
#define line_t perl_line_t |
24 |
#include <EXTERN.h> |
25 |
#include <perl.h> |
26 |
#include <XSUB.h> |
27 |
#undef line_t |
28 |
|
29 |
#include "../config.h" |
30 |
|
31 |
#include <cstdarg> |
32 |
|
33 |
#include "rxvt.h" |
34 |
#include "iom.h" |
35 |
#include "rxvtutil.h" |
36 |
#include "rxvtperl.h" |
37 |
|
38 |
#include "perlxsi.c" |
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 |
|
45 |
///////////////////////////////////////////////////////////////////////////// |
46 |
|
47 |
static wchar_t * |
48 |
sv2wcs (SV *sv) |
49 |
{ |
50 |
STRLEN len; |
51 |
char *str = SvPVutf8 (sv, len); |
52 |
return rxvt_utf8towcs (str, len); |
53 |
} |
54 |
|
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 * |
68 |
new_ref (HV *hv, const char *klass) |
69 |
{ |
70 |
return sv_bless (newRV ((SV *)hv), gv_stashpv (klass, 1)); |
71 |
} |
72 |
|
73 |
//TODO: use magic |
74 |
static SV * |
75 |
newSVptr (void *ptr, const char *klass) |
76 |
{ |
77 |
HV *hv = newHV (); |
78 |
sv_magic ((SV *)hv, 0, PERL_MAGIC_ext, (char *)ptr, 0); |
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); |
90 |
} |
91 |
|
92 |
static long |
93 |
SvPTR (SV *sv, const char *klass) |
94 |
{ |
95 |
if (!sv_derived_from (sv, klass)) |
96 |
croak ("object of type %s expected", klass); |
97 |
|
98 |
MAGIC *mg = mg_find (SvRV (sv), PERL_MAGIC_ext); |
99 |
|
100 |
if (!mg) |
101 |
croak ("perl code used %s object, but C++ object is already destroyed, caught", klass); |
102 |
|
103 |
return (long)mg->mg_ptr; |
104 |
} |
105 |
|
106 |
#define newSVterm(term) SvREFCNT_inc ((SV *)term->perl.self) |
107 |
#define SvTERM(sv) (rxvt_term *)SvPTR (sv, "urxvt::term") |
108 |
|
109 |
///////////////////////////////////////////////////////////////////////////// |
110 |
|
111 |
struct perl_watcher |
112 |
{ |
113 |
SV *cbsv; |
114 |
HV *self; |
115 |
|
116 |
perl_watcher () |
117 |
: cbsv (newSV (0)) |
118 |
{ |
119 |
} |
120 |
|
121 |
~perl_watcher () |
122 |
{ |
123 |
SvREFCNT_dec (cbsv); |
124 |
} |
125 |
|
126 |
void cb (SV *cb) |
127 |
{ |
128 |
sv_setsv (cbsv, cb); |
129 |
} |
130 |
|
131 |
void invoke (const char *type, SV *self, int arg = -1); |
132 |
}; |
133 |
|
134 |
void |
135 |
perl_watcher::invoke (const char *type, SV *self, int arg) |
136 |
{ |
137 |
dSP; |
138 |
|
139 |
ENTER; |
140 |
SAVETMPS; |
141 |
|
142 |
PUSHMARK (SP); |
143 |
|
144 |
XPUSHs (sv_2mortal (self)); |
145 |
|
146 |
if (arg >= 0) |
147 |
XPUSHs (sv_2mortal (newSViv (arg))); |
148 |
|
149 |
PUTBACK; |
150 |
call_sv (cbsv, G_VOID | G_EVAL | G_DISCARD); |
151 |
SPAGAIN; |
152 |
|
153 |
PUTBACK; |
154 |
FREETMPS; |
155 |
LEAVE; |
156 |
|
157 |
if (SvTRUE (ERRSV)) |
158 |
rxvt_warn ("%s callback evaluation error: %s", type, SvPV_nolen (ERRSV)); |
159 |
} |
160 |
|
161 |
#define newSVtimer(timer) new_ref (timer->self, "urxvt::timer") |
162 |
#define SvTIMER(sv) (timer *)SvPTR (sv, "urxvt::timer") |
163 |
|
164 |
struct timer : time_watcher, perl_watcher |
165 |
{ |
166 |
tstamp interval; |
167 |
|
168 |
timer () |
169 |
: time_watcher (this, &timer::execute) |
170 |
{ |
171 |
} |
172 |
|
173 |
void execute (time_watcher &w) |
174 |
{ |
175 |
if (interval) |
176 |
start (at + interval); |
177 |
|
178 |
invoke ("urxvt::timer", newSVtimer (this)); |
179 |
} |
180 |
}; |
181 |
|
182 |
#define newSViow(iow) new_ref (iow->self, "urxvt::iow") |
183 |
#define SvIOW(sv) (iow *)SvPTR (sv, "urxvt::iow") |
184 |
|
185 |
struct iow : io_watcher, perl_watcher |
186 |
{ |
187 |
iow () |
188 |
: io_watcher (this, &iow::execute) |
189 |
{ |
190 |
} |
191 |
|
192 |
void execute (io_watcher &w, short revents) |
193 |
{ |
194 |
invoke ("urxvt::iow", newSViow (this), revents); |
195 |
} |
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->perl.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->perl.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 |
|
367 |
|
368 |
///////////////////////////////////////////////////////////////////////////// |
369 |
|
370 |
struct rxvt_perl_interp rxvt_perl; |
371 |
|
372 |
static PerlInterpreter *perl; |
373 |
|
374 |
rxvt_perl_interp::rxvt_perl_interp () |
375 |
{ |
376 |
} |
377 |
|
378 |
rxvt_perl_interp::~rxvt_perl_interp () |
379 |
{ |
380 |
if (perl) |
381 |
{ |
382 |
perl_destruct (perl); |
383 |
perl_free (perl); |
384 |
} |
385 |
} |
386 |
|
387 |
void |
388 |
rxvt_perl_interp::init () |
389 |
{ |
390 |
if (!perl) |
391 |
{ |
392 |
char *argv[] = { |
393 |
"", |
394 |
"-edo '" LIBDIR "/urxvt.pm' or ($@ and die $@) or exit 1", |
395 |
}; |
396 |
|
397 |
perl = perl_alloc (); |
398 |
perl_construct (perl); |
399 |
|
400 |
if (perl_parse (perl, xs_init, 2, argv, (char **)NULL) |
401 |
|| perl_run (perl)) |
402 |
{ |
403 |
rxvt_warn ("unable to initialize perl-interpreter, continuing without.\n"); |
404 |
|
405 |
perl_destruct (perl); |
406 |
perl_free (perl); |
407 |
perl = 0; |
408 |
} |
409 |
} |
410 |
} |
411 |
|
412 |
bool |
413 |
rxvt_perl_interp::invoke (rxvt_term *term, hook_type htype, ...) |
414 |
{ |
415 |
if (!perl) |
416 |
return false; |
417 |
|
418 |
if (htype == HOOK_INIT) // first hook ever called |
419 |
{ |
420 |
term->perl.self = (void *)newSVptr ((void *)term, "urxvt::term"); |
421 |
hv_store ((HV *)SvRV ((SV *)term->perl.self), "_overlay", 8, newRV_noinc ((SV *)newHV ()), 0); |
422 |
} |
423 |
else if (!term->perl.self) |
424 |
return false; // perl not initialized for this instance |
425 |
else if (htype == HOOK_DESTROY) |
426 |
{ |
427 |
// handled later |
428 |
} |
429 |
else if (htype == HOOK_REFRESH_BEGIN || htype == HOOK_REFRESH_END) |
430 |
{ |
431 |
HV *hv = (HV *)SvRV (*hv_fetch ((HV *)SvRV ((SV *)term->perl.self), "_overlay", 8, 0)); |
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 |
} |
441 |
else if (!should_invoke [htype]) |
442 |
return false; |
443 |
|
444 |
dSP; |
445 |
va_list ap; |
446 |
|
447 |
va_start (ap, htype); |
448 |
|
449 |
ENTER; |
450 |
SAVETMPS; |
451 |
|
452 |
PUSHMARK (SP); |
453 |
|
454 |
XPUSHs (sv_2mortal (newSVterm (term))); |
455 |
XPUSHs (sv_2mortal (newSViv (htype))); |
456 |
|
457 |
for (;;) { |
458 |
data_type dt = (data_type)va_arg (ap, int); |
459 |
|
460 |
switch (dt) |
461 |
{ |
462 |
case DT_INT: |
463 |
XPUSHs (sv_2mortal (newSViv (va_arg (ap, int)))); |
464 |
break; |
465 |
|
466 |
case DT_LONG: |
467 |
XPUSHs (sv_2mortal (newSViv (va_arg (ap, long)))); |
468 |
break; |
469 |
|
470 |
case DT_STR: |
471 |
XPUSHs (sv_2mortal (newSVpv (va_arg (ap, char *), 0))); |
472 |
break; |
473 |
|
474 |
case DT_STR_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_WCS_LEN: |
484 |
{ |
485 |
wchar_t *wstr = va_arg (ap, wchar_t *); |
486 |
int wlen = va_arg (ap, int); |
487 |
|
488 |
XPUSHs (sv_2mortal (wcs2sv (wstr, wlen))); |
489 |
} |
490 |
break; |
491 |
|
492 |
case DT_XEVENT: |
493 |
{ |
494 |
XEvent *xe = va_arg (ap, XEvent *); |
495 |
HV *hv = newHV (); |
496 |
|
497 |
# define set(name, sv) hv_store (hv, # name, sizeof (# name) - 1, sv, 0) |
498 |
# define setiv(name, val) hv_store (hv, # name, sizeof (# name) - 1, newSViv (val), 0) |
499 |
# undef set |
500 |
|
501 |
setiv (type, xe->type); |
502 |
setiv (send_event, xe->xany.send_event); |
503 |
setiv (serial, xe->xany.serial); |
504 |
|
505 |
switch (xe->type) |
506 |
{ |
507 |
case KeyPress: |
508 |
case KeyRelease: |
509 |
case ButtonPress: |
510 |
case ButtonRelease: |
511 |
case MotionNotify: |
512 |
setiv (time, xe->xmotion.time); |
513 |
setiv (x, xe->xmotion.x); |
514 |
setiv (y, xe->xmotion.y); |
515 |
setiv (row, xe->xmotion.y / term->fheight); |
516 |
setiv (col, xe->xmotion.x / term->fwidth); |
517 |
setiv (x_root, xe->xmotion.x_root); |
518 |
setiv (y_root, xe->xmotion.y_root); |
519 |
setiv (state, xe->xmotion.state); |
520 |
break; |
521 |
} |
522 |
|
523 |
switch (xe->type) |
524 |
{ |
525 |
case KeyPress: |
526 |
case KeyRelease: |
527 |
setiv (keycode, xe->xkey.keycode); |
528 |
break; |
529 |
|
530 |
case ButtonPress: |
531 |
case ButtonRelease: |
532 |
setiv (button, xe->xbutton.button); |
533 |
break; |
534 |
|
535 |
case MotionNotify: |
536 |
setiv (is_hint, xe->xmotion.is_hint); |
537 |
break; |
538 |
} |
539 |
|
540 |
XPUSHs (sv_2mortal (newRV_noinc ((SV *)hv))); |
541 |
} |
542 |
break; |
543 |
|
544 |
case DT_END: |
545 |
{ |
546 |
va_end (ap); |
547 |
|
548 |
PUTBACK; |
549 |
int count = call_pv ("urxvt::invoke", G_ARRAY | G_EVAL); |
550 |
SPAGAIN; |
551 |
|
552 |
if (count) |
553 |
{ |
554 |
SV *status = POPs; |
555 |
count = SvTRUE (status); |
556 |
} |
557 |
|
558 |
PUTBACK; |
559 |
FREETMPS; |
560 |
LEAVE; |
561 |
|
562 |
if (SvTRUE (ERRSV)) |
563 |
rxvt_warn ("perl hook %d evaluation error: %s", htype, SvPV_nolen (ERRSV)); |
564 |
|
565 |
if (htype == HOOK_DESTROY) |
566 |
{ |
567 |
clearSVptr ((SV *)term->perl.self); |
568 |
SvREFCNT_dec ((SV *)term->perl.self); |
569 |
} |
570 |
|
571 |
return count; |
572 |
} |
573 |
|
574 |
default: |
575 |
rxvt_fatal ("FATAL: unable to pass data type %d\n", dt); |
576 |
} |
577 |
} |
578 |
} |
579 |
|
580 |
///////////////////////////////////////////////////////////////////////////// |
581 |
|
582 |
MODULE = urxvt PACKAGE = urxvt |
583 |
|
584 |
PROTOTYPES: ENABLE |
585 |
|
586 |
BOOT: |
587 |
{ |
588 |
HV *stash = gv_stashpv ("urxvt", 1); |
589 |
# define export_const_iv(name) newCONSTSUB (stash, # name, newSViv (name)); |
590 |
|
591 |
AV *hookname = get_av ("urxvt::HOOKNAME", 1); |
592 |
# define def(sym) av_store (hookname, HOOK_ ## sym, newSVpv (# sym, 0)); |
593 |
# include "hookinc.h" |
594 |
# undef def |
595 |
|
596 |
|
597 |
export_const_iv (DEFAULT_RSTYLE); |
598 |
export_const_iv (OVERLAY_RSTYLE); |
599 |
export_const_iv (RS_Bold); |
600 |
export_const_iv (RS_Italic); |
601 |
export_const_iv (RS_Blink); |
602 |
export_const_iv (RS_RVid); |
603 |
export_const_iv (RS_Uline); |
604 |
export_const_iv (CurrentTime); |
605 |
|
606 |
sv_setsv (get_sv ("urxvt::LIBDIR", 1), newSVpvn (LIBDIR, sizeof (LIBDIR) - 1)); |
607 |
} |
608 |
|
609 |
SV * |
610 |
new (...) |
611 |
CODE: |
612 |
{ |
613 |
stringvec *argv = new stringvec; |
614 |
bool success; |
615 |
|
616 |
for (int i = 0; i < items ;i++) |
617 |
argv->push_back (strdup (SvPVbyte_nolen (ST (i)))); |
618 |
|
619 |
rxvt_term *term = new rxvt_term; |
620 |
|
621 |
term->argv = argv; |
622 |
|
623 |
try |
624 |
{ |
625 |
if (!term->init (argv->size (), argv->begin ())) |
626 |
term = 0; |
627 |
} |
628 |
catch (const class rxvt_failure_exception &e) |
629 |
{ |
630 |
term->destroy (); |
631 |
croak ("exception caught while initializing new terminal instance"); |
632 |
} |
633 |
|
634 |
RETVAL = term && term->perl.self ? newSVterm (term) : &PL_sv_undef; |
635 |
} |
636 |
OUTPUT: |
637 |
RETVAL |
638 |
|
639 |
void |
640 |
set_should_invoke (int htype, int value) |
641 |
CODE: |
642 |
rxvt_perl.should_invoke [htype] = value; |
643 |
|
644 |
void |
645 |
warn (const char *msg) |
646 |
CODE: |
647 |
rxvt_warn ("%s", msg); |
648 |
|
649 |
void |
650 |
fatal (const char *msg) |
651 |
CODE: |
652 |
rxvt_fatal ("%s", msg); |
653 |
|
654 |
NV |
655 |
NOW () |
656 |
CODE: |
657 |
RETVAL = NOW; |
658 |
OUTPUT: |
659 |
RETVAL |
660 |
|
661 |
int |
662 |
GET_BASEFG (int rend) |
663 |
CODE: |
664 |
RETVAL = GET_BASEFG (rend); |
665 |
OUTPUT: |
666 |
RETVAL |
667 |
|
668 |
int |
669 |
GET_BASEBG (int rend) |
670 |
CODE: |
671 |
RETVAL = GET_BASEBG (rend); |
672 |
OUTPUT: |
673 |
RETVAL |
674 |
|
675 |
int |
676 |
SET_FGCOLOR (int rend, int new_color) |
677 |
CODE: |
678 |
RETVAL = SET_FGCOLOR (rend, new_color); |
679 |
OUTPUT: |
680 |
RETVAL |
681 |
|
682 |
int |
683 |
SET_BGCOLOR (int rend, int new_color) |
684 |
CODE: |
685 |
RETVAL = SET_BGCOLOR (rend, new_color); |
686 |
OUTPUT: |
687 |
RETVAL |
688 |
|
689 |
int |
690 |
GET_CUSTOM (int rend) |
691 |
CODE: |
692 |
RETVAL = (rend && RS_customMask) >> RS_customShift; |
693 |
OUTPUT: |
694 |
RETVAL |
695 |
|
696 |
int |
697 |
SET_CUSTOM (int rend, int new_value) |
698 |
CODE: |
699 |
{ |
700 |
if (!IN_RANGE_EXC (new_value, 0, RS_customCount)) |
701 |
croak ("custom value out of range, must be 0..%d", RS_customCount - 1); |
702 |
|
703 |
RETVAL = (rend & ~RS_customMask) |
704 |
| ((new_value << RS_customShift) & RS_customMask); |
705 |
} |
706 |
OUTPUT: |
707 |
RETVAL |
708 |
|
709 |
MODULE = urxvt PACKAGE = urxvt::term |
710 |
|
711 |
void |
712 |
rxvt_term::destroy () |
713 |
|
714 |
void |
715 |
rxvt_term::grab_button (int button, U32 modifiers) |
716 |
CODE: |
717 |
XGrabButton (THIS->display->display, button, modifiers, THIS->vt, 1, |
718 |
ButtonPressMask | ButtonReleaseMask | EnterWindowMask | LeaveWindowMask | PointerMotionMask, |
719 |
GrabModeSync, GrabModeSync, None, None); |
720 |
|
721 |
bool |
722 |
rxvt_term::grab (U32 eventtime, int sync = 0) |
723 |
CODE: |
724 |
{ |
725 |
int mode = sync ? GrabModeSync : GrabModeAsync; |
726 |
|
727 |
THIS->perl.grabtime = 0; |
728 |
|
729 |
if (!XGrabPointer (THIS->display->display, THIS->vt, 0, |
730 |
ButtonPressMask | ButtonReleaseMask | EnterWindowMask | LeaveWindowMask | PointerMotionMask, |
731 |
mode, mode, None, None, eventtime)) |
732 |
if (!XGrabKeyboard (THIS->display->display, THIS->vt, 0, mode, mode, eventtime)) |
733 |
THIS->perl.grabtime = eventtime; |
734 |
else |
735 |
XUngrabPointer (THIS->display->display, eventtime); |
736 |
|
737 |
RETVAL = !!THIS->perl.grabtime; |
738 |
} |
739 |
OUTPUT: |
740 |
RETVAL |
741 |
|
742 |
void |
743 |
rxvt_term::allow_events_async (U32 eventtime = THIS->perl.grabtime) |
744 |
CODE: |
745 |
XAllowEvents (THIS->display->display, AsyncBoth, eventtime); |
746 |
|
747 |
void |
748 |
rxvt_term::allow_events_sync (U32 eventtime = THIS->perl.grabtime) |
749 |
CODE: |
750 |
XAllowEvents (THIS->display->display, SyncBoth, eventtime); |
751 |
|
752 |
void |
753 |
rxvt_term::allow_events_replay (U32 eventtime = THIS->perl.grabtime) |
754 |
CODE: |
755 |
XAllowEvents (THIS->display->display, ReplayPointer, eventtime); |
756 |
XAllowEvents (THIS->display->display, ReplayKeyboard, eventtime); |
757 |
|
758 |
void |
759 |
rxvt_term::ungrab (U32 eventtime = THIS->perl.grabtime) |
760 |
CODE: |
761 |
THIS->perl.grabtime = 0; |
762 |
XUngrabKeyboard (THIS->display->display, eventtime); |
763 |
XUngrabPointer (THIS->display->display, eventtime); |
764 |
|
765 |
int |
766 |
rxvt_term::strwidth (SV *str) |
767 |
CODE: |
768 |
{ |
769 |
wchar_t *wstr = sv2wcs (str); |
770 |
|
771 |
rxvt_push_locale (THIS->locale); |
772 |
RETVAL = wcswidth (wstr, wcslen (wstr)); |
773 |
rxvt_pop_locale (); |
774 |
|
775 |
free (wstr); |
776 |
} |
777 |
OUTPUT: |
778 |
RETVAL |
779 |
|
780 |
SV * |
781 |
rxvt_term::locale_encode (SV *str) |
782 |
CODE: |
783 |
{ |
784 |
wchar_t *wstr = sv2wcs (str); |
785 |
|
786 |
rxvt_push_locale (THIS->locale); |
787 |
char *mbstr = rxvt_wcstombs (wstr); |
788 |
rxvt_pop_locale (); |
789 |
|
790 |
free (wstr); |
791 |
|
792 |
RETVAL = newSVpv (mbstr, 0); |
793 |
free (mbstr); |
794 |
} |
795 |
OUTPUT: |
796 |
RETVAL |
797 |
|
798 |
SV * |
799 |
rxvt_term::locale_decode (SV *octets) |
800 |
CODE: |
801 |
{ |
802 |
STRLEN len; |
803 |
char *data = SvPVbyte (octets, len); |
804 |
|
805 |
rxvt_push_locale (THIS->locale); |
806 |
wchar_t *wstr = rxvt_mbstowcs (data, len); |
807 |
rxvt_pop_locale (); |
808 |
|
809 |
RETVAL = wcs2sv (wstr); |
810 |
free (wstr); |
811 |
} |
812 |
OUTPUT: |
813 |
RETVAL |
814 |
|
815 |
# very portable, especially on objects as opposed to pods |
816 |
#define TERM_OFFSET(sym) (((char *)&((TermWin_t *)0)->sym) - (char *)(TermWin_t *)0) |
817 |
|
818 |
#define TERM_OFFSET_width TERM_OFFSET(width) |
819 |
#define TERM_OFFSET_height TERM_OFFSET(height) |
820 |
#define TERM_OFFSET_fwidth TERM_OFFSET(fwidth) |
821 |
#define TERM_OFFSET_fheight TERM_OFFSET(fheight) |
822 |
#define TERM_OFFSET_fbase TERM_OFFSET(fbase) |
823 |
#define TERM_OFFSET_nrow TERM_OFFSET(nrow) |
824 |
#define TERM_OFFSET_ncol TERM_OFFSET(ncol) |
825 |
#define TERM_OFFSET_focus TERM_OFFSET(focus) |
826 |
#define TERM_OFFSET_mapped TERM_OFFSET(mapped) |
827 |
#define TERM_OFFSET_saveLines TERM_OFFSET(saveLines) |
828 |
#define TERM_OFFSET_total_rows TERM_OFFSET(total_rows) |
829 |
#define TERM_OFFSET_nsaved TERM_OFFSET(nsaved) |
830 |
|
831 |
int |
832 |
rxvt_term::width () |
833 |
ALIAS: |
834 |
width = TERM_OFFSET_width |
835 |
height = TERM_OFFSET_height |
836 |
fwidth = TERM_OFFSET_fwidth |
837 |
fheight = TERM_OFFSET_fheight |
838 |
fbase = TERM_OFFSET_fbase |
839 |
nrow = TERM_OFFSET_nrow |
840 |
ncol = TERM_OFFSET_ncol |
841 |
focus = TERM_OFFSET_focus |
842 |
mapped = TERM_OFFSET_mapped |
843 |
saveLines = TERM_OFFSET_saveLines |
844 |
total_rows = TERM_OFFSET_total_rows |
845 |
nsaved = TERM_OFFSET_nsaved |
846 |
CODE: |
847 |
RETVAL = *(int *)((char *)THIS + ix); |
848 |
OUTPUT: |
849 |
RETVAL |
850 |
|
851 |
U32 |
852 |
rxvt_term::parent () |
853 |
CODE: |
854 |
RETVAL = (U32)THIS->parent [0]; |
855 |
OUTPUT: |
856 |
RETVAL |
857 |
|
858 |
U32 |
859 |
rxvt_term::vt () |
860 |
CODE: |
861 |
RETVAL = (U32)THIS->vt; |
862 |
OUTPUT: |
863 |
RETVAL |
864 |
|
865 |
U32 |
866 |
rxvt_term::rstyle (U32 new_rstyle = THIS->rstyle) |
867 |
CODE: |
868 |
{ |
869 |
RETVAL = THIS->rstyle; |
870 |
THIS->rstyle = new_rstyle; |
871 |
} |
872 |
OUTPUT: |
873 |
RETVAL |
874 |
|
875 |
int |
876 |
rxvt_term::view_start (int newval = -1) |
877 |
CODE: |
878 |
{ |
879 |
RETVAL = THIS->view_start; |
880 |
|
881 |
if (newval >= 0) |
882 |
{ |
883 |
THIS->view_start = min (newval, THIS->nsaved); |
884 |
THIS->scr_changeview (RETVAL); |
885 |
} |
886 |
} |
887 |
OUTPUT: |
888 |
RETVAL |
889 |
|
890 |
void |
891 |
rxvt_term::want_refresh () |
892 |
CODE: |
893 |
THIS->want_refresh = 1; |
894 |
|
895 |
void |
896 |
rxvt_term::ROW_t (int row_number, SV *new_text = 0, int start_col = 0, int start_ofs = 0, int max_len = MAX_COLS) |
897 |
PPCODE: |
898 |
{ |
899 |
if (!IN_RANGE_EXC (row_number, -THIS->nsaved, THIS->nrow)) |
900 |
XSRETURN_EMPTY; |
901 |
|
902 |
line_t &l = ROW(row_number); |
903 |
|
904 |
if (GIMME_V != G_VOID) |
905 |
{ |
906 |
wchar_t *wstr = new wchar_t [THIS->ncol]; |
907 |
|
908 |
for (int col = 0; col < THIS->ncol; col++) |
909 |
wstr [col] = l.t [col]; |
910 |
|
911 |
XPUSHs (sv_2mortal (wcs2sv (wstr, THIS->ncol))); |
912 |
|
913 |
delete [] wstr; |
914 |
} |
915 |
|
916 |
if (new_text) |
917 |
{ |
918 |
wchar_t *wstr = sv2wcs (new_text); |
919 |
|
920 |
int len = min (wcslen (wstr) - start_ofs, max_len); |
921 |
|
922 |
if (!IN_RANGE_INC (start_col, 0, THIS->ncol - len)) |
923 |
{ |
924 |
free (wstr); |
925 |
croak ("new_text extends beyond horizontal margins"); |
926 |
} |
927 |
|
928 |
for (int col = start_col; col < start_col + len; col++) |
929 |
{ |
930 |
l.t [col] = wstr [start_ofs + col - start_col]; |
931 |
l.r [col] = SET_FONT (l.r [col], THIS->fontset [GET_STYLE (l.r [col])]->find_font (l.t [col])); |
932 |
} |
933 |
|
934 |
free (wstr); |
935 |
} |
936 |
} |
937 |
|
938 |
void |
939 |
rxvt_term::ROW_r (int row_number, SV *new_rend = 0, int start_col = 0, int start_ofs = 0, int max_len = MAX_COLS) |
940 |
PPCODE: |
941 |
{ |
942 |
if (!IN_RANGE_EXC (row_number, -THIS->nsaved, THIS->nrow)) |
943 |
XSRETURN_EMPTY; |
944 |
|
945 |
line_t &l = ROW(row_number); |
946 |
|
947 |
if (GIMME_V != G_VOID) |
948 |
{ |
949 |
AV *av = newAV (); |
950 |
|
951 |
av_extend (av, THIS->ncol - 1); |
952 |
for (int col = 0; col < THIS->ncol; col++) |
953 |
av_store (av, col, newSViv (l.r [col])); |
954 |
|
955 |
XPUSHs (sv_2mortal (newRV_noinc ((SV *)av))); |
956 |
} |
957 |
|
958 |
if (new_rend) |
959 |
{ |
960 |
if (!SvROK (new_rend) || SvTYPE (SvRV (new_rend)) != SVt_PVAV) |
961 |
croak ("new_rend must be arrayref"); |
962 |
|
963 |
AV *av = (AV *)SvRV (new_rend); |
964 |
int len = min (av_len (av) + 1 - start_ofs, max_len); |
965 |
|
966 |
if (!IN_RANGE_INC (start_col, 0, THIS->ncol - len)) |
967 |
croak ("new_rend array extends beyond horizontal margins"); |
968 |
|
969 |
for (int col = start_col; col < start_col + len; col++) |
970 |
{ |
971 |
rend_t r = SvIV (*av_fetch (av, start_ofs + col - start_col, 1)) & ~RS_fontMask; |
972 |
|
973 |
l.r [col] = SET_FONT (r, THIS->fontset [GET_STYLE (r)]->find_font (l.t [col])); |
974 |
} |
975 |
} |
976 |
} |
977 |
|
978 |
int |
979 |
rxvt_term::ROW_l (int row_number, int new_length = -1) |
980 |
CODE: |
981 |
{ |
982 |
if (!IN_RANGE_EXC (row_number, -THIS->nsaved, THIS->nrow)) |
983 |
XSRETURN_EMPTY; |
984 |
|
985 |
line_t &l = ROW(row_number); |
986 |
RETVAL = l.l; |
987 |
|
988 |
if (new_length >= 0) |
989 |
l.l = new_length; |
990 |
} |
991 |
OUTPUT: |
992 |
RETVAL |
993 |
|
994 |
bool |
995 |
rxvt_term::ROW_is_longer (int row_number, int new_is_longer = -1) |
996 |
CODE: |
997 |
{ |
998 |
if (!IN_RANGE_EXC (row_number, -THIS->nsaved, THIS->nrow)) |
999 |
XSRETURN_EMPTY; |
1000 |
|
1001 |
line_t &l = ROW(row_number); |
1002 |
RETVAL = l.is_longer (); |
1003 |
|
1004 |
if (new_is_longer >= 0) |
1005 |
l.is_longer (new_is_longer); |
1006 |
} |
1007 |
OUTPUT: |
1008 |
RETVAL |
1009 |
|
1010 |
SV * |
1011 |
rxvt_term::special_encode (SV *string) |
1012 |
CODE: |
1013 |
{ |
1014 |
wchar_t *wstr = sv2wcs (string); |
1015 |
int wlen = wcslen (wstr); |
1016 |
wchar_t *rstr = new wchar_t [wlen]; // cannot become longer |
1017 |
|
1018 |
rxvt_push_locale (THIS->locale); |
1019 |
|
1020 |
wchar_t *r = rstr; |
1021 |
for (wchar_t *s = wstr; *s; s++) |
1022 |
if (wcwidth (*s) == 0) |
1023 |
{ |
1024 |
if (r == rstr) |
1025 |
croak ("leading combining character unencodable"); |
1026 |
|
1027 |
unicode_t n = rxvt_compose (r[-1], *s); |
1028 |
if (n == NOCHAR) |
1029 |
n = rxvt_composite.compose (r[-1], *s); |
1030 |
|
1031 |
r[-1] = n; |
1032 |
} |
1033 |
#if !UNICODE_3 |
1034 |
else if (*s >= 0x10000) |
1035 |
*r++ = rxvt_composite.compose (*s); |
1036 |
#endif |
1037 |
else |
1038 |
*r++ = *s; |
1039 |
|
1040 |
rxvt_pop_locale (); |
1041 |
|
1042 |
RETVAL = wcs2sv (rstr, r - rstr); |
1043 |
|
1044 |
delete [] rstr; |
1045 |
} |
1046 |
OUTPUT: |
1047 |
RETVAL |
1048 |
|
1049 |
SV * |
1050 |
rxvt_term::special_decode (SV *text) |
1051 |
CODE: |
1052 |
{ |
1053 |
wchar_t *wstr = sv2wcs (text); |
1054 |
int wlen = wcslen (wstr); |
1055 |
int dlen = 0; |
1056 |
|
1057 |
// find length |
1058 |
for (wchar_t *s = wstr; *s; s++) |
1059 |
if (*s == NOCHAR) |
1060 |
; |
1061 |
else if (IS_COMPOSE (*s)) |
1062 |
dlen += rxvt_composite.expand (*s, 0); |
1063 |
else |
1064 |
dlen++; |
1065 |
|
1066 |
wchar_t *rstr = new wchar_t [dlen]; |
1067 |
|
1068 |
// decode |
1069 |
wchar_t *r = rstr; |
1070 |
for (wchar_t *s = wstr; *s; s++) |
1071 |
if (*s == NOCHAR) |
1072 |
; |
1073 |
else if (IS_COMPOSE (*s)) |
1074 |
r += rxvt_composite.expand (*s, r); |
1075 |
else |
1076 |
*r++ = *s; |
1077 |
|
1078 |
RETVAL = wcs2sv (rstr, r - rstr); |
1079 |
|
1080 |
delete [] rstr; |
1081 |
} |
1082 |
OUTPUT: |
1083 |
RETVAL |
1084 |
|
1085 |
void |
1086 |
rxvt_term::_resource (char *name, int index, SV *newval = 0) |
1087 |
PPCODE: |
1088 |
{ |
1089 |
struct resval { const char *name; int value; } rslist [] = { |
1090 |
# define def(name) { # name, Rs_ ## name }, |
1091 |
# define reserve(name,count) |
1092 |
# include "rsinc.h" |
1093 |
# undef def |
1094 |
# undef reserve |
1095 |
}; |
1096 |
|
1097 |
struct resval *rs = rslist + sizeof (rslist) / sizeof (rslist [0]); |
1098 |
|
1099 |
do { |
1100 |
if (rs-- == rslist) |
1101 |
croak ("no such resource '%s', requested", name); |
1102 |
} while (strcmp (name, rs->name)); |
1103 |
|
1104 |
index += rs->value; |
1105 |
|
1106 |
if (!IN_RANGE_EXC (index, 0, NUM_RESOURCES)) |
1107 |
croak ("requested out-of-bound resource %s+%d,", name, index - rs->value); |
1108 |
|
1109 |
if (GIMME_V != G_VOID) |
1110 |
XPUSHs (THIS->rs [index] ? sv_2mortal (newSVpv (THIS->rs [index], 0)) : &PL_sv_undef); |
1111 |
|
1112 |
if (newval) |
1113 |
{ |
1114 |
if (SvOK (newval)) |
1115 |
{ |
1116 |
char *str = strdup (SvPVbyte_nolen (newval)); |
1117 |
THIS->rs [index] = str; |
1118 |
THIS->allocated.push_back (str); |
1119 |
} |
1120 |
else |
1121 |
THIS->rs [index] = 0; |
1122 |
} |
1123 |
} |
1124 |
|
1125 |
void |
1126 |
rxvt_term::cur (...) |
1127 |
PROTOTYPE: $;$$ |
1128 |
ALIAS: |
1129 |
screen_cur = 0 |
1130 |
selection_beg = 1 |
1131 |
selection_end = 2 |
1132 |
selection_mark = 3 |
1133 |
PPCODE: |
1134 |
{ |
1135 |
row_col_t &rc = ix == 0 ? THIS->screen.cur |
1136 |
: ix == 1 ? THIS->selection.beg |
1137 |
: ix == 2 ? THIS->selection.end |
1138 |
: THIS->selection.mark; |
1139 |
|
1140 |
if (GIMME_V != G_VOID) |
1141 |
{ |
1142 |
EXTEND (SP, 2); |
1143 |
PUSHs (sv_2mortal (newSViv (rc.row))); |
1144 |
PUSHs (sv_2mortal (newSViv (rc.col))); |
1145 |
} |
1146 |
|
1147 |
if (items == 3) |
1148 |
{ |
1149 |
rc.row = clamp (SvIV (ST (1)), -THIS->nsaved, THIS->nrow - 1); |
1150 |
rc.col = clamp (SvIV (ST (2)), 0, THIS->ncol - 1); |
1151 |
|
1152 |
if (ix) |
1153 |
THIS->want_refresh = 1; |
1154 |
} |
1155 |
} |
1156 |
|
1157 |
int |
1158 |
rxvt_term::selection_grab (U32 eventtime) |
1159 |
|
1160 |
void |
1161 |
rxvt_term::selection (SV *newtext = 0) |
1162 |
PPCODE: |
1163 |
{ |
1164 |
if (GIMME_V != G_VOID) |
1165 |
XPUSHs (sv_2mortal (wcs2sv (THIS->selection.text, THIS->selection.len))); |
1166 |
|
1167 |
if (newtext) |
1168 |
{ |
1169 |
free (THIS->selection.text); |
1170 |
|
1171 |
THIS->selection.text = sv2wcs (newtext); |
1172 |
THIS->selection.len = wcslen (THIS->selection.text); |
1173 |
} |
1174 |
} |
1175 |
|
1176 |
void |
1177 |
rxvt_term::scr_add_lines (SV *string) |
1178 |
CODE: |
1179 |
{ |
1180 |
wchar_t *wstr = sv2wcs (string); |
1181 |
THIS->scr_add_lines (wstr, wcslen (wstr)); |
1182 |
free (wstr); |
1183 |
} |
1184 |
|
1185 |
void |
1186 |
rxvt_term::tt_write (SV *octets) |
1187 |
INIT: |
1188 |
STRLEN len; |
1189 |
char *str = SvPVbyte (octets, len); |
1190 |
C_ARGS: |
1191 |
str, len |
1192 |
|
1193 |
void |
1194 |
rxvt_term::cmd_parse (SV *octets) |
1195 |
CODE: |
1196 |
{ |
1197 |
STRLEN len; |
1198 |
char *str = SvPVbyte (octets, len); |
1199 |
|
1200 |
char *old_cmdbuf_ptr = THIS->cmdbuf_ptr; |
1201 |
char *old_cmdbuf_endp = THIS->cmdbuf_endp; |
1202 |
|
1203 |
THIS->cmdbuf_ptr = str; |
1204 |
THIS->cmdbuf_endp = str + len; |
1205 |
|
1206 |
rxvt_push_locale (THIS->locale); |
1207 |
THIS->cmd_parse (); |
1208 |
rxvt_pop_locale (); |
1209 |
|
1210 |
THIS->cmdbuf_ptr = old_cmdbuf_ptr; |
1211 |
THIS->cmdbuf_endp = old_cmdbuf_endp; |
1212 |
} |
1213 |
|
1214 |
SV * |
1215 |
rxvt_term::overlay (int x, int y, int w, int h, int rstyle = OVERLAY_RSTYLE, int border = 2) |
1216 |
CODE: |
1217 |
{ |
1218 |
overlay *o = new overlay (THIS, x, y, w, h, rstyle, border); |
1219 |
RETVAL = newSVptr ((void *)o, "urxvt::overlay"); |
1220 |
o->self = (HV *)SvRV (RETVAL); |
1221 |
} |
1222 |
OUTPUT: |
1223 |
RETVAL |
1224 |
|
1225 |
MODULE = urxvt PACKAGE = urxvt::overlay |
1226 |
|
1227 |
void |
1228 |
overlay::set (int x, int y, SV *text, SV *rend = 0) |
1229 |
|
1230 |
void |
1231 |
overlay::show () |
1232 |
|
1233 |
void |
1234 |
overlay::hide () |
1235 |
|
1236 |
void |
1237 |
overlay::DESTROY () |
1238 |
|
1239 |
MODULE = urxvt PACKAGE = urxvt::timer |
1240 |
|
1241 |
SV * |
1242 |
timer::new () |
1243 |
CODE: |
1244 |
timer *w = new timer; |
1245 |
w->start (NOW); |
1246 |
RETVAL = newSVptr ((void *)w, "urxvt::timer"); |
1247 |
w->self = (HV *)SvRV (RETVAL); |
1248 |
OUTPUT: |
1249 |
RETVAL |
1250 |
|
1251 |
timer * |
1252 |
timer::cb (SV *cb) |
1253 |
CODE: |
1254 |
THIS->cb (cb); |
1255 |
RETVAL = THIS; |
1256 |
OUTPUT: |
1257 |
RETVAL |
1258 |
|
1259 |
NV |
1260 |
timer::at () |
1261 |
CODE: |
1262 |
RETVAL = THIS->at; |
1263 |
OUTPUT: |
1264 |
RETVAL |
1265 |
|
1266 |
timer * |
1267 |
timer::interval (NV interval) |
1268 |
CODE: |
1269 |
THIS->interval = interval; |
1270 |
RETVAL = THIS; |
1271 |
OUTPUT: |
1272 |
RETVAL |
1273 |
|
1274 |
timer * |
1275 |
timer::set (NV tstamp) |
1276 |
CODE: |
1277 |
THIS->set (tstamp); |
1278 |
RETVAL = THIS; |
1279 |
OUTPUT: |
1280 |
RETVAL |
1281 |
|
1282 |
timer * |
1283 |
timer::start (NV tstamp = THIS->at) |
1284 |
CODE: |
1285 |
THIS->start (tstamp); |
1286 |
RETVAL = THIS; |
1287 |
OUTPUT: |
1288 |
RETVAL |
1289 |
|
1290 |
timer * |
1291 |
timer::stop () |
1292 |
CODE: |
1293 |
THIS->stop (); |
1294 |
RETVAL = THIS; |
1295 |
OUTPUT: |
1296 |
RETVAL |
1297 |
|
1298 |
void |
1299 |
timer::DESTROY () |
1300 |
|
1301 |
MODULE = urxvt PACKAGE = urxvt::iow |
1302 |
|
1303 |
SV * |
1304 |
iow::new () |
1305 |
CODE: |
1306 |
iow *w = new iow; |
1307 |
RETVAL = newSVptr ((void *)w, "urxvt::iow"); |
1308 |
w->self = (HV *)SvRV (RETVAL); |
1309 |
OUTPUT: |
1310 |
RETVAL |
1311 |
|
1312 |
iow * |
1313 |
iow::cb (SV *cb) |
1314 |
CODE: |
1315 |
THIS->cb (cb); |
1316 |
RETVAL = THIS; |
1317 |
OUTPUT: |
1318 |
RETVAL |
1319 |
|
1320 |
iow * |
1321 |
iow::fd (int fd) |
1322 |
CODE: |
1323 |
THIS->fd = fd; |
1324 |
RETVAL = THIS; |
1325 |
OUTPUT: |
1326 |
RETVAL |
1327 |
|
1328 |
iow * |
1329 |
iow::events (short events) |
1330 |
CODE: |
1331 |
THIS->events = events; |
1332 |
RETVAL = THIS; |
1333 |
OUTPUT: |
1334 |
RETVAL |
1335 |
|
1336 |
iow * |
1337 |
iow::start () |
1338 |
CODE: |
1339 |
THIS->start (); |
1340 |
RETVAL = THIS; |
1341 |
OUTPUT: |
1342 |
RETVAL |
1343 |
|
1344 |
iow * |
1345 |
iow::stop () |
1346 |
CODE: |
1347 |
THIS->stop (); |
1348 |
RETVAL = THIS; |
1349 |
OUTPUT: |
1350 |
RETVAL |
1351 |
|
1352 |
void |
1353 |
iow::DESTROY () |
1354 |
|
1355 |
|