… | |
… | |
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 (x_root, xe->xmotion.x_root); |
|
|
507 | setiv (y_root, xe->xmotion.y_root); |
|
|
508 | setiv (state, xe->xmotion.state); |
|
|
509 | break; |
|
|
510 | } |
|
|
511 | |
|
|
512 | switch (xe->type) |
|
|
513 | { |
|
|
514 | case KeyPress: |
|
|
515 | case KeyRelease: |
|
|
516 | setiv (keycode, xe->xkey.keycode); |
|
|
517 | break; |
|
|
518 | |
|
|
519 | case ButtonPress: |
|
|
520 | case ButtonRelease: |
|
|
521 | setiv (button, xe->xbutton.button); |
|
|
522 | break; |
|
|
523 | |
|
|
524 | case MotionNotify: |
|
|
525 | setiv (is_hint, xe->xmotion.is_hint); |
|
|
526 | break; |
|
|
527 | } |
|
|
528 | |
|
|
529 | XPUSHs (sv_2mortal (newRV_noinc ((SV *)hv))); |
|
|
530 | } |
|
|
531 | break; |
|
|
532 | |
474 | case DT_USTRING_LEN: |
533 | case DT_USTRING_LEN: |
475 | { |
534 | { |
476 | unicode_t *ustr = va_arg (ap, unicode_t *); |
535 | unicode_t *ustr = va_arg (ap, unicode_t *); |
477 | int ulen = va_arg (ap, int); |
536 | int ulen = va_arg (ap, int); |
478 | wchar_t *wstr = new wchar_t [ulen]; |
537 | wchar_t *wstr = new wchar_t [ulen]; |
… | |
… | |
544 | export_const (RS_Uline); |
603 | export_const (RS_Uline); |
545 | |
604 | |
546 | sv_setpv (get_sv ("urxvt::LIBDIR", 1), LIBDIR); |
605 | sv_setpv (get_sv ("urxvt::LIBDIR", 1), LIBDIR); |
547 | } |
606 | } |
548 | |
607 | |
|
|
608 | SV * |
|
|
609 | new (...) |
|
|
610 | CODE: |
|
|
611 | { |
|
|
612 | stringvec *argv = new stringvec; |
|
|
613 | bool success; |
|
|
614 | |
|
|
615 | for (int i = 0; i < items ;i++) |
|
|
616 | argv->push_back (strdup (SvPVbyte_nolen (ST (i)))); |
|
|
617 | |
|
|
618 | rxvt_term *term = new rxvt_term; |
|
|
619 | |
|
|
620 | term->argv = argv; |
|
|
621 | |
|
|
622 | try |
|
|
623 | { |
|
|
624 | if (!term->init (argv->size (), argv->begin ())) |
|
|
625 | term = 0; |
|
|
626 | } |
|
|
627 | catch (const class rxvt_failure_exception &e) |
|
|
628 | { |
|
|
629 | term->destroy (); |
|
|
630 | croak ("exception caught while initializing new terminal instance"); |
|
|
631 | } |
|
|
632 | |
|
|
633 | RETVAL = term && term->self ? newSVterm (term) : &PL_sv_undef; |
|
|
634 | } |
|
|
635 | OUTPUT: |
|
|
636 | RETVAL |
|
|
637 | |
549 | void |
638 | void |
550 | set_should_invoke (int htype, int value) |
639 | set_should_invoke (int htype, int value) |
551 | CODE: |
640 | CODE: |
552 | rxvt_perl.should_invoke [htype] = value; |
641 | rxvt_perl.should_invoke [htype] = value; |
553 | |
642 | |
… | |
… | |
615 | } |
704 | } |
616 | OUTPUT: |
705 | OUTPUT: |
617 | RETVAL |
706 | RETVAL |
618 | |
707 | |
619 | MODULE = urxvt PACKAGE = urxvt::term |
708 | MODULE = urxvt PACKAGE = urxvt::term |
|
|
709 | |
|
|
710 | void |
|
|
711 | rxvt_term::destroy () |
620 | |
712 | |
621 | int |
713 | int |
622 | rxvt_term::strwidth (SV *str) |
714 | rxvt_term::strwidth (SV *str) |
623 | CODE: |
715 | CODE: |
624 | { |
716 | { |
… | |
… | |
977 | STRLEN len; |
1069 | STRLEN len; |
978 | char *str = SvPVbyte (octets, len); |
1070 | char *str = SvPVbyte (octets, len); |
979 | C_ARGS: |
1071 | C_ARGS: |
980 | str, len |
1072 | str, len |
981 | |
1073 | |
|
|
1074 | void |
|
|
1075 | rxvt_term::cmd_parse (SV *octets) |
|
|
1076 | CODE: |
|
|
1077 | { |
|
|
1078 | STRLEN len; |
|
|
1079 | char *str = SvPVbyte (octets, len); |
|
|
1080 | |
|
|
1081 | char *old_cmdbuf_ptr = THIS->cmdbuf_ptr; |
|
|
1082 | char *old_cmdbuf_endp = THIS->cmdbuf_endp; |
|
|
1083 | |
|
|
1084 | THIS->cmdbuf_ptr = str; |
|
|
1085 | THIS->cmdbuf_endp = str + len; |
|
|
1086 | |
|
|
1087 | THIS->cmd_parse (); |
|
|
1088 | |
|
|
1089 | THIS->cmdbuf_ptr = old_cmdbuf_ptr; |
|
|
1090 | THIS->cmdbuf_endp = old_cmdbuf_endp; |
|
|
1091 | } |
|
|
1092 | |
982 | SV * |
1093 | SV * |
983 | rxvt_term::overlay (int x, int y, int w, int h, int rstyle = OVERLAY_RSTYLE, int border = 2) |
1094 | rxvt_term::overlay (int x, int y, int w, int h, int rstyle = OVERLAY_RSTYLE, int border = 2) |
984 | CODE: |
1095 | CODE: |
985 | { |
1096 | { |
986 | overlay *o = new overlay (THIS, x, y, w, h, rstyle, border); |
1097 | overlay *o = new overlay (THIS, x, y, w, h, rstyle, border); |