[Python-checkins] CVS: python/dist/src/Modules _cursesmodule.c,2.56,2.57
A.M. Kuchling
akuchling@users.sourceforge.net
2001年10月20日 09:05:54 -0700
Update of /cvsroot/python/python/dist/src/Modules
In directory usw-pr-cvs1:/tmp/cvs-serv22149
Modified Files:
_cursesmodule.c
Log Message:
Add two forgotten 'break' statements
Allow passing strings to the .border() method
Correct some error messages ("1 or 4" -> "1 to 4")
Bump version number
Tweak code formatting
Update my e-mail address
Index: _cursesmodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/_cursesmodule.c,v
retrieving revision 2.56
retrieving revision 2.57
diff -C2 -d -r2.56 -r2.57
*** _cursesmodule.c 2001年10月13日 09:00:42 2.56
--- _cursesmodule.c 2001年10月20日 16:05:52 2.57
***************
*** 9,13 ****
* Copyright 1996,1997 by Oliver Andrich, Koblenz, Germany.
*
! * Tidied for Python 1.6, and currently maintained by AMK (amk1@bigfoot.com)
*
* Permission is hereby granted, free of charge, to any person obtaining
--- 9,14 ----
* Copyright 1996,1997 by Oliver Andrich, Koblenz, Germany.
*
! * Tidied for Python 1.6, and currently maintained by
! * <akuchlin@mems-exchange.org>.
*
* Permission is hereby granted, free of charge, to any person obtaining
***************
*** 96,100 ****
/* Release Number */
! char *PyCursesVersion = "2.1";
/* Includes */
--- 97,101 ----
/* Release Number */
! char *PyCursesVersion = "2.2";
/* Includes */
***************
*** 389,393 ****
break;
default:
! PyErr_SetString(PyExc_TypeError, "addch requires 1 or 4 arguments");
return NULL;
}
--- 390,394 ----
break;
default:
! PyErr_SetString(PyExc_TypeError, "addch requires 1 to 4 arguments");
return NULL;
}
***************
*** 561,570 ****
PyCursesWindow_Border(PyCursesWindowObject *self, PyObject *args)
{
! chtype ls, rs, ts, bs, tl, tr, bl, br;
! ls = rs = ts = bs = tl = tr = bl = br = 0;
! if (!PyArg_Parse(args,"|llllllll;ls,rs,ts,bs,tl,tr,bl,br",
! &ls, &rs, &ts, &bs, &tl, &tr, &bl, &br))
return NULL;
! wborder(self->win, ls, rs, ts, bs, tl, tr, bl, br);
Py_INCREF(Py_None);
return Py_None;
--- 562,591 ----
PyCursesWindow_Border(PyCursesWindowObject *self, PyObject *args)
{
! PyObject *temp[8];
! chtype ch[8];
! int i;
!
! /* Clear the array of parameters */
! for(i=0; i<8; i++) {
! temp[i] = NULL;
! ch[i] = 0;
! }
!
! if (!PyArg_ParseTuple(args,"|OOOOOOOO;ls,rs,ts,bs,tl,tr,bl,br",
! &temp[0], &temp[1], &temp[2], &temp[3],
! &temp[4], &temp[5], &temp[6], &temp[7]))
return NULL;
!
! for(i=0; i<8; i++) {
! if (temp[i] != NULL && !PyCurses_ConvertToChtype(temp[i], &ch[i])) {
! PyErr_Format(PyExc_TypeError,
! "argument %i must be a ch or an int", i+1);
! return NULL;
! }
! }
!
! wborder(self->win,
! ch[0], ch[1], ch[2], ch[3],
! ch[4], ch[5], ch[6], ch[7]);
Py_INCREF(Py_None);
return Py_None;
***************
*** 835,840 ****
return NULL;
code = wmove(self->win, y, x);
default:
! PyErr_SetString(PyExc_TypeError, "hline requires 2 or 5 arguments");
return NULL;
}
--- 856,862 ----
return NULL;
code = wmove(self->win, y, x);
+ break;
default:
! PyErr_SetString(PyExc_TypeError, "hline requires 2 to 5 arguments");
return NULL;
}
***************
*** 1361,1366 ****
return NULL;
code = wmove(self->win, y, x);
default:
! PyErr_SetString(PyExc_TypeError, "vline requires 2 or 5 arguments");
return NULL;
}
--- 1383,1389 ----
return NULL;
code = wmove(self->win, y, x);
+ break;
default:
! PyErr_SetString(PyExc_TypeError, "vline requires 2 to 5 arguments");
return NULL;
}
***************
*** 1432,1437 ****
/* Backward compatibility alias -- remove in Python 2.1 */
{"nooutrefresh", (PyCFunction)PyCursesWindow_NoOutRefresh},
! {"overlay", (PyCFunction)PyCursesWindow_Overlay, METH_VARARGS},
! {"overwrite", (PyCFunction)PyCursesWindow_Overwrite, METH_VARARGS},
{"putwin", (PyCFunction)PyCursesWindow_PutWin},
{"redrawln", (PyCFunction)PyCursesWindow_RedrawLine},
--- 1455,1461 ----
/* Backward compatibility alias -- remove in Python 2.1 */
{"nooutrefresh", (PyCFunction)PyCursesWindow_NoOutRefresh},
! {"overlay", (PyCFunction)PyCursesWindow_Overlay, METH_VARARGS},
! {"overwrite", (PyCFunction)PyCursesWindow_Overwrite,
! METH_VARARGS},
{"putwin", (PyCFunction)PyCursesWindow_PutWin},
{"redrawln", (PyCFunction)PyCursesWindow_RedrawLine},
***************
*** 1456,1460 ****
{"untouchwin", (PyCFunction)PyCursesWindow_untouchwin},
{"vline", (PyCFunction)PyCursesWindow_Vline},
! {NULL, NULL} /* sentinel */
};
--- 1480,1484 ----
{"untouchwin", (PyCFunction)PyCursesWindow_untouchwin},
{"vline", (PyCFunction)PyCursesWindow_Vline},
! {NULL, NULL} /* sentinel */
};
***************
*** 2445,2449 ****
{"savetty", (PyCFunction)PyCurses_savetty},
{"setsyx", (PyCFunction)PyCurses_setsyx},
! {"setupterm", (PyCFunction)PyCurses_setupterm, METH_VARARGS|METH_KEYWORDS},
{"start_color", (PyCFunction)PyCurses_Start_Color},
{"termattrs", (PyCFunction)PyCurses_termattrs},
--- 2469,2474 ----
{"savetty", (PyCFunction)PyCurses_savetty},
{"setsyx", (PyCFunction)PyCurses_setsyx},
! {"setupterm", (PyCFunction)PyCurses_setupterm,
! METH_VARARGS|METH_KEYWORDS},
{"start_color", (PyCFunction)PyCurses_Start_Color},
{"termattrs", (PyCFunction)PyCurses_termattrs},
***************
*** 2457,2461 ****
{"ungetch", (PyCFunction)PyCurses_UngetCh},
{"use_env", (PyCFunction)PyCurses_Use_Env},
! {NULL, NULL} /* sentinel */
};
--- 2482,2486 ----
{"ungetch", (PyCFunction)PyCurses_UngetCh},
{"use_env", (PyCFunction)PyCurses_Use_Env},
! {NULL, NULL} /* sentinel */
};