author | Mike Sullivan <Mike.Sullivan@Oracle.COM> |
Mon, 11 Mar 2013 10:38:09 -0700 | |
branch | s11-update |
changeset 2520 | ceec631e74d1 |
parent 2386 | 4b1a9590af26 |
permissions | -rw-r--r-- |
2386
4b1a9590af26
7194867 Need to patch python to support reading "wide" characters in the curses module
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1 |
--- Python-2.6.8/Modules/_cursesmodule.c.orig 2012-09-18 08:01:45.938603187 -0700 |
4b1a9590af26
7194867 Need to patch python to support reading "wide" characters in the curses module
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
2 |
+++ Python-2.6.8/Modules/_cursesmodule.c 2012-09-18 08:05:15.216646894 -0700 |
4b1a9590af26
7194867 Need to patch python to support reading "wide" characters in the curses module
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
3 |
@@ -856,6 +856,37 @@ |
4b1a9590af26
7194867 Need to patch python to support reading "wide" characters in the curses module
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
4 |
} |
4b1a9590af26
7194867 Need to patch python to support reading "wide" characters in the curses module
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
5 |
|
4b1a9590af26
7194867 Need to patch python to support reading "wide" characters in the curses module
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
6 |
static PyObject * |
4b1a9590af26
7194867 Need to patch python to support reading "wide" characters in the curses module
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
7 |
+PyCursesWindow_Get_WCh(PyCursesWindowObject *self, PyObject *args) |
4b1a9590af26
7194867 Need to patch python to support reading "wide" characters in the curses module
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
8 |
+{ |
4b1a9590af26
7194867 Need to patch python to support reading "wide" characters in the curses module
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
9 |
+ int x, y; |
4b1a9590af26
7194867 Need to patch python to support reading "wide" characters in the curses module
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
10 |
+ int ct; |
4b1a9590af26
7194867 Need to patch python to support reading "wide" characters in the curses module
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
11 |
+ wint_t rtn; |
4b1a9590af26
7194867 Need to patch python to support reading "wide" characters in the curses module
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
12 |
+ |
4b1a9590af26
7194867 Need to patch python to support reading "wide" characters in the curses module
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
13 |
+ switch (PyTuple_Size(args)) { |
4b1a9590af26
7194867 Need to patch python to support reading "wide" characters in the curses module
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
14 |
+ case 0: |
4b1a9590af26
7194867 Need to patch python to support reading "wide" characters in the curses module
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
15 |
+ Py_BEGIN_ALLOW_THREADS |
4b1a9590af26
7194867 Need to patch python to support reading "wide" characters in the curses module
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
16 |
+ ct = wget_wch(self->win,&rtn); |
4b1a9590af26
7194867 Need to patch python to support reading "wide" characters in the curses module
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
17 |
+ Py_END_ALLOW_THREADS |
4b1a9590af26
7194867 Need to patch python to support reading "wide" characters in the curses module
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
18 |
+ break; |
4b1a9590af26
7194867 Need to patch python to support reading "wide" characters in the curses module
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
19 |
+ case 2: |
4b1a9590af26
7194867 Need to patch python to support reading "wide" characters in the curses module
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
20 |
+ if (!PyArg_ParseTuple(args,"ii;y,x",&y,&x)) |
4b1a9590af26
7194867 Need to patch python to support reading "wide" characters in the curses module
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
21 |
+ return NULL; |
4b1a9590af26
7194867 Need to patch python to support reading "wide" characters in the curses module
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
22 |
+ Py_BEGIN_ALLOW_THREADS |
4b1a9590af26
7194867 Need to patch python to support reading "wide" characters in the curses module
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
23 |
+ ct = mvwget_wch(self->win,y,x,&rtn); |
4b1a9590af26
7194867 Need to patch python to support reading "wide" characters in the curses module
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
24 |
+ Py_END_ALLOW_THREADS |
4b1a9590af26
7194867 Need to patch python to support reading "wide" characters in the curses module
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
25 |
+ break; |
4b1a9590af26
7194867 Need to patch python to support reading "wide" characters in the curses module
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
26 |
+ default: |
4b1a9590af26
7194867 Need to patch python to support reading "wide" characters in the curses module
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
27 |
+ PyErr_SetString(PyExc_TypeError, "get_wch requires 0 or 2 arguments"); |
4b1a9590af26
7194867 Need to patch python to support reading "wide" characters in the curses module
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
28 |
+ return NULL; |
4b1a9590af26
7194867 Need to patch python to support reading "wide" characters in the curses module
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
29 |
+ } |
4b1a9590af26
7194867 Need to patch python to support reading "wide" characters in the curses module
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
30 |
+ if (ct == ERR) { |
4b1a9590af26
7194867 Need to patch python to support reading "wide" characters in the curses module
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
31 |
+ PyErr_SetString(PyCursesError, "get_wch failed"); |
4b1a9590af26
7194867 Need to patch python to support reading "wide" characters in the curses module
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
32 |
+ return NULL; |
4b1a9590af26
7194867 Need to patch python to support reading "wide" characters in the curses module
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
33 |
+ } |
4b1a9590af26
7194867 Need to patch python to support reading "wide" characters in the curses module
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
34 |
+ return PyInt_FromLong((long)rtn); |
4b1a9590af26
7194867 Need to patch python to support reading "wide" characters in the curses module
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
35 |
+} |
4b1a9590af26
7194867 Need to patch python to support reading "wide" characters in the curses module
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
36 |
+ |
4b1a9590af26
7194867 Need to patch python to support reading "wide" characters in the curses module
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
37 |
+static PyObject * |
4b1a9590af26
7194867 Need to patch python to support reading "wide" characters in the curses module
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
38 |
PyCursesWindow_GetKey(PyCursesWindowObject *self, PyObject *args) |
4b1a9590af26
7194867 Need to patch python to support reading "wide" characters in the curses module
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
39 |
{ |
4b1a9590af26
7194867 Need to patch python to support reading "wide" characters in the curses module
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
40 |
int x, y; |
4b1a9590af26
7194867 Need to patch python to support reading "wide" characters in the curses module
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
41 |
@@ -1563,6 +1594,7 @@ |
4b1a9590af26
7194867 Need to patch python to support reading "wide" characters in the curses module
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
42 |
{"getbegyx", (PyCFunction)PyCursesWindow_getbegyx, METH_NOARGS}, |
4b1a9590af26
7194867 Need to patch python to support reading "wide" characters in the curses module
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
43 |
{"getbkgd", (PyCFunction)PyCursesWindow_GetBkgd, METH_NOARGS}, |
4b1a9590af26
7194867 Need to patch python to support reading "wide" characters in the curses module
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
44 |
{"getch", (PyCFunction)PyCursesWindow_GetCh, METH_VARARGS}, |
4b1a9590af26
7194867 Need to patch python to support reading "wide" characters in the curses module
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
45 |
+ {"get_wch", (PyCFunction)PyCursesWindow_Get_WCh, METH_VARARGS}, |
4b1a9590af26
7194867 Need to patch python to support reading "wide" characters in the curses module
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
46 |
{"getkey", (PyCFunction)PyCursesWindow_GetKey, METH_VARARGS}, |
4b1a9590af26
7194867 Need to patch python to support reading "wide" characters in the curses module
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
47 |
{"getmaxyx", (PyCFunction)PyCursesWindow_getmaxyx, METH_NOARGS}, |
4b1a9590af26
7194867 Need to patch python to support reading "wide" characters in the curses module
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
48 |
{"getparyx", (PyCFunction)PyCursesWindow_getparyx, METH_NOARGS}, |