… | |
… | |
26 | #include <XSUB.h> |
26 | #include <XSUB.h> |
27 | #undef line_t |
27 | #undef line_t |
28 | |
28 | |
29 | #include "../config.h" |
29 | #include "../config.h" |
30 | |
30 | |
|
|
31 | #include <cstddef> |
31 | #include <cstdarg> |
32 | #include <cstdarg> |
32 | |
33 | |
|
|
34 | #include "iom.h" |
33 | #include "rxvt.h" |
35 | #include "rxvt.h" |
34 | #include "iom.h" |
36 | #include "keyboard.h" |
35 | #include "rxvtutil.h" |
37 | #include "rxvtutil.h" |
36 | #include "rxvtperl.h" |
38 | #include "rxvtperl.h" |
37 | |
39 | |
38 | #include "perlxsi.c" |
40 | #include "perlxsi.c" |
|
|
41 | |
|
|
42 | #if defined(HAVE_SCROLLBARS) || defined(MENUBAR) |
|
|
43 | # define GRAB_CURSOR THIS->leftptr_cursor |
|
|
44 | #else |
|
|
45 | # define GRAB_CURSOR None |
|
|
46 | #endif |
39 | |
47 | |
40 | #undef LINENO |
48 | #undef LINENO |
41 | #define LINENO(n) MOD (THIS->term_start + int(n), THIS->total_rows) |
49 | #define LINENO(n) MOD (THIS->term_start + int(n), THIS->total_rows) |
42 | #undef ROW |
50 | #undef ROW |
43 | #define ROW(n) THIS->row_buf [LINENO (n)] |
51 | #define ROW(n) THIS->row_buf [LINENO (n)] |
44 | |
52 | |
45 | ///////////////////////////////////////////////////////////////////////////// |
53 | ///////////////////////////////////////////////////////////////////////////// |
|
|
54 | |
|
|
55 | static SV * |
|
|
56 | taint (SV *sv) |
|
|
57 | { |
|
|
58 | SvTAINT (sv); |
|
|
59 | return sv; |
|
|
60 | } |
|
|
61 | |
|
|
62 | static SV * |
|
|
63 | taint_if (SV *sv, SV *src) |
|
|
64 | { |
|
|
65 | if (SvTAINTED (src)) |
|
|
66 | SvTAINT (sv); |
|
|
67 | |
|
|
68 | return sv; |
|
|
69 | } |
46 | |
70 | |
47 | static wchar_t * |
71 | static wchar_t * |
48 | sv2wcs (SV *sv) |
72 | sv2wcs (SV *sv) |
49 | { |
73 | { |
50 | STRLEN len; |
74 | STRLEN len; |
… | |
… | |
389 | { |
413 | { |
390 | if (!perl) |
414 | if (!perl) |
391 | { |
415 | { |
392 | char *argv[] = { |
416 | char *argv[] = { |
393 | "", |
417 | "", |
|
|
418 | "-T", |
394 | "-edo '" LIBDIR "/urxvt.pm' or ($@ and die $@) or exit 1", |
419 | "-edo '" LIBDIR "/urxvt.pm' or ($@ and die $@) or exit 1", |
395 | }; |
420 | }; |
396 | |
421 | |
397 | perl = perl_alloc (); |
422 | perl = perl_alloc (); |
398 | perl_construct (perl); |
423 | perl_construct (perl); |
399 | |
424 | |
400 | if (perl_parse (perl, xs_init, 2, argv, (char **)NULL) |
425 | if (perl_parse (perl, xs_init, 3, argv, (char **)NULL) |
401 | || perl_run (perl)) |
426 | || perl_run (perl)) |
402 | { |
427 | { |
403 | rxvt_warn ("unable to initialize perl-interpreter, continuing without.\n"); |
428 | rxvt_warn ("unable to initialize perl-interpreter, continuing without.\n"); |
404 | |
429 | |
405 | perl_destruct (perl); |
430 | perl_destruct (perl); |
406 | perl_free (perl); |
431 | perl_free (perl); |
407 | perl = 0; |
432 | perl = 0; |
408 | } |
433 | } |
|
|
434 | } |
|
|
435 | } |
|
|
436 | |
|
|
437 | static void |
|
|
438 | ungrab (rxvt_term *THIS) |
|
|
439 | { |
|
|
440 | if (THIS->perl.grabtime) |
|
|
441 | { |
|
|
442 | XUngrabKeyboard (THIS->display->display, THIS->perl.grabtime); |
|
|
443 | XUngrabPointer (THIS->display->display, THIS->perl.grabtime); |
|
|
444 | THIS->perl.grabtime = 0; |
409 | } |
445 | } |
410 | } |
446 | } |
411 | |
447 | |
412 | bool |
448 | bool |
413 | rxvt_perl_interp::invoke (rxvt_term *term, hook_type htype, ...) |
449 | rxvt_perl_interp::invoke (rxvt_term *term, hook_type htype, ...) |
… | |
… | |
424 | return false; // perl not initialized for this instance |
460 | return false; // perl not initialized for this instance |
425 | else if (htype == HOOK_DESTROY) |
461 | else if (htype == HOOK_DESTROY) |
426 | { |
462 | { |
427 | // handled later |
463 | // handled later |
428 | } |
464 | } |
429 | else if (htype == HOOK_REFRESH_BEGIN || htype == HOOK_REFRESH_END) |
465 | else |
430 | { |
466 | { |
431 | HV *hv = (HV *)SvRV (*hv_fetch ((HV *)SvRV ((SV *)term->perl.self), "_overlay", 8, 0)); |
467 | if (htype == HOOK_REFRESH_BEGIN || htype == HOOK_REFRESH_END) |
432 | |
|
|
433 | if (HvKEYS (hv)) |
|
|
434 | { |
468 | { |
|
|
469 | HV *hv = (HV *)SvRV (*hv_fetch ((HV *)SvRV ((SV *)term->perl.self), "_overlay", 8, 0)); |
|
|
470 | |
|
|
471 | if (HvKEYS (hv)) |
|
|
472 | { |
435 | hv_iterinit (hv); |
473 | hv_iterinit (hv); |
436 | |
474 | |
437 | while (HE *he = hv_iternext (hv)) |
475 | while (HE *he = hv_iternext (hv)) |
438 | ((overlay *)SvIV (hv_iterval (hv, he)))->swap (); |
476 | ((overlay *)SvIV (hv_iterval (hv, he)))->swap (); |
|
|
477 | } |
|
|
478 | |
439 | } |
479 | } |
|
|
480 | |
|
|
481 | if (!should_invoke [htype]) |
|
|
482 | return false; |
440 | } |
483 | } |
441 | else if (!should_invoke [htype]) |
|
|
442 | return false; |
|
|
443 | |
484 | |
444 | dSP; |
485 | dSP; |
445 | va_list ap; |
486 | va_list ap; |
446 | |
487 | |
447 | va_start (ap, htype); |
488 | va_start (ap, htype); |
… | |
… | |
466 | case DT_LONG: |
507 | case DT_LONG: |
467 | XPUSHs (sv_2mortal (newSViv (va_arg (ap, long)))); |
508 | XPUSHs (sv_2mortal (newSViv (va_arg (ap, long)))); |
468 | break; |
509 | break; |
469 | |
510 | |
470 | case DT_STR: |
511 | case DT_STR: |
471 | XPUSHs (sv_2mortal (newSVpv (va_arg (ap, char *), 0))); |
512 | XPUSHs (taint (sv_2mortal (newSVpv (va_arg (ap, char *), 0)))); |
472 | break; |
513 | break; |
473 | |
514 | |
474 | case DT_STR_LEN: |
515 | case DT_STR_LEN: |
475 | { |
516 | { |
476 | char *str = va_arg (ap, char *); |
517 | char *str = va_arg (ap, char *); |
477 | int len = va_arg (ap, int); |
518 | int len = va_arg (ap, int); |
478 | |
519 | |
479 | XPUSHs (sv_2mortal (newSVpvn (str, len))); |
520 | XPUSHs (taint (sv_2mortal (newSVpvn (str, len)))); |
480 | } |
521 | } |
481 | break; |
522 | break; |
482 | |
523 | |
483 | case DT_WCS_LEN: |
524 | case DT_WCS_LEN: |
484 | { |
525 | { |
485 | wchar_t *wstr = va_arg (ap, wchar_t *); |
526 | wchar_t *wstr = va_arg (ap, wchar_t *); |
486 | int wlen = va_arg (ap, int); |
527 | int wlen = va_arg (ap, int); |
487 | |
528 | |
488 | XPUSHs (sv_2mortal (wcs2sv (wstr, wlen))); |
529 | XPUSHs (taint (sv_2mortal (wcs2sv (wstr, wlen)))); |
489 | } |
530 | } |
490 | break; |
531 | break; |
491 | |
532 | |
492 | case DT_XEVENT: |
533 | case DT_XEVENT: |
493 | { |
534 | { |
… | |
… | |
558 | PUTBACK; |
599 | PUTBACK; |
559 | FREETMPS; |
600 | FREETMPS; |
560 | LEAVE; |
601 | LEAVE; |
561 | |
602 | |
562 | if (SvTRUE (ERRSV)) |
603 | if (SvTRUE (ERRSV)) |
|
|
604 | { |
563 | rxvt_warn ("perl hook %d evaluation error: %s", htype, SvPV_nolen (ERRSV)); |
605 | rxvt_warn ("perl hook %d evaluation error: %s", htype, SvPV_nolen (ERRSV)); |
|
|
606 | ungrab (term); // better lose the grab than the session |
|
|
607 | } |
564 | |
608 | |
565 | if (htype == HOOK_DESTROY) |
609 | if (htype == HOOK_DESTROY) |
566 | { |
610 | { |
567 | clearSVptr ((SV *)term->perl.self); |
611 | clearSVptr ((SV *)term->perl.self); |
568 | SvREFCNT_dec ((SV *)term->perl.self); |
612 | SvREFCNT_dec ((SV *)term->perl.self); |
… | |
… | |
583 | |
627 | |
584 | PROTOTYPES: ENABLE |
628 | PROTOTYPES: ENABLE |
585 | |
629 | |
586 | BOOT: |
630 | BOOT: |
587 | { |
631 | { |
588 | # define export_const(name) newCONSTSUB (gv_stashpv ("urxvt", 1), # name, newSViv (name)); |
632 | sv_setsv (get_sv ("urxvt::LIBDIR", 1), newSVpvn (LIBDIR, sizeof (LIBDIR) - 1)); |
|
|
633 | |
589 | AV *hookname = get_av ("urxvt::HOOKNAME", 1); |
634 | AV *hookname = get_av ("urxvt::HOOKNAME", 1); |
590 | # define def(sym) av_store (hookname, HOOK_ ## sym, newSVpv (# sym, 0)); |
635 | # define def(sym) av_store (hookname, HOOK_ ## sym, newSVpv (# sym, 0)); |
591 | # include "hookinc.h" |
636 | # include "hookinc.h" |
592 | # undef def |
637 | # undef def |
593 | |
638 | |
|
|
639 | HV *option = get_hv ("urxvt::OPTION", 1); |
|
|
640 | # define def(name,val) hv_store (option, # name, sizeof (# name) - 1, newSVuv (Opt_ ## name), 0); |
|
|
641 | # define nodef(name) |
|
|
642 | # include "optinc.h" |
|
|
643 | # undef nodef |
|
|
644 | # undef def |
|
|
645 | |
|
|
646 | HV *stash = gv_stashpv ("urxvt", 1); |
|
|
647 | # define export_const_iv(name) newCONSTSUB (stash, # name, newSViv (name)); |
594 | export_const (DEFAULT_RSTYLE); |
648 | export_const_iv (DEFAULT_RSTYLE); |
595 | export_const (OVERLAY_RSTYLE); |
649 | export_const_iv (OVERLAY_RSTYLE); |
596 | export_const (RS_Bold); |
650 | export_const_iv (RS_Bold); |
597 | export_const (RS_Italic); |
651 | export_const_iv (RS_Italic); |
598 | export_const (RS_Blink); |
652 | export_const_iv (RS_Blink); |
599 | export_const (RS_RVid); |
653 | export_const_iv (RS_RVid); |
600 | export_const (RS_Uline); |
654 | export_const_iv (RS_Uline); |
|
|
655 | |
601 | export_const (CurrentTime); |
656 | export_const_iv (CurrentTime); |
|
|
657 | export_const_iv (ShiftMask); |
|
|
658 | export_const_iv (LockMask); |
|
|
659 | export_const_iv (ControlMask); |
|
|
660 | export_const_iv (Mod1Mask); |
|
|
661 | export_const_iv (Mod2Mask); |
|
|
662 | export_const_iv (Mod3Mask); |
|
|
663 | export_const_iv (Mod4Mask); |
|
|
664 | export_const_iv (Mod5Mask); |
|
|
665 | export_const_iv (Button1Mask); |
|
|
666 | export_const_iv (Button2Mask); |
|
|
667 | export_const_iv (Button3Mask); |
|
|
668 | export_const_iv (Button4Mask); |
|
|
669 | export_const_iv (Button5Mask); |
|
|
670 | export_const_iv (AnyModifier); |
602 | |
671 | |
603 | sv_setpv (get_sv ("urxvt::LIBDIR", 1), LIBDIR); |
672 | export_const_iv (EVENT_NONE); |
|
|
673 | export_const_iv (EVENT_READ); |
|
|
674 | export_const_iv (EVENT_WRITE); |
604 | } |
675 | } |
605 | |
676 | |
606 | SV * |
677 | SV * |
607 | new (...) |
678 | new (...) |
608 | CODE: |
679 | CODE: |
… | |
… | |
646 | void |
717 | void |
647 | fatal (const char *msg) |
718 | fatal (const char *msg) |
648 | CODE: |
719 | CODE: |
649 | rxvt_fatal ("%s", msg); |
720 | rxvt_fatal ("%s", msg); |
650 | |
721 | |
|
|
722 | SV * |
|
|
723 | untaint (SV *sv) |
|
|
724 | CODE: |
|
|
725 | RETVAL = newSVsv (sv); |
|
|
726 | SvTAINTED_off (RETVAL); |
|
|
727 | OUTPUT: |
|
|
728 | RETVAL |
|
|
729 | |
|
|
730 | bool |
|
|
731 | safe () |
|
|
732 | CODE: |
|
|
733 | RETVAL = !rxvt_tainted (); |
|
|
734 | OUTPUT: |
|
|
735 | RETVAL |
|
|
736 | |
651 | NV |
737 | NV |
652 | NOW () |
738 | NOW () |
653 | CODE: |
739 | CODE: |
654 | RETVAL = NOW; |
740 | RETVAL = NOW; |
655 | OUTPUT: |
741 | OUTPUT: |
… | |
… | |
711 | void |
797 | void |
712 | rxvt_term::grab_button (int button, U32 modifiers) |
798 | rxvt_term::grab_button (int button, U32 modifiers) |
713 | CODE: |
799 | CODE: |
714 | XGrabButton (THIS->display->display, button, modifiers, THIS->vt, 1, |
800 | XGrabButton (THIS->display->display, button, modifiers, THIS->vt, 1, |
715 | ButtonPressMask | ButtonReleaseMask | EnterWindowMask | LeaveWindowMask | PointerMotionMask, |
801 | ButtonPressMask | ButtonReleaseMask | EnterWindowMask | LeaveWindowMask | PointerMotionMask, |
716 | GrabModeSync, GrabModeSync, None, None); |
802 | GrabModeSync, GrabModeSync, None, GRAB_CURSOR); |
717 | |
803 | |
718 | bool |
804 | bool |
719 | rxvt_term::grab (U32 eventtime, int sync = 0) |
805 | rxvt_term::grab (U32 eventtime, int sync = 0) |
720 | CODE: |
806 | CODE: |
721 | { |
807 | { |
… | |
… | |
723 | |
809 | |
724 | THIS->perl.grabtime = 0; |
810 | THIS->perl.grabtime = 0; |
725 | |
811 | |
726 | if (!XGrabPointer (THIS->display->display, THIS->vt, 0, |
812 | if (!XGrabPointer (THIS->display->display, THIS->vt, 0, |
727 | ButtonPressMask | ButtonReleaseMask | EnterWindowMask | LeaveWindowMask | PointerMotionMask, |
813 | ButtonPressMask | ButtonReleaseMask | EnterWindowMask | LeaveWindowMask | PointerMotionMask, |
728 | mode, mode, None, None, eventtime)) |
814 | mode, mode, None, GRAB_CURSOR, eventtime)) |
729 | if (!XGrabKeyboard (THIS->display->display, THIS->vt, 0, mode, mode, eventtime)) |
815 | if (!XGrabKeyboard (THIS->display->display, THIS->vt, 0, mode, mode, eventtime)) |
730 | THIS->perl.grabtime = eventtime; |
816 | THIS->perl.grabtime = eventtime; |
731 | else |
817 | else |
732 | XUngrabPointer (THIS->display->display, eventtime); |
818 | XUngrabPointer (THIS->display->display, eventtime); |
733 | |
819 | |
… | |
… | |
735 | } |
821 | } |
736 | OUTPUT: |
822 | OUTPUT: |
737 | RETVAL |
823 | RETVAL |
738 | |
824 | |
739 | void |
825 | void |
740 | rxvt_term::allow_events_async (U32 eventtime = THIS->perl.grabtime) |
826 | rxvt_term::allow_events_async () |
741 | CODE: |
827 | CODE: |
742 | XAllowEvents (THIS->display->display, AsyncBoth, eventtime); |
828 | XAllowEvents (THIS->display->display, AsyncBoth, THIS->perl.grabtime); |
743 | |
829 | |
744 | void |
830 | void |
745 | rxvt_term::allow_events_sync (U32 eventtime = THIS->perl.grabtime) |
831 | rxvt_term::allow_events_sync () |
746 | CODE: |
832 | CODE: |
747 | XAllowEvents (THIS->display->display, SyncBoth, eventtime); |
833 | XAllowEvents (THIS->display->display, SyncBoth, THIS->perl.grabtime); |
748 | |
834 | |
749 | void |
835 | void |
750 | rxvt_term::allow_events_replay (U32 eventtime = THIS->perl.grabtime) |
836 | rxvt_term::allow_events_replay () |
751 | CODE: |
837 | CODE: |
752 | XAllowEvents (THIS->display->display, ReplayPointer, eventtime); |
838 | XAllowEvents (THIS->display->display, ReplayPointer, THIS->perl.grabtime); |
753 | XAllowEvents (THIS->display->display, ReplayKeyboard, eventtime); |
839 | XAllowEvents (THIS->display->display, ReplayKeyboard, THIS->perl.grabtime); |
754 | |
840 | |
755 | void |
841 | void |
756 | rxvt_term::ungrab (U32 eventtime = THIS->perl.grabtime) |
842 | rxvt_term::ungrab () |
757 | CODE: |
843 | CODE: |
758 | THIS->perl.grabtime = 0; |
844 | ungrab (THIS); |
759 | XUngrabKeyboard (THIS->display->display, eventtime); |
|
|
760 | XUngrabPointer (THIS->display->display, eventtime); |
|
|
761 | |
845 | |
762 | int |
846 | int |
763 | rxvt_term::strwidth (SV *str) |
847 | rxvt_term::strwidth (SV *str) |
764 | CODE: |
848 | CODE: |
765 | { |
849 | { |
… | |
… | |
784 | char *mbstr = rxvt_wcstombs (wstr); |
868 | char *mbstr = rxvt_wcstombs (wstr); |
785 | rxvt_pop_locale (); |
869 | rxvt_pop_locale (); |
786 | |
870 | |
787 | free (wstr); |
871 | free (wstr); |
788 | |
872 | |
789 | RETVAL = newSVpv (mbstr, 0); |
873 | RETVAL = taint_if (newSVpv (mbstr, 0), str); |
790 | free (mbstr); |
874 | free (mbstr); |
791 | } |
875 | } |
792 | OUTPUT: |
876 | OUTPUT: |
793 | RETVAL |
877 | RETVAL |
794 | |
878 | |
… | |
… | |
801 | |
885 | |
802 | rxvt_push_locale (THIS->locale); |
886 | rxvt_push_locale (THIS->locale); |
803 | wchar_t *wstr = rxvt_mbstowcs (data, len); |
887 | wchar_t *wstr = rxvt_mbstowcs (data, len); |
804 | rxvt_pop_locale (); |
888 | rxvt_pop_locale (); |
805 | |
889 | |
806 | RETVAL = wcs2sv (wstr); |
890 | RETVAL = taint_if (wcs2sv (wstr), octets); |
807 | free (wstr); |
891 | free (wstr); |
808 | } |
892 | } |
809 | OUTPUT: |
893 | OUTPUT: |
810 | RETVAL |
894 | RETVAL |
811 | |
895 | |
812 | # very portable, especially on objects as opposed to pods |
896 | #define TERM_OFFSET(sym) offsetof (TermWin_t, sym) |
813 | #define TERM_OFFSET(sym) (((char *)&((TermWin_t *)0)->sym) - (char *)(TermWin_t *)0) |
|
|
814 | |
897 | |
815 | #define TERM_OFFSET_width TERM_OFFSET(width) |
898 | #define TERM_OFFSET_width TERM_OFFSET(width) |
816 | #define TERM_OFFSET_height TERM_OFFSET(height) |
899 | #define TERM_OFFSET_height TERM_OFFSET(height) |
817 | #define TERM_OFFSET_fwidth TERM_OFFSET(fwidth) |
900 | #define TERM_OFFSET_fwidth TERM_OFFSET(fwidth) |
818 | #define TERM_OFFSET_fheight TERM_OFFSET(fheight) |
901 | #define TERM_OFFSET_fheight TERM_OFFSET(fheight) |
… | |
… | |
843 | CODE: |
926 | CODE: |
844 | RETVAL = *(int *)((char *)THIS + ix); |
927 | RETVAL = *(int *)((char *)THIS + ix); |
845 | OUTPUT: |
928 | OUTPUT: |
846 | RETVAL |
929 | RETVAL |
847 | |
930 | |
|
|
931 | unsigned int |
|
|
932 | rxvt_term::ModLevel3Mask () |
|
|
933 | ALIAS: |
|
|
934 | ModLevel3Mask = 0 |
|
|
935 | ModMetaMask = 1 |
|
|
936 | ModNumLockMask = 2 |
|
|
937 | CODE: |
|
|
938 | switch (ix) |
|
|
939 | { |
|
|
940 | case 0: RETVAL = THIS->ModLevel3Mask; break; |
|
|
941 | case 1: RETVAL = THIS->ModMetaMask; break; |
|
|
942 | case 2: RETVAL = THIS->ModNumLockMask; break; |
|
|
943 | } |
|
|
944 | OUTPUT: |
|
|
945 | RETVAL |
|
|
946 | |
|
|
947 | char * |
|
|
948 | rxvt_term::display_id () |
|
|
949 | ALIAS: |
|
|
950 | display_id = 0 |
|
|
951 | locale = 1 |
|
|
952 | CODE: |
|
|
953 | switch (ix) |
|
|
954 | { |
|
|
955 | case 0: RETVAL = THIS->display->id; break; |
|
|
956 | case 1: RETVAL = THIS->locale; break; |
|
|
957 | } |
|
|
958 | OUTPUT: |
|
|
959 | RETVAL |
|
|
960 | |
|
|
961 | int |
|
|
962 | rxvt_term::pty_ev_events (int events = EVENT_UNDEF) |
|
|
963 | CODE: |
|
|
964 | RETVAL = THIS->pty_ev.events; |
|
|
965 | if (events != EVENT_UNDEF) |
|
|
966 | THIS->pty_ev.set (events); |
|
|
967 | OUTPUT: |
|
|
968 | RETVAL |
|
|
969 | |
848 | U32 |
970 | U32 |
849 | rxvt_term::parent () |
971 | rxvt_term::parent () |
850 | CODE: |
972 | CODE: |
851 | RETVAL = (U32)THIS->parent [0]; |
973 | RETVAL = (U32)THIS->parent [0]; |
852 | OUTPUT: |
974 | OUTPUT: |
… | |
… | |
903 | wchar_t *wstr = new wchar_t [THIS->ncol]; |
1025 | wchar_t *wstr = new wchar_t [THIS->ncol]; |
904 | |
1026 | |
905 | for (int col = 0; col < THIS->ncol; col++) |
1027 | for (int col = 0; col < THIS->ncol; col++) |
906 | wstr [col] = l.t [col]; |
1028 | wstr [col] = l.t [col]; |
907 | |
1029 | |
908 | XPUSHs (sv_2mortal (wcs2sv (wstr, THIS->ncol))); |
1030 | XPUSHs (taint (sv_2mortal (wcs2sv (wstr, THIS->ncol)))); |
909 | |
1031 | |
910 | delete [] wstr; |
1032 | delete [] wstr; |
911 | } |
1033 | } |
912 | |
1034 | |
913 | if (new_text) |
1035 | if (new_text) |
… | |
… | |
1034 | else |
1156 | else |
1035 | *r++ = *s; |
1157 | *r++ = *s; |
1036 | |
1158 | |
1037 | rxvt_pop_locale (); |
1159 | rxvt_pop_locale (); |
1038 | |
1160 | |
1039 | RETVAL = wcs2sv (rstr, r - rstr); |
1161 | RETVAL = taint_if (wcs2sv (rstr, r - rstr), string); |
1040 | |
1162 | |
1041 | delete [] rstr; |
1163 | delete [] rstr; |
1042 | } |
1164 | } |
1043 | OUTPUT: |
1165 | OUTPUT: |
1044 | RETVAL |
1166 | RETVAL |
… | |
… | |
1070 | else if (IS_COMPOSE (*s)) |
1192 | else if (IS_COMPOSE (*s)) |
1071 | r += rxvt_composite.expand (*s, r); |
1193 | r += rxvt_composite.expand (*s, r); |
1072 | else |
1194 | else |
1073 | *r++ = *s; |
1195 | *r++ = *s; |
1074 | |
1196 | |
1075 | RETVAL = wcs2sv (rstr, r - rstr); |
1197 | RETVAL = taint_if (wcs2sv (rstr, r - rstr), text); |
1076 | |
1198 | |
1077 | delete [] rstr; |
1199 | delete [] rstr; |
1078 | } |
1200 | } |
1079 | OUTPUT: |
1201 | OUTPUT: |
1080 | RETVAL |
1202 | RETVAL |
… | |
… | |
1102 | |
1224 | |
1103 | if (!IN_RANGE_EXC (index, 0, NUM_RESOURCES)) |
1225 | if (!IN_RANGE_EXC (index, 0, NUM_RESOURCES)) |
1104 | croak ("requested out-of-bound resource %s+%d,", name, index - rs->value); |
1226 | croak ("requested out-of-bound resource %s+%d,", name, index - rs->value); |
1105 | |
1227 | |
1106 | if (GIMME_V != G_VOID) |
1228 | if (GIMME_V != G_VOID) |
1107 | XPUSHs (THIS->rs [index] ? sv_2mortal (newSVpv (THIS->rs [index], 0)) : &PL_sv_undef); |
1229 | XPUSHs (THIS->rs [index] ? sv_2mortal (taint (newSVpv (THIS->rs [index], 0))) : &PL_sv_undef); |
1108 | |
1230 | |
1109 | if (newval) |
1231 | if (newval) |
1110 | { |
1232 | { |
1111 | if (SvOK (newval)) |
1233 | if (SvOK (newval)) |
1112 | { |
1234 | { |
… | |
… | |
1117 | else |
1239 | else |
1118 | THIS->rs [index] = 0; |
1240 | THIS->rs [index] = 0; |
1119 | } |
1241 | } |
1120 | } |
1242 | } |
1121 | |
1243 | |
|
|
1244 | bool |
|
|
1245 | rxvt_term::option (U32 optval, int set = -1) |
|
|
1246 | CODE: |
|
|
1247 | { |
|
|
1248 | RETVAL = THIS->options & optval; |
|
|
1249 | |
|
|
1250 | if (set >= 0) |
|
|
1251 | { |
|
|
1252 | if (set) |
|
|
1253 | THIS->options |= optval; |
|
|
1254 | else |
|
|
1255 | THIS->options &= ~optval; |
|
|
1256 | |
|
|
1257 | switch (optval) |
|
|
1258 | { |
|
|
1259 | case Opt_skipBuiltinGlyphs: |
|
|
1260 | THIS->set_fonts (); |
|
|
1261 | THIS->scr_remap_chars (); |
|
|
1262 | THIS->scr_touch (true); |
|
|
1263 | THIS->want_refresh = 1; |
|
|
1264 | break; |
|
|
1265 | |
|
|
1266 | case Opt_cursorUnderline: |
|
|
1267 | THIS->want_refresh = 1; |
|
|
1268 | break; |
|
|
1269 | |
|
|
1270 | # case Opt_scrollBar_floating: |
|
|
1271 | # case Opt_scrollBar_right: |
|
|
1272 | # THIS->resize_all_windows (THIS->width, THIS->height, 1); |
|
|
1273 | # break; |
|
|
1274 | } |
|
|
1275 | } |
|
|
1276 | } |
|
|
1277 | OUTPUT: |
|
|
1278 | RETVAL |
|
|
1279 | |
|
|
1280 | bool |
|
|
1281 | rxvt_term::parse_keysym (char *keysym, char *str) |
|
|
1282 | CODE: |
|
|
1283 | RETVAL = 0 < THIS->parse_keysym (keysym, str); |
|
|
1284 | THIS->keyboard->register_done (); |
|
|
1285 | OUTPUT: |
|
|
1286 | RETVAL |
|
|
1287 | |
1122 | void |
1288 | void |
1123 | rxvt_term::cur (...) |
1289 | rxvt_term::screen_cur (...) |
1124 | PROTOTYPE: $;$$ |
1290 | PROTOTYPE: $;$$ |
1125 | ALIAS: |
1291 | ALIAS: |
1126 | screen_cur = 0 |
1292 | screen_cur = 0 |
1127 | selection_beg = 1 |
1293 | selection_beg = 1 |
1128 | selection_end = 2 |
1294 | selection_end = 2 |
… | |
… | |
1157 | void |
1323 | void |
1158 | rxvt_term::selection (SV *newtext = 0) |
1324 | rxvt_term::selection (SV *newtext = 0) |
1159 | PPCODE: |
1325 | PPCODE: |
1160 | { |
1326 | { |
1161 | if (GIMME_V != G_VOID) |
1327 | if (GIMME_V != G_VOID) |
|
|
1328 | XPUSHs (THIS->selection.text |
1162 | XPUSHs (sv_2mortal (wcs2sv (THIS->selection.text, THIS->selection.len))); |
1329 | ? taint (sv_2mortal (wcs2sv (THIS->selection.text, THIS->selection.len))) |
|
|
1330 | : &PL_sv_undef); |
1163 | |
1331 | |
1164 | if (newtext) |
1332 | if (newtext) |
1165 | { |
1333 | { |
1166 | free (THIS->selection.text); |
1334 | free (THIS->selection.text); |
1167 | |
1335 | |
1168 | THIS->selection.text = sv2wcs (newtext); |
1336 | THIS->selection.text = sv2wcs (newtext); |
1169 | THIS->selection.len = wcslen (THIS->selection.text); |
1337 | THIS->selection.len = wcslen (THIS->selection.text); |
1170 | } |
1338 | } |
1171 | } |
1339 | } |
|
|
1340 | |
|
|
1341 | void |
|
|
1342 | rxvt_term::scr_xor_rect (int beg_row, int beg_col, int end_row, int end_col, U32 rstyle1 = RS_RVid, U32 rstyle2 = RS_RVid | RS_Uline) |
|
|
1343 | |
|
|
1344 | void |
|
|
1345 | rxvt_term::scr_xor_span (int beg_row, int beg_col, int end_row, int end_col, U32 rstyle = RS_RVid) |
|
|
1346 | |
|
|
1347 | void |
|
|
1348 | rxvt_term::scr_bell () |
1172 | |
1349 | |
1173 | void |
1350 | void |
1174 | rxvt_term::scr_add_lines (SV *string) |
1351 | rxvt_term::scr_add_lines (SV *string) |
1175 | CODE: |
1352 | CODE: |
1176 | { |
1353 | { |