summaryrefslogtreecommitdiff
path: root/lang/python35/patches/patch-Modules___cursesmodule.c
diff options
context:
space:
mode:
Diffstat (limited to 'lang/python35/patches/patch-Modules___cursesmodule.c')
-rw-r--r--lang/python35/patches/patch-Modules___cursesmodule.c123
1 files changed, 40 insertions, 83 deletions
diff --git a/lang/python35/patches/patch-Modules___cursesmodule.c b/lang/python35/patches/patch-Modules___cursesmodule.c
index b56ad9f92b7..21f259406b9 100644
--- a/lang/python35/patches/patch-Modules___cursesmodule.c
+++ b/lang/python35/patches/patch-Modules___cursesmodule.c
@@ -1,11 +1,12 @@
-$NetBSD: patch-Modules___cursesmodule.c,v 1.4 2017/01/05 23:16:42 roy Exp $
+$NetBSD: patch-Modules___cursesmodule.c,v 1.5 2018/06/17 19:21:22 adam Exp $
Allow py-curses to use NetBSD curses as well as ncurses
http://bugs.python.org/issue21457
+Use is_pad() when supported (taken from Python 3.7).
---- Modules/_cursesmodule.c.orig 2016-06-25 21:38:38.000000000 +0000
+--- Modules/_cursesmodule.c.orig 2018-02-04 23:40:56.000000000 +0000
+++ Modules/_cursesmodule.c
-@@ -112,12 +112,7 @@ char *PyCursesVersion = "2.2";
+@@ -112,13 +112,13 @@ char *PyCursesVersion = "2.2";
#define CURSES_MODULE
#include "py_curses.h"
@@ -15,11 +16,17 @@ http://bugs.python.org/issue21457
- explicit prototypes here. */
-extern int setupterm(char *,int,int *);
-#ifdef __sgi
-+#ifdef HAVE_TERM_H
++#if defined(HAVE_TERM_H) || defined(__sgi)
++/* For termname, longname, putp, tigetflag, tigetnum, tigetstr, tparm
++ which are not declared in SysV curses and for setupterm. */
#include <term.h>
++/* Including <term.h> #defines many common symbols. */
++#undef lines
++#undef columns
#endif
-@@ -486,17 +481,9 @@ Window_NoArg2TupleReturnFunction(getpary
+ #ifdef HAVE_LANGINFO_H
+@@ -494,17 +494,9 @@ Window_NoArg2TupleReturnFunction(getpary
Window_OneArgNoReturnFunction(clearok, int, "i;True(1) or False(0)")
Window_OneArgNoReturnFunction(idlok, int, "i;True(1) or False(0)")
@@ -37,16 +44,29 @@ http://bugs.python.org/issue21457
Window_OneArgNoReturnFunction(notimeout, int, "i;True(1) or False(0)")
Window_OneArgNoReturnFunction(scrollok, int, "i;True(1) or False(0)")
Window_OneArgNoReturnFunction(winsdelln, int, "i;nlines")
-@@ -1070,7 +1057,7 @@ PyCursesWindow_EchoChar(PyCursesWindowOb
+@@ -940,6 +932,12 @@ int py_mvwdelch(WINDOW *w, int y, int x)
+ }
+ #endif
+
++#if defined(HAVE_CURSES_IS_PAD)
++#define py_is_pad(win) is_pad(win)
++#elif defined(WINDOW_HAS_FLAGS)
++#define py_is_pad(win) ((win) ? ((win)->_flags & _ISPAD) != 0 : FALSE)
++#endif
++
+ /* chgat, added by Fabian Kreutz <fabian.kreutz at gmx.net> */
+
+ static PyObject *
+@@ -1080,7 +1078,7 @@ PyCursesWindow_EchoChar(PyCursesWindowOb
return NULL;
#ifdef WINDOW_HAS_FLAGS
- if (self->win->_flags & _ISPAD)
-+ if (is_pad(self->win))
++ if (py_is_pad(self->win))
return PyCursesCheckERR(pechochar(self->win, ch | attr),
"echochar");
else
-@@ -1156,11 +1143,7 @@ PyCursesWindow_GetKey(PyCursesWindowObje
+@@ -1166,11 +1164,7 @@ PyCursesWindow_GetKey(PyCursesWindowObje
return Py_BuildValue("C", rtn);
} else {
const char *knp;
@@ -58,54 +78,34 @@ http://bugs.python.org/issue21457
return PyUnicode_FromString((knp == NULL) ? "" : knp);
}
}
-@@ -1593,7 +1576,7 @@ PyCursesWindow_NoOutRefresh(PyCursesWind
+@@ -1619,7 +1613,7 @@ PyCursesWindow_NoOutRefresh(PyCursesWind
#ifndef WINDOW_HAS_FLAGS
if (0)
#else
- if (self->win->_flags & _ISPAD)
-+ if (is_pad(self->win))
++ if (py_is_pad(self->win))
#endif
{
switch(PyTuple_Size(args)) {
-@@ -1768,7 +1751,7 @@ PyCursesWindow_Refresh(PyCursesWindowObj
+@@ -1794,7 +1788,7 @@ PyCursesWindow_Refresh(PyCursesWindowObj
#ifndef WINDOW_HAS_FLAGS
if (0)
#else
- if (self->win->_flags & _ISPAD)
-+ if (is_pad(self->win))
++ if (py_is_pad(self->win))
#endif
{
switch(PyTuple_Size(args)) {
-@@ -1835,7 +1818,7 @@ PyCursesWindow_SubWin(PyCursesWindowObje
+@@ -1861,7 +1855,7 @@ PyCursesWindow_SubWin(PyCursesWindowObje
/* printf("Subwin: %i %i %i %i \n", nlines, ncols, begin_y, begin_x); */
#ifdef WINDOW_HAS_FLAGS
- if (self->win->_flags & _ISPAD)
-+ if (is_pad(self->win))
++ if (py_is_pad(self->win))
win = subpad(self->win, nlines, ncols, begin_y, begin_x);
else
#endif
-@@ -2576,15 +2559,15 @@ PyCurses_IntrFlush(PyObject *self, PyObj
- static PyObject *
- PyCurses_Is_Term_Resized(PyObject *self, PyObject *args)
- {
-- int lines;
-- int columns;
-+ int nlines;
-+ int ncolumns;
- int result;
-
- PyCursesInitialised;
-
-- if (!PyArg_ParseTuple(args,"ii:is_term_resized", &lines, &columns))
-+ if (!PyArg_ParseTuple(args,"ii:is_term_resized", &nlines, &ncolumns))
- return NULL;
-- result = is_term_resized(lines, columns);
-+ result = is_term_resized(nlines, ncolumns);
- if (result == TRUE) {
- Py_INCREF(Py_True);
- return Py_True;
-@@ -2595,7 +2578,6 @@ PyCurses_Is_Term_Resized(PyObject *self,
+@@ -2621,7 +2615,6 @@ PyCurses_Is_Term_Resized(PyObject *self,
}
#endif /* HAVE_CURSES_IS_TERM_RESIZED */
@@ -113,7 +113,7 @@ http://bugs.python.org/issue21457
static PyObject *
PyCurses_KeyName(PyObject *self, PyObject *args)
{
-@@ -2614,7 +2596,6 @@ PyCurses_KeyName(PyObject *self, PyObjec
+@@ -2640,7 +2633,6 @@ PyCurses_KeyName(PyObject *self, PyObjec
return PyBytes_FromString((knp == NULL) ? "" : knp);
}
@@ -121,50 +121,7 @@ http://bugs.python.org/issue21457
static PyObject *
PyCurses_KillChar(PyObject *self)
-@@ -2879,16 +2860,16 @@ PyCurses_update_lines_cols(PyObject *sel
- static PyObject *
- PyCurses_ResizeTerm(PyObject *self, PyObject *args)
- {
-- int lines;
-- int columns;
-+ int nlines;
-+ int ncolumns;
- PyObject *result;
-
- PyCursesInitialised;
-
-- if (!PyArg_ParseTuple(args,"ii:resizeterm", &lines, &columns))
-+ if (!PyArg_ParseTuple(args,"ii:resizeterm", &nlines, &ncolumns))
- return NULL;
-
-- result = PyCursesCheckERR(resizeterm(lines, columns), "resizeterm");
-+ result = PyCursesCheckERR(resizeterm(nlines, ncolumns), "resizeterm");
- if (!result)
- return NULL;
- if (!update_lines_cols())
-@@ -2902,17 +2883,17 @@ PyCurses_ResizeTerm(PyObject *self, PyOb
- static PyObject *
- PyCurses_Resize_Term(PyObject *self, PyObject *args)
- {
-- int lines;
-- int columns;
-+ int nlines;
-+ int ncolumns;
-
- PyObject *result;
-
- PyCursesInitialised;
-
-- if (!PyArg_ParseTuple(args,"ii:resize_term", &lines, &columns))
-+ if (!PyArg_ParseTuple(args,"ii:resize_term", &nlines, &ncolumns))
- return NULL;
-
-- result = PyCursesCheckERR(resize_term(lines, columns), "resize_term");
-+ result = PyCursesCheckERR(resize_term(nlines, ncolumns), "resize_term");
- if (!result)
- return NULL;
- if (!update_lines_cols())
-@@ -3228,9 +3209,7 @@ static PyMethodDef PyCurses_methods[] =
+@@ -3254,9 +3246,7 @@ static PyMethodDef PyCurses_methods[] =
#ifdef HAVE_CURSES_IS_TERM_RESIZED
{"is_term_resized", (PyCFunction)PyCurses_Is_Term_Resized, METH_VARARGS},
#endif
@@ -174,7 +131,7 @@ http://bugs.python.org/issue21457
{"killchar", (PyCFunction)PyCurses_KillChar, METH_NOARGS},
{"longname", (PyCFunction)PyCurses_longname, METH_NOARGS},
{"meta", (PyCFunction)PyCurses_Meta, METH_VARARGS},
-@@ -3359,9 +3338,7 @@ PyInit__curses(void)
+@@ -3385,9 +3375,7 @@ PyInit__curses(void)
SetDictInt("A_DIM", A_DIM);
SetDictInt("A_BOLD", A_BOLD);
SetDictInt("A_ALTCHARSET", A_ALTCHARSET);
@@ -184,7 +141,7 @@ http://bugs.python.org/issue21457
SetDictInt("A_PROTECT", A_PROTECT);
SetDictInt("A_CHARTEXT", A_CHARTEXT);
SetDictInt("A_COLOR", A_COLOR);
-@@ -3433,7 +3410,6 @@ PyInit__curses(void)
+@@ -3459,7 +3447,6 @@ PyInit__curses(void)
int key;
char *key_n;
char *key_n2;
@@ -192,7 +149,7 @@ http://bugs.python.org/issue21457
for (key=KEY_MIN;key < KEY_MAX; key++) {
key_n = (char *)keyname(key);
if (key_n == NULL || strcmp(key_n,"UNKNOWN KEY")==0)
-@@ -3461,7 +3437,6 @@ PyInit__curses(void)
+@@ -3487,7 +3474,6 @@ PyInit__curses(void)
if (key_n2 != key_n)
PyMem_Free(key_n2);
}