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.29 by root, Fri Jan 6 03:40:19 2006 UTC vs.
Revision 1.32 by root, Fri Jan 6 18:33:30 2006 UTC

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.
465 465
466 case DT_LONG: 466 case DT_LONG:
467 XPUSHs (sv_2mortal (newSViv (va_arg (ap, long)))); 467 XPUSHs (sv_2mortal (newSViv (va_arg (ap, long))));
468 break; 468 break;
469 469
470 case DT_STRING: 470 case DT_STR:
471 XPUSHs (sv_2mortal (newSVpv (va_arg (ap, char *), 0))); 471 XPUSHs (sv_2mortal (newSVpv (va_arg (ap, char *), 0)));
472 break; 472 break;
473 473
474 case DT_STRING_LEN: 474 case DT_STR_LEN:
475 { 475 {
476 char *str = va_arg (ap, char *); 476 char *str = va_arg (ap, char *);
477 int len = va_arg (ap, int); 477 int len = va_arg (ap, int);
478 478
479 XPUSHs (sv_2mortal (newSVpvn (str, len))); 479 XPUSHs (sv_2mortal (newSVpvn (str, len)));
480 } 480 }
481 break; 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 }
482 490
483 case DT_XEVENT: 491 case DT_XEVENT:
484 { 492 {
485 XEvent *xe = va_arg (ap, XEvent *); 493 XEvent *xe = va_arg (ap, XEvent *);
486 HV *hv = newHV (); 494 HV *hv = newHV ();
501 case ButtonRelease: 509 case ButtonRelease:
502 case MotionNotify: 510 case MotionNotify:
503 setiv (time, xe->xmotion.time); 511 setiv (time, xe->xmotion.time);
504 setiv (x, xe->xmotion.x); 512 setiv (x, xe->xmotion.x);
505 setiv (y, xe->xmotion.y); 513 setiv (y, xe->xmotion.y);
514 setiv (row, xe->xmotion.y / term->fheight);
515 setiv (col, xe->xmotion.x / term->fwidth);
506 setiv (x_root, xe->xmotion.x_root); 516 setiv (x_root, xe->xmotion.x_root);
507 setiv (y_root, xe->xmotion.y_root); 517 setiv (y_root, xe->xmotion.y_root);
508 setiv (state, xe->xmotion.state); 518 setiv (state, xe->xmotion.state);
509 break; 519 break;
510 } 520 }
527 } 537 }
528 538
529 XPUSHs (sv_2mortal (newRV_noinc ((SV *)hv))); 539 XPUSHs (sv_2mortal (newRV_noinc ((SV *)hv)));
530 } 540 }
531 break; 541 break;
532
533 case DT_USTRING_LEN:
534 {
535 unicode_t *ustr = va_arg (ap, unicode_t *);
536 int ulen = va_arg (ap, int);
537 wchar_t *wstr = new wchar_t [ulen];
538
539 for (int i = ulen; i--; )
540 wstr [i] = ustr [i];
541
542 XPUSHs (sv_2mortal (wcs2sv (wstr, ulen)));
543
544 delete [] wstr;
545 }
546 542
547 case DT_END: 543 case DT_END:
548 { 544 {
549 va_end (ap); 545 va_end (ap);
550 546
795 RETVAL = *(int *)((char *)THIS + ix); 791 RETVAL = *(int *)((char *)THIS + ix);
796 OUTPUT: 792 OUTPUT:
797 RETVAL 793 RETVAL
798 794
799U32 795U32
796rxvt_term::parent ()
797 CODE:
798 RETVAL = (U32)THIS->parent [0];
799 OUTPUT:
800 RETVAL
801
802U32
803rxvt_term::vt ()
804 CODE:
805 RETVAL = (U32)THIS->vt;
806 OUTPUT:
807 RETVAL
808
809U32
800rxvt_term::rstyle (U32 new_rstyle = THIS->rstyle) 810rxvt_term::rstyle (U32 new_rstyle = THIS->rstyle)
801 CODE: 811 CODE:
802{ 812{
803 RETVAL = THIS->rstyle; 813 RETVAL = THIS->rstyle;
804 THIS->rstyle = new_rstyle; 814 THIS->rstyle = new_rstyle;
1045void 1055void
1046rxvt_term::scr_add_lines (SV *string) 1056rxvt_term::scr_add_lines (SV *string)
1047 CODE: 1057 CODE:
1048{ 1058{
1049 wchar_t *wstr = sv2wcs (string); 1059 wchar_t *wstr = sv2wcs (string);
1050 int wlen = wcslen (wstr);
1051 unicode_t *ustr = new unicode_t [wlen];
1052 int nlines = 0;
1053
1054 for (int i = wlen; i--; )
1055 {
1056 ustr [i] = wstr [i];
1057 nlines += ustr [i] == '\012';
1058 }
1059
1060 THIS->scr_add_lines (ustr, nlines, wlen); 1060 THIS->scr_add_lines (wstr, wcslen (wstr));
1061
1062 free (wstr); 1061 free (wstr);
1063 delete [] ustr;
1064} 1062}
1065 1063
1066void 1064void
1067rxvt_term::tt_write (SV *octets) 1065rxvt_term::tt_write (SV *octets)
1068 INIT: 1066 INIT:

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines