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.53 by root, Tue Jan 10 04:49:54 2006 UTC vs.
Revision 1.56 by root, Thu Jan 12 00:35:39 2006 UTC

411void 411void
412rxvt_perl_interp::init () 412rxvt_perl_interp::init ()
413{ 413{
414 if (!perl) 414 if (!perl)
415 { 415 {
416 temp_environ temp_environ(rxvt_environ);
417
416 char *argv[] = { 418 char *argv[] = {
417 "", 419 "",
418 "-T", 420 "-T",
419 "-edo '" LIBDIR "/urxvt.pm' or ($@ and die $@) or exit 1", 421 "-edo '" LIBDIR "/urxvt.pm' or ($@ and die $@) or exit 1",
420 }; 422 };
479 } 481 }
480 482
481 if (!should_invoke [htype]) 483 if (!should_invoke [htype])
482 return false; 484 return false;
483 } 485 }
486
487 temp_environ temp_environ(rxvt_environ);
484 488
485 dSP; 489 dSP;
486 va_list ap; 490 va_list ap;
487 491
488 va_start (ap, htype); 492 va_start (ap, htype);
675 export_const_iv (EVENT_NONE); 679 export_const_iv (EVENT_NONE);
676 export_const_iv (EVENT_READ); 680 export_const_iv (EVENT_READ);
677 export_const_iv (EVENT_WRITE); 681 export_const_iv (EVENT_WRITE);
678} 682}
679 683
680SV *
681new (...)
682 CODE:
683{
684 stringvec *argv = new stringvec;
685 bool success;
686
687 for (int i = 0; i < items ;i++)
688 argv->push_back (strdup (SvPVbyte_nolen (ST (i))));
689
690 rxvt_term *term = new rxvt_term;
691
692 term->argv = argv;
693
694 try
695 {
696 if (!term->init (argv->size (), argv->begin ()))
697 term = 0;
698 }
699 catch (const class rxvt_failure_exception &e)
700 {
701 term->destroy ();
702 croak ("exception caught while initializing new terminal instance");
703 }
704
705 RETVAL = term && term->perl.self ? newSVterm (term) : &PL_sv_undef;
706}
707 OUTPUT:
708 RETVAL
709
710void 684void
711set_should_invoke (int htype, int value) 685set_should_invoke (int htype, int value)
712 CODE: 686 CODE:
713 rxvt_perl.should_invoke [htype] = value; 687 rxvt_perl.should_invoke [htype] = value;
714 688
791} 765}
792 OUTPUT: 766 OUTPUT:
793 RETVAL 767 RETVAL
794 768
795MODULE = urxvt PACKAGE = urxvt::term 769MODULE = urxvt PACKAGE = urxvt::term
770
771SV *
772_new (...)
773 CODE:
774{
775 if (items < 1 || !SvROK (ST (0)) || SvTYPE (SvRV (ST (0))) != SVt_PVAV)
776 croak ("first argument to urxvt::term->_new must be arrayref");
777
778 rxvt_term *term = new rxvt_term;
779
780 term->argv = new stringvec;
781 term->envv = new stringvec;
782
783 for (int i = 1; i < items; i++)
784 term->argv->push_back (strdup (SvPVbyte_nolen (ST (i))));
785
786 AV *envv = (AV *)SvRV (ST (0));
787 for (int i = av_len (envv) + 1; i--; )
788 term->envv->push_back (strdup (SvPVbyte_nolen (*av_fetch (envv, i, 1))));
789
790 term->envv->push_back (0);
791
792 bool success;
793
794 try
795 {
796 success = term->init (term->argv->size (), term->argv->begin ());
797 }
798 catch (const class rxvt_failure_exception &e)
799 {
800 success = false;
801 }
802
803 if (!success)
804 {
805 term->destroy ();
806 croak ("error while initializing new terminal instance");
807 }
808
809 RETVAL = term && term->perl.self
810 ? newSVterm (term) : &PL_sv_undef;
811}
812 OUTPUT:
813 RETVAL
796 814
797void 815void
798rxvt_term::destroy () 816rxvt_term::destroy ()
799 817
800void 818void
959 case 1: RETVAL = THIS->locale; break; 977 case 1: RETVAL = THIS->locale; break;
960 } 978 }
961 OUTPUT: 979 OUTPUT:
962 RETVAL 980 RETVAL
963 981
982SV *
983rxvt_term::_env ()
984 CODE:
985{
986 if (THIS->envv)
987 {
988 AV *av = newAV ();
989
990 for (char **i = THIS->envv->begin (); i != THIS->envv->end (); ++i)
991 if (*i)
992 av_push (av, newSVpv (*i, 0));
993
994 RETVAL = newRV_noinc ((SV *)av);
995 }
996 else
997 RETVAL = &PL_sv_undef;
998}
999 OUTPUT:
1000 RETVAL
1001
964int 1002int
965rxvt_term::pty_ev_events (int events = EVENT_UNDEF) 1003rxvt_term::pty_ev_events (int events = EVENT_UNDEF)
966 CODE: 1004 CODE:
967 RETVAL = THIS->pty_ev.events; 1005 RETVAL = THIS->pty_ev.events;
968 if (events != EVENT_UNDEF) 1006 if (events != EVENT_UNDEF)
1242 else 1280 else
1243 THIS->rs [index] = 0; 1281 THIS->rs [index] = 0;
1244 } 1282 }
1245} 1283}
1246 1284
1285const char *
1286rxvt_term::x_resource (const char *name)
1287 CLEANUP:
1288 SvTAINTED_on (ST (0));
1289
1247bool 1290bool
1248rxvt_term::option (U32 optval, int set = -1) 1291rxvt_term::option (U32 optval, int set = -1)
1249 CODE: 1292 CODE:
1250{ 1293{
1251 RETVAL = THIS->options & optval; 1294 RETVAL = THIS->options & optval;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines