… | |
… | |
324 | void |
324 | void |
325 | fatal (const char *msg) |
325 | fatal (const char *msg) |
326 | CODE: |
326 | CODE: |
327 | rxvt_fatal ("%s", msg); |
327 | rxvt_fatal ("%s", msg); |
328 | |
328 | |
329 | int |
|
|
330 | wcswidth (SV *str) |
|
|
331 | CODE: |
|
|
332 | { |
|
|
333 | wchar_t *wstr = sv2wcs (str); |
|
|
334 | RETVAL = wcswidth (wstr, wcslen (wstr)); |
|
|
335 | free (wstr); |
|
|
336 | } |
|
|
337 | OUTPUT: |
|
|
338 | RETVAL |
|
|
339 | |
|
|
340 | NV |
329 | NV |
341 | NOW () |
330 | NOW () |
342 | CODE: |
331 | CODE: |
343 | RETVAL = NOW; |
332 | RETVAL = NOW; |
344 | OUTPUT: |
333 | OUTPUT: |
345 | RETVAL |
334 | RETVAL |
346 | |
335 | |
347 | MODULE = urxvt PACKAGE = urxvt::term |
336 | MODULE = urxvt PACKAGE = urxvt::term |
|
|
337 | |
|
|
338 | int |
|
|
339 | rxvt_term::strwidth (SV *str) |
|
|
340 | CODE: |
|
|
341 | { |
|
|
342 | wchar_t *wstr = sv2wcs (str); |
|
|
343 | |
|
|
344 | rxvt_push_locale (THIS->locale); |
|
|
345 | RETVAL = wcswidth (wstr, wcslen (wstr)); |
|
|
346 | rxvt_pop_locale (); |
|
|
347 | |
|
|
348 | free (wstr); |
|
|
349 | } |
|
|
350 | OUTPUT: |
|
|
351 | RETVAL |
|
|
352 | |
|
|
353 | SV * |
|
|
354 | rxvt_term::locale_encode (SV *str) |
|
|
355 | CODE: |
|
|
356 | { |
|
|
357 | wchar_t *wstr = sv2wcs (str); |
|
|
358 | |
|
|
359 | rxvt_push_locale (THIS->locale); |
|
|
360 | char *mbstr = rxvt_wcstombs (wstr); |
|
|
361 | rxvt_pop_locale (); |
|
|
362 | |
|
|
363 | free (wstr); |
|
|
364 | |
|
|
365 | RETVAL = newSVpv (mbstr, 0); |
|
|
366 | free (mbstr); |
|
|
367 | } |
|
|
368 | OUTPUT: |
|
|
369 | RETVAL |
|
|
370 | |
|
|
371 | SV * |
|
|
372 | rxvt_term::locale_decode (SV *octets) |
|
|
373 | CODE: |
|
|
374 | { |
|
|
375 | STRLEN len; |
|
|
376 | char *data = SvPVbyte (octets, len); |
|
|
377 | |
|
|
378 | rxvt_push_locale (THIS->locale); |
|
|
379 | wchar_t *wstr = rxvt_mbstowcs (data, len); |
|
|
380 | rxvt_pop_locale (); |
|
|
381 | |
|
|
382 | char *str = rxvt_wcstoutf8 (wstr); |
|
|
383 | free (wstr); |
|
|
384 | |
|
|
385 | RETVAL = newSVpv (str, 0); |
|
|
386 | SvUTF8_on (RETVAL); |
|
|
387 | free (str); |
|
|
388 | } |
|
|
389 | OUTPUT: |
|
|
390 | RETVAL |
|
|
391 | |
|
|
392 | void |
|
|
393 | rxvt_term::_resource (char *name, int index, SV *newval = 0) |
|
|
394 | PPCODE: |
|
|
395 | { |
|
|
396 | struct resval { const char *name; int value; } rslist [] = { |
|
|
397 | # define Rs_def(name) { # name, Rs_ ## name }, |
|
|
398 | # define Rs_reserve(name,count) |
|
|
399 | # include "rsinc.h" |
|
|
400 | # undef Rs_def |
|
|
401 | # undef Rs_reserve |
|
|
402 | }; |
|
|
403 | |
|
|
404 | struct resval *rs = rslist + sizeof (rslist) / sizeof (rslist [0]); |
|
|
405 | |
|
|
406 | do { |
|
|
407 | if (rs-- == rslist) |
|
|
408 | croak ("no such resource '%s', requested", name); |
|
|
409 | } while (strcmp (name, rs->name)); |
|
|
410 | |
|
|
411 | index += rs->value; |
|
|
412 | |
|
|
413 | if (!IN_RANGE_EXC (index, 0, NUM_RESOURCES)) |
|
|
414 | croak ("requested out-of-bound resource %s+%d,", name, index - rs->value); |
|
|
415 | |
|
|
416 | if (GIMME_V != G_VOID) |
|
|
417 | XPUSHs (THIS->rs [index] ? sv_2mortal (newSVpv (THIS->rs [index], 0)) : &PL_sv_undef); |
|
|
418 | |
|
|
419 | if (newval) |
|
|
420 | { |
|
|
421 | if (SvOK (newval)) |
|
|
422 | { |
|
|
423 | char *str = strdup (SvPVbyte_nolen (newval)); |
|
|
424 | THIS->rs [index] = str; |
|
|
425 | THIS->allocated.push_back (str); |
|
|
426 | } |
|
|
427 | else |
|
|
428 | THIS->rs [index] = 0; |
|
|
429 | } |
|
|
430 | } |
348 | |
431 | |
349 | void |
432 | void |
350 | rxvt_term::selection_mark (...) |
433 | rxvt_term::selection_mark (...) |
351 | PROTOTYPE: $;$$ |
434 | PROTOTYPE: $;$$ |
352 | ALIAS: |
435 | ALIAS: |
… | |
… | |
418 | wchar_t *wtext = sv2wcs (text); |
501 | wchar_t *wtext = sv2wcs (text); |
419 | THIS->scr_overlay_set (x, y, wtext); |
502 | THIS->scr_overlay_set (x, y, wtext); |
420 | free (wtext); |
503 | free (wtext); |
421 | } |
504 | } |
422 | |
505 | |
|
|
506 | void |
|
|
507 | rxvt_term::tt_write (SV *octets) |
|
|
508 | INIT: |
|
|
509 | STRLEN len; |
|
|
510 | char *str = SvPVbyte (octets, len); |
|
|
511 | C_ARGS: |
|
|
512 | (unsigned char *)str, len |
|
|
513 | |
423 | MODULE = urxvt PACKAGE = urxvt::timer |
514 | MODULE = urxvt PACKAGE = urxvt::timer |
424 | |
515 | |
425 | SV * |
516 | SV * |
426 | timer::new () |
517 | timer::new () |
427 | CODE: |
518 | CODE: |