author | John Beck <John.Beck@Oracle.COM> |
Tue, 20 Dec 2016 13:25:44 -0800 | |
changeset 7516 | 09c933391a1b |
parent 1954 | 32663e59626d |
permissions | -rw-r--r-- |
1954
32663e59626d
19004605 update Python 2.7 line to version 2.7.7
John Beck <John.Beck@Oracle.COM>
parents:
1914
diff
changeset
|
1 |
This patch adds wget_wch support to the curses module. It may be contributed |
32663e59626d
19004605 update Python 2.7 line to version 2.7.7
John Beck <John.Beck@Oracle.COM>
parents:
1914
diff
changeset
|
2 |
upstream at some point, but the suitability (or lack thereof) has not yet |
32663e59626d
19004605 update Python 2.7 line to version 2.7.7
John Beck <John.Beck@Oracle.COM>
parents:
1914
diff
changeset
|
3 |
been determined. |
32663e59626d
19004605 update Python 2.7 line to version 2.7.7
John Beck <John.Beck@Oracle.COM>
parents:
1914
diff
changeset
|
4 |
|
1914
00e8dbcb9b1e
PSARC 2014/183 Python 2.7.6
John Beck <John.Beck@Oracle.COM>
parents:
996
diff
changeset
|
5 |
--- Python-2.7.6/Modules/_cursesmodule.c.~1~ 2013-11-09 23:36:41.000000000 -0800 |
00e8dbcb9b1e
PSARC 2014/183 Python 2.7.6
John Beck <John.Beck@Oracle.COM>
parents:
996
diff
changeset
|
6 |
+++ Python-2.7.6/Modules/_cursesmodule.c 2014-05-14 13:36:59.388642793 -0700 |
996
0698123e4e6b
7194867 Need to patch python to support reading "wide" characters in the curses module
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
7 |
@@ -861,6 +861,37 @@ |
0698123e4e6b
7194867 Need to patch python to support reading "wide" characters in the curses module
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
8 |
} |
0698123e4e6b
7194867 Need to patch python to support reading "wide" characters in the curses module
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
9 |
|
0698123e4e6b
7194867 Need to patch python to support reading "wide" characters in the curses module
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
10 |
static PyObject * |
0698123e4e6b
7194867 Need to patch python to support reading "wide" characters in the curses module
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
11 |
+PyCursesWindow_Get_WCh(PyCursesWindowObject *self, PyObject *args) |
0698123e4e6b
7194867 Need to patch python to support reading "wide" characters in the curses module
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
12 |
+{ |
0698123e4e6b
7194867 Need to patch python to support reading "wide" characters in the curses module
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
13 |
+ int x, y; |
0698123e4e6b
7194867 Need to patch python to support reading "wide" characters in the curses module
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
14 |
+ int ct; |
0698123e4e6b
7194867 Need to patch python to support reading "wide" characters in the curses module
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
15 |
+ wint_t rtn; |
0698123e4e6b
7194867 Need to patch python to support reading "wide" characters in the curses module
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
16 |
+ |
0698123e4e6b
7194867 Need to patch python to support reading "wide" characters in the curses module
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
17 |
+ switch (PyTuple_Size(args)) { |
0698123e4e6b
7194867 Need to patch python to support reading "wide" characters in the curses module
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
18 |
+ case 0: |
0698123e4e6b
7194867 Need to patch python to support reading "wide" characters in the curses module
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
19 |
+ Py_BEGIN_ALLOW_THREADS |
0698123e4e6b
7194867 Need to patch python to support reading "wide" characters in the curses module
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
20 |
+ ct = wget_wch(self->win,&rtn); |
0698123e4e6b
7194867 Need to patch python to support reading "wide" characters in the curses module
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
21 |
+ Py_END_ALLOW_THREADS |
0698123e4e6b
7194867 Need to patch python to support reading "wide" characters in the curses module
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
22 |
+ break; |
0698123e4e6b
7194867 Need to patch python to support reading "wide" characters in the curses module
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
23 |
+ case 2: |
0698123e4e6b
7194867 Need to patch python to support reading "wide" characters in the curses module
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
24 |
+ if (!PyArg_ParseTuple(args,"ii;y,x",&y,&x)) |
0698123e4e6b
7194867 Need to patch python to support reading "wide" characters in the curses module
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
25 |
+ return NULL; |
0698123e4e6b
7194867 Need to patch python to support reading "wide" characters in the curses module
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
26 |
+ Py_BEGIN_ALLOW_THREADS |
0698123e4e6b
7194867 Need to patch python to support reading "wide" characters in the curses module
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
27 |
+ ct = mvwget_wch(self->win,y,x,&rtn); |
0698123e4e6b
7194867 Need to patch python to support reading "wide" characters in the curses module
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
28 |
+ Py_END_ALLOW_THREADS |
0698123e4e6b
7194867 Need to patch python to support reading "wide" characters in the curses module
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
29 |
+ break; |
0698123e4e6b
7194867 Need to patch python to support reading "wide" characters in the curses module
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
30 |
+ default: |
0698123e4e6b
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(PyExc_TypeError, "get_wch requires 0 or 2 arguments"); |
0698123e4e6b
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; |
0698123e4e6b
7194867 Need to patch python to support reading "wide" characters in the curses module
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
33 |
+ } |
0698123e4e6b
7194867 Need to patch python to support reading "wide" characters in the curses module
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
34 |
+ if (ct == ERR) { |
0698123e4e6b
7194867 Need to patch python to support reading "wide" characters in the curses module
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
35 |
+ PyErr_SetString(PyCursesError, "get_wch failed"); |
0698123e4e6b
7194867 Need to patch python to support reading "wide" characters in the curses module
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
36 |
+ return NULL; |
0698123e4e6b
7194867 Need to patch python to support reading "wide" characters in the curses module
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
37 |
+ } |
0698123e4e6b
7194867 Need to patch python to support reading "wide" characters in the curses module
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
38 |
+ return PyInt_FromLong((long)rtn); |
0698123e4e6b
7194867 Need to patch python to support reading "wide" characters in the curses module
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
39 |
+} |
0698123e4e6b
7194867 Need to patch python to support reading "wide" characters in the curses module
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
40 |
+ |
0698123e4e6b
7194867 Need to patch python to support reading "wide" characters in the curses module
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
41 |
+static PyObject * |
0698123e4e6b
7194867 Need to patch python to support reading "wide" characters in the curses module
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
42 |
PyCursesWindow_GetKey(PyCursesWindowObject *self, PyObject *args) |
0698123e4e6b
7194867 Need to patch python to support reading "wide" characters in the curses module
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
43 |
{ |
0698123e4e6b
7194867 Need to patch python to support reading "wide" characters in the curses module
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
44 |
int x, y; |
7516
09c933391a1b
25293039 Upgrade Python 2.7 line to 2.7.13
John Beck <John.Beck@Oracle.COM>
parents:
1954
diff
changeset
|
45 |
@@ -1588,6 +1619,7 @@ |
996
0698123e4e6b
7194867 Need to patch python to support reading "wide" characters in the curses module
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
46 |
{"getbegyx", (PyCFunction)PyCursesWindow_getbegyx, METH_NOARGS}, |
0698123e4e6b
7194867 Need to patch python to support reading "wide" characters in the curses module
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
47 |
{"getbkgd", (PyCFunction)PyCursesWindow_GetBkgd, METH_NOARGS}, |
0698123e4e6b
7194867 Need to patch python to support reading "wide" characters in the curses module
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
48 |
{"getch", (PyCFunction)PyCursesWindow_GetCh, METH_VARARGS}, |
0698123e4e6b
7194867 Need to patch python to support reading "wide" characters in the curses module
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
49 |
+ {"get_wch", (PyCFunction)PyCursesWindow_Get_WCh, METH_VARARGS}, |
0698123e4e6b
7194867 Need to patch python to support reading "wide" characters in the curses module
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
50 |
{"getkey", (PyCFunction)PyCursesWindow_GetKey, METH_VARARGS}, |
0698123e4e6b
7194867 Need to patch python to support reading "wide" characters in the curses module
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
51 |
{"getmaxyx", (PyCFunction)PyCursesWindow_getmaxyx, METH_NOARGS}, |
0698123e4e6b
7194867 Need to patch python to support reading "wide" characters in the curses module
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
52 |
{"getparyx", (PyCFunction)PyCursesWindow_getparyx, METH_NOARGS}, |