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.111 by root, Thu Dec 14 17:33:53 2006 UTC vs.
Revision 1.117 by root, Thu Dec 13 18:24:36 2007 UTC

31#include <cstddef> 31#include <cstddef>
32#include <cstdarg> 32#include <cstdarg>
33 33
34#include "unistd.h" 34#include "unistd.h"
35 35
36#include "iom.h" 36#include "ev_cpp.h"
37#include "rxvt.h" 37#include "rxvt.h"
38#include "keyboard.h" 38#include "keyboard.h"
39#include "rxvtutil.h" 39#include "rxvtutil.h"
40#include "rxvtperl.h" 40#include "rxvtperl.h"
41 41
70 SV *sv = newSVpv (str, 0); 70 SV *sv = newSVpv (str, 0);
71 SvUTF8_on (sv); 71 SvUTF8_on (sv);
72 free (str); 72 free (str);
73 73
74 return sv; 74 return sv;
75}
76
77static SV *
78new_ref (HV *hv, const char *klass)
79{
80 return sv_bless (newRV ((SV *)hv), gv_stashpv (klass, 1));
81} 75}
82 76
83static SV * 77static SV *
84newSVptr (void *ptr, const char *klass) 78newSVptr (void *ptr, const char *klass)
85{ 79{
302} 296}
303 297
304///////////////////////////////////////////////////////////////////////////// 298/////////////////////////////////////////////////////////////////////////////
305 299
306#define IOM_CLASS "urxvt" 300#define IOM_CLASS "urxvt"
301#define IOM_WARN rxvt_warn
307#include <iom_perl.h> 302#include <iom_perl.h>
308 303
309///////////////////////////////////////////////////////////////////////////// 304/////////////////////////////////////////////////////////////////////////////
310 305
311struct rxvt_perl_interp rxvt_perl; 306struct rxvt_perl_interp rxvt_perl;
387 382
388 // pre-handling of some events 383 // pre-handling of some events
389 if (htype == HOOK_REFRESH_END) 384 if (htype == HOOK_REFRESH_END)
390 { 385 {
391 AV *av = (AV *)SvRV (*hv_fetch ((HV *)SvRV ((SV *)term->perl.self), "_overlay", 8, 0)); 386 AV *av = (AV *)SvRV (*hv_fetch ((HV *)SvRV ((SV *)term->perl.self), "_overlay", 8, 0));
392 387
393 for (int i = 0; i <= AvFILL (av); i++) 388 for (int i = 0; i <= AvFILL (av); i++)
394 ((overlay *)SvIV (*av_fetch (av, i, 0)))->swap (); 389 ((overlay *)SvIV (*av_fetch (av, i, 0)))->swap ();
395 } 390 }
396 391
397 swap (perl_environ, environ); 392 swap (perl_environ, environ);
596 591
597 // post-handling of some events 592 // post-handling of some events
598 if (htype == HOOK_REFRESH_BEGIN) 593 if (htype == HOOK_REFRESH_BEGIN)
599 { 594 {
600 AV *av = (AV *)SvRV (*hv_fetch ((HV *)SvRV ((SV *)term->perl.self), "_overlay", 8, 0)); 595 AV *av = (AV *)SvRV (*hv_fetch ((HV *)SvRV ((SV *)term->perl.self), "_overlay", 8, 0));
601 596
602 for (int i = AvFILL (av); i >= 0; i--) 597 for (int i = AvFILL (av); i >= 0; i--)
603 ((overlay *)SvIV (*av_fetch (av, i, 0)))->swap (); 598 ((overlay *)SvIV (*av_fetch (av, i, 0)))->swap ();
604 } 599 }
605 else if (htype == HOOK_DESTROY) 600 else if (htype == HOOK_DESTROY)
606 { 601 {
607 clearSVptr ((SV *)term->perl.self); 602 clearSVptr ((SV *)term->perl.self);
608 SvREFCNT_dec ((SV *)term->perl.self); 603 SvREFCNT_dec ((SV *)term->perl.self);
609 604
610 // don't allow further calls 605 // don't allow further calls
611 term->perl.self = 0; 606 term->perl.self = 0;
612 } 607 }
613 608
614 swap (perl_environ, environ); 609 swap (perl_environ, environ);
780_exit (int status) 775_exit (int status)
781 776
782NV 777NV
783NOW () 778NOW ()
784 CODE: 779 CODE:
785 RETVAL = NOW; 780 RETVAL = ev::now ();
786 OUTPUT: 781 OUTPUT:
787 RETVAL 782 RETVAL
788 783
789int 784int
790GET_BASEFG (int rend) 785GET_BASEFG (int rend)
862 for (int i = AvFILL (env) + 1; i--; ) 857 for (int i = AvFILL (env) + 1; i--; )
863 envv->push_back (strdup (SvPVbyte_nolen (*av_fetch (env, i, 1)))); 858 envv->push_back (strdup (SvPVbyte_nolen (*av_fetch (env, i, 1))));
864 859
865 envv->push_back (0); 860 envv->push_back (0);
866 861
867 bool success;
868
869 try 862 try
870 { 863 {
871 success = term->init (argv, envv); 864 term->init (argv, envv);
872 } 865 }
873 catch (const class rxvt_failure_exception &e) 866 catch (const class rxvt_failure_exception &e)
874 {
875 success = false;
876 }
877
878 if (!success)
879 { 867 {
880 term->destroy (); 868 term->destroy ();
881 croak ("error while initializing new terminal instance"); 869 croak ("error while initializing new terminal instance");
882 } 870 }
883 871
1144 if (*i) 1132 if (*i)
1145 PUSHs (sv_2mortal (newSVpv (*i, 0))); 1133 PUSHs (sv_2mortal (newSVpv (*i, 0)));
1146} 1134}
1147 1135
1148int 1136int
1149rxvt_term::pty_ev_events (int events = EVENT_UNDEF) 1137rxvt_term::pty_ev_events (int events = ev::UNDEF)
1150 CODE: 1138 CODE:
1151 RETVAL = THIS->pty_ev.events; 1139 RETVAL = THIS->pty_ev.events;
1152 if (events != EVENT_UNDEF) 1140 if (events != ev::UNDEF)
1153 THIS->pty_ev.set (events); 1141 THIS->pty_ev.set (events);
1154 OUTPUT: 1142 OUTPUT:
1155 RETVAL 1143 RETVAL
1156 1144
1157int 1145int
1400SV * 1388SV *
1401rxvt_term::special_decode (SV *text) 1389rxvt_term::special_decode (SV *text)
1402 CODE: 1390 CODE:
1403{ 1391{
1404 wchar_t *wstr = sv2wcs (text); 1392 wchar_t *wstr = sv2wcs (text);
1405 int wlen = wcslen (wstr);
1406 int dlen = 0; 1393 int dlen = 0;
1407 1394
1408 // find length 1395 // find length
1409 for (wchar_t *s = wstr; *s; s++) 1396 for (wchar_t *s = wstr; *s; s++)
1410 if (*s == NOCHAR) 1397 if (*s == NOCHAR)
1473 1460
1474const char * 1461const char *
1475rxvt_term::x_resource (const char *name) 1462rxvt_term::x_resource (const char *name)
1476 1463
1477bool 1464bool
1478rxvt_term::option (U32 optval, int set = -1) 1465rxvt_term::option (U8 optval, int set = -1)
1479 CODE: 1466 CODE:
1480{ 1467{
1481 RETVAL = THIS->options & optval; 1468 RETVAL = THIS->option (optval);
1482 1469
1483 if (set >= 0) 1470 if (set >= 0)
1484 { 1471 {
1485 if (set)
1486 THIS->options |= optval; 1472 THIS->set_option (optval, set);
1487 else
1488 THIS->options &= ~optval;
1489 1473
1490 if (THIS->check_ev.is_active ()) // avoid doing this before START 1474 if (THIS->prepare_ev.is_active ()) // avoid doing this before START
1491 switch (optval) 1475 switch (optval)
1492 { 1476 {
1493 case Opt_skipBuiltinGlyphs: 1477 case Opt_skipBuiltinGlyphs:
1494 THIS->set_fonts (); 1478 THIS->set_fonts ();
1495 THIS->scr_remap_chars (); 1479 THIS->scr_remap_chars ();
1681 Atom *props = XListProperties (THIS->dpy, window, &count); 1665 Atom *props = XListProperties (THIS->dpy, window, &count);
1682 1666
1683 EXTEND (SP, count); 1667 EXTEND (SP, count);
1684 while (count--) 1668 while (count--)
1685 PUSHs (newSVuv ((U32)props [count])); 1669 PUSHs (newSVuv ((U32)props [count]));
1686 1670
1687 XFree (props); 1671 XFree (props);
1688} 1672}
1689 1673
1690void 1674void
1691rxvt_term::XGetWindowProperty (Window window, Atom property) 1675rxvt_term::XGetWindowProperty (Window window, Atom property)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines