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.122 by root, Sun Jun 15 14:07:58 2008 UTC vs.
Revision 1.125 by root, Fri Aug 22 15:36:45 2008 UTC

310{ 310{
311 if (perl) 311 if (perl)
312 { 312 {
313 perl_destruct (perl); 313 perl_destruct (perl);
314 perl_free (perl); 314 perl_free (perl);
315 PERL_SYS_TERM ();
315 } 316 }
316} 317}
317 318
318void 319void
319rxvt_perl_interp::init (rxvt_term *term) 320rxvt_perl_interp::init (rxvt_term *term)
323 rxvt_push_locale (""); // perl init destroys current locale 324 rxvt_push_locale (""); // perl init destroys current locale
324 325
325 perl_environ = rxvt_environ; 326 perl_environ = rxvt_environ;
326 swap (perl_environ, environ); 327 swap (perl_environ, environ);
327 328
328 char *argv[] = { 329 char *args[] = {
329 "", 330 "",
330 "-e" 331 "-e"
331 "BEGIN {" 332 "BEGIN {"
332 " urxvt->bootstrap;" 333 " urxvt->bootstrap;"
333 " unshift @INC, '" LIBDIR "';" 334 " unshift @INC, '" LIBDIR "';"
334 "}" 335 "}"
335 "" 336 ""
336 "use urxvt;" 337 "use urxvt;"
337 }; 338 };
339 int argc = sizeof (args) / sizeof (args[0]);
340 char **argv = args;
338 341
342 PERL_SYS_INIT3 (&argc, &argv, &environ);
339 perl = perl_alloc (); 343 perl = perl_alloc ();
340 perl_construct (perl); 344 perl_construct (perl);
341 345
342 if (perl_parse (perl, xs_init, 2, argv, (char **)NULL) 346 if (perl_parse (perl, xs_init, argc, argv, (char **)NULL)
343 || perl_run (perl)) 347 || perl_run (perl))
344 { 348 {
345 rxvt_warn ("unable to initialize perl-interpreter, continuing without.\n"); 349 rxvt_warn ("unable to initialize perl-interpreter, continuing without.\n");
346 350
347 perl_destruct (perl); 351 perl_destruct (perl);
639 static const struct { 643 static const struct {
640 const char *name; 644 const char *name;
641 IV iv; 645 IV iv;
642 } *civ, const_iv[] = { 646 } *civ, const_iv[] = {
643# define const_iv(name) { # name, (IV)name } 647# define const_iv(name) { # name, (IV)name }
648 const_iv (NUM_RESOURCES),
644 const_iv (DEFAULT_RSTYLE), 649 const_iv (DEFAULT_RSTYLE),
645 const_iv (OVERLAY_RSTYLE), 650 const_iv (OVERLAY_RSTYLE),
646 const_iv (RS_Bold), 651 const_iv (RS_Bold),
647 const_iv (RS_Italic), 652 const_iv (RS_Italic),
648 const_iv (RS_Blink), 653 const_iv (RS_Blink),
1096 { 1101 {
1097 case 0: RETVAL = THIS->ModLevel3Mask; break; 1102 case 0: RETVAL = THIS->ModLevel3Mask; break;
1098 case 1: RETVAL = THIS->ModMetaMask; break; 1103 case 1: RETVAL = THIS->ModMetaMask; break;
1099 case 2: RETVAL = THIS->ModNumLockMask; break; 1104 case 2: RETVAL = THIS->ModNumLockMask; break;
1100 case 3: RETVAL = THIS->current_screen; break; 1105 case 3: RETVAL = THIS->current_screen; break;
1106#ifdef CURSOR_BLINK
1101 case 4: RETVAL = THIS->hidden_cursor; break; 1107 case 4: RETVAL = THIS->hidden_cursor; break;
1108#endif
1102 } 1109 }
1103 OUTPUT: 1110 OUTPUT:
1104 RETVAL 1111 RETVAL
1105 1112
1106char * 1113char *
1430# undef reserve 1437# undef reserve
1431 }; 1438 };
1432 1439
1433 rs = rslist + sizeof (rslist) / sizeof (rslist [0]); 1440 rs = rslist + sizeof (rslist) / sizeof (rslist [0]);
1434 1441
1442 if (*name)
1435 do { 1443 {
1444 do {
1436 if (rs-- == rslist) 1445 if (rs-- == rslist)
1437 croak ("no such resource '%s', requested", name); 1446 croak ("no such resource '%s', requested", name);
1438 } while (strcmp (name, rs->name)); 1447 } while (strcmp (name, rs->name));
1439 1448
1440 index += rs->value; 1449 index += rs->value;
1450 }
1451 else
1452 {
1453 --rs;
1454 name = "";
1455 }
1441 1456
1442 if (!IN_RANGE_EXC (index, 0, NUM_RESOURCES)) 1457 if (!IN_RANGE_EXC (index, 0, NUM_RESOURCES))
1443 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);
1444 1459
1445 if (GIMME_V != G_VOID) 1460 if (GIMME_V != G_VOID)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines