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.118 by root, Fri Dec 14 05:25:25 2007 UTC vs.
Revision 1.125 by root, Fri Aug 22 15:36:45 2008 UTC

1/*----------------------------------------------------------------------* 1/*----------------------------------------------------------------------*
2 * File: rxvtperl.xs 2 * File: rxvtperl.xs
3 *----------------------------------------------------------------------* 3 *----------------------------------------------------------------------*
4 * 4 *
5 * All portions of code are copyright by their respective author/s. 5 * All portions of code are copyright by their respective author/s.
6 * Copyright (c) 2005-2006 Marc Lehmann <pcg@goof.com> 6 * Copyright (c) 2005-2008 Marc Lehmann <pcg@goof.com>
7 * 7 *
8 * This program is free software; you can redistribute it and/or modify 8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by 9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or 10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version. 11 * (at your option) any later version.
39#include "rxvtutil.h" 39#include "rxvtutil.h"
40#include "rxvtperl.h" 40#include "rxvtperl.h"
41 41
42#include "perlxsi.c" 42#include "perlxsi.c"
43 43
44#ifdef HAVE_SCROLLBARS
45# define GRAB_CURSOR THIS->leftptr_cursor 44#define GRAB_CURSOR THIS->scrollBar.leftptr_cursor
46#else
47# define GRAB_CURSOR None
48#endif
49 45
50#undef LINENO 46#undef LINENO
51#define LINENO(n) MOD (THIS->term_start + int(n), THIS->total_rows) 47#define LINENO(n) MOD (THIS->term_start + int(n), THIS->total_rows)
52#undef ROW 48#undef ROW
53#define ROW(n) THIS->row_buf [LINENO (n)] 49#define ROW(n) THIS->row_buf [LINENO (n)]
300 296
301///////////////////////////////////////////////////////////////////////////// 297/////////////////////////////////////////////////////////////////////////////
302 298
303#define IOM_CLASS "urxvt" 299#define IOM_CLASS "urxvt"
304#define IOM_WARN rxvt_warn 300#define IOM_WARN rxvt_warn
305#include <iom_perl.h> 301#include "iom_perl.h"
306 302
307///////////////////////////////////////////////////////////////////////////// 303/////////////////////////////////////////////////////////////////////////////
308 304
309struct rxvt_perl_interp rxvt_perl; 305struct rxvt_perl_interp rxvt_perl;
310 306
314{ 310{
315 if (perl) 311 if (perl)
316 { 312 {
317 perl_destruct (perl); 313 perl_destruct (perl);
318 perl_free (perl); 314 perl_free (perl);
315 PERL_SYS_TERM ();
319 } 316 }
320} 317}
321 318
322void 319void
323rxvt_perl_interp::init (rxvt_term *term) 320rxvt_perl_interp::init (rxvt_term *term)
327 rxvt_push_locale (""); // perl init destroys current locale 324 rxvt_push_locale (""); // perl init destroys current locale
328 325
329 perl_environ = rxvt_environ; 326 perl_environ = rxvt_environ;
330 swap (perl_environ, environ); 327 swap (perl_environ, environ);
331 328
332 char *argv[] = { 329 char *args[] = {
333 "", 330 "",
334 "-e" 331 "-e"
335 "BEGIN {" 332 "BEGIN {"
336 " urxvt->bootstrap;" 333 " urxvt->bootstrap;"
337 " unshift @INC, '" LIBDIR "';" 334 " unshift @INC, '" LIBDIR "';"
338 "}" 335 "}"
339 "" 336 ""
340 "use urxvt;" 337 "use urxvt;"
341 }; 338 };
339 int argc = sizeof (args) / sizeof (args[0]);
340 char **argv = args;
342 341
342 PERL_SYS_INIT3 (&argc, &argv, &environ);
343 perl = perl_alloc (); 343 perl = perl_alloc ();
344 perl_construct (perl); 344 perl_construct (perl);
345 345
346 if (perl_parse (perl, xs_init, 2, argv, (char **)NULL) 346 if (perl_parse (perl, xs_init, argc, argv, (char **)NULL)
347 || perl_run (perl)) 347 || perl_run (perl))
348 { 348 {
349 rxvt_warn ("unable to initialize perl-interpreter, continuing without.\n"); 349 rxvt_warn ("unable to initialize perl-interpreter, continuing without.\n");
350 350
351 perl_destruct (perl); 351 perl_destruct (perl);
643 static const struct { 643 static const struct {
644 const char *name; 644 const char *name;
645 IV iv; 645 IV iv;
646 } *civ, const_iv[] = { 646 } *civ, const_iv[] = {
647# define const_iv(name) { # name, (IV)name } 647# define const_iv(name) { # name, (IV)name }
648 const_iv (NUM_RESOURCES),
648 const_iv (DEFAULT_RSTYLE), 649 const_iv (DEFAULT_RSTYLE),
649 const_iv (OVERLAY_RSTYLE), 650 const_iv (OVERLAY_RSTYLE),
650 const_iv (RS_Bold), 651 const_iv (RS_Bold),
651 const_iv (RS_Italic), 652 const_iv (RS_Italic),
652 const_iv (RS_Blink), 653 const_iv (RS_Blink),
1100 { 1101 {
1101 case 0: RETVAL = THIS->ModLevel3Mask; break; 1102 case 0: RETVAL = THIS->ModLevel3Mask; break;
1102 case 1: RETVAL = THIS->ModMetaMask; break; 1103 case 1: RETVAL = THIS->ModMetaMask; break;
1103 case 2: RETVAL = THIS->ModNumLockMask; break; 1104 case 2: RETVAL = THIS->ModNumLockMask; break;
1104 case 3: RETVAL = THIS->current_screen; break; 1105 case 3: RETVAL = THIS->current_screen; break;
1106#ifdef CURSOR_BLINK
1105 case 4: RETVAL = THIS->hidden_cursor; break; 1107 case 4: RETVAL = THIS->hidden_cursor; break;
1108#endif
1106 } 1109 }
1107 OUTPUT: 1110 OUTPUT:
1108 RETVAL 1111 RETVAL
1109 1112
1110char * 1113char *
1434# undef reserve 1437# undef reserve
1435 }; 1438 };
1436 1439
1437 rs = rslist + sizeof (rslist) / sizeof (rslist [0]); 1440 rs = rslist + sizeof (rslist) / sizeof (rslist [0]);
1438 1441
1442 if (*name)
1439 do { 1443 {
1444 do {
1440 if (rs-- == rslist) 1445 if (rs-- == rslist)
1441 croak ("no such resource '%s', requested", name); 1446 croak ("no such resource '%s', requested", name);
1442 } while (strcmp (name, rs->name)); 1447 } while (strcmp (name, rs->name));
1443 1448
1444 index += rs->value; 1449 index += rs->value;
1450 }
1451 else
1452 {
1453 --rs;
1454 name = "";
1455 }
1445 1456
1446 if (!IN_RANGE_EXC (index, 0, NUM_RESOURCES)) 1457 if (!IN_RANGE_EXC (index, 0, NUM_RESOURCES))
1447 croak ("requested out-of-bound resource %s+%d,", name, index - rs->value); 1458 croak ("requested out-of-bound resource %s+%d,", name, index - rs->value);
1448 1459
1449 if (GIMME_V != G_VOID) 1460 if (GIMME_V != G_VOID)
1707 XFree (prop); 1718 XFree (prop);
1708 } 1719 }
1709} 1720}
1710 1721
1711void 1722void
1712rxvt_term::XChangeWindowProperty (Window window, Atom property, Atom type, int format, SV *data) 1723rxvt_term::XChangeProperty (Window window, Atom property, Atom type, int format, SV *data)
1713 CODE: 1724 CODE:
1714{ 1725{
1715 STRLEN len; 1726 STRLEN len;
1716 char *data_ = SvPVbyte (data, len); 1727 char *data_ = SvPVbyte (data, len);
1717 1728

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines