[Python-checkins] CVS: python/dist/src/Modules _cursesmodule.c,2.39.2.1,2.39.2.2

Moshe Zadka moshez@users.sourceforge.net
Fri, 30 Mar 2001 06:23:08 -0800


Update of /cvsroot/python/python/dist/src/Modules
In directory usw-pr-cvs1:/tmp/cvs-serv29389/Modules

Modified Files:
      Tag: release20-maint
	_cursesmodule.c 
Log Message:
More _curses compilation-problem fixes.
NetBSD, IRIX and platforms with term.h that makes "lines" a macro


Index: _cursesmodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/_cursesmodule.c,v
retrieving revision 2.39.2.1
retrieving revision 2.39.2.2
diff -C2 -r2.39.2.1 -r2.39.2.2
*** _cursesmodule.c	2001/03/29 19:27:29	2.39.2.1
--- _cursesmodule.c	2001/03/30 14:23:06	2.39.2.2
***************
*** 85,88 ****
--- 85,89 ----
      prototype here. */
  extern char *tigetstr(char *);
+ extern char *tparm(char *instring, ...);
  #endif
  
***************
*** 92,95 ****
--- 93,100 ----
  #endif
  
+ #if defined(_AIX)
+ #define STRICT_SYSV_CURSES
+ #endif
+ 
  /* Definition of exception curses.error */
  
***************
*** 262,268 ****
--- 267,281 ----
  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)")
***************
*** 607,614 ****
--- 620,629 ----
    }
    
+ #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");
***************
*** 687,691 ****
--- 702,710 ----
      return Py_BuildValue("c", rtn);
    else
+ #if defined(__NetBSD__)
+     return PyString_FromString(unctrl(rtn));
+ #else
      return PyString_FromString((char *)keyname(rtn));
+ #endif
  }
  
***************
*** 1006,1010 ****
--- 1025,1033 ----
    int rtn;
  
+ #if defined(__NetBSD__)
+   if (0) {
+ #else
    if (self->win->_flags & _ISPAD) {
+ #endif
      switch(ARG_COUNT(args)) {
      case 6:
***************
*** 1068,1072 ****
--- 1091,1099 ----
    int rtn;
    
+ #if defined(__NetBSD__)
+   if (0) {
+ #else
    if (self->win->_flags & _ISPAD) {
+ #endif
      switch(ARG_COUNT(args)) {
      case 6:
***************
*** 1132,1138 ****
--- 1159,1167 ----
  
    /* 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);
  
***************
*** 1148,1152 ****
  PyCursesWindow_Scroll(PyCursesWindowObject *self, PyObject *args)
  {
!   int lines;
    switch(ARG_COUNT(args)) {
    case 0:
--- 1177,1181 ----
  PyCursesWindow_Scroll(PyCursesWindowObject *self, PyObject *args)
  {
!   int nlines;
    switch(ARG_COUNT(args)) {
    case 0:
***************
*** 1154,1160 ****
      break;
    case 1:
!     if (!PyArg_Parse(args, "i;lines", &lines))
        return NULL;
!     return PyCursesCheckERR(wscrl(self->win, lines), "scroll");
    default:
      PyErr_SetString(PyExc_TypeError, "scroll requires 0 or 1 arguments");
--- 1183,1189 ----
      break;
    case 1:
!     if (!PyArg_Parse(args, "i;nlines", &nlines))
        return NULL;
!     return PyCursesCheckERR(wscrl(self->win, nlines), "scroll");
    default:
      PyErr_SetString(PyExc_TypeError, "scroll requires 0 or 1 arguments");
***************
*** 1688,1692 ****
  {
    WINDOW *win;
!   PyObject *lines, *cols;
  
    if (!PyArg_NoArgs(args)) return NULL;
--- 1717,1721 ----
  {
    WINDOW *win;
!   PyObject *nlines, *cols;
  
    if (!PyArg_NoArgs(args)) return NULL;
***************
*** 1772,1778 ****
  #endif
  
!   lines = PyInt_FromLong((long) LINES);
!   PyDict_SetItemString(ModDict, "LINES", lines);
!   Py_DECREF(lines);
    cols = PyInt_FromLong((long) COLS);
    PyDict_SetItemString(ModDict, "COLS", cols);
--- 1801,1807 ----
  #endif
  
!   nlines = PyInt_FromLong((long) LINES);
!   PyDict_SetItemString(ModDict, "LINES", nlines);
!   Py_DECREF(nlines);
    cols = PyInt_FromLong((long) COLS);
    PyDict_SetItemString(ModDict, "COLS", cols);
***************
*** 1802,1805 ****
--- 1831,1835 ----
  }
  
+ #if !defined(__NetBSD__)
  static PyObject *
  PyCurses_KeyName(PyObject *self, PyObject *args)
***************
*** 1816,1819 ****
--- 1846,1850 ----
    return PyString_FromString((knp == NULL) ? "" : (char *)knp);
  }
+ #endif
  
  static PyObject *  
***************
*** 2215,2219 ****
--- 2246,2252 ----
    {"intrflush",           (PyCFunction)PyCurses_IntrFlush},
    {"isendwin",            (PyCFunction)PyCurses_isendwin},
+ #if !defined(__NetBSD__)
    {"keyname",             (PyCFunction)PyCurses_KeyName},
+ #endif
    {"killchar",            (PyCFunction)PyCurses_KillChar}, 
    {"longname",            (PyCFunction)PyCurses_longname}, 
***************
*** 2289,2293 ****
--- 2322,2328 ----
  	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);
***************
*** 2361,2364 ****
--- 2396,2400 ----
  	  char *key_n;
  	  char *key_n2;
+ #if !defined(__NetBSD__)
  	  for (key=KEY_MIN;key < KEY_MAX; key++) {
  	    key_n = (char *)keyname(key);
***************
*** 2384,2387 ****
--- 2420,2424 ----
  	      free(key_n2);
  	  }
+ #endif
  	  SetDictInt("KEY_MIN", KEY_MIN);
  	  SetDictInt("KEY_MAX", KEY_MAX);