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.27 by root, Fri Jan 6 01:16:58 2006 UTC vs.
Revision 1.30 by root, Fri Jan 6 05:28:55 2006 UTC

469 469
470 case DT_STRING: 470 case DT_STRING:
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:
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_XEVENT:
484 {
485 XEvent *xe = va_arg (ap, XEvent *);
486 HV *hv = newHV ();
487
488# define set(name, sv) hv_store (hv, # name, sizeof (# name) - 1, sv, 0)
489# define setiv(name, val) hv_store (hv, # name, sizeof (# name) - 1, newSViv (val), 0)
490# undef set
491
492 setiv (type, xe->type);
493 setiv (send_event, xe->xany.send_event);
494 setiv (serial, xe->xany.serial);
495
496 switch (xe->type)
497 {
498 case KeyPress:
499 case KeyRelease:
500 case ButtonPress:
501 case ButtonRelease:
502 case MotionNotify:
503 setiv (time, xe->xmotion.time);
504 setiv (x, xe->xmotion.x);
505 setiv (y, xe->xmotion.y);
506 setiv (row, xe->xmotion.y / term->fheight);
507 setiv (col, xe->xmotion.x / term->fwidth);
508 setiv (x_root, xe->xmotion.x_root);
509 setiv (y_root, xe->xmotion.y_root);
510 setiv (state, xe->xmotion.state);
511 break;
512 }
513
514 switch (xe->type)
515 {
516 case KeyPress:
517 case KeyRelease:
518 setiv (keycode, xe->xkey.keycode);
519 break;
520
521 case ButtonPress:
522 case ButtonRelease:
523 setiv (button, xe->xbutton.button);
524 break;
525
526 case MotionNotify:
527 setiv (is_hint, xe->xmotion.is_hint);
528 break;
529 }
530
531 XPUSHs (sv_2mortal (newRV_noinc ((SV *)hv)));
532 }
533 break;
534
474 case DT_USTRING_LEN: 535 case DT_USTRING_LEN:
475 { 536 {
476 unicode_t *ustr = va_arg (ap, unicode_t *); 537 unicode_t *ustr = va_arg (ap, unicode_t *);
477 int ulen = va_arg (ap, int); 538 int ulen = va_arg (ap, int);
478 wchar_t *wstr = new wchar_t [ulen]; 539 wchar_t *wstr = new wchar_t [ulen];
544 export_const (RS_Uline); 605 export_const (RS_Uline);
545 606
546 sv_setpv (get_sv ("urxvt::LIBDIR", 1), LIBDIR); 607 sv_setpv (get_sv ("urxvt::LIBDIR", 1), LIBDIR);
547} 608}
548 609
610SV *
611new (...)
612 CODE:
613{
614 stringvec *argv = new stringvec;
615 bool success;
616
617 for (int i = 0; i < items ;i++)
618 argv->push_back (strdup (SvPVbyte_nolen (ST (i))));
619
620 rxvt_term *term = new rxvt_term;
621
622 term->argv = argv;
623
624 try
625 {
626 if (!term->init (argv->size (), argv->begin ()))
627 term = 0;
628 }
629 catch (const class rxvt_failure_exception &e)
630 {
631 term->destroy ();
632 croak ("exception caught while initializing new terminal instance");
633 }
634
635 RETVAL = term && term->self ? newSVterm (term) : &PL_sv_undef;
636}
637 OUTPUT:
638 RETVAL
639
549void 640void
550set_should_invoke (int htype, int value) 641set_should_invoke (int htype, int value)
551 CODE: 642 CODE:
552 rxvt_perl.should_invoke [htype] = value; 643 rxvt_perl.should_invoke [htype] = value;
553 644
615} 706}
616 OUTPUT: 707 OUTPUT:
617 RETVAL 708 RETVAL
618 709
619MODULE = urxvt PACKAGE = urxvt::term 710MODULE = urxvt PACKAGE = urxvt::term
711
712void
713rxvt_term::destroy ()
620 714
621int 715int
622rxvt_term::strwidth (SV *str) 716rxvt_term::strwidth (SV *str)
623 CODE: 717 CODE:
624{ 718{
703 RETVAL = *(int *)((char *)THIS + ix); 797 RETVAL = *(int *)((char *)THIS + ix);
704 OUTPUT: 798 OUTPUT:
705 RETVAL 799 RETVAL
706 800
707U32 801U32
802rxvt_term::vt ()
803 CODE:
804 RETVAL = THIS->vt;
805 OUTPUT:
806 RETVAL
807
808U32
708rxvt_term::rstyle (U32 new_rstyle = THIS->rstyle) 809rxvt_term::rstyle (U32 new_rstyle = THIS->rstyle)
709 CODE: 810 CODE:
710{ 811{
711 RETVAL = THIS->rstyle; 812 RETVAL = THIS->rstyle;
712 THIS->rstyle = new_rstyle; 813 THIS->rstyle = new_rstyle;
977 STRLEN len; 1078 STRLEN len;
978 char *str = SvPVbyte (octets, len); 1079 char *str = SvPVbyte (octets, len);
979 C_ARGS: 1080 C_ARGS:
980 str, len 1081 str, len
981 1082
1083void
1084rxvt_term::cmd_parse (SV *octets)
1085 CODE:
1086{
1087 STRLEN len;
1088 char *str = SvPVbyte (octets, len);
1089
1090 char *old_cmdbuf_ptr = THIS->cmdbuf_ptr;
1091 char *old_cmdbuf_endp = THIS->cmdbuf_endp;
1092
1093 THIS->cmdbuf_ptr = str;
1094 THIS->cmdbuf_endp = str + len;
1095
1096 THIS->cmd_parse ();
1097
1098 THIS->cmdbuf_ptr = old_cmdbuf_ptr;
1099 THIS->cmdbuf_endp = old_cmdbuf_endp;
1100}
1101
982SV * 1102SV *
983rxvt_term::overlay (int x, int y, int w, int h, int rstyle = OVERLAY_RSTYLE, int border = 2) 1103rxvt_term::overlay (int x, int y, int w, int h, int rstyle = OVERLAY_RSTYLE, int border = 2)
984 CODE: 1104 CODE:
985{ 1105{
986 overlay *o = new overlay (THIS, x, y, w, h, rstyle, border); 1106 overlay *o = new overlay (THIS, x, y, w, h, rstyle, border);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines