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.51 by root, Mon Jan 9 23:00:07 2006 UTC vs.
Revision 1.55 by root, Wed Jan 11 02:13:56 2006 UTC

627 627
628PROTOTYPES: ENABLE 628PROTOTYPES: ENABLE
629 629
630BOOT: 630BOOT:
631{ 631{
632 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));
633 636
634 AV *hookname = get_av ("urxvt::HOOKNAME", 1); 637 AV *hookname = get_av ("urxvt::HOOKNAME", 1);
635# define def(sym) av_store (hookname, HOOK_ ## sym, newSVpv (# sym, 0)); 638# define def(sym) av_store (hookname, HOOK_ ## sym, newSVpv (# sym, 0));
636# include "hookinc.h" 639# include "hookinc.h"
637# undef def 640# undef def
672 export_const_iv (EVENT_NONE); 675 export_const_iv (EVENT_NONE);
673 export_const_iv (EVENT_READ); 676 export_const_iv (EVENT_READ);
674 export_const_iv (EVENT_WRITE); 677 export_const_iv (EVENT_WRITE);
675} 678}
676 679
677SV *
678new (...)
679 CODE:
680{
681 stringvec *argv = new stringvec;
682 bool success;
683
684 for (int i = 0; i < items ;i++)
685 argv->push_back (strdup (SvPVbyte_nolen (ST (i))));
686
687 rxvt_term *term = new rxvt_term;
688
689 term->argv = argv;
690
691 try
692 {
693 if (!term->init (argv->size (), argv->begin ()))
694 term = 0;
695 }
696 catch (const class rxvt_failure_exception &e)
697 {
698 term->destroy ();
699 croak ("exception caught while initializing new terminal instance");
700 }
701
702 RETVAL = term && term->perl.self ? newSVterm (term) : &PL_sv_undef;
703}
704 OUTPUT:
705 RETVAL
706
707void 680void
708set_should_invoke (int htype, int value) 681set_should_invoke (int htype, int value)
709 CODE: 682 CODE:
710 rxvt_perl.should_invoke [htype] = value; 683 rxvt_perl.should_invoke [htype] = value;
711 684
788} 761}
789 OUTPUT: 762 OUTPUT:
790 RETVAL 763 RETVAL
791 764
792MODULE = 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
793 810
794void 811void
795rxvt_term::destroy () 812rxvt_term::destroy ()
796 813
797void 814void
956 case 1: RETVAL = THIS->locale; break; 973 case 1: RETVAL = THIS->locale; break;
957 } 974 }
958 OUTPUT: 975 OUTPUT:
959 RETVAL 976 RETVAL
960 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
961int 998int
962rxvt_term::pty_ev_events (int events = EVENT_UNDEF) 999rxvt_term::pty_ev_events (int events = EVENT_UNDEF)
963 CODE: 1000 CODE:
964 RETVAL = THIS->pty_ev.events; 1001 RETVAL = THIS->pty_ev.events;
965 if (events != EVENT_UNDEF) 1002 if (events != EVENT_UNDEF)
1239 else 1276 else
1240 THIS->rs [index] = 0; 1277 THIS->rs [index] = 0;
1241 } 1278 }
1242} 1279}
1243 1280
1281const char *
1282rxvt_term::x_resource (const char *name)
1283 CLEANUP:
1284 SvTAINTED_on (ST (0));
1285
1244bool 1286bool
1245rxvt_term::option (U32 optval, int set = -1) 1287rxvt_term::option (U32 optval, int set = -1)
1246 CODE: 1288 CODE:
1247{ 1289{
1248 RETVAL = THIS->options & optval; 1290 RETVAL = THIS->options & optval;
1315 if (ix) 1357 if (ix)
1316 THIS->want_refresh = 1; 1358 THIS->want_refresh = 1;
1317 } 1359 }
1318} 1360}
1319 1361
1362char
1363rxvt_term::cur_charset ()
1364 CODE:
1365 RETVAL = THIS->charsets [THIS->screen.charset];
1366 OUTPUT:
1367 RETVAL
1368
1320int 1369int
1321rxvt_term::selection_grab (U32 eventtime) 1370rxvt_term::selection_grab (U32 eventtime)
1322 1371
1323void 1372void
1324rxvt_term::selection (SV *newtext = 0) 1373rxvt_term::selection (SV *newtext = 0)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines