1 | /*----------------------------------------------------------------------* |
1 | /*----------------------------------------------------------------------* |
2 | * File: rxvtperl.xs |
2 | * File: rxvtperl.xs |
3 | *----------------------------------------------------------------------* |
3 | *----------------------------------------------------------------------* |
4 | * |
4 | * |
5 | * All portions of code are copyright by their respective author/s. |
5 | * All portions of code are copyright by their respective author/s. |
6 | * Copyright (c) 2005-2005 Marc Lehmann <pcg@goof.com> |
6 | * Copyright (c) 2005-2006 Marc Lehmann <pcg@goof.com> |
7 | * |
7 | * |
8 | * This program is free software; you can redistribute it and/or modify |
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 |
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 |
10 | * the Free Software Foundation; either version 2 of the License, or |
11 | * (at your option) any later version. |
11 | * (at your option) any later version. |
… | |
… | |
51 | char *str = SvPVutf8 (sv, len); |
51 | char *str = SvPVutf8 (sv, len); |
52 | return rxvt_utf8towcs (str, len); |
52 | return rxvt_utf8towcs (str, len); |
53 | } |
53 | } |
54 | |
54 | |
55 | static SV * |
55 | static SV * |
|
|
56 | 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 * |
56 | new_ref (HV *hv, const char *klass) |
68 | new_ref (HV *hv, const char *klass) |
57 | { |
69 | { |
58 | return sv_bless (newRV ((SV *)hv), gv_stashpv (klass, 1)); |
70 | return sv_bless (newRV ((SV *)hv), gv_stashpv (klass, 1)); |
59 | } |
71 | } |
60 | |
72 | |
… | |
… | |
453 | |
465 | |
454 | case DT_LONG: |
466 | case DT_LONG: |
455 | XPUSHs (sv_2mortal (newSViv (va_arg (ap, long)))); |
467 | XPUSHs (sv_2mortal (newSViv (va_arg (ap, long)))); |
456 | break; |
468 | break; |
457 | |
469 | |
458 | case DT_STRING: |
470 | case DT_STR: |
459 | XPUSHs (sv_2mortal (newSVpv (va_arg (ap, char *), 0))); |
471 | XPUSHs (sv_2mortal (newSVpv (va_arg (ap, char *), 0))); |
|
|
472 | break; |
|
|
473 | |
|
|
474 | case DT_STR_LEN: |
|
|
475 | { |
|
|
476 | char *str = va_arg (ap, char *); |
|
|
477 | int len = va_arg (ap, int); |
|
|
478 | |
|
|
479 | XPUSHs (sv_2mortal (newSVpvn (str, len))); |
|
|
480 | } |
|
|
481 | break; |
|
|
482 | |
|
|
483 | case DT_WCS_LEN: |
|
|
484 | { |
|
|
485 | wchar_t *wstr = va_arg (ap, wchar_t *); |
|
|
486 | int wlen = va_arg (ap, int); |
|
|
487 | |
|
|
488 | XPUSHs (sv_2mortal (wcs2sv (wstr, wlen))); |
|
|
489 | } |
|
|
490 | break; |
|
|
491 | |
|
|
492 | case DT_XEVENT: |
|
|
493 | { |
|
|
494 | XEvent *xe = va_arg (ap, XEvent *); |
|
|
495 | HV *hv = newHV (); |
|
|
496 | |
|
|
497 | # define set(name, sv) hv_store (hv, # name, sizeof (# name) - 1, sv, 0) |
|
|
498 | # define setiv(name, val) hv_store (hv, # name, sizeof (# name) - 1, newSViv (val), 0) |
|
|
499 | # undef set |
|
|
500 | |
|
|
501 | setiv (type, xe->type); |
|
|
502 | setiv (send_event, xe->xany.send_event); |
|
|
503 | setiv (serial, xe->xany.serial); |
|
|
504 | |
|
|
505 | switch (xe->type) |
|
|
506 | { |
|
|
507 | case KeyPress: |
|
|
508 | case KeyRelease: |
|
|
509 | case ButtonPress: |
|
|
510 | case ButtonRelease: |
|
|
511 | case MotionNotify: |
|
|
512 | setiv (time, xe->xmotion.time); |
|
|
513 | setiv (x, xe->xmotion.x); |
|
|
514 | setiv (y, xe->xmotion.y); |
|
|
515 | setiv (row, xe->xmotion.y / term->fheight); |
|
|
516 | setiv (col, xe->xmotion.x / term->fwidth); |
|
|
517 | setiv (x_root, xe->xmotion.x_root); |
|
|
518 | setiv (y_root, xe->xmotion.y_root); |
|
|
519 | setiv (state, xe->xmotion.state); |
|
|
520 | break; |
|
|
521 | } |
|
|
522 | |
|
|
523 | switch (xe->type) |
|
|
524 | { |
|
|
525 | case KeyPress: |
|
|
526 | case KeyRelease: |
|
|
527 | setiv (keycode, xe->xkey.keycode); |
|
|
528 | break; |
|
|
529 | |
|
|
530 | case ButtonPress: |
|
|
531 | case ButtonRelease: |
|
|
532 | setiv (button, xe->xbutton.button); |
|
|
533 | break; |
|
|
534 | |
|
|
535 | case MotionNotify: |
|
|
536 | setiv (is_hint, xe->xmotion.is_hint); |
|
|
537 | break; |
|
|
538 | } |
|
|
539 | |
|
|
540 | XPUSHs (sv_2mortal (newRV_noinc ((SV *)hv))); |
|
|
541 | } |
460 | break; |
542 | break; |
461 | |
543 | |
462 | case DT_END: |
544 | case DT_END: |
463 | { |
545 | { |
464 | va_end (ap); |
546 | va_end (ap); |
… | |
… | |
518 | export_const (RS_Uline); |
600 | export_const (RS_Uline); |
519 | |
601 | |
520 | sv_setpv (get_sv ("urxvt::LIBDIR", 1), LIBDIR); |
602 | sv_setpv (get_sv ("urxvt::LIBDIR", 1), LIBDIR); |
521 | } |
603 | } |
522 | |
604 | |
|
|
605 | SV * |
|
|
606 | new (...) |
|
|
607 | CODE: |
|
|
608 | { |
|
|
609 | stringvec *argv = new stringvec; |
|
|
610 | bool success; |
|
|
611 | |
|
|
612 | for (int i = 0; i < items ;i++) |
|
|
613 | argv->push_back (strdup (SvPVbyte_nolen (ST (i)))); |
|
|
614 | |
|
|
615 | rxvt_term *term = new rxvt_term; |
|
|
616 | |
|
|
617 | term->argv = argv; |
|
|
618 | |
|
|
619 | try |
|
|
620 | { |
|
|
621 | if (!term->init (argv->size (), argv->begin ())) |
|
|
622 | term = 0; |
|
|
623 | } |
|
|
624 | catch (const class rxvt_failure_exception &e) |
|
|
625 | { |
|
|
626 | term->destroy (); |
|
|
627 | croak ("exception caught while initializing new terminal instance"); |
|
|
628 | } |
|
|
629 | |
|
|
630 | RETVAL = term && term->self ? newSVterm (term) : &PL_sv_undef; |
|
|
631 | } |
|
|
632 | OUTPUT: |
|
|
633 | RETVAL |
|
|
634 | |
523 | void |
635 | void |
524 | set_should_invoke (int htype, int value) |
636 | set_should_invoke (int htype, int value) |
525 | CODE: |
637 | CODE: |
526 | rxvt_perl.should_invoke [htype] = value; |
638 | rxvt_perl.should_invoke [htype] = value; |
527 | |
639 | |
… | |
… | |
589 | } |
701 | } |
590 | OUTPUT: |
702 | OUTPUT: |
591 | RETVAL |
703 | RETVAL |
592 | |
704 | |
593 | MODULE = urxvt PACKAGE = urxvt::term |
705 | MODULE = urxvt PACKAGE = urxvt::term |
|
|
706 | |
|
|
707 | void |
|
|
708 | rxvt_term::destroy () |
594 | |
709 | |
595 | int |
710 | int |
596 | rxvt_term::strwidth (SV *str) |
711 | rxvt_term::strwidth (SV *str) |
597 | CODE: |
712 | CODE: |
598 | { |
713 | { |
… | |
… | |
634 | |
749 | |
635 | rxvt_push_locale (THIS->locale); |
750 | rxvt_push_locale (THIS->locale); |
636 | wchar_t *wstr = rxvt_mbstowcs (data, len); |
751 | wchar_t *wstr = rxvt_mbstowcs (data, len); |
637 | rxvt_pop_locale (); |
752 | rxvt_pop_locale (); |
638 | |
753 | |
639 | char *str = rxvt_wcstoutf8 (wstr); |
754 | RETVAL = wcs2sv (wstr); |
640 | free (wstr); |
755 | free (wstr); |
641 | |
|
|
642 | RETVAL = newSVpv (str, 0); |
|
|
643 | SvUTF8_on (RETVAL); |
|
|
644 | free (str); |
|
|
645 | } |
756 | } |
646 | OUTPUT: |
757 | OUTPUT: |
647 | RETVAL |
758 | RETVAL |
648 | |
759 | |
649 | # very portable, especially on objects as opposed to pods |
760 | # very portable, especially on objects as opposed to pods |
… | |
… | |
681 | RETVAL = *(int *)((char *)THIS + ix); |
792 | RETVAL = *(int *)((char *)THIS + ix); |
682 | OUTPUT: |
793 | OUTPUT: |
683 | RETVAL |
794 | RETVAL |
684 | |
795 | |
685 | U32 |
796 | U32 |
|
|
797 | rxvt_term::parent () |
|
|
798 | CODE: |
|
|
799 | RETVAL = (U32)THIS->parent [0]; |
|
|
800 | OUTPUT: |
|
|
801 | RETVAL |
|
|
802 | |
|
|
803 | U32 |
|
|
804 | rxvt_term::vt () |
|
|
805 | CODE: |
|
|
806 | RETVAL = (U32)THIS->vt; |
|
|
807 | OUTPUT: |
|
|
808 | RETVAL |
|
|
809 | |
|
|
810 | U32 |
686 | rxvt_term::screen_rstyle (U32 new_rstyle = THIS->screen.s_rstyle) |
811 | rxvt_term::rstyle (U32 new_rstyle = THIS->rstyle) |
687 | CODE: |
812 | CODE: |
688 | { |
813 | { |
689 | RETVAL = THIS->screen.s_rstyle; |
814 | RETVAL = THIS->rstyle; |
690 | THIS->screen.s_rstyle = new_rstyle; |
815 | THIS->rstyle = new_rstyle; |
691 | } |
816 | } |
692 | OUTPUT: |
817 | OUTPUT: |
693 | RETVAL |
818 | RETVAL |
694 | |
819 | |
695 | int |
820 | int |
… | |
… | |
711 | rxvt_term::want_refresh () |
836 | rxvt_term::want_refresh () |
712 | CODE: |
837 | CODE: |
713 | THIS->want_refresh = 1; |
838 | THIS->want_refresh = 1; |
714 | |
839 | |
715 | void |
840 | void |
716 | rxvt_term::ROW_t (int row_number, SV *new_text = 0, int start_col = 0) |
841 | rxvt_term::ROW_t (int row_number, SV *new_text = 0, int start_col = 0, int start_ofs = 0, int max_len = MAX_COLS) |
717 | PPCODE: |
842 | PPCODE: |
718 | { |
843 | { |
719 | if (!IN_RANGE_EXC (row_number, -THIS->nsaved, THIS->nrow)) |
844 | if (!IN_RANGE_EXC (row_number, -THIS->nsaved, THIS->nrow)) |
720 | XSRETURN_EMPTY; |
845 | XSRETURN_EMPTY; |
721 | |
846 | |
… | |
… | |
723 | |
848 | |
724 | if (GIMME_V != G_VOID) |
849 | if (GIMME_V != G_VOID) |
725 | { |
850 | { |
726 | wchar_t *wstr = new wchar_t [THIS->ncol]; |
851 | wchar_t *wstr = new wchar_t [THIS->ncol]; |
727 | |
852 | |
728 | for (int col = 0; col <THIS->ncol; col++) |
853 | for (int col = 0; col < THIS->ncol; col++) |
729 | wstr [col] = l.t [col]; |
854 | wstr [col] = l.t [col]; |
730 | |
855 | |
731 | char *str = rxvt_wcstoutf8 (wstr, THIS->ncol); |
|
|
732 | free (wstr); |
|
|
733 | |
|
|
734 | SV *sv = newSVpv (str, 0); |
|
|
735 | SvUTF8_on (sv); |
|
|
736 | XPUSHs (sv_2mortal (sv)); |
856 | XPUSHs (sv_2mortal (wcs2sv (wstr, THIS->ncol))); |
737 | free (str); |
857 | |
|
|
858 | delete [] wstr; |
738 | } |
859 | } |
739 | |
860 | |
740 | if (new_text) |
861 | if (new_text) |
741 | { |
862 | { |
742 | wchar_t *wstr = sv2wcs (new_text); |
863 | wchar_t *wstr = sv2wcs (new_text); |
743 | |
864 | |
744 | int len = wcslen (wstr); |
865 | int len = min (wcslen (wstr) - start_ofs, max_len); |
745 | |
866 | |
746 | if (!IN_RANGE_INC (start_col, 0, THIS->ncol - len)) |
867 | if (!IN_RANGE_INC (start_col, 0, THIS->ncol - len)) |
747 | { |
868 | { |
748 | free (wstr); |
869 | free (wstr); |
749 | croak ("new_text extends beyond horizontal margins"); |
870 | croak ("new_text extends beyond horizontal margins"); |
750 | } |
871 | } |
751 | |
872 | |
752 | for (int col = start_col; col < start_col + len; col++) |
873 | for (int col = start_col; col < start_col + len; col++) |
753 | { |
874 | { |
754 | l.t [col] = wstr [col - start_col]; |
875 | l.t [col] = wstr [start_ofs + col - start_col]; |
755 | l.r [col] = SET_FONT (l.r [col], THIS->fontset [GET_STYLE (l.r [col])]->find_font (l.t [col])); |
876 | l.r [col] = SET_FONT (l.r [col], THIS->fontset [GET_STYLE (l.r [col])]->find_font (l.t [col])); |
756 | } |
877 | } |
757 | |
878 | |
758 | free (wstr); |
879 | free (wstr); |
759 | } |
880 | } |
760 | } |
881 | } |
761 | |
882 | |
762 | void |
883 | void |
763 | rxvt_term::ROW_r (int row_number, SV *new_rend = 0, int start_col = 0) |
884 | rxvt_term::ROW_r (int row_number, SV *new_rend = 0, int start_col = 0, int start_ofs = 0, int max_len = MAX_COLS) |
764 | PPCODE: |
885 | PPCODE: |
765 | { |
886 | { |
766 | if (!IN_RANGE_EXC (row_number, -THIS->nsaved, THIS->nrow)) |
887 | if (!IN_RANGE_EXC (row_number, -THIS->nsaved, THIS->nrow)) |
767 | XSRETURN_EMPTY; |
888 | XSRETURN_EMPTY; |
768 | |
889 | |
… | |
… | |
783 | { |
904 | { |
784 | if (!SvROK (new_rend) || SvTYPE (SvRV (new_rend)) != SVt_PVAV) |
905 | if (!SvROK (new_rend) || SvTYPE (SvRV (new_rend)) != SVt_PVAV) |
785 | croak ("new_rend must be arrayref"); |
906 | croak ("new_rend must be arrayref"); |
786 | |
907 | |
787 | AV *av = (AV *)SvRV (new_rend); |
908 | AV *av = (AV *)SvRV (new_rend); |
788 | int len = av_len (av) + 1; |
909 | int len = min (av_len (av) + 1 - start_ofs, max_len); |
789 | |
910 | |
790 | if (!IN_RANGE_INC (start_col, 0, THIS->ncol - len)) |
911 | if (!IN_RANGE_INC (start_col, 0, THIS->ncol - len)) |
791 | croak ("new_rend array extends beyond horizontal margins"); |
912 | croak ("new_rend array extends beyond horizontal margins"); |
792 | |
913 | |
793 | for (int col = start_col; col < start_col + len; col++) |
914 | for (int col = start_col; col < start_col + len; col++) |
794 | { |
915 | { |
795 | rend_t r = SvIV (*av_fetch (av, col - start_col, 1)) & ~RS_fontMask; |
916 | rend_t r = SvIV (*av_fetch (av, start_ofs + col - start_col, 1)) & ~RS_fontMask; |
796 | |
917 | |
797 | l.r [col] = SET_FONT (r, THIS->fontset [GET_STYLE (r)]->find_font (l.t [col])); |
918 | l.r [col] = SET_FONT (r, THIS->fontset [GET_STYLE (r)]->find_font (l.t [col])); |
798 | } |
919 | } |
799 | } |
920 | } |
800 | } |
921 | } |
801 | |
922 | |
802 | int |
923 | int |
803 | rxvt_term::ROW_l (int row_number, int new_length = -2) |
924 | rxvt_term::ROW_l (int row_number, int new_length = -1) |
804 | CODE: |
925 | CODE: |
805 | { |
926 | { |
806 | if (!IN_RANGE_EXC (row_number, -THIS->nsaved, THIS->nrow)) |
927 | if (!IN_RANGE_EXC (row_number, -THIS->nsaved, THIS->nrow)) |
807 | XSRETURN_EMPTY; |
928 | XSRETURN_EMPTY; |
808 | |
929 | |
809 | line_t &l = ROW(row_number); |
930 | line_t &l = ROW(row_number); |
810 | RETVAL = l.l < 0 ? THIS->ncol : l.l; |
931 | RETVAL = l.l; |
811 | |
932 | |
812 | if (new_length >= -1) |
933 | if (new_length >= 0) |
813 | l.l = new_length; |
934 | l.l = new_length; |
814 | } |
935 | } |
815 | OUTPUT: |
936 | OUTPUT: |
816 | RETVAL |
937 | RETVAL |
817 | |
938 | |
818 | bool |
939 | bool |
819 | rxvt_term::ROW_is_longer (int row_number) |
940 | rxvt_term::ROW_is_longer (int row_number, int new_is_longer = -1) |
820 | CODE: |
941 | CODE: |
821 | { |
942 | { |
822 | if (!IN_RANGE_EXC (row_number, -THIS->nsaved, THIS->nrow)) |
943 | if (!IN_RANGE_EXC (row_number, -THIS->nsaved, THIS->nrow)) |
823 | XSRETURN_EMPTY; |
944 | XSRETURN_EMPTY; |
824 | |
945 | |
825 | line_t &l = ROW(row_number); |
946 | line_t &l = ROW(row_number); |
826 | RETVAL = l.l < 0; |
947 | RETVAL = l.is_longer (); |
|
|
948 | |
|
|
949 | if (new_is_longer >= 0) |
|
|
950 | l.is_longer (new_is_longer); |
827 | } |
951 | } |
828 | OUTPUT: |
952 | OUTPUT: |
829 | RETVAL |
953 | RETVAL |
830 | |
954 | |
831 | SV * |
955 | SV * |
832 | rxvt_term::special_encode (SV *str) |
956 | rxvt_term::special_encode (SV *string) |
833 | CODE: |
957 | CODE: |
834 | abort ();//TODO |
958 | { |
|
|
959 | wchar_t *wstr = sv2wcs (string); |
|
|
960 | int wlen = wcslen (wstr); |
|
|
961 | wchar_t *rstr = new wchar_t [wlen]; // cannot become longer |
|
|
962 | |
|
|
963 | rxvt_push_locale (THIS->locale); |
|
|
964 | |
|
|
965 | wchar_t *r = rstr; |
|
|
966 | for (wchar_t *s = wstr; *s; s++) |
|
|
967 | if (wcwidth (*s) == 0) |
|
|
968 | { |
|
|
969 | if (r == rstr) |
|
|
970 | croak ("leading combining character unencodable"); |
|
|
971 | |
|
|
972 | unicode_t n = rxvt_compose (r[-1], *s); |
|
|
973 | if (n == NOCHAR) |
|
|
974 | n = rxvt_composite.compose (r[-1], *s); |
|
|
975 | |
|
|
976 | r[-1] = n; |
|
|
977 | } |
|
|
978 | #if !UNICODE_3 |
|
|
979 | else if (*s >= 0x10000) |
|
|
980 | *r++ = rxvt_composite.compose (*s); |
|
|
981 | #endif |
|
|
982 | else |
|
|
983 | *r++ = *s; |
|
|
984 | |
|
|
985 | rxvt_pop_locale (); |
|
|
986 | |
|
|
987 | RETVAL = wcs2sv (rstr, r - rstr); |
|
|
988 | |
|
|
989 | delete [] rstr; |
|
|
990 | } |
|
|
991 | OUTPUT: |
|
|
992 | RETVAL |
835 | |
993 | |
836 | SV * |
994 | SV * |
837 | rxvt_term::special_decode (SV *str) |
995 | rxvt_term::special_decode (SV *text) |
838 | CODE: |
996 | CODE: |
839 | abort ();//TODO |
997 | { |
|
|
998 | wchar_t *wstr = sv2wcs (text); |
|
|
999 | int wlen = wcslen (wstr); |
|
|
1000 | int dlen = 0; |
|
|
1001 | |
|
|
1002 | // find length |
|
|
1003 | for (wchar_t *s = wstr; *s; s++) |
|
|
1004 | if (*s == NOCHAR) |
|
|
1005 | ; |
|
|
1006 | else if (IS_COMPOSE (*s)) |
|
|
1007 | dlen += rxvt_composite.expand (*s, 0); |
|
|
1008 | else |
|
|
1009 | dlen++; |
|
|
1010 | |
|
|
1011 | wchar_t *rstr = new wchar_t [dlen]; |
|
|
1012 | |
|
|
1013 | // decode |
|
|
1014 | wchar_t *r = rstr; |
|
|
1015 | for (wchar_t *s = wstr; *s; s++) |
|
|
1016 | if (*s == NOCHAR) |
|
|
1017 | ; |
|
|
1018 | else if (IS_COMPOSE (*s)) |
|
|
1019 | r += rxvt_composite.expand (*s, r); |
|
|
1020 | else |
|
|
1021 | *r++ = *s; |
|
|
1022 | |
|
|
1023 | RETVAL = wcs2sv (rstr, r - rstr); |
|
|
1024 | |
|
|
1025 | delete [] rstr; |
|
|
1026 | } |
|
|
1027 | OUTPUT: |
|
|
1028 | RETVAL |
840 | |
1029 | |
841 | void |
1030 | void |
842 | rxvt_term::_resource (char *name, int index, SV *newval = 0) |
1031 | rxvt_term::_resource (char *name, int index, SV *newval = 0) |
843 | PPCODE: |
1032 | PPCODE: |
844 | { |
1033 | { |
… | |
… | |
916 | void |
1105 | void |
917 | rxvt_term::selection (SV *newtext = 0) |
1106 | rxvt_term::selection (SV *newtext = 0) |
918 | PPCODE: |
1107 | PPCODE: |
919 | { |
1108 | { |
920 | if (GIMME_V != G_VOID) |
1109 | if (GIMME_V != G_VOID) |
921 | { |
1110 | XPUSHs (sv_2mortal (wcs2sv (THIS->selection.text, THIS->selection.len))); |
922 | char *sel = rxvt_wcstoutf8 (THIS->selection.text, THIS->selection.len); |
|
|
923 | SV *sv = newSVpv (sel, 0); |
|
|
924 | SvUTF8_on (sv); |
|
|
925 | free (sel); |
|
|
926 | XPUSHs (sv_2mortal (sv)); |
|
|
927 | } |
|
|
928 | |
1111 | |
929 | if (newtext) |
1112 | if (newtext) |
930 | { |
1113 | { |
931 | free (THIS->selection.text); |
1114 | free (THIS->selection.text); |
932 | |
1115 | |
933 | THIS->selection.text = sv2wcs (newtext); |
1116 | THIS->selection.text = sv2wcs (newtext); |
934 | THIS->selection.len = wcslen (THIS->selection.text); |
1117 | THIS->selection.len = wcslen (THIS->selection.text); |
935 | } |
1118 | } |
|
|
1119 | } |
|
|
1120 | |
|
|
1121 | void |
|
|
1122 | rxvt_term::scr_add_lines (SV *string) |
|
|
1123 | CODE: |
|
|
1124 | { |
|
|
1125 | wchar_t *wstr = sv2wcs (string); |
|
|
1126 | THIS->scr_add_lines (wstr, wcslen (wstr)); |
|
|
1127 | free (wstr); |
936 | } |
1128 | } |
937 | |
1129 | |
938 | void |
1130 | void |
939 | rxvt_term::tt_write (SV *octets) |
1131 | rxvt_term::tt_write (SV *octets) |
940 | INIT: |
1132 | INIT: |
941 | STRLEN len; |
1133 | STRLEN len; |
942 | char *str = SvPVbyte (octets, len); |
1134 | char *str = SvPVbyte (octets, len); |
943 | C_ARGS: |
1135 | C_ARGS: |
944 | str, len |
1136 | str, len |
945 | |
1137 | |
|
|
1138 | void |
|
|
1139 | rxvt_term::cmd_parse (SV *octets) |
|
|
1140 | CODE: |
|
|
1141 | { |
|
|
1142 | STRLEN len; |
|
|
1143 | char *str = SvPVbyte (octets, len); |
|
|
1144 | |
|
|
1145 | char *old_cmdbuf_ptr = THIS->cmdbuf_ptr; |
|
|
1146 | char *old_cmdbuf_endp = THIS->cmdbuf_endp; |
|
|
1147 | |
|
|
1148 | THIS->cmdbuf_ptr = str; |
|
|
1149 | THIS->cmdbuf_endp = str + len; |
|
|
1150 | |
|
|
1151 | THIS->cmd_parse (); |
|
|
1152 | |
|
|
1153 | THIS->cmdbuf_ptr = old_cmdbuf_ptr; |
|
|
1154 | THIS->cmdbuf_endp = old_cmdbuf_endp; |
|
|
1155 | } |
|
|
1156 | |
946 | SV * |
1157 | SV * |
947 | rxvt_term::overlay (int x, int y, int w, int h, int rstyle = OVERLAY_RSTYLE, int border = 2) |
1158 | rxvt_term::overlay (int x, int y, int w, int h, int rstyle = OVERLAY_RSTYLE, int border = 2) |
948 | CODE: |
1159 | CODE: |
949 | { |
1160 | { |
950 | overlay *o = new overlay (THIS, x, y, w, h, rstyle, border); |
1161 | overlay *o = new overlay (THIS, x, y, w, h, rstyle, border); |