1 |
root |
1.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 |
root |
1.8 |
#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 |
root |
1.1 |
///////////////////////////////////////////////////////////////////////////// |
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 |
root |
1.25 |
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 |
root |
1.1 |
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 |
root |
1.18 |
sv_magic ((SV *)hv, 0, PERL_MAGIC_ext, (char *)ptr, 0); |
79 |
root |
1.1 |
return sv_bless (newRV_noinc ((SV *)hv), gv_stashpv (klass, 1)); |
80 |
|
|
} |
81 |
|
|
|
82 |
root |
1.18 |
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 |
root |
1.1 |
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 |
root |
1.18 |
MAGIC *mg = mg_find (SvRV (sv), PERL_MAGIC_ext); |
99 |
root |
1.1 |
|
100 |
root |
1.18 |
if (!mg) |
101 |
root |
1.1 |
croak ("perl code used %s object, but C++ object is already destroyed, caught", klass); |
102 |
|
|
|
103 |
root |
1.18 |
return (long)mg->mg_ptr; |
104 |
root |
1.1 |
} |
105 |
|
|
|
106 |
|
|
#define newSVterm(term) SvREFCNT_inc ((SV *)term->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 |
root |
1.13 |
tstamp interval; |
167 |
|
|
|
168 |
root |
1.1 |
timer () |
169 |
|
|
: time_watcher (this, &timer::execute) |
170 |
|
|
{ |
171 |
|
|
} |
172 |
|
|
|
173 |
|
|
void execute (time_watcher &w) |
174 |
|
|
{ |
175 |
root |
1.13 |
if (interval) |
176 |
|
|
start (at + interval); |
177 |
|
|
|
178 |
root |
1.1 |
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 |
root |
1.13 |
#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 |
root |
1.18 |
void show (); |
214 |
|
|
void hide (); |
215 |
|
|
|
216 |
root |
1.13 |
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 |
root |
1.24 |
|
233 |
root |
1.13 |
for (int y = 0; y < h; y++) |
234 |
root |
1.24 |
{ |
235 |
root |
1.13 |
text_t *tp = text[y] = new text_t[w]; |
236 |
|
|
rend_t *rp = rend[y] = new rend_t[w]; |
237 |
root |
1.24 |
|
238 |
root |
1.13 |
text_t t0, t1, t2; |
239 |
|
|
rend_t r = rstyle; |
240 |
root |
1.24 |
|
241 |
root |
1.13 |
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 |
root |
1.24 |
|
250 |
|
|
*tp++ = t0; |
251 |
root |
1.13 |
*rp++ = r; |
252 |
root |
1.24 |
|
253 |
root |
1.13 |
for (int x = w - 2; x-- > 0; ) |
254 |
|
|
{ |
255 |
|
|
*tp++ = t1; |
256 |
|
|
*rp++ = r; |
257 |
root |
1.24 |
} |
258 |
root |
1.13 |
|
259 |
|
|
*tp = t2; |
260 |
root |
1.24 |
*rp = r; |
261 |
root |
1.13 |
} |
262 |
|
|
else |
263 |
|
|
for (int x = w; x-- > 0; ) |
264 |
|
|
{ |
265 |
|
|
*tp++ = 0x0020; |
266 |
|
|
*rp++ = r; |
267 |
root |
1.24 |
} |
268 |
|
|
} |
269 |
root |
1.13 |
|
270 |
root |
1.18 |
show (); |
271 |
root |
1.13 |
THIS->want_refresh = 1; |
272 |
|
|
} |
273 |
|
|
|
274 |
|
|
overlay::~overlay () |
275 |
|
|
{ |
276 |
root |
1.18 |
hide (); |
277 |
|
|
|
278 |
root |
1.13 |
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 |
root |
1.18 |
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 |
root |
1.13 |
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 |
root |
1.24 |
|
326 |
root |
1.13 |
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 |
root |
1.24 |
{ |
331 |
root |
1.13 |
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 |
root |
1.14 |
void overlay::set (int x, int y, SV *text, SV *rend) |
339 |
root |
1.13 |
{ |
340 |
|
|
x += border; |
341 |
|
|
y += border; |
342 |
|
|
|
343 |
|
|
if (!IN_RANGE_EXC (y, 0, h - border)) |
344 |
|
|
return; |
345 |
|
|
|
346 |
root |
1.14 |
wchar_t *wtext = sv2wcs (text); |
347 |
root |
1.13 |
|
348 |
root |
1.14 |
for (int col = min (wcslen (wtext), w - x - border); col--; ) |
349 |
|
|
this->text [y][x + col] = wtext [col]; |
350 |
root |
1.24 |
|
351 |
root |
1.14 |
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 |
root |
1.13 |
|
364 |
|
|
THIS->want_refresh = 1; |
365 |
|
|
} |
366 |
|
|
|
367 |
|
|
|
368 |
|
|
///////////////////////////////////////////////////////////////////////////// |
369 |
|
|
|
370 |
root |
1.1 |
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 |
root |
1.13 |
if (!perl) |
416 |
root |
1.1 |
return false; |
417 |
root |
1.24 |
|
418 |
root |
1.1 |
if (htype == HOOK_INIT) // first hook ever called |
419 |
root |
1.13 |
{ |
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 |
root |
1.17 |
else if (!term->self) |
424 |
|
|
return false; // perl not initialized for this instance |
425 |
root |
1.13 |
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->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 |
root |
1.1 |
|
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 |
root |
1.6 |
case DT_STRING: |
471 |
|
|
XPUSHs (sv_2mortal (newSVpv (va_arg (ap, char *), 0))); |
472 |
|
|
break; |
473 |
|
|
|
474 |
root |
1.25 |
case DT_USTRING_LEN: |
475 |
|
|
{ |
476 |
|
|
unicode_t *ustr = va_arg (ap, unicode_t *); |
477 |
|
|
int ulen = va_arg (ap, int); |
478 |
|
|
wchar_t *wstr = new wchar_t [ulen]; |
479 |
|
|
|
480 |
|
|
for (int i = ulen; i--; ) |
481 |
|
|
wstr [i] = ustr [i]; |
482 |
|
|
|
483 |
|
|
XPUSHs (sv_2mortal (wcs2sv (wstr, ulen))); |
484 |
|
|
|
485 |
|
|
delete [] wstr; |
486 |
|
|
} |
487 |
|
|
|
488 |
root |
1.1 |
case DT_END: |
489 |
|
|
{ |
490 |
|
|
va_end (ap); |
491 |
|
|
|
492 |
|
|
PUTBACK; |
493 |
|
|
int count = call_pv ("urxvt::invoke", G_ARRAY | G_EVAL); |
494 |
|
|
SPAGAIN; |
495 |
|
|
|
496 |
|
|
if (count) |
497 |
|
|
{ |
498 |
|
|
SV *status = POPs; |
499 |
|
|
count = SvTRUE (status); |
500 |
|
|
} |
501 |
|
|
|
502 |
|
|
PUTBACK; |
503 |
|
|
FREETMPS; |
504 |
|
|
LEAVE; |
505 |
|
|
|
506 |
|
|
if (SvTRUE (ERRSV)) |
507 |
|
|
rxvt_warn ("perl hook %d evaluation error: %s", htype, SvPV_nolen (ERRSV)); |
508 |
|
|
|
509 |
root |
1.4 |
if (htype == HOOK_DESTROY) |
510 |
|
|
{ |
511 |
root |
1.18 |
clearSVptr ((SV *)term->self); |
512 |
root |
1.4 |
SvREFCNT_dec ((SV *)term->self); |
513 |
|
|
} |
514 |
|
|
|
515 |
root |
1.1 |
return count; |
516 |
|
|
} |
517 |
|
|
|
518 |
|
|
default: |
519 |
|
|
rxvt_fatal ("FATAL: unable to pass data type %d\n", dt); |
520 |
|
|
} |
521 |
|
|
} |
522 |
|
|
} |
523 |
|
|
|
524 |
|
|
///////////////////////////////////////////////////////////////////////////// |
525 |
|
|
|
526 |
|
|
MODULE = urxvt PACKAGE = urxvt |
527 |
|
|
|
528 |
|
|
PROTOTYPES: ENABLE |
529 |
|
|
|
530 |
|
|
BOOT: |
531 |
|
|
{ |
532 |
root |
1.22 |
# define export_const(name) newCONSTSUB (gv_stashpv ("urxvt", 1), # name, newSViv (name)); |
533 |
root |
1.1 |
AV *hookname = get_av ("urxvt::HOOKNAME", 1); |
534 |
root |
1.21 |
# define def(sym) av_store (hookname, HOOK_ ## sym, newSVpv (# sym, 0)); |
535 |
|
|
# include "hookinc.h" |
536 |
|
|
# undef def |
537 |
root |
1.1 |
|
538 |
root |
1.11 |
export_const (DEFAULT_RSTYLE); |
539 |
|
|
export_const (OVERLAY_RSTYLE); |
540 |
|
|
export_const (RS_Bold); |
541 |
|
|
export_const (RS_Italic); |
542 |
|
|
export_const (RS_Blink); |
543 |
|
|
export_const (RS_RVid); |
544 |
|
|
export_const (RS_Uline); |
545 |
root |
1.9 |
|
546 |
root |
1.1 |
sv_setpv (get_sv ("urxvt::LIBDIR", 1), LIBDIR); |
547 |
|
|
} |
548 |
|
|
|
549 |
|
|
void |
550 |
|
|
set_should_invoke (int htype, int value) |
551 |
|
|
CODE: |
552 |
|
|
rxvt_perl.should_invoke [htype] = value; |
553 |
|
|
|
554 |
|
|
void |
555 |
|
|
warn (const char *msg) |
556 |
|
|
CODE: |
557 |
|
|
rxvt_warn ("%s", msg); |
558 |
|
|
|
559 |
|
|
void |
560 |
|
|
fatal (const char *msg) |
561 |
|
|
CODE: |
562 |
|
|
rxvt_fatal ("%s", msg); |
563 |
|
|
|
564 |
root |
1.3 |
NV |
565 |
|
|
NOW () |
566 |
|
|
CODE: |
567 |
|
|
RETVAL = NOW; |
568 |
|
|
OUTPUT: |
569 |
|
|
RETVAL |
570 |
|
|
|
571 |
root |
1.11 |
int |
572 |
|
|
GET_BASEFG (int rend) |
573 |
|
|
CODE: |
574 |
|
|
RETVAL = GET_BASEFG (rend); |
575 |
|
|
OUTPUT: |
576 |
|
|
RETVAL |
577 |
|
|
|
578 |
|
|
int |
579 |
|
|
GET_BASEBG (int rend) |
580 |
|
|
CODE: |
581 |
|
|
RETVAL = GET_BASEBG (rend); |
582 |
|
|
OUTPUT: |
583 |
|
|
RETVAL |
584 |
|
|
|
585 |
|
|
int |
586 |
root |
1.12 |
SET_FGCOLOR (int rend, int new_color) |
587 |
root |
1.11 |
CODE: |
588 |
root |
1.12 |
RETVAL = SET_FGCOLOR (rend, new_color); |
589 |
root |
1.11 |
OUTPUT: |
590 |
|
|
RETVAL |
591 |
|
|
|
592 |
|
|
int |
593 |
root |
1.12 |
SET_BGCOLOR (int rend, int new_color) |
594 |
root |
1.11 |
CODE: |
595 |
root |
1.12 |
RETVAL = SET_BGCOLOR (rend, new_color); |
596 |
|
|
OUTPUT: |
597 |
|
|
RETVAL |
598 |
|
|
|
599 |
|
|
int |
600 |
|
|
GET_CUSTOM (int rend) |
601 |
|
|
CODE: |
602 |
|
|
RETVAL = (rend && RS_customMask) >> RS_customShift; |
603 |
|
|
OUTPUT: |
604 |
|
|
RETVAL |
605 |
|
|
|
606 |
|
|
int |
607 |
|
|
SET_CUSTOM (int rend, int new_value) |
608 |
|
|
CODE: |
609 |
|
|
{ |
610 |
|
|
if (!IN_RANGE_EXC (new_value, 0, RS_customCount)) |
611 |
|
|
croak ("custom value out of range, must be 0..%d", RS_customCount - 1); |
612 |
|
|
|
613 |
|
|
RETVAL = (rend & ~RS_customMask) |
614 |
|
|
| ((new_value << RS_customShift) & RS_customMask); |
615 |
|
|
} |
616 |
root |
1.11 |
OUTPUT: |
617 |
|
|
RETVAL |
618 |
|
|
|
619 |
root |
1.3 |
MODULE = urxvt PACKAGE = urxvt::term |
620 |
|
|
|
621 |
root |
1.1 |
int |
622 |
root |
1.3 |
rxvt_term::strwidth (SV *str) |
623 |
root |
1.1 |
CODE: |
624 |
|
|
{ |
625 |
|
|
wchar_t *wstr = sv2wcs (str); |
626 |
root |
1.3 |
|
627 |
|
|
rxvt_push_locale (THIS->locale); |
628 |
root |
1.1 |
RETVAL = wcswidth (wstr, wcslen (wstr)); |
629 |
root |
1.3 |
rxvt_pop_locale (); |
630 |
|
|
|
631 |
root |
1.1 |
free (wstr); |
632 |
|
|
} |
633 |
|
|
OUTPUT: |
634 |
|
|
RETVAL |
635 |
|
|
|
636 |
root |
1.3 |
SV * |
637 |
|
|
rxvt_term::locale_encode (SV *str) |
638 |
root |
1.1 |
CODE: |
639 |
root |
1.3 |
{ |
640 |
|
|
wchar_t *wstr = sv2wcs (str); |
641 |
|
|
|
642 |
|
|
rxvt_push_locale (THIS->locale); |
643 |
|
|
char *mbstr = rxvt_wcstombs (wstr); |
644 |
|
|
rxvt_pop_locale (); |
645 |
|
|
|
646 |
|
|
free (wstr); |
647 |
|
|
|
648 |
|
|
RETVAL = newSVpv (mbstr, 0); |
649 |
|
|
free (mbstr); |
650 |
|
|
} |
651 |
|
|
OUTPUT: |
652 |
root |
1.1 |
RETVAL |
653 |
|
|
|
654 |
root |
1.3 |
SV * |
655 |
|
|
rxvt_term::locale_decode (SV *octets) |
656 |
|
|
CODE: |
657 |
|
|
{ |
658 |
|
|
STRLEN len; |
659 |
|
|
char *data = SvPVbyte (octets, len); |
660 |
|
|
|
661 |
|
|
rxvt_push_locale (THIS->locale); |
662 |
|
|
wchar_t *wstr = rxvt_mbstowcs (data, len); |
663 |
|
|
rxvt_pop_locale (); |
664 |
|
|
|
665 |
root |
1.25 |
RETVAL = wcs2sv (wstr); |
666 |
root |
1.3 |
free (wstr); |
667 |
|
|
} |
668 |
|
|
OUTPUT: |
669 |
|
|
RETVAL |
670 |
root |
1.1 |
|
671 |
root |
1.24 |
# very portable, especially on objects as opposed to pods |
672 |
|
|
#define TERM_OFFSET(sym) (((char *)&((TermWin_t *)0)->sym) - (char *)(TermWin_t *)0) |
673 |
|
|
|
674 |
|
|
#define TERM_OFFSET_width TERM_OFFSET(width) |
675 |
|
|
#define TERM_OFFSET_height TERM_OFFSET(height) |
676 |
|
|
#define TERM_OFFSET_fwidth TERM_OFFSET(fwidth) |
677 |
|
|
#define TERM_OFFSET_fheight TERM_OFFSET(fheight) |
678 |
|
|
#define TERM_OFFSET_fbase TERM_OFFSET(fbase) |
679 |
|
|
#define TERM_OFFSET_nrow TERM_OFFSET(nrow) |
680 |
|
|
#define TERM_OFFSET_ncol TERM_OFFSET(ncol) |
681 |
|
|
#define TERM_OFFSET_focus TERM_OFFSET(focus) |
682 |
|
|
#define TERM_OFFSET_mapped TERM_OFFSET(mapped) |
683 |
|
|
#define TERM_OFFSET_saveLines TERM_OFFSET(saveLines) |
684 |
|
|
#define TERM_OFFSET_total_rows TERM_OFFSET(total_rows) |
685 |
|
|
#define TERM_OFFSET_nsaved TERM_OFFSET(nsaved) |
686 |
|
|
|
687 |
|
|
int |
688 |
|
|
rxvt_term::width () |
689 |
|
|
ALIAS: |
690 |
|
|
width = TERM_OFFSET_width |
691 |
|
|
height = TERM_OFFSET_height |
692 |
|
|
fwidth = TERM_OFFSET_fwidth |
693 |
|
|
fheight = TERM_OFFSET_fheight |
694 |
|
|
fbase = TERM_OFFSET_fbase |
695 |
|
|
nrow = TERM_OFFSET_nrow |
696 |
|
|
ncol = TERM_OFFSET_ncol |
697 |
|
|
focus = TERM_OFFSET_focus |
698 |
|
|
mapped = TERM_OFFSET_mapped |
699 |
|
|
saveLines = TERM_OFFSET_saveLines |
700 |
|
|
total_rows = TERM_OFFSET_total_rows |
701 |
|
|
nsaved = TERM_OFFSET_nsaved |
702 |
|
|
CODE: |
703 |
|
|
RETVAL = *(int *)((char *)THIS + ix); |
704 |
|
|
OUTPUT: |
705 |
|
|
RETVAL |
706 |
|
|
|
707 |
|
|
U32 |
708 |
root |
1.25 |
rxvt_term::rstyle (U32 new_rstyle = THIS->rstyle) |
709 |
root |
1.7 |
CODE: |
710 |
root |
1.24 |
{ |
711 |
root |
1.25 |
RETVAL = THIS->rstyle; |
712 |
|
|
THIS->rstyle = new_rstyle; |
713 |
root |
1.24 |
} |
714 |
root |
1.7 |
OUTPUT: |
715 |
root |
1.24 |
RETVAL |
716 |
root |
1.7 |
|
717 |
|
|
int |
718 |
|
|
rxvt_term::view_start (int newval = -1) |
719 |
|
|
CODE: |
720 |
|
|
{ |
721 |
|
|
RETVAL = THIS->view_start; |
722 |
|
|
|
723 |
|
|
if (newval >= 0) |
724 |
|
|
{ |
725 |
|
|
THIS->view_start = min (newval, THIS->nsaved); |
726 |
|
|
THIS->scr_changeview (RETVAL); |
727 |
|
|
} |
728 |
|
|
} |
729 |
|
|
OUTPUT: |
730 |
|
|
RETVAL |
731 |
|
|
|
732 |
root |
1.8 |
void |
733 |
root |
1.9 |
rxvt_term::want_refresh () |
734 |
|
|
CODE: |
735 |
|
|
THIS->want_refresh = 1; |
736 |
|
|
|
737 |
|
|
void |
738 |
root |
1.27 |
rxvt_term::ROW_t (int row_number, SV *new_text = 0, int start_col = 0, int start_ofs = 0, int max_len = MAX_COLS) |
739 |
root |
1.8 |
PPCODE: |
740 |
|
|
{ |
741 |
|
|
if (!IN_RANGE_EXC (row_number, -THIS->nsaved, THIS->nrow)) |
742 |
root |
1.19 |
XSRETURN_EMPTY; |
743 |
root |
1.8 |
|
744 |
|
|
line_t &l = ROW(row_number); |
745 |
|
|
|
746 |
|
|
if (GIMME_V != G_VOID) |
747 |
|
|
{ |
748 |
|
|
wchar_t *wstr = new wchar_t [THIS->ncol]; |
749 |
|
|
|
750 |
|
|
for (int col = 0; col <THIS->ncol; col++) |
751 |
|
|
wstr [col] = l.t [col]; |
752 |
|
|
|
753 |
root |
1.25 |
XPUSHs (sv_2mortal (wcs2sv (wstr))); |
754 |
root |
1.8 |
|
755 |
root |
1.25 |
delete [] wstr; |
756 |
root |
1.8 |
} |
757 |
|
|
|
758 |
|
|
if (new_text) |
759 |
|
|
{ |
760 |
root |
1.13 |
wchar_t *wstr = sv2wcs (new_text); |
761 |
root |
1.8 |
|
762 |
root |
1.27 |
int len = min (wcslen (wstr) - start_ofs, max_len); |
763 |
root |
1.8 |
|
764 |
root |
1.10 |
if (!IN_RANGE_INC (start_col, 0, THIS->ncol - len)) |
765 |
root |
1.8 |
{ |
766 |
|
|
free (wstr); |
767 |
root |
1.10 |
croak ("new_text extends beyond horizontal margins"); |
768 |
root |
1.8 |
} |
769 |
|
|
|
770 |
|
|
for (int col = start_col; col < start_col + len; col++) |
771 |
|
|
{ |
772 |
root |
1.27 |
l.t [col] = wstr [start_ofs + col - start_col]; |
773 |
root |
1.8 |
l.r [col] = SET_FONT (l.r [col], THIS->fontset [GET_STYLE (l.r [col])]->find_font (l.t [col])); |
774 |
|
|
} |
775 |
root |
1.9 |
|
776 |
|
|
free (wstr); |
777 |
root |
1.8 |
} |
778 |
|
|
} |
779 |
|
|
|
780 |
|
|
void |
781 |
root |
1.27 |
rxvt_term::ROW_r (int row_number, SV *new_rend = 0, int start_col = 0, int start_ofs = 0, int max_len = MAX_COLS) |
782 |
root |
1.8 |
PPCODE: |
783 |
|
|
{ |
784 |
|
|
if (!IN_RANGE_EXC (row_number, -THIS->nsaved, THIS->nrow)) |
785 |
root |
1.19 |
XSRETURN_EMPTY; |
786 |
root |
1.8 |
|
787 |
|
|
line_t &l = ROW(row_number); |
788 |
|
|
|
789 |
|
|
if (GIMME_V != G_VOID) |
790 |
|
|
{ |
791 |
|
|
AV *av = newAV (); |
792 |
|
|
|
793 |
|
|
av_extend (av, THIS->ncol - 1); |
794 |
|
|
for (int col = 0; col < THIS->ncol; col++) |
795 |
|
|
av_store (av, col, newSViv (l.r [col])); |
796 |
|
|
|
797 |
|
|
XPUSHs (sv_2mortal (newRV_noinc ((SV *)av))); |
798 |
|
|
} |
799 |
|
|
|
800 |
|
|
if (new_rend) |
801 |
|
|
{ |
802 |
|
|
if (!SvROK (new_rend) || SvTYPE (SvRV (new_rend)) != SVt_PVAV) |
803 |
|
|
croak ("new_rend must be arrayref"); |
804 |
|
|
|
805 |
|
|
AV *av = (AV *)SvRV (new_rend); |
806 |
root |
1.27 |
int len = min (av_len (av) + 1 - start_ofs, max_len); |
807 |
root |
1.8 |
|
808 |
root |
1.10 |
if (!IN_RANGE_INC (start_col, 0, THIS->ncol - len)) |
809 |
|
|
croak ("new_rend array extends beyond horizontal margins"); |
810 |
root |
1.8 |
|
811 |
|
|
for (int col = start_col; col < start_col + len; col++) |
812 |
|
|
{ |
813 |
root |
1.27 |
rend_t r = SvIV (*av_fetch (av, start_ofs + col - start_col, 1)) & ~RS_fontMask; |
814 |
root |
1.8 |
|
815 |
|
|
l.r [col] = SET_FONT (r, THIS->fontset [GET_STYLE (r)]->find_font (l.t [col])); |
816 |
|
|
} |
817 |
|
|
} |
818 |
|
|
} |
819 |
|
|
|
820 |
|
|
int |
821 |
root |
1.26 |
rxvt_term::ROW_l (int row_number, int new_length = -1) |
822 |
root |
1.8 |
CODE: |
823 |
|
|
{ |
824 |
|
|
if (!IN_RANGE_EXC (row_number, -THIS->nsaved, THIS->nrow)) |
825 |
root |
1.19 |
XSRETURN_EMPTY; |
826 |
root |
1.8 |
|
827 |
|
|
line_t &l = ROW(row_number); |
828 |
root |
1.26 |
RETVAL = l.l; |
829 |
root |
1.8 |
|
830 |
root |
1.26 |
if (new_length >= 0) |
831 |
root |
1.8 |
l.l = new_length; |
832 |
|
|
} |
833 |
|
|
OUTPUT: |
834 |
|
|
RETVAL |
835 |
|
|
|
836 |
root |
1.19 |
bool |
837 |
root |
1.26 |
rxvt_term::ROW_is_longer (int row_number, int new_is_longer = -1) |
838 |
root |
1.19 |
CODE: |
839 |
|
|
{ |
840 |
|
|
if (!IN_RANGE_EXC (row_number, -THIS->nsaved, THIS->nrow)) |
841 |
|
|
XSRETURN_EMPTY; |
842 |
|
|
|
843 |
|
|
line_t &l = ROW(row_number); |
844 |
root |
1.26 |
RETVAL = l.is_longer (); |
845 |
|
|
|
846 |
|
|
if (new_is_longer >= 0) |
847 |
|
|
l.is_longer (new_is_longer); |
848 |
root |
1.19 |
} |
849 |
|
|
OUTPUT: |
850 |
|
|
RETVAL |
851 |
|
|
|
852 |
root |
1.8 |
SV * |
853 |
|
|
rxvt_term::special_encode (SV *str) |
854 |
|
|
CODE: |
855 |
|
|
abort ();//TODO |
856 |
|
|
|
857 |
|
|
SV * |
858 |
|
|
rxvt_term::special_decode (SV *str) |
859 |
|
|
CODE: |
860 |
|
|
abort ();//TODO |
861 |
|
|
|
862 |
root |
1.1 |
void |
863 |
root |
1.2 |
rxvt_term::_resource (char *name, int index, SV *newval = 0) |
864 |
|
|
PPCODE: |
865 |
|
|
{ |
866 |
|
|
struct resval { const char *name; int value; } rslist [] = { |
867 |
root |
1.21 |
# define def(name) { # name, Rs_ ## name }, |
868 |
|
|
# define reserve(name,count) |
869 |
root |
1.2 |
# include "rsinc.h" |
870 |
root |
1.21 |
# undef def |
871 |
|
|
# undef reserve |
872 |
root |
1.2 |
}; |
873 |
|
|
|
874 |
|
|
struct resval *rs = rslist + sizeof (rslist) / sizeof (rslist [0]); |
875 |
|
|
|
876 |
|
|
do { |
877 |
|
|
if (rs-- == rslist) |
878 |
|
|
croak ("no such resource '%s', requested", name); |
879 |
|
|
} while (strcmp (name, rs->name)); |
880 |
|
|
|
881 |
|
|
index += rs->value; |
882 |
|
|
|
883 |
|
|
if (!IN_RANGE_EXC (index, 0, NUM_RESOURCES)) |
884 |
|
|
croak ("requested out-of-bound resource %s+%d,", name, index - rs->value); |
885 |
|
|
|
886 |
|
|
if (GIMME_V != G_VOID) |
887 |
|
|
XPUSHs (THIS->rs [index] ? sv_2mortal (newSVpv (THIS->rs [index], 0)) : &PL_sv_undef); |
888 |
|
|
|
889 |
|
|
if (newval) |
890 |
|
|
{ |
891 |
|
|
if (SvOK (newval)) |
892 |
|
|
{ |
893 |
|
|
char *str = strdup (SvPVbyte_nolen (newval)); |
894 |
|
|
THIS->rs [index] = str; |
895 |
|
|
THIS->allocated.push_back (str); |
896 |
|
|
} |
897 |
|
|
else |
898 |
|
|
THIS->rs [index] = 0; |
899 |
|
|
} |
900 |
|
|
} |
901 |
|
|
|
902 |
|
|
void |
903 |
root |
1.24 |
rxvt_term::cur (...) |
904 |
root |
1.1 |
PROTOTYPE: $;$$ |
905 |
|
|
ALIAS: |
906 |
root |
1.24 |
screen_cur = 0 |
907 |
|
|
selection_beg = 1 |
908 |
|
|
selection_end = 2 |
909 |
|
|
selection_mark = 3 |
910 |
root |
1.1 |
PPCODE: |
911 |
|
|
{ |
912 |
root |
1.24 |
row_col_t &rc = ix == 0 ? THIS->screen.cur |
913 |
|
|
: ix == 1 ? THIS->selection.beg |
914 |
|
|
: ix == 2 ? THIS->selection.end |
915 |
|
|
: THIS->selection.mark; |
916 |
root |
1.1 |
|
917 |
|
|
if (GIMME_V != G_VOID) |
918 |
|
|
{ |
919 |
|
|
EXTEND (SP, 2); |
920 |
root |
1.24 |
PUSHs (sv_2mortal (newSViv (rc.row))); |
921 |
|
|
PUSHs (sv_2mortal (newSViv (rc.col))); |
922 |
root |
1.1 |
} |
923 |
|
|
|
924 |
|
|
if (items == 3) |
925 |
|
|
{ |
926 |
root |
1.24 |
rc.row = clamp (SvIV (ST (1)), -THIS->nsaved, THIS->nrow - 1); |
927 |
|
|
rc.col = clamp (SvIV (ST (2)), 0, THIS->ncol - 1); |
928 |
root |
1.1 |
|
929 |
|
|
if (ix) |
930 |
|
|
THIS->want_refresh = 1; |
931 |
|
|
} |
932 |
|
|
} |
933 |
|
|
|
934 |
|
|
int |
935 |
root |
1.15 |
rxvt_term::selection_grab (int eventtime = CurrentTime) |
936 |
root |
1.1 |
|
937 |
|
|
void |
938 |
|
|
rxvt_term::selection (SV *newtext = 0) |
939 |
|
|
PPCODE: |
940 |
|
|
{ |
941 |
|
|
if (GIMME_V != G_VOID) |
942 |
root |
1.25 |
XPUSHs (sv_2mortal (wcs2sv (THIS->selection.text, THIS->selection.len))); |
943 |
root |
1.1 |
|
944 |
|
|
if (newtext) |
945 |
|
|
{ |
946 |
|
|
free (THIS->selection.text); |
947 |
|
|
|
948 |
|
|
THIS->selection.text = sv2wcs (newtext); |
949 |
|
|
THIS->selection.len = wcslen (THIS->selection.text); |
950 |
|
|
} |
951 |
|
|
} |
952 |
root |
1.24 |
|
953 |
root |
1.1 |
void |
954 |
root |
1.25 |
rxvt_term::scr_add_lines (SV *string) |
955 |
|
|
CODE: |
956 |
|
|
{ |
957 |
|
|
wchar_t *wstr = sv2wcs (string); |
958 |
|
|
int wlen = wcslen (wstr); |
959 |
|
|
unicode_t *ustr = new unicode_t [wlen]; |
960 |
|
|
int nlines = 0; |
961 |
|
|
|
962 |
|
|
for (int i = wlen; i--; ) |
963 |
|
|
{ |
964 |
|
|
ustr [i] = wstr [i]; |
965 |
|
|
nlines += ustr [i] == '\012'; |
966 |
|
|
} |
967 |
|
|
|
968 |
|
|
THIS->scr_add_lines (ustr, nlines, wlen); |
969 |
|
|
|
970 |
|
|
free (wstr); |
971 |
|
|
delete [] ustr; |
972 |
|
|
} |
973 |
|
|
|
974 |
|
|
void |
975 |
root |
1.13 |
rxvt_term::tt_write (SV *octets) |
976 |
|
|
INIT: |
977 |
|
|
STRLEN len; |
978 |
|
|
char *str = SvPVbyte (octets, len); |
979 |
|
|
C_ARGS: |
980 |
root |
1.23 |
str, len |
981 |
root |
1.13 |
|
982 |
|
|
SV * |
983 |
|
|
rxvt_term::overlay (int x, int y, int w, int h, int rstyle = OVERLAY_RSTYLE, int border = 2) |
984 |
|
|
CODE: |
985 |
|
|
{ |
986 |
|
|
overlay *o = new overlay (THIS, x, y, w, h, rstyle, border); |
987 |
|
|
RETVAL = newSVptr ((void *)o, "urxvt::overlay"); |
988 |
|
|
o->self = (HV *)SvRV (RETVAL); |
989 |
|
|
} |
990 |
|
|
OUTPUT: |
991 |
|
|
RETVAL |
992 |
|
|
|
993 |
|
|
MODULE = urxvt PACKAGE = urxvt::overlay |
994 |
root |
1.1 |
|
995 |
|
|
void |
996 |
root |
1.13 |
overlay::set (int x, int y, SV *text, SV *rend = 0) |
997 |
root |
1.1 |
|
998 |
|
|
void |
999 |
root |
1.18 |
overlay::show () |
1000 |
|
|
|
1001 |
|
|
void |
1002 |
|
|
overlay::hide () |
1003 |
|
|
|
1004 |
|
|
void |
1005 |
root |
1.13 |
overlay::DESTROY () |
1006 |
root |
1.1 |
|
1007 |
|
|
MODULE = urxvt PACKAGE = urxvt::timer |
1008 |
|
|
|
1009 |
|
|
SV * |
1010 |
|
|
timer::new () |
1011 |
|
|
CODE: |
1012 |
|
|
timer *w = new timer; |
1013 |
root |
1.13 |
w->start (NOW); |
1014 |
root |
1.1 |
RETVAL = newSVptr ((void *)w, "urxvt::timer"); |
1015 |
|
|
w->self = (HV *)SvRV (RETVAL); |
1016 |
|
|
OUTPUT: |
1017 |
|
|
RETVAL |
1018 |
|
|
|
1019 |
|
|
timer * |
1020 |
|
|
timer::cb (SV *cb) |
1021 |
|
|
CODE: |
1022 |
|
|
THIS->cb (cb); |
1023 |
|
|
RETVAL = THIS; |
1024 |
|
|
OUTPUT: |
1025 |
|
|
RETVAL |
1026 |
|
|
|
1027 |
|
|
NV |
1028 |
|
|
timer::at () |
1029 |
|
|
CODE: |
1030 |
|
|
RETVAL = THIS->at; |
1031 |
|
|
OUTPUT: |
1032 |
|
|
RETVAL |
1033 |
|
|
|
1034 |
|
|
timer * |
1035 |
root |
1.13 |
timer::interval (NV interval) |
1036 |
|
|
CODE: |
1037 |
|
|
THIS->interval = interval; |
1038 |
|
|
RETVAL = THIS; |
1039 |
|
|
OUTPUT: |
1040 |
|
|
RETVAL |
1041 |
|
|
|
1042 |
|
|
timer * |
1043 |
root |
1.1 |
timer::set (NV tstamp) |
1044 |
|
|
CODE: |
1045 |
|
|
THIS->set (tstamp); |
1046 |
|
|
RETVAL = THIS; |
1047 |
|
|
OUTPUT: |
1048 |
|
|
RETVAL |
1049 |
|
|
|
1050 |
|
|
timer * |
1051 |
|
|
timer::start (NV tstamp = THIS->at) |
1052 |
|
|
CODE: |
1053 |
|
|
THIS->start (tstamp); |
1054 |
|
|
RETVAL = THIS; |
1055 |
|
|
OUTPUT: |
1056 |
|
|
RETVAL |
1057 |
|
|
|
1058 |
|
|
timer * |
1059 |
|
|
timer::stop () |
1060 |
|
|
CODE: |
1061 |
|
|
THIS->stop (); |
1062 |
|
|
RETVAL = THIS; |
1063 |
|
|
OUTPUT: |
1064 |
|
|
RETVAL |
1065 |
|
|
|
1066 |
|
|
void |
1067 |
|
|
timer::DESTROY () |
1068 |
|
|
|
1069 |
|
|
MODULE = urxvt PACKAGE = urxvt::iow |
1070 |
|
|
|
1071 |
|
|
SV * |
1072 |
|
|
iow::new () |
1073 |
|
|
CODE: |
1074 |
|
|
iow *w = new iow; |
1075 |
|
|
RETVAL = newSVptr ((void *)w, "urxvt::iow"); |
1076 |
|
|
w->self = (HV *)SvRV (RETVAL); |
1077 |
|
|
OUTPUT: |
1078 |
|
|
RETVAL |
1079 |
|
|
|
1080 |
|
|
iow * |
1081 |
|
|
iow::cb (SV *cb) |
1082 |
|
|
CODE: |
1083 |
|
|
THIS->cb (cb); |
1084 |
|
|
RETVAL = THIS; |
1085 |
|
|
OUTPUT: |
1086 |
|
|
RETVAL |
1087 |
|
|
|
1088 |
|
|
iow * |
1089 |
|
|
iow::fd (int fd) |
1090 |
|
|
CODE: |
1091 |
|
|
THIS->fd = fd; |
1092 |
|
|
RETVAL = THIS; |
1093 |
|
|
OUTPUT: |
1094 |
|
|
RETVAL |
1095 |
|
|
|
1096 |
|
|
iow * |
1097 |
|
|
iow::events (short events) |
1098 |
|
|
CODE: |
1099 |
|
|
THIS->events = events; |
1100 |
|
|
RETVAL = THIS; |
1101 |
|
|
OUTPUT: |
1102 |
|
|
RETVAL |
1103 |
|
|
|
1104 |
|
|
iow * |
1105 |
|
|
iow::start () |
1106 |
|
|
CODE: |
1107 |
|
|
THIS->start (); |
1108 |
|
|
RETVAL = THIS; |
1109 |
|
|
OUTPUT: |
1110 |
|
|
RETVAL |
1111 |
|
|
|
1112 |
|
|
iow * |
1113 |
|
|
iow::stop () |
1114 |
|
|
CODE: |
1115 |
|
|
THIS->stop (); |
1116 |
|
|
RETVAL = THIS; |
1117 |
|
|
OUTPUT: |
1118 |
|
|
RETVAL |
1119 |
|
|
|
1120 |
|
|
void |
1121 |
|
|
iow::DESTROY () |
1122 |
|
|
|
1123 |
|
|
|