… | |
… | |
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 | { |
… | |
… | |
291 | PROTOTYPES: ENABLE |
296 | PROTOTYPES: ENABLE |
292 | |
297 | |
293 | BOOT: |
298 | BOOT: |
294 | { |
299 | { |
295 | # 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)); |
296 | AV *hookname = get_av ("urxvt::HOOKNAME", 1); |
302 | AV *hookname = get_av ("urxvt::HOOKNAME", 1); |
297 | set_hookname (INIT); |
303 | set_hookname (INIT); |
298 | set_hookname (RESET); |
304 | set_hookname (RESET); |
299 | set_hookname (START); |
305 | set_hookname (START); |
300 | set_hookname (DESTROY); |
306 | set_hookname (DESTROY); |
… | |
… | |
309 | set_hookname (TTY_ACTIVITY); |
315 | set_hookname (TTY_ACTIVITY); |
310 | set_hookname (REFRESH_BEGIN); |
316 | set_hookname (REFRESH_BEGIN); |
311 | set_hookname (REFRESH_END); |
317 | set_hookname (REFRESH_END); |
312 | set_hookname (KEYBOARD_COMMAND); |
318 | set_hookname (KEYBOARD_COMMAND); |
313 | |
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 | |
314 | sv_setpv (get_sv ("urxvt::LIBDIR", 1), LIBDIR); |
328 | sv_setpv (get_sv ("urxvt::LIBDIR", 1), LIBDIR); |
315 | } |
329 | } |
316 | |
330 | |
317 | void |
331 | void |
318 | set_should_invoke (int htype, int value) |
332 | set_should_invoke (int htype, int value) |
… | |
… | |
332 | NV |
346 | NV |
333 | NOW () |
347 | NOW () |
334 | CODE: |
348 | CODE: |
335 | RETVAL = NOW; |
349 | RETVAL = NOW; |
336 | OUTPUT: |
350 | OUTPUT: |
|
|
351 | RETVAL |
|
|
352 | |
|
|
353 | int |
|
|
354 | GET_BASEFG (int rend) |
|
|
355 | CODE: |
|
|
356 | RETVAL = GET_BASEFG (rend); |
|
|
357 | OUTPUT: |
|
|
358 | RETVAL |
|
|
359 | |
|
|
360 | int |
|
|
361 | GET_BASEBG (int rend) |
|
|
362 | CODE: |
|
|
363 | RETVAL = GET_BASEBG (rend); |
|
|
364 | OUTPUT: |
|
|
365 | RETVAL |
|
|
366 | |
|
|
367 | int |
|
|
368 | SET_FGCOLOR (int rend, int color) |
|
|
369 | CODE: |
|
|
370 | RETVAL = SET_FGCOLOR (rend, color); |
|
|
371 | OUTPUT: |
|
|
372 | RETVAL |
|
|
373 | |
|
|
374 | int |
|
|
375 | SET_BGCOLOR (int rend, int color) |
|
|
376 | CODE: |
|
|
377 | RETVAL = SET_BGCOLOR (rend, color); |
|
|
378 | OUTPUT: |
337 | RETVAL |
379 | RETVAL |
338 | |
380 | |
339 | MODULE = urxvt PACKAGE = urxvt::term |
381 | MODULE = urxvt PACKAGE = urxvt::term |
340 | |
382 | |
341 | int |
383 | int |
… | |
… | |
411 | THIS->scr_changeview (RETVAL); |
453 | THIS->scr_changeview (RETVAL); |
412 | } |
454 | } |
413 | } |
455 | } |
414 | OUTPUT: |
456 | OUTPUT: |
415 | RETVAL |
457 | RETVAL |
|
|
458 | |
|
|
459 | int |
|
|
460 | rxvt_term::nrow () |
|
|
461 | CODE: |
|
|
462 | RETVAL = THIS->nrow; |
|
|
463 | OUTPUT: |
|
|
464 | RETVAL |
|
|
465 | |
|
|
466 | int |
|
|
467 | rxvt_term::ncol () |
|
|
468 | CODE: |
|
|
469 | RETVAL = THIS->ncol; |
|
|
470 | OUTPUT: |
|
|
471 | RETVAL |
|
|
472 | |
|
|
473 | void |
|
|
474 | rxvt_term::want_refresh () |
|
|
475 | CODE: |
|
|
476 | THIS->want_refresh = 1; |
|
|
477 | |
|
|
478 | void |
|
|
479 | rxvt_term::ROW_t (int row_number, SV *new_text = 0, int start_col = 0) |
|
|
480 | PPCODE: |
|
|
481 | { |
|
|
482 | if (!IN_RANGE_EXC (row_number, -THIS->nsaved, THIS->nrow)) |
|
|
483 | croak ("row_number number of out range"); |
|
|
484 | |
|
|
485 | line_t &l = ROW(row_number); |
|
|
486 | |
|
|
487 | if (GIMME_V != G_VOID) |
|
|
488 | { |
|
|
489 | wchar_t *wstr = new wchar_t [THIS->ncol]; |
|
|
490 | |
|
|
491 | for (int col = 0; col <THIS->ncol; col++) |
|
|
492 | wstr [col] = l.t [col]; |
|
|
493 | |
|
|
494 | char *str = rxvt_wcstoutf8 (wstr, THIS->ncol); |
|
|
495 | free (wstr); |
|
|
496 | |
|
|
497 | SV *sv = newSVpv (str, 0); |
|
|
498 | SvUTF8_on (sv); |
|
|
499 | XPUSHs (sv_2mortal (sv)); |
|
|
500 | free (str); |
|
|
501 | } |
|
|
502 | |
|
|
503 | if (new_text) |
|
|
504 | { |
|
|
505 | STRLEN slen; |
|
|
506 | char *str = SvPVutf8 (new_text, slen); |
|
|
507 | wchar_t *wstr = rxvt_utf8towcs (str, slen); |
|
|
508 | |
|
|
509 | int len = wcslen (wstr); |
|
|
510 | |
|
|
511 | if (!IN_RANGE_INC (start_col, 0, THIS->ncol - len)) |
|
|
512 | { |
|
|
513 | free (wstr); |
|
|
514 | croak ("new_text extends beyond horizontal margins"); |
|
|
515 | } |
|
|
516 | |
|
|
517 | for (int col = start_col; col < start_col + len; col++) |
|
|
518 | { |
|
|
519 | l.t [col] = wstr [col - start_col]; |
|
|
520 | l.r [col] = SET_FONT (l.r [col], THIS->fontset [GET_STYLE (l.r [col])]->find_font (l.t [col])); |
|
|
521 | } |
|
|
522 | |
|
|
523 | free (wstr); |
|
|
524 | } |
|
|
525 | } |
|
|
526 | |
|
|
527 | void |
|
|
528 | rxvt_term::ROW_r (int row_number, SV *new_rend = 0, int start_col = 0) |
|
|
529 | PPCODE: |
|
|
530 | { |
|
|
531 | if (!IN_RANGE_EXC (row_number, -THIS->nsaved, THIS->nrow)) |
|
|
532 | croak ("row_number number of out range"); |
|
|
533 | |
|
|
534 | line_t &l = ROW(row_number); |
|
|
535 | |
|
|
536 | if (GIMME_V != G_VOID) |
|
|
537 | { |
|
|
538 | AV *av = newAV (); |
|
|
539 | |
|
|
540 | av_extend (av, THIS->ncol - 1); |
|
|
541 | for (int col = 0; col < THIS->ncol; col++) |
|
|
542 | av_store (av, col, newSViv (l.r [col])); |
|
|
543 | |
|
|
544 | XPUSHs (sv_2mortal (newRV_noinc ((SV *)av))); |
|
|
545 | } |
|
|
546 | |
|
|
547 | if (new_rend) |
|
|
548 | { |
|
|
549 | if (!SvROK (new_rend) || SvTYPE (SvRV (new_rend)) != SVt_PVAV) |
|
|
550 | croak ("new_rend must be arrayref"); |
|
|
551 | |
|
|
552 | AV *av = (AV *)SvRV (new_rend); |
|
|
553 | int len = av_len (av) + 1; |
|
|
554 | |
|
|
555 | if (!IN_RANGE_INC (start_col, 0, THIS->ncol - len)) |
|
|
556 | croak ("new_rend array extends beyond horizontal margins"); |
|
|
557 | |
|
|
558 | for (int col = start_col; col < start_col + len; col++) |
|
|
559 | { |
|
|
560 | rend_t r = SvIV (*av_fetch (av, col - start_col, 1)) & ~RS_fontMask; |
|
|
561 | |
|
|
562 | l.r [col] = SET_FONT (r, THIS->fontset [GET_STYLE (r)]->find_font (l.t [col])); |
|
|
563 | } |
|
|
564 | } |
|
|
565 | } |
|
|
566 | |
|
|
567 | int |
|
|
568 | rxvt_term::ROW_l (int row_number, int new_length = -2) |
|
|
569 | CODE: |
|
|
570 | { |
|
|
571 | if (!IN_RANGE_EXC (row_number, -THIS->nsaved, THIS->nrow)) |
|
|
572 | croak ("row_number number of out range"); |
|
|
573 | |
|
|
574 | line_t &l = ROW(row_number); |
|
|
575 | RETVAL = l.l; |
|
|
576 | |
|
|
577 | if (new_length >= -1) |
|
|
578 | l.l = new_length; |
|
|
579 | } |
|
|
580 | OUTPUT: |
|
|
581 | RETVAL |
|
|
582 | |
|
|
583 | SV * |
|
|
584 | rxvt_term::special_encode (SV *str) |
|
|
585 | CODE: |
|
|
586 | abort ();//TODO |
|
|
587 | |
|
|
588 | SV * |
|
|
589 | rxvt_term::special_decode (SV *str) |
|
|
590 | CODE: |
|
|
591 | abort ();//TODO |
416 | |
592 | |
417 | void |
593 | void |
418 | rxvt_term::_resource (char *name, int index, SV *newval = 0) |
594 | rxvt_term::_resource (char *name, int index, SV *newval = 0) |
419 | PPCODE: |
595 | PPCODE: |
420 | { |
596 | { |