… | |
… | |
345 | RETVAL |
345 | RETVAL |
346 | |
346 | |
347 | MODULE = urxvt PACKAGE = urxvt::term |
347 | MODULE = urxvt PACKAGE = urxvt::term |
348 | |
348 | |
349 | void |
349 | void |
|
|
350 | rxvt_term::_resource (char *name, int index, SV *newval = 0) |
|
|
351 | PPCODE: |
|
|
352 | { |
|
|
353 | struct resval { const char *name; int value; } rslist [] = { |
|
|
354 | # define Rs_def(name) { # name, Rs_ ## name }, |
|
|
355 | # define Rs_reserve(name,count) |
|
|
356 | # include "rsinc.h" |
|
|
357 | # undef Rs_def |
|
|
358 | # undef Rs_reserve |
|
|
359 | }; |
|
|
360 | |
|
|
361 | struct resval *rs = rslist + sizeof (rslist) / sizeof (rslist [0]); |
|
|
362 | |
|
|
363 | do { |
|
|
364 | if (rs-- == rslist) |
|
|
365 | croak ("no such resource '%s', requested", name); |
|
|
366 | } while (strcmp (name, rs->name)); |
|
|
367 | |
|
|
368 | index += rs->value; |
|
|
369 | |
|
|
370 | if (!IN_RANGE_EXC (index, 0, NUM_RESOURCES)) |
|
|
371 | croak ("requested out-of-bound resource %s+%d,", name, index - rs->value); |
|
|
372 | |
|
|
373 | if (GIMME_V != G_VOID) |
|
|
374 | XPUSHs (THIS->rs [index] ? sv_2mortal (newSVpv (THIS->rs [index], 0)) : &PL_sv_undef); |
|
|
375 | |
|
|
376 | if (newval) |
|
|
377 | { |
|
|
378 | if (SvOK (newval)) |
|
|
379 | { |
|
|
380 | char *str = strdup (SvPVbyte_nolen (newval)); |
|
|
381 | THIS->rs [index] = str; |
|
|
382 | THIS->allocated.push_back (str); |
|
|
383 | } |
|
|
384 | else |
|
|
385 | THIS->rs [index] = 0; |
|
|
386 | } |
|
|
387 | } |
|
|
388 | |
|
|
389 | void |
350 | rxvt_term::selection_mark (...) |
390 | rxvt_term::selection_mark (...) |
351 | PROTOTYPE: $;$$ |
391 | PROTOTYPE: $;$$ |
352 | ALIAS: |
392 | ALIAS: |
353 | selection_beg = 1 |
393 | selection_beg = 1 |
354 | selection_end = 2 |
394 | selection_end = 2 |