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-2014,2011 Marc Lehmann <schmorp@schmorp.de> |
6 | * Copyright (c) 2005-2014 Marc Lehmann <schmorp@schmorp.de> |
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 3 of the License, or |
10 | * the Free Software Foundation; either version 3 of the License, or |
11 | * (at your option) any later version. |
11 | * (at your option) any later version. |
… | |
… | |
495 | } |
495 | } |
496 | |
496 | |
497 | static void |
497 | static void |
498 | _keysym_resource_push (rxvt_term *term, const char *k, const char *v) |
498 | _keysym_resource_push (rxvt_term *term, const char *k, const char *v) |
499 | { |
499 | { |
|
|
500 | unsigned int state; |
|
|
501 | |
|
|
502 | if (term->parse_keysym (k, state) == -1) |
|
|
503 | return; |
|
|
504 | |
500 | dSP; |
505 | dSP; |
501 | XPUSHs (sv_2mortal (newSVpv (v, 0))); |
506 | XPUSHs (sv_2mortal (newSVpv (v, 0))); |
502 | PUTBACK; |
507 | PUTBACK; |
503 | } |
508 | } |
504 | |
509 | |
… | |
… | |
1022 | for (civ = const_iv + ecb_array_length (const_iv); civ > const_iv; civ--) |
1027 | for (civ = const_iv + ecb_array_length (const_iv); civ > const_iv; civ--) |
1023 | newCONSTSUB (stash, (char *)civ[-1].name, newSViv (civ[-1].iv)); |
1028 | newCONSTSUB (stash, (char *)civ[-1].name, newSViv (civ[-1].iv)); |
1024 | } |
1029 | } |
1025 | |
1030 | |
1026 | void |
1031 | void |
1027 | log (const char *msg) |
1032 | log (utf8_string msg) |
1028 | CODE: |
1033 | CODE: |
1029 | rxvt_log ("%s", msg); |
1034 | rxvt_log ("%s", msg); |
1030 | |
1035 | |
1031 | void |
1036 | void |
1032 | warn (const char *msg) |
1037 | warn (utf8_string msg) |
1033 | CODE: |
1038 | CODE: |
1034 | rxvt_warn ("%s", msg); |
1039 | rxvt_warn ("%s", msg); |
1035 | |
1040 | |
1036 | void |
1041 | void |
1037 | fatal (const char *msg) |
1042 | fatal (utf8_string msg) |
1038 | CODE: |
1043 | CODE: |
1039 | rxvt_fatal ("%s", msg); |
1044 | rxvt_fatal ("%s", msg); |
1040 | |
1045 | |
1041 | void |
1046 | void |
1042 | _exit (int status) |
1047 | _exit (int status) |
… | |
… | |
1282 | rxvt_term::ungrab () |
1287 | rxvt_term::ungrab () |
1283 | CODE: |
1288 | CODE: |
1284 | ungrab (THIS); |
1289 | ungrab (THIS); |
1285 | |
1290 | |
1286 | int |
1291 | int |
1287 | rxvt_term::XStringToKeysym (char *string) |
1292 | rxvt_term::XStringToKeysym (octet_string string) |
1288 | CODE: |
1293 | CODE: |
1289 | RETVAL = XStringToKeysym (string); |
1294 | RETVAL = XStringToKeysym (string); |
1290 | OUTPUT: RETVAL |
1295 | OUTPUT: RETVAL |
1291 | |
1296 | |
1292 | char * |
1297 | char * |
… | |
… | |
1302 | OUTPUT: RETVAL |
1307 | OUTPUT: RETVAL |
1303 | |
1308 | |
1304 | int |
1309 | int |
1305 | rxvt_term::XKeycodeToKeysym (int code, int index) |
1310 | rxvt_term::XKeycodeToKeysym (int code, int index) |
1306 | CODE: |
1311 | CODE: |
1307 | RETVAL = XKeycodeToKeysym (THIS->dpy, code, index); |
1312 | RETVAL = rxvt_XKeycodeToKeysym (THIS->dpy, code, index); |
1308 | OUTPUT: RETVAL |
1313 | OUTPUT: RETVAL |
1309 | |
1314 | |
1310 | int |
1315 | int |
1311 | rxvt_term::strwidth (SV *str) |
1316 | rxvt_term::strwidth (SV *str) |
1312 | CODE: |
1317 | CODE: |
… | |
… | |
1569 | CODE: |
1574 | CODE: |
1570 | THIS->want_refresh = 1; |
1575 | THIS->want_refresh = 1; |
1571 | THIS->refresh_check (); |
1576 | THIS->refresh_check (); |
1572 | |
1577 | |
1573 | void |
1578 | void |
|
|
1579 | rxvt_term::refresh_check () |
|
|
1580 | |
|
|
1581 | void |
1574 | rxvt_term::ROW_t (int row_number, SV *new_text = 0, int start_col = 0, int start_ofs = 0, int max_len = MAX_COLS) |
1582 | rxvt_term::ROW_t (int row_number, SV *new_text = 0, int start_col = 0, int start_ofs = 0, int max_len = MAX_COLS) |
1575 | PPCODE: |
1583 | PPCODE: |
1576 | { |
1584 | { |
1577 | if (!IN_RANGE_EXC (row_number, THIS->top_row, THIS->nrow)) |
1585 | if (!IN_RANGE_EXC (row_number, THIS->top_row, THIS->nrow)) |
1578 | XSRETURN_EMPTY; |
1586 | XSRETURN_EMPTY; |
… | |
… | |
1721 | *r++ = NOCHAR; |
1729 | *r++ = NOCHAR; |
1722 | } |
1730 | } |
1723 | |
1731 | |
1724 | rxvt_pop_locale (); |
1732 | rxvt_pop_locale (); |
1725 | |
1733 | |
|
|
1734 | free (wstr); |
1726 | RETVAL = wcs2sv (rstr, r - rstr); |
1735 | RETVAL = wcs2sv (rstr, r - rstr); |
1727 | } |
1736 | } |
1728 | OUTPUT: |
1737 | OUTPUT: |
1729 | RETVAL |
1738 | RETVAL |
1730 | |
1739 | |
… | |
… | |
1754 | else if (IS_COMPOSE (*s)) |
1763 | else if (IS_COMPOSE (*s)) |
1755 | r += rxvt_composite.expand (*s, r); |
1764 | r += rxvt_composite.expand (*s, r); |
1756 | else |
1765 | else |
1757 | *r++ = *s; |
1766 | *r++ = *s; |
1758 | |
1767 | |
|
|
1768 | free (wstr); |
1759 | RETVAL = wcs2sv (rstr, r - rstr); |
1769 | RETVAL = wcs2sv (rstr, r - rstr); |
1760 | } |
1770 | } |
1761 | OUTPUT: |
1771 | OUTPUT: |
1762 | RETVAL |
1772 | RETVAL |
1763 | |
1773 | |
1764 | void |
1774 | void |
1765 | rxvt_term::_resource (char *name, int index, SV *newval = 0) |
1775 | rxvt_term::_resource (octet_string name, int index, SV *newval = 0) |
1766 | PPCODE: |
1776 | PPCODE: |
1767 | { |
1777 | { |
1768 | static const struct resval { const char *name; int value; } *rs, rslist [] = { |
1778 | static const struct resval { const char *name; int value; } *rs, rslist [] = { |
1769 | # define def(name) { # name, Rs_ ## name }, |
1779 | # define def(name) { # name, Rs_ ## name }, |
1770 | # define reserve(name,count) |
1780 | # define reserve(name,count) |
… | |
… | |
1808 | THIS->rs [index] = 0; |
1818 | THIS->rs [index] = 0; |
1809 | } |
1819 | } |
1810 | } |
1820 | } |
1811 | |
1821 | |
1812 | const char * |
1822 | const char * |
1813 | rxvt_term::x_resource (const char *name) |
1823 | rxvt_term::x_resource (octet_string name) |
1814 | |
1824 | |
1815 | bool |
1825 | bool |
1816 | rxvt_term::option (U8 optval, int set = -1) |
1826 | rxvt_term::option (U8 optval, int set = -1) |
1817 | CODE: |
1827 | CODE: |
1818 | { |
1828 | { |
… | |
… | |
1852 | } |
1862 | } |
1853 | } |
1863 | } |
1854 | OUTPUT: |
1864 | OUTPUT: |
1855 | RETVAL |
1865 | RETVAL |
1856 | |
1866 | |
|
|
1867 | SV * |
|
|
1868 | rxvt_term::lookup_keysym (int keysym, unsigned int state) |
|
|
1869 | CODE: |
|
|
1870 | { |
|
|
1871 | keysym_t *key = THIS->keyboard->lookup_keysym (THIS, keysym, state); |
|
|
1872 | RETVAL = key ? sv_2mortal (newSVpv (key->str, 0)) : &PL_sv_undef; |
|
|
1873 | } |
|
|
1874 | OUTPUT: |
|
|
1875 | RETVAL |
|
|
1876 | |
1857 | bool |
1877 | bool |
1858 | rxvt_term::bind_action (char *keysym, char *str) |
1878 | rxvt_term::bind_action (octet_string keysym, octet_string action) |
1859 | ALIAS: |
1879 | ALIAS: |
1860 | parse_keysym = 1 |
1880 | parse_keysym = 1 |
1861 | CODE: |
1881 | CODE: |
1862 | RETVAL = 0 < THIS->bind_action (keysym, str); |
1882 | RETVAL = 0 < THIS->bind_action (keysym, action); |
1863 | THIS->keyboard->register_done (); |
1883 | THIS->keyboard->register_done (); |
1864 | OUTPUT: |
1884 | OUTPUT: |
1865 | RETVAL |
1885 | RETVAL |
1866 | |
1886 | |
1867 | void |
1887 | void |
… | |
… | |
1988 | |
2008 | |
1989 | void |
2009 | void |
1990 | rxvt_term::scr_bell () |
2010 | rxvt_term::scr_bell () |
1991 | |
2011 | |
1992 | void |
2012 | void |
1993 | rxvt_term::scr_recolour (bool refresh = true); |
2013 | rxvt_term::scr_recolor (bool refresh = true); |
1994 | |
2014 | |
1995 | void |
2015 | void |
1996 | rxvt_term::scr_change_screen (int screen) |
2016 | rxvt_term::scr_change_screen (int screen) |
1997 | |
2017 | |
1998 | void |
2018 | void |