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.8 by root, Tue Jan 3 00:06:57 2006 UTC vs.
Revision 1.12 by root, Tue Jan 3 02:42:17 2006 UTC

296PROTOTYPES: ENABLE 296PROTOTYPES: ENABLE
297 297
298BOOT: 298BOOT:
299{ 299{
300# define set_hookname(sym) av_store (hookname, PP_CONCAT(HOOK_, sym), newSVpv (PP_STRINGIFY(sym), 0)) 300# define set_hookname(sym) av_store (hookname, PP_CONCAT(HOOK_, sym), newSVpv (PP_STRINGIFY(sym), 0))
301# define export_const(name) newCONSTSUB (gv_stashpv ("urxvt", 1), #name, newSViv (name));
301 AV *hookname = get_av ("urxvt::HOOKNAME", 1); 302 AV *hookname = get_av ("urxvt::HOOKNAME", 1);
302 set_hookname (INIT); 303 set_hookname (INIT);
303 set_hookname (RESET); 304 set_hookname (RESET);
304 set_hookname (START); 305 set_hookname (START);
305 set_hookname (DESTROY); 306 set_hookname (DESTROY);
314 set_hookname (TTY_ACTIVITY); 315 set_hookname (TTY_ACTIVITY);
315 set_hookname (REFRESH_BEGIN); 316 set_hookname (REFRESH_BEGIN);
316 set_hookname (REFRESH_END); 317 set_hookname (REFRESH_END);
317 set_hookname (KEYBOARD_COMMAND); 318 set_hookname (KEYBOARD_COMMAND);
318 319
320 export_const (DEFAULT_RSTYLE);
321 export_const (OVERLAY_RSTYLE);
322 export_const (RS_Bold);
323 export_const (RS_Italic);
324 export_const (RS_Blink);
325 export_const (RS_RVid);
326 export_const (RS_Uline);
327
319 sv_setpv (get_sv ("urxvt::LIBDIR", 1), LIBDIR); 328 sv_setpv (get_sv ("urxvt::LIBDIR", 1), LIBDIR);
320} 329}
321 330
322void 331void
323set_should_invoke (int htype, int value) 332set_should_invoke (int htype, int value)
337NV 346NV
338NOW () 347NOW ()
339 CODE: 348 CODE:
340 RETVAL = NOW; 349 RETVAL = NOW;
341 OUTPUT: 350 OUTPUT:
351 RETVAL
352
353int
354GET_BASEFG (int rend)
355 CODE:
356 RETVAL = GET_BASEFG (rend);
357 OUTPUT:
358 RETVAL
359
360int
361GET_BASEBG (int rend)
362 CODE:
363 RETVAL = GET_BASEBG (rend);
364 OUTPUT:
365 RETVAL
366
367int
368SET_FGCOLOR (int rend, int new_color)
369 CODE:
370 RETVAL = SET_FGCOLOR (rend, new_color);
371 OUTPUT:
372 RETVAL
373
374int
375SET_BGCOLOR (int rend, int new_color)
376 CODE:
377 RETVAL = SET_BGCOLOR (rend, new_color);
378 OUTPUT:
379 RETVAL
380
381int
382GET_CUSTOM (int rend)
383 CODE:
384 RETVAL = (rend && RS_customMask) >> RS_customShift;
385 OUTPUT:
386 RETVAL
387
388int
389SET_CUSTOM (int rend, int new_value)
390 CODE:
391{
392 if (!IN_RANGE_EXC (new_value, 0, RS_customCount))
393 croak ("custom value out of range, must be 0..%d", RS_customCount - 1);
394
395 RETVAL = (rend & ~RS_customMask)
396 | ((new_value << RS_customShift) & RS_customMask);
397}
398 OUTPUT:
342 RETVAL 399 RETVAL
343 400
344MODULE = urxvt PACKAGE = urxvt::term 401MODULE = urxvt PACKAGE = urxvt::term
345 402
346int 403int
430rxvt_term::ncol () 487rxvt_term::ncol ()
431 CODE: 488 CODE:
432 RETVAL = THIS->ncol; 489 RETVAL = THIS->ncol;
433 OUTPUT: 490 OUTPUT:
434 RETVAL 491 RETVAL
492
493void
494rxvt_term::want_refresh ()
495 CODE:
496 THIS->want_refresh = 1;
435 497
436void 498void
437rxvt_term::ROW_t (int row_number, SV *new_text = 0, int start_col = 0) 499rxvt_term::ROW_t (int row_number, SV *new_text = 0, int start_col = 0)
438 PPCODE: 500 PPCODE:
439{ 501{
464 char *str = SvPVutf8 (new_text, slen); 526 char *str = SvPVutf8 (new_text, slen);
465 wchar_t *wstr = rxvt_utf8towcs (str, slen); 527 wchar_t *wstr = rxvt_utf8towcs (str, slen);
466 528
467 int len = wcslen (wstr); 529 int len = wcslen (wstr);
468 530
469 if (start_col + len > THIS->ncol) 531 if (!IN_RANGE_INC (start_col, 0, THIS->ncol - len))
470 { 532 {
471 free (wstr); 533 free (wstr);
472 croak ("new_text extends beyond right margin"); 534 croak ("new_text extends beyond horizontal margins");
473 } 535 }
474 536
475 for (int col = start_col; col < start_col + len; col++) 537 for (int col = start_col; col < start_col + len; col++)
476 { 538 {
477 l.t [col] = wstr [col]; 539 l.t [col] = wstr [col - start_col];
478 l.r [col] = SET_FONT (l.r [col], THIS->fontset [GET_STYLE (l.r [col])]->find_font (l.t [col])); 540 l.r [col] = SET_FONT (l.r [col], THIS->fontset [GET_STYLE (l.r [col])]->find_font (l.t [col]));
479 } 541 }
542
543 free (wstr);
480 } 544 }
481} 545}
482 546
483void 547void
484rxvt_term::ROW_r (int row_number, SV *new_rend = 0, int start_col = 0) 548rxvt_term::ROW_r (int row_number, SV *new_rend = 0, int start_col = 0)
506 croak ("new_rend must be arrayref"); 570 croak ("new_rend must be arrayref");
507 571
508 AV *av = (AV *)SvRV (new_rend); 572 AV *av = (AV *)SvRV (new_rend);
509 int len = av_len (av) + 1; 573 int len = av_len (av) + 1;
510 574
511 if (start_col + len > THIS->ncol) 575 if (!IN_RANGE_INC (start_col, 0, THIS->ncol - len))
512 croak ("new_rend array extends beyond right margin"); 576 croak ("new_rend array extends beyond horizontal margins");
513 577
514 for (int col = start_col; col < start_col + len; col++) 578 for (int col = start_col; col < start_col + len; col++)
515 { 579 {
516 rend_t r = SvIV (*av_fetch (av, col, 1)) & ~RS_fontMask; 580 rend_t r = SvIV (*av_fetch (av, col - start_col, 1)) & ~RS_fontMask;
517 581
518 l.r [col] = SET_FONT (r, THIS->fontset [GET_STYLE (r)]->find_font (l.t [col])); 582 l.r [col] = SET_FONT (r, THIS->fontset [GET_STYLE (r)]->find_font (l.t [col]));
519 } 583 }
520 } 584 }
521} 585}

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines