]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
More _curses compilation-problem fixes.
authorMoshe Zadka <moshez@math.huji.ac.il>
Fri, 30 Mar 2001 14:23:06 +0000 (14:23 +0000)
committerMoshe Zadka <moshez@math.huji.ac.il>
Fri, 30 Mar 2001 14:23:06 +0000 (14:23 +0000)
NetBSD, IRIX and platforms with term.h that makes "lines" a macro

Misc/NEWS
Modules/_cursesmodule.c

index aad276e71a0ef448576c69ecc206a397de671600..93adb2d54c290942441f332822fbcdbd7f7dd0e5 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -17,6 +17,12 @@ http://sourceforge.net/tracker/index.php?func=detail&aid=<id>&group_id=5470&atid
 
 - #116172, curses module fails to build on SGI, _curses
 
+- Patch #103485, compile on NetBSD
+
+- Rename lines to nlines, macro sometimes defined in term.h
+
+- Patch #130117: add a prototype required to compile cleanly on IRIX
+
 What's New in Python 2.0?
 =========================
 
index 12e2084e6401381341c88a2993f960876a1d56c8..7a3953d18ea37d56d590d39b20368ead54108b6a 100644 (file)
@@ -84,6 +84,7 @@ char *PyCursesVersion = "1.6";
     module in other ways.  So the code will just specify an explicit
     prototype here. */
 extern char *tigetstr(char *);
+extern char *tparm(char *instring, ...);
 #endif
 
 #if defined(sgi) || defined(__sun__)
@@ -91,6 +92,10 @@ extern char *tigetstr(char *);
 typedef chtype attr_t;           /* No attr_t type is available */
 #endif
 
+#if defined(_AIX)
+#define STRICT_SYSV_CURSES
+#endif
+
 /* Definition of exception curses.error */
 
 static PyObject *PyCursesError;
@@ -261,9 +266,17 @@ Window_OneArgNoReturnFunction(wattroff, attr_t, "l;attr")
 Window_OneArgNoReturnFunction(wattrset, attr_t, "l;attr")
 Window_OneArgNoReturnFunction(clearok, int, "i;True(1) or False(0)")
 Window_OneArgNoReturnFunction(idlok, int, "i;True(1) or False(0)")
+#if defined(__NetBSD__)
+Window_OneArgNoReturnVoidFunction(keypad, int, "i;True(1) or False(0)")
+#else
 Window_OneArgNoReturnFunction(keypad, int, "i;True(1) or False(0)")
+#endif
 Window_OneArgNoReturnFunction(leaveok, int, "i;True(1) or False(0)")
+#if defined(__NetBSD__)
+Window_OneArgNoReturnVoidFunction(nodelay, int, "i;True(1) or False(0)")
+#else
 Window_OneArgNoReturnFunction(nodelay, int, "i;True(1) or False(0)")
+#endif
 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")
@@ -606,10 +619,12 @@ PyCursesWindow_EchoChar(PyCursesWindowObject *self, PyObject *args)
     return NULL;
   }
   
+#if !defined(__NetBSD__)
   if (self->win->_flags & _ISPAD)
     return PyCursesCheckERR(pechochar(self->win, ch | attr), 
                            "echochar");
   else
+#endif
     return PyCursesCheckERR(wechochar(self->win, ch | attr), 
                            "echochar");
 }
@@ -686,7 +701,11 @@ PyCursesWindow_GetKey(PyCursesWindowObject *self, PyObject *args)
   if (rtn<=255)
     return Py_BuildValue("c", rtn);
   else
+#if defined(__NetBSD__)
+    return PyString_FromString(unctrl(rtn));
+#else
     return PyString_FromString((char *)keyname(rtn));
+#endif
 }
 
 static PyObject *
@@ -1005,7 +1024,11 @@ PyCursesWindow_NoOutRefresh(PyCursesWindowObject *self, PyObject *args)
   int pminrow,pmincol,sminrow,smincol,smaxrow,smaxcol;
   int rtn;
 
+#if defined(__NetBSD__)
+  if (0) {
+#else
   if (self->win->_flags & _ISPAD) {
+#endif
     switch(ARG_COUNT(args)) {
     case 6:
       if (!PyArg_Parse(args, 
@@ -1067,7 +1090,11 @@ PyCursesWindow_Refresh(PyCursesWindowObject *self, PyObject *args)
   int pminrow,pmincol,sminrow,smincol,smaxrow,smaxcol;
   int rtn;
   
+#if defined(__NetBSD__)
+  if (0) {
+#else
   if (self->win->_flags & _ISPAD) {
+#endif
     switch(ARG_COUNT(args)) {
     case 6:
       if (!PyArg_Parse(args, 
@@ -1131,9 +1158,11 @@ PyCursesWindow_SubWin(PyCursesWindowObject *self, PyObject *args)
   }
 
   /* printf("Subwin: %i %i %i %i   \n", nlines, ncols, begin_y, begin_x); */
+#if !defined(__NetBSD__)
   if (self->win->_flags & _ISPAD)
     win = subpad(self->win, nlines, ncols, begin_y, begin_x);
   else
+#endif
     win = subwin(self->win, nlines, ncols, begin_y, begin_x);
 
   if (win == NULL) {
@@ -1147,15 +1176,15 @@ PyCursesWindow_SubWin(PyCursesWindowObject *self, PyObject *args)
 static PyObject *
 PyCursesWindow_Scroll(PyCursesWindowObject *self, PyObject *args)
 {
-  int lines;
+  int nlines;
   switch(ARG_COUNT(args)) {
   case 0:
     return PyCursesCheckERR(scroll(self->win), "scroll");
     break;
   case 1:
-    if (!PyArg_Parse(args, "i;lines", &lines))
+    if (!PyArg_Parse(args, "i;nlines", &nlines))
       return NULL;
-    return PyCursesCheckERR(wscrl(self->win, lines), "scroll");
+    return PyCursesCheckERR(wscrl(self->win, nlines), "scroll");
   default:
     PyErr_SetString(PyExc_TypeError, "scroll requires 0 or 1 arguments");
     return NULL;
@@ -1687,7 +1716,7 @@ static PyObject *
 PyCurses_InitScr(PyObject *self, PyObject *args)
 {
   WINDOW *win;
-  PyObject *lines, *cols;
+  PyObject *nlines, *cols;
 
   if (!PyArg_NoArgs(args)) return NULL;
 
@@ -1771,9 +1800,9 @@ PyCurses_InitScr(PyObject *self, PyObject *args)
        SetDictInt("ACS_STERLING",      (ACS_STERLING));
 #endif
 
-  lines = PyInt_FromLong((long) LINES);
-  PyDict_SetItemString(ModDict, "LINES", lines);
-  Py_DECREF(lines);
+  nlines = PyInt_FromLong((long) LINES);
+  PyDict_SetItemString(ModDict, "LINES", nlines);
+  Py_DECREF(nlines);
   cols = PyInt_FromLong((long) COLS);
   PyDict_SetItemString(ModDict, "COLS", cols);
   Py_DECREF(cols);
@@ -1801,6 +1830,7 @@ PyCurses_IntrFlush(PyObject *self, PyObject *args)
   return PyCursesCheckERR(intrflush(NULL,ch), "intrflush");
 }
 
+#if !defined(__NetBSD__)
 static PyObject *
 PyCurses_KeyName(PyObject *self, PyObject *args)
 {
@@ -1815,6 +1845,7 @@ PyCurses_KeyName(PyObject *self, PyObject *args)
 
   return PyString_FromString((knp == NULL) ? "" : (char *)knp);
 }
+#endif
 
 static PyObject *  
 PyCurses_KillChar(PyObject *self, PyObject *args)  
@@ -2214,7 +2245,9 @@ static PyMethodDef PyCurses_methods[] = {
   {"initscr",             (PyCFunction)PyCurses_InitScr},
   {"intrflush",           (PyCFunction)PyCurses_IntrFlush},
   {"isendwin",            (PyCFunction)PyCurses_isendwin},
+#if !defined(__NetBSD__)
   {"keyname",             (PyCFunction)PyCurses_KeyName},
+#endif
   {"killchar",            (PyCFunction)PyCurses_KillChar}, 
   {"longname",            (PyCFunction)PyCurses_longname}, 
   {"meta",                (PyCFunction)PyCurses_Meta},
@@ -2288,7 +2321,9 @@ init_curses(void)
        SetDictInt("A_DIM",             A_DIM);
        SetDictInt("A_BOLD",            A_BOLD);
        SetDictInt("A_ALTCHARSET",      A_ALTCHARSET);
+#if !defined(__NetBSD__)
        SetDictInt("A_INVIS",           A_INVIS);
+#endif
        SetDictInt("A_PROTECT",         A_PROTECT);
        SetDictInt("A_CHARTEXT",        A_CHARTEXT);
        SetDictInt("A_COLOR",           A_COLOR);
@@ -2360,6 +2395,7 @@ init_curses(void)
          int key;
          char *key_n;
          char *key_n2;
+#if !defined(__NetBSD__)
          for (key=KEY_MIN;key < KEY_MAX; key++) {
            key_n = (char *)keyname(key);
            if (key_n == NULL || strcmp(key_n,"UNKNOWN KEY")==0)
@@ -2383,6 +2419,7 @@ init_curses(void)
            if (key_n2 != key_n)
              free(key_n2);
          }
+#endif
          SetDictInt("KEY_MIN", KEY_MIN);
          SetDictInt("KEY_MAX", KEY_MAX);
        }