summaryrefslogtreecommitdiffstats
path: root/Modules/_curses_panel.c
diff options
context:
space:
mode:
authorMartin v. Löwis <martin@v.loewis.de>2002-01-17 23:08:27 (GMT)
committerMartin v. Löwis <martin@v.loewis.de>2002-01-17 23:08:27 (GMT)
commitc0e1671c71dfcf25c8584b06a2e9584a8806a325 (patch)
tree0fca39adcdeadfa0674f298208a3813c4472d294 /Modules/_curses_panel.c
parentac6dd0a81715b5bedd2e6fb25f7a80ef29d560c0 (diff)
downloadcpython-c0e1671c71dfcf25c8584b06a2e9584a8806a325.zip
cpython-c0e1671c71dfcf25c8584b06a2e9584a8806a325.tar.gz
cpython-c0e1671c71dfcf25c8584b06a2e9584a8806a325.tar.bz2
Patch #477752: Drop old-style getargs from curses.
Diffstat (limited to 'Modules/_curses_panel.c')
-rw-r--r--Modules/_curses_panel.c64
1 files changed, 23 insertions, 41 deletions
diff --git a/Modules/_curses_panel.c b/Modules/_curses_panel.c
index 11bf5c8..f95392f 100644
--- a/Modules/_curses_panel.c
+++ b/Modules/_curses_panel.c
@@ -141,14 +141,12 @@ find_po(PANEL *pan)
PARSESTR - format string for argument parsing */
#define Panel_NoArgNoReturnFunction(X) \
-static PyObject *PyCursesPanel_##X(PyCursesPanelObject *self, PyObject *args) \
-{ if (!PyArg_NoArgs(args)) return NULL; \
- return PyCursesCheckERR(X(self->pan), # X); }
+static PyObject *PyCursesPanel_##X(PyCursesPanelObject *self) \
+{ return PyCursesCheckERR(X(self->pan), # X); }
#define Panel_NoArgTrueFalseFunction(X) \
-static PyObject *PyCursesPanel_##X(PyCursesPanelObject *self, PyObject *args) \
+static PyObject *PyCursesPanel_##X(PyCursesPanelObject *self) \
{ \
- if (!PyArg_NoArgs(args)) return NULL; \
if (X (self->pan) == FALSE) { Py_INCREF(Py_False); return Py_False; } \
else { Py_INCREF(Py_True); return Py_True; } }
@@ -156,7 +154,7 @@ static PyObject *PyCursesPanel_##X(PyCursesPanelObject *self, PyObject *args) \
static PyObject *PyCursesPanel_##X(PyCursesPanelObject *self, PyObject *args) \
{ \
TYPE arg1, arg2; \
- if (!PyArg_Parse(args,PARSESTR, &arg1, &arg2)) return NULL; \
+ if (!PyArg_ParseTuple(args, PARSESTR, &arg1, &arg2)) return NULL; \
return PyCursesCheckERR(X(self->pan, arg1, arg2), # X); }
/* ------------- PANEL routines --------------- */
@@ -166,7 +164,7 @@ Panel_NoArgNoReturnFunction(hide_panel)
Panel_NoArgNoReturnFunction(show_panel)
Panel_NoArgNoReturnFunction(top_panel)
Panel_NoArgTrueFalseFunction(panel_hidden)
-Panel_TwoArgNoReturnFunction(move_panel, int, "(ii);y,x")
+Panel_TwoArgNoReturnFunction(move_panel, int, "ii;y,x")
/* Allocation and deallocation of Panel Objects */
@@ -199,13 +197,11 @@ PyCursesPanel_Dealloc(PyCursesPanelObject *po)
/* panel_above(NULL) returns the bottom panel in the stack. To get
this behaviour we use curses.panel.bottom_panel(). */
static PyObject *
-PyCursesPanel_above(PyCursesPanelObject *self, PyObject *args)
+PyCursesPanel_above(PyCursesPanelObject *self)
{
PANEL *pan;
PyCursesPanelObject *po;
- if (!PyArg_NoArgs(args)) return NULL;
-
pan = panel_above(self->pan);
if (pan == NULL) { /* valid output, it means the calling panel
@@ -226,13 +222,11 @@ PyCursesPanel_above(PyCursesPanelObject *self, PyObject *args)
/* panel_below(NULL) returns the top panel in the stack. To get
this behaviour we use curses.panel.top_panel(). */
static PyObject *
-PyCursesPanel_below(PyCursesPanelObject *self, PyObject *args)
+PyCursesPanel_below(PyCursesPanelObject *self)
{
PANEL *pan;
PyCursesPanelObject *po;
- if (!PyArg_NoArgs(args)) return NULL;
-
pan = panel_below(self->pan);
if (pan == NULL) { /* valid output, it means the calling panel
@@ -251,10 +245,8 @@ PyCursesPanel_below(PyCursesPanelObject *self, PyObject *args)
}
static PyObject *
-PyCursesPanel_window(PyCursesPanelObject *self, PyObject *args)
+PyCursesPanel_window(PyCursesPanelObject *self)
{
- if (!PyArg_NoArgs(args)) return NULL;
-
Py_INCREF(self->wo);
return (PyObject *)self->wo;
}
@@ -266,7 +258,7 @@ PyCursesPanel_replace_panel(PyCursesPanelObject *self, PyObject *args)
PyCursesWindowObject *temp;
int rtn;
- if (ARG_COUNT(args) != 1) {
+ if (PyTuple_Size(args) != 1) {
PyErr_SetString(PyExc_TypeError, "replace requires one argument");
return NULL;
}
@@ -294,27 +286,18 @@ PyCursesPanel_replace_panel(PyCursesPanelObject *self, PyObject *args)
}
static PyObject *
-PyCursesPanel_set_panel_userptr(PyCursesPanelObject *self, PyObject *args)
+PyCursesPanel_set_panel_userptr(PyCursesPanelObject *self, PyObject *obj)
{
- PyObject *obj;
-
- if (ARG_COUNT(args) != 1) {
- PyErr_SetString(PyExc_TypeError, "set_userptr requires one argument");
- return NULL;
- }
- obj = PyTuple_GetItem(args, 0);
Py_INCREF(obj);
return PyCursesCheckERR(set_panel_userptr(self->pan, (void*)obj),
"set_panel_userptr");
}
-static PyObject *PyCursesPanel_userptr
-(PyCursesPanelObject *self, PyObject *args)
+static PyObject *
+PyCursesPanel_userptr(PyCursesPanelObject *self)
{
PyObject *obj;
PyCursesInitialised;
- if (!PyArg_NoArgs(args))
- return NULL;
obj = (PyObject *) panel_userptr(self->pan);
Py_INCREF(obj);
return obj;
@@ -324,20 +307,19 @@ static PyObject *PyCursesPanel_userptr
/* Module interface */
static PyMethodDef PyCursesPanel_Methods[] = {
- {"above", (PyCFunction)PyCursesPanel_above},
- {"below", (PyCFunction)PyCursesPanel_below},
- {"bottom", (PyCFunction)PyCursesPanel_bottom_panel},
- {"hidden", (PyCFunction)PyCursesPanel_panel_hidden},
- {"hide", (PyCFunction)PyCursesPanel_hide_panel},
- {"move", (PyCFunction)PyCursesPanel_move_panel},
+ {"above", (PyCFunction)PyCursesPanel_above, METH_NOARGS},
+ {"below", (PyCFunction)PyCursesPanel_below, METH_NOARGS},
+ {"bottom", (PyCFunction)PyCursesPanel_bottom_panel, METH_NOARGS},
+ {"hidden", (PyCFunction)PyCursesPanel_panel_hidden, METH_NOARGS},
+ {"hide", (PyCFunction)PyCursesPanel_hide_panel, METH_NOARGS},
+ {"move", (PyCFunction)PyCursesPanel_move_panel, METH_VARARGS},
{"replace", (PyCFunction)PyCursesPanel_replace_panel,
METH_VARARGS},
- {"set_userptr", (PyCFunction)PyCursesPanel_set_panel_userptr,
- METH_VARARGS},
- {"show", (PyCFunction)PyCursesPanel_show_panel},
- {"top", (PyCFunction)PyCursesPanel_top_panel},
- {"userptr", (PyCFunction)PyCursesPanel_userptr},
- {"window", (PyCFunction)PyCursesPanel_window},
+ {"set_userptr", (PyCFunction)PyCursesPanel_set_panel_userptr, METH_O},
+ {"show", (PyCFunction)PyCursesPanel_show_panel, METH_NOARGS},
+ {"top", (PyCFunction)PyCursesPanel_top_panel, METH_NOARGS},
+ {"userptr", (PyCFunction)PyCursesPanel_userptr, METH_NOARGS},
+ {"window", (PyCFunction)PyCursesPanel_window, METH_NOARGS},
{NULL, NULL} /* sentinel */
};