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.47 by root, Mon Jan 9 02:06:43 2006 UTC vs.
Revision 1.54 by root, Wed Jan 11 00:59:58 2006 UTC

29#include "../config.h" 29#include "../config.h"
30 30
31#include <cstddef> 31#include <cstddef>
32#include <cstdarg> 32#include <cstdarg>
33 33
34#include "iom.h"
34#include "rxvt.h" 35#include "rxvt.h"
35#include "iom.h" 36#include "keyboard.h"
36#include "rxvtutil.h" 37#include "rxvtutil.h"
37#include "rxvtperl.h" 38#include "rxvtperl.h"
38 39
39#include "perlxsi.c" 40#include "perlxsi.c"
40 41
459 return false; // perl not initialized for this instance 460 return false; // perl not initialized for this instance
460 else if (htype == HOOK_DESTROY) 461 else if (htype == HOOK_DESTROY)
461 { 462 {
462 // handled later 463 // handled later
463 } 464 }
464 else if (htype == HOOK_REFRESH_BEGIN || htype == HOOK_REFRESH_END) 465 else
465 { 466 {
466 HV *hv = (HV *)SvRV (*hv_fetch ((HV *)SvRV ((SV *)term->perl.self), "_overlay", 8, 0)); 467 if (htype == HOOK_REFRESH_BEGIN || htype == HOOK_REFRESH_END)
467
468 if (HvKEYS (hv))
469 { 468 {
469 HV *hv = (HV *)SvRV (*hv_fetch ((HV *)SvRV ((SV *)term->perl.self), "_overlay", 8, 0));
470
471 if (HvKEYS (hv))
472 {
470 hv_iterinit (hv); 473 hv_iterinit (hv);
471 474
472 while (HE *he = hv_iternext (hv)) 475 while (HE *he = hv_iternext (hv))
473 ((overlay *)SvIV (hv_iterval (hv, he)))->swap (); 476 ((overlay *)SvIV (hv_iterval (hv, he)))->swap ();
477 }
478
474 } 479 }
480
481 if (!should_invoke [htype])
482 return false;
475 } 483 }
476 else if (!should_invoke [htype])
477 return false;
478 484
479 dSP; 485 dSP;
480 va_list ap; 486 va_list ap;
481 487
482 va_start (ap, htype); 488 va_start (ap, htype);
621 627
622PROTOTYPES: ENABLE 628PROTOTYPES: ENABLE
623 629
624BOOT: 630BOOT:
625{ 631{
626 sv_setsv (get_sv ("urxvt::LIBDIR", 1), newSVpvn (LIBDIR, sizeof (LIBDIR) - 1)); 632 sv_setsv (get_sv ("urxvt::LIBDIR", 1), newSVpvn (LIBDIR, sizeof (LIBDIR) - 1));
633 sv_setsv (get_sv ("urxvt::RESNAME", 1), newSVpvn (RESNAME, sizeof (RESNAME) - 1));
634 sv_setsv (get_sv ("urxvt::RESCLASS", 1), newSVpvn (RESCLASS, sizeof (RESCLASS) - 1));
635 sv_setsv (get_sv ("urxvt::RXVTNAME", 1), newSVpvn (RXVTNAME, sizeof (RXVTNAME) - 1));
627 636
628 AV *hookname = get_av ("urxvt::HOOKNAME", 1); 637 AV *hookname = get_av ("urxvt::HOOKNAME", 1);
629# define def(sym) av_store (hookname, HOOK_ ## sym, newSVpv (# sym, 0)); 638# define def(sym) av_store (hookname, HOOK_ ## sym, newSVpv (# sym, 0));
630# include "hookinc.h" 639# include "hookinc.h"
631# undef def 640# undef def
660 export_const_iv (Button2Mask); 669 export_const_iv (Button2Mask);
661 export_const_iv (Button3Mask); 670 export_const_iv (Button3Mask);
662 export_const_iv (Button4Mask); 671 export_const_iv (Button4Mask);
663 export_const_iv (Button5Mask); 672 export_const_iv (Button5Mask);
664 export_const_iv (AnyModifier); 673 export_const_iv (AnyModifier);
665}
666 674
667SV * 675 export_const_iv (EVENT_NONE);
668new (...) 676 export_const_iv (EVENT_READ);
669 CODE: 677 export_const_iv (EVENT_WRITE);
670{
671 stringvec *argv = new stringvec;
672 bool success;
673
674 for (int i = 0; i < items ;i++)
675 argv->push_back (strdup (SvPVbyte_nolen (ST (i))));
676
677 rxvt_term *term = new rxvt_term;
678
679 term->argv = argv;
680
681 try
682 {
683 if (!term->init (argv->size (), argv->begin ()))
684 term = 0;
685 }
686 catch (const class rxvt_failure_exception &e)
687 {
688 term->destroy ();
689 croak ("exception caught while initializing new terminal instance");
690 }
691
692 RETVAL = term && term->perl.self ? newSVterm (term) : &PL_sv_undef;
693} 678}
694 OUTPUT:
695 RETVAL
696 679
697void 680void
698set_should_invoke (int htype, int value) 681set_should_invoke (int htype, int value)
699 CODE: 682 CODE:
700 rxvt_perl.should_invoke [htype] = value; 683 rxvt_perl.should_invoke [htype] = value;
778} 761}
779 OUTPUT: 762 OUTPUT:
780 RETVAL 763 RETVAL
781 764
782MODULE = urxvt PACKAGE = urxvt::term 765MODULE = urxvt PACKAGE = urxvt::term
766
767SV *
768_new (...)
769 CODE:
770{
771 if (items < 1 || !SvROK (ST (0)) || SvTYPE (SvRV (ST (0))) != SVt_PVAV)
772 croak ("first argument to urxvt::term->_new must be arrayref");
773
774 rxvt_term *term = new rxvt_term;
775
776 term->argv = new stringvec;
777 term->envv = new stringvec;
778
779 for (int i = 1; i < items; i++)
780 term->argv->push_back (strdup (SvPVbyte_nolen (ST (i))));
781
782 AV *envv = (AV *)SvRV (ST (0));
783 for (int i = av_len (envv) + 1; i--; )
784 term->envv->push_back (strdup (SvPVbyte_nolen (*av_fetch (envv, i, 1))));
785
786 term->envv->push_back (0);
787
788 bool success;
789
790 try
791 {
792 success = term->init (term->argv->size (), term->argv->begin ());
793 }
794 catch (const class rxvt_failure_exception &e)
795 {
796 success = false;
797 }
798
799 if (!success)
800 {
801 term->destroy ();
802 croak ("error while initializing new terminal instance");
803 }
804
805 RETVAL = term && term->perl.self
806 ? newSVterm (term) : &PL_sv_undef;
807}
808 OUTPUT:
809 RETVAL
783 810
784void 811void
785rxvt_term::destroy () 812rxvt_term::destroy ()
786 813
787void 814void
932 case 2: RETVAL = THIS->ModNumLockMask; break; 959 case 2: RETVAL = THIS->ModNumLockMask; break;
933 } 960 }
934 OUTPUT: 961 OUTPUT:
935 RETVAL 962 RETVAL
936 963
964char *
965rxvt_term::display_id ()
966 ALIAS:
967 display_id = 0
968 locale = 1
969 CODE:
970 switch (ix)
971 {
972 case 0: RETVAL = THIS->display->id; break;
973 case 1: RETVAL = THIS->locale; break;
974 }
975 OUTPUT:
976 RETVAL
977
978SV *
979rxvt_term::_env ()
980 CODE:
981{
982 if (THIS->envv)
983 {
984 AV *av = newAV ();
985
986 for (char **i = THIS->envv->begin (); i != THIS->envv->end (); ++i)
987 if (*i)
988 av_push (av, newSVpv (*i, 0));
989
990 RETVAL = newRV_noinc ((SV *)av);
991 }
992 else
993 RETVAL = &PL_sv_undef;
994}
995 OUTPUT:
996 RETVAL
997
998int
999rxvt_term::pty_ev_events (int events = EVENT_UNDEF)
1000 CODE:
1001 RETVAL = THIS->pty_ev.events;
1002 if (events != EVENT_UNDEF)
1003 THIS->pty_ev.set (events);
1004 OUTPUT:
1005 RETVAL
1006
937U32 1007U32
938rxvt_term::parent () 1008rxvt_term::parent ()
939 CODE: 1009 CODE:
940 RETVAL = (U32)THIS->parent [0]; 1010 RETVAL = (U32)THIS->parent [0];
941 OUTPUT: 1011 OUTPUT:
1242 } 1312 }
1243} 1313}
1244 OUTPUT: 1314 OUTPUT:
1245 RETVAL 1315 RETVAL
1246 1316
1317bool
1318rxvt_term::parse_keysym (char *keysym, char *str)
1319 CODE:
1320 RETVAL = 0 < THIS->parse_keysym (keysym, str);
1321 THIS->keyboard->register_done ();
1322 OUTPUT:
1323 RETVAL
1324
1247void 1325void
1248rxvt_term::screen_cur (...) 1326rxvt_term::screen_cur (...)
1249 PROTOTYPE: $;$$ 1327 PROTOTYPE: $;$$
1250 ALIAS: 1328 ALIAS:
1251 screen_cur = 0 1329 screen_cur = 0
1274 if (ix) 1352 if (ix)
1275 THIS->want_refresh = 1; 1353 THIS->want_refresh = 1;
1276 } 1354 }
1277} 1355}
1278 1356
1357char
1358rxvt_term::cur_charset ()
1359 CODE:
1360 RETVAL = THIS->charsets [THIS->screen.charset];
1361 OUTPUT:
1362 RETVAL
1363
1279int 1364int
1280rxvt_term::selection_grab (U32 eventtime) 1365rxvt_term::selection_grab (U32 eventtime)
1281 1366
1282void 1367void
1283rxvt_term::selection (SV *newtext = 0) 1368rxvt_term::selection (SV *newtext = 0)
1294 1379
1295 THIS->selection.text = sv2wcs (newtext); 1380 THIS->selection.text = sv2wcs (newtext);
1296 THIS->selection.len = wcslen (THIS->selection.text); 1381 THIS->selection.len = wcslen (THIS->selection.text);
1297 } 1382 }
1298} 1383}
1384
1385void
1386rxvt_term::scr_xor_rect (int beg_row, int beg_col, int end_row, int end_col, U32 rstyle1 = RS_RVid, U32 rstyle2 = RS_RVid | RS_Uline)
1387
1388void
1389rxvt_term::scr_xor_span (int beg_row, int beg_col, int end_row, int end_col, U32 rstyle = RS_RVid)
1390
1391void
1392rxvt_term::scr_bell ()
1299 1393
1300void 1394void
1301rxvt_term::scr_add_lines (SV *string) 1395rxvt_term::scr_add_lines (SV *string)
1302 CODE: 1396 CODE:
1303{ 1397{

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines