Check for HP/UX curses problems. Define _XOPEN_SOURCE_EXTENDED and
STRICT_SYSV_CURSES when compiling curses module on HP/UX. Generalize access to _flags on systems where WINDOW is opaque. Fixes bugs #432497, #422265, and the curses parts of #467145 and #473150.
This commit is contained in:
parent
861a65bc2f
commit
eb9b103296
|
@ -12,6 +12,17 @@
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_NCURSES_H
|
||||||
|
/* configure was checking <curses.h>, but we will
|
||||||
|
use <ncurses.h>, which has all these features. */
|
||||||
|
#ifndef WINDOW_HAS_FLAGS
|
||||||
|
#define WINDOW_HAS_FLAGS 1
|
||||||
|
#endif
|
||||||
|
#ifndef MVWDELCH_IS_EXPRESSION
|
||||||
|
#define MVWDELCH_IS_EXPRESSION 1
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -107,6 +107,11 @@ char *PyCursesVersion = "2.2";
|
||||||
#define STRICT_SYSV_CURSES /* Don't use ncurses extensions */
|
#define STRICT_SYSV_CURSES /* Don't use ncurses extensions */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef __hpux
|
||||||
|
#define _XOPEN_SOURCE_EXTENDED
|
||||||
|
#define STRICT_SYSV_CURSES
|
||||||
|
#endif
|
||||||
|
|
||||||
#define CURSES_MODULE
|
#define CURSES_MODULE
|
||||||
#include "py_curses.h"
|
#include "py_curses.h"
|
||||||
|
|
||||||
|
@ -119,7 +124,7 @@ extern int setupterm(char *,int,int *);
|
||||||
#include <term.h>
|
#include <term.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(sgi) || defined(__sun)
|
#if !defined(HAVE_NCURSES_H) && (defined(sgi) || defined(__sun))
|
||||||
#define STRICT_SYSV_CURSES /* Don't use ncurses extensions */
|
#define STRICT_SYSV_CURSES /* Don't use ncurses extensions */
|
||||||
typedef chtype attr_t; /* No attr_t type is available */
|
typedef chtype attr_t; /* No attr_t type is available */
|
||||||
#endif
|
#endif
|
||||||
|
@ -605,6 +610,19 @@ PyCursesWindow_Box(PyCursesWindowObject *self, PyObject *args)
|
||||||
return Py_None;
|
return Py_None;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(HAVE_NCURSES_H) || defined(MVWDELCH_IS_EXPRESSION)
|
||||||
|
#define py_mvwdelch mvwdelch
|
||||||
|
#else
|
||||||
|
int py_mvwdelch(WINDOW *w, int y, int x)
|
||||||
|
{
|
||||||
|
mvwdelch(w,y,x);
|
||||||
|
/* On HP/UX, mvwdelch already returns. On other systems,
|
||||||
|
we may well run into this return statement. */
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
PyCursesWindow_DelCh(PyCursesWindowObject *self, PyObject *args)
|
PyCursesWindow_DelCh(PyCursesWindowObject *self, PyObject *args)
|
||||||
{
|
{
|
||||||
|
@ -618,7 +636,7 @@ PyCursesWindow_DelCh(PyCursesWindowObject *self, PyObject *args)
|
||||||
case 2:
|
case 2:
|
||||||
if (!PyArg_Parse(args,"(ii);y,x", &y, &x))
|
if (!PyArg_Parse(args,"(ii);y,x", &y, &x))
|
||||||
return NULL;
|
return NULL;
|
||||||
rtn = mvwdelch(self->win,y,x);
|
rtn = py_mvwdelch(self->win,y,x);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
PyErr_SetString(PyExc_TypeError, "delch requires 0 or 2 arguments");
|
PyErr_SetString(PyExc_TypeError, "delch requires 0 or 2 arguments");
|
||||||
|
@ -688,7 +706,7 @@ PyCursesWindow_EchoChar(PyCursesWindowObject *self, PyObject *args)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !defined(__NetBSD__)
|
#ifdef WINDOW_HAS_FLAGS
|
||||||
if (self->win->_flags & _ISPAD)
|
if (self->win->_flags & _ISPAD)
|
||||||
return PyCursesCheckERR(pechochar(self->win, ch | attr),
|
return PyCursesCheckERR(pechochar(self->win, ch | attr),
|
||||||
"echochar");
|
"echochar");
|
||||||
|
@ -1094,7 +1112,7 @@ PyCursesWindow_NoOutRefresh(PyCursesWindowObject *self, PyObject *args)
|
||||||
int pminrow,pmincol,sminrow,smincol,smaxrow,smaxcol;
|
int pminrow,pmincol,sminrow,smincol,smaxrow,smaxcol;
|
||||||
int rtn;
|
int rtn;
|
||||||
|
|
||||||
#if defined(__NetBSD__)
|
#ifndef WINDOW_HAS_FLAGS
|
||||||
if (0) {
|
if (0) {
|
||||||
#else
|
#else
|
||||||
if (self->win->_flags & _ISPAD) {
|
if (self->win->_flags & _ISPAD) {
|
||||||
|
@ -1236,7 +1254,7 @@ PyCursesWindow_Refresh(PyCursesWindowObject *self, PyObject *args)
|
||||||
int pminrow,pmincol,sminrow,smincol,smaxrow,smaxcol;
|
int pminrow,pmincol,sminrow,smincol,smaxrow,smaxcol;
|
||||||
int rtn;
|
int rtn;
|
||||||
|
|
||||||
#if defined(__NetBSD__)
|
#ifndef WINDOW_HAS_FLAGS
|
||||||
if (0) {
|
if (0) {
|
||||||
#else
|
#else
|
||||||
if (self->win->_flags & _ISPAD) {
|
if (self->win->_flags & _ISPAD) {
|
||||||
|
@ -1304,7 +1322,7 @@ PyCursesWindow_SubWin(PyCursesWindowObject *self, PyObject *args)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* printf("Subwin: %i %i %i %i \n", nlines, ncols, begin_y, begin_x); */
|
/* printf("Subwin: %i %i %i %i \n", nlines, ncols, begin_y, begin_x); */
|
||||||
#if !defined(__NetBSD__)
|
#ifdef WINDOW_HAS_FLAGS
|
||||||
if (self->win->_flags & _ISPAD)
|
if (self->win->_flags & _ISPAD)
|
||||||
win = subpad(self->win, nlines, ncols, begin_y, begin_x);
|
win = subpad(self->win, nlines, ncols, begin_y, begin_x);
|
||||||
else
|
else
|
||||||
|
@ -1832,6 +1850,11 @@ PyCurses_InitScr(PyObject *self, PyObject *args)
|
||||||
SetDictInt("ACS_HLINE", (ACS_HLINE));
|
SetDictInt("ACS_HLINE", (ACS_HLINE));
|
||||||
SetDictInt("ACS_VLINE", (ACS_VLINE));
|
SetDictInt("ACS_VLINE", (ACS_VLINE));
|
||||||
SetDictInt("ACS_PLUS", (ACS_PLUS));
|
SetDictInt("ACS_PLUS", (ACS_PLUS));
|
||||||
|
#if !defined(__hpux) || defined(HAVE_NCURSES_H)
|
||||||
|
/* On HP/UX 11, these are of type cchar_t, which is not an
|
||||||
|
integral type. If this is a problem on more platforms, a
|
||||||
|
configure test should be added to determine whether ACS_S1
|
||||||
|
is of integral type. */
|
||||||
SetDictInt("ACS_S1", (ACS_S1));
|
SetDictInt("ACS_S1", (ACS_S1));
|
||||||
SetDictInt("ACS_S9", (ACS_S9));
|
SetDictInt("ACS_S9", (ACS_S9));
|
||||||
SetDictInt("ACS_DIAMOND", (ACS_DIAMOND));
|
SetDictInt("ACS_DIAMOND", (ACS_DIAMOND));
|
||||||
|
@ -1846,6 +1869,7 @@ PyCurses_InitScr(PyObject *self, PyObject *args)
|
||||||
SetDictInt("ACS_BOARD", (ACS_BOARD));
|
SetDictInt("ACS_BOARD", (ACS_BOARD));
|
||||||
SetDictInt("ACS_LANTERN", (ACS_LANTERN));
|
SetDictInt("ACS_LANTERN", (ACS_LANTERN));
|
||||||
SetDictInt("ACS_BLOCK", (ACS_BLOCK));
|
SetDictInt("ACS_BLOCK", (ACS_BLOCK));
|
||||||
|
#endif
|
||||||
SetDictInt("ACS_BSSB", (ACS_ULCORNER));
|
SetDictInt("ACS_BSSB", (ACS_ULCORNER));
|
||||||
SetDictInt("ACS_SSBB", (ACS_LLCORNER));
|
SetDictInt("ACS_SSBB", (ACS_LLCORNER));
|
||||||
SetDictInt("ACS_BBSS", (ACS_URCORNER));
|
SetDictInt("ACS_BBSS", (ACS_URCORNER));
|
||||||
|
@ -2286,6 +2310,15 @@ PyCurses_tparm(PyObject *self, PyObject *args)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef __hpux
|
||||||
|
/* tparm is declared with 10 arguments on HP/UX 11.
|
||||||
|
If this is a problem on other platforms as well,
|
||||||
|
an autoconf test should be added to determine
|
||||||
|
whether tparm can be called with a variable number
|
||||||
|
of arguments. Perhaps the other arguments should
|
||||||
|
be initialized in this case also. */
|
||||||
|
result = tparm(fmt,i1,i2,i3,i4,i5,i6,i7,i8,i9);
|
||||||
|
#else
|
||||||
switch (PyTuple_GET_SIZE(args)) {
|
switch (PyTuple_GET_SIZE(args)) {
|
||||||
case 1:
|
case 1:
|
||||||
result = tparm(fmt);
|
result = tparm(fmt);
|
||||||
|
@ -2318,7 +2351,7 @@ PyCurses_tparm(PyObject *self, PyObject *args)
|
||||||
result = tparm(fmt,i1,i2,i3,i4,i5,i6,i7,i8,i9);
|
result = tparm(fmt,i1,i2,i3,i4,i5,i6,i7,i8,i9);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
#endif /* __hpux */
|
||||||
return PyString_FromString(result);
|
return PyString_FromString(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -232,6 +232,12 @@
|
||||||
/* Define if you want to compile in rudimentary thread support */
|
/* Define if you want to compile in rudimentary thread support */
|
||||||
#undef WITH_THREAD
|
#undef WITH_THREAD
|
||||||
|
|
||||||
|
/* Define if mvwdelch in curses.h is an expression. */
|
||||||
|
#undef MVWDELCH_IS_EXPRESSION
|
||||||
|
|
||||||
|
/* Define if WINDOW in curses.h offers a field _flags. */
|
||||||
|
#undef WINDOW_HAS_FLAGS
|
||||||
|
|
||||||
|
|
||||||
/* Leave that blank line there-- autoheader needs it! */
|
/* Leave that blank line there-- autoheader needs it! */
|
||||||
|
|
||||||
|
|
32
configure.in
32
configure.in
|
@ -1963,6 +1963,38 @@ then
|
||||||
AC_DEFINE(HAVE_BROKEN_NICE)
|
AC_DEFINE(HAVE_BROKEN_NICE)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# On HP/UX 11.0, mvwdelch is a block with a return statement
|
||||||
|
AC_MSG_CHECKING(whether mvwdelch is an expression)
|
||||||
|
AC_CACHE_VAL(ac_cv_mvwdelch_is_expression,
|
||||||
|
AC_TRY_COMPILE([#include <curses.h>], [
|
||||||
|
int rtn;
|
||||||
|
rtn = mvwdelch(0,0,0);
|
||||||
|
], ac_cv_mvwdelch_is_expression=yes,
|
||||||
|
ac_cv_mvwdelch_is_expression=no,
|
||||||
|
ac_cv_mvwdelch_is_expression=yes))
|
||||||
|
AC_MSG_RESULT($ac_cv_mvwdelch_is_expression)
|
||||||
|
|
||||||
|
if test "$ac_cv_mvwdelch_is_expression" = yes
|
||||||
|
then
|
||||||
|
AC_DEFINE(MVWDELCH_IS_EXPRESSION)
|
||||||
|
fi
|
||||||
|
|
||||||
|
AC_MSG_CHECKING(whether WINDOW has _flags)
|
||||||
|
AC_CACHE_VAL(ac_cv_window_has_flags,
|
||||||
|
AC_TRY_COMPILE([#include <curses.h>], [
|
||||||
|
WINDOW *w;
|
||||||
|
w->_flags = 0;
|
||||||
|
], ac_cv_window_has_flags=yes,
|
||||||
|
ac_cv_window_has_flags=no,
|
||||||
|
ac_cv_window_has_flags=no))
|
||||||
|
AC_MSG_RESULT($ac_cv_window_has_flags)
|
||||||
|
|
||||||
|
|
||||||
|
if test "$ac_cv_window_has_flags" = yes
|
||||||
|
then
|
||||||
|
AC_DEFINE(WINDOW_HAS_FLAGS)
|
||||||
|
fi
|
||||||
|
|
||||||
# THIS MUST BE LAST, IT CAN BREAK OTHER TESTS!
|
# THIS MUST BE LAST, IT CAN BREAK OTHER TESTS!
|
||||||
# Add sys/socket.h to confdefs.h
|
# Add sys/socket.h to confdefs.h
|
||||||
cat >> confdefs.h <<\EOF
|
cat >> confdefs.h <<\EOF
|
||||||
|
|
|
@ -288,6 +288,12 @@
|
||||||
/* Define if you want to compile in rudimentary thread support */
|
/* Define if you want to compile in rudimentary thread support */
|
||||||
#undef WITH_THREAD
|
#undef WITH_THREAD
|
||||||
|
|
||||||
|
/* Define if mvwdelch in curses.h is an expression. */
|
||||||
|
#undef MVWDELCH_IS_EXPRESSION
|
||||||
|
|
||||||
|
/* Define if WINDOW in curses.h offers a field _flags. */
|
||||||
|
#undef WINDOW_HAS_FLAGS
|
||||||
|
|
||||||
/* The number of bytes in a char. */
|
/* The number of bytes in a char. */
|
||||||
#undef SIZEOF_CHAR
|
#undef SIZEOF_CHAR
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue