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-2008 Marc Lehmann <pcg@goof.com> |
6 | * Copyright (c) 2005-2008,2011 Marc Lehmann <schmorp@schmorp.de> |
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. |
… | |
… | |
413 | ENTER; |
413 | ENTER; |
414 | SAVETMPS; |
414 | SAVETMPS; |
415 | |
415 | |
416 | PUSHMARK (SP); |
416 | PUSHMARK (SP); |
417 | |
417 | |
|
|
418 | EXTEND (SP, 2); |
418 | XPUSHs (sv_2mortal (newSVterm (term))); |
419 | PUSHs (sv_2mortal (newSVterm (term))); |
419 | XPUSHs (sv_2mortal (newSViv (htype))); |
420 | PUSHs (sv_2mortal (newSViv (htype))); |
420 | |
421 | |
421 | for (;;) { |
422 | for (;;) { |
422 | data_type dt = (data_type)va_arg (ap, int); |
423 | data_type dt = (data_type)va_arg (ap, int); |
423 | |
424 | |
424 | switch (dt) |
425 | switch (dt) |
… | |
… | |
581 | FREETMPS; |
582 | FREETMPS; |
582 | LEAVE; |
583 | LEAVE; |
583 | |
584 | |
584 | if (SvTRUE (ERRSV)) |
585 | if (SvTRUE (ERRSV)) |
585 | { |
586 | { |
586 | rxvt_warn ("perl hook %d evaluation error: %s", htype, SvPV_nolen (ERRSV)); |
587 | rxvt_warn ("perl hook %d evaluation error: %s", htype, SvPVbyte_nolen (ERRSV)); |
587 | ungrab (term); // better lose the grab than the session |
588 | ungrab (term); // better lose the grab than the session |
588 | } |
589 | } |
589 | |
590 | |
590 | event_consumed = !!count; |
591 | event_consumed = !!count; |
591 | } |
592 | } |
… | |
… | |
608 | // don't allow further calls |
609 | // don't allow further calls |
609 | term->perl.self = 0; |
610 | term->perl.self = 0; |
610 | } |
611 | } |
611 | |
612 | |
612 | return event_consumed; |
613 | return event_consumed; |
|
|
614 | } |
|
|
615 | |
|
|
616 | void |
|
|
617 | rxvt_perl_interp::selection_finish (rxvt_selection *sel, char *data, unsigned int len) |
|
|
618 | { |
|
|
619 | localise_env set_environ (perl_environ); |
|
|
620 | |
|
|
621 | ENTER; |
|
|
622 | SAVETMPS; |
|
|
623 | |
|
|
624 | dSP; |
|
|
625 | XPUSHs (sv_2mortal (newSVpvn (data, len))); |
|
|
626 | call_sv ((SV *)sel->cb_sv, G_VOID | G_DISCARD | G_EVAL); |
|
|
627 | |
|
|
628 | if (SvTRUE (ERRSV)) |
|
|
629 | rxvt_warn ("perl selection callback evaluation error: %s", SvPVbyte_nolen (ERRSV)); |
|
|
630 | |
|
|
631 | FREETMPS; |
|
|
632 | LEAVE; |
613 | } |
633 | } |
614 | |
634 | |
615 | ///////////////////////////////////////////////////////////////////////////// |
635 | ///////////////////////////////////////////////////////////////////////////// |
616 | |
636 | |
617 | MODULE = urxvt PACKAGE = urxvt |
637 | MODULE = urxvt PACKAGE = urxvt |