Annotation of pkgsrc/lang/python36/patches/patch-Modules___cursesmodule.c, revision 1.3
1.3 ! roy 1: $NetBSD: patch-Modules___cursesmodule.c,v 1.2 2017/01/02 21:14:53 roy Exp $
1.1 adam 2:
1.2 roy 3: Allow py-curses to use NetBSD curses as well as ncurses
1.1 adam 4: http://bugs.python.org/issue21457
5:
1.2 roy 6: --- Modules/_cursesmodule.c.orig 2016-06-25 21:38:38.000000000 +0000
1.1 adam 7: +++ Modules/_cursesmodule.c
1.2 roy 8: @@ -112,12 +112,7 @@ char *PyCursesVersion = "2.2";
9: #define CURSES_MODULE
10: #include "py_curses.h"
11:
12: -/* These prototypes are in <term.h>, but including this header
13: - #defines many common symbols (such as "lines") which breaks the
14: - curses module in other ways. So the code will just specify
15: - explicit prototypes here. */
16: -extern int setupterm(char *,int,int *);
17: -#ifdef __sgi
18: +#ifdef HAVE_TERM_H
19: #include <term.h>
20: #endif
21:
22: @@ -486,17 +481,9 @@ Window_NoArg2TupleReturnFunction(getpary
1.1 adam 23:
24: Window_OneArgNoReturnFunction(clearok, int, "i;True(1) or False(0)")
25: Window_OneArgNoReturnFunction(idlok, int, "i;True(1) or False(0)")
26: -#if defined(__NetBSD__)
27: -Window_OneArgNoReturnVoidFunction(keypad, int, "i;True(1) or False(0)")
28: -#else
29: Window_OneArgNoReturnFunction(keypad, int, "i;True(1) or False(0)")
30: -#endif
31: Window_OneArgNoReturnFunction(leaveok, int, "i;True(1) or False(0)")
32: -#if defined(__NetBSD__)
33: -Window_OneArgNoReturnVoidFunction(nodelay, int, "i;True(1) or False(0)")
34: -#else
35: Window_OneArgNoReturnFunction(nodelay, int, "i;True(1) or False(0)")
36: -#endif
37: Window_OneArgNoReturnFunction(notimeout, int, "i;True(1) or False(0)")
38: Window_OneArgNoReturnFunction(scrollok, int, "i;True(1) or False(0)")
39: Window_OneArgNoReturnFunction(winsdelln, int, "i;nlines")
1.2 roy 40: @@ -1070,7 +1057,7 @@ PyCursesWindow_EchoChar(PyCursesWindowOb
41: return NULL;
42:
43: #ifdef WINDOW_HAS_FLAGS
44: - if (self->win->_flags & _ISPAD)
1.3 ! roy 45: + if (is_pad(self->win))
1.2 roy 46: return PyCursesCheckERR(pechochar(self->win, ch | attr),
47: "echochar");
48: else
49: @@ -1156,11 +1143,7 @@ PyCursesWindow_GetKey(PyCursesWindowObje
1.1 adam 50: return Py_BuildValue("C", rtn);
51: } else {
52: const char *knp;
53: -#if defined(__NetBSD__)
54: - knp = unctrl(rtn);
55: -#else
56: knp = keyname(rtn);
57: -#endif
58: return PyUnicode_FromString((knp == NULL) ? "" : knp);
59: }
60: }
1.2 roy 61: @@ -1593,7 +1576,7 @@ PyCursesWindow_NoOutRefresh(PyCursesWind
62: #ifndef WINDOW_HAS_FLAGS
63: if (0)
64: #else
65: - if (self->win->_flags & _ISPAD)
1.3 ! roy 66: + if (is_pad(self->win))
1.2 roy 67: #endif
68: {
69: switch(PyTuple_Size(args)) {
70: @@ -1768,7 +1751,7 @@ PyCursesWindow_Refresh(PyCursesWindowObj
71: #ifndef WINDOW_HAS_FLAGS
72: if (0)
73: #else
74: - if (self->win->_flags & _ISPAD)
1.3 ! roy 75: + if (is_pad(self->win))
1.2 roy 76: #endif
77: {
78: switch(PyTuple_Size(args)) {
79: @@ -1835,7 +1818,7 @@ PyCursesWindow_SubWin(PyCursesWindowObje
80:
81: /* printf("Subwin: %i %i %i %i \n", nlines, ncols, begin_y, begin_x); */
82: #ifdef WINDOW_HAS_FLAGS
83: - if (self->win->_flags & _ISPAD)
1.3 ! roy 84: + if (is_pad(self->win))
1.2 roy 85: win = subpad(self->win, nlines, ncols, begin_y, begin_x);
86: else
87: #endif
88: @@ -2576,15 +2559,15 @@ PyCurses_IntrFlush(PyObject *self, PyObj
89: static PyObject *
90: PyCurses_Is_Term_Resized(PyObject *self, PyObject *args)
91: {
92: - int lines;
93: - int columns;
94: + int nlines;
95: + int ncolumns;
96: int result;
97:
98: PyCursesInitialised;
99:
100: - if (!PyArg_ParseTuple(args,"ii:is_term_resized", &lines, &columns))
101: + if (!PyArg_ParseTuple(args,"ii:is_term_resized", &nlines, &ncolumns))
102: return NULL;
103: - result = is_term_resized(lines, columns);
104: + result = is_term_resized(nlines, ncolumns);
105: if (result == TRUE) {
106: Py_INCREF(Py_True);
107: return Py_True;
108: @@ -2595,7 +2578,6 @@ PyCurses_Is_Term_Resized(PyObject *self,
1.1 adam 109: }
110: #endif /* HAVE_CURSES_IS_TERM_RESIZED */
111:
112: -#if !defined(__NetBSD__)
113: static PyObject *
114: PyCurses_KeyName(PyObject *self, PyObject *args)
115: {
1.2 roy 116: @@ -2614,7 +2596,6 @@ PyCurses_KeyName(PyObject *self, PyObjec
1.1 adam 117:
118: return PyBytes_FromString((knp == NULL) ? "" : knp);
119: }
120: -#endif
121:
122: static PyObject *
123: PyCurses_KillChar(PyObject *self)
1.2 roy 124: @@ -2879,16 +2860,16 @@ PyCurses_update_lines_cols(PyObject *sel
125: static PyObject *
126: PyCurses_ResizeTerm(PyObject *self, PyObject *args)
127: {
128: - int lines;
129: - int columns;
130: + int nlines;
131: + int ncolumns;
132: PyObject *result;
133:
134: PyCursesInitialised;
135:
136: - if (!PyArg_ParseTuple(args,"ii:resizeterm", &lines, &columns))
137: + if (!PyArg_ParseTuple(args,"ii:resizeterm", &nlines, &ncolumns))
138: return NULL;
139:
140: - result = PyCursesCheckERR(resizeterm(lines, columns), "resizeterm");
141: + result = PyCursesCheckERR(resizeterm(nlines, ncolumns), "resizeterm");
142: if (!result)
143: return NULL;
144: if (!update_lines_cols())
145: @@ -2902,17 +2883,17 @@ PyCurses_ResizeTerm(PyObject *self, PyOb
146: static PyObject *
147: PyCurses_Resize_Term(PyObject *self, PyObject *args)
148: {
149: - int lines;
150: - int columns;
151: + int nlines;
152: + int ncolumns;
153:
154: PyObject *result;
155:
156: PyCursesInitialised;
157:
158: - if (!PyArg_ParseTuple(args,"ii:resize_term", &lines, &columns))
159: + if (!PyArg_ParseTuple(args,"ii:resize_term", &nlines, &ncolumns))
160: return NULL;
161:
162: - result = PyCursesCheckERR(resize_term(lines, columns), "resize_term");
163: + result = PyCursesCheckERR(resize_term(nlines, ncolumns), "resize_term");
164: if (!result)
165: return NULL;
166: if (!update_lines_cols())
167: @@ -3228,9 +3209,7 @@ static PyMethodDef PyCurses_methods[] =
1.1 adam 168: #ifdef HAVE_CURSES_IS_TERM_RESIZED
169: {"is_term_resized", (PyCFunction)PyCurses_Is_Term_Resized, METH_VARARGS},
170: #endif
171: -#if !defined(__NetBSD__)
172: {"keyname", (PyCFunction)PyCurses_KeyName, METH_VARARGS},
173: -#endif
174: {"killchar", (PyCFunction)PyCurses_KillChar, METH_NOARGS},
175: {"longname", (PyCFunction)PyCurses_longname, METH_NOARGS},
176: {"meta", (PyCFunction)PyCurses_Meta, METH_VARARGS},
1.2 roy 177: @@ -3359,9 +3338,7 @@ PyInit__curses(void)
1.1 adam 178: SetDictInt("A_DIM", A_DIM);
179: SetDictInt("A_BOLD", A_BOLD);
180: SetDictInt("A_ALTCHARSET", A_ALTCHARSET);
181: -#if !defined(__NetBSD__)
182: SetDictInt("A_INVIS", A_INVIS);
183: -#endif
184: SetDictInt("A_PROTECT", A_PROTECT);
185: SetDictInt("A_CHARTEXT", A_CHARTEXT);
186: SetDictInt("A_COLOR", A_COLOR);
1.2 roy 187: @@ -3433,7 +3410,6 @@ PyInit__curses(void)
1.1 adam 188: int key;
189: char *key_n;
190: char *key_n2;
191: -#if !defined(__NetBSD__)
192: for (key=KEY_MIN;key < KEY_MAX; key++) {
193: key_n = (char *)keyname(key);
194: if (key_n == NULL || strcmp(key_n,"UNKNOWN KEY")==0)
1.2 roy 195: @@ -3461,7 +3437,6 @@ PyInit__curses(void)
1.1 adam 196: if (key_n2 != key_n)
197: PyMem_Free(key_n2);
198: }
199: -#endif
200: SetDictInt("KEY_MIN", KEY_MIN);
201: SetDictInt("KEY_MAX", KEY_MAX);
202: }
CVSweb <webmaster@jp.NetBSD.org>