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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines