ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/rxvt-unicode/src/rxvtperl.xs
(Generate patch)

Comparing rxvt-unicode/src/rxvtperl.xs (file contents):
Revision 1.32 by root, Fri Jan 6 18:33:30 2006 UTC vs.
Revision 1.34 by root, Fri Jan 6 21:06:09 2006 UTC

485 wchar_t *wstr = va_arg (ap, wchar_t *); 485 wchar_t *wstr = va_arg (ap, wchar_t *);
486 int wlen = va_arg (ap, int); 486 int wlen = va_arg (ap, int);
487 487
488 XPUSHs (sv_2mortal (wcs2sv (wstr, wlen))); 488 XPUSHs (sv_2mortal (wcs2sv (wstr, wlen)));
489 } 489 }
490 break;
490 491
491 case DT_XEVENT: 492 case DT_XEVENT:
492 { 493 {
493 XEvent *xe = va_arg (ap, XEvent *); 494 XEvent *xe = va_arg (ap, XEvent *);
494 HV *hv = newHV (); 495 HV *hv = newHV ();
847 848
848 if (GIMME_V != G_VOID) 849 if (GIMME_V != G_VOID)
849 { 850 {
850 wchar_t *wstr = new wchar_t [THIS->ncol]; 851 wchar_t *wstr = new wchar_t [THIS->ncol];
851 852
852 for (int col = 0; col <THIS->ncol; col++) 853 for (int col = 0; col < THIS->ncol; col++)
853 wstr [col] = l.t [col]; 854 wstr [col] = l.t [col];
854 855
855 XPUSHs (sv_2mortal (wcs2sv (wstr))); 856 XPUSHs (sv_2mortal (wcs2sv (wstr, THIS->ncol)));
856 857
857 delete [] wstr; 858 delete [] wstr;
858 } 859 }
859 860
860 if (new_text) 861 if (new_text)
950} 951}
951 OUTPUT: 952 OUTPUT:
952 RETVAL 953 RETVAL
953 954
954SV * 955SV *
955rxvt_term::special_encode (SV *str) 956rxvt_term::special_encode (SV *string)
956 CODE: 957 CODE:
957 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
958 993
959SV * 994SV *
960rxvt_term::special_decode (SV *str) 995rxvt_term::special_decode (SV *text)
961 CODE: 996 CODE:
962 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
963 1029
964void 1030void
965rxvt_term::_resource (char *name, int index, SV *newval = 0) 1031rxvt_term::_resource (char *name, int index, SV *newval = 0)
966 PPCODE: 1032 PPCODE:
967{ 1033{

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines