… | |
… | |
35 | #include "rxvtutil.h" |
35 | #include "rxvtutil.h" |
36 | #include "rxvtperl.h" |
36 | #include "rxvtperl.h" |
37 | |
37 | |
38 | #include "perlxsi.c" |
38 | #include "perlxsi.c" |
39 | |
39 | |
|
|
40 | #undef LINENO |
|
|
41 | #define LINENO(n) MOD (THIS->term_start + int(n), THIS->total_rows) |
|
|
42 | #undef ROW |
|
|
43 | #define ROW(n) THIS->row_buf [LINENO (n)] |
|
|
44 | |
40 | ///////////////////////////////////////////////////////////////////////////// |
45 | ///////////////////////////////////////////////////////////////////////////// |
41 | |
46 | |
42 | static wchar_t * |
47 | static wchar_t * |
43 | sv2wcs (SV *sv) |
48 | sv2wcs (SV *sv) |
44 | { |
49 | { |
… | |
… | |
309 | set_hookname (TTY_ACTIVITY); |
314 | set_hookname (TTY_ACTIVITY); |
310 | set_hookname (REFRESH_BEGIN); |
315 | set_hookname (REFRESH_BEGIN); |
311 | set_hookname (REFRESH_END); |
316 | set_hookname (REFRESH_END); |
312 | set_hookname (KEYBOARD_COMMAND); |
317 | set_hookname (KEYBOARD_COMMAND); |
313 | |
318 | |
|
|
319 | newCONSTSUB (gv_stashpv ("urxvt", 1), "DEFAULT_RSTYLE", newSViv (DEFAULT_RSTYLE)); |
|
|
320 | |
314 | sv_setpv (get_sv ("urxvt::LIBDIR", 1), LIBDIR); |
321 | sv_setpv (get_sv ("urxvt::LIBDIR", 1), LIBDIR); |
315 | } |
322 | } |
316 | |
323 | |
317 | void |
324 | void |
318 | set_should_invoke (int htype, int value) |
325 | set_should_invoke (int htype, int value) |
… | |
… | |
411 | THIS->scr_changeview (RETVAL); |
418 | THIS->scr_changeview (RETVAL); |
412 | } |
419 | } |
413 | } |
420 | } |
414 | OUTPUT: |
421 | OUTPUT: |
415 | RETVAL |
422 | RETVAL |
|
|
423 | |
|
|
424 | int |
|
|
425 | rxvt_term::nrow () |
|
|
426 | CODE: |
|
|
427 | RETVAL = THIS->nrow; |
|
|
428 | OUTPUT: |
|
|
429 | RETVAL |
|
|
430 | |
|
|
431 | int |
|
|
432 | rxvt_term::ncol () |
|
|
433 | CODE: |
|
|
434 | RETVAL = THIS->ncol; |
|
|
435 | OUTPUT: |
|
|
436 | RETVAL |
|
|
437 | |
|
|
438 | void |
|
|
439 | rxvt_term::want_refresh () |
|
|
440 | CODE: |
|
|
441 | THIS->want_refresh = 1; |
|
|
442 | |
|
|
443 | void |
|
|
444 | rxvt_term::ROW_t (int row_number, SV *new_text = 0, int start_col = 0) |
|
|
445 | PPCODE: |
|
|
446 | { |
|
|
447 | if (!IN_RANGE_EXC (row_number, -THIS->nsaved, THIS->nrow)) |
|
|
448 | croak ("row_number number of out range"); |
|
|
449 | |
|
|
450 | line_t &l = ROW(row_number); |
|
|
451 | |
|
|
452 | if (GIMME_V != G_VOID) |
|
|
453 | { |
|
|
454 | wchar_t *wstr = new wchar_t [THIS->ncol]; |
|
|
455 | |
|
|
456 | for (int col = 0; col <THIS->ncol; col++) |
|
|
457 | wstr [col] = l.t [col]; |
|
|
458 | |
|
|
459 | char *str = rxvt_wcstoutf8 (wstr, THIS->ncol); |
|
|
460 | free (wstr); |
|
|
461 | |
|
|
462 | SV *sv = newSVpv (str, 0); |
|
|
463 | SvUTF8_on (sv); |
|
|
464 | XPUSHs (sv_2mortal (sv)); |
|
|
465 | free (str); |
|
|
466 | } |
|
|
467 | |
|
|
468 | if (new_text) |
|
|
469 | { |
|
|
470 | STRLEN slen; |
|
|
471 | char *str = SvPVutf8 (new_text, slen); |
|
|
472 | wchar_t *wstr = rxvt_utf8towcs (str, slen); |
|
|
473 | |
|
|
474 | int len = wcslen (wstr); |
|
|
475 | |
|
|
476 | if (!IN_RANGE_INC (start_col, 0, THIS->ncol - len)) |
|
|
477 | { |
|
|
478 | free (wstr); |
|
|
479 | croak ("new_text extends beyond horizontal margins"); |
|
|
480 | } |
|
|
481 | |
|
|
482 | for (int col = start_col; col < start_col + len; col++) |
|
|
483 | { |
|
|
484 | l.t [col] = wstr [col - start_col]; |
|
|
485 | l.r [col] = SET_FONT (l.r [col], THIS->fontset [GET_STYLE (l.r [col])]->find_font (l.t [col])); |
|
|
486 | } |
|
|
487 | |
|
|
488 | free (wstr); |
|
|
489 | } |
|
|
490 | } |
|
|
491 | |
|
|
492 | void |
|
|
493 | rxvt_term::ROW_r (int row_number, SV *new_rend = 0, int start_col = 0) |
|
|
494 | PPCODE: |
|
|
495 | { |
|
|
496 | if (!IN_RANGE_EXC (row_number, -THIS->nsaved, THIS->nrow)) |
|
|
497 | croak ("row_number number of out range"); |
|
|
498 | |
|
|
499 | line_t &l = ROW(row_number); |
|
|
500 | |
|
|
501 | if (GIMME_V != G_VOID) |
|
|
502 | { |
|
|
503 | AV *av = newAV (); |
|
|
504 | |
|
|
505 | av_extend (av, THIS->ncol - 1); |
|
|
506 | for (int col = 0; col < THIS->ncol; col++) |
|
|
507 | av_store (av, col, newSViv (l.r [col])); |
|
|
508 | |
|
|
509 | XPUSHs (sv_2mortal (newRV_noinc ((SV *)av))); |
|
|
510 | } |
|
|
511 | |
|
|
512 | if (new_rend) |
|
|
513 | { |
|
|
514 | if (!SvROK (new_rend) || SvTYPE (SvRV (new_rend)) != SVt_PVAV) |
|
|
515 | croak ("new_rend must be arrayref"); |
|
|
516 | |
|
|
517 | AV *av = (AV *)SvRV (new_rend); |
|
|
518 | int len = av_len (av) + 1; |
|
|
519 | |
|
|
520 | if (!IN_RANGE_INC (start_col, 0, THIS->ncol - len)) |
|
|
521 | croak ("new_rend array extends beyond horizontal margins"); |
|
|
522 | |
|
|
523 | for (int col = start_col; col < start_col + len; col++) |
|
|
524 | { |
|
|
525 | rend_t r = SvIV (*av_fetch (av, col - start_col, 1)) & ~RS_fontMask; |
|
|
526 | |
|
|
527 | l.r [col] = SET_FONT (r, THIS->fontset [GET_STYLE (r)]->find_font (l.t [col])); |
|
|
528 | } |
|
|
529 | } |
|
|
530 | } |
|
|
531 | |
|
|
532 | int |
|
|
533 | rxvt_term::ROW_l (int row_number, int new_length = -2) |
|
|
534 | CODE: |
|
|
535 | { |
|
|
536 | if (!IN_RANGE_EXC (row_number, -THIS->nsaved, THIS->nrow)) |
|
|
537 | croak ("row_number number of out range"); |
|
|
538 | |
|
|
539 | line_t &l = ROW(row_number); |
|
|
540 | RETVAL = l.l; |
|
|
541 | |
|
|
542 | if (new_length >= -1) |
|
|
543 | l.l = new_length; |
|
|
544 | } |
|
|
545 | OUTPUT: |
|
|
546 | RETVAL |
|
|
547 | |
|
|
548 | SV * |
|
|
549 | rxvt_term::special_encode (SV *str) |
|
|
550 | CODE: |
|
|
551 | abort ();//TODO |
|
|
552 | |
|
|
553 | SV * |
|
|
554 | rxvt_term::special_decode (SV *str) |
|
|
555 | CODE: |
|
|
556 | abort ();//TODO |
416 | |
557 | |
417 | void |
558 | void |
418 | rxvt_term::_resource (char *name, int index, SV *newval = 0) |
559 | rxvt_term::_resource (char *name, int index, SV *newval = 0) |
419 | PPCODE: |
560 | PPCODE: |
420 | { |
561 | { |