7194867 Need to patch python to support reading "wide" characters in the curses module
authorRich Burridge <rich.burridge@oracle.com>
Mon, 01 Oct 2012 09:42:46 -0700
changeset 996 0698123e4e6b
parent 995 52ebc73c889f
child 997 15b3b55c6b28
7194867 Need to patch python to support reading "wide" characters in the curses module
components/python/python26/patches/Python26-27-get_wch.patch
components/python/python27/patches/15-get_wch.patch
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/python/python26/patches/Python26-27-get_wch.patch	Mon Oct 01 09:42:46 2012 -0700
@@ -0,0 +1,48 @@
+--- Python-2.6.8/Modules/_cursesmodule.c.orig	2012-09-18 08:01:45.938603187 -0700
++++ Python-2.6.8/Modules/_cursesmodule.c	2012-09-18 08:05:15.216646894 -0700
[email protected]@ -856,6 +856,37 @@
+ }
+ 
+ static PyObject *
++PyCursesWindow_Get_WCh(PyCursesWindowObject *self, PyObject *args)
++{
++    int x, y;
++    int ct;
++    wint_t rtn;
++
++    switch (PyTuple_Size(args)) {
++    case 0:
++        Py_BEGIN_ALLOW_THREADS
++        ct = wget_wch(self->win,&rtn);
++        Py_END_ALLOW_THREADS
++        break;
++    case 2:
++        if (!PyArg_ParseTuple(args,"ii;y,x",&y,&x))
++            return NULL;
++        Py_BEGIN_ALLOW_THREADS
++        ct = mvwget_wch(self->win,y,x,&rtn);
++        Py_END_ALLOW_THREADS
++        break;
++    default:
++        PyErr_SetString(PyExc_TypeError, "get_wch requires 0 or 2 arguments");
++        return NULL;
++    }
++    if (ct == ERR) {
++        PyErr_SetString(PyCursesError, "get_wch failed");
++        return NULL;
++    }
++    return PyInt_FromLong((long)rtn);
++}
++
++static PyObject *
+ PyCursesWindow_GetKey(PyCursesWindowObject *self, PyObject *args)
+ {
+     int x, y;
[email protected]@ -1563,6 +1594,7 @@
+             {"getbegyx",        (PyCFunction)PyCursesWindow_getbegyx, METH_NOARGS},
+             {"getbkgd",         (PyCFunction)PyCursesWindow_GetBkgd, METH_NOARGS},
+             {"getch",           (PyCFunction)PyCursesWindow_GetCh, METH_VARARGS},
++            {"get_wch",         (PyCFunction)PyCursesWindow_Get_WCh, METH_VARARGS},
+             {"getkey",          (PyCFunction)PyCursesWindow_GetKey, METH_VARARGS},
+             {"getmaxyx",        (PyCFunction)PyCursesWindow_getmaxyx, METH_NOARGS},
+             {"getparyx",        (PyCFunction)PyCursesWindow_getparyx, METH_NOARGS},
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/python/python27/patches/15-get_wch.patch	Mon Oct 01 09:42:46 2012 -0700
@@ -0,0 +1,48 @@
+--- Python-2.7.3/Modules/_cursesmodule.c.orig	2012-09-27 10:17:54.934886883 -0700
++++ Python-2.7.3/Modules/_cursesmodule.c	2012-09-27 10:21:19.861160806 -0700
[email protected]@ -861,6 +861,37 @@
+ }
+ 
+ static PyObject *
++PyCursesWindow_Get_WCh(PyCursesWindowObject *self, PyObject *args)
++{
++    int x, y;
++    int ct;
++    wint_t rtn;
++
++    switch (PyTuple_Size(args)) {
++    case 0:
++        Py_BEGIN_ALLOW_THREADS
++        ct = wget_wch(self->win,&rtn);
++        Py_END_ALLOW_THREADS
++        break;
++    case 2:
++        if (!PyArg_ParseTuple(args,"ii;y,x",&y,&x))
++            return NULL;
++        Py_BEGIN_ALLOW_THREADS
++        ct = mvwget_wch(self->win,y,x,&rtn);
++        Py_END_ALLOW_THREADS
++        break;
++    default:
++        PyErr_SetString(PyExc_TypeError, "get_wch requires 0 or 2 arguments");
++        return NULL;
++    }
++    if (ct == ERR) {
++        PyErr_SetString(PyCursesError, "get_wch failed");
++        return NULL;
++    }
++    return PyInt_FromLong((long)rtn);
++}
++
++static PyObject *
+ PyCursesWindow_GetKey(PyCursesWindowObject *self, PyObject *args)
+ {
+     int x, y;
[email protected]@ -1570,6 +1601,7 @@
+     {"getbegyx",        (PyCFunction)PyCursesWindow_getbegyx, METH_NOARGS},
+     {"getbkgd",         (PyCFunction)PyCursesWindow_GetBkgd, METH_NOARGS},
+     {"getch",           (PyCFunction)PyCursesWindow_GetCh, METH_VARARGS},
++    {"get_wch",         (PyCFunction)PyCursesWindow_Get_WCh, METH_VARARGS},
+     {"getkey",          (PyCFunction)PyCursesWindow_GetKey, METH_VARARGS},
+     {"getmaxyx",        (PyCFunction)PyCursesWindow_getmaxyx, METH_NOARGS},
+     {"getparyx",        (PyCFunction)PyCursesWindow_getparyx, METH_NOARGS},