1 |
/*----------------------------------------------------------------------* |
2 |
* File: rxvtperl.xs |
3 |
*----------------------------------------------------------------------* |
4 |
* |
5 |
* All portions of code are copyright by their respective author/s. |
6 |
* Copyright (c) 2005-2005 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 |
new_ref (HV *hv, const char *klass) |
57 |
{ |
58 |
return sv_bless (newRV ((SV *)hv), gv_stashpv (klass, 1)); |
59 |
} |
60 |
|
61 |
//TODO: use magic |
62 |
static SV * |
63 |
newSVptr (void *ptr, const char *klass) |
64 |
{ |
65 |
HV *hv = newHV (); |
66 |
hv_store (hv, "_ptr", 4, newSViv ((long)ptr), 0); |
67 |
return sv_bless (newRV_noinc ((SV *)hv), gv_stashpv (klass, 1)); |
68 |
} |
69 |
|
70 |
static long |
71 |
SvPTR (SV *sv, const char *klass) |
72 |
{ |
73 |
if (!sv_derived_from (sv, klass)) |
74 |
croak ("object of type %s expected", klass); |
75 |
|
76 |
IV iv = SvIV (*hv_fetch ((HV *)SvRV (sv), "_ptr", 4, 1)); |
77 |
|
78 |
if (!iv) |
79 |
croak ("perl code used %s object, but C++ object is already destroyed, caught", klass); |
80 |
|
81 |
return (long)iv; |
82 |
} |
83 |
|
84 |
#define newSVterm(term) SvREFCNT_inc ((SV *)term->self) |
85 |
#define SvTERM(sv) (rxvt_term *)SvPTR (sv, "urxvt::term") |
86 |
|
87 |
///////////////////////////////////////////////////////////////////////////// |
88 |
|
89 |
struct perl_watcher |
90 |
{ |
91 |
SV *cbsv; |
92 |
HV *self; |
93 |
|
94 |
perl_watcher () |
95 |
: cbsv (newSV (0)) |
96 |
{ |
97 |
} |
98 |
|
99 |
~perl_watcher () |
100 |
{ |
101 |
SvREFCNT_dec (cbsv); |
102 |
} |
103 |
|
104 |
void cb (SV *cb) |
105 |
{ |
106 |
sv_setsv (cbsv, cb); |
107 |
} |
108 |
|
109 |
void invoke (const char *type, SV *self, int arg = -1); |
110 |
}; |
111 |
|
112 |
void |
113 |
perl_watcher::invoke (const char *type, SV *self, int arg) |
114 |
{ |
115 |
dSP; |
116 |
|
117 |
ENTER; |
118 |
SAVETMPS; |
119 |
|
120 |
PUSHMARK (SP); |
121 |
|
122 |
XPUSHs (sv_2mortal (self)); |
123 |
|
124 |
if (arg >= 0) |
125 |
XPUSHs (sv_2mortal (newSViv (arg))); |
126 |
|
127 |
PUTBACK; |
128 |
call_sv (cbsv, G_VOID | G_EVAL | G_DISCARD); |
129 |
SPAGAIN; |
130 |
|
131 |
PUTBACK; |
132 |
FREETMPS; |
133 |
LEAVE; |
134 |
|
135 |
if (SvTRUE (ERRSV)) |
136 |
rxvt_warn ("%s callback evaluation error: %s", type, SvPV_nolen (ERRSV)); |
137 |
} |
138 |
|
139 |
#define newSVtimer(timer) new_ref (timer->self, "urxvt::timer") |
140 |
#define SvTIMER(sv) (timer *)SvPTR (sv, "urxvt::timer") |
141 |
|
142 |
struct timer : time_watcher, perl_watcher |
143 |
{ |
144 |
timer () |
145 |
: time_watcher (this, &timer::execute) |
146 |
{ |
147 |
} |
148 |
|
149 |
void execute (time_watcher &w) |
150 |
{ |
151 |
invoke ("urxvt::timer", newSVtimer (this)); |
152 |
} |
153 |
}; |
154 |
|
155 |
#define newSViow(iow) new_ref (iow->self, "urxvt::iow") |
156 |
#define SvIOW(sv) (iow *)SvPTR (sv, "urxvt::iow") |
157 |
|
158 |
struct iow : io_watcher, perl_watcher |
159 |
{ |
160 |
iow () |
161 |
: io_watcher (this, &iow::execute) |
162 |
{ |
163 |
} |
164 |
|
165 |
void execute (io_watcher &w, short revents) |
166 |
{ |
167 |
invoke ("urxvt::iow", newSViow (this), revents); |
168 |
} |
169 |
}; |
170 |
|
171 |
///////////////////////////////////////////////////////////////////////////// |
172 |
|
173 |
struct rxvt_perl_interp rxvt_perl; |
174 |
|
175 |
static PerlInterpreter *perl; |
176 |
|
177 |
rxvt_perl_interp::rxvt_perl_interp () |
178 |
{ |
179 |
} |
180 |
|
181 |
rxvt_perl_interp::~rxvt_perl_interp () |
182 |
{ |
183 |
if (perl) |
184 |
{ |
185 |
perl_destruct (perl); |
186 |
perl_free (perl); |
187 |
} |
188 |
} |
189 |
|
190 |
void |
191 |
rxvt_perl_interp::init () |
192 |
{ |
193 |
if (!perl) |
194 |
{ |
195 |
char *argv[] = { |
196 |
"", |
197 |
"-edo '" LIBDIR "/urxvt.pm' or ($@ and die $@) or exit 1", |
198 |
}; |
199 |
|
200 |
perl = perl_alloc (); |
201 |
perl_construct (perl); |
202 |
|
203 |
if (perl_parse (perl, xs_init, 2, argv, (char **)NULL) |
204 |
|| perl_run (perl)) |
205 |
{ |
206 |
rxvt_warn ("unable to initialize perl-interpreter, continuing without.\n"); |
207 |
|
208 |
perl_destruct (perl); |
209 |
perl_free (perl); |
210 |
perl = 0; |
211 |
} |
212 |
} |
213 |
} |
214 |
|
215 |
bool |
216 |
rxvt_perl_interp::invoke (rxvt_term *term, hook_type htype, ...) |
217 |
{ |
218 |
if (!perl |
219 |
|| (!should_invoke [htype] && htype != HOOK_INIT && htype != HOOK_DESTROY)) |
220 |
return false; |
221 |
|
222 |
if (htype == HOOK_INIT) // first hook ever called |
223 |
term->self = (void *)newSVptr ((void *)term, "urxvt::term"); |
224 |
|
225 |
dSP; |
226 |
va_list ap; |
227 |
|
228 |
va_start (ap, htype); |
229 |
|
230 |
ENTER; |
231 |
SAVETMPS; |
232 |
|
233 |
PUSHMARK (SP); |
234 |
|
235 |
XPUSHs (sv_2mortal (newSVterm (term))); |
236 |
XPUSHs (sv_2mortal (newSViv (htype))); |
237 |
|
238 |
for (;;) { |
239 |
data_type dt = (data_type)va_arg (ap, int); |
240 |
|
241 |
switch (dt) |
242 |
{ |
243 |
case DT_INT: |
244 |
XPUSHs (sv_2mortal (newSViv (va_arg (ap, int)))); |
245 |
break; |
246 |
|
247 |
case DT_LONG: |
248 |
XPUSHs (sv_2mortal (newSViv (va_arg (ap, long)))); |
249 |
break; |
250 |
|
251 |
case DT_STRING: |
252 |
XPUSHs (sv_2mortal (newSVpv (va_arg (ap, char *), 0))); |
253 |
break; |
254 |
|
255 |
case DT_END: |
256 |
{ |
257 |
va_end (ap); |
258 |
|
259 |
PUTBACK; |
260 |
int count = call_pv ("urxvt::invoke", G_ARRAY | G_EVAL); |
261 |
SPAGAIN; |
262 |
|
263 |
if (count) |
264 |
{ |
265 |
SV *status = POPs; |
266 |
count = SvTRUE (status); |
267 |
} |
268 |
|
269 |
PUTBACK; |
270 |
FREETMPS; |
271 |
LEAVE; |
272 |
|
273 |
if (SvTRUE (ERRSV)) |
274 |
rxvt_warn ("perl hook %d evaluation error: %s", htype, SvPV_nolen (ERRSV)); |
275 |
|
276 |
if (htype == HOOK_DESTROY) |
277 |
{ |
278 |
// TODO: clear magic |
279 |
hv_clear ((HV *)SvRV ((SV *)term->self)); |
280 |
SvREFCNT_dec ((SV *)term->self); |
281 |
} |
282 |
|
283 |
return count; |
284 |
} |
285 |
|
286 |
default: |
287 |
rxvt_fatal ("FATAL: unable to pass data type %d\n", dt); |
288 |
} |
289 |
} |
290 |
} |
291 |
|
292 |
///////////////////////////////////////////////////////////////////////////// |
293 |
|
294 |
MODULE = urxvt PACKAGE = urxvt |
295 |
|
296 |
PROTOTYPES: ENABLE |
297 |
|
298 |
BOOT: |
299 |
{ |
300 |
# define set_hookname(sym) av_store (hookname, PP_CONCAT(HOOK_, sym), newSVpv (PP_STRINGIFY(sym), 0)) |
301 |
AV *hookname = get_av ("urxvt::HOOKNAME", 1); |
302 |
set_hookname (INIT); |
303 |
set_hookname (RESET); |
304 |
set_hookname (START); |
305 |
set_hookname (DESTROY); |
306 |
set_hookname (SEL_BEGIN); |
307 |
set_hookname (SEL_EXTEND); |
308 |
set_hookname (SEL_MAKE); |
309 |
set_hookname (SEL_GRAB); |
310 |
set_hookname (FOCUS_IN); |
311 |
set_hookname (FOCUS_OUT); |
312 |
set_hookname (VIEW_CHANGE); |
313 |
set_hookname (SCROLL_BACK); |
314 |
set_hookname (TTY_ACTIVITY); |
315 |
set_hookname (REFRESH_BEGIN); |
316 |
set_hookname (REFRESH_END); |
317 |
set_hookname (KEYBOARD_COMMAND); |
318 |
|
319 |
newCONSTSUB (gv_stashpv ("urxvt", 1), "DEFAULT_RSTYLE", newSViv (DEFAULT_RSTYLE)); |
320 |
|
321 |
sv_setpv (get_sv ("urxvt::LIBDIR", 1), LIBDIR); |
322 |
} |
323 |
|
324 |
void |
325 |
set_should_invoke (int htype, int value) |
326 |
CODE: |
327 |
rxvt_perl.should_invoke [htype] = value; |
328 |
|
329 |
void |
330 |
warn (const char *msg) |
331 |
CODE: |
332 |
rxvt_warn ("%s", msg); |
333 |
|
334 |
void |
335 |
fatal (const char *msg) |
336 |
CODE: |
337 |
rxvt_fatal ("%s", msg); |
338 |
|
339 |
NV |
340 |
NOW () |
341 |
CODE: |
342 |
RETVAL = NOW; |
343 |
OUTPUT: |
344 |
RETVAL |
345 |
|
346 |
MODULE = urxvt PACKAGE = urxvt::term |
347 |
|
348 |
int |
349 |
rxvt_term::strwidth (SV *str) |
350 |
CODE: |
351 |
{ |
352 |
wchar_t *wstr = sv2wcs (str); |
353 |
|
354 |
rxvt_push_locale (THIS->locale); |
355 |
RETVAL = wcswidth (wstr, wcslen (wstr)); |
356 |
rxvt_pop_locale (); |
357 |
|
358 |
free (wstr); |
359 |
} |
360 |
OUTPUT: |
361 |
RETVAL |
362 |
|
363 |
SV * |
364 |
rxvt_term::locale_encode (SV *str) |
365 |
CODE: |
366 |
{ |
367 |
wchar_t *wstr = sv2wcs (str); |
368 |
|
369 |
rxvt_push_locale (THIS->locale); |
370 |
char *mbstr = rxvt_wcstombs (wstr); |
371 |
rxvt_pop_locale (); |
372 |
|
373 |
free (wstr); |
374 |
|
375 |
RETVAL = newSVpv (mbstr, 0); |
376 |
free (mbstr); |
377 |
} |
378 |
OUTPUT: |
379 |
RETVAL |
380 |
|
381 |
SV * |
382 |
rxvt_term::locale_decode (SV *octets) |
383 |
CODE: |
384 |
{ |
385 |
STRLEN len; |
386 |
char *data = SvPVbyte (octets, len); |
387 |
|
388 |
rxvt_push_locale (THIS->locale); |
389 |
wchar_t *wstr = rxvt_mbstowcs (data, len); |
390 |
rxvt_pop_locale (); |
391 |
|
392 |
char *str = rxvt_wcstoutf8 (wstr); |
393 |
free (wstr); |
394 |
|
395 |
RETVAL = newSVpv (str, 0); |
396 |
SvUTF8_on (RETVAL); |
397 |
free (str); |
398 |
} |
399 |
OUTPUT: |
400 |
RETVAL |
401 |
|
402 |
int |
403 |
rxvt_term::nsaved () |
404 |
CODE: |
405 |
RETVAL = THIS->nsaved; |
406 |
OUTPUT: |
407 |
RETVAL |
408 |
|
409 |
int |
410 |
rxvt_term::view_start (int newval = -1) |
411 |
CODE: |
412 |
{ |
413 |
RETVAL = THIS->view_start; |
414 |
|
415 |
if (newval >= 0) |
416 |
{ |
417 |
THIS->view_start = min (newval, THIS->nsaved); |
418 |
THIS->scr_changeview (RETVAL); |
419 |
} |
420 |
} |
421 |
OUTPUT: |
422 |
RETVAL |
423 |
|
424 |
int |
425 |
rxvt_term::nrow () |
426 |
CODE: |
427 |
RETVAL = THIS->nrow; |
428 |
OUTPUT: |
429 |
RETVAL |
430 |
|
431 |
int |
432 |
rxvt_term::ncol () |
433 |
CODE: |
434 |
RETVAL = THIS->ncol; |
435 |
OUTPUT: |
436 |
RETVAL |
437 |
|
438 |
void |
439 |
rxvt_term::want_refresh () |
440 |
CODE: |
441 |
THIS->want_refresh = 1; |
442 |
|
443 |
void |
444 |
rxvt_term::ROW_t (int row_number, SV *new_text = 0, int start_col = 0) |
445 |
PPCODE: |
446 |
{ |
447 |
if (!IN_RANGE_EXC (row_number, -THIS->nsaved, THIS->nrow)) |
448 |
croak ("row_number number of out range"); |
449 |
|
450 |
line_t &l = ROW(row_number); |
451 |
|
452 |
if (GIMME_V != G_VOID) |
453 |
{ |
454 |
wchar_t *wstr = new wchar_t [THIS->ncol]; |
455 |
|
456 |
for (int col = 0; col <THIS->ncol; col++) |
457 |
wstr [col] = l.t [col]; |
458 |
|
459 |
char *str = rxvt_wcstoutf8 (wstr, THIS->ncol); |
460 |
free (wstr); |
461 |
|
462 |
SV *sv = newSVpv (str, 0); |
463 |
SvUTF8_on (sv); |
464 |
XPUSHs (sv_2mortal (sv)); |
465 |
free (str); |
466 |
} |
467 |
|
468 |
if (new_text) |
469 |
{ |
470 |
STRLEN slen; |
471 |
char *str = SvPVutf8 (new_text, slen); |
472 |
wchar_t *wstr = rxvt_utf8towcs (str, slen); |
473 |
|
474 |
int len = wcslen (wstr); |
475 |
|
476 |
if (start_col + len > THIS->ncol) |
477 |
{ |
478 |
free (wstr); |
479 |
croak ("new_text extends beyond right margin"); |
480 |
} |
481 |
|
482 |
for (int col = start_col; col < start_col + len; col++) |
483 |
{ |
484 |
l.t [col] = wstr [col - start_col]; |
485 |
l.r [col] = SET_FONT (l.r [col], THIS->fontset [GET_STYLE (l.r [col])]->find_font (l.t [col])); |
486 |
} |
487 |
|
488 |
free (wstr); |
489 |
} |
490 |
} |
491 |
|
492 |
void |
493 |
rxvt_term::ROW_r (int row_number, SV *new_rend = 0, int start_col = 0) |
494 |
PPCODE: |
495 |
{ |
496 |
if (!IN_RANGE_EXC (row_number, -THIS->nsaved, THIS->nrow)) |
497 |
croak ("row_number number of out range"); |
498 |
|
499 |
line_t &l = ROW(row_number); |
500 |
|
501 |
if (GIMME_V != G_VOID) |
502 |
{ |
503 |
AV *av = newAV (); |
504 |
|
505 |
av_extend (av, THIS->ncol - 1); |
506 |
for (int col = 0; col < THIS->ncol; col++) |
507 |
av_store (av, col, newSViv (l.r [col])); |
508 |
|
509 |
XPUSHs (sv_2mortal (newRV_noinc ((SV *)av))); |
510 |
} |
511 |
|
512 |
if (new_rend) |
513 |
{ |
514 |
if (!SvROK (new_rend) || SvTYPE (SvRV (new_rend)) != SVt_PVAV) |
515 |
croak ("new_rend must be arrayref"); |
516 |
|
517 |
AV *av = (AV *)SvRV (new_rend); |
518 |
int len = av_len (av) + 1; |
519 |
|
520 |
if (start_col + len > THIS->ncol) |
521 |
croak ("new_rend array extends beyond right margin"); |
522 |
|
523 |
for (int col = start_col; col < start_col + len; col++) |
524 |
{ |
525 |
rend_t r = SvIV (*av_fetch (av, col - start_col, 1)) & ~RS_fontMask; |
526 |
|
527 |
l.r [col] = SET_FONT (r, THIS->fontset [GET_STYLE (r)]->find_font (l.t [col])); |
528 |
} |
529 |
} |
530 |
} |
531 |
|
532 |
int |
533 |
rxvt_term::ROW_l (int row_number, int new_length = -2) |
534 |
CODE: |
535 |
{ |
536 |
if (!IN_RANGE_EXC (row_number, -THIS->nsaved, THIS->nrow)) |
537 |
croak ("row_number number of out range"); |
538 |
|
539 |
line_t &l = ROW(row_number); |
540 |
RETVAL = l.l; |
541 |
|
542 |
if (new_length >= -1) |
543 |
l.l = new_length; |
544 |
} |
545 |
OUTPUT: |
546 |
RETVAL |
547 |
|
548 |
SV * |
549 |
rxvt_term::special_encode (SV *str) |
550 |
CODE: |
551 |
abort ();//TODO |
552 |
|
553 |
SV * |
554 |
rxvt_term::special_decode (SV *str) |
555 |
CODE: |
556 |
abort ();//TODO |
557 |
|
558 |
void |
559 |
rxvt_term::_resource (char *name, int index, SV *newval = 0) |
560 |
PPCODE: |
561 |
{ |
562 |
struct resval { const char *name; int value; } rslist [] = { |
563 |
# define Rs_def(name) { # name, Rs_ ## name }, |
564 |
# define Rs_reserve(name,count) |
565 |
# include "rsinc.h" |
566 |
# undef Rs_def |
567 |
# undef Rs_reserve |
568 |
}; |
569 |
|
570 |
struct resval *rs = rslist + sizeof (rslist) / sizeof (rslist [0]); |
571 |
|
572 |
do { |
573 |
if (rs-- == rslist) |
574 |
croak ("no such resource '%s', requested", name); |
575 |
} while (strcmp (name, rs->name)); |
576 |
|
577 |
index += rs->value; |
578 |
|
579 |
if (!IN_RANGE_EXC (index, 0, NUM_RESOURCES)) |
580 |
croak ("requested out-of-bound resource %s+%d,", name, index - rs->value); |
581 |
|
582 |
if (GIMME_V != G_VOID) |
583 |
XPUSHs (THIS->rs [index] ? sv_2mortal (newSVpv (THIS->rs [index], 0)) : &PL_sv_undef); |
584 |
|
585 |
if (newval) |
586 |
{ |
587 |
if (SvOK (newval)) |
588 |
{ |
589 |
char *str = strdup (SvPVbyte_nolen (newval)); |
590 |
THIS->rs [index] = str; |
591 |
THIS->allocated.push_back (str); |
592 |
} |
593 |
else |
594 |
THIS->rs [index] = 0; |
595 |
} |
596 |
} |
597 |
|
598 |
void |
599 |
rxvt_term::selection_mark (...) |
600 |
PROTOTYPE: $;$$ |
601 |
ALIAS: |
602 |
selection_beg = 1 |
603 |
selection_end = 2 |
604 |
PPCODE: |
605 |
{ |
606 |
row_col_t &sel = ix == 1 ? THIS->selection.beg |
607 |
: ix == 2 ? THIS->selection.end |
608 |
: THIS->selection.mark; |
609 |
|
610 |
if (GIMME_V != G_VOID) |
611 |
{ |
612 |
EXTEND (SP, 2); |
613 |
PUSHs (sv_2mortal (newSViv (sel.row))); |
614 |
PUSHs (sv_2mortal (newSViv (sel.col))); |
615 |
} |
616 |
|
617 |
if (items == 3) |
618 |
{ |
619 |
sel.row = clamp (SvIV (ST (1)), -THIS->nsaved, THIS->nrow - 1); |
620 |
sel.col = clamp (SvIV (ST (2)), 0, THIS->ncol - 1); |
621 |
|
622 |
if (ix) |
623 |
THIS->want_refresh = 1; |
624 |
} |
625 |
} |
626 |
|
627 |
int |
628 |
rxvt_term::selection_grab (int eventtime) |
629 |
|
630 |
void |
631 |
rxvt_term::selection (SV *newtext = 0) |
632 |
PPCODE: |
633 |
{ |
634 |
if (GIMME_V != G_VOID) |
635 |
{ |
636 |
char *sel = rxvt_wcstoutf8 (THIS->selection.text, THIS->selection.len); |
637 |
SV *sv = newSVpv (sel, 0); |
638 |
SvUTF8_on (sv); |
639 |
free (sel); |
640 |
XPUSHs (sv_2mortal (sv)); |
641 |
} |
642 |
|
643 |
if (newtext) |
644 |
{ |
645 |
free (THIS->selection.text); |
646 |
|
647 |
THIS->selection.text = sv2wcs (newtext); |
648 |
THIS->selection.len = wcslen (THIS->selection.text); |
649 |
} |
650 |
} |
651 |
|
652 |
void |
653 |
rxvt_term::scr_overlay_new (int x, int y, int w, int h) |
654 |
|
655 |
void |
656 |
rxvt_term::scr_overlay_off () |
657 |
|
658 |
void |
659 |
rxvt_term::scr_overlay_set_char (int x, int y, U32 text, U32 rend = OVERLAY_RSTYLE) |
660 |
CODE: |
661 |
THIS->scr_overlay_set (x, y, text, rend); |
662 |
|
663 |
void |
664 |
rxvt_term::scr_overlay_set (int x, int y, SV *text) |
665 |
CODE: |
666 |
{ |
667 |
wchar_t *wtext = sv2wcs (text); |
668 |
THIS->scr_overlay_set (x, y, wtext); |
669 |
free (wtext); |
670 |
} |
671 |
|
672 |
void |
673 |
rxvt_term::tt_write (SV *octets) |
674 |
INIT: |
675 |
STRLEN len; |
676 |
char *str = SvPVbyte (octets, len); |
677 |
C_ARGS: |
678 |
(unsigned char *)str, len |
679 |
|
680 |
MODULE = urxvt PACKAGE = urxvt::timer |
681 |
|
682 |
SV * |
683 |
timer::new () |
684 |
CODE: |
685 |
timer *w = new timer; |
686 |
RETVAL = newSVptr ((void *)w, "urxvt::timer"); |
687 |
w->self = (HV *)SvRV (RETVAL); |
688 |
OUTPUT: |
689 |
RETVAL |
690 |
|
691 |
timer * |
692 |
timer::cb (SV *cb) |
693 |
CODE: |
694 |
THIS->cb (cb); |
695 |
RETVAL = THIS; |
696 |
OUTPUT: |
697 |
RETVAL |
698 |
|
699 |
NV |
700 |
timer::at () |
701 |
CODE: |
702 |
RETVAL = THIS->at; |
703 |
OUTPUT: |
704 |
RETVAL |
705 |
|
706 |
timer * |
707 |
timer::set (NV tstamp) |
708 |
CODE: |
709 |
THIS->set (tstamp); |
710 |
RETVAL = THIS; |
711 |
OUTPUT: |
712 |
RETVAL |
713 |
|
714 |
timer * |
715 |
timer::start (NV tstamp = THIS->at) |
716 |
CODE: |
717 |
THIS->start (tstamp); |
718 |
RETVAL = THIS; |
719 |
OUTPUT: |
720 |
RETVAL |
721 |
|
722 |
timer * |
723 |
timer::stop () |
724 |
CODE: |
725 |
THIS->stop (); |
726 |
RETVAL = THIS; |
727 |
OUTPUT: |
728 |
RETVAL |
729 |
|
730 |
void |
731 |
timer::DESTROY () |
732 |
|
733 |
MODULE = urxvt PACKAGE = urxvt::iow |
734 |
|
735 |
SV * |
736 |
iow::new () |
737 |
CODE: |
738 |
iow *w = new iow; |
739 |
RETVAL = newSVptr ((void *)w, "urxvt::iow"); |
740 |
w->self = (HV *)SvRV (RETVAL); |
741 |
OUTPUT: |
742 |
RETVAL |
743 |
|
744 |
iow * |
745 |
iow::cb (SV *cb) |
746 |
CODE: |
747 |
THIS->cb (cb); |
748 |
RETVAL = THIS; |
749 |
OUTPUT: |
750 |
RETVAL |
751 |
|
752 |
iow * |
753 |
iow::fd (int fd) |
754 |
CODE: |
755 |
THIS->fd = fd; |
756 |
RETVAL = THIS; |
757 |
OUTPUT: |
758 |
RETVAL |
759 |
|
760 |
iow * |
761 |
iow::events (short events) |
762 |
CODE: |
763 |
THIS->events = events; |
764 |
RETVAL = THIS; |
765 |
OUTPUT: |
766 |
RETVAL |
767 |
|
768 |
iow * |
769 |
iow::start () |
770 |
CODE: |
771 |
THIS->start (); |
772 |
RETVAL = THIS; |
773 |
OUTPUT: |
774 |
RETVAL |
775 |
|
776 |
iow * |
777 |
iow::stop () |
778 |
CODE: |
779 |
THIS->stop (); |
780 |
RETVAL = THIS; |
781 |
OUTPUT: |
782 |
RETVAL |
783 |
|
784 |
void |
785 |
iow::DESTROY () |
786 |
|
787 |
|