summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2018-05-10 08:27:23 (GMT)
committerGitHub <noreply@github.com>2018-05-10 08:27:23 (GMT)
commitb00854caa080cec613496d3a5e1b0891c9ff83e6 (patch)
tree7d46b563232b3f3e6d99ed8bee0134f3fe084f03
parentd518d8bc8d5dac1a1270612f424d33e0e5afc2b5 (diff)
downloadcpython-b00854caa080cec613496d3a5e1b0891c9ff83e6.zip
cpython-b00854caa080cec613496d3a5e1b0891c9ff83e6.tar.gz
cpython-b00854caa080cec613496d3a5e1b0891c9ff83e6.tar.bz2
bpo-20171: Convert the _curses and _curses_panel modules to Argument Clinic. (GH-4251)
-rw-r--r--Include/py_curses.h59
-rw-r--r--Modules/_curses_panel.c284
-rw-r--r--Modules/_cursesmodule.c3422
-rw-r--r--Modules/clinic/_curses_panel.c.h317
-rw-r--r--Modules/clinic/_cursesmodule.c.h3790
5 files changed, 6543 insertions, 1329 deletions
diff --git a/Include/py_curses.h b/Include/py_curses.h
index 0eebc36..2702b37 100644
--- a/Include/py_curses.h
+++ b/Include/py_curses.h
@@ -91,65 +91,6 @@ static void **PyCurses_API;
static const char catchall_ERR[] = "curses function returned ERR";
static const char catchall_NULL[] = "curses function returned NULL";
-/* Function Prototype Macros - They are ugly but very, very useful. ;-)
-
- X - function name
- TYPE - parameter Type
- ERGSTR - format string for construction of the return value
- PARSESTR - format string for argument parsing
- */
-
-#define NoArgNoReturnFunction(X) \
-static PyObject *PyCurses_ ## X (PyObject *self) \
-{ \
- PyCursesInitialised \
- return PyCursesCheckERR(X(), # X); }
-
-#define NoArgOrFlagNoReturnFunction(X) \
-static PyObject *PyCurses_ ## X (PyObject *self, PyObject *args) \
-{ \
- int flag = 0; \
- PyCursesInitialised \
- switch(PyTuple_Size(args)) { \
- case 0: \
- return PyCursesCheckERR(X(), # X); \
- case 1: \
- if (!PyArg_ParseTuple(args, "i;True(1) or False(0)", &flag)) return NULL; \
- if (flag) return PyCursesCheckERR(X(), # X); \
- else return PyCursesCheckERR(no ## X (), # X); \
- default: \
- PyErr_SetString(PyExc_TypeError, # X " requires 0 or 1 arguments"); \
- return NULL; } }
-
-#define NoArgReturnIntFunction(X) \
-static PyObject *PyCurses_ ## X (PyObject *self) \
-{ \
- PyCursesInitialised \
- return PyLong_FromLong((long) X()); }
-
-
-#define NoArgReturnStringFunction(X) \
-static PyObject *PyCurses_ ## X (PyObject *self) \
-{ \
- PyCursesInitialised \
- return PyBytes_FromString(X()); }
-
-#define NoArgTrueFalseFunction(X) \
-static PyObject *PyCurses_ ## X (PyObject *self) \
-{ \
- PyCursesInitialised \
- if (X () == FALSE) { \
- Py_RETURN_FALSE; \
- } \
- Py_RETURN_TRUE; }
-
-#define NoArgNoReturnVoidFunction(X) \
-static PyObject *PyCurses_ ## X (PyObject *self) \
-{ \
- PyCursesInitialised \
- X(); \
- Py_RETURN_NONE; }
-
#ifdef __cplusplus
}
#endif
diff --git a/Modules/_curses_panel.c b/Modules/_curses_panel.c
index a98d2bf..609718f 100644
--- a/Modules/_curses_panel.c
+++ b/Modules/_curses_panel.c
@@ -162,38 +162,69 @@ find_po(PANEL *pan)
return temp->po;
}
-/* Function Prototype Macros - They are ugly but very, very useful. ;-)
-
- X - function name
- TYPE - parameter Type
- ERGSTR - format string for construction of the return value
- PARSESTR - format string for argument parsing */
-
-#define Panel_NoArgNoReturnFunction(X) \
-static PyObject *PyCursesPanel_##X(PyCursesPanelObject *self) \
-{ return PyCursesCheckERR(X(self->pan), # X); }
-
-#define Panel_NoArgTrueFalseFunction(X) \
-static PyObject *PyCursesPanel_##X(PyCursesPanelObject *self) \
-{ \
- if (X (self->pan) == FALSE) { Py_RETURN_FALSE; } \
- else { Py_RETURN_TRUE; } }
-
-#define Panel_TwoArgNoReturnFunction(X, TYPE, PARSESTR) \
-static PyObject *PyCursesPanel_##X(PyCursesPanelObject *self, PyObject *args) \
-{ \
- TYPE arg1, arg2; \
- if (!PyArg_ParseTuple(args, PARSESTR, &arg1, &arg2)) return NULL; \
- return PyCursesCheckERR(X(self->pan, arg1, arg2), # X); }
+/*[clinic input]
+module _curses_panel
+class _curses_panel.panel "PyCursesPanelObject *" "&PyCursesPanel_Type"
+[clinic start generated code]*/
+/*[clinic end generated code: output=da39a3ee5e6b4b0d input=2f4ef263ca850a31]*/
+
+#include "clinic/_curses_panel.c.h"
/* ------------- PANEL routines --------------- */
-Panel_NoArgNoReturnFunction(bottom_panel)
-Panel_NoArgNoReturnFunction(hide_panel)
-Panel_NoArgNoReturnFunction(show_panel)
-Panel_NoArgNoReturnFunction(top_panel)
-Panel_NoArgTrueFalseFunction(panel_hidden)
-Panel_TwoArgNoReturnFunction(move_panel, int, "ii;y,x")
+/*[clinic input]
+_curses_panel.panel.bottom
+
+Push the panel to the bottom of the stack.
+[clinic start generated code]*/
+
+static PyObject *
+_curses_panel_panel_bottom_impl(PyCursesPanelObject *self)
+/*[clinic end generated code: output=7aa7d14d7e1d1ce6 input=b6c920c071b61e2e]*/
+{
+ return PyCursesCheckERR(bottom_panel(self->pan), "bottom");
+}
+
+/*[clinic input]
+_curses_panel.panel.hide
+
+Hide the panel.
+
+This does not delete the object, it just makes the window on screen invisible.
+[clinic start generated code]*/
+
+static PyObject *
+_curses_panel_panel_hide_impl(PyCursesPanelObject *self)
+/*[clinic end generated code: output=a7bbbd523e1eab49 input=f6ab884e99386118]*/
+{
+ return PyCursesCheckERR(hide_panel(self->pan), "hide");
+}
+
+/*[clinic input]
+_curses_panel.panel.show
+
+Display the panel (which might have been hidden).
+[clinic start generated code]*/
+
+static PyObject *
+_curses_panel_panel_show_impl(PyCursesPanelObject *self)
+/*[clinic end generated code: output=6b4553ab45c97769 input=57b167bbefaa3755]*/
+{
+ return PyCursesCheckERR(show_panel(self->pan), "show");
+}
+
+/*[clinic input]
+_curses_panel.panel.top
+
+Push panel to the top of the stack.
+[clinic start generated code]*/
+
+static PyObject *
+_curses_panel_panel_top_impl(PyCursesPanelObject *self)
+/*[clinic end generated code: output=0f5f2f8cdd2d1777 input=be33975ec3ca0e9a]*/
+{
+ return PyCursesCheckERR(top_panel(self->pan), "top");
+}
/* Allocation and deallocation of Panel Objects */
@@ -234,8 +265,15 @@ PyCursesPanel_Dealloc(PyCursesPanelObject *po)
/* panel_above(NULL) returns the bottom panel in the stack. To get
this behaviour we use curses.panel.bottom_panel(). */
+/*[clinic input]
+_curses_panel.panel.above
+
+Return the panel above the current panel.
+[clinic start generated code]*/
+
static PyObject *
-PyCursesPanel_above(PyCursesPanelObject *self)
+_curses_panel_panel_above_impl(PyCursesPanelObject *self)
+/*[clinic end generated code: output=70ac06d25fd3b4da input=c059994022976788]*/
{
PANEL *pan;
PyCursesPanelObject *po;
@@ -258,8 +296,15 @@ PyCursesPanel_above(PyCursesPanelObject *self)
/* panel_below(NULL) returns the top panel in the stack. To get
this behaviour we use curses.panel.top_panel(). */
+/*[clinic input]
+_curses_panel.panel.below
+
+Return the panel below the current panel.
+[clinic start generated code]*/
+
static PyObject *
-PyCursesPanel_below(PyCursesPanelObject *self)
+_curses_panel_panel_below_impl(PyCursesPanelObject *self)
+/*[clinic end generated code: output=282861122e06e3de input=cc08f61936d297c6]*/
{
PANEL *pan;
PyCursesPanelObject *po;
@@ -280,28 +325,70 @@ PyCursesPanel_below(PyCursesPanelObject *self)
return (PyObject *)po;
}
+/*[clinic input]
+_curses_panel.panel.hidden
+
+Return True if the panel is hidden (not visible), False otherwise.
+[clinic start generated code]*/
+
static PyObject *
-PyCursesPanel_window(PyCursesPanelObject *self)
+_curses_panel_panel_hidden_impl(PyCursesPanelObject *self)
+/*[clinic end generated code: output=66eebd1ab4501a71 input=453d4b4fce25e21a]*/
+{
+ if (panel_hidden(self->pan))
+ Py_RETURN_TRUE;
+ else
+ Py_RETURN_FALSE;
+}
+
+/*[clinic input]
+_curses_panel.panel.move
+
+ y: int
+ x: int
+ /
+
+Move the panel to the screen coordinates (y, x).
+[clinic start generated code]*/
+
+static PyObject *
+_curses_panel_panel_move_impl(PyCursesPanelObject *self, int y, int x)
+/*[clinic end generated code: output=d867535a89777415 input=e0b36b78acc03fba]*/
+{
+ return PyCursesCheckERR(move_panel(self->pan, y, x), "move_panel");
+}
+
+/*[clinic input]
+_curses_panel.panel.window
+
+Return the window object associated with the panel.
+[clinic start generated code]*/
+
+static PyObject *
+_curses_panel_panel_window_impl(PyCursesPanelObject *self)
+/*[clinic end generated code: output=5f05940d4106b4cb input=6067353d2c307901]*/
{
Py_INCREF(self->wo);
return (PyObject *)self->wo;
}
+/*[clinic input]
+_curses_panel.panel.replace
+
+ win: object(type="PyCursesWindowObject *", subclass_of="&PyCursesWindow_Type")
+ /
+
+Change the window associated with the panel to the window win.
+[clinic start generated code]*/
+
static PyObject *
-PyCursesPanel_replace_panel(PyCursesPanelObject *self, PyObject *args)
+_curses_panel_panel_replace_impl(PyCursesPanelObject *self,
+ PyCursesWindowObject *win)
+/*[clinic end generated code: output=2253a95f7b287255 input=4b1c4283987d9dfa]*/
{
PyCursesPanelObject *po;
- PyCursesWindowObject *temp;
int rtn;
- if (PyTuple_Size(args) != 1) {
- PyErr_SetString(PyExc_TypeError, "replace requires one argument");
- return NULL;
- }
- if (!PyArg_ParseTuple(args, "O!;window object",
- &PyCursesWindow_Type, &temp))
- return NULL;
-
po = find_po(self->pan);
if (po == NULL) {
PyErr_SetString(PyExc_RuntimeError,
@@ -309,18 +396,28 @@ PyCursesPanel_replace_panel(PyCursesPanelObject *self, PyObject *args)
return NULL;
}
- rtn = replace_panel(self->pan, temp->win);
+ rtn = replace_panel(self->pan, win->win);
if (rtn == ERR) {
PyErr_SetString(_curses_panelstate_global->PyCursesError, "replace_panel() returned ERR");
return NULL;
}
- Py_INCREF(temp);
- Py_SETREF(po->wo, temp);
+ Py_INCREF(win);
+ Py_SETREF(po->wo, win);
Py_RETURN_NONE;
}
+/*[clinic input]
+_curses_panel.panel.set_userptr
+
+ obj: object
+ /
+
+Set the panel’s user pointer to obj.
+[clinic start generated code]*/
+
static PyObject *
-PyCursesPanel_set_panel_userptr(PyCursesPanelObject *self, PyObject *obj)
+_curses_panel_panel_set_userptr(PyCursesPanelObject *self, PyObject *obj)
+/*[clinic end generated code: output=6fb145b3af88cf4a input=2056be1cd148b05c]*/
{
PyObject *oldobj;
int rc;
@@ -336,8 +433,15 @@ PyCursesPanel_set_panel_userptr(PyCursesPanelObject *self, PyObject *obj)
return PyCursesCheckERR(rc, "set_panel_userptr");
}
+/*[clinic input]
+_curses_panel.panel.userptr
+
+Return the user pointer for the panel.
+[clinic start generated code]*/
+
static PyObject *
-PyCursesPanel_userptr(PyCursesPanelObject *self)
+_curses_panel_panel_userptr_impl(PyCursesPanelObject *self)
+/*[clinic end generated code: output=e849c307b5dc9237 input=f78b7a47aef0fd50]*/
{
PyObject *obj;
PyCursesInitialised;
@@ -355,18 +459,18 @@ PyCursesPanel_userptr(PyCursesPanelObject *self)
/* Module interface */
static PyMethodDef PyCursesPanel_Methods[] = {
- {"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_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},
+ _CURSES_PANEL_PANEL_ABOVE_METHODDEF
+ _CURSES_PANEL_PANEL_BELOW_METHODDEF
+ _CURSES_PANEL_PANEL_BOTTOM_METHODDEF
+ _CURSES_PANEL_PANEL_HIDDEN_METHODDEF
+ _CURSES_PANEL_PANEL_HIDE_METHODDEF
+ _CURSES_PANEL_PANEL_MOVE_METHODDEF
+ _CURSES_PANEL_PANEL_REPLACE_METHODDEF
+ _CURSES_PANEL_PANEL_SET_USERPTR_METHODDEF
+ _CURSES_PANEL_PANEL_SHOW_METHODDEF
+ _CURSES_PANEL_PANEL_TOP_METHODDEF
+ _CURSES_PANEL_PANEL_USERPTR_METHODDEF
+ _CURSES_PANEL_PANEL_WINDOW_METHODDEF
{NULL, NULL} /* sentinel */
};
@@ -379,7 +483,7 @@ static PyType_Slot PyCursesPanel_Type_slots[] = {
};
static PyType_Spec PyCursesPanel_Type_spec = {
- "_curses_panel.curses panel",
+ "_curses_panel.panel",
sizeof(PyCursesPanelObject),
0,
Py_TPFLAGS_DEFAULT,
@@ -390,8 +494,15 @@ static PyType_Spec PyCursesPanel_Type_spec = {
panel of the stack, so it's renamed to bottom_panel().
panel.above() *requires* a panel object in the first place which
may be undesirable. */
+/*[clinic input]
+_curses_panel.bottom_panel
+
+Return the bottom panel in the panel stack.
+[clinic start generated code]*/
+
static PyObject *
-PyCurses_bottom_panel(PyObject *self)
+_curses_panel_bottom_panel_impl(PyObject *module)
+/*[clinic end generated code: output=3aba9f985f4c2bd0 input=634c2a8078b3d7e4]*/
{
PANEL *pan;
PyCursesPanelObject *po;
@@ -414,15 +525,20 @@ PyCurses_bottom_panel(PyObject *self)
return (PyObject *)po;
}
+/*[clinic input]
+_curses_panel.new_panel
+
+ win: object(type="PyCursesWindowObject *", subclass_of="&PyCursesWindow_Type")
+ /
+
+Return a panel object, associating it with the given window win.
+[clinic start generated code]*/
+
static PyObject *
-PyCurses_new_panel(PyObject *self, PyObject *args)
+_curses_panel_new_panel_impl(PyObject *module, PyCursesWindowObject *win)
+/*[clinic end generated code: output=45e948e0176a9bd2 input=74d4754e0ebe4800]*/
{
- PyCursesWindowObject *win;
- PANEL *pan;
-
- if (!PyArg_ParseTuple(args, "O!", &PyCursesWindow_Type, &win))
- return NULL;
- pan = new_panel(win->win);
+ PANEL *pan = new_panel(win->win);
if (pan == NULL) {
PyErr_SetString(_curses_panelstate_global->PyCursesError, catchall_NULL);
return NULL;
@@ -435,8 +551,15 @@ PyCurses_new_panel(PyObject *self, PyObject *args)
of the stack, so it's renamed to top_panel(). panel.below()
*requires* a panel object in the first place which may be
undesirable. */
+/*[clinic input]
+_curses_panel.top_panel
+
+Return the top panel in the panel stack.
+[clinic start generated code]*/
+
static PyObject *
-PyCurses_top_panel(PyObject *self)
+_curses_panel_top_panel_impl(PyObject *module)
+/*[clinic end generated code: output=86704988bea8508e input=e62d6278dba39e79]*/
{
PANEL *pan;
PyCursesPanelObject *po;
@@ -459,7 +582,17 @@ PyCurses_top_panel(PyObject *self)
return (PyObject *)po;
}
-static PyObject *PyCurses_update_panels(PyObject *self)
+/*[clinic input]
+_curses_panel.update_panels
+
+Updates the virtual screen after changes in the panel stack.
+
+This does not call curses.doupdate(), so you’ll have to do this yourself.
+[clinic start generated code]*/
+
+static PyObject *
+_curses_panel_update_panels_impl(PyObject *module)
+/*[clinic end generated code: output=2f3b4c2e03d90ded input=a127069202b0a097]*/
{
PyCursesInitialised;
update_panels();
@@ -470,10 +603,10 @@ static PyObject *PyCurses_update_panels(PyObject *self)
/* List of functions defined in the module */
static PyMethodDef PyCurses_methods[] = {
- {"bottom_panel", (PyCFunction)PyCurses_bottom_panel, METH_NOARGS},
- {"new_panel", (PyCFunction)PyCurses_new_panel, METH_VARARGS},
- {"top_panel", (PyCFunction)PyCurses_top_panel, METH_NOARGS},
- {"update_panels", (PyCFunction)PyCurses_update_panels, METH_NOARGS},
+ _CURSES_PANEL_BOTTOM_PANEL_METHODDEF
+ _CURSES_PANEL_NEW_PANEL_METHODDEF
+ _CURSES_PANEL_TOP_PANEL_METHODDEF
+ _CURSES_PANEL_UPDATE_PANELS_METHODDEF
{NULL, NULL} /* sentinel */
};
@@ -523,6 +656,9 @@ PyInit__curses_panel(void)
PyDict_SetItemString(d, "version", v);
PyDict_SetItemString(d, "__version__", v);
Py_DECREF(v);
+
+ Py_INCREF(_curses_panelstate(m)->PyCursesPanel_Type);
+ PyModule_AddObject(m, "panel", (PyObject *)_curses_panelstate(m)->PyCursesPanel_Type);
return m;
fail:
Py_XDECREF(m);
diff --git a/Modules/_cursesmodule.c b/Modules/_cursesmodule.c
index 7936aef..fe4c9d1 100644
--- a/Modules/_cursesmodule.c
+++ b/Modules/_cursesmodule.c
@@ -135,12 +135,10 @@ typedef chtype attr_t; /* No attr_t type is available */
#endif
/*[clinic input]
-module curses
-class curses.window "PyCursesWindowObject *" "&PyCursesWindow_Type"
+module _curses
+class _curses.window "PyCursesWindowObject *" "&PyCursesWindow_Type"
[clinic start generated code]*/
-/*[clinic end generated code: output=da39a3ee5e6b4b0d input=88c860abdbb50e0c]*/
-
-#include "clinic/_cursesmodule.c.h"
+/*[clinic end generated code: output=da39a3ee5e6b4b0d input=43265c372c2887d6]*/
/* Definition of exception curses.error */
@@ -423,8 +421,7 @@ PyTypeObject PyCursesWindow_Type;
static PyObject * PyCursesWindow_ ## X \
(PyCursesWindowObject *self) \
{ \
- if (X (self->win) == FALSE) { Py_RETURN_FALSE; } \
- else { Py_RETURN_TRUE; } }
+ return PyBool_FromLong(X(self->win)); }
#define Window_NoArgNoReturnVoidFunction(X) \
static PyObject * PyCursesWindow_ ## X \
@@ -562,26 +559,25 @@ PyCursesWindow_Dealloc(PyCursesWindowObject *wo)
/* Addch, Addstr, Addnstr */
/*[clinic input]
-
-curses.window.addch
+_curses.window.addch
[
y: int
- Y-coordinate.
+ Y-coordinate.
x: int
- X-coordinate.
+ X-coordinate.
]
ch: object
- Character to add.
+ Character to add.
[
- attr: long
- Attributes for the character.
+ attr: long(c_default="A_NORMAL") = _curses.A_NORMAL
+ Attributes for the character.
]
/
-Paint character ch at (y, x) with attributes attr.
+Paint the character.
Paint character ch at (y, x) with attributes attr,
overwriting any character previously painted at that location.
@@ -590,13 +586,12 @@ current settings for the window object.
[clinic start generated code]*/
static PyObject *
-curses_window_addch_impl(PyCursesWindowObject *self, int group_left_1, int y,
- int x, PyObject *ch, int group_right_1, long attr)
-/*[clinic end generated code: output=99f7f85078ec06c3 input=5a41efb34a2de338]*/
+_curses_window_addch_impl(PyCursesWindowObject *self, int group_left_1,
+ int y, int x, PyObject *ch, int group_right_1,
+ long attr)
+/*[clinic end generated code: output=00f4c37af3378f45 input=95ce131578458196]*/
{
- PyCursesWindowObject *cwself = (PyCursesWindowObject *)self;
int coordinates_group = group_left_1;
- int attr_group = group_right_1;
int rtn;
int type;
chtype cch = 0;
@@ -606,31 +601,28 @@ curses_window_addch_impl(PyCursesWindowObject *self, int group_left_1, int y,
#endif
const char *funcname;
- if (!attr_group)
- attr = A_NORMAL;
-
#ifdef HAVE_NCURSESW
- type = PyCurses_ConvertToCchar_t(cwself, ch, &cch, wstr);
+ type = PyCurses_ConvertToCchar_t(self, ch, &cch, wstr);
if (type == 2) {
funcname = "add_wch";
wstr[1] = L'\0';
setcchar(&wcval, wstr, attr, 0, NULL);
if (coordinates_group)
- rtn = mvwadd_wch(cwself->win,y,x, &wcval);
+ rtn = mvwadd_wch(self->win,y,x, &wcval);
else {
- rtn = wadd_wch(cwself->win, &wcval);
+ rtn = wadd_wch(self->win, &wcval);
}
}
else
#else
- type = PyCurses_ConvertToCchar_t(cwself, ch, &cch);
+ type = PyCurses_ConvertToCchar_t(self, ch, &cch);
#endif
if (type == 1) {
funcname = "addch";
if (coordinates_group)
- rtn = mvwaddch(cwself->win,y,x, cch | attr);
+ rtn = mvwaddch(self->win,y,x, cch | (attr_t) attr);
else {
- rtn = waddch(cwself->win, cch | attr);
+ rtn = waddch(self->win, cch | (attr_t) attr);
}
}
else {
@@ -639,62 +631,64 @@ curses_window_addch_impl(PyCursesWindowObject *self, int group_left_1, int y,
return PyCursesCheckERR(rtn, funcname);
}
+/*[clinic input]
+_curses.window.addstr
+
+ [
+ y: int
+ Y-coordinate.
+ x: int
+ X-coordinate.
+ ]
+
+ str: object
+ String to add.
+
+ [
+ attr: long
+ Attributes for characters.
+ ]
+ /
+
+Paint the string.
+
+Paint the string str at (y, x) with attributes attr,
+overwriting anything previously on the display.
+By default, the character position and attributes are the
+current settings for the window object.
+[clinic start generated code]*/
+
static PyObject *
-PyCursesWindow_AddStr(PyCursesWindowObject *self, PyObject *args)
+_curses_window_addstr_impl(PyCursesWindowObject *self, int group_left_1,
+ int y, int x, PyObject *str, int group_right_1,
+ long attr)
+/*[clinic end generated code: output=65a928ea85ff3115 input=ff6cbb91448a22a3]*/
{
int rtn;
- int x, y;
int strtype;
- PyObject *strobj, *bytesobj = NULL;
+ PyObject *bytesobj = NULL;
#ifdef HAVE_NCURSESW
wchar_t *wstr = NULL;
#endif
- attr_t attr = A_NORMAL , attr_old = A_NORMAL;
- long lattr;
- int use_xy = FALSE, use_attr = FALSE;
+ attr_t attr_old = A_NORMAL;
+ int use_xy = group_left_1, use_attr = group_right_1;
const char *funcname;
- switch (PyTuple_Size(args)) {
- case 1:
- if (!PyArg_ParseTuple(args,"O;str", &strobj))
- return NULL;
- break;
- case 2:
- if (!PyArg_ParseTuple(args,"Ol;str,attr", &strobj, &lattr))
- return NULL;
- attr = lattr;
- use_attr = TRUE;
- break;
- case 3:
- if (!PyArg_ParseTuple(args,"iiO;int,int,str", &y, &x, &strobj))
- return NULL;
- use_xy = TRUE;
- break;
- case 4:
- if (!PyArg_ParseTuple(args,"iiOl;int,int,str,attr", &y, &x, &strobj, &lattr))
- return NULL;
- attr = lattr;
- use_xy = use_attr = TRUE;
- break;
- default:
- PyErr_SetString(PyExc_TypeError, "addstr requires 1 to 4 arguments");
- return NULL;
- }
#ifdef HAVE_NCURSESW
- strtype = PyCurses_ConvertToString(self, strobj, &bytesobj, &wstr);
+ strtype = PyCurses_ConvertToString(self, str, &bytesobj, &wstr);
#else
- strtype = PyCurses_ConvertToString(self, strobj, &bytesobj, NULL);
+ strtype = PyCurses_ConvertToString(self, str, &bytesobj, NULL);
#endif
if (strtype == 0)
return NULL;
- if (use_attr == TRUE) {
+ if (use_attr) {
attr_old = getattrs(self->win);
(void)wattrset(self->win,attr);
}
#ifdef HAVE_NCURSESW
if (strtype == 2) {
funcname = "addwstr";
- if (use_xy == TRUE)
+ if (use_xy)
rtn = mvwaddwstr(self->win,y,x,wstr);
else
rtn = waddwstr(self->win,wstr);
@@ -705,73 +699,79 @@ PyCursesWindow_AddStr(PyCursesWindowObject *self, PyObject *args)
{
char *str = PyBytes_AS_STRING(bytesobj);
funcname = "addstr";
- if (use_xy == TRUE)
+ if (use_xy)
rtn = mvwaddstr(self->win,y,x,str);
else
rtn = waddstr(self->win,str);
Py_DECREF(bytesobj);
}
- if (use_attr == TRUE)
+ if (use_attr)
(void)wattrset(self->win,attr_old);
return PyCursesCheckERR(rtn, funcname);
}
+/*[clinic input]
+_curses.window.addnstr
+
+ [
+ y: int
+ Y-coordinate.
+ x: int
+ X-coordinate.
+ ]
+
+ str: object
+ String to add.
+
+ n: int
+ Maximal number of characters.
+
+ [
+ attr: long
+ Attributes for characters.
+ ]
+ /
+
+Paint at most n characters of the string.
+
+Paint at most n characters of the string str at (y, x) with
+attributes attr, overwriting anything previously on the display.
+By default, the character position and attributes are the
+current settings for the window object.
+[clinic start generated code]*/
+
static PyObject *
-PyCursesWindow_AddNStr(PyCursesWindowObject *self, PyObject *args)
+_curses_window_addnstr_impl(PyCursesWindowObject *self, int group_left_1,
+ int y, int x, PyObject *str, int n,
+ int group_right_1, long attr)
+/*[clinic end generated code: output=6d21cee2ce6876d9 input=72718415c2744a2a]*/
{
- int rtn, x, y, n;
+ int rtn;
int strtype;
- PyObject *strobj, *bytesobj = NULL;
+ PyObject *bytesobj = NULL;
#ifdef HAVE_NCURSESW
wchar_t *wstr = NULL;
#endif
- attr_t attr = A_NORMAL , attr_old = A_NORMAL;
- long lattr;
- int use_xy = FALSE, use_attr = FALSE;
+ attr_t attr_old = A_NORMAL;
+ int use_xy = group_left_1, use_attr = group_right_1;
const char *funcname;
- switch (PyTuple_Size(args)) {
- case 2:
- if (!PyArg_ParseTuple(args,"Oi;str,n", &strobj, &n))
- return NULL;
- break;
- case 3:
- if (!PyArg_ParseTuple(args,"Oil;str,n,attr", &strobj, &n, &lattr))
- return NULL;
- attr = lattr;
- use_attr = TRUE;
- break;
- case 4:
- if (!PyArg_ParseTuple(args,"iiOi;y,x,str,n", &y, &x, &strobj, &n))
- return NULL;
- use_xy = TRUE;
- break;
- case 5:
- if (!PyArg_ParseTuple(args,"iiOil;y,x,str,n,attr", &y, &x, &strobj, &n, &lattr))
- return NULL;
- attr = lattr;
- use_xy = use_attr = TRUE;
- break;
- default:
- PyErr_SetString(PyExc_TypeError, "addnstr requires 2 to 5 arguments");
- return NULL;
- }
#ifdef HAVE_NCURSESW
- strtype = PyCurses_ConvertToString(self, strobj, &bytesobj, &wstr);
+ strtype = PyCurses_ConvertToString(self, str, &bytesobj, &wstr);
#else
- strtype = PyCurses_ConvertToString(self, strobj, &bytesobj, NULL);
+ strtype = PyCurses_ConvertToString(self, str, &bytesobj, NULL);
#endif
if (strtype == 0)
return NULL;
- if (use_attr == TRUE) {
+ if (use_attr) {
attr_old = getattrs(self->win);
(void)wattrset(self->win,attr);
}
#ifdef HAVE_NCURSESW
if (strtype == 2) {
funcname = "addnwstr";
- if (use_xy == TRUE)
+ if (use_xy)
rtn = mvwaddnwstr(self->win,y,x,wstr,n);
else
rtn = waddnwstr(self->win,wstr,n);
@@ -782,125 +782,172 @@ PyCursesWindow_AddNStr(PyCursesWindowObject *self, PyObject *args)
{
char *str = PyBytes_AS_STRING(bytesobj);
funcname = "addnstr";
- if (use_xy == TRUE)
+ if (use_xy)
rtn = mvwaddnstr(self->win,y,x,str,n);
else
rtn = waddnstr(self->win,str,n);
Py_DECREF(bytesobj);
}
- if (use_attr == TRUE)
+ if (use_attr)
(void)wattrset(self->win,attr_old);
return PyCursesCheckERR(rtn, funcname);
}
+/*[clinic input]
+_curses.window.bkgd
+
+ ch: object
+ Background character.
+ attr: long(c_default="A_NORMAL") = _curses.A_NORMAL
+ Background attributes.
+ /
+
+Set the background property of the window.
+[clinic start generated code]*/
+
static PyObject *
-PyCursesWindow_Bkgd(PyCursesWindowObject *self, PyObject *args)
+_curses_window_bkgd_impl(PyCursesWindowObject *self, PyObject *ch, long attr)
+/*[clinic end generated code: output=058290afb2cf4034 input=634015bcb339283d]*/
{
- PyObject *temp;
chtype bkgd;
- attr_t attr = A_NORMAL;
- long lattr;
- switch (PyTuple_Size(args)) {
- case 1:
- if (!PyArg_ParseTuple(args, "O;ch or int", &temp))
- return NULL;
- break;
- case 2:
- if (!PyArg_ParseTuple(args,"Ol;ch or int,attr", &temp, &lattr))
- return NULL;
- attr = lattr;
- break;
- default:
- PyErr_SetString(PyExc_TypeError, "bkgd requires 1 or 2 arguments");
- return NULL;
- }
-
- if (!PyCurses_ConvertToChtype(self, temp, &bkgd))
+ if (!PyCurses_ConvertToChtype(self, ch, &bkgd))
return NULL;
return PyCursesCheckERR(wbkgd(self->win, bkgd | attr), "bkgd");
}
+/*[clinic input]
+_curses.window.attroff
+
+ attr: long
+ /
+
+Remove attribute attr from the "background" set.
+[clinic start generated code]*/
+
static PyObject *
-PyCursesWindow_AttrOff(PyCursesWindowObject *self, PyObject *args)
+_curses_window_attroff_impl(PyCursesWindowObject *self, long attr)
+/*[clinic end generated code: output=8a2fcd4df682fc64 input=786beedf06a7befe]*/
{
- long lattr;
- if (!PyArg_ParseTuple(args,"l;attr", &lattr))
- return NULL;
- return PyCursesCheckERR(wattroff(self->win, (attr_t)lattr), "attroff");
+ return PyCursesCheckERR(wattroff(self->win, (attr_t)attr), "attroff");
}
+/*[clinic input]
+_curses.window.attron
+
+ attr: long
+ /
+
+Add attribute attr from the "background" set.
+[clinic start generated code]*/
+
static PyObject *
-PyCursesWindow_AttrOn(PyCursesWindowObject *self, PyObject *args)
+_curses_window_attron_impl(PyCursesWindowObject *self, long attr)
+/*[clinic end generated code: output=7afea43b237fa870 input=5a88fba7b1524f32]*/
{
- long lattr;
- if (!PyArg_ParseTuple(args,"l;attr", &lattr))
- return NULL;
- return PyCursesCheckERR(wattron(self->win, (attr_t)lattr), "attron");
+ return PyCursesCheckERR(wattron(self->win, (attr_t)attr), "attron");
}
+/*[clinic input]
+_curses.window.attrset
+
+ attr: long
+ /
+
+Set the "background" set of attributes.
+[clinic start generated code]*/
+
static PyObject *
-PyCursesWindow_AttrSet(PyCursesWindowObject *self, PyObject *args)
+_curses_window_attrset_impl(PyCursesWindowObject *self, long attr)
+/*[clinic end generated code: output=84e379bff20c0433 input=42e400c0d0154ab5]*/
{
- long lattr;
- if (!PyArg_ParseTuple(args,"l;attr", &lattr))
- return NULL;
- return PyCursesCheckERR(wattrset(self->win, (attr_t)lattr), "attrset");
+ return PyCursesCheckERR(wattrset(self->win, (attr_t)attr), "attrset");
}
+/*[clinic input]
+_curses.window.bkgdset
+
+ ch: object
+ Background character.
+ attr: long(c_default="A_NORMAL") = _curses.A_NORMAL
+ Background attributes.
+ /
+
+Set the window's background.
+[clinic start generated code]*/
+
static PyObject *
-PyCursesWindow_BkgdSet(PyCursesWindowObject *self, PyObject *args)
+_curses_window_bkgdset_impl(PyCursesWindowObject *self, PyObject *ch,
+ long attr)
+/*[clinic end generated code: output=8cb994fc4d7e2496 input=e09c682425c9e45b]*/
{
- PyObject *temp;
chtype bkgd;
- attr_t attr = A_NORMAL;
- long lattr;
-
- switch (PyTuple_Size(args)) {
- case 1:
- if (!PyArg_ParseTuple(args, "O;ch or int", &temp))
- return NULL;
- break;
- case 2:
- if (!PyArg_ParseTuple(args,"Ol;ch or int,attr", &temp, &lattr))
- return NULL;
- attr = lattr;
- break;
- default:
- PyErr_SetString(PyExc_TypeError, "bkgdset requires 1 or 2 arguments");
- return NULL;
- }
- if (!PyCurses_ConvertToChtype(self, temp, &bkgd))
+ if (!PyCurses_ConvertToChtype(self, ch, &bkgd))
return NULL;
wbkgdset(self->win, bkgd | attr);
return PyCursesCheckERR(0, "bkgdset");
}
+/*[clinic input]
+_curses.window.border
+
+ ls: object(c_default="NULL") = _curses.ACS_VLINE
+ Left side.
+ rs: object(c_default="NULL") = _curses.ACS_VLINE
+ Right side.
+ ts: object(c_default="NULL") = _curses.ACS_HLINE
+ Top side.
+ bs: object(c_default="NULL") = _curses.ACS_HLINE
+ Bottom side.
+ tl: object(c_default="NULL") = _curses.ACS_ULCORNER
+ Upper-left corner.
+ tr: object(c_default="NULL") = _curses.ACS_URCORNER
+ Upper-right corner.
+ bl: object(c_default="NULL") = _curses.ACS_LLCORNER
+ Bottom-left corner.
+ br: object(c_default="NULL") = _curses.ACS_LRCORNER
+ Bottom-right corner.
+ /
+
+Draw a border around the edges of the window.
+
+Each parameter specifies the character to use for a specific part of the
+border. The characters can be specified as integers or as one-character
+strings. A 0 value for any parameter will cause the default character to be
+used for that parameter.
+[clinic start generated code]*/
+
static PyObject *
-PyCursesWindow_Border(PyCursesWindowObject *self, PyObject *args)
+_curses_window_border_impl(PyCursesWindowObject *self, PyObject *ls,
+ PyObject *rs, PyObject *ts, PyObject *bs,
+ PyObject *tl, PyObject *tr, PyObject *bl,
+ PyObject *br)
+/*[clinic end generated code: output=670ef38d3d7c2aa3 input=e015f735d67a240b]*/
{
- PyObject *temp[8];
chtype ch[8];
int i;
/* Clear the array of parameters */
- for(i=0; i<8; i++) {
- temp[i] = NULL;
+ for(i=0; i<8; i++)
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]))
+#define CONVERTTOCHTYPE(obj, i) \
+ if ((obj) != NULL && !PyCurses_ConvertToChtype(self, (obj), &ch[(i)])) \
return NULL;
- for(i=0; i<8; i++) {
- if (temp[i] != NULL && !PyCurses_ConvertToChtype(self, temp[i], &ch[i]))
- return NULL;
- }
+ CONVERTTOCHTYPE(ls, 0);
+ CONVERTTOCHTYPE(rs, 1);
+ CONVERTTOCHTYPE(ts, 2);
+ CONVERTTOCHTYPE(bs, 3);
+ CONVERTTOCHTYPE(tl, 4);
+ CONVERTTOCHTYPE(tr, 5);
+ CONVERTTOCHTYPE(bl, 6);
+ CONVERTTOCHTYPE(br, 7);
+
+#undef CONVERTTOCHTYPE
wborder(self->win,
ch[0], ch[1], ch[2], ch[3],
@@ -908,20 +955,34 @@ PyCursesWindow_Border(PyCursesWindowObject *self, PyObject *args)
Py_RETURN_NONE;
}
+/*[clinic input]
+_curses.window.box
+
+ [
+ verch: object(c_default="_PyLong_Zero") = 0
+ Left and right side.
+ horch: object(c_default="_PyLong_Zero") = 0
+ Top and bottom side.
+ ]
+ /
+
+Draw a border around the edges of the window.
+
+Similar to border(), but both ls and rs are verch and both ts and bs are
+horch. The default corner characters are always used by this function.
+[clinic start generated code]*/
+
static PyObject *
-PyCursesWindow_Box(PyCursesWindowObject *self, PyObject *args)
+_curses_window_box_impl(PyCursesWindowObject *self, int group_right_1,
+ PyObject *verch, PyObject *horch)
+/*[clinic end generated code: output=f3fcb038bb287192 input=465a121741c1efdf]*/
{
- PyObject *temp1, *temp2;
- chtype ch1=0,ch2=0;
- switch(PyTuple_Size(args)){
- case 0: break;
- default:
- if (!PyArg_ParseTuple(args,"OO;verch,horch", &temp1, &temp2))
- return NULL;
- if (!PyCurses_ConvertToChtype(self, temp1, &ch1)) {
+ chtype ch1 = 0, ch2 = 0;
+ if (group_right_1) {
+ if (!PyCurses_ConvertToChtype(self, verch, &ch1)) {
return NULL;
}
- if (!PyCurses_ConvertToChtype(self, temp2, &ch2)) {
+ if (!PyCurses_ConvertToChtype(self, horch, &ch2)) {
return NULL;
}
}
@@ -949,6 +1010,32 @@ int py_mvwdelch(WINDOW *w, int y, int x)
/* chgat, added by Fabian Kreutz <fabian.kreutz at gmx.net> */
#ifdef HAVE_CURSES_WCHGAT
+/*[-clinic input]
+_curses.window.chgat
+
+ [
+ y: int
+ Y-coordinate.
+ x: int
+ X-coordinate.
+ ]
+
+ n: int = -1
+ Number of characters.
+
+ attr: long
+ Attributes for characters.
+ /
+
+Set the attributes of characters.
+
+Set the attributes of num characters at the current cursor position, or at
+position (y, x) if supplied. If no value of num is given or num = -1, the
+attribute will be set on all the characters to the end of the line. This
+function does not move the cursor. The changed line will be touched using
+the touchline() method so that the contents will be redisplayed by the next
+window refresh.
+[-clinic start generated code]*/
static PyObject *
PyCursesWindow_ChgAt(PyCursesWindowObject *self, PyObject *args)
{
@@ -991,7 +1078,7 @@ PyCursesWindow_ChgAt(PyCursesWindowObject *self, PyObject *args)
color = (short)((attr >> 8) & 0xff);
attr = attr - (color << 8);
- if (use_xy == TRUE) {
+ if (use_xy) {
rtn = mvwchgat(self->win,y,x,num,attr,color,NULL);
touchline(self->win,y,1);
} else {
@@ -1003,50 +1090,61 @@ PyCursesWindow_ChgAt(PyCursesWindowObject *self, PyObject *args)
}
#endif
+/*[clinic input]
+_curses.window.delch
+
+ [
+ y: int
+ Y-coordinate.
+ x: int
+ X-coordinate.
+ ]
+ /
+
+Delete any character at (y, x).
+[clinic start generated code]*/
+
static PyObject *
-PyCursesWindow_DelCh(PyCursesWindowObject *self, PyObject *args)
+_curses_window_delch_impl(PyCursesWindowObject *self, int group_right_1,
+ int y, int x)
+/*[clinic end generated code: output=22e77bb9fa11b461 input=d2f79e630a4fc6d0]*/
{
- int rtn;
- int x, y;
-
- switch (PyTuple_Size(args)) {
- case 0:
- rtn = wdelch(self->win);
- break;
- case 2:
- if (!PyArg_ParseTuple(args,"ii;y,x", &y, &x))
- return NULL;
- rtn = py_mvwdelch(self->win,y,x);
- break;
- default:
- PyErr_SetString(PyExc_TypeError, "delch requires 0 or 2 arguments");
- return NULL;
+ if (!group_right_1) {
+ return PyCursesCheckERR(wdelch(self->win), "wdelch");
+ }
+ else {
+ return PyCursesCheckERR(py_mvwdelch(self->win, y, x), "mvwdelch");
}
- return PyCursesCheckERR(rtn, "[mv]wdelch");
}
+/*[clinic input]
+_curses.window.derwin
+
+ [
+ nlines: int = 0
+ Height.
+ ncols: int = 0
+ Width.
+ ]
+ begin_y: int
+ Top side y-coordinate.
+ begin_x: int
+ Left side x-coordinate.
+ /
+
+Create a sub-window (window-relative coordinates).
+
+derwin() is the same as calling subwin(), except that begin_y and begin_x
+are relative to the origin of the window, rather than relative to the entire
+screen.
+[clinic start generated code]*/
+
static PyObject *
-PyCursesWindow_DerWin(PyCursesWindowObject *self, PyObject *args)
+_curses_window_derwin_impl(PyCursesWindowObject *self, int group_left_1,
+ int nlines, int ncols, int begin_y, int begin_x)
+/*[clinic end generated code: output=7924b112d9f70d6e input=966d9481f7f5022e]*/
{
WINDOW *win;
- int nlines, ncols, begin_y, begin_x;
-
- nlines = 0;
- ncols = 0;
- switch (PyTuple_Size(args)) {
- case 2:
- if (!PyArg_ParseTuple(args,"ii;begin_y,begin_x",&begin_y,&begin_x))
- return NULL;
- break;
- case 4:
- if (!PyArg_ParseTuple(args, "iiii;nlines,ncols,begin_y,begin_x",
- &nlines,&ncols,&begin_y,&begin_x))
- return NULL;
- break;
- default:
- PyErr_SetString(PyExc_TypeError, "derwin requires 2 or 4 arguments");
- return NULL;
- }
win = derwin(self->win,nlines,ncols,begin_y,begin_x);
@@ -1058,112 +1156,145 @@ PyCursesWindow_DerWin(PyCursesWindowObject *self, PyObject *args)
return (PyObject *)PyCursesWindow_New(win, NULL);
}
-static PyObject *
-PyCursesWindow_EchoChar(PyCursesWindowObject *self, PyObject *args)
-{
- PyObject *temp;
- chtype ch;
- attr_t attr = A_NORMAL;
- long lattr;
+/*[clinic input]
+_curses.window.echochar
- switch (PyTuple_Size(args)) {
- case 1:
- if (!PyArg_ParseTuple(args,"O;ch or int", &temp))
- return NULL;
- break;
- case 2:
- if (!PyArg_ParseTuple(args,"Ol;ch or int,attr", &temp, &lattr))
- return NULL;
- attr = lattr;
- break;
- default:
- PyErr_SetString(PyExc_TypeError, "echochar requires 1 or 2 arguments");
+ ch: object
+ Character to add.
+ attr: long(c_default="A_NORMAL") = _curses.A_NORMAL
+ Attributes for the character.
+ /
- return NULL;
- }
+Add character ch with attribute attr, and refresh.
+[clinic start generated code]*/
+
+static PyObject *
+_curses_window_echochar_impl(PyCursesWindowObject *self, PyObject *ch,
+ long attr)
+/*[clinic end generated code: output=13e7dd875d4b9642 input=e7f34b964e92b156]*/
+{
+ chtype ch_;
- if (!PyCurses_ConvertToChtype(self, temp, &ch))
+ if (!PyCurses_ConvertToChtype(self, ch, &ch_))
return NULL;
#ifdef py_is_pad
if (py_is_pad(self->win)) {
- return PyCursesCheckERR(pechochar(self->win, ch | attr),
+ return PyCursesCheckERR(pechochar(self->win, ch_ | (attr_t)attr),
"echochar");
}
else
#endif
- return PyCursesCheckERR(wechochar(self->win, ch | attr),
+ return PyCursesCheckERR(wechochar(self->win, ch_ | (attr_t)attr),
"echochar");
}
#ifdef NCURSES_MOUSE_VERSION
-static PyObject *
-PyCursesWindow_Enclose(PyCursesWindowObject *self, PyObject *args)
-{
- int x, y;
- if (!PyArg_ParseTuple(args,"ii;y,x", &y, &x))
- return NULL;
+/*[clinic input]
+_curses.window.enclose -> long
+
+ y: int
+ Y-coordinate.
+ x: int
+ X-coordinate.
+ /
+
+Return True if the screen-relative coordinates are enclosed by the window.
+[clinic start generated code]*/
- return PyLong_FromLong( wenclose(self->win,y,x) );
+static long
+_curses_window_enclose_impl(PyCursesWindowObject *self, int y, int x)
+/*[clinic end generated code: output=5251c961cbe3df63 input=dfe1d9d4d05d8642]*/
+{
+ return wenclose(self->win, y, x);
}
#endif
-static PyObject *
-PyCursesWindow_GetBkgd(PyCursesWindowObject *self)
+/*[clinic input]
+_curses.window.getbkgd -> long
+
+Return the window's current background character/attribute pair.
+[clinic start generated code]*/
+
+static long
+_curses_window_getbkgd_impl(PyCursesWindowObject *self)
+/*[clinic end generated code: output=c52b25dc16b215c3 input=a69db882fa35426c]*/
{
- return PyLong_FromLong((long) getbkgd(self->win));
+ return (long) getbkgd(self->win);
}
-static PyObject *
-PyCursesWindow_GetCh(PyCursesWindowObject *self, PyObject *args)
+/*[clinic input]
+_curses.window.getch -> int
+
+ [
+ y: int
+ Y-coordinate.
+ x: int
+ X-coordinate.
+ ]
+ /
+
+Get a character code from terminal keyboard.
+
+The integer returned does not have to be in ASCII range: function keys,
+keypad keys and so on return numbers higher than 256. In no-delay mode, -1
+is returned if there is no input, else getch() waits until a key is pressed.
+[clinic start generated code]*/
+
+static int
+_curses_window_getch_impl(PyCursesWindowObject *self, int group_right_1,
+ int y, int x)
+/*[clinic end generated code: output=980aa6af0c0ca387 input=bb24ebfb379f991f]*/
{
- int x, y;
int rtn;
- switch (PyTuple_Size(args)) {
- case 0:
- Py_BEGIN_ALLOW_THREADS
+ Py_BEGIN_ALLOW_THREADS
+ if (!group_right_1) {
rtn = wgetch(self->win);
- Py_END_ALLOW_THREADS
- break;
- case 2:
- if (!PyArg_ParseTuple(args,"ii;y,x",&y,&x))
- return NULL;
- Py_BEGIN_ALLOW_THREADS
- rtn = mvwgetch(self->win,y,x);
- Py_END_ALLOW_THREADS
- break;
- default:
- PyErr_SetString(PyExc_TypeError, "getch requires 0 or 2 arguments");
- return NULL;
}
- return PyLong_FromLong((long)rtn);
+ else {
+ rtn = mvwgetch(self->win, y, x);
+ }
+ Py_END_ALLOW_THREADS
+
+ return rtn;
}
+/*[clinic input]
+_curses.window.getkey
+
+ [
+ y: int
+ Y-coordinate.
+ x: int
+ X-coordinate.
+ ]
+ /
+
+Get a character (string) from terminal keyboard.
+
+Returning a string instead of an integer, as getch() does. Function keys,
+keypad keys and other special keys return a multibyte string containing the
+key name. In no-delay mode, an exception is raised if there is no input.
+[clinic start generated code]*/
+
static PyObject *
-PyCursesWindow_GetKey(PyCursesWindowObject *self, PyObject *args)
+_curses_window_getkey_impl(PyCursesWindowObject *self, int group_right_1,
+ int y, int x)
+/*[clinic end generated code: output=8490a182db46b10f input=be2dee34f5cf57f8]*/
{
- int x, y;
int rtn;
- switch (PyTuple_Size(args)) {
- case 0:
- Py_BEGIN_ALLOW_THREADS
+ Py_BEGIN_ALLOW_THREADS
+ if (!group_right_1) {
rtn = wgetch(self->win);
- Py_END_ALLOW_THREADS
- break;
- case 2:
- if (!PyArg_ParseTuple(args,"ii;y,x",&y,&x))
- return NULL;
- Py_BEGIN_ALLOW_THREADS
- rtn = mvwgetch(self->win,y,x);
- Py_END_ALLOW_THREADS
- break;
- default:
- PyErr_SetString(PyExc_TypeError, "getkey requires 0 or 2 arguments");
- return NULL;
}
+ else {
+ rtn = mvwgetch(self->win, y, x);
+ }
+ Py_END_ALLOW_THREADS
+
if (rtn == ERR) {
/* getch() returns ERR in nodelay mode */
PyErr_CheckSignals();
@@ -1187,30 +1318,40 @@ PyCursesWindow_GetKey(PyCursesWindowObject *self, PyObject *args)
}
#ifdef HAVE_NCURSESW
+/*[clinic input]
+_curses.window.get_wch
+
+ [
+ y: int
+ Y-coordinate.
+ x: int
+ X-coordinate.
+ ]
+ /
+
+Get a wide character from terminal keyboard.
+
+Return a character for most keys, or an integer for function keys,
+keypad keys, and other special keys.
+[clinic start generated code]*/
+
static PyObject *
-PyCursesWindow_Get_WCh(PyCursesWindowObject *self, PyObject *args)
+_curses_window_get_wch_impl(PyCursesWindowObject *self, int group_right_1,
+ int y, int x)
+/*[clinic end generated code: output=9f4f86e91fe50ef3 input=dd7e5367fb49dc48]*/
{
- int x, y;
int ct;
wint_t rtn;
- switch (PyTuple_Size(args)) {
- case 0:
- Py_BEGIN_ALLOW_THREADS
- ct = wget_wch(self->win,&rtn);
- Py_END_ALLOW_THREADS
- break;
- case 2:
- if (!PyArg_ParseTuple(args,"ii;y,x",&y,&x))
- return NULL;
- Py_BEGIN_ALLOW_THREADS
- ct = mvwget_wch(self->win,y,x,&rtn);
- Py_END_ALLOW_THREADS
- break;
- default:
- PyErr_SetString(PyExc_TypeError, "get_wch requires 0 or 2 arguments");
- return NULL;
+ Py_BEGIN_ALLOW_THREADS
+ if (!group_right_1) {
+ ct = wget_wch(self->win ,&rtn);
+ }
+ else {
+ ct = mvwget_wch(self->win, y, x, &rtn);
}
+ Py_END_ALLOW_THREADS
+
if (ct == ERR) {
if (PyErr_CheckSignals())
return NULL;
@@ -1226,6 +1367,22 @@ PyCursesWindow_Get_WCh(PyCursesWindowObject *self, PyObject *args)
}
#endif
+/*[-clinic input]
+_curses.window.getstr
+
+ [
+ y: int
+ Y-coordinate.
+ x: int
+ X-coordinate.
+ ]
+ n: int = 1023
+ Maximal number of characters.
+ /
+
+Read a string from the user, with primitive line editing capacity.
+[-clinic start generated code]*/
+
static PyObject *
PyCursesWindow_GetStr(PyCursesWindowObject *self, PyObject *args)
{
@@ -1288,118 +1445,148 @@ PyCursesWindow_GetStr(PyCursesWindowObject *self, PyObject *args)
return PyBytes_FromString(rtn);
}
+/*[clinic input]
+_curses.window.hline
+
+ [
+ y: int
+ Starting Y-coordinate.
+ x: int
+ Starting X-coordinate.
+ ]
+
+ ch: object
+ Character to draw.
+ n: int
+ Line length.
+
+ [
+ attr: long(c_default="A_NORMAL") = _curses.A_NORMAL
+ Attributes for the characters.
+ ]
+ /
+
+Display a horizontal line.
+[clinic start generated code]*/
+
static PyObject *
-PyCursesWindow_Hline(PyCursesWindowObject *self, PyObject *args)
+_curses_window_hline_impl(PyCursesWindowObject *self, int group_left_1,
+ int y, int x, PyObject *ch, int n,
+ int group_right_1, long attr)
+/*[clinic end generated code: output=c00d489d61fc9eef input=81a4dea47268163e]*/
{
- PyObject *temp;
- chtype ch;
- int n, x, y, code = OK;
- attr_t attr = A_NORMAL;
- long lattr;
+ chtype ch_;
- switch (PyTuple_Size(args)) {
- case 2:
- if (!PyArg_ParseTuple(args, "Oi;ch or int,n", &temp, &n))
- return NULL;
- break;
- case 3:
- if (!PyArg_ParseTuple(args, "Oil;ch or int,n,attr", &temp, &n, &lattr))
- return NULL;
- attr = lattr;
- break;
- case 4:
- if (!PyArg_ParseTuple(args, "iiOi;y,x,ch or int,n", &y, &x, &temp, &n))
- return NULL;
- code = wmove(self->win, y, x);
- break;
- case 5:
- if (!PyArg_ParseTuple(args, "iiOil; y,x,ch or int,n,attr",
- &y, &x, &temp, &n, &lattr))
- return NULL;
- attr = lattr;
- code = wmove(self->win, y, x);
- break;
- default:
- PyErr_SetString(PyExc_TypeError, "hline requires 2 to 5 arguments");
+ if (!PyCurses_ConvertToChtype(self, ch, &ch_))
return NULL;
+ if (group_left_1) {
+ if (wmove(self->win, y, x) == ERR) {
+ return PyCursesCheckERR(ERR, "wmove");
+ }
}
-
- if (code != ERR) {
- if (!PyCurses_ConvertToChtype(self, temp, &ch))
- return NULL;
- return PyCursesCheckERR(whline(self->win, ch | attr, n), "hline");
- } else
- return PyCursesCheckERR(code, "wmove");
+ return PyCursesCheckERR(whline(self->win, ch_ | (attr_t)attr, n), "hline");
}
+/*[clinic input]
+_curses.window.insch
+
+ [
+ y: int
+ Y-coordinate.
+ x: int
+ X-coordinate.
+ ]
+
+ ch: object
+ Character to insert.
+
+ [
+ attr: long(c_default="A_NORMAL") = _curses.A_NORMAL
+ Attributes for the character.
+ ]
+ /
+
+Insert a character before the current or specified position.
+
+All characters to the right of the cursor are shifted one position right, with
+the rightmost characters on the line being lost.
+[clinic start generated code]*/
+
static PyObject *
-PyCursesWindow_InsCh(PyCursesWindowObject *self, PyObject *args)
+_curses_window_insch_impl(PyCursesWindowObject *self, int group_left_1,
+ int y, int x, PyObject *ch, int group_right_1,
+ long attr)
+/*[clinic end generated code: output=ade8cfe3a3bf3e34 input=336342756ee19812]*/
{
- int rtn, x, y, use_xy = FALSE;
- PyObject *temp;
- chtype ch = 0;
- attr_t attr = A_NORMAL;
- long lattr;
-
- switch (PyTuple_Size(args)) {
- case 1:
- if (!PyArg_ParseTuple(args, "O;ch or int", &temp))
- return NULL;
- break;
- case 2:
- if (!PyArg_ParseTuple(args, "Ol;ch or int,attr", &temp, &lattr))
- return NULL;
- attr = lattr;
- break;
- case 3:
- if (!PyArg_ParseTuple(args,"iiO;y,x,ch or int", &y, &x, &temp))
- return NULL;
- use_xy = TRUE;
- break;
- case 4:
- if (!PyArg_ParseTuple(args,"iiOl;y,x,ch or int, attr", &y, &x, &temp, &lattr))
- return NULL;
- attr = lattr;
- use_xy = TRUE;
- break;
- default:
- PyErr_SetString(PyExc_TypeError, "insch requires 1 to 4 arguments");
- return NULL;
- }
+ int rtn;
+ chtype ch_ = 0;
- if (!PyCurses_ConvertToChtype(self, temp, &ch))
+ if (!PyCurses_ConvertToChtype(self, ch, &ch_))
return NULL;
- if (use_xy == TRUE)
- rtn = mvwinsch(self->win,y,x, ch | attr);
+ if (!group_left_1) {
+ rtn = winsch(self->win, ch_ | (attr_t)attr);
+ }
else {
- rtn = winsch(self->win, ch | attr);
+ rtn = mvwinsch(self->win, y, x, ch_ | (attr_t)attr);
}
+
return PyCursesCheckERR(rtn, "insch");
}
-static PyObject *
-PyCursesWindow_InCh(PyCursesWindowObject *self, PyObject *args)
+/*[clinic input]
+_curses.window.inch -> unsigned_long
+
+ [
+ y: int
+ Y-coordinate.
+ x: int
+ X-coordinate.
+ ]
+ /
+
+Return the character at the given position in the window.
+
+The bottom 8 bits are the character proper, and upper bits are the attributes.
+[clinic start generated code]*/
+
+static unsigned long
+_curses_window_inch_impl(PyCursesWindowObject *self, int group_right_1,
+ int y, int x)
+/*[clinic end generated code: output=6c4719fe978fe86a input=fac23ee11e3b3a66]*/
{
- int x, y;
unsigned long rtn;
- switch (PyTuple_Size(args)) {
- case 0:
+ if (!group_right_1) {
rtn = winch(self->win);
- break;
- case 2:
- if (!PyArg_ParseTuple(args,"ii;y,x",&y,&x))
- return NULL;
- rtn = mvwinch(self->win,y,x);
- break;
- default:
- PyErr_SetString(PyExc_TypeError, "inch requires 0 to 2 arguments");
- return NULL;
}
- return PyLong_FromUnsignedLong(rtn);
+ else {
+ rtn = mvwinch(self->win, y, x);
+ }
+
+ return rtn;
}
+/*[-clinic input]
+_curses.window.instr
+
+ [
+ y: int
+ Y-coordinate.
+ x: int
+ X-coordinate.
+ ]
+ n: int = 1023
+ Maximal number of characters.
+ /
+
+Return a string of characters, extracted from the window.
+
+Return a string of characters, extracted from the window starting at the
+current cursor position, or at y, x if specified. Attributes are stripped
+from the characters. If n is specified, instr() returns a string at most
+n characters long (exclusive of the trailing NUL).
+[-clinic start generated code]*/
static PyObject *
PyCursesWindow_InStr(PyCursesWindowObject *self, PyObject *args)
{
@@ -1443,64 +1630,66 @@ PyCursesWindow_InStr(PyCursesWindowObject *self, PyObject *args)
return PyBytes_FromString(rtn);
}
+/*[clinic input]
+_curses.window.insstr
+
+ [
+ y: int
+ Y-coordinate.
+ x: int
+ X-coordinate.
+ ]
+
+ str: object
+ String to insert.
+
+ [
+ attr: long
+ Attributes for characters.
+ ]
+ /
+
+Insert the string before the current or specified position.
+
+Insert a character string (as many characters as will fit on the line)
+before the character under the cursor. All characters to the right of
+the cursor are shifted right, with the rightmost characters on the line
+being lost. The cursor position does not change (after moving to y, x,
+if specified).
+[clinic start generated code]*/
+
static PyObject *
-PyCursesWindow_InsStr(PyCursesWindowObject *self, PyObject *args)
+_curses_window_insstr_impl(PyCursesWindowObject *self, int group_left_1,
+ int y, int x, PyObject *str, int group_right_1,
+ long attr)
+/*[clinic end generated code: output=c259a5265ad0b777 input=6827cddc6340a7f3]*/
{
int rtn;
- int x, y;
int strtype;
- PyObject *strobj, *bytesobj = NULL;
+ PyObject *bytesobj = NULL;
#ifdef HAVE_NCURSESW
wchar_t *wstr = NULL;
#endif
- attr_t attr = A_NORMAL , attr_old = A_NORMAL;
- long lattr;
- int use_xy = FALSE, use_attr = FALSE;
+ attr_t attr_old = A_NORMAL;
+ int use_xy = group_left_1, use_attr = group_right_1;
const char *funcname;
- switch (PyTuple_Size(args)) {
- case 1:
- if (!PyArg_ParseTuple(args,"O;str", &strobj))
- return NULL;
- break;
- case 2:
- if (!PyArg_ParseTuple(args,"Ol;str,attr", &strobj, &lattr))
- return NULL;
- attr = lattr;
- use_attr = TRUE;
- break;
- case 3:
- if (!PyArg_ParseTuple(args,"iiO;y,x,str", &y, &x, &strobj))
- return NULL;
- use_xy = TRUE;
- break;
- case 4:
- if (!PyArg_ParseTuple(args,"iiOl;y,x,str,attr", &y, &x, &strobj, &lattr))
- return NULL;
- attr = lattr;
- use_xy = use_attr = TRUE;
- break;
- default:
- PyErr_SetString(PyExc_TypeError, "insstr requires 1 to 4 arguments");
- return NULL;
- }
-
#ifdef HAVE_NCURSESW
- strtype = PyCurses_ConvertToString(self, strobj, &bytesobj, &wstr);
+ strtype = PyCurses_ConvertToString(self, str, &bytesobj, &wstr);
#else
- strtype = PyCurses_ConvertToString(self, strobj, &bytesobj, NULL);
+ strtype = PyCurses_ConvertToString(self, str, &bytesobj, NULL);
#endif
if (strtype == 0)
return NULL;
- if (use_attr == TRUE) {
+ if (use_attr) {
attr_old = getattrs(self->win);
- (void)wattrset(self->win,attr);
+ (void)wattrset(self->win, (attr_t)attr);
}
#ifdef HAVE_NCURSESW
if (strtype == 2) {
funcname = "inswstr";
- if (use_xy == TRUE)
+ if (use_xy)
rtn = mvwins_wstr(self->win,y,x,wstr);
else
rtn = wins_wstr(self->win,wstr);
@@ -1511,74 +1700,81 @@ PyCursesWindow_InsStr(PyCursesWindowObject *self, PyObject *args)
{
char *str = PyBytes_AS_STRING(bytesobj);
funcname = "insstr";
- if (use_xy == TRUE)
+ if (use_xy)
rtn = mvwinsstr(self->win,y,x,str);
else
rtn = winsstr(self->win,str);
Py_DECREF(bytesobj);
}
- if (use_attr == TRUE)
+ if (use_attr)
(void)wattrset(self->win,attr_old);
return PyCursesCheckERR(rtn, funcname);
}
+/*[clinic input]
+_curses.window.insnstr
+
+ [
+ y: int
+ Y-coordinate.
+ x: int
+ X-coordinate.
+ ]
+
+ str: object
+ String to insert.
+
+ n: int
+ Maximal number of characters.
+
+ [
+ attr: long
+ Attributes for characters.
+ ]
+ /
+
+Insert at most n characters of the string.
+
+Insert a character string (as many characters as will fit on the line)
+before the character under the cursor, up to n characters. If n is zero
+or negative, the entire string is inserted. All characters to the right
+of the cursor are shifted right, with the rightmost characters on the line
+being lost. The cursor position does not change (after moving to y, x, if
+specified).
+[clinic start generated code]*/
+
static PyObject *
-PyCursesWindow_InsNStr(PyCursesWindowObject *self, PyObject *args)
+_curses_window_insnstr_impl(PyCursesWindowObject *self, int group_left_1,
+ int y, int x, PyObject *str, int n,
+ int group_right_1, long attr)
+/*[clinic end generated code: output=971a32ea6328ec8b input=70fa0cd543901a4c]*/
{
- int rtn, x, y, n;
+ int rtn;
int strtype;
- PyObject *strobj, *bytesobj = NULL;
+ PyObject *bytesobj = NULL;
#ifdef HAVE_NCURSESW
wchar_t *wstr = NULL;
#endif
- attr_t attr = A_NORMAL , attr_old = A_NORMAL;
- long lattr;
- int use_xy = FALSE, use_attr = FALSE;
+ attr_t attr_old = A_NORMAL;
+ int use_xy = group_left_1, use_attr = group_right_1;
const char *funcname;
- switch (PyTuple_Size(args)) {
- case 2:
- if (!PyArg_ParseTuple(args,"Oi;str,n", &strobj, &n))
- return NULL;
- break;
- case 3:
- if (!PyArg_ParseTuple(args,"Oil;str,n,attr", &strobj, &n, &lattr))
- return NULL;
- attr = lattr;
- use_attr = TRUE;
- break;
- case 4:
- if (!PyArg_ParseTuple(args,"iiOi;y,x,str,n", &y, &x, &strobj, &n))
- return NULL;
- use_xy = TRUE;
- break;
- case 5:
- if (!PyArg_ParseTuple(args,"iiOil;y,x,str,n,attr", &y, &x, &strobj, &n, &lattr))
- return NULL;
- attr = lattr;
- use_xy = use_attr = TRUE;
- break;
- default:
- PyErr_SetString(PyExc_TypeError, "insnstr requires 2 to 5 arguments");
- return NULL;
- }
-
#ifdef HAVE_NCURSESW
- strtype = PyCurses_ConvertToString(self, strobj, &bytesobj, &wstr);
+ strtype = PyCurses_ConvertToString(self, str, &bytesobj, &wstr);
#else
- strtype = PyCurses_ConvertToString(self, strobj, &bytesobj, NULL);
+ strtype = PyCurses_ConvertToString(self, str, &bytesobj, NULL);
#endif
if (strtype == 0)
return NULL;
- if (use_attr == TRUE) {
+ if (use_attr) {
attr_old = getattrs(self->win);
- (void)wattrset(self->win,attr);
+ (void)wattrset(self->win, (attr_t)attr);
}
#ifdef HAVE_NCURSESW
if (strtype == 2) {
funcname = "insn_wstr";
- if (use_xy == TRUE)
+ if (use_xy)
rtn = mvwins_nwstr(self->win,y,x,wstr,n);
else
rtn = wins_nwstr(self->win,wstr,n);
@@ -1589,160 +1785,226 @@ PyCursesWindow_InsNStr(PyCursesWindowObject *self, PyObject *args)
{
char *str = PyBytes_AS_STRING(bytesobj);
funcname = "insnstr";
- if (use_xy == TRUE)
+ if (use_xy)
rtn = mvwinsnstr(self->win,y,x,str,n);
else
rtn = winsnstr(self->win,str,n);
Py_DECREF(bytesobj);
}
- if (use_attr == TRUE)
+ if (use_attr)
(void)wattrset(self->win,attr_old);
return PyCursesCheckERR(rtn, funcname);
}
+/*[clinic input]
+_curses.window.is_linetouched
+
+ line: int
+ Line number.
+ /
+
+Return True if the specified line was modified, otherwise return False.
+
+Raise a curses.error exception if line is not valid for the given window.
+[clinic start generated code]*/
+
static PyObject *
-PyCursesWindow_Is_LineTouched(PyCursesWindowObject *self, PyObject *args)
+_curses_window_is_linetouched_impl(PyCursesWindowObject *self, int line)
+/*[clinic end generated code: output=ad4a4edfee2db08c input=a7be0c189f243914]*/
{
- int line, erg;
- if (!PyArg_ParseTuple(args,"i;line", &line))
- return NULL;
+ int erg;
erg = is_linetouched(self->win, line);
if (erg == ERR) {
PyErr_SetString(PyExc_TypeError,
"is_linetouched: line number outside of boundaries");
return NULL;
- } else
- if (erg == FALSE) {
- Py_RETURN_FALSE;
- } else {
- Py_RETURN_TRUE;
- }
+ }
+ return PyBool_FromLong(erg);
}
-static PyObject *
-PyCursesWindow_NoOutRefresh(PyCursesWindowObject *self, PyObject *args)
-{
- int pminrow,pmincol,sminrow,smincol,smaxrow,smaxcol;
- int rtn;
+#ifdef py_is_pad
+/*[clinic input]
+_curses.window.noutrefresh
+
+ [
+ pminrow: int
+ pmincol: int
+ sminrow: int
+ smincol: int
+ smaxrow: int
+ smaxcol: int
+ ]
+ /
+
+Mark for refresh but wait.
+
+This function updates the data structure representing the desired state of the
+window, but does not force an update of the physical screen. To accomplish
+that, call doupdate().
+[clinic start generated code]*/
-#ifndef py_is_pad
- if (0)
+static PyObject *
+_curses_window_noutrefresh_impl(PyCursesWindowObject *self,
+ int group_right_1, int pminrow, int pmincol,
+ int sminrow, int smincol, int smaxrow,
+ int smaxcol)
+/*[clinic end generated code: output=809a1f3c6a03e23e input=3e56898388cd739e]*/
#else
- if (py_is_pad(self->win))
-#endif
- {
- switch(PyTuple_Size(args)) {
- case 6:
- if (!PyArg_ParseTuple(args,
- "iiiiii;" \
- "pminrow,pmincol,sminrow,smincol,smaxrow,smaxcol",
- &pminrow, &pmincol, &sminrow,
- &smincol, &smaxrow, &smaxcol))
- return NULL;
- Py_BEGIN_ALLOW_THREADS
- rtn = pnoutrefresh(self->win,
- pminrow, pmincol, sminrow,
- smincol, smaxrow, smaxcol);
- Py_END_ALLOW_THREADS
- return PyCursesCheckERR(rtn, "pnoutrefresh");
- default:
- PyErr_SetString(PyCursesError,
- "noutrefresh() called for a pad "
- "requires 6 arguments");
- return NULL;
- }
- } else {
- if (!PyArg_ParseTuple(args, ":noutrefresh"))
- return NULL;
+/*[clinic input]
+_curses.window.noutrefresh
- Py_BEGIN_ALLOW_THREADS
- rtn = wnoutrefresh(self->win);
- Py_END_ALLOW_THREADS
- return PyCursesCheckERR(rtn, "wnoutrefresh");
- }
-}
+Mark for refresh but wait.
+
+This function updates the data structure representing the desired state of the
+window, but does not force an update of the physical screen. To accomplish
+that, call doupdate().
+[clinic start generated code]*/
static PyObject *
-PyCursesWindow_Overlay(PyCursesWindowObject *self, PyObject *args)
+_curses_window_noutrefresh_impl(PyCursesWindowObject *self)
+/*[clinic end generated code: output=6ef6dec666643fee input=876902e3fa431dbd]*/
+#endif
{
- PyCursesWindowObject *temp;
- int use_copywin = FALSE;
- int sminrow, smincol, dminrow, dmincol, dmaxrow, dmaxcol;
int rtn;
- switch (PyTuple_Size(args)) {
- case 1:
- if (!PyArg_ParseTuple(args, "O!;window object",
- &PyCursesWindow_Type, &temp))
- return NULL;
- break;
- case 7:
- if (!PyArg_ParseTuple(args, "O!iiiiii;window object, int, int, int, int, int, int",
- &PyCursesWindow_Type, &temp, &sminrow, &smincol,
- &dminrow, &dmincol, &dmaxrow, &dmaxcol))
+#ifdef py_is_pad
+ if (py_is_pad(self->win)) {
+ if (!group_right_1) {
+ PyErr_SetString(PyCursesError,
+ "noutrefresh() called for a pad "
+ "requires 6 arguments");
return NULL;
- use_copywin = TRUE;
- break;
- default:
+ }
+ Py_BEGIN_ALLOW_THREADS
+ rtn = pnoutrefresh(self->win, pminrow, pmincol,
+ sminrow, smincol, smaxrow, smaxcol);
+ Py_END_ALLOW_THREADS
+ return PyCursesCheckERR(rtn, "pnoutrefresh");
+ }
+ if (group_right_1) {
PyErr_SetString(PyExc_TypeError,
- "overlay requires one or seven arguments");
+ "noutrefresh() takes no arguments (6 given)");
return NULL;
}
+#endif
+ Py_BEGIN_ALLOW_THREADS
+ rtn = wnoutrefresh(self->win);
+ Py_END_ALLOW_THREADS
+ return PyCursesCheckERR(rtn, "wnoutrefresh");
+}
+
+/*[clinic input]
+_curses.window.overlay
+
+ destwin: object(type="PyCursesWindowObject *", subclass_of="&PyCursesWindow_Type")
+
+ [
+ sminrow: int
+ smincol: int
+ dminrow: int
+ dmincol: int
+ dmaxrow: int
+ dmaxcol: int
+ ]
+ /
- if (use_copywin == TRUE) {
- rtn = copywin(self->win, temp->win, sminrow, smincol,
+Overlay the window on top of destwin.
+
+The windows need not be the same size, only the overlapping region is copied.
+This copy is non-destructive, which means that the current background
+character does not overwrite the old contents of destwin.
+
+To get fine-grained control over the copied region, the second form of
+overlay() can be used. sminrow and smincol are the upper-left coordinates
+of the source window, and the other variables mark a rectangle in the
+destination window.
+[clinic start generated code]*/
+
+static PyObject *
+_curses_window_overlay_impl(PyCursesWindowObject *self,
+ PyCursesWindowObject *destwin, int group_right_1,
+ int sminrow, int smincol, int dminrow,
+ int dmincol, int dmaxrow, int dmaxcol)
+/*[clinic end generated code: output=82bb2c4cb443ca58 input=7edd23ad22cc1984]*/
+{
+ int rtn;
+
+ if (group_right_1) {
+ rtn = copywin(self->win, destwin->win, sminrow, smincol,
dminrow, dmincol, dmaxrow, dmaxcol, TRUE);
return PyCursesCheckERR(rtn, "copywin");
}
else {
- rtn = overlay(self->win, temp->win);
+ rtn = overlay(self->win, destwin->win);
return PyCursesCheckERR(rtn, "overlay");
}
}
+/*[clinic input]
+_curses.window.overwrite
+
+ destwin: object(type="PyCursesWindowObject *", subclass_of="&PyCursesWindow_Type")
+
+ [
+ sminrow: int
+ smincol: int
+ dminrow: int
+ dmincol: int
+ dmaxrow: int
+ dmaxcol: int
+ ]
+ /
+
+Overwrite the window on top of destwin.
+
+The windows need not be the same size, in which case only the overlapping
+region is copied. This copy is destructive, which means that the current
+background character overwrites the old contents of destwin.
+
+To get fine-grained control over the copied region, the second form of
+overwrite() can be used. sminrow and smincol are the upper-left coordinates
+of the source window, the other variables mark a rectangle in the destination
+window.
+[clinic start generated code]*/
+
static PyObject *
-PyCursesWindow_Overwrite(PyCursesWindowObject *self, PyObject *args)
+_curses_window_overwrite_impl(PyCursesWindowObject *self,
+ PyCursesWindowObject *destwin,
+ int group_right_1, int sminrow, int smincol,
+ int dminrow, int dmincol, int dmaxrow,
+ int dmaxcol)
+/*[clinic end generated code: output=12ae007d1681be28 input=ea5de1b35cd948e0]*/
{
- PyCursesWindowObject *temp;
- int use_copywin = FALSE;
- int sminrow, smincol, dminrow, dmincol, dmaxrow, dmaxcol;
int rtn;
- switch (PyTuple_Size(args)) {
- case 1:
- if (!PyArg_ParseTuple(args, "O!;window object",
- &PyCursesWindow_Type, &temp))
- return NULL;
- break;
- case 7:
- if (!PyArg_ParseTuple(args, "O!iiiiii;window object, int, int, int, int, int, int",
- &PyCursesWindow_Type, &temp, &sminrow, &smincol,
- &dminrow, &dmincol, &dmaxrow, &dmaxcol))
- return NULL;
- use_copywin = TRUE;
- break;
- default:
- PyErr_SetString(PyExc_TypeError,
- "overwrite requires one or seven arguments");
- return NULL;
- }
-
- if (use_copywin == TRUE) {
- rtn = copywin(self->win, temp->win, sminrow, smincol,
+ if (group_right_1) {
+ rtn = copywin(self->win, destwin->win, sminrow, smincol,
dminrow, dmincol, dmaxrow, dmaxcol, FALSE);
return PyCursesCheckERR(rtn, "copywin");
}
else {
- rtn = overwrite(self->win, temp->win);
+ rtn = overwrite(self->win, destwin->win);
return PyCursesCheckERR(rtn, "overwrite");
}
}
+/*[clinic input]
+_curses.window.putwin
+
+ file: object
+ /
+
+Write all data associated with the window into the provided file object.
+
+This information can be later retrieved using the getwin() function.
+[clinic start generated code]*/
+
static PyObject *
-PyCursesWindow_PutWin(PyCursesWindowObject *self, PyObject *stream)
+_curses_window_putwin(PyCursesWindowObject *self, PyObject *file)
+/*[clinic end generated code: output=3a25e2a5e7a040ac input=0608648e09c8ea0a]*/
{
/* We have to simulate this by writing to a temporary FILE*,
- then reading back, then writing to the argument stream. */
+ then reading back, then writing to the argument file. */
FILE *fp;
PyObject *res = NULL;
@@ -1763,7 +2025,7 @@ PyCursesWindow_PutWin(PyCursesWindowObject *self, PyObject *stream)
if (n <= 0)
break;
Py_DECREF(res);
- res = _PyObject_CallMethodId(stream, &PyId_write, "y#", buf, n);
+ res = _PyObject_CallMethodId(file, &PyId_write, "y#", buf, n);
if (res == NULL)
break;
}
@@ -1773,88 +2035,137 @@ exit:
return res;
}
+/*[clinic input]
+_curses.window.redrawln
+
+ beg: int
+ Starting line number.
+ num: int
+ The number of lines.
+ /
+
+Mark the specified lines corrupted.
+
+They should be completely redrawn on the next refresh() call.
+[clinic start generated code]*/
+
static PyObject *
-PyCursesWindow_RedrawLine(PyCursesWindowObject *self, PyObject *args)
+_curses_window_redrawln_impl(PyCursesWindowObject *self, int beg, int num)
+/*[clinic end generated code: output=ea216e334f9ce1b4 input=152155e258a77a7a]*/
{
- int beg, num;
- if (!PyArg_ParseTuple(args, "ii;beg,num", &beg, &num))
- return NULL;
return PyCursesCheckERR(wredrawln(self->win,beg,num), "redrawln");
}
+/*[clinic input]
+_curses.window.refresh
+
+ [
+ pminrow: int
+ pmincol: int
+ sminrow: int
+ smincol: int
+ smaxrow: int
+ smaxcol: int
+ ]
+ /
+
+Update the display immediately.
+
+Synchronize actual screen with previous drawing/deleting methods.
+The 6 optional arguments can only be specified when the window is a pad
+created with newpad(). The additional parameters are needed to indicate
+what part of the pad and screen are involved. pminrow and pmincol specify
+the upper left-hand corner of the rectangle to be displayed in the pad.
+sminrow, smincol, smaxrow, and smaxcol specify the edges of the rectangle to
+be displayed on the screen. The lower right-hand corner of the rectangle to
+be displayed in the pad is calculated from the screen coordinates, since the
+rectangles must be the same size. Both rectangles must be entirely contained
+within their respective structures. Negative values of pminrow, pmincol,
+sminrow, or smincol are treated as if they were zero.
+[clinic start generated code]*/
+
static PyObject *
-PyCursesWindow_Refresh(PyCursesWindowObject *self, PyObject *args)
+_curses_window_refresh_impl(PyCursesWindowObject *self, int group_right_1,
+ int pminrow, int pmincol, int sminrow,
+ int smincol, int smaxrow, int smaxcol)
+/*[clinic end generated code: output=42199543115e6e63 input=95e01cb5ffc635d0]*/
{
- int pminrow,pmincol,sminrow,smincol,smaxrow,smaxcol;
int rtn;
-#ifndef py_is_pad
- if (0)
-#else
- if (py_is_pad(self->win))
-#endif
- {
- switch(PyTuple_Size(args)) {
- case 6:
- if (!PyArg_ParseTuple(args,
- "iiiiii;" \
- "pminrow,pmincol,sminrow,smincol,smaxrow,smaxcol",
- &pminrow, &pmincol, &sminrow,
- &smincol, &smaxrow, &smaxcol))
- return NULL;
-
- Py_BEGIN_ALLOW_THREADS
- rtn = prefresh(self->win,
- pminrow, pmincol, sminrow,
- smincol, smaxrow, smaxcol);
- Py_END_ALLOW_THREADS
- return PyCursesCheckERR(rtn, "prefresh");
- default:
- PyErr_SetString(PyCursesError,
- "refresh() for a pad requires 6 arguments");
- return NULL;
- }
- } else {
- if (!PyArg_ParseTuple(args, ":refresh"))
- return NULL;
- Py_BEGIN_ALLOW_THREADS
- rtn = wrefresh(self->win);
- Py_END_ALLOW_THREADS
- return PyCursesCheckERR(rtn, "prefresh");
+#ifdef py_is_pad
+ if (py_is_pad(self->win)) {
+ if (!group_right_1) {
+ PyErr_SetString(PyCursesError,
+ "refresh() for a pad requires 6 arguments");
+ return NULL;
}
+ Py_BEGIN_ALLOW_THREADS
+ rtn = prefresh(self->win, pminrow, pmincol,
+ sminrow, smincol, smaxrow, smaxcol);
+ Py_END_ALLOW_THREADS
+ return PyCursesCheckERR(rtn, "prefresh");
+ }
+#endif
+ if (group_right_1) {
+ PyErr_SetString(PyExc_TypeError,
+ "refresh() takes no arguments (6 given)");
+ return NULL;
+ }
+ Py_BEGIN_ALLOW_THREADS
+ rtn = wrefresh(self->win);
+ Py_END_ALLOW_THREADS
+ return PyCursesCheckERR(rtn, "prefresh");
}
+/*[clinic input]
+_curses.window.setscrreg
+
+ top: int
+ First line number.
+ bottom: int
+ Last line number.
+ /
+
+Define a software scrolling region.
+
+All scrolling actions will take place in this region.
+[clinic start generated code]*/
+
static PyObject *
-PyCursesWindow_SetScrollRegion(PyCursesWindowObject *self, PyObject *args)
+_curses_window_setscrreg_impl(PyCursesWindowObject *self, int top,
+ int bottom)
+/*[clinic end generated code: output=486ab5db218d2b1a input=1b517b986838bf0e]*/
{
- int x, y;
- if (!PyArg_ParseTuple(args,"ii;top, bottom",&y,&x))
- return NULL;
- return PyCursesCheckERR(wsetscrreg(self->win,y,x), "wsetscrreg");
+ return PyCursesCheckERR(wsetscrreg(self->win, top, bottom), "wsetscrreg");
}
+/*[clinic input]
+_curses.window.subwin
+
+ [
+ nlines: int = 0
+ Height.
+ ncols: int = 0
+ Width.
+ ]
+ begin_y: int
+ Top side y-coordinate.
+ begin_x: int
+ Left side x-coordinate.
+ /
+
+Create a sub-window (screen-relative coordinates).
+
+By default, the sub-window will extend from the specified position to the
+lower right corner of the window.
+[clinic start generated code]*/
+
static PyObject *
-PyCursesWindow_SubWin(PyCursesWindowObject *self, PyObject *args)
+_curses_window_subwin_impl(PyCursesWindowObject *self, int group_left_1,
+ int nlines, int ncols, int begin_y, int begin_x)
+/*[clinic end generated code: output=93e898afc348f59a input=2129fa47fd57721c]*/
{
WINDOW *win;
- int nlines, ncols, begin_y, begin_x;
-
- nlines = 0;
- ncols = 0;
- switch (PyTuple_Size(args)) {
- case 2:
- if (!PyArg_ParseTuple(args,"ii;begin_y,begin_x",&begin_y,&begin_x))
- return NULL;
- break;
- case 4:
- if (!PyArg_ParseTuple(args, "iiii;nlines,ncols,begin_y,begin_x",
- &nlines,&ncols,&begin_y,&begin_x))
- return NULL;
- break;
- default:
- PyErr_SetString(PyExc_TypeError, "subwin requires 2 or 4 arguments");
- return NULL;
- }
/* printf("Subwin: %i %i %i %i \n", nlines, ncols, begin_y, begin_x); */
#ifdef py_is_pad
@@ -1873,84 +2184,101 @@ PyCursesWindow_SubWin(PyCursesWindowObject *self, PyObject *args)
return (PyObject *)PyCursesWindow_New(win, self->encoding);
}
+/*[clinic input]
+_curses.window.scroll
+
+ [
+ lines: int = 1
+ Number of lines to scroll.
+ ]
+ /
+
+Scroll the screen or scrolling region.
+
+Scroll upward if the argument is positive and downward if it is negative.
+[clinic start generated code]*/
+
static PyObject *
-PyCursesWindow_Scroll(PyCursesWindowObject *self, PyObject *args)
+_curses_window_scroll_impl(PyCursesWindowObject *self, int group_right_1,
+ int lines)
+/*[clinic end generated code: output=4541a8a11852d360 input=c969ca0cfabbdbec]*/
{
- int nlines;
- switch(PyTuple_Size(args)) {
- case 0:
+ if (!group_right_1) {
return PyCursesCheckERR(scroll(self->win), "scroll");
- case 1:
- if (!PyArg_ParseTuple(args, "i;nlines", &nlines))
- return NULL;
- return PyCursesCheckERR(wscrl(self->win, nlines), "scroll");
- default:
- PyErr_SetString(PyExc_TypeError, "scroll requires 0 or 1 arguments");
- return NULL;
+ }
+ else {
+ return PyCursesCheckERR(wscrl(self->win, lines), "scroll");
}
}
+/*[clinic input]
+_curses.window.touchline
+
+ start: int
+ count: int
+ [
+ changed: bool(accept={int}) = True
+ ]
+ /
+
+Pretend count lines have been changed, starting with line start.
+
+If changed is supplied, it specifies whether the affected lines are marked
+as having been changed (changed=True) or unchanged (changed=False).
+[clinic start generated code]*/
+
static PyObject *
-PyCursesWindow_TouchLine(PyCursesWindowObject *self, PyObject *args)
+_curses_window_touchline_impl(PyCursesWindowObject *self, int start,
+ int count, int group_right_1, int changed)
+/*[clinic end generated code: output=65d05b3f7438c61d input=918ad1cbdadf93ea]*/
{
- int st, cnt, val;
- switch (PyTuple_Size(args)) {
- case 2:
- if (!PyArg_ParseTuple(args,"ii;start,count",&st,&cnt))
- return NULL;
- return PyCursesCheckERR(touchline(self->win,st,cnt), "touchline");
- case 3:
- if (!PyArg_ParseTuple(args, "iii;start,count,val", &st, &cnt, &val))
- return NULL;
- return PyCursesCheckERR(wtouchln(self->win, st, cnt, val), "touchline");
- default:
- PyErr_SetString(PyExc_TypeError, "touchline requires 2 or 3 arguments");
- return NULL;
+ if (!group_right_1) {
+ return PyCursesCheckERR(touchline(self->win, start, count), "touchline");
+ }
+ else {
+ return PyCursesCheckERR(wtouchln(self->win, start, count, changed), "touchline");
}
}
+/*[clinic input]
+_curses.window.vline
+
+ [
+ y: int
+ Starting Y-coordinate.
+ x: int
+ Starting X-coordinate.
+ ]
+
+ ch: object
+ Character to draw.
+ n: int
+ Line length.
+
+ [
+ attr: long(c_default="A_NORMAL") = _curses.A_NORMAL
+ Attributes for the character.
+ ]
+ /
+
+Display a vertical line.
+[clinic start generated code]*/
+
static PyObject *
-PyCursesWindow_Vline(PyCursesWindowObject *self, PyObject *args)
+_curses_window_vline_impl(PyCursesWindowObject *self, int group_left_1,
+ int y, int x, PyObject *ch, int n,
+ int group_right_1, long attr)
+/*[clinic end generated code: output=287ad1cc8982217f input=a6f2dc86a4648b32]*/
{
- PyObject *temp;
- chtype ch;
- int n, x, y, code = OK;
- attr_t attr = A_NORMAL;
- long lattr;
+ chtype ch_;
- switch (PyTuple_Size(args)) {
- case 2:
- if (!PyArg_ParseTuple(args, "Oi;ch or int,n", &temp, &n))
- return NULL;
- break;
- case 3:
- if (!PyArg_ParseTuple(args, "Oil;ch or int,n,attr", &temp, &n, &lattr))
- return NULL;
- attr = lattr;
- break;
- case 4:
- if (!PyArg_ParseTuple(args, "iiOi;y,x,ch or int,n", &y, &x, &temp, &n))
- return NULL;
- code = wmove(self->win, y, x);
- break;
- case 5:
- if (!PyArg_ParseTuple(args, "iiOil; y,x,ch or int,n,attr",
- &y, &x, &temp, &n, &lattr))
- return NULL;
- attr = lattr;
- code = wmove(self->win, y, x);
- break;
- default:
- PyErr_SetString(PyExc_TypeError, "vline requires 2 to 5 arguments");
+ if (!PyCurses_ConvertToChtype(self, ch, &ch_))
return NULL;
+ if (group_left_1) {
+ if (wmove(self->win, y, x) == ERR)
+ return PyCursesCheckERR(ERR, "wmove");
}
-
- if (code != ERR) {
- if (!PyCurses_ConvertToChtype(self, temp, &ch))
- return NULL;
- return PyCursesCheckERR(wvline(self->win, ch | attr, n), "vline");
- } else
- return PyCursesCheckERR(code, "wmove");
+ return PyCursesCheckERR(wvline(self->win, ch_ | (attr_t)attr, n), "vline");
}
static PyObject *
@@ -1991,59 +2319,56 @@ PyCursesWindow_set_encoding(PyCursesWindowObject *self, PyObject *value)
return 0;
}
+#include "clinic/_cursesmodule.c.h"
static PyMethodDef PyCursesWindow_Methods[] = {
- CURSES_WINDOW_ADDCH_METHODDEF
- {"addnstr", (PyCFunction)PyCursesWindow_AddNStr, METH_VARARGS},
- {"addstr", (PyCFunction)PyCursesWindow_AddStr, METH_VARARGS},
- {"attroff", (PyCFunction)PyCursesWindow_AttrOff, METH_VARARGS},
- {"attron", (PyCFunction)PyCursesWindow_AttrOn, METH_VARARGS},
- {"attrset", (PyCFunction)PyCursesWindow_AttrSet, METH_VARARGS},
- {"bkgd", (PyCFunction)PyCursesWindow_Bkgd, METH_VARARGS},
+ _CURSES_WINDOW_ADDCH_METHODDEF
+ _CURSES_WINDOW_ADDNSTR_METHODDEF
+ _CURSES_WINDOW_ADDSTR_METHODDEF
+ _CURSES_WINDOW_ATTROFF_METHODDEF
+ _CURSES_WINDOW_ATTRON_METHODDEF
+ _CURSES_WINDOW_ATTRSET_METHODDEF
+ _CURSES_WINDOW_BKGD_METHODDEF
#ifdef HAVE_CURSES_WCHGAT
{"chgat", (PyCFunction)PyCursesWindow_ChgAt, METH_VARARGS},
#endif
- {"bkgdset", (PyCFunction)PyCursesWindow_BkgdSet, METH_VARARGS},
- {"border", (PyCFunction)PyCursesWindow_Border, METH_VARARGS},
- {"box", (PyCFunction)PyCursesWindow_Box, METH_VARARGS},
+ _CURSES_WINDOW_BKGDSET_METHODDEF
+ _CURSES_WINDOW_BORDER_METHODDEF
+ _CURSES_WINDOW_BOX_METHODDEF
{"clear", (PyCFunction)PyCursesWindow_wclear, METH_NOARGS},
{"clearok", (PyCFunction)PyCursesWindow_clearok, METH_VARARGS},
{"clrtobot", (PyCFunction)PyCursesWindow_wclrtobot, METH_NOARGS},
{"clrtoeol", (PyCFunction)PyCursesWindow_wclrtoeol, METH_NOARGS},
{"cursyncup", (PyCFunction)PyCursesWindow_wcursyncup, METH_NOARGS},
- {"delch", (PyCFunction)PyCursesWindow_DelCh, METH_VARARGS},
+ _CURSES_WINDOW_DELCH_METHODDEF
{"deleteln", (PyCFunction)PyCursesWindow_wdeleteln, METH_NOARGS},
- {"derwin", (PyCFunction)PyCursesWindow_DerWin, METH_VARARGS},
- {"echochar", (PyCFunction)PyCursesWindow_EchoChar, METH_VARARGS},
-#ifdef NCURSES_MOUSE_VERSION
- {"enclose", (PyCFunction)PyCursesWindow_Enclose, METH_VARARGS},
-#endif
+ _CURSES_WINDOW_DERWIN_METHODDEF
+ _CURSES_WINDOW_ECHOCHAR_METHODDEF
+ _CURSES_WINDOW_ENCLOSE_METHODDEF
{"erase", (PyCFunction)PyCursesWindow_werase, METH_NOARGS},
{"getbegyx", (PyCFunction)PyCursesWindow_getbegyx, METH_NOARGS},
- {"getbkgd", (PyCFunction)PyCursesWindow_GetBkgd, METH_NOARGS},
- {"getch", (PyCFunction)PyCursesWindow_GetCh, METH_VARARGS},
- {"getkey", (PyCFunction)PyCursesWindow_GetKey, METH_VARARGS},
-#ifdef HAVE_NCURSESW
- {"get_wch", (PyCFunction)PyCursesWindow_Get_WCh, METH_VARARGS},
-#endif
+ _CURSES_WINDOW_GETBKGD_METHODDEF
+ _CURSES_WINDOW_GETCH_METHODDEF
+ _CURSES_WINDOW_GETKEY_METHODDEF
+ _CURSES_WINDOW_GET_WCH_METHODDEF
{"getmaxyx", (PyCFunction)PyCursesWindow_getmaxyx, METH_NOARGS},
{"getparyx", (PyCFunction)PyCursesWindow_getparyx, METH_NOARGS},
{"getstr", (PyCFunction)PyCursesWindow_GetStr, METH_VARARGS},
{"getyx", (PyCFunction)PyCursesWindow_getyx, METH_NOARGS},
- {"hline", (PyCFunction)PyCursesWindow_Hline, METH_VARARGS},
+ _CURSES_WINDOW_HLINE_METHODDEF
{"idcok", (PyCFunction)PyCursesWindow_idcok, METH_VARARGS},
{"idlok", (PyCFunction)PyCursesWindow_idlok, METH_VARARGS},
#ifdef HAVE_CURSES_IMMEDOK
{"immedok", (PyCFunction)PyCursesWindow_immedok, METH_VARARGS},
#endif
- {"inch", (PyCFunction)PyCursesWindow_InCh, METH_VARARGS},
- {"insch", (PyCFunction)PyCursesWindow_InsCh, METH_VARARGS},
+ _CURSES_WINDOW_INCH_METHODDEF
+ _CURSES_WINDOW_INSCH_METHODDEF
{"insdelln", (PyCFunction)PyCursesWindow_winsdelln, METH_VARARGS},
{"insertln", (PyCFunction)PyCursesWindow_winsertln, METH_NOARGS},
- {"insnstr", (PyCFunction)PyCursesWindow_InsNStr, METH_VARARGS},
- {"insstr", (PyCFunction)PyCursesWindow_InsStr, METH_VARARGS},
+ _CURSES_WINDOW_INSNSTR_METHODDEF
+ _CURSES_WINDOW_INSSTR_METHODDEF
{"instr", (PyCFunction)PyCursesWindow_InStr, METH_VARARGS},
- {"is_linetouched", (PyCFunction)PyCursesWindow_Is_LineTouched, METH_VARARGS},
+ _CURSES_WINDOW_IS_LINETOUCHED_METHODDEF
{"is_wintouched", (PyCFunction)PyCursesWindow_is_wintouched, METH_NOARGS},
{"keypad", (PyCFunction)PyCursesWindow_keypad, METH_VARARGS},
{"leaveok", (PyCFunction)PyCursesWindow_leaveok, METH_VARARGS},
@@ -2052,34 +2377,33 @@ static PyMethodDef PyCursesWindow_Methods[] = {
{"mvwin", (PyCFunction)PyCursesWindow_mvwin, METH_VARARGS},
{"nodelay", (PyCFunction)PyCursesWindow_nodelay, METH_VARARGS},
{"notimeout", (PyCFunction)PyCursesWindow_notimeout, METH_VARARGS},
- {"noutrefresh", (PyCFunction)PyCursesWindow_NoOutRefresh, METH_VARARGS},
- {"overlay", (PyCFunction)PyCursesWindow_Overlay, METH_VARARGS},
- {"overwrite", (PyCFunction)PyCursesWindow_Overwrite,
- METH_VARARGS},
- {"putwin", (PyCFunction)PyCursesWindow_PutWin, METH_O},
- {"redrawln", (PyCFunction)PyCursesWindow_RedrawLine, METH_VARARGS},
+ _CURSES_WINDOW_NOUTREFRESH_METHODDEF
+ _CURSES_WINDOW_OVERLAY_METHODDEF
+ _CURSES_WINDOW_OVERWRITE_METHODDEF
+ _CURSES_WINDOW_PUTWIN_METHODDEF
+ _CURSES_WINDOW_REDRAWLN_METHODDEF
{"redrawwin", (PyCFunction)PyCursesWindow_redrawwin, METH_NOARGS},
- {"refresh", (PyCFunction)PyCursesWindow_Refresh, METH_VARARGS},
+ _CURSES_WINDOW_REFRESH_METHODDEF
#ifndef STRICT_SYSV_CURSES
{"resize", (PyCFunction)PyCursesWindow_wresize, METH_VARARGS},
#endif
- {"scroll", (PyCFunction)PyCursesWindow_Scroll, METH_VARARGS},
+ _CURSES_WINDOW_SCROLL_METHODDEF
{"scrollok", (PyCFunction)PyCursesWindow_scrollok, METH_VARARGS},
- {"setscrreg", (PyCFunction)PyCursesWindow_SetScrollRegion, METH_VARARGS},
+ _CURSES_WINDOW_SETSCRREG_METHODDEF
{"standend", (PyCFunction)PyCursesWindow_wstandend, METH_NOARGS},
{"standout", (PyCFunction)PyCursesWindow_wstandout, METH_NOARGS},
- {"subpad", (PyCFunction)PyCursesWindow_SubWin, METH_VARARGS},
- {"subwin", (PyCFunction)PyCursesWindow_SubWin, METH_VARARGS},
+ {"subpad", (PyCFunction)_curses_window_subwin, METH_VARARGS, _curses_window_subwin__doc__},
+ _CURSES_WINDOW_SUBWIN_METHODDEF
{"syncdown", (PyCFunction)PyCursesWindow_wsyncdown, METH_NOARGS},
#ifdef HAVE_CURSES_SYNCOK
{"syncok", (PyCFunction)PyCursesWindow_syncok, METH_VARARGS},
#endif
{"syncup", (PyCFunction)PyCursesWindow_wsyncup, METH_NOARGS},
{"timeout", (PyCFunction)PyCursesWindow_wtimeout, METH_VARARGS},
- {"touchline", (PyCFunction)PyCursesWindow_TouchLine, METH_VARARGS},
+ _CURSES_WINDOW_TOUCHLINE_METHODDEF
{"touchwin", (PyCFunction)PyCursesWindow_touchwin, METH_NOARGS},
{"untouchwin", (PyCFunction)PyCursesWindow_untouchwin, METH_NOARGS},
- {"vline", (PyCFunction)PyCursesWindow_Vline, METH_VARARGS},
+ _CURSES_WINDOW_VLINE_METHODDEF
{NULL, NULL} /* sentinel */
};
@@ -2127,47 +2451,63 @@ PyTypeObject PyCursesWindow_Type = {
PyCursesWindow_getsets, /* tp_getset */
};
+/* Function Prototype Macros - They are ugly but very, very useful. ;-)
+
+ X - function name
+ TYPE - parameter Type
+ ERGSTR - format string for construction of the return value
+ PARSESTR - format string for argument parsing
+ */
+
+#define NoArgNoReturnFunctionBody(X) \
+{ \
+ PyCursesInitialised \
+ return PyCursesCheckERR(X(), # X); }
+
+#define NoArgOrFlagNoReturnFunctionBody(X, flag) \
+{ \
+ PyCursesInitialised \
+ if (flag) \
+ return PyCursesCheckERR(X(), # X); \
+ else \
+ return PyCursesCheckERR(no ## X(), # X); \
+}
+
+#define NoArgReturnIntFunctionBody(X) \
+{ \
+ PyCursesInitialised \
+ return PyLong_FromLong((long) X()); }
+
+
+#define NoArgReturnStringFunctionBody(X) \
+{ \
+ PyCursesInitialised \
+ return PyBytes_FromString(X()); }
+
+#define NoArgTrueFalseFunctionBody(X) \
+{ \
+ PyCursesInitialised \
+ return PyBool_FromLong(X()); }
+
+#define NoArgNoReturnVoidFunctionBody(X) \
+{ \
+ PyCursesInitialised \
+ X(); \
+ Py_RETURN_NONE; }
+
/*********************************************************************
Global Functions
**********************************************************************/
-NoArgNoReturnFunction(beep)
-NoArgNoReturnFunction(def_prog_mode)
-NoArgNoReturnFunction(def_shell_mode)
-NoArgNoReturnFunction(doupdate)
-NoArgNoReturnFunction(endwin)
-NoArgNoReturnFunction(flash)
-NoArgNoReturnFunction(nocbreak)
-NoArgNoReturnFunction(noecho)
-NoArgNoReturnFunction(nonl)
-NoArgNoReturnFunction(noraw)
-NoArgNoReturnFunction(reset_prog_mode)
-NoArgNoReturnFunction(reset_shell_mode)
-NoArgNoReturnFunction(resetty)
-NoArgNoReturnFunction(savetty)
-
-NoArgOrFlagNoReturnFunction(cbreak)
-NoArgOrFlagNoReturnFunction(echo)
-NoArgOrFlagNoReturnFunction(nl)
-NoArgOrFlagNoReturnFunction(raw)
-
-NoArgReturnIntFunction(baudrate)
-NoArgReturnIntFunction(termattrs)
-
-NoArgReturnStringFunction(termname)
-NoArgReturnStringFunction(longname)
-
-NoArgTrueFalseFunction(can_change_color)
-NoArgTrueFalseFunction(has_colors)
-NoArgTrueFalseFunction(has_ic)
-NoArgTrueFalseFunction(has_il)
-NoArgTrueFalseFunction(isendwin)
-NoArgNoReturnVoidFunction(flushinp)
-NoArgNoReturnVoidFunction(noqiflush)
-
#ifdef HAVE_CURSES_FILTER
+/*[clinic input]
+_curses.filter
+
+[clinic start generated code]*/
+
static PyObject *
-PyCurses_filter(PyObject *self)
+_curses_filter_impl(PyObject *module)
+/*[clinic end generated code: output=fb5b8a3642eb70b5 input=668c75a6992d3624]*/
{
/* not checking for PyCursesInitialised here since filter() must
be called before initscr() */
@@ -2176,17 +2516,83 @@ PyCurses_filter(PyObject *self)
}
#endif
+/*[clinic input]
+_curses.baudrate
+
+Return the output speed of the terminal in bits per second.
+[clinic start generated code]*/
+
+static PyObject *
+_curses_baudrate_impl(PyObject *module)
+/*[clinic end generated code: output=3c63c6c401d7d9c0 input=921f022ed04a0fd9]*/
+NoArgReturnIntFunctionBody(baudrate)
+
+/*[clinic input]
+_curses.beep
+
+Emit a short attention sound.
+[clinic start generated code]*/
+
+static PyObject *
+_curses_beep_impl(PyObject *module)
+/*[clinic end generated code: output=425274962abe49a2 input=a35698ca7d0162bc]*/
+NoArgNoReturnFunctionBody(beep)
+
+/*[clinic input]
+_curses.can_change_color
+
+Return True if the programmer can change the colors displayed by the terminal.
+[clinic start generated code]*/
+
+static PyObject *
+_curses_can_change_color_impl(PyObject *module)
+/*[clinic end generated code: output=359df8c3c77d8bf1 input=d7718884de0092f2]*/
+NoArgTrueFalseFunctionBody(can_change_color)
+
+/*[clinic input]
+_curses.cbreak
+
+ flag: bool(accept={int}) = True
+ If false, the effect is the same as calling nocbreak().
+ /
+
+Enter cbreak mode.
+
+In cbreak mode (sometimes called "rare" mode) normal tty line buffering is
+turned off and characters are available to be read one by one. However,
+unlike raw mode, special characters (interrupt, quit, suspend, and flow
+control) retain their effects on the tty driver and calling program.
+Calling first raw() then cbreak() leaves the terminal in cbreak mode.
+[clinic start generated code]*/
+
static PyObject *
-PyCurses_Color_Content(PyObject *self, PyObject *args)
+_curses_cbreak_impl(PyObject *module, int flag)
+/*[clinic end generated code: output=9f9dee9664769751 input=150be619eb1f1458]*/
+NoArgOrFlagNoReturnFunctionBody(cbreak, flag)
+
+/*[clinic input]
+_curses.color_content
+
+ color_number: short
+ The number of the color (0 - COLORS).
+ /
+
+Return the red, green, and blue (RGB) components of the specified color.
+
+A 3-tuple is returned, containing the R, G, B values for the given color,
+which will be between 0 (no component) and 1000 (maximum amount of component).
+[clinic start generated code]*/
+
+static PyObject *
+_curses_color_content_impl(PyObject *module, short color_number)
+/*[clinic end generated code: output=cb15cf3120d4bfc1 input=5555abb1c11e11b7]*/
{
- short color,r,g,b;
+ short r,g,b;
PyCursesInitialised;
PyCursesInitialisedColor;
- if (!PyArg_ParseTuple(args, "h:color_content", &color)) return NULL;
-
- if (color_content(color, &r, &g, &b) != ERR)
+ if (color_content(color_number, &r, &g, &b) != ERR)
return Py_BuildValue("(iii)", r, g, b);
else {
PyErr_SetString(PyCursesError,
@@ -2195,47 +2601,155 @@ PyCurses_Color_Content(PyObject *self, PyObject *args)
}
}
+/*[clinic input]
+_curses.color_pair
+
+ color_number: short
+ The number of the color (0 - COLORS).
+ /
+
+Return the attribute value for displaying text in the specified color.
+
+This attribute value can be combined with A_STANDOUT, A_REVERSE, and the
+other A_* attributes. pair_number() is the counterpart to this function.
+[clinic start generated code]*/
+
static PyObject *
-PyCurses_color_pair(PyObject *self, PyObject *args)
+_curses_color_pair_impl(PyObject *module, short color_number)
+/*[clinic end generated code: output=6a84cb6b29ecaf9a input=a9d3eb6f50e4dc12]*/
{
- int n;
-
PyCursesInitialised;
PyCursesInitialisedColor;
- if (!PyArg_ParseTuple(args, "i:color_pair", &n)) return NULL;
- return PyLong_FromLong((long) (n << 8));
+ return PyLong_FromLong((long) (color_number << 8));
}
+/*[clinic input]
+_curses.curs_set
+
+ visibility: int
+ 0 for invisible, 1 for normal visible, or 2 for very visible.
+ /
+
+Set the cursor state.
+
+If the terminal supports the visibility requested, the previous cursor
+state is returned; otherwise, an exception is raised. On many terminals,
+the "visible" mode is an underline cursor and the "very visible" mode is
+a block cursor.
+[clinic start generated code]*/
+
static PyObject *
-PyCurses_Curs_Set(PyObject *self, PyObject *args)
+_curses_curs_set_impl(PyObject *module, int visibility)
+/*[clinic end generated code: output=ee8e62483b1d6cd4 input=81a7924a65d29504]*/
{
- int vis,erg;
+ int erg;
PyCursesInitialised;
- if (!PyArg_ParseTuple(args, "i:curs_set", &vis)) return NULL;
-
- erg = curs_set(vis);
+ erg = curs_set(visibility);
if (erg == ERR) return PyCursesCheckERR(erg, "curs_set");
return PyLong_FromLong((long) erg);
}
+/*[clinic input]
+_curses.def_prog_mode
+
+Save the current terminal mode as the "program" mode.
+
+The "program" mode is the mode when the running program is using curses.
+
+Subsequent calls to reset_prog_mode() will restore this mode.
+[clinic start generated code]*/
+
static PyObject *
-PyCurses_Delay_Output(PyObject *self, PyObject *args)
-{
- int ms;
+_curses_def_prog_mode_impl(PyObject *module)
+/*[clinic end generated code: output=05d5a351fff874aa input=768b9cace620dda5]*/
+NoArgNoReturnFunctionBody(def_prog_mode)
- PyCursesInitialised;
+/*[clinic input]
+_curses.def_shell_mode
- if (!PyArg_ParseTuple(args, "i:delay_output", &ms)) return NULL;
+Save the current terminal mode as the "shell" mode.
+
+The "shell" mode is the mode when the running program is not using curses.
+
+Subsequent calls to reset_shell_mode() will restore this mode.
+[clinic start generated code]*/
+
+static PyObject *
+_curses_def_shell_mode_impl(PyObject *module)
+/*[clinic end generated code: output=d6e42f5c768f860f input=5ead21f6f0baa894]*/
+NoArgNoReturnFunctionBody(def_shell_mode)
+
+/*[clinic input]
+_curses.delay_output
+
+ ms: int
+ Duration in milliseconds.
+ /
+
+Insert a pause in output.
+[clinic start generated code]*/
+
+static PyObject *
+_curses_delay_output_impl(PyObject *module, int ms)
+/*[clinic end generated code: output=b6613a67f17fa4f4 input=5316457f5f59196c]*/
+{
+ PyCursesInitialised;
return PyCursesCheckERR(delay_output(ms), "delay_output");
}
+/*[clinic input]
+_curses.doupdate
+
+Update the physical screen to match the virtual screen.
+[clinic start generated code]*/
+
+static PyObject *
+_curses_doupdate_impl(PyObject *module)
+/*[clinic end generated code: output=f34536975a75680c input=8da80914432a6489]*/
+NoArgNoReturnFunctionBody(doupdate)
+
+/*[clinic input]
+_curses.echo
+
+ flag: bool(accept={int}) = True
+ If false, the effect is the same as calling noecho().
+ /
+
+Enter echo mode.
+
+In echo mode, each character input is echoed to the screen as it is entered.
+[clinic start generated code]*/
+
+static PyObject *
+_curses_echo_impl(PyObject *module, int flag)
+/*[clinic end generated code: output=03acb2ddfa6c8729 input=2e9e891d637eac5d]*/
+NoArgOrFlagNoReturnFunctionBody(echo, flag)
+
+/*[clinic input]
+_curses.endwin
+
+De-initialize the library, and return terminal to normal status.
+[clinic start generated code]*/
+
static PyObject *
-PyCurses_EraseChar(PyObject *self)
+_curses_endwin_impl(PyObject *module)
+/*[clinic end generated code: output=c0150cd96d2f4128 input=e172cfa43062f3fa]*/
+NoArgNoReturnFunctionBody(endwin)
+
+/*[clinic input]
+_curses.erasechar
+
+Return the user's current erase character.
+[clinic start generated code]*/
+
+static PyObject *
+_curses_erasechar_impl(PyObject *module)
+/*[clinic end generated code: output=3df305dc6b926b3f input=628c136c3c5758d3]*/
{
char ch;
@@ -2246,9 +2760,45 @@ PyCurses_EraseChar(PyObject *self)
return PyBytes_FromStringAndSize(&ch, 1);
}
+/*[clinic input]
+_curses.flash
+
+Flash the screen.
+
+That is, change it to reverse-video and then change it back in a short interval.
+[clinic start generated code]*/
+
+static PyObject *
+_curses_flash_impl(PyObject *module)
+/*[clinic end generated code: output=488b8a0ebd9ea9b8 input=02fdfb06c8fc3171]*/
+NoArgNoReturnFunctionBody(flash)
+
+/*[clinic input]
+_curses.flushinp
+
+Flush all input buffers.
+
+This throws away any typeahead that has been typed by the user and has not
+yet been processed by the program.
+[clinic start generated code]*/
+
+static PyObject *
+_curses_flushinp_impl(PyObject *module)
+/*[clinic end generated code: output=7e7a1fc1473960f5 input=59d042e705cef5ec]*/
+NoArgNoReturnVoidFunctionBody(flushinp)
+
#ifdef getsyx
+/*[clinic input]
+_curses.getsyx
+
+Return the current coordinates of the virtual screen cursor.
+
+Return a (y, x) tuple. If leaveok is currently true, return (-1, -1).
+[clinic start generated code]*/
+
static PyObject *
-PyCurses_getsyx(PyObject *self)
+_curses_getsyx_impl(PyObject *module)
+/*[clinic end generated code: output=c8e6c3f42349a038 input=9e1f862f3b4f7cba]*/
{
int x = 0;
int y = 0;
@@ -2262,8 +2812,18 @@ PyCurses_getsyx(PyObject *self)
#endif
#ifdef NCURSES_MOUSE_VERSION
+/*[clinic input]
+_curses.getmouse
+
+Retrieve the queued mouse event.
+
+After getch() returns KEY_MOUSE to signal a mouse event, this function
+returns a 5-tuple (id, x, y, z, bstate).
+[clinic start generated code]*/
+
static PyObject *
-PyCurses_GetMouse(PyObject *self)
+_curses_getmouse_impl(PyObject *module)
+/*[clinic end generated code: output=ccf4242546b9cfa8 input=5b756ee6f5b481b1]*/
{
int rtn;
MEVENT event;
@@ -2281,18 +2841,29 @@ PyCurses_GetMouse(PyObject *self)
(unsigned long) event.bstate);
}
+/*[clinic input]
+_curses.ungetmouse
+
+ id: short
+ x: int
+ y: int
+ z: int
+ bstate: unsigned_long(bitwise=True)
+ /
+
+Push a KEY_MOUSE event onto the input queue.
+
+The following getmouse() will return the given state data.
+[clinic start generated code]*/
+
static PyObject *
-PyCurses_UngetMouse(PyObject *self, PyObject *args)
+_curses_ungetmouse_impl(PyObject *module, short id, int x, int y, int z,
+ unsigned long bstate)
+/*[clinic end generated code: output=3430c9b0fc5c4341 input=fd650b2ca5a01e8f]*/
{
MEVENT event;
- short id;
- int x, y, z;
- unsigned long bstate;
PyCursesInitialised;
- if (!PyArg_ParseTuple(args, "hiiik",
- &id, &x, &y, &z, &bstate))
- return NULL;
event.id = id;
event.x = x;
@@ -2303,8 +2874,21 @@ PyCurses_UngetMouse(PyObject *self, PyObject *args)
}
#endif
+/*[clinic input]
+_curses.getwin
+
+ file: object
+ /
+
+Read window related data stored in the file by an earlier putwin() call.
+
+The routine then creates and initializes a new window using that data,
+returning the new window object.
+[clinic start generated code]*/
+
static PyObject *
-PyCurses_GetWin(PyCursesWindowObject *self, PyObject *stream)
+_curses_getwin(PyObject *module, PyObject *file)
+/*[clinic end generated code: output=a79e0df3379af756 input=f713d2bba0e4c929]*/
{
FILE *fp;
PyObject *data;
@@ -2322,8 +2906,7 @@ PyCurses_GetWin(PyCursesWindowObject *self, PyObject *stream)
if (_Py_set_inheritable(fileno(fp), 0, NULL) < 0)
goto error;
-
- data = _PyObject_CallMethodId(stream, &PyId_read, NULL);
+ data = _PyObject_CallMethodId(file, &PyId_read, NULL);
if (data == NULL)
goto error;
if (!PyBytes_Check(data)) {
@@ -2354,82 +2937,158 @@ error:
return res;
}
+/*[clinic input]
+_curses.halfdelay
+
+ tenths: byte
+ Maximal blocking delay in tenths of seconds (1 - 255).
+ /
+
+Enter half-delay mode.
+
+Use nocbreak() to leave half-delay mode.
+[clinic start generated code]*/
+
static PyObject *
-PyCurses_HalfDelay(PyObject *self, PyObject *args)
+_curses_halfdelay_impl(PyObject *module, unsigned char tenths)
+/*[clinic end generated code: output=e92cdf0ef33c0663 input=e42dce7259c15100]*/
{
- unsigned char tenths;
-
PyCursesInitialised;
- if (!PyArg_ParseTuple(args, "b:halfdelay", &tenths)) return NULL;
-
return PyCursesCheckERR(halfdelay(tenths), "halfdelay");
}
+/*[clinic input]
+_curses.has_colors
+
+Return True if the terminal can display colors; otherwise, return False.
+[clinic start generated code]*/
+
+static PyObject *
+_curses_has_colors_impl(PyObject *module)
+/*[clinic end generated code: output=db5667483139e3e2 input=b2ec41b739d896c6]*/
+NoArgTrueFalseFunctionBody(has_colors)
+
+/*[clinic input]
+_curses.has_ic
+
+Return True if the terminal has insert- and delete-character capabilities.
+[clinic start generated code]*/
+
+static PyObject *
+_curses_has_ic_impl(PyObject *module)
+/*[clinic end generated code: output=6be24da9cb1268fe input=9bc2d3a797cc7324]*/
+NoArgTrueFalseFunctionBody(has_ic)
+
+/*[clinic input]
+_curses.has_il
+
+Return True if the terminal has insert- and delete-line capabilities.
+[clinic start generated code]*/
+
+static PyObject *
+_curses_has_il_impl(PyObject *module)
+/*[clinic end generated code: output=d45bd7788ff9f5f4 input=cd939d5607ee5427]*/
+NoArgTrueFalseFunctionBody(has_il)
+
#ifdef HAVE_CURSES_HAS_KEY
+/*[clinic input]
+_curses.has_key
+
+ key: int
+ Key number.
+ /
+
+Return True if the current terminal type recognizes a key with that value.
+[clinic start generated code]*/
+
static PyObject *
-PyCurses_has_key(PyObject *self, PyObject *args)
+_curses_has_key_impl(PyObject *module, int key)
+/*[clinic end generated code: output=19ad48319414d0b1 input=78bd44acf1a4997c]*/
{
- int ch;
-
PyCursesInitialised;
- if (!PyArg_ParseTuple(args,"i",&ch)) return NULL;
-
- if (has_key(ch) == FALSE) {
- Py_RETURN_FALSE;
- }
- Py_RETURN_TRUE;
+ return PyBool_FromLong(has_key(key));
}
#endif
+/*[clinic input]
+_curses.init_color
+
+ color_number: short
+ The number of the color to be changed (0 - COLORS).
+ r: short
+ Red component (0 - 1000).
+ g: short
+ Green component (0 - 1000).
+ b: short
+ Blue component (0 - 1000).
+ /
+
+Change the definition of a color.
+
+When init_color() is used, all occurrences of that color on the screen
+immediately change to the new definition. This function is a no-op on
+most terminals; it is active only if can_change_color() returns 1.
+[clinic start generated code]*/
+
static PyObject *
-PyCurses_Init_Color(PyObject *self, PyObject *args)
+_curses_init_color_impl(PyObject *module, short color_number, short r,
+ short g, short b)
+/*[clinic end generated code: output=280236f5efe9776a input=f3a05bd38f619175]*/
{
- short color, r, g, b;
-
PyCursesInitialised;
PyCursesInitialisedColor;
- switch(PyTuple_Size(args)) {
- case 4:
- if (!PyArg_ParseTuple(args, "hhhh;color,r,g,b", &color, &r, &g, &b)) return NULL;
- break;
- default:
- PyErr_SetString(PyExc_TypeError, "init_color requires 4 arguments");
- return NULL;
- }
-
- return PyCursesCheckERR(init_color(color, r, g, b), "init_color");
+ return PyCursesCheckERR(init_color(color_number, r, g, b), "init_color");
}
+/*[clinic input]
+_curses.init_pair
+
+ pair_number: short
+ The number of the color-pair to be changed (1 - (COLOR_PAIRS-1)).
+ fg: short
+ Foreground color number (0 - COLORS).
+ bg: short
+ Background color number (0 - COLORS).
+ /
+
+Change the definition of a color-pair.
+
+If the color-pair was previously initialized, the screen is refreshed and
+all occurrences of that color-pair are changed to the new definition.
+[clinic start generated code]*/
+
static PyObject *
-PyCurses_Init_Pair(PyObject *self, PyObject *args)
+_curses_init_pair_impl(PyObject *module, short pair_number, short fg,
+ short bg)
+/*[clinic end generated code: output=9c2ce39c22f376b6 input=c9f0b11b17a2ac6d]*/
{
- short pair, f, b;
-
PyCursesInitialised;
PyCursesInitialisedColor;
- if (PyTuple_Size(args) != 3) {
- PyErr_SetString(PyExc_TypeError, "init_pair requires 3 arguments");
- return NULL;
- }
-
- if (!PyArg_ParseTuple(args, "hhh;pair, f, b", &pair, &f, &b)) return NULL;
-
- return PyCursesCheckERR(init_pair(pair, f, b), "init_pair");
+ return PyCursesCheckERR(init_pair(pair_number, fg, bg), "init_pair");
}
static PyObject *ModDict;
+/*[clinic input]
+_curses.initscr
+
+Initialize the library.
+
+Return a WindowObject which represents the whole screen.
+[clinic start generated code]*/
+
static PyObject *
-PyCurses_InitScr(PyObject *self)
+_curses_initscr_impl(PyObject *module)
+/*[clinic end generated code: output=619fb68443810b7b input=514f4bce1821f6b5]*/
{
WINDOW *win;
PyCursesWindowObject *winobj;
- if (initialised == TRUE) {
+ if (initialised) {
wrefresh(stdscr);
return (PyObject *)PyCursesWindow_New(stdscr, NULL);
}
@@ -2528,19 +3187,24 @@ PyCurses_InitScr(PyObject *self)
return (PyObject *)winobj;
}
+/*[clinic input]
+_curses.setupterm
+
+ term: str(accept={str, NoneType}) = NULL
+ Terminal name.
+ If omitted, the value of the TERM environment variable will be used.
+ fd: int = -1
+ File descriptor to which any initialization sequences will be sent.
+ If not supplied, the file descriptor for sys.stdout will be used.
+
+Initialize the terminal.
+[clinic start generated code]*/
+
static PyObject *
-PyCurses_setupterm(PyObject* self, PyObject *args, PyObject* keywds)
+_curses_setupterm_impl(PyObject *module, const char *term, int fd)
+/*[clinic end generated code: output=4584e587350f2848 input=8ac5f78ec6268be3]*/
{
- int fd = -1;
int err;
- char* termstr = NULL;
-
- static char *kwlist[] = {"term", "fd", NULL};
-
- if (!PyArg_ParseTupleAndKeywords(
- args, keywds, "|zi:setupterm", kwlist, &termstr, &fd)) {
- return NULL;
- }
if (fd == -1) {
PyObject* sys_stdout;
@@ -2561,7 +3225,7 @@ PyCurses_setupterm(PyObject* self, PyObject *args, PyObject* keywds)
}
}
- if (!initialised_setupterm && setupterm(termstr,fd,&err) == ERR) {
+ if (!initialised_setupterm && setupterm((char *)term, fd, &err) == ERR) {
const char* s = "setupterm: unknown error";
if (err == 0) {
@@ -2579,67 +3243,93 @@ PyCurses_setupterm(PyObject* self, PyObject *args, PyObject* keywds)
Py_RETURN_NONE;
}
+/*[clinic input]
+_curses.intrflush
+
+ flag: bool(accept={int})
+ /
+
+[clinic start generated code]*/
+
static PyObject *
-PyCurses_IntrFlush(PyObject *self, PyObject *args)
+_curses_intrflush_impl(PyObject *module, int flag)
+/*[clinic end generated code: output=c1986df35e999a0f input=fcba57bb28dfd795]*/
{
- int ch;
-
PyCursesInitialised;
- switch(PyTuple_Size(args)) {
- case 1:
- if (!PyArg_ParseTuple(args,"i;True(1), False(0)",&ch)) return NULL;
- break;
- default:
- PyErr_SetString(PyExc_TypeError, "intrflush requires 1 argument");
- return NULL;
- }
-
- return PyCursesCheckERR(intrflush(NULL,ch), "intrflush");
+ return PyCursesCheckERR(intrflush(NULL, flag), "intrflush");
}
+/*[clinic input]
+_curses.isendwin
+
+Return True if endwin() has been called.
+[clinic start generated code]*/
+
+static PyObject *
+_curses_isendwin_impl(PyObject *module)
+/*[clinic end generated code: output=d73179e4a7e1eb8c input=6cdb01a7ebf71397]*/
+NoArgTrueFalseFunctionBody(isendwin)
+
#ifdef HAVE_CURSES_IS_TERM_RESIZED
+/*[clinic input]
+_curses.is_term_resized
+
+ nlines: int
+ Height.
+ ncols: int
+ Width.
+ /
+
+Return True if resize_term() would modify the window structure, False otherwise.
+[clinic start generated code]*/
+
static PyObject *
-PyCurses_Is_Term_Resized(PyObject *self, PyObject *args)
+_curses_is_term_resized_impl(PyObject *module, int nlines, int ncols)
+/*[clinic end generated code: output=aafe04afe50f1288 input=ca9c0bd0fb8ab444]*/
{
- int lines;
- int columns;
- int result;
-
PyCursesInitialised;
- if (!PyArg_ParseTuple(args,"ii:is_term_resized", &lines, &columns))
- return NULL;
- result = is_term_resized(lines, columns);
- if (result == TRUE) {
- Py_RETURN_TRUE;
- } else {
- Py_RETURN_FALSE;
- }
+ return PyBool_FromLong(is_term_resized(nlines, ncols));
}
#endif /* HAVE_CURSES_IS_TERM_RESIZED */
+/*[clinic input]
+_curses.keyname
+
+ key: int
+ Key number.
+ /
+
+Return the name of specified key.
+[clinic start generated code]*/
+
static PyObject *
-PyCurses_KeyName(PyObject *self, PyObject *args)
+_curses_keyname_impl(PyObject *module, int key)
+/*[clinic end generated code: output=fa2675ab3f4e056b input=ee4b1d0f243a2a2b]*/
{
const char *knp;
- int ch;
PyCursesInitialised;
- if (!PyArg_ParseTuple(args,"i",&ch)) return NULL;
-
- if (ch < 0) {
+ if (key < 0) {
PyErr_SetString(PyExc_ValueError, "invalid key number");
return NULL;
}
- knp = keyname(ch);
+ knp = keyname(key);
return PyBytes_FromString((knp == NULL) ? "" : knp);
}
+/*[clinic input]
+_curses.killchar
+
+Return the user's current line kill character.
+[clinic start generated code]*/
+
static PyObject *
-PyCurses_KillChar(PyObject *self)
+_curses_killchar_impl(PyObject *module)
+/*[clinic end generated code: output=31c3a45b2c528269 input=1ff171c38df5ccad]*/
{
char ch;
@@ -2648,74 +3338,132 @@ PyCurses_KillChar(PyObject *self)
return PyBytes_FromStringAndSize(&ch, 1);
}
+/*[clinic input]
+_curses.longname
+
+Return the terminfo long name field describing the current terminal.
+
+The maximum length of a verbose description is 128 characters. It is defined
+only after the call to initscr().
+[clinic start generated code]*/
+
static PyObject *
-PyCurses_Meta(PyObject *self, PyObject *args)
-{
- int ch;
+_curses_longname_impl(PyObject *module)
+/*[clinic end generated code: output=fdf30433727ef568 input=84c3f20201b1098e]*/
+NoArgReturnStringFunctionBody(longname)
- PyCursesInitialised;
+/*[clinic input]
+_curses.meta
- switch(PyTuple_Size(args)) {
- case 1:
- if (!PyArg_ParseTuple(args,"i;True(1), False(0)",&ch)) return NULL;
- break;
- default:
- PyErr_SetString(PyExc_TypeError, "meta requires 1 argument");
- return NULL;
- }
+ yes: bool(accept={int})
+ /
+
+Enable/disable meta keys.
- return PyCursesCheckERR(meta(stdscr, ch), "meta");
+If yes is True, allow 8-bit characters to be input. If yes is False,
+allow only 7-bit characters.
+[clinic start generated code]*/
+
+static PyObject *
+_curses_meta_impl(PyObject *module, int yes)
+/*[clinic end generated code: output=22f5abda46a605d8 input=af9892e3a74f35db]*/
+{
+ PyCursesInitialised;
+
+ return PyCursesCheckERR(meta(stdscr, yes), "meta");
}
#ifdef NCURSES_MOUSE_VERSION
+/*[clinic input]
+_curses.mouseinterval
+
+ interval: int
+ Time in milliseconds.
+ /
+
+Set and retrieve the maximum time between press and release in a click.
+
+Set the maximum time that can elapse between press and release events in
+order for them to be recognized as a click, and return the previous interval
+value.
+[clinic start generated code]*/
+
static PyObject *
-PyCurses_MouseInterval(PyObject *self, PyObject *args)
+_curses_mouseinterval_impl(PyObject *module, int interval)
+/*[clinic end generated code: output=c4f5ff04354634c5 input=75aaa3f0db10ac4e]*/
{
- int interval;
PyCursesInitialised;
- if (!PyArg_ParseTuple(args,"i;interval",&interval))
- return NULL;
return PyCursesCheckERR(mouseinterval(interval), "mouseinterval");
}
+/*[clinic input]
+_curses.mousemask
+
+ newmask: unsigned_long(bitwise=True)
+ /
+
+Set the mouse events to be reported, and return a tuple (availmask, oldmask).
+
+Return a tuple (availmask, oldmask). availmask indicates which of the
+specified mouse events can be reported; on complete failure it returns 0.
+oldmask is the previous value of the given window's mouse event mask.
+If this function is never called, no mouse events are ever reported.
+[clinic start generated code]*/
+
static PyObject *
-PyCurses_MouseMask(PyObject *self, PyObject *args)
+_curses_mousemask_impl(PyObject *module, unsigned long newmask)
+/*[clinic end generated code: output=9406cf1b8a36e485 input=bdf76b7568a3c541]*/
{
- unsigned long newmask;
mmask_t oldmask, availmask;
PyCursesInitialised;
- if (!PyArg_ParseTuple(args,"k;mousemask",&newmask))
- return NULL;
availmask = mousemask((mmask_t)newmask, &oldmask);
return Py_BuildValue("(kk)",
(unsigned long)availmask, (unsigned long)oldmask);
}
#endif
+/*[clinic input]
+_curses.napms
+
+ ms: int
+ Duration in milliseconds.
+ /
+
+Sleep for specified time.
+[clinic start generated code]*/
+
static PyObject *
-PyCurses_Napms(PyObject *self, PyObject *args)
+_curses_napms_impl(PyObject *module, int ms)
+/*[clinic end generated code: output=a40a1da2e39ea438 input=20cd3af2b6900f56]*/
{
- int ms;
-
PyCursesInitialised;
- if (!PyArg_ParseTuple(args, "i;ms", &ms)) return NULL;
return Py_BuildValue("i", napms(ms));
}
+/*[clinic input]
+_curses.newpad
+
+ nlines: int
+ Height.
+ ncols: int
+ Width.
+ /
+
+Create and return a pointer to a new pad data structure.
+[clinic start generated code]*/
+
static PyObject *
-PyCurses_NewPad(PyObject *self, PyObject *args)
+_curses_newpad_impl(PyObject *module, int nlines, int ncols)
+/*[clinic end generated code: output=de52a56eb1098ec9 input=93f1272f240d8894]*/
{
WINDOW *win;
- int nlines, ncols;
PyCursesInitialised;
- if (!PyArg_ParseTuple(args,"ii;nlines,ncols",&nlines,&ncols)) return NULL;
-
win = newpad(nlines, ncols);
if (win == NULL) {
@@ -2726,29 +3474,36 @@ PyCurses_NewPad(PyObject *self, PyObject *args)
return (PyObject *)PyCursesWindow_New(win, NULL);
}
+/*[clinic input]
+_curses.newwin
+
+ nlines: int
+ Height.
+ ncols: int
+ Width.
+ [
+ begin_y: int = 0
+ Top side y-coordinate.
+ begin_x: int = 0
+ Left side x-coordinate.
+ ]
+ /
+
+Return a new window.
+
+By default, the window will extend from the specified position to the lower
+right corner of the screen.
+[clinic start generated code]*/
+
static PyObject *
-PyCurses_NewWindow(PyObject *self, PyObject *args)
+_curses_newwin_impl(PyObject *module, int nlines, int ncols,
+ int group_right_1, int begin_y, int begin_x)
+/*[clinic end generated code: output=c1e0a8dc8ac2826c input=29312c15a72a003d]*/
{
WINDOW *win;
- int nlines, ncols, begin_y=0, begin_x=0;
PyCursesInitialised;
- switch (PyTuple_Size(args)) {
- case 2:
- if (!PyArg_ParseTuple(args,"ii;nlines,ncols",&nlines,&ncols))
- return NULL;
- break;
- case 4:
- if (!PyArg_ParseTuple(args, "iiii;nlines,ncols,begin_y,begin_x",
- &nlines,&ncols,&begin_y,&begin_x))
- return NULL;
- break;
- default:
- PyErr_SetString(PyExc_TypeError, "newwin requires 2 or 4 arguments");
- return NULL;
- }
-
win = newwin(nlines,ncols,begin_y,begin_x);
if (win == NULL) {
PyErr_SetString(PyCursesError, catchall_NULL);
@@ -2758,24 +3513,111 @@ PyCurses_NewWindow(PyObject *self, PyObject *args)
return (PyObject *)PyCursesWindow_New(win, NULL);
}
+/*[clinic input]
+_curses.nl
+
+ flag: bool(accept={int}) = True
+ If false, the effect is the same as calling nonl().
+ /
+
+Enter newline mode.
+
+This mode translates the return key into newline on input, and translates
+newline into return and line-feed on output. Newline mode is initially on.
+[clinic start generated code]*/
+
+static PyObject *
+_curses_nl_impl(PyObject *module, int flag)
+/*[clinic end generated code: output=b39cc0ffc9015003 input=cf36a63f7b86e28a]*/
+NoArgOrFlagNoReturnFunctionBody(nl, flag)
+
+/*[clinic input]
+_curses.nocbreak
+
+Leave cbreak mode.
+
+Return to normal "cooked" mode with line buffering.
+[clinic start generated code]*/
+
+static PyObject *
+_curses_nocbreak_impl(PyObject *module)
+/*[clinic end generated code: output=eabf3833a4fbf620 input=e4b65f7d734af400]*/
+NoArgNoReturnFunctionBody(nocbreak)
+
+/*[clinic input]
+_curses.noecho
+
+Leave echo mode.
+
+Echoing of input characters is turned off.
+[clinic start generated code]*/
+
+static PyObject *
+_curses_noecho_impl(PyObject *module)
+/*[clinic end generated code: output=cc95ab45bc98f41b input=76714df529e614c3]*/
+NoArgNoReturnFunctionBody(noecho)
+
+/*[clinic input]
+_curses.nonl
+
+Leave newline mode.
+
+Disable translation of return into newline on input, and disable low-level
+translation of newline into newline/return on output.
+[clinic start generated code]*/
+
+static PyObject *
+_curses_nonl_impl(PyObject *module)
+/*[clinic end generated code: output=99e917e9715770c6 input=9d37dd122d3022fc]*/
+NoArgNoReturnFunctionBody(nonl)
+
+/*[clinic input]
+_curses.noqiflush
+
+Disable queue flushing.
+
+When queue flushing is disabled, normal flush of input and output queues
+associated with the INTR, QUIT and SUSP characters will not be done.
+[clinic start generated code]*/
+
+static PyObject *
+_curses_noqiflush_impl(PyObject *module)
+/*[clinic end generated code: output=8b95a4229bbf0877 input=ba3e6b2e3e54c4df]*/
+NoArgNoReturnVoidFunctionBody(noqiflush)
+
+/*[clinic input]
+_curses.noraw
+
+Leave raw mode.
+
+Return to normal "cooked" mode with line buffering.
+[clinic start generated code]*/
+
+static PyObject *
+_curses_noraw_impl(PyObject *module)
+/*[clinic end generated code: output=39894e5524c430cc input=6ec86692096dffb5]*/
+NoArgNoReturnFunctionBody(noraw)
+
+/*[clinic input]
+_curses.pair_content
+
+ pair_number: short
+ The number of the color pair (1 - (COLOR_PAIRS-1)).
+ /
+
+Return a tuple (fg, bg) containing the colors for the requested color pair.
+[clinic start generated code]*/
+
static PyObject *
-PyCurses_Pair_Content(PyObject *self, PyObject *args)
+_curses_pair_content_impl(PyObject *module, short pair_number)
+/*[clinic end generated code: output=5a72aa1a28bbacf3 input=f4d7fec5643b976b]*/
{
- short pair,f,b;
+ short f, b;
PyCursesInitialised;
PyCursesInitialisedColor;
- switch(PyTuple_Size(args)) {
- case 1:
- if (!PyArg_ParseTuple(args, "h;pair", &pair)) return NULL;
- break;
- default:
- PyErr_SetString(PyExc_TypeError, "pair_content requires 1 argument");
- return NULL;
- }
-
- if (pair_content(pair, &f, &b)==ERR) {
+ if (pair_content(pair_number, &f, &b)==ERR) {
PyErr_SetString(PyCursesError,
"Argument 1 was out of range. (1..COLOR_PAIRS-1)");
return NULL;
@@ -2784,57 +3626,71 @@ PyCurses_Pair_Content(PyObject *self, PyObject *args)
return Py_BuildValue("(ii)", f, b);
}
+/*[clinic input]
+_curses.pair_number
+
+ attr: int
+ /
+
+Return the number of the color-pair set by the specified attribute value.
+
+color_pair() is the counterpart to this function.
+[clinic start generated code]*/
+
static PyObject *
-PyCurses_pair_number(PyObject *self, PyObject *args)
+_curses_pair_number_impl(PyObject *module, int attr)
+/*[clinic end generated code: output=85bce7d65c0aa3f4 input=d478548e33f5e61a]*/
{
- int n;
-
PyCursesInitialised;
PyCursesInitialisedColor;
- switch(PyTuple_Size(args)) {
- case 1:
- if (!PyArg_ParseTuple(args, "i;pairvalue", &n)) return NULL;
- break;
- default:
- PyErr_SetString(PyExc_TypeError,
- "pair_number requires 1 argument");
- return NULL;
- }
-
- return PyLong_FromLong((long) ((n & A_COLOR) >> 8));
+ return PyLong_FromLong((long) ((attr & A_COLOR) >> 8));
}
+/*[clinic input]
+_curses.putp
+
+ string: str(accept={robuffer})
+ /
+
+Emit the value of a specified terminfo capability for the current terminal.
+
+Note that the output of putp() always goes to standard output.
+[clinic start generated code]*/
+
static PyObject *
-PyCurses_Putp(PyObject *self, PyObject *args)
+_curses_putp_impl(PyObject *module, const char *string)
+/*[clinic end generated code: output=e98081d1b8eb5816 input=1601faa828b44cb3]*/
{
- char *str;
-
- if (!PyArg_ParseTuple(args,"y;str", &str))
- return NULL;
- return PyCursesCheckERR(putp(str), "putp");
+ return PyCursesCheckERR(putp(string), "putp");
}
+/*[clinic input]
+_curses.qiflush
+
+ flag: bool(accept={int}) = True
+ If false, the effect is the same as calling noqiflush().
+ /
+
+Enable queue flushing.
+
+If queue flushing is enabled, all output in the display driver queue
+will be flushed when the INTR, QUIT and SUSP characters are read.
+[clinic start generated code]*/
+
static PyObject *
-PyCurses_QiFlush(PyObject *self, PyObject *args)
+_curses_qiflush_impl(PyObject *module, int flag)
+/*[clinic end generated code: output=9167e862f760ea30 input=e9e4a389946a0dbc]*/
{
- int flag = 0;
-
PyCursesInitialised;
- switch(PyTuple_Size(args)) {
- case 0:
+ if (flag) {
qiflush();
- Py_RETURN_NONE;
- case 1:
- if (!PyArg_ParseTuple(args, "i;True(1) or False(0)", &flag)) return NULL;
- if (flag) qiflush();
- else noqiflush();
- Py_RETURN_NONE;
- default:
- PyErr_SetString(PyExc_TypeError, "qiflush requires 0 or 1 arguments");
- return NULL;
}
+ else {
+ noqiflush();
+ }
+ Py_RETURN_NONE;
}
/* Internal helper used for updating curses.LINES, curses.COLS, _curses.LINES
@@ -2888,28 +3744,97 @@ update_lines_cols(void)
return 1;
}
-static PyObject *
-PyCurses_update_lines_cols(PyObject *self)
+/*[clinic input]
+_curses.update_lines_cols -> int
+
+[clinic start generated code]*/
+
+static int
+_curses_update_lines_cols_impl(PyObject *module)
+/*[clinic end generated code: output=0345e7f072ea711a input=3a87760f7d5197f0]*/
{
- return PyLong_FromLong((long) update_lines_cols());
+ return update_lines_cols();
}
#endif
+/*[clinic input]
+_curses.raw
+
+ flag: bool(accept={int}) = True
+ If false, the effect is the same as calling noraw().
+ /
+
+Enter raw mode.
+
+In raw mode, normal line buffering and processing of interrupt, quit,
+suspend, and flow control keys are turned off; characters are presented to
+curses input functions one by one.
+[clinic start generated code]*/
+
+static PyObject *
+_curses_raw_impl(PyObject *module, int flag)
+/*[clinic end generated code: output=a750e4b342be015b input=e36d8db27832b848]*/
+NoArgOrFlagNoReturnFunctionBody(raw, flag)
+
+/*[clinic input]
+_curses.reset_prog_mode
+
+Restore the terminal to "program" mode, as previously saved by def_prog_mode().
+[clinic start generated code]*/
+
+static PyObject *
+_curses_reset_prog_mode_impl(PyObject *module)
+/*[clinic end generated code: output=15eb765abf0b6575 input=3d82bea2b3243471]*/
+NoArgNoReturnFunctionBody(reset_prog_mode)
+
+/*[clinic input]
+_curses.reset_shell_mode
+
+Restore the terminal to "shell" mode, as previously saved by def_shell_mode().
+[clinic start generated code]*/
+
+static PyObject *
+_curses_reset_shell_mode_impl(PyObject *module)
+/*[clinic end generated code: output=0238de2962090d33 input=1c738fa64bd1a24f]*/
+NoArgNoReturnFunctionBody(reset_shell_mode)
+
+/*[clinic input]
+_curses.resetty
+
+Restore terminal mode.
+[clinic start generated code]*/
+
+static PyObject *
+_curses_resetty_impl(PyObject *module)
+/*[clinic end generated code: output=ff4b448e80a7cd63 input=940493de03624bb0]*/
+NoArgNoReturnFunctionBody(resetty)
+
#ifdef HAVE_CURSES_RESIZETERM
+/*[clinic input]
+_curses.resizeterm
+
+ nlines: int
+ Height.
+ ncols: int
+ Width.
+ /
+
+Resize the standard and current windows to the specified dimensions.
+
+Adjusts other bookkeeping data used by the curses library that record the
+window dimensions (in particular the SIGWINCH handler).
+[clinic start generated code]*/
+
static PyObject *
-PyCurses_ResizeTerm(PyObject *self, PyObject *args)
+_curses_resizeterm_impl(PyObject *module, int nlines, int ncols)
+/*[clinic end generated code: output=56d6bcc5194ad055 input=0fca02ebad5ffa82]*/
{
- int lines;
- int columns;
PyObject *result;
PyCursesInitialised;
- if (!PyArg_ParseTuple(args,"ii:resizeterm", &lines, &columns))
- return NULL;
-
- result = PyCursesCheckERR(resizeterm(lines, columns), "resizeterm");
+ result = PyCursesCheckERR(resizeterm(nlines, ncols), "resizeterm");
if (!result)
return NULL;
if (!update_lines_cols())
@@ -2920,20 +3845,33 @@ PyCurses_ResizeTerm(PyObject *self, PyObject *args)
#endif
#ifdef HAVE_CURSES_RESIZE_TERM
+/*[clinic input]
+_curses.resize_term
+
+ nlines: int
+ Height.
+ ncols: int
+ Width.
+ /
+
+Backend function used by resizeterm(), performing most of the work.
+
+When resizing the windows, resize_term() blank-fills the areas that are
+extended. The calling application should fill in these areas with appropriate
+data. The resize_term() function attempts to resize all windows. However,
+due to the calling convention of pads, it is not possible to resize these
+without additional interaction with the application.
+[clinic start generated code]*/
+
static PyObject *
-PyCurses_Resize_Term(PyObject *self, PyObject *args)
+_curses_resize_term_impl(PyObject *module, int nlines, int ncols)
+/*[clinic end generated code: output=9e26d8b9ea311ed2 input=2197edd05b049ed4]*/
{
- int lines;
- int columns;
-
PyObject *result;
PyCursesInitialised;
- if (!PyArg_ParseTuple(args,"ii:resize_term", &lines, &columns))
- return NULL;
-
- result = PyCursesCheckERR(resize_term(lines, columns), "resize_term");
+ result = PyCursesCheckERR(resize_term(nlines, ncols), "resize_term");
if (!result)
return NULL;
if (!update_lines_cols())
@@ -2942,20 +3880,37 @@ PyCurses_Resize_Term(PyObject *self, PyObject *args)
}
#endif /* HAVE_CURSES_RESIZE_TERM */
-#ifdef getsyx
+/*[clinic input]
+_curses.savetty
+
+Save terminal mode.
+[clinic start generated code]*/
+
static PyObject *
-PyCurses_setsyx(PyObject *self, PyObject *args)
-{
- int y,x;
+_curses_savetty_impl(PyObject *module)
+/*[clinic end generated code: output=6babc49f12b42199 input=fce6b2b7d2200102]*/
+NoArgNoReturnFunctionBody(savetty)
- PyCursesInitialised;
+#ifdef getsyx
+/*[clinic input]
+_curses.setsyx
- if (PyTuple_Size(args)!=2) {
- PyErr_SetString(PyExc_TypeError, "setsyx requires 2 arguments");
- return NULL;
- }
+ y: int
+ Y-coordinate.
+ x: int
+ X-coordinate.
+ /
+
+Set the virtual screen cursor.
+
+If y and x are both -1, then leaveok is set.
+[clinic start generated code]*/
- if (!PyArg_ParseTuple(args, "ii;y, x", &y, &x)) return NULL;
+static PyObject *
+_curses_setsyx_impl(PyObject *module, int y, int x)
+/*[clinic end generated code: output=23dcf753511a2464 input=fa7f2b208e10a557]*/
+{
+ PyCursesInitialised;
setsyx(y,x);
@@ -2963,8 +3918,22 @@ PyCurses_setsyx(PyObject *self, PyObject *args)
}
#endif
+/*[clinic input]
+_curses.start_color
+
+Initializes eight basic colors and global variables COLORS and COLOR_PAIRS.
+
+Must be called if the programmer wants to use colors, and before any other
+color manipulation routine is called. It is good practice to call this
+routine right after initscr().
+
+It also restores the colors on the terminal to the values they had when the
+terminal was just turned on.
+[clinic start generated code]*/
+
static PyObject *
-PyCurses_Start_Color(PyObject *self)
+_curses_start_color_impl(PyObject *module)
+/*[clinic end generated code: output=8b772b41d8090ede input=0ca0ecb2b77e1a12]*/
{
int code;
PyObject *c, *cp;
@@ -2991,42 +3960,91 @@ PyCurses_Start_Color(PyObject *self)
}
}
+/*[clinic input]
+_curses.termattrs
+
+Return a logical OR of all video attributes supported by the terminal.
+[clinic start generated code]*/
+
static PyObject *
-PyCurses_tigetflag(PyObject *self, PyObject *args)
-{
- char *capname;
+_curses_termattrs_impl(PyObject *module)
+/*[clinic end generated code: output=b06f437fce1b6fc4 input=0559882a04f84d1d]*/
+NoArgReturnIntFunctionBody(termattrs)
- PyCursesSetupTermCalled;
+/*[clinic input]
+_curses.termname
- if (!PyArg_ParseTuple(args, "s", &capname))
- return NULL;
+Return the value of the environment variable TERM, truncated to 14 characters.
+[clinic start generated code]*/
+
+static PyObject *
+_curses_termname_impl(PyObject *module)
+/*[clinic end generated code: output=96375577ebbd67fd input=33c08d000944f33f]*/
+NoArgReturnStringFunctionBody(termname)
+
+/*[clinic input]
+_curses.tigetflag
+
+ capname: str
+ The terminfo capability name.
+ /
+
+Return the value of the Boolean capability.
+
+The value -1 is returned if capname is not a Boolean capability, or 0 if
+it is canceled or absent from the terminal description.
+[clinic start generated code]*/
+
+static PyObject *
+_curses_tigetflag_impl(PyObject *module, const char *capname)
+/*[clinic end generated code: output=8853c0e55542195b input=b0787af9e3e9a6ce]*/
+{
+ PyCursesSetupTermCalled;
return PyLong_FromLong( (long) tigetflag( capname ) );
}
+/*[clinic input]
+_curses.tigetnum
+
+ capname: str
+ The terminfo capability name.
+ /
+
+Return the value of the numeric capability.
+
+The value -2 is returned if capname is not a numeric capability, or -1 if
+it is canceled or absent from the terminal description.
+[clinic start generated code]*/
+
static PyObject *
-PyCurses_tigetnum(PyObject *self, PyObject *args)
+_curses_tigetnum_impl(PyObject *module, const char *capname)
+/*[clinic end generated code: output=46f8b0a1b5dff42f input=5cdf2f410b109720]*/
{
- char *capname;
-
PyCursesSetupTermCalled;
- if (!PyArg_ParseTuple(args, "s", &capname))
- return NULL;
-
return PyLong_FromLong( (long) tigetnum( capname ) );
}
+/*[clinic input]
+_curses.tigetstr
+
+ capname: str
+ The terminfo capability name.
+ /
+
+Return the value of the string capability.
+
+None is returned if capname is not a string capability, or is canceled or
+absent from the terminal description.
+[clinic start generated code]*/
+
static PyObject *
-PyCurses_tigetstr(PyObject *self, PyObject *args)
+_curses_tigetstr_impl(PyObject *module, const char *capname)
+/*[clinic end generated code: output=f22b576ad60248f3 input=36644df25c73c0a7]*/
{
- char *capname;
-
PyCursesSetupTermCalled;
- if (!PyArg_ParseTuple(args, "s", &capname))
- return NULL;
-
capname = tigetstr( capname );
if (capname == NULL || capname == (char*) -1) {
Py_RETURN_NONE;
@@ -3034,22 +4052,35 @@ PyCurses_tigetstr(PyObject *self, PyObject *args)
return PyBytes_FromString( capname );
}
+/*[clinic input]
+_curses.tparm
+
+ str: str(accept={robuffer})
+ Parameterized byte string obtained from the terminfo database.
+ i1: int = 0
+ i2: int = 0
+ i3: int = 0
+ i4: int = 0
+ i5: int = 0
+ i6: int = 0
+ i7: int = 0
+ i8: int = 0
+ i9: int = 0
+ /
+
+Instantiate the specified byte string with the supplied parameters.
+[clinic start generated code]*/
+
static PyObject *
-PyCurses_tparm(PyObject *self, PyObject *args)
+_curses_tparm_impl(PyObject *module, const char *str, int i1, int i2, int i3,
+ int i4, int i5, int i6, int i7, int i8, int i9)
+/*[clinic end generated code: output=599f62b615c667ff input=5e30b15786f032aa]*/
{
- char* fmt;
char* result = NULL;
- int i1=0,i2=0,i3=0,i4=0,i5=0,i6=0,i7=0,i8=0,i9=0;
PyCursesSetupTermCalled;
- if (!PyArg_ParseTuple(args, "y|iiiiiiiii:tparm",
- &fmt, &i1, &i2, &i3, &i4,
- &i5, &i6, &i7, &i8, &i9)) {
- return NULL;
- }
-
- result = tparm(fmt,i1,i2,i3,i4,i5,i6,i7,i8,i9);
+ result = tparm(str,i1,i2,i3,i4,i5,i6,i7,i8,i9);
if (!result) {
PyErr_SetString(PyCursesError, "tparm() returned NULL");
return NULL;
@@ -3059,50 +4090,75 @@ PyCurses_tparm(PyObject *self, PyObject *args)
}
#ifdef HAVE_CURSES_TYPEAHEAD
+/*[clinic input]
+_curses.typeahead
+
+ fd: int
+ File descriptor.
+ /
+
+Specify that the file descriptor fd be used for typeahead checking.
+
+If fd is -1, then no typeahead checking is done.
+[clinic start generated code]*/
+
static PyObject *
-PyCurses_TypeAhead(PyObject *self, PyObject *args)
+_curses_typeahead_impl(PyObject *module, int fd)
+/*[clinic end generated code: output=084bb649d7066583 input=f2968d8e1805051b]*/
{
- int fd;
-
PyCursesInitialised;
- if (!PyArg_ParseTuple(args,"i;fd",&fd)) return NULL;
-
return PyCursesCheckERR(typeahead( fd ), "typeahead");
}
#endif
+/*[clinic input]
+_curses.unctrl
+
+ ch: object
+ /
+
+Return a string which is a printable representation of the character ch.
+
+Control characters are displayed as a caret followed by the character,
+for example as ^C. Printing characters are left as they are.
+[clinic start generated code]*/
+
static PyObject *
-PyCurses_UnCtrl(PyObject *self, PyObject *args)
+_curses_unctrl(PyObject *module, PyObject *ch)
+/*[clinic end generated code: output=8e07fafc430c9434 input=cd1e35e16cd1ace4]*/
{
- PyObject *temp;
- chtype ch;
+ chtype ch_;
PyCursesInitialised;
- if (!PyArg_ParseTuple(args,"O;ch or int",&temp)) return NULL;
-
- if (!PyCurses_ConvertToChtype(NULL, temp, &ch))
+ if (!PyCurses_ConvertToChtype(NULL, ch, &ch_))
return NULL;
- return PyBytes_FromString(unctrl(ch));
+ return PyBytes_FromString(unctrl(ch_));
}
+/*[clinic input]
+_curses.ungetch
+
+ ch: object
+ /
+
+Push ch so the next getch() will return it.
+[clinic start generated code]*/
+
static PyObject *
-PyCurses_UngetCh(PyObject *self, PyObject *args)
+_curses_ungetch(PyObject *module, PyObject *ch)
+/*[clinic end generated code: output=9b19d8268376d887 input=6681e6ae4c42e5eb]*/
{
- PyObject *temp;
- chtype ch;
+ chtype ch_;
PyCursesInitialised;
- if (!PyArg_ParseTuple(args,"O;ch or int",&temp))
- return NULL;
-
- if (!PyCurses_ConvertToChtype(NULL, temp, &ch))
+ if (!PyCurses_ConvertToChtype(NULL, ch, &ch_))
return NULL;
- return PyCursesCheckERR(ungetch(ch), "ungetch");
+ return PyCursesCheckERR(ungetch(ch_), "ungetch");
}
#ifdef HAVE_NCURSESW
@@ -3153,46 +4209,70 @@ PyCurses_ConvertToWchar_t(PyObject *obj,
}
}
+/*[clinic input]
+_curses.unget_wch
+
+ ch: object
+ /
+
+Push ch so the next get_wch() will return it.
+[clinic start generated code]*/
+
static PyObject *
-PyCurses_Unget_Wch(PyObject *self, PyObject *args)
+_curses_unget_wch(PyObject *module, PyObject *ch)
+/*[clinic end generated code: output=1974c9fb01d37863 input=0d56dc65a46feebb]*/
{
- PyObject *obj;
wchar_t wch;
PyCursesInitialised;
- if (!PyArg_ParseTuple(args,"O", &obj))
- return NULL;
-
- if (!PyCurses_ConvertToWchar_t(obj, &wch))
+ if (!PyCurses_ConvertToWchar_t(ch, &wch))
return NULL;
return PyCursesCheckERR(unget_wch(wch), "unget_wch");
}
#endif
-#ifdef HAVE_CURSES_TYPEAHEAD
+#ifdef HAVE_CURSES_USE_ENV
+/*[clinic input]
+_curses.use_env
+
+ flag: bool(accept={int})
+ /
+
+Use environment variables LINES and COLUMNS.
+
+If used, this function should be called before initscr() or newterm() are
+called.
+
+When flag is False, the values of lines and columns specified in the terminfo
+database will be used, even if environment variables LINES and COLUMNS (used
+by default) are set, or if curses is running in a window (in which case
+default behavior would be to use the window size if LINES and COLUMNS are
+not set).
+[clinic start generated code]*/
+
static PyObject *
-PyCurses_Use_Env(PyObject *self, PyObject *args)
+_curses_use_env_impl(PyObject *module, int flag)
+/*[clinic end generated code: output=b2c445e435c0b164 input=1778eb1e9151ea37]*/
{
- int flag;
-
- switch(PyTuple_Size(args)) {
- case 1:
- if (!PyArg_ParseTuple(args,"i;True(1), False(0)",&flag))
- return NULL;
- break;
- default:
- PyErr_SetString(PyExc_TypeError, "use_env requires 1 argument");
- return NULL;
- }
use_env(flag);
Py_RETURN_NONE;
}
#endif
#ifndef STRICT_SYSV_CURSES
+/*[clinic input]
+_curses.use_default_colors
+
+Allow use of default values for colors on terminals supporting this feature.
+
+Use this to support transparency in your application. The default color
+is assigned to the color number -1.
+[clinic start generated code]*/
+
static PyObject *
-PyCurses_Use_Default_Colors(PyObject *self)
+_curses_use_default_colors_impl(PyObject *module)
+/*[clinic end generated code: output=a3b81ff71dd901be input=656844367470e8fc]*/
{
int code;
@@ -3212,109 +4292,80 @@ PyCurses_Use_Default_Colors(PyObject *self)
/* List of functions defined in the module */
static PyMethodDef PyCurses_methods[] = {
- {"baudrate", (PyCFunction)PyCurses_baudrate, METH_NOARGS},
- {"beep", (PyCFunction)PyCurses_beep, METH_NOARGS},
- {"can_change_color", (PyCFunction)PyCurses_can_change_color, METH_NOARGS},
- {"cbreak", (PyCFunction)PyCurses_cbreak, METH_VARARGS},
- {"color_content", (PyCFunction)PyCurses_Color_Content, METH_VARARGS},
- {"color_pair", (PyCFunction)PyCurses_color_pair, METH_VARARGS},
- {"curs_set", (PyCFunction)PyCurses_Curs_Set, METH_VARARGS},
- {"def_prog_mode", (PyCFunction)PyCurses_def_prog_mode, METH_NOARGS},
- {"def_shell_mode", (PyCFunction)PyCurses_def_shell_mode, METH_NOARGS},
- {"delay_output", (PyCFunction)PyCurses_Delay_Output, METH_VARARGS},
- {"doupdate", (PyCFunction)PyCurses_doupdate, METH_NOARGS},
- {"echo", (PyCFunction)PyCurses_echo, METH_VARARGS},
- {"endwin", (PyCFunction)PyCurses_endwin, METH_NOARGS},
- {"erasechar", (PyCFunction)PyCurses_EraseChar, METH_NOARGS},
-#ifdef HAVE_CURSES_FILTER
- {"filter", (PyCFunction)PyCurses_filter, METH_NOARGS},
-#endif
- {"flash", (PyCFunction)PyCurses_flash, METH_NOARGS},
- {"flushinp", (PyCFunction)PyCurses_flushinp, METH_NOARGS},
-#ifdef NCURSES_MOUSE_VERSION
- {"getmouse", (PyCFunction)PyCurses_GetMouse, METH_NOARGS},
- {"ungetmouse", (PyCFunction)PyCurses_UngetMouse, METH_VARARGS},
-#endif
-#ifdef getsyx
- {"getsyx", (PyCFunction)PyCurses_getsyx, METH_NOARGS},
-#endif
- {"getwin", (PyCFunction)PyCurses_GetWin, METH_O},
- {"has_colors", (PyCFunction)PyCurses_has_colors, METH_NOARGS},
- {"has_ic", (PyCFunction)PyCurses_has_ic, METH_NOARGS},
- {"has_il", (PyCFunction)PyCurses_has_il, METH_NOARGS},
-#ifdef HAVE_CURSES_HAS_KEY
- {"has_key", (PyCFunction)PyCurses_has_key, METH_VARARGS},
-#endif
- {"halfdelay", (PyCFunction)PyCurses_HalfDelay, METH_VARARGS},
- {"init_color", (PyCFunction)PyCurses_Init_Color, METH_VARARGS},
- {"init_pair", (PyCFunction)PyCurses_Init_Pair, METH_VARARGS},
- {"initscr", (PyCFunction)PyCurses_InitScr, METH_NOARGS},
- {"intrflush", (PyCFunction)PyCurses_IntrFlush, METH_VARARGS},
- {"isendwin", (PyCFunction)PyCurses_isendwin, METH_NOARGS},
-#ifdef HAVE_CURSES_IS_TERM_RESIZED
- {"is_term_resized", (PyCFunction)PyCurses_Is_Term_Resized, METH_VARARGS},
-#endif
- {"keyname", (PyCFunction)PyCurses_KeyName, METH_VARARGS},
- {"killchar", (PyCFunction)PyCurses_KillChar, METH_NOARGS},
- {"longname", (PyCFunction)PyCurses_longname, METH_NOARGS},
- {"meta", (PyCFunction)PyCurses_Meta, METH_VARARGS},
-#ifdef NCURSES_MOUSE_VERSION
- {"mouseinterval", (PyCFunction)PyCurses_MouseInterval, METH_VARARGS},
- {"mousemask", (PyCFunction)PyCurses_MouseMask, METH_VARARGS},
-#endif
- {"napms", (PyCFunction)PyCurses_Napms, METH_VARARGS},
- {"newpad", (PyCFunction)PyCurses_NewPad, METH_VARARGS},
- {"newwin", (PyCFunction)PyCurses_NewWindow, METH_VARARGS},
- {"nl", (PyCFunction)PyCurses_nl, METH_VARARGS},
- {"nocbreak", (PyCFunction)PyCurses_nocbreak, METH_NOARGS},
- {"noecho", (PyCFunction)PyCurses_noecho, METH_NOARGS},
- {"nonl", (PyCFunction)PyCurses_nonl, METH_NOARGS},
- {"noqiflush", (PyCFunction)PyCurses_noqiflush, METH_NOARGS},
- {"noraw", (PyCFunction)PyCurses_noraw, METH_NOARGS},
- {"pair_content", (PyCFunction)PyCurses_Pair_Content, METH_VARARGS},
- {"pair_number", (PyCFunction)PyCurses_pair_number, METH_VARARGS},
- {"putp", (PyCFunction)PyCurses_Putp, METH_VARARGS},
- {"qiflush", (PyCFunction)PyCurses_QiFlush, METH_VARARGS},
- {"raw", (PyCFunction)PyCurses_raw, METH_VARARGS},
- {"reset_prog_mode", (PyCFunction)PyCurses_reset_prog_mode, METH_NOARGS},
- {"reset_shell_mode", (PyCFunction)PyCurses_reset_shell_mode, METH_NOARGS},
- {"resetty", (PyCFunction)PyCurses_resetty, METH_NOARGS},
-#ifdef HAVE_CURSES_RESIZETERM
- {"resizeterm", (PyCFunction)PyCurses_ResizeTerm, METH_VARARGS},
-#endif
-#ifdef HAVE_CURSES_RESIZE_TERM
- {"resize_term", (PyCFunction)PyCurses_Resize_Term, METH_VARARGS},
-#endif
- {"savetty", (PyCFunction)PyCurses_savetty, METH_NOARGS},
-#ifdef getsyx
- {"setsyx", (PyCFunction)PyCurses_setsyx, METH_VARARGS},
-#endif
- {"setupterm", (PyCFunction)PyCurses_setupterm,
- METH_VARARGS|METH_KEYWORDS},
- {"start_color", (PyCFunction)PyCurses_Start_Color, METH_NOARGS},
- {"termattrs", (PyCFunction)PyCurses_termattrs, METH_NOARGS},
- {"termname", (PyCFunction)PyCurses_termname, METH_NOARGS},
- {"tigetflag", (PyCFunction)PyCurses_tigetflag, METH_VARARGS},
- {"tigetnum", (PyCFunction)PyCurses_tigetnum, METH_VARARGS},
- {"tigetstr", (PyCFunction)PyCurses_tigetstr, METH_VARARGS},
- {"tparm", (PyCFunction)PyCurses_tparm, METH_VARARGS},
-#ifdef HAVE_CURSES_TYPEAHEAD
- {"typeahead", (PyCFunction)PyCurses_TypeAhead, METH_VARARGS},
-#endif
- {"unctrl", (PyCFunction)PyCurses_UnCtrl, METH_VARARGS},
- {"ungetch", (PyCFunction)PyCurses_UngetCh, METH_VARARGS},
-#if defined(HAVE_CURSES_RESIZETERM) || defined(HAVE_CURSES_RESIZE_TERM)
- {"update_lines_cols", (PyCFunction)PyCurses_update_lines_cols, METH_NOARGS},
-#endif
-#ifdef HAVE_NCURSESW
- {"unget_wch", (PyCFunction)PyCurses_Unget_Wch, METH_VARARGS},
-#endif
-#ifdef HAVE_CURSES_USE_ENV
- {"use_env", (PyCFunction)PyCurses_Use_Env, METH_VARARGS},
-#endif
-#ifndef STRICT_SYSV_CURSES
- {"use_default_colors", (PyCFunction)PyCurses_Use_Default_Colors, METH_NOARGS},
-#endif
+ _CURSES_BAUDRATE_METHODDEF
+ _CURSES_BEEP_METHODDEF
+ _CURSES_CAN_CHANGE_COLOR_METHODDEF
+ _CURSES_CBREAK_METHODDEF
+ _CURSES_COLOR_CONTENT_METHODDEF
+ _CURSES_COLOR_PAIR_METHODDEF
+ _CURSES_CURS_SET_METHODDEF
+ _CURSES_DEF_PROG_MODE_METHODDEF
+ _CURSES_DEF_SHELL_MODE_METHODDEF
+ _CURSES_DELAY_OUTPUT_METHODDEF
+ _CURSES_DOUPDATE_METHODDEF
+ _CURSES_ECHO_METHODDEF
+ _CURSES_ENDWIN_METHODDEF
+ _CURSES_ERASECHAR_METHODDEF
+ _CURSES_FILTER_METHODDEF
+ _CURSES_FLASH_METHODDEF
+ _CURSES_FLUSHINP_METHODDEF
+ _CURSES_GETMOUSE_METHODDEF
+ _CURSES_UNGETMOUSE_METHODDEF
+ _CURSES_GETSYX_METHODDEF
+ _CURSES_GETWIN_METHODDEF
+ _CURSES_HAS_COLORS_METHODDEF
+ _CURSES_HAS_IC_METHODDEF
+ _CURSES_HAS_IL_METHODDEF
+ _CURSES_HAS_KEY_METHODDEF
+ _CURSES_HALFDELAY_METHODDEF
+ _CURSES_INIT_COLOR_METHODDEF
+ _CURSES_INIT_PAIR_METHODDEF
+ _CURSES_INITSCR_METHODDEF
+ _CURSES_INTRFLUSH_METHODDEF
+ _CURSES_ISENDWIN_METHODDEF
+ _CURSES_IS_TERM_RESIZED_METHODDEF
+ _CURSES_KEYNAME_METHODDEF
+ _CURSES_KILLCHAR_METHODDEF
+ _CURSES_LONGNAME_METHODDEF
+ _CURSES_META_METHODDEF
+ _CURSES_MOUSEINTERVAL_METHODDEF
+ _CURSES_MOUSEMASK_METHODDEF
+ _CURSES_NAPMS_METHODDEF
+ _CURSES_NEWPAD_METHODDEF
+ _CURSES_NEWWIN_METHODDEF
+ _CURSES_NL_METHODDEF
+ _CURSES_NOCBREAK_METHODDEF
+ _CURSES_NOECHO_METHODDEF
+ _CURSES_NONL_METHODDEF
+ _CURSES_NOQIFLUSH_METHODDEF
+ _CURSES_NORAW_METHODDEF
+ _CURSES_PAIR_CONTENT_METHODDEF
+ _CURSES_PAIR_NUMBER_METHODDEF
+ _CURSES_PUTP_METHODDEF
+ _CURSES_QIFLUSH_METHODDEF
+ _CURSES_RAW_METHODDEF
+ _CURSES_RESET_PROG_MODE_METHODDEF
+ _CURSES_RESET_SHELL_MODE_METHODDEF
+ _CURSES_RESETTY_METHODDEF
+ _CURSES_RESIZETERM_METHODDEF
+ _CURSES_RESIZE_TERM_METHODDEF
+ _CURSES_SAVETTY_METHODDEF
+ _CURSES_SETSYX_METHODDEF
+ _CURSES_SETUPTERM_METHODDEF
+ _CURSES_START_COLOR_METHODDEF
+ _CURSES_TERMATTRS_METHODDEF
+ _CURSES_TERMNAME_METHODDEF
+ _CURSES_TIGETFLAG_METHODDEF
+ _CURSES_TIGETNUM_METHODDEF
+ _CURSES_TIGETSTR_METHODDEF
+ _CURSES_TPARM_METHODDEF
+ _CURSES_TYPEAHEAD_METHODDEF
+ _CURSES_UNCTRL_METHODDEF
+ _CURSES_UNGETCH_METHODDEF
+ _CURSES_UPDATE_LINES_COLS_METHODDEF
+ _CURSES_UNGET_WCH_METHODDEF
+ _CURSES_USE_ENV_METHODDEF
+ _CURSES_USE_DEFAULT_COLORS_METHODDEF
{NULL, NULL} /* sentinel */
};
@@ -3496,5 +4547,8 @@ PyInit__curses(void)
SetDictInt("KEY_MIN", KEY_MIN);
SetDictInt("KEY_MAX", KEY_MAX);
}
+
+ Py_INCREF(&PyCursesWindow_Type);
+ PyModule_AddObject(m, "window", (PyObject *)&PyCursesWindow_Type);
return m;
}
diff --git a/Modules/clinic/_curses_panel.c.h b/Modules/clinic/_curses_panel.c.h
new file mode 100644
index 0000000..e11c68d
--- /dev/null
+++ b/Modules/clinic/_curses_panel.c.h
@@ -0,0 +1,317 @@
+/*[clinic input]
+preserve
+[clinic start generated code]*/
+
+PyDoc_STRVAR(_curses_panel_panel_bottom__doc__,
+"bottom($self, /)\n"
+"--\n"
+"\n"
+"Push the panel to the bottom of the stack.");
+
+#define _CURSES_PANEL_PANEL_BOTTOM_METHODDEF \
+ {"bottom", (PyCFunction)_curses_panel_panel_bottom, METH_NOARGS, _curses_panel_panel_bottom__doc__},
+
+static PyObject *
+_curses_panel_panel_bottom_impl(PyCursesPanelObject *self);
+
+static PyObject *
+_curses_panel_panel_bottom(PyCursesPanelObject *self, PyObject *Py_UNUSED(ignored))
+{
+ return _curses_panel_panel_bottom_impl(self);
+}
+
+PyDoc_STRVAR(_curses_panel_panel_hide__doc__,
+"hide($self, /)\n"
+"--\n"
+"\n"
+"Hide the panel.\n"
+"\n"
+"This does not delete the object, it just makes the window on screen invisible.");
+
+#define _CURSES_PANEL_PANEL_HIDE_METHODDEF \
+ {"hide", (PyCFunction)_curses_panel_panel_hide, METH_NOARGS, _curses_panel_panel_hide__doc__},
+
+static PyObject *
+_curses_panel_panel_hide_impl(PyCursesPanelObject *self);
+
+static PyObject *
+_curses_panel_panel_hide(PyCursesPanelObject *self, PyObject *Py_UNUSED(ignored))
+{
+ return _curses_panel_panel_hide_impl(self);
+}
+
+PyDoc_STRVAR(_curses_panel_panel_show__doc__,
+"show($self, /)\n"
+"--\n"
+"\n"
+"Display the panel (which might have been hidden).");
+
+#define _CURSES_PANEL_PANEL_SHOW_METHODDEF \
+ {"show", (PyCFunction)_curses_panel_panel_show, METH_NOARGS, _curses_panel_panel_show__doc__},
+
+static PyObject *
+_curses_panel_panel_show_impl(PyCursesPanelObject *self);
+
+static PyObject *
+_curses_panel_panel_show(PyCursesPanelObject *self, PyObject *Py_UNUSED(ignored))
+{
+ return _curses_panel_panel_show_impl(self);
+}
+
+PyDoc_STRVAR(_curses_panel_panel_top__doc__,
+"top($self, /)\n"
+"--\n"
+"\n"
+"Push panel to the top of the stack.");
+
+#define _CURSES_PANEL_PANEL_TOP_METHODDEF \
+ {"top", (PyCFunction)_curses_panel_panel_top, METH_NOARGS, _curses_panel_panel_top__doc__},
+
+static PyObject *
+_curses_panel_panel_top_impl(PyCursesPanelObject *self);
+
+static PyObject *
+_curses_panel_panel_top(PyCursesPanelObject *self, PyObject *Py_UNUSED(ignored))
+{
+ return _curses_panel_panel_top_impl(self);
+}
+
+PyDoc_STRVAR(_curses_panel_panel_above__doc__,
+"above($self, /)\n"
+"--\n"
+"\n"
+"Return the panel above the current panel.");
+
+#define _CURSES_PANEL_PANEL_ABOVE_METHODDEF \
+ {"above", (PyCFunction)_curses_panel_panel_above, METH_NOARGS, _curses_panel_panel_above__doc__},
+
+static PyObject *
+_curses_panel_panel_above_impl(PyCursesPanelObject *self);
+
+static PyObject *
+_curses_panel_panel_above(PyCursesPanelObject *self, PyObject *Py_UNUSED(ignored))
+{
+ return _curses_panel_panel_above_impl(self);
+}
+
+PyDoc_STRVAR(_curses_panel_panel_below__doc__,
+"below($self, /)\n"
+"--\n"
+"\n"
+"Return the panel below the current panel.");
+
+#define _CURSES_PANEL_PANEL_BELOW_METHODDEF \
+ {"below", (PyCFunction)_curses_panel_panel_below, METH_NOARGS, _curses_panel_panel_below__doc__},
+
+static PyObject *
+_curses_panel_panel_below_impl(PyCursesPanelObject *self);
+
+static PyObject *
+_curses_panel_panel_below(PyCursesPanelObject *self, PyObject *Py_UNUSED(ignored))
+{
+ return _curses_panel_panel_below_impl(self);
+}
+
+PyDoc_STRVAR(_curses_panel_panel_hidden__doc__,
+"hidden($self, /)\n"
+"--\n"
+"\n"
+"Return True if the panel is hidden (not visible), False otherwise.");
+
+#define _CURSES_PANEL_PANEL_HIDDEN_METHODDEF \
+ {"hidden", (PyCFunction)_curses_panel_panel_hidden, METH_NOARGS, _curses_panel_panel_hidden__doc__},
+
+static PyObject *
+_curses_panel_panel_hidden_impl(PyCursesPanelObject *self);
+
+static PyObject *
+_curses_panel_panel_hidden(PyCursesPanelObject *self, PyObject *Py_UNUSED(ignored))
+{
+ return _curses_panel_panel_hidden_impl(self);
+}
+
+PyDoc_STRVAR(_curses_panel_panel_move__doc__,
+"move($self, y, x, /)\n"
+"--\n"
+"\n"
+"Move the panel to the screen coordinates (y, x).");
+
+#define _CURSES_PANEL_PANEL_MOVE_METHODDEF \
+ {"move", (PyCFunction)_curses_panel_panel_move, METH_FASTCALL, _curses_panel_panel_move__doc__},
+
+static PyObject *
+_curses_panel_panel_move_impl(PyCursesPanelObject *self, int y, int x);
+
+static PyObject *
+_curses_panel_panel_move(PyCursesPanelObject *self, PyObject *const *args, Py_ssize_t nargs)
+{
+ PyObject *return_value = NULL;
+ int y;
+ int x;
+
+ if (!_PyArg_ParseStack(args, nargs, "ii:move",
+ &y, &x)) {
+ goto exit;
+ }
+ return_value = _curses_panel_panel_move_impl(self, y, x);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_curses_panel_panel_window__doc__,
+"window($self, /)\n"
+"--\n"
+"\n"
+"Return the window object associated with the panel.");
+
+#define _CURSES_PANEL_PANEL_WINDOW_METHODDEF \
+ {"window", (PyCFunction)_curses_panel_panel_window, METH_NOARGS, _curses_panel_panel_window__doc__},
+
+static PyObject *
+_curses_panel_panel_window_impl(PyCursesPanelObject *self);
+
+static PyObject *
+_curses_panel_panel_window(PyCursesPanelObject *self, PyObject *Py_UNUSED(ignored))
+{
+ return _curses_panel_panel_window_impl(self);
+}
+
+PyDoc_STRVAR(_curses_panel_panel_replace__doc__,
+"replace($self, win, /)\n"
+"--\n"
+"\n"
+"Change the window associated with the panel to the window win.");
+
+#define _CURSES_PANEL_PANEL_REPLACE_METHODDEF \
+ {"replace", (PyCFunction)_curses_panel_panel_replace, METH_O, _curses_panel_panel_replace__doc__},
+
+static PyObject *
+_curses_panel_panel_replace_impl(PyCursesPanelObject *self,
+ PyCursesWindowObject *win);
+
+static PyObject *
+_curses_panel_panel_replace(PyCursesPanelObject *self, PyObject *arg)
+{
+ PyObject *return_value = NULL;
+ PyCursesWindowObject *win;
+
+ if (!PyArg_Parse(arg, "O!:replace", &PyCursesWindow_Type, &win)) {
+ goto exit;
+ }
+ return_value = _curses_panel_panel_replace_impl(self, win);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_curses_panel_panel_set_userptr__doc__,
+"set_userptr($self, obj, /)\n"
+"--\n"
+"\n"
+"Set the panel’s user pointer to obj.");
+
+#define _CURSES_PANEL_PANEL_SET_USERPTR_METHODDEF \
+ {"set_userptr", (PyCFunction)_curses_panel_panel_set_userptr, METH_O, _curses_panel_panel_set_userptr__doc__},
+
+PyDoc_STRVAR(_curses_panel_panel_userptr__doc__,
+"userptr($self, /)\n"
+"--\n"
+"\n"
+"Return the user pointer for the panel.");
+
+#define _CURSES_PANEL_PANEL_USERPTR_METHODDEF \
+ {"userptr", (PyCFunction)_curses_panel_panel_userptr, METH_NOARGS, _curses_panel_panel_userptr__doc__},
+
+static PyObject *
+_curses_panel_panel_userptr_impl(PyCursesPanelObject *self);
+
+static PyObject *
+_curses_panel_panel_userptr(PyCursesPanelObject *self, PyObject *Py_UNUSED(ignored))
+{
+ return _curses_panel_panel_userptr_impl(self);
+}
+
+PyDoc_STRVAR(_curses_panel_bottom_panel__doc__,
+"bottom_panel($module, /)\n"
+"--\n"
+"\n"
+"Return the bottom panel in the panel stack.");
+
+#define _CURSES_PANEL_BOTTOM_PANEL_METHODDEF \
+ {"bottom_panel", (PyCFunction)_curses_panel_bottom_panel, METH_NOARGS, _curses_panel_bottom_panel__doc__},
+
+static PyObject *
+_curses_panel_bottom_panel_impl(PyObject *module);
+
+static PyObject *
+_curses_panel_bottom_panel(PyObject *module, PyObject *Py_UNUSED(ignored))
+{
+ return _curses_panel_bottom_panel_impl(module);
+}
+
+PyDoc_STRVAR(_curses_panel_new_panel__doc__,
+"new_panel($module, win, /)\n"
+"--\n"
+"\n"
+"Return a panel object, associating it with the given window win.");
+
+#define _CURSES_PANEL_NEW_PANEL_METHODDEF \
+ {"new_panel", (PyCFunction)_curses_panel_new_panel, METH_O, _curses_panel_new_panel__doc__},
+
+static PyObject *
+_curses_panel_new_panel_impl(PyObject *module, PyCursesWindowObject *win);
+
+static PyObject *
+_curses_panel_new_panel(PyObject *module, PyObject *arg)
+{
+ PyObject *return_value = NULL;
+ PyCursesWindowObject *win;
+
+ if (!PyArg_Parse(arg, "O!:new_panel", &PyCursesWindow_Type, &win)) {
+ goto exit;
+ }
+ return_value = _curses_panel_new_panel_impl(module, win);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_curses_panel_top_panel__doc__,
+"top_panel($module, /)\n"
+"--\n"
+"\n"
+"Return the top panel in the panel stack.");
+
+#define _CURSES_PANEL_TOP_PANEL_METHODDEF \
+ {"top_panel", (PyCFunction)_curses_panel_top_panel, METH_NOARGS, _curses_panel_top_panel__doc__},
+
+static PyObject *
+_curses_panel_top_panel_impl(PyObject *module);
+
+static PyObject *
+_curses_panel_top_panel(PyObject *module, PyObject *Py_UNUSED(ignored))
+{
+ return _curses_panel_top_panel_impl(module);
+}
+
+PyDoc_STRVAR(_curses_panel_update_panels__doc__,
+"update_panels($module, /)\n"
+"--\n"
+"\n"
+"Updates the virtual screen after changes in the panel stack.\n"
+"\n"
+"This does not call curses.doupdate(), so you’ll have to do this yourself.");
+
+#define _CURSES_PANEL_UPDATE_PANELS_METHODDEF \
+ {"update_panels", (PyCFunction)_curses_panel_update_panels, METH_NOARGS, _curses_panel_update_panels__doc__},
+
+static PyObject *
+_curses_panel_update_panels_impl(PyObject *module);
+
+static PyObject *
+_curses_panel_update_panels(PyObject *module, PyObject *Py_UNUSED(ignored))
+{
+ return _curses_panel_update_panels_impl(module);
+}
+/*[clinic end generated code: output=96f627ca0b08b96d input=a9049054013a1b77]*/
diff --git a/Modules/clinic/_cursesmodule.c.h b/Modules/clinic/_cursesmodule.c.h
index 62ff1c8..b32797f 100644
--- a/Modules/clinic/_cursesmodule.c.h
+++ b/Modules/clinic/_cursesmodule.c.h
@@ -2,9 +2,9 @@
preserve
[clinic start generated code]*/
-PyDoc_STRVAR(curses_window_addch__doc__,
-"addch([y, x,] ch, [attr])\n"
-"Paint character ch at (y, x) with attributes attr.\n"
+PyDoc_STRVAR(_curses_window_addch__doc__,
+"addch([y, x,] ch, [attr=_curses.A_NORMAL])\n"
+"Paint the character.\n"
"\n"
" y\n"
" Y-coordinate.\n"
@@ -20,15 +20,16 @@ PyDoc_STRVAR(curses_window_addch__doc__,
"By default, the character position and attributes are the\n"
"current settings for the window object.");
-#define CURSES_WINDOW_ADDCH_METHODDEF \
- {"addch", (PyCFunction)curses_window_addch, METH_VARARGS, curses_window_addch__doc__},
+#define _CURSES_WINDOW_ADDCH_METHODDEF \
+ {"addch", (PyCFunction)_curses_window_addch, METH_VARARGS, _curses_window_addch__doc__},
static PyObject *
-curses_window_addch_impl(PyCursesWindowObject *self, int group_left_1, int y,
- int x, PyObject *ch, int group_right_1, long attr);
+_curses_window_addch_impl(PyCursesWindowObject *self, int group_left_1,
+ int y, int x, PyObject *ch, int group_right_1,
+ long attr);
static PyObject *
-curses_window_addch(PyCursesWindowObject *self, PyObject *args)
+_curses_window_addch(PyCursesWindowObject *self, PyObject *args)
{
PyObject *return_value = NULL;
int group_left_1 = 0;
@@ -36,7 +37,7 @@ curses_window_addch(PyCursesWindowObject *self, PyObject *args)
int x = 0;
PyObject *ch;
int group_right_1 = 0;
- long attr = 0;
+ long attr = A_NORMAL;
switch (PyTuple_GET_SIZE(args)) {
case 1:
@@ -64,12 +65,3777 @@ curses_window_addch(PyCursesWindowObject *self, PyObject *args)
group_left_1 = 1;
break;
default:
- PyErr_SetString(PyExc_TypeError, "curses.window.addch requires 1 to 4 arguments");
+ PyErr_SetString(PyExc_TypeError, "_curses.window.addch requires 1 to 4 arguments");
+ goto exit;
+ }
+ return_value = _curses_window_addch_impl(self, group_left_1, y, x, ch, group_right_1, attr);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_curses_window_addstr__doc__,
+"addstr([y, x,] str, [attr])\n"
+"Paint the string.\n"
+"\n"
+" y\n"
+" Y-coordinate.\n"
+" x\n"
+" X-coordinate.\n"
+" str\n"
+" String to add.\n"
+" attr\n"
+" Attributes for characters.\n"
+"\n"
+"Paint the string str at (y, x) with attributes attr,\n"
+"overwriting anything previously on the display.\n"
+"By default, the character position and attributes are the\n"
+"current settings for the window object.");
+
+#define _CURSES_WINDOW_ADDSTR_METHODDEF \
+ {"addstr", (PyCFunction)_curses_window_addstr, METH_VARARGS, _curses_window_addstr__doc__},
+
+static PyObject *
+_curses_window_addstr_impl(PyCursesWindowObject *self, int group_left_1,
+ int y, int x, PyObject *str, int group_right_1,
+ long attr);
+
+static PyObject *
+_curses_window_addstr(PyCursesWindowObject *self, PyObject *args)
+{
+ PyObject *return_value = NULL;
+ int group_left_1 = 0;
+ int y = 0;
+ int x = 0;
+ PyObject *str;
+ int group_right_1 = 0;
+ long attr = 0;
+
+ switch (PyTuple_GET_SIZE(args)) {
+ case 1:
+ if (!PyArg_ParseTuple(args, "O:addstr", &str)) {
+ goto exit;
+ }
+ break;
+ case 2:
+ if (!PyArg_ParseTuple(args, "Ol:addstr", &str, &attr)) {
+ goto exit;
+ }
+ group_right_1 = 1;
+ break;
+ case 3:
+ if (!PyArg_ParseTuple(args, "iiO:addstr", &y, &x, &str)) {
+ goto exit;
+ }
+ group_left_1 = 1;
+ break;
+ case 4:
+ if (!PyArg_ParseTuple(args, "iiOl:addstr", &y, &x, &str, &attr)) {
+ goto exit;
+ }
+ group_right_1 = 1;
+ group_left_1 = 1;
+ break;
+ default:
+ PyErr_SetString(PyExc_TypeError, "_curses.window.addstr requires 1 to 4 arguments");
+ goto exit;
+ }
+ return_value = _curses_window_addstr_impl(self, group_left_1, y, x, str, group_right_1, attr);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_curses_window_addnstr__doc__,
+"addnstr([y, x,] str, n, [attr])\n"
+"Paint at most n characters of the string.\n"
+"\n"
+" y\n"
+" Y-coordinate.\n"
+" x\n"
+" X-coordinate.\n"
+" str\n"
+" String to add.\n"
+" n\n"
+" Maximal number of characters.\n"
+" attr\n"
+" Attributes for characters.\n"
+"\n"
+"Paint at most n characters of the string str at (y, x) with\n"
+"attributes attr, overwriting anything previously on the display.\n"
+"By default, the character position and attributes are the\n"
+"current settings for the window object.");
+
+#define _CURSES_WINDOW_ADDNSTR_METHODDEF \
+ {"addnstr", (PyCFunction)_curses_window_addnstr, METH_VARARGS, _curses_window_addnstr__doc__},
+
+static PyObject *
+_curses_window_addnstr_impl(PyCursesWindowObject *self, int group_left_1,
+ int y, int x, PyObject *str, int n,
+ int group_right_1, long attr);
+
+static PyObject *
+_curses_window_addnstr(PyCursesWindowObject *self, PyObject *args)
+{
+ PyObject *return_value = NULL;
+ int group_left_1 = 0;
+ int y = 0;
+ int x = 0;
+ PyObject *str;
+ int n;
+ int group_right_1 = 0;
+ long attr = 0;
+
+ switch (PyTuple_GET_SIZE(args)) {
+ case 2:
+ if (!PyArg_ParseTuple(args, "Oi:addnstr", &str, &n)) {
+ goto exit;
+ }
+ break;
+ case 3:
+ if (!PyArg_ParseTuple(args, "Oil:addnstr", &str, &n, &attr)) {
+ goto exit;
+ }
+ group_right_1 = 1;
+ break;
+ case 4:
+ if (!PyArg_ParseTuple(args, "iiOi:addnstr", &y, &x, &str, &n)) {
+ goto exit;
+ }
+ group_left_1 = 1;
+ break;
+ case 5:
+ if (!PyArg_ParseTuple(args, "iiOil:addnstr", &y, &x, &str, &n, &attr)) {
+ goto exit;
+ }
+ group_right_1 = 1;
+ group_left_1 = 1;
+ break;
+ default:
+ PyErr_SetString(PyExc_TypeError, "_curses.window.addnstr requires 2 to 5 arguments");
+ goto exit;
+ }
+ return_value = _curses_window_addnstr_impl(self, group_left_1, y, x, str, n, group_right_1, attr);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_curses_window_bkgd__doc__,
+"bkgd($self, ch, attr=_curses.A_NORMAL, /)\n"
+"--\n"
+"\n"
+"Set the background property of the window.\n"
+"\n"
+" ch\n"
+" Background character.\n"
+" attr\n"
+" Background attributes.");
+
+#define _CURSES_WINDOW_BKGD_METHODDEF \
+ {"bkgd", (PyCFunction)_curses_window_bkgd, METH_FASTCALL, _curses_window_bkgd__doc__},
+
+static PyObject *
+_curses_window_bkgd_impl(PyCursesWindowObject *self, PyObject *ch, long attr);
+
+static PyObject *
+_curses_window_bkgd(PyCursesWindowObject *self, PyObject *const *args, Py_ssize_t nargs)
+{
+ PyObject *return_value = NULL;
+ PyObject *ch;
+ long attr = A_NORMAL;
+
+ if (!_PyArg_ParseStack(args, nargs, "O|l:bkgd",
+ &ch, &attr)) {
+ goto exit;
+ }
+ return_value = _curses_window_bkgd_impl(self, ch, attr);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_curses_window_attroff__doc__,
+"attroff($self, attr, /)\n"
+"--\n"
+"\n"
+"Remove attribute attr from the \"background\" set.");
+
+#define _CURSES_WINDOW_ATTROFF_METHODDEF \
+ {"attroff", (PyCFunction)_curses_window_attroff, METH_O, _curses_window_attroff__doc__},
+
+static PyObject *
+_curses_window_attroff_impl(PyCursesWindowObject *self, long attr);
+
+static PyObject *
+_curses_window_attroff(PyCursesWindowObject *self, PyObject *arg)
+{
+ PyObject *return_value = NULL;
+ long attr;
+
+ if (!PyArg_Parse(arg, "l:attroff", &attr)) {
+ goto exit;
+ }
+ return_value = _curses_window_attroff_impl(self, attr);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_curses_window_attron__doc__,
+"attron($self, attr, /)\n"
+"--\n"
+"\n"
+"Add attribute attr from the \"background\" set.");
+
+#define _CURSES_WINDOW_ATTRON_METHODDEF \
+ {"attron", (PyCFunction)_curses_window_attron, METH_O, _curses_window_attron__doc__},
+
+static PyObject *
+_curses_window_attron_impl(PyCursesWindowObject *self, long attr);
+
+static PyObject *
+_curses_window_attron(PyCursesWindowObject *self, PyObject *arg)
+{
+ PyObject *return_value = NULL;
+ long attr;
+
+ if (!PyArg_Parse(arg, "l:attron", &attr)) {
+ goto exit;
+ }
+ return_value = _curses_window_attron_impl(self, attr);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_curses_window_attrset__doc__,
+"attrset($self, attr, /)\n"
+"--\n"
+"\n"
+"Set the \"background\" set of attributes.");
+
+#define _CURSES_WINDOW_ATTRSET_METHODDEF \
+ {"attrset", (PyCFunction)_curses_window_attrset, METH_O, _curses_window_attrset__doc__},
+
+static PyObject *
+_curses_window_attrset_impl(PyCursesWindowObject *self, long attr);
+
+static PyObject *
+_curses_window_attrset(PyCursesWindowObject *self, PyObject *arg)
+{
+ PyObject *return_value = NULL;
+ long attr;
+
+ if (!PyArg_Parse(arg, "l:attrset", &attr)) {
+ goto exit;
+ }
+ return_value = _curses_window_attrset_impl(self, attr);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_curses_window_bkgdset__doc__,
+"bkgdset($self, ch, attr=_curses.A_NORMAL, /)\n"
+"--\n"
+"\n"
+"Set the window\'s background.\n"
+"\n"
+" ch\n"
+" Background character.\n"
+" attr\n"
+" Background attributes.");
+
+#define _CURSES_WINDOW_BKGDSET_METHODDEF \
+ {"bkgdset", (PyCFunction)_curses_window_bkgdset, METH_FASTCALL, _curses_window_bkgdset__doc__},
+
+static PyObject *
+_curses_window_bkgdset_impl(PyCursesWindowObject *self, PyObject *ch,
+ long attr);
+
+static PyObject *
+_curses_window_bkgdset(PyCursesWindowObject *self, PyObject *const *args, Py_ssize_t nargs)
+{
+ PyObject *return_value = NULL;
+ PyObject *ch;
+ long attr = A_NORMAL;
+
+ if (!_PyArg_ParseStack(args, nargs, "O|l:bkgdset",
+ &ch, &attr)) {
+ goto exit;
+ }
+ return_value = _curses_window_bkgdset_impl(self, ch, attr);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_curses_window_border__doc__,
+"border($self, ls=_curses.ACS_VLINE, rs=_curses.ACS_VLINE,\n"
+" ts=_curses.ACS_HLINE, bs=_curses.ACS_HLINE,\n"
+" tl=_curses.ACS_ULCORNER, tr=_curses.ACS_URCORNER,\n"
+" bl=_curses.ACS_LLCORNER, br=_curses.ACS_LRCORNER, /)\n"
+"--\n"
+"\n"
+"Draw a border around the edges of the window.\n"
+"\n"
+" ls\n"
+" Left side.\n"
+" rs\n"
+" Right side.\n"
+" ts\n"
+" Top side.\n"
+" bs\n"
+" Bottom side.\n"
+" tl\n"
+" Upper-left corner.\n"
+" tr\n"
+" Upper-right corner.\n"
+" bl\n"
+" Bottom-left corner.\n"
+" br\n"
+" Bottom-right corner.\n"
+"\n"
+"Each parameter specifies the character to use for a specific part of the\n"
+"border. The characters can be specified as integers or as one-character\n"
+"strings. A 0 value for any parameter will cause the default character to be\n"
+"used for that parameter.");
+
+#define _CURSES_WINDOW_BORDER_METHODDEF \
+ {"border", (PyCFunction)_curses_window_border, METH_FASTCALL, _curses_window_border__doc__},
+
+static PyObject *
+_curses_window_border_impl(PyCursesWindowObject *self, PyObject *ls,
+ PyObject *rs, PyObject *ts, PyObject *bs,
+ PyObject *tl, PyObject *tr, PyObject *bl,
+ PyObject *br);
+
+static PyObject *
+_curses_window_border(PyCursesWindowObject *self, PyObject *const *args, Py_ssize_t nargs)
+{
+ PyObject *return_value = NULL;
+ PyObject *ls = NULL;
+ PyObject *rs = NULL;
+ PyObject *ts = NULL;
+ PyObject *bs = NULL;
+ PyObject *tl = NULL;
+ PyObject *tr = NULL;
+ PyObject *bl = NULL;
+ PyObject *br = NULL;
+
+ if (!_PyArg_UnpackStack(args, nargs, "border",
+ 0, 8,
+ &ls, &rs, &ts, &bs, &tl, &tr, &bl, &br)) {
+ goto exit;
+ }
+ return_value = _curses_window_border_impl(self, ls, rs, ts, bs, tl, tr, bl, br);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_curses_window_box__doc__,
+"box([verch=0, horch=0])\n"
+"Draw a border around the edges of the window.\n"
+"\n"
+" verch\n"
+" Left and right side.\n"
+" horch\n"
+" Top and bottom side.\n"
+"\n"
+"Similar to border(), but both ls and rs are verch and both ts and bs are\n"
+"horch. The default corner characters are always used by this function.");
+
+#define _CURSES_WINDOW_BOX_METHODDEF \
+ {"box", (PyCFunction)_curses_window_box, METH_VARARGS, _curses_window_box__doc__},
+
+static PyObject *
+_curses_window_box_impl(PyCursesWindowObject *self, int group_right_1,
+ PyObject *verch, PyObject *horch);
+
+static PyObject *
+_curses_window_box(PyCursesWindowObject *self, PyObject *args)
+{
+ PyObject *return_value = NULL;
+ int group_right_1 = 0;
+ PyObject *verch = _PyLong_Zero;
+ PyObject *horch = _PyLong_Zero;
+
+ switch (PyTuple_GET_SIZE(args)) {
+ case 0:
+ break;
+ case 2:
+ if (!PyArg_ParseTuple(args, "OO:box", &verch, &horch)) {
+ goto exit;
+ }
+ group_right_1 = 1;
+ break;
+ default:
+ PyErr_SetString(PyExc_TypeError, "_curses.window.box requires 0 to 2 arguments");
+ goto exit;
+ }
+ return_value = _curses_window_box_impl(self, group_right_1, verch, horch);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_curses_window_delch__doc__,
+"delch([y, x])\n"
+"Delete any character at (y, x).\n"
+"\n"
+" y\n"
+" Y-coordinate.\n"
+" x\n"
+" X-coordinate.");
+
+#define _CURSES_WINDOW_DELCH_METHODDEF \
+ {"delch", (PyCFunction)_curses_window_delch, METH_VARARGS, _curses_window_delch__doc__},
+
+static PyObject *
+_curses_window_delch_impl(PyCursesWindowObject *self, int group_right_1,
+ int y, int x);
+
+static PyObject *
+_curses_window_delch(PyCursesWindowObject *self, PyObject *args)
+{
+ PyObject *return_value = NULL;
+ int group_right_1 = 0;
+ int y = 0;
+ int x = 0;
+
+ switch (PyTuple_GET_SIZE(args)) {
+ case 0:
+ break;
+ case 2:
+ if (!PyArg_ParseTuple(args, "ii:delch", &y, &x)) {
+ goto exit;
+ }
+ group_right_1 = 1;
+ break;
+ default:
+ PyErr_SetString(PyExc_TypeError, "_curses.window.delch requires 0 to 2 arguments");
+ goto exit;
+ }
+ return_value = _curses_window_delch_impl(self, group_right_1, y, x);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_curses_window_derwin__doc__,
+"derwin([nlines=0, ncols=0,] begin_y, begin_x)\n"
+"Create a sub-window (window-relative coordinates).\n"
+"\n"
+" nlines\n"
+" Height.\n"
+" ncols\n"
+" Width.\n"
+" begin_y\n"
+" Top side y-coordinate.\n"
+" begin_x\n"
+" Left side x-coordinate.\n"
+"\n"
+"derwin() is the same as calling subwin(), except that begin_y and begin_x\n"
+"are relative to the origin of the window, rather than relative to the entire\n"
+"screen.");
+
+#define _CURSES_WINDOW_DERWIN_METHODDEF \
+ {"derwin", (PyCFunction)_curses_window_derwin, METH_VARARGS, _curses_window_derwin__doc__},
+
+static PyObject *
+_curses_window_derwin_impl(PyCursesWindowObject *self, int group_left_1,
+ int nlines, int ncols, int begin_y, int begin_x);
+
+static PyObject *
+_curses_window_derwin(PyCursesWindowObject *self, PyObject *args)
+{
+ PyObject *return_value = NULL;
+ int group_left_1 = 0;
+ int nlines = 0;
+ int ncols = 0;
+ int begin_y;
+ int begin_x;
+
+ switch (PyTuple_GET_SIZE(args)) {
+ case 2:
+ if (!PyArg_ParseTuple(args, "ii:derwin", &begin_y, &begin_x)) {
+ goto exit;
+ }
+ break;
+ case 4:
+ if (!PyArg_ParseTuple(args, "iiii:derwin", &nlines, &ncols, &begin_y, &begin_x)) {
+ goto exit;
+ }
+ group_left_1 = 1;
+ break;
+ default:
+ PyErr_SetString(PyExc_TypeError, "_curses.window.derwin requires 2 to 4 arguments");
+ goto exit;
+ }
+ return_value = _curses_window_derwin_impl(self, group_left_1, nlines, ncols, begin_y, begin_x);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_curses_window_echochar__doc__,
+"echochar($self, ch, attr=_curses.A_NORMAL, /)\n"
+"--\n"
+"\n"
+"Add character ch with attribute attr, and refresh.\n"
+"\n"
+" ch\n"
+" Character to add.\n"
+" attr\n"
+" Attributes for the character.");
+
+#define _CURSES_WINDOW_ECHOCHAR_METHODDEF \
+ {"echochar", (PyCFunction)_curses_window_echochar, METH_FASTCALL, _curses_window_echochar__doc__},
+
+static PyObject *
+_curses_window_echochar_impl(PyCursesWindowObject *self, PyObject *ch,
+ long attr);
+
+static PyObject *
+_curses_window_echochar(PyCursesWindowObject *self, PyObject *const *args, Py_ssize_t nargs)
+{
+ PyObject *return_value = NULL;
+ PyObject *ch;
+ long attr = A_NORMAL;
+
+ if (!_PyArg_ParseStack(args, nargs, "O|l:echochar",
+ &ch, &attr)) {
+ goto exit;
+ }
+ return_value = _curses_window_echochar_impl(self, ch, attr);
+
+exit:
+ return return_value;
+}
+
+#if defined(NCURSES_MOUSE_VERSION)
+
+PyDoc_STRVAR(_curses_window_enclose__doc__,
+"enclose($self, y, x, /)\n"
+"--\n"
+"\n"
+"Return True if the screen-relative coordinates are enclosed by the window.\n"
+"\n"
+" y\n"
+" Y-coordinate.\n"
+" x\n"
+" X-coordinate.");
+
+#define _CURSES_WINDOW_ENCLOSE_METHODDEF \
+ {"enclose", (PyCFunction)_curses_window_enclose, METH_FASTCALL, _curses_window_enclose__doc__},
+
+static long
+_curses_window_enclose_impl(PyCursesWindowObject *self, int y, int x);
+
+static PyObject *
+_curses_window_enclose(PyCursesWindowObject *self, PyObject *const *args, Py_ssize_t nargs)
+{
+ PyObject *return_value = NULL;
+ int y;
+ int x;
+ long _return_value;
+
+ if (!_PyArg_ParseStack(args, nargs, "ii:enclose",
+ &y, &x)) {
+ goto exit;
+ }
+ _return_value = _curses_window_enclose_impl(self, y, x);
+ if ((_return_value == -1) && PyErr_Occurred()) {
+ goto exit;
+ }
+ return_value = PyLong_FromLong(_return_value);
+
+exit:
+ return return_value;
+}
+
+#endif /* defined(NCURSES_MOUSE_VERSION) */
+
+PyDoc_STRVAR(_curses_window_getbkgd__doc__,
+"getbkgd($self, /)\n"
+"--\n"
+"\n"
+"Return the window\'s current background character/attribute pair.");
+
+#define _CURSES_WINDOW_GETBKGD_METHODDEF \
+ {"getbkgd", (PyCFunction)_curses_window_getbkgd, METH_NOARGS, _curses_window_getbkgd__doc__},
+
+static long
+_curses_window_getbkgd_impl(PyCursesWindowObject *self);
+
+static PyObject *
+_curses_window_getbkgd(PyCursesWindowObject *self, PyObject *Py_UNUSED(ignored))
+{
+ PyObject *return_value = NULL;
+ long _return_value;
+
+ _return_value = _curses_window_getbkgd_impl(self);
+ if ((_return_value == -1) && PyErr_Occurred()) {
+ goto exit;
+ }
+ return_value = PyLong_FromLong(_return_value);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_curses_window_getch__doc__,
+"getch([y, x])\n"
+"Get a character code from terminal keyboard.\n"
+"\n"
+" y\n"
+" Y-coordinate.\n"
+" x\n"
+" X-coordinate.\n"
+"\n"
+"The integer returned does not have to be in ASCII range: function keys,\n"
+"keypad keys and so on return numbers higher than 256. In no-delay mode, -1\n"
+"is returned if there is no input, else getch() waits until a key is pressed.");
+
+#define _CURSES_WINDOW_GETCH_METHODDEF \
+ {"getch", (PyCFunction)_curses_window_getch, METH_VARARGS, _curses_window_getch__doc__},
+
+static int
+_curses_window_getch_impl(PyCursesWindowObject *self, int group_right_1,
+ int y, int x);
+
+static PyObject *
+_curses_window_getch(PyCursesWindowObject *self, PyObject *args)
+{
+ PyObject *return_value = NULL;
+ int group_right_1 = 0;
+ int y = 0;
+ int x = 0;
+ int _return_value;
+
+ switch (PyTuple_GET_SIZE(args)) {
+ case 0:
+ break;
+ case 2:
+ if (!PyArg_ParseTuple(args, "ii:getch", &y, &x)) {
+ goto exit;
+ }
+ group_right_1 = 1;
+ break;
+ default:
+ PyErr_SetString(PyExc_TypeError, "_curses.window.getch requires 0 to 2 arguments");
+ goto exit;
+ }
+ _return_value = _curses_window_getch_impl(self, group_right_1, y, x);
+ if ((_return_value == -1) && PyErr_Occurred()) {
+ goto exit;
+ }
+ return_value = PyLong_FromLong((long)_return_value);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_curses_window_getkey__doc__,
+"getkey([y, x])\n"
+"Get a character (string) from terminal keyboard.\n"
+"\n"
+" y\n"
+" Y-coordinate.\n"
+" x\n"
+" X-coordinate.\n"
+"\n"
+"Returning a string instead of an integer, as getch() does. Function keys,\n"
+"keypad keys and other special keys return a multibyte string containing the\n"
+"key name. In no-delay mode, an exception is raised if there is no input.");
+
+#define _CURSES_WINDOW_GETKEY_METHODDEF \
+ {"getkey", (PyCFunction)_curses_window_getkey, METH_VARARGS, _curses_window_getkey__doc__},
+
+static PyObject *
+_curses_window_getkey_impl(PyCursesWindowObject *self, int group_right_1,
+ int y, int x);
+
+static PyObject *
+_curses_window_getkey(PyCursesWindowObject *self, PyObject *args)
+{
+ PyObject *return_value = NULL;
+ int group_right_1 = 0;
+ int y = 0;
+ int x = 0;
+
+ switch (PyTuple_GET_SIZE(args)) {
+ case 0:
+ break;
+ case 2:
+ if (!PyArg_ParseTuple(args, "ii:getkey", &y, &x)) {
+ goto exit;
+ }
+ group_right_1 = 1;
+ break;
+ default:
+ PyErr_SetString(PyExc_TypeError, "_curses.window.getkey requires 0 to 2 arguments");
+ goto exit;
+ }
+ return_value = _curses_window_getkey_impl(self, group_right_1, y, x);
+
+exit:
+ return return_value;
+}
+
+#if defined(HAVE_NCURSESW)
+
+PyDoc_STRVAR(_curses_window_get_wch__doc__,
+"get_wch([y, x])\n"
+"Get a wide character from terminal keyboard.\n"
+"\n"
+" y\n"
+" Y-coordinate.\n"
+" x\n"
+" X-coordinate.\n"
+"\n"
+"Return a character for most keys, or an integer for function keys,\n"
+"keypad keys, and other special keys.");
+
+#define _CURSES_WINDOW_GET_WCH_METHODDEF \
+ {"get_wch", (PyCFunction)_curses_window_get_wch, METH_VARARGS, _curses_window_get_wch__doc__},
+
+static PyObject *
+_curses_window_get_wch_impl(PyCursesWindowObject *self, int group_right_1,
+ int y, int x);
+
+static PyObject *
+_curses_window_get_wch(PyCursesWindowObject *self, PyObject *args)
+{
+ PyObject *return_value = NULL;
+ int group_right_1 = 0;
+ int y = 0;
+ int x = 0;
+
+ switch (PyTuple_GET_SIZE(args)) {
+ case 0:
+ break;
+ case 2:
+ if (!PyArg_ParseTuple(args, "ii:get_wch", &y, &x)) {
+ goto exit;
+ }
+ group_right_1 = 1;
+ break;
+ default:
+ PyErr_SetString(PyExc_TypeError, "_curses.window.get_wch requires 0 to 2 arguments");
+ goto exit;
+ }
+ return_value = _curses_window_get_wch_impl(self, group_right_1, y, x);
+
+exit:
+ return return_value;
+}
+
+#endif /* defined(HAVE_NCURSESW) */
+
+PyDoc_STRVAR(_curses_window_hline__doc__,
+"hline([y, x,] ch, n, [attr=_curses.A_NORMAL])\n"
+"Display a horizontal line.\n"
+"\n"
+" y\n"
+" Starting Y-coordinate.\n"
+" x\n"
+" Starting X-coordinate.\n"
+" ch\n"
+" Character to draw.\n"
+" n\n"
+" Line length.\n"
+" attr\n"
+" Attributes for the characters.");
+
+#define _CURSES_WINDOW_HLINE_METHODDEF \
+ {"hline", (PyCFunction)_curses_window_hline, METH_VARARGS, _curses_window_hline__doc__},
+
+static PyObject *
+_curses_window_hline_impl(PyCursesWindowObject *self, int group_left_1,
+ int y, int x, PyObject *ch, int n,
+ int group_right_1, long attr);
+
+static PyObject *
+_curses_window_hline(PyCursesWindowObject *self, PyObject *args)
+{
+ PyObject *return_value = NULL;
+ int group_left_1 = 0;
+ int y = 0;
+ int x = 0;
+ PyObject *ch;
+ int n;
+ int group_right_1 = 0;
+ long attr = A_NORMAL;
+
+ switch (PyTuple_GET_SIZE(args)) {
+ case 2:
+ if (!PyArg_ParseTuple(args, "Oi:hline", &ch, &n)) {
+ goto exit;
+ }
+ break;
+ case 3:
+ if (!PyArg_ParseTuple(args, "Oil:hline", &ch, &n, &attr)) {
+ goto exit;
+ }
+ group_right_1 = 1;
+ break;
+ case 4:
+ if (!PyArg_ParseTuple(args, "iiOi:hline", &y, &x, &ch, &n)) {
+ goto exit;
+ }
+ group_left_1 = 1;
+ break;
+ case 5:
+ if (!PyArg_ParseTuple(args, "iiOil:hline", &y, &x, &ch, &n, &attr)) {
+ goto exit;
+ }
+ group_right_1 = 1;
+ group_left_1 = 1;
+ break;
+ default:
+ PyErr_SetString(PyExc_TypeError, "_curses.window.hline requires 2 to 5 arguments");
+ goto exit;
+ }
+ return_value = _curses_window_hline_impl(self, group_left_1, y, x, ch, n, group_right_1, attr);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_curses_window_insch__doc__,
+"insch([y, x,] ch, [attr=_curses.A_NORMAL])\n"
+"Insert a character before the current or specified position.\n"
+"\n"
+" y\n"
+" Y-coordinate.\n"
+" x\n"
+" X-coordinate.\n"
+" ch\n"
+" Character to insert.\n"
+" attr\n"
+" Attributes for the character.\n"
+"\n"
+"All characters to the right of the cursor are shifted one position right, with\n"
+"the rightmost characters on the line being lost.");
+
+#define _CURSES_WINDOW_INSCH_METHODDEF \
+ {"insch", (PyCFunction)_curses_window_insch, METH_VARARGS, _curses_window_insch__doc__},
+
+static PyObject *
+_curses_window_insch_impl(PyCursesWindowObject *self, int group_left_1,
+ int y, int x, PyObject *ch, int group_right_1,
+ long attr);
+
+static PyObject *
+_curses_window_insch(PyCursesWindowObject *self, PyObject *args)
+{
+ PyObject *return_value = NULL;
+ int group_left_1 = 0;
+ int y = 0;
+ int x = 0;
+ PyObject *ch;
+ int group_right_1 = 0;
+ long attr = A_NORMAL;
+
+ switch (PyTuple_GET_SIZE(args)) {
+ case 1:
+ if (!PyArg_ParseTuple(args, "O:insch", &ch)) {
+ goto exit;
+ }
+ break;
+ case 2:
+ if (!PyArg_ParseTuple(args, "Ol:insch", &ch, &attr)) {
+ goto exit;
+ }
+ group_right_1 = 1;
+ break;
+ case 3:
+ if (!PyArg_ParseTuple(args, "iiO:insch", &y, &x, &ch)) {
+ goto exit;
+ }
+ group_left_1 = 1;
+ break;
+ case 4:
+ if (!PyArg_ParseTuple(args, "iiOl:insch", &y, &x, &ch, &attr)) {
+ goto exit;
+ }
+ group_right_1 = 1;
+ group_left_1 = 1;
+ break;
+ default:
+ PyErr_SetString(PyExc_TypeError, "_curses.window.insch requires 1 to 4 arguments");
+ goto exit;
+ }
+ return_value = _curses_window_insch_impl(self, group_left_1, y, x, ch, group_right_1, attr);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_curses_window_inch__doc__,
+"inch([y, x])\n"
+"Return the character at the given position in the window.\n"
+"\n"
+" y\n"
+" Y-coordinate.\n"
+" x\n"
+" X-coordinate.\n"
+"\n"
+"The bottom 8 bits are the character proper, and upper bits are the attributes.");
+
+#define _CURSES_WINDOW_INCH_METHODDEF \
+ {"inch", (PyCFunction)_curses_window_inch, METH_VARARGS, _curses_window_inch__doc__},
+
+static unsigned long
+_curses_window_inch_impl(PyCursesWindowObject *self, int group_right_1,
+ int y, int x);
+
+static PyObject *
+_curses_window_inch(PyCursesWindowObject *self, PyObject *args)
+{
+ PyObject *return_value = NULL;
+ int group_right_1 = 0;
+ int y = 0;
+ int x = 0;
+ unsigned long _return_value;
+
+ switch (PyTuple_GET_SIZE(args)) {
+ case 0:
+ break;
+ case 2:
+ if (!PyArg_ParseTuple(args, "ii:inch", &y, &x)) {
+ goto exit;
+ }
+ group_right_1 = 1;
+ break;
+ default:
+ PyErr_SetString(PyExc_TypeError, "_curses.window.inch requires 0 to 2 arguments");
goto exit;
}
- return_value = curses_window_addch_impl(self, group_left_1, y, x, ch, group_right_1, attr);
+ _return_value = _curses_window_inch_impl(self, group_right_1, y, x);
+ if ((_return_value == (unsigned long)-1) && PyErr_Occurred()) {
+ goto exit;
+ }
+ return_value = PyLong_FromUnsignedLong(_return_value);
exit:
return return_value;
}
-/*[clinic end generated code: output=13ffc5f8d79cbfbf input=a9049054013a1b77]*/
+
+PyDoc_STRVAR(_curses_window_insstr__doc__,
+"insstr([y, x,] str, [attr])\n"
+"Insert the string before the current or specified position.\n"
+"\n"
+" y\n"
+" Y-coordinate.\n"
+" x\n"
+" X-coordinate.\n"
+" str\n"
+" String to insert.\n"
+" attr\n"
+" Attributes for characters.\n"
+"\n"
+"Insert a character string (as many characters as will fit on the line)\n"
+"before the character under the cursor. All characters to the right of\n"
+"the cursor are shifted right, with the rightmost characters on the line\n"
+"being lost. The cursor position does not change (after moving to y, x,\n"
+"if specified).");
+
+#define _CURSES_WINDOW_INSSTR_METHODDEF \
+ {"insstr", (PyCFunction)_curses_window_insstr, METH_VARARGS, _curses_window_insstr__doc__},
+
+static PyObject *
+_curses_window_insstr_impl(PyCursesWindowObject *self, int group_left_1,
+ int y, int x, PyObject *str, int group_right_1,
+ long attr);
+
+static PyObject *
+_curses_window_insstr(PyCursesWindowObject *self, PyObject *args)
+{
+ PyObject *return_value = NULL;
+ int group_left_1 = 0;
+ int y = 0;
+ int x = 0;
+ PyObject *str;
+ int group_right_1 = 0;
+ long attr = 0;
+
+ switch (PyTuple_GET_SIZE(args)) {
+ case 1:
+ if (!PyArg_ParseTuple(args, "O:insstr", &str)) {
+ goto exit;
+ }
+ break;
+ case 2:
+ if (!PyArg_ParseTuple(args, "Ol:insstr", &str, &attr)) {
+ goto exit;
+ }
+ group_right_1 = 1;
+ break;
+ case 3:
+ if (!PyArg_ParseTuple(args, "iiO:insstr", &y, &x, &str)) {
+ goto exit;
+ }
+ group_left_1 = 1;
+ break;
+ case 4:
+ if (!PyArg_ParseTuple(args, "iiOl:insstr", &y, &x, &str, &attr)) {
+ goto exit;
+ }
+ group_right_1 = 1;
+ group_left_1 = 1;
+ break;
+ default:
+ PyErr_SetString(PyExc_TypeError, "_curses.window.insstr requires 1 to 4 arguments");
+ goto exit;
+ }
+ return_value = _curses_window_insstr_impl(self, group_left_1, y, x, str, group_right_1, attr);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_curses_window_insnstr__doc__,
+"insnstr([y, x,] str, n, [attr])\n"
+"Insert at most n characters of the string.\n"
+"\n"
+" y\n"
+" Y-coordinate.\n"
+" x\n"
+" X-coordinate.\n"
+" str\n"
+" String to insert.\n"
+" n\n"
+" Maximal number of characters.\n"
+" attr\n"
+" Attributes for characters.\n"
+"\n"
+"Insert a character string (as many characters as will fit on the line)\n"
+"before the character under the cursor, up to n characters. If n is zero\n"
+"or negative, the entire string is inserted. All characters to the right\n"
+"of the cursor are shifted right, with the rightmost characters on the line\n"
+"being lost. The cursor position does not change (after moving to y, x, if\n"
+"specified).");
+
+#define _CURSES_WINDOW_INSNSTR_METHODDEF \
+ {"insnstr", (PyCFunction)_curses_window_insnstr, METH_VARARGS, _curses_window_insnstr__doc__},
+
+static PyObject *
+_curses_window_insnstr_impl(PyCursesWindowObject *self, int group_left_1,
+ int y, int x, PyObject *str, int n,
+ int group_right_1, long attr);
+
+static PyObject *
+_curses_window_insnstr(PyCursesWindowObject *self, PyObject *args)
+{
+ PyObject *return_value = NULL;
+ int group_left_1 = 0;
+ int y = 0;
+ int x = 0;
+ PyObject *str;
+ int n;
+ int group_right_1 = 0;
+ long attr = 0;
+
+ switch (PyTuple_GET_SIZE(args)) {
+ case 2:
+ if (!PyArg_ParseTuple(args, "Oi:insnstr", &str, &n)) {
+ goto exit;
+ }
+ break;
+ case 3:
+ if (!PyArg_ParseTuple(args, "Oil:insnstr", &str, &n, &attr)) {
+ goto exit;
+ }
+ group_right_1 = 1;
+ break;
+ case 4:
+ if (!PyArg_ParseTuple(args, "iiOi:insnstr", &y, &x, &str, &n)) {
+ goto exit;
+ }
+ group_left_1 = 1;
+ break;
+ case 5:
+ if (!PyArg_ParseTuple(args, "iiOil:insnstr", &y, &x, &str, &n, &attr)) {
+ goto exit;
+ }
+ group_right_1 = 1;
+ group_left_1 = 1;
+ break;
+ default:
+ PyErr_SetString(PyExc_TypeError, "_curses.window.insnstr requires 2 to 5 arguments");
+ goto exit;
+ }
+ return_value = _curses_window_insnstr_impl(self, group_left_1, y, x, str, n, group_right_1, attr);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_curses_window_is_linetouched__doc__,
+"is_linetouched($self, line, /)\n"
+"--\n"
+"\n"
+"Return True if the specified line was modified, otherwise return False.\n"
+"\n"
+" line\n"
+" Line number.\n"
+"\n"
+"Raise a curses.error exception if line is not valid for the given window.");
+
+#define _CURSES_WINDOW_IS_LINETOUCHED_METHODDEF \
+ {"is_linetouched", (PyCFunction)_curses_window_is_linetouched, METH_O, _curses_window_is_linetouched__doc__},
+
+static PyObject *
+_curses_window_is_linetouched_impl(PyCursesWindowObject *self, int line);
+
+static PyObject *
+_curses_window_is_linetouched(PyCursesWindowObject *self, PyObject *arg)
+{
+ PyObject *return_value = NULL;
+ int line;
+
+ if (!PyArg_Parse(arg, "i:is_linetouched", &line)) {
+ goto exit;
+ }
+ return_value = _curses_window_is_linetouched_impl(self, line);
+
+exit:
+ return return_value;
+}
+
+#if defined(py_is_pad)
+
+PyDoc_STRVAR(_curses_window_noutrefresh__doc__,
+"noutrefresh([pminrow, pmincol, sminrow, smincol, smaxrow, smaxcol])\n"
+"Mark for refresh but wait.\n"
+"\n"
+"This function updates the data structure representing the desired state of the\n"
+"window, but does not force an update of the physical screen. To accomplish\n"
+"that, call doupdate().");
+
+#define _CURSES_WINDOW_NOUTREFRESH_METHODDEF \
+ {"noutrefresh", (PyCFunction)_curses_window_noutrefresh, METH_VARARGS, _curses_window_noutrefresh__doc__},
+
+static PyObject *
+_curses_window_noutrefresh_impl(PyCursesWindowObject *self,
+ int group_right_1, int pminrow, int pmincol,
+ int sminrow, int smincol, int smaxrow,
+ int smaxcol);
+
+static PyObject *
+_curses_window_noutrefresh(PyCursesWindowObject *self, PyObject *args)
+{
+ PyObject *return_value = NULL;
+ int group_right_1 = 0;
+ int pminrow = 0;
+ int pmincol = 0;
+ int sminrow = 0;
+ int smincol = 0;
+ int smaxrow = 0;
+ int smaxcol = 0;
+
+ switch (PyTuple_GET_SIZE(args)) {
+ case 0:
+ break;
+ case 6:
+ if (!PyArg_ParseTuple(args, "iiiiii:noutrefresh", &pminrow, &pmincol, &sminrow, &smincol, &smaxrow, &smaxcol)) {
+ goto exit;
+ }
+ group_right_1 = 1;
+ break;
+ default:
+ PyErr_SetString(PyExc_TypeError, "_curses.window.noutrefresh requires 0 to 6 arguments");
+ goto exit;
+ }
+ return_value = _curses_window_noutrefresh_impl(self, group_right_1, pminrow, pmincol, sminrow, smincol, smaxrow, smaxcol);
+
+exit:
+ return return_value;
+}
+
+#endif /* defined(py_is_pad) */
+
+#if !defined(py_is_pad)
+
+PyDoc_STRVAR(_curses_window_noutrefresh__doc__,
+"noutrefresh($self, /)\n"
+"--\n"
+"\n"
+"Mark for refresh but wait.\n"
+"\n"
+"This function updates the data structure representing the desired state of the\n"
+"window, but does not force an update of the physical screen. To accomplish\n"
+"that, call doupdate().");
+
+#define _CURSES_WINDOW_NOUTREFRESH_METHODDEF \
+ {"noutrefresh", (PyCFunction)_curses_window_noutrefresh, METH_NOARGS, _curses_window_noutrefresh__doc__},
+
+static PyObject *
+_curses_window_noutrefresh_impl(PyCursesWindowObject *self);
+
+static PyObject *
+_curses_window_noutrefresh(PyCursesWindowObject *self, PyObject *Py_UNUSED(ignored))
+{
+ return _curses_window_noutrefresh_impl(self);
+}
+
+#endif /* !defined(py_is_pad) */
+
+PyDoc_STRVAR(_curses_window_overlay__doc__,
+"overlay(destwin, [sminrow, smincol, dminrow, dmincol, dmaxrow, dmaxcol])\n"
+"Overlay the window on top of destwin.\n"
+"\n"
+"The windows need not be the same size, only the overlapping region is copied.\n"
+"This copy is non-destructive, which means that the current background\n"
+"character does not overwrite the old contents of destwin.\n"
+"\n"
+"To get fine-grained control over the copied region, the second form of\n"
+"overlay() can be used. sminrow and smincol are the upper-left coordinates\n"
+"of the source window, and the other variables mark a rectangle in the\n"
+"destination window.");
+
+#define _CURSES_WINDOW_OVERLAY_METHODDEF \
+ {"overlay", (PyCFunction)_curses_window_overlay, METH_VARARGS, _curses_window_overlay__doc__},
+
+static PyObject *
+_curses_window_overlay_impl(PyCursesWindowObject *self,
+ PyCursesWindowObject *destwin, int group_right_1,
+ int sminrow, int smincol, int dminrow,
+ int dmincol, int dmaxrow, int dmaxcol);
+
+static PyObject *
+_curses_window_overlay(PyCursesWindowObject *self, PyObject *args)
+{
+ PyObject *return_value = NULL;
+ PyCursesWindowObject *destwin;
+ int group_right_1 = 0;
+ int sminrow = 0;
+ int smincol = 0;
+ int dminrow = 0;
+ int dmincol = 0;
+ int dmaxrow = 0;
+ int dmaxcol = 0;
+
+ switch (PyTuple_GET_SIZE(args)) {
+ case 1:
+ if (!PyArg_ParseTuple(args, "O!:overlay", &PyCursesWindow_Type, &destwin)) {
+ goto exit;
+ }
+ break;
+ case 7:
+ if (!PyArg_ParseTuple(args, "O!iiiiii:overlay", &PyCursesWindow_Type, &destwin, &sminrow, &smincol, &dminrow, &dmincol, &dmaxrow, &dmaxcol)) {
+ goto exit;
+ }
+ group_right_1 = 1;
+ break;
+ default:
+ PyErr_SetString(PyExc_TypeError, "_curses.window.overlay requires 1 to 7 arguments");
+ goto exit;
+ }
+ return_value = _curses_window_overlay_impl(self, destwin, group_right_1, sminrow, smincol, dminrow, dmincol, dmaxrow, dmaxcol);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_curses_window_overwrite__doc__,
+"overwrite(destwin, [sminrow, smincol, dminrow, dmincol, dmaxrow,\n"
+" dmaxcol])\n"
+"Overwrite the window on top of destwin.\n"
+"\n"
+"The windows need not be the same size, in which case only the overlapping\n"
+"region is copied. This copy is destructive, which means that the current\n"
+"background character overwrites the old contents of destwin.\n"
+"\n"
+"To get fine-grained control over the copied region, the second form of\n"
+"overwrite() can be used. sminrow and smincol are the upper-left coordinates\n"
+"of the source window, the other variables mark a rectangle in the destination\n"
+"window.");
+
+#define _CURSES_WINDOW_OVERWRITE_METHODDEF \
+ {"overwrite", (PyCFunction)_curses_window_overwrite, METH_VARARGS, _curses_window_overwrite__doc__},
+
+static PyObject *
+_curses_window_overwrite_impl(PyCursesWindowObject *self,
+ PyCursesWindowObject *destwin,
+ int group_right_1, int sminrow, int smincol,
+ int dminrow, int dmincol, int dmaxrow,
+ int dmaxcol);
+
+static PyObject *
+_curses_window_overwrite(PyCursesWindowObject *self, PyObject *args)
+{
+ PyObject *return_value = NULL;
+ PyCursesWindowObject *destwin;
+ int group_right_1 = 0;
+ int sminrow = 0;
+ int smincol = 0;
+ int dminrow = 0;
+ int dmincol = 0;
+ int dmaxrow = 0;
+ int dmaxcol = 0;
+
+ switch (PyTuple_GET_SIZE(args)) {
+ case 1:
+ if (!PyArg_ParseTuple(args, "O!:overwrite", &PyCursesWindow_Type, &destwin)) {
+ goto exit;
+ }
+ break;
+ case 7:
+ if (!PyArg_ParseTuple(args, "O!iiiiii:overwrite", &PyCursesWindow_Type, &destwin, &sminrow, &smincol, &dminrow, &dmincol, &dmaxrow, &dmaxcol)) {
+ goto exit;
+ }
+ group_right_1 = 1;
+ break;
+ default:
+ PyErr_SetString(PyExc_TypeError, "_curses.window.overwrite requires 1 to 7 arguments");
+ goto exit;
+ }
+ return_value = _curses_window_overwrite_impl(self, destwin, group_right_1, sminrow, smincol, dminrow, dmincol, dmaxrow, dmaxcol);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_curses_window_putwin__doc__,
+"putwin($self, file, /)\n"
+"--\n"
+"\n"
+"Write all data associated with the window into the provided file object.\n"
+"\n"
+"This information can be later retrieved using the getwin() function.");
+
+#define _CURSES_WINDOW_PUTWIN_METHODDEF \
+ {"putwin", (PyCFunction)_curses_window_putwin, METH_O, _curses_window_putwin__doc__},
+
+PyDoc_STRVAR(_curses_window_redrawln__doc__,
+"redrawln($self, beg, num, /)\n"
+"--\n"
+"\n"
+"Mark the specified lines corrupted.\n"
+"\n"
+" beg\n"
+" Starting line number.\n"
+" num\n"
+" The number of lines.\n"
+"\n"
+"They should be completely redrawn on the next refresh() call.");
+
+#define _CURSES_WINDOW_REDRAWLN_METHODDEF \
+ {"redrawln", (PyCFunction)_curses_window_redrawln, METH_FASTCALL, _curses_window_redrawln__doc__},
+
+static PyObject *
+_curses_window_redrawln_impl(PyCursesWindowObject *self, int beg, int num);
+
+static PyObject *
+_curses_window_redrawln(PyCursesWindowObject *self, PyObject *const *args, Py_ssize_t nargs)
+{
+ PyObject *return_value = NULL;
+ int beg;
+ int num;
+
+ if (!_PyArg_ParseStack(args, nargs, "ii:redrawln",
+ &beg, &num)) {
+ goto exit;
+ }
+ return_value = _curses_window_redrawln_impl(self, beg, num);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_curses_window_refresh__doc__,
+"refresh([pminrow, pmincol, sminrow, smincol, smaxrow, smaxcol])\n"
+"Update the display immediately.\n"
+"\n"
+"Synchronize actual screen with previous drawing/deleting methods.\n"
+"The 6 optional arguments can only be specified when the window is a pad\n"
+"created with newpad(). The additional parameters are needed to indicate\n"
+"what part of the pad and screen are involved. pminrow and pmincol specify\n"
+"the upper left-hand corner of the rectangle to be displayed in the pad.\n"
+"sminrow, smincol, smaxrow, and smaxcol specify the edges of the rectangle to\n"
+"be displayed on the screen. The lower right-hand corner of the rectangle to\n"
+"be displayed in the pad is calculated from the screen coordinates, since the\n"
+"rectangles must be the same size. Both rectangles must be entirely contained\n"
+"within their respective structures. Negative values of pminrow, pmincol,\n"
+"sminrow, or smincol are treated as if they were zero.");
+
+#define _CURSES_WINDOW_REFRESH_METHODDEF \
+ {"refresh", (PyCFunction)_curses_window_refresh, METH_VARARGS, _curses_window_refresh__doc__},
+
+static PyObject *
+_curses_window_refresh_impl(PyCursesWindowObject *self, int group_right_1,
+ int pminrow, int pmincol, int sminrow,
+ int smincol, int smaxrow, int smaxcol);
+
+static PyObject *
+_curses_window_refresh(PyCursesWindowObject *self, PyObject *args)
+{
+ PyObject *return_value = NULL;
+ int group_right_1 = 0;
+ int pminrow = 0;
+ int pmincol = 0;
+ int sminrow = 0;
+ int smincol = 0;
+ int smaxrow = 0;
+ int smaxcol = 0;
+
+ switch (PyTuple_GET_SIZE(args)) {
+ case 0:
+ break;
+ case 6:
+ if (!PyArg_ParseTuple(args, "iiiiii:refresh", &pminrow, &pmincol, &sminrow, &smincol, &smaxrow, &smaxcol)) {
+ goto exit;
+ }
+ group_right_1 = 1;
+ break;
+ default:
+ PyErr_SetString(PyExc_TypeError, "_curses.window.refresh requires 0 to 6 arguments");
+ goto exit;
+ }
+ return_value = _curses_window_refresh_impl(self, group_right_1, pminrow, pmincol, sminrow, smincol, smaxrow, smaxcol);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_curses_window_setscrreg__doc__,
+"setscrreg($self, top, bottom, /)\n"
+"--\n"
+"\n"
+"Define a software scrolling region.\n"
+"\n"
+" top\n"
+" First line number.\n"
+" bottom\n"
+" Last line number.\n"
+"\n"
+"All scrolling actions will take place in this region.");
+
+#define _CURSES_WINDOW_SETSCRREG_METHODDEF \
+ {"setscrreg", (PyCFunction)_curses_window_setscrreg, METH_FASTCALL, _curses_window_setscrreg__doc__},
+
+static PyObject *
+_curses_window_setscrreg_impl(PyCursesWindowObject *self, int top,
+ int bottom);
+
+static PyObject *
+_curses_window_setscrreg(PyCursesWindowObject *self, PyObject *const *args, Py_ssize_t nargs)
+{
+ PyObject *return_value = NULL;
+ int top;
+ int bottom;
+
+ if (!_PyArg_ParseStack(args, nargs, "ii:setscrreg",
+ &top, &bottom)) {
+ goto exit;
+ }
+ return_value = _curses_window_setscrreg_impl(self, top, bottom);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_curses_window_subwin__doc__,
+"subwin([nlines=0, ncols=0,] begin_y, begin_x)\n"
+"Create a sub-window (screen-relative coordinates).\n"
+"\n"
+" nlines\n"
+" Height.\n"
+" ncols\n"
+" Width.\n"
+" begin_y\n"
+" Top side y-coordinate.\n"
+" begin_x\n"
+" Left side x-coordinate.\n"
+"\n"
+"By default, the sub-window will extend from the specified position to the\n"
+"lower right corner of the window.");
+
+#define _CURSES_WINDOW_SUBWIN_METHODDEF \
+ {"subwin", (PyCFunction)_curses_window_subwin, METH_VARARGS, _curses_window_subwin__doc__},
+
+static PyObject *
+_curses_window_subwin_impl(PyCursesWindowObject *self, int group_left_1,
+ int nlines, int ncols, int begin_y, int begin_x);
+
+static PyObject *
+_curses_window_subwin(PyCursesWindowObject *self, PyObject *args)
+{
+ PyObject *return_value = NULL;
+ int group_left_1 = 0;
+ int nlines = 0;
+ int ncols = 0;
+ int begin_y;
+ int begin_x;
+
+ switch (PyTuple_GET_SIZE(args)) {
+ case 2:
+ if (!PyArg_ParseTuple(args, "ii:subwin", &begin_y, &begin_x)) {
+ goto exit;
+ }
+ break;
+ case 4:
+ if (!PyArg_ParseTuple(args, "iiii:subwin", &nlines, &ncols, &begin_y, &begin_x)) {
+ goto exit;
+ }
+ group_left_1 = 1;
+ break;
+ default:
+ PyErr_SetString(PyExc_TypeError, "_curses.window.subwin requires 2 to 4 arguments");
+ goto exit;
+ }
+ return_value = _curses_window_subwin_impl(self, group_left_1, nlines, ncols, begin_y, begin_x);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_curses_window_scroll__doc__,
+"scroll([lines=1])\n"
+"Scroll the screen or scrolling region.\n"
+"\n"
+" lines\n"
+" Number of lines to scroll.\n"
+"\n"
+"Scroll upward if the argument is positive and downward if it is negative.");
+
+#define _CURSES_WINDOW_SCROLL_METHODDEF \
+ {"scroll", (PyCFunction)_curses_window_scroll, METH_VARARGS, _curses_window_scroll__doc__},
+
+static PyObject *
+_curses_window_scroll_impl(PyCursesWindowObject *self, int group_right_1,
+ int lines);
+
+static PyObject *
+_curses_window_scroll(PyCursesWindowObject *self, PyObject *args)
+{
+ PyObject *return_value = NULL;
+ int group_right_1 = 0;
+ int lines = 1;
+
+ switch (PyTuple_GET_SIZE(args)) {
+ case 0:
+ break;
+ case 1:
+ if (!PyArg_ParseTuple(args, "i:scroll", &lines)) {
+ goto exit;
+ }
+ group_right_1 = 1;
+ break;
+ default:
+ PyErr_SetString(PyExc_TypeError, "_curses.window.scroll requires 0 to 1 arguments");
+ goto exit;
+ }
+ return_value = _curses_window_scroll_impl(self, group_right_1, lines);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_curses_window_touchline__doc__,
+"touchline(start, count, [changed=True])\n"
+"Pretend count lines have been changed, starting with line start.\n"
+"\n"
+"If changed is supplied, it specifies whether the affected lines are marked\n"
+"as having been changed (changed=True) or unchanged (changed=False).");
+
+#define _CURSES_WINDOW_TOUCHLINE_METHODDEF \
+ {"touchline", (PyCFunction)_curses_window_touchline, METH_VARARGS, _curses_window_touchline__doc__},
+
+static PyObject *
+_curses_window_touchline_impl(PyCursesWindowObject *self, int start,
+ int count, int group_right_1, int changed);
+
+static PyObject *
+_curses_window_touchline(PyCursesWindowObject *self, PyObject *args)
+{
+ PyObject *return_value = NULL;
+ int start;
+ int count;
+ int group_right_1 = 0;
+ int changed = 1;
+
+ switch (PyTuple_GET_SIZE(args)) {
+ case 2:
+ if (!PyArg_ParseTuple(args, "ii:touchline", &start, &count)) {
+ goto exit;
+ }
+ break;
+ case 3:
+ if (!PyArg_ParseTuple(args, "iii:touchline", &start, &count, &changed)) {
+ goto exit;
+ }
+ group_right_1 = 1;
+ break;
+ default:
+ PyErr_SetString(PyExc_TypeError, "_curses.window.touchline requires 2 to 3 arguments");
+ goto exit;
+ }
+ return_value = _curses_window_touchline_impl(self, start, count, group_right_1, changed);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_curses_window_vline__doc__,
+"vline([y, x,] ch, n, [attr=_curses.A_NORMAL])\n"
+"Display a vertical line.\n"
+"\n"
+" y\n"
+" Starting Y-coordinate.\n"
+" x\n"
+" Starting X-coordinate.\n"
+" ch\n"
+" Character to draw.\n"
+" n\n"
+" Line length.\n"
+" attr\n"
+" Attributes for the character.");
+
+#define _CURSES_WINDOW_VLINE_METHODDEF \
+ {"vline", (PyCFunction)_curses_window_vline, METH_VARARGS, _curses_window_vline__doc__},
+
+static PyObject *
+_curses_window_vline_impl(PyCursesWindowObject *self, int group_left_1,
+ int y, int x, PyObject *ch, int n,
+ int group_right_1, long attr);
+
+static PyObject *
+_curses_window_vline(PyCursesWindowObject *self, PyObject *args)
+{
+ PyObject *return_value = NULL;
+ int group_left_1 = 0;
+ int y = 0;
+ int x = 0;
+ PyObject *ch;
+ int n;
+ int group_right_1 = 0;
+ long attr = A_NORMAL;
+
+ switch (PyTuple_GET_SIZE(args)) {
+ case 2:
+ if (!PyArg_ParseTuple(args, "Oi:vline", &ch, &n)) {
+ goto exit;
+ }
+ break;
+ case 3:
+ if (!PyArg_ParseTuple(args, "Oil:vline", &ch, &n, &attr)) {
+ goto exit;
+ }
+ group_right_1 = 1;
+ break;
+ case 4:
+ if (!PyArg_ParseTuple(args, "iiOi:vline", &y, &x, &ch, &n)) {
+ goto exit;
+ }
+ group_left_1 = 1;
+ break;
+ case 5:
+ if (!PyArg_ParseTuple(args, "iiOil:vline", &y, &x, &ch, &n, &attr)) {
+ goto exit;
+ }
+ group_right_1 = 1;
+ group_left_1 = 1;
+ break;
+ default:
+ PyErr_SetString(PyExc_TypeError, "_curses.window.vline requires 2 to 5 arguments");
+ goto exit;
+ }
+ return_value = _curses_window_vline_impl(self, group_left_1, y, x, ch, n, group_right_1, attr);
+
+exit:
+ return return_value;
+}
+
+#if defined(HAVE_CURSES_FILTER)
+
+PyDoc_STRVAR(_curses_filter__doc__,
+"filter($module, /)\n"
+"--\n"
+"\n");
+
+#define _CURSES_FILTER_METHODDEF \
+ {"filter", (PyCFunction)_curses_filter, METH_NOARGS, _curses_filter__doc__},
+
+static PyObject *
+_curses_filter_impl(PyObject *module);
+
+static PyObject *
+_curses_filter(PyObject *module, PyObject *Py_UNUSED(ignored))
+{
+ return _curses_filter_impl(module);
+}
+
+#endif /* defined(HAVE_CURSES_FILTER) */
+
+PyDoc_STRVAR(_curses_baudrate__doc__,
+"baudrate($module, /)\n"
+"--\n"
+"\n"
+"Return the output speed of the terminal in bits per second.");
+
+#define _CURSES_BAUDRATE_METHODDEF \
+ {"baudrate", (PyCFunction)_curses_baudrate, METH_NOARGS, _curses_baudrate__doc__},
+
+static PyObject *
+_curses_baudrate_impl(PyObject *module);
+
+static PyObject *
+_curses_baudrate(PyObject *module, PyObject *Py_UNUSED(ignored))
+{
+ return _curses_baudrate_impl(module);
+}
+
+PyDoc_STRVAR(_curses_beep__doc__,
+"beep($module, /)\n"
+"--\n"
+"\n"
+"Emit a short attention sound.");
+
+#define _CURSES_BEEP_METHODDEF \
+ {"beep", (PyCFunction)_curses_beep, METH_NOARGS, _curses_beep__doc__},
+
+static PyObject *
+_curses_beep_impl(PyObject *module);
+
+static PyObject *
+_curses_beep(PyObject *module, PyObject *Py_UNUSED(ignored))
+{
+ return _curses_beep_impl(module);
+}
+
+PyDoc_STRVAR(_curses_can_change_color__doc__,
+"can_change_color($module, /)\n"
+"--\n"
+"\n"
+"Return True if the programmer can change the colors displayed by the terminal.");
+
+#define _CURSES_CAN_CHANGE_COLOR_METHODDEF \
+ {"can_change_color", (PyCFunction)_curses_can_change_color, METH_NOARGS, _curses_can_change_color__doc__},
+
+static PyObject *
+_curses_can_change_color_impl(PyObject *module);
+
+static PyObject *
+_curses_can_change_color(PyObject *module, PyObject *Py_UNUSED(ignored))
+{
+ return _curses_can_change_color_impl(module);
+}
+
+PyDoc_STRVAR(_curses_cbreak__doc__,
+"cbreak($module, flag=True, /)\n"
+"--\n"
+"\n"
+"Enter cbreak mode.\n"
+"\n"
+" flag\n"
+" If false, the effect is the same as calling nocbreak().\n"
+"\n"
+"In cbreak mode (sometimes called \"rare\" mode) normal tty line buffering is\n"
+"turned off and characters are available to be read one by one. However,\n"
+"unlike raw mode, special characters (interrupt, quit, suspend, and flow\n"
+"control) retain their effects on the tty driver and calling program.\n"
+"Calling first raw() then cbreak() leaves the terminal in cbreak mode.");
+
+#define _CURSES_CBREAK_METHODDEF \
+ {"cbreak", (PyCFunction)_curses_cbreak, METH_FASTCALL, _curses_cbreak__doc__},
+
+static PyObject *
+_curses_cbreak_impl(PyObject *module, int flag);
+
+static PyObject *
+_curses_cbreak(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
+{
+ PyObject *return_value = NULL;
+ int flag = 1;
+
+ if (!_PyArg_ParseStack(args, nargs, "|i:cbreak",
+ &flag)) {
+ goto exit;
+ }
+ return_value = _curses_cbreak_impl(module, flag);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_curses_color_content__doc__,
+"color_content($module, color_number, /)\n"
+"--\n"
+"\n"
+"Return the red, green, and blue (RGB) components of the specified color.\n"
+"\n"
+" color_number\n"
+" The number of the color (0 - COLORS).\n"
+"\n"
+"A 3-tuple is returned, containing the R, G, B values for the given color,\n"
+"which will be between 0 (no component) and 1000 (maximum amount of component).");
+
+#define _CURSES_COLOR_CONTENT_METHODDEF \
+ {"color_content", (PyCFunction)_curses_color_content, METH_O, _curses_color_content__doc__},
+
+static PyObject *
+_curses_color_content_impl(PyObject *module, short color_number);
+
+static PyObject *
+_curses_color_content(PyObject *module, PyObject *arg)
+{
+ PyObject *return_value = NULL;
+ short color_number;
+
+ if (!PyArg_Parse(arg, "h:color_content", &color_number)) {
+ goto exit;
+ }
+ return_value = _curses_color_content_impl(module, color_number);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_curses_color_pair__doc__,
+"color_pair($module, color_number, /)\n"
+"--\n"
+"\n"
+"Return the attribute value for displaying text in the specified color.\n"
+"\n"
+" color_number\n"
+" The number of the color (0 - COLORS).\n"
+"\n"
+"This attribute value can be combined with A_STANDOUT, A_REVERSE, and the\n"
+"other A_* attributes. pair_number() is the counterpart to this function.");
+
+#define _CURSES_COLOR_PAIR_METHODDEF \
+ {"color_pair", (PyCFunction)_curses_color_pair, METH_O, _curses_color_pair__doc__},
+
+static PyObject *
+_curses_color_pair_impl(PyObject *module, short color_number);
+
+static PyObject *
+_curses_color_pair(PyObject *module, PyObject *arg)
+{
+ PyObject *return_value = NULL;
+ short color_number;
+
+ if (!PyArg_Parse(arg, "h:color_pair", &color_number)) {
+ goto exit;
+ }
+ return_value = _curses_color_pair_impl(module, color_number);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_curses_curs_set__doc__,
+"curs_set($module, visibility, /)\n"
+"--\n"
+"\n"
+"Set the cursor state.\n"
+"\n"
+" visibility\n"
+" 0 for invisible, 1 for normal visible, or 2 for very visible.\n"
+"\n"
+"If the terminal supports the visibility requested, the previous cursor\n"
+"state is returned; otherwise, an exception is raised. On many terminals,\n"
+"the \"visible\" mode is an underline cursor and the \"very visible\" mode is\n"
+"a block cursor.");
+
+#define _CURSES_CURS_SET_METHODDEF \
+ {"curs_set", (PyCFunction)_curses_curs_set, METH_O, _curses_curs_set__doc__},
+
+static PyObject *
+_curses_curs_set_impl(PyObject *module, int visibility);
+
+static PyObject *
+_curses_curs_set(PyObject *module, PyObject *arg)
+{
+ PyObject *return_value = NULL;
+ int visibility;
+
+ if (!PyArg_Parse(arg, "i:curs_set", &visibility)) {
+ goto exit;
+ }
+ return_value = _curses_curs_set_impl(module, visibility);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_curses_def_prog_mode__doc__,
+"def_prog_mode($module, /)\n"
+"--\n"
+"\n"
+"Save the current terminal mode as the \"program\" mode.\n"
+"\n"
+"The \"program\" mode is the mode when the running program is using curses.\n"
+"\n"
+"Subsequent calls to reset_prog_mode() will restore this mode.");
+
+#define _CURSES_DEF_PROG_MODE_METHODDEF \
+ {"def_prog_mode", (PyCFunction)_curses_def_prog_mode, METH_NOARGS, _curses_def_prog_mode__doc__},
+
+static PyObject *
+_curses_def_prog_mode_impl(PyObject *module);
+
+static PyObject *
+_curses_def_prog_mode(PyObject *module, PyObject *Py_UNUSED(ignored))
+{
+ return _curses_def_prog_mode_impl(module);
+}
+
+PyDoc_STRVAR(_curses_def_shell_mode__doc__,
+"def_shell_mode($module, /)\n"
+"--\n"
+"\n"
+"Save the current terminal mode as the \"shell\" mode.\n"
+"\n"
+"The \"shell\" mode is the mode when the running program is not using curses.\n"
+"\n"
+"Subsequent calls to reset_shell_mode() will restore this mode.");
+
+#define _CURSES_DEF_SHELL_MODE_METHODDEF \
+ {"def_shell_mode", (PyCFunction)_curses_def_shell_mode, METH_NOARGS, _curses_def_shell_mode__doc__},
+
+static PyObject *
+_curses_def_shell_mode_impl(PyObject *module);
+
+static PyObject *
+_curses_def_shell_mode(PyObject *module, PyObject *Py_UNUSED(ignored))
+{
+ return _curses_def_shell_mode_impl(module);
+}
+
+PyDoc_STRVAR(_curses_delay_output__doc__,
+"delay_output($module, ms, /)\n"
+"--\n"
+"\n"
+"Insert a pause in output.\n"
+"\n"
+" ms\n"
+" Duration in milliseconds.");
+
+#define _CURSES_DELAY_OUTPUT_METHODDEF \
+ {"delay_output", (PyCFunction)_curses_delay_output, METH_O, _curses_delay_output__doc__},
+
+static PyObject *
+_curses_delay_output_impl(PyObject *module, int ms);
+
+static PyObject *
+_curses_delay_output(PyObject *module, PyObject *arg)
+{
+ PyObject *return_value = NULL;
+ int ms;
+
+ if (!PyArg_Parse(arg, "i:delay_output", &ms)) {
+ goto exit;
+ }
+ return_value = _curses_delay_output_impl(module, ms);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_curses_doupdate__doc__,
+"doupdate($module, /)\n"
+"--\n"
+"\n"
+"Update the physical screen to match the virtual screen.");
+
+#define _CURSES_DOUPDATE_METHODDEF \
+ {"doupdate", (PyCFunction)_curses_doupdate, METH_NOARGS, _curses_doupdate__doc__},
+
+static PyObject *
+_curses_doupdate_impl(PyObject *module);
+
+static PyObject *
+_curses_doupdate(PyObject *module, PyObject *Py_UNUSED(ignored))
+{
+ return _curses_doupdate_impl(module);
+}
+
+PyDoc_STRVAR(_curses_echo__doc__,
+"echo($module, flag=True, /)\n"
+"--\n"
+"\n"
+"Enter echo mode.\n"
+"\n"
+" flag\n"
+" If false, the effect is the same as calling noecho().\n"
+"\n"
+"In echo mode, each character input is echoed to the screen as it is entered.");
+
+#define _CURSES_ECHO_METHODDEF \
+ {"echo", (PyCFunction)_curses_echo, METH_FASTCALL, _curses_echo__doc__},
+
+static PyObject *
+_curses_echo_impl(PyObject *module, int flag);
+
+static PyObject *
+_curses_echo(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
+{
+ PyObject *return_value = NULL;
+ int flag = 1;
+
+ if (!_PyArg_ParseStack(args, nargs, "|i:echo",
+ &flag)) {
+ goto exit;
+ }
+ return_value = _curses_echo_impl(module, flag);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_curses_endwin__doc__,
+"endwin($module, /)\n"
+"--\n"
+"\n"
+"De-initialize the library, and return terminal to normal status.");
+
+#define _CURSES_ENDWIN_METHODDEF \
+ {"endwin", (PyCFunction)_curses_endwin, METH_NOARGS, _curses_endwin__doc__},
+
+static PyObject *
+_curses_endwin_impl(PyObject *module);
+
+static PyObject *
+_curses_endwin(PyObject *module, PyObject *Py_UNUSED(ignored))
+{
+ return _curses_endwin_impl(module);
+}
+
+PyDoc_STRVAR(_curses_erasechar__doc__,
+"erasechar($module, /)\n"
+"--\n"
+"\n"
+"Return the user\'s current erase character.");
+
+#define _CURSES_ERASECHAR_METHODDEF \
+ {"erasechar", (PyCFunction)_curses_erasechar, METH_NOARGS, _curses_erasechar__doc__},
+
+static PyObject *
+_curses_erasechar_impl(PyObject *module);
+
+static PyObject *
+_curses_erasechar(PyObject *module, PyObject *Py_UNUSED(ignored))
+{
+ return _curses_erasechar_impl(module);
+}
+
+PyDoc_STRVAR(_curses_flash__doc__,
+"flash($module, /)\n"
+"--\n"
+"\n"
+"Flash the screen.\n"
+"\n"
+"That is, change it to reverse-video and then change it back in a short interval.");
+
+#define _CURSES_FLASH_METHODDEF \
+ {"flash", (PyCFunction)_curses_flash, METH_NOARGS, _curses_flash__doc__},
+
+static PyObject *
+_curses_flash_impl(PyObject *module);
+
+static PyObject *
+_curses_flash(PyObject *module, PyObject *Py_UNUSED(ignored))
+{
+ return _curses_flash_impl(module);
+}
+
+PyDoc_STRVAR(_curses_flushinp__doc__,
+"flushinp($module, /)\n"
+"--\n"
+"\n"
+"Flush all input buffers.\n"
+"\n"
+"This throws away any typeahead that has been typed by the user and has not\n"
+"yet been processed by the program.");
+
+#define _CURSES_FLUSHINP_METHODDEF \
+ {"flushinp", (PyCFunction)_curses_flushinp, METH_NOARGS, _curses_flushinp__doc__},
+
+static PyObject *
+_curses_flushinp_impl(PyObject *module);
+
+static PyObject *
+_curses_flushinp(PyObject *module, PyObject *Py_UNUSED(ignored))
+{
+ return _curses_flushinp_impl(module);
+}
+
+#if defined(getsyx)
+
+PyDoc_STRVAR(_curses_getsyx__doc__,
+"getsyx($module, /)\n"
+"--\n"
+"\n"
+"Return the current coordinates of the virtual screen cursor.\n"
+"\n"
+"Return a (y, x) tuple. If leaveok is currently true, return (-1, -1).");
+
+#define _CURSES_GETSYX_METHODDEF \
+ {"getsyx", (PyCFunction)_curses_getsyx, METH_NOARGS, _curses_getsyx__doc__},
+
+static PyObject *
+_curses_getsyx_impl(PyObject *module);
+
+static PyObject *
+_curses_getsyx(PyObject *module, PyObject *Py_UNUSED(ignored))
+{
+ return _curses_getsyx_impl(module);
+}
+
+#endif /* defined(getsyx) */
+
+#if defined(NCURSES_MOUSE_VERSION)
+
+PyDoc_STRVAR(_curses_getmouse__doc__,
+"getmouse($module, /)\n"
+"--\n"
+"\n"
+"Retrieve the queued mouse event.\n"
+"\n"
+"After getch() returns KEY_MOUSE to signal a mouse event, this function\n"
+"returns a 5-tuple (id, x, y, z, bstate).");
+
+#define _CURSES_GETMOUSE_METHODDEF \
+ {"getmouse", (PyCFunction)_curses_getmouse, METH_NOARGS, _curses_getmouse__doc__},
+
+static PyObject *
+_curses_getmouse_impl(PyObject *module);
+
+static PyObject *
+_curses_getmouse(PyObject *module, PyObject *Py_UNUSED(ignored))
+{
+ return _curses_getmouse_impl(module);
+}
+
+#endif /* defined(NCURSES_MOUSE_VERSION) */
+
+#if defined(NCURSES_MOUSE_VERSION)
+
+PyDoc_STRVAR(_curses_ungetmouse__doc__,
+"ungetmouse($module, id, x, y, z, bstate, /)\n"
+"--\n"
+"\n"
+"Push a KEY_MOUSE event onto the input queue.\n"
+"\n"
+"The following getmouse() will return the given state data.");
+
+#define _CURSES_UNGETMOUSE_METHODDEF \
+ {"ungetmouse", (PyCFunction)_curses_ungetmouse, METH_FASTCALL, _curses_ungetmouse__doc__},
+
+static PyObject *
+_curses_ungetmouse_impl(PyObject *module, short id, int x, int y, int z,
+ unsigned long bstate);
+
+static PyObject *
+_curses_ungetmouse(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
+{
+ PyObject *return_value = NULL;
+ short id;
+ int x;
+ int y;
+ int z;
+ unsigned long bstate;
+
+ if (!_PyArg_ParseStack(args, nargs, "hiiik:ungetmouse",
+ &id, &x, &y, &z, &bstate)) {
+ goto exit;
+ }
+ return_value = _curses_ungetmouse_impl(module, id, x, y, z, bstate);
+
+exit:
+ return return_value;
+}
+
+#endif /* defined(NCURSES_MOUSE_VERSION) */
+
+PyDoc_STRVAR(_curses_getwin__doc__,
+"getwin($module, file, /)\n"
+"--\n"
+"\n"
+"Read window related data stored in the file by an earlier putwin() call.\n"
+"\n"
+"The routine then creates and initializes a new window using that data,\n"
+"returning the new window object.");
+
+#define _CURSES_GETWIN_METHODDEF \
+ {"getwin", (PyCFunction)_curses_getwin, METH_O, _curses_getwin__doc__},
+
+PyDoc_STRVAR(_curses_halfdelay__doc__,
+"halfdelay($module, tenths, /)\n"
+"--\n"
+"\n"
+"Enter half-delay mode.\n"
+"\n"
+" tenths\n"
+" Maximal blocking delay in tenths of seconds (1 - 255).\n"
+"\n"
+"Use nocbreak() to leave half-delay mode.");
+
+#define _CURSES_HALFDELAY_METHODDEF \
+ {"halfdelay", (PyCFunction)_curses_halfdelay, METH_O, _curses_halfdelay__doc__},
+
+static PyObject *
+_curses_halfdelay_impl(PyObject *module, unsigned char tenths);
+
+static PyObject *
+_curses_halfdelay(PyObject *module, PyObject *arg)
+{
+ PyObject *return_value = NULL;
+ unsigned char tenths;
+
+ if (!PyArg_Parse(arg, "b:halfdelay", &tenths)) {
+ goto exit;
+ }
+ return_value = _curses_halfdelay_impl(module, tenths);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_curses_has_colors__doc__,
+"has_colors($module, /)\n"
+"--\n"
+"\n"
+"Return True if the terminal can display colors; otherwise, return False.");
+
+#define _CURSES_HAS_COLORS_METHODDEF \
+ {"has_colors", (PyCFunction)_curses_has_colors, METH_NOARGS, _curses_has_colors__doc__},
+
+static PyObject *
+_curses_has_colors_impl(PyObject *module);
+
+static PyObject *
+_curses_has_colors(PyObject *module, PyObject *Py_UNUSED(ignored))
+{
+ return _curses_has_colors_impl(module);
+}
+
+PyDoc_STRVAR(_curses_has_ic__doc__,
+"has_ic($module, /)\n"
+"--\n"
+"\n"
+"Return True if the terminal has insert- and delete-character capabilities.");
+
+#define _CURSES_HAS_IC_METHODDEF \
+ {"has_ic", (PyCFunction)_curses_has_ic, METH_NOARGS, _curses_has_ic__doc__},
+
+static PyObject *
+_curses_has_ic_impl(PyObject *module);
+
+static PyObject *
+_curses_has_ic(PyObject *module, PyObject *Py_UNUSED(ignored))
+{
+ return _curses_has_ic_impl(module);
+}
+
+PyDoc_STRVAR(_curses_has_il__doc__,
+"has_il($module, /)\n"
+"--\n"
+"\n"
+"Return True if the terminal has insert- and delete-line capabilities.");
+
+#define _CURSES_HAS_IL_METHODDEF \
+ {"has_il", (PyCFunction)_curses_has_il, METH_NOARGS, _curses_has_il__doc__},
+
+static PyObject *
+_curses_has_il_impl(PyObject *module);
+
+static PyObject *
+_curses_has_il(PyObject *module, PyObject *Py_UNUSED(ignored))
+{
+ return _curses_has_il_impl(module);
+}
+
+#if defined(HAVE_CURSES_HAS_KEY)
+
+PyDoc_STRVAR(_curses_has_key__doc__,
+"has_key($module, key, /)\n"
+"--\n"
+"\n"
+"Return True if the current terminal type recognizes a key with that value.\n"
+"\n"
+" key\n"
+" Key number.");
+
+#define _CURSES_HAS_KEY_METHODDEF \
+ {"has_key", (PyCFunction)_curses_has_key, METH_O, _curses_has_key__doc__},
+
+static PyObject *
+_curses_has_key_impl(PyObject *module, int key);
+
+static PyObject *
+_curses_has_key(PyObject *module, PyObject *arg)
+{
+ PyObject *return_value = NULL;
+ int key;
+
+ if (!PyArg_Parse(arg, "i:has_key", &key)) {
+ goto exit;
+ }
+ return_value = _curses_has_key_impl(module, key);
+
+exit:
+ return return_value;
+}
+
+#endif /* defined(HAVE_CURSES_HAS_KEY) */
+
+PyDoc_STRVAR(_curses_init_color__doc__,
+"init_color($module, color_number, r, g, b, /)\n"
+"--\n"
+"\n"
+"Change the definition of a color.\n"
+"\n"
+" color_number\n"
+" The number of the color to be changed (0 - COLORS).\n"
+" r\n"
+" Red component (0 - 1000).\n"
+" g\n"
+" Green component (0 - 1000).\n"
+" b\n"
+" Blue component (0 - 1000).\n"
+"\n"
+"When init_color() is used, all occurrences of that color on the screen\n"
+"immediately change to the new definition. This function is a no-op on\n"
+"most terminals; it is active only if can_change_color() returns 1.");
+
+#define _CURSES_INIT_COLOR_METHODDEF \
+ {"init_color", (PyCFunction)_curses_init_color, METH_FASTCALL, _curses_init_color__doc__},
+
+static PyObject *
+_curses_init_color_impl(PyObject *module, short color_number, short r,
+ short g, short b);
+
+static PyObject *
+_curses_init_color(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
+{
+ PyObject *return_value = NULL;
+ short color_number;
+ short r;
+ short g;
+ short b;
+
+ if (!_PyArg_ParseStack(args, nargs, "hhhh:init_color",
+ &color_number, &r, &g, &b)) {
+ goto exit;
+ }
+ return_value = _curses_init_color_impl(module, color_number, r, g, b);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_curses_init_pair__doc__,
+"init_pair($module, pair_number, fg, bg, /)\n"
+"--\n"
+"\n"
+"Change the definition of a color-pair.\n"
+"\n"
+" pair_number\n"
+" The number of the color-pair to be changed (1 - (COLOR_PAIRS-1)).\n"
+" fg\n"
+" Foreground color number (0 - COLORS).\n"
+" bg\n"
+" Background color number (0 - COLORS).\n"
+"\n"
+"If the color-pair was previously initialized, the screen is refreshed and\n"
+"all occurrences of that color-pair are changed to the new definition.");
+
+#define _CURSES_INIT_PAIR_METHODDEF \
+ {"init_pair", (PyCFunction)_curses_init_pair, METH_FASTCALL, _curses_init_pair__doc__},
+
+static PyObject *
+_curses_init_pair_impl(PyObject *module, short pair_number, short fg,
+ short bg);
+
+static PyObject *
+_curses_init_pair(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
+{
+ PyObject *return_value = NULL;
+ short pair_number;
+ short fg;
+ short bg;
+
+ if (!_PyArg_ParseStack(args, nargs, "hhh:init_pair",
+ &pair_number, &fg, &bg)) {
+ goto exit;
+ }
+ return_value = _curses_init_pair_impl(module, pair_number, fg, bg);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_curses_initscr__doc__,
+"initscr($module, /)\n"
+"--\n"
+"\n"
+"Initialize the library.\n"
+"\n"
+"Return a WindowObject which represents the whole screen.");
+
+#define _CURSES_INITSCR_METHODDEF \
+ {"initscr", (PyCFunction)_curses_initscr, METH_NOARGS, _curses_initscr__doc__},
+
+static PyObject *
+_curses_initscr_impl(PyObject *module);
+
+static PyObject *
+_curses_initscr(PyObject *module, PyObject *Py_UNUSED(ignored))
+{
+ return _curses_initscr_impl(module);
+}
+
+PyDoc_STRVAR(_curses_setupterm__doc__,
+"setupterm($module, /, term=None, fd=-1)\n"
+"--\n"
+"\n"
+"Initialize the terminal.\n"
+"\n"
+" term\n"
+" Terminal name.\n"
+" If omitted, the value of the TERM environment variable will be used.\n"
+" fd\n"
+" File descriptor to which any initialization sequences will be sent.\n"
+" If not supplied, the file descriptor for sys.stdout will be used.");
+
+#define _CURSES_SETUPTERM_METHODDEF \
+ {"setupterm", (PyCFunction)_curses_setupterm, METH_FASTCALL|METH_KEYWORDS, _curses_setupterm__doc__},
+
+static PyObject *
+_curses_setupterm_impl(PyObject *module, const char *term, int fd);
+
+static PyObject *
+_curses_setupterm(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
+{
+ PyObject *return_value = NULL;
+ static const char * const _keywords[] = {"term", "fd", NULL};
+ static _PyArg_Parser _parser = {"|zi:setupterm", _keywords, 0};
+ const char *term = NULL;
+ int fd = -1;
+
+ if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
+ &term, &fd)) {
+ goto exit;
+ }
+ return_value = _curses_setupterm_impl(module, term, fd);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_curses_intrflush__doc__,
+"intrflush($module, flag, /)\n"
+"--\n"
+"\n");
+
+#define _CURSES_INTRFLUSH_METHODDEF \
+ {"intrflush", (PyCFunction)_curses_intrflush, METH_O, _curses_intrflush__doc__},
+
+static PyObject *
+_curses_intrflush_impl(PyObject *module, int flag);
+
+static PyObject *
+_curses_intrflush(PyObject *module, PyObject *arg)
+{
+ PyObject *return_value = NULL;
+ int flag;
+
+ if (!PyArg_Parse(arg, "i:intrflush", &flag)) {
+ goto exit;
+ }
+ return_value = _curses_intrflush_impl(module, flag);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_curses_isendwin__doc__,
+"isendwin($module, /)\n"
+"--\n"
+"\n"
+"Return True if endwin() has been called.");
+
+#define _CURSES_ISENDWIN_METHODDEF \
+ {"isendwin", (PyCFunction)_curses_isendwin, METH_NOARGS, _curses_isendwin__doc__},
+
+static PyObject *
+_curses_isendwin_impl(PyObject *module);
+
+static PyObject *
+_curses_isendwin(PyObject *module, PyObject *Py_UNUSED(ignored))
+{
+ return _curses_isendwin_impl(module);
+}
+
+#if defined(HAVE_CURSES_IS_TERM_RESIZED)
+
+PyDoc_STRVAR(_curses_is_term_resized__doc__,
+"is_term_resized($module, nlines, ncols, /)\n"
+"--\n"
+"\n"
+"Return True if resize_term() would modify the window structure, False otherwise.\n"
+"\n"
+" nlines\n"
+" Height.\n"
+" ncols\n"
+" Width.");
+
+#define _CURSES_IS_TERM_RESIZED_METHODDEF \
+ {"is_term_resized", (PyCFunction)_curses_is_term_resized, METH_FASTCALL, _curses_is_term_resized__doc__},
+
+static PyObject *
+_curses_is_term_resized_impl(PyObject *module, int nlines, int ncols);
+
+static PyObject *
+_curses_is_term_resized(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
+{
+ PyObject *return_value = NULL;
+ int nlines;
+ int ncols;
+
+ if (!_PyArg_ParseStack(args, nargs, "ii:is_term_resized",
+ &nlines, &ncols)) {
+ goto exit;
+ }
+ return_value = _curses_is_term_resized_impl(module, nlines, ncols);
+
+exit:
+ return return_value;
+}
+
+#endif /* defined(HAVE_CURSES_IS_TERM_RESIZED) */
+
+PyDoc_STRVAR(_curses_keyname__doc__,
+"keyname($module, key, /)\n"
+"--\n"
+"\n"
+"Return the name of specified key.\n"
+"\n"
+" key\n"
+" Key number.");
+
+#define _CURSES_KEYNAME_METHODDEF \
+ {"keyname", (PyCFunction)_curses_keyname, METH_O, _curses_keyname__doc__},
+
+static PyObject *
+_curses_keyname_impl(PyObject *module, int key);
+
+static PyObject *
+_curses_keyname(PyObject *module, PyObject *arg)
+{
+ PyObject *return_value = NULL;
+ int key;
+
+ if (!PyArg_Parse(arg, "i:keyname", &key)) {
+ goto exit;
+ }
+ return_value = _curses_keyname_impl(module, key);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_curses_killchar__doc__,
+"killchar($module, /)\n"
+"--\n"
+"\n"
+"Return the user\'s current line kill character.");
+
+#define _CURSES_KILLCHAR_METHODDEF \
+ {"killchar", (PyCFunction)_curses_killchar, METH_NOARGS, _curses_killchar__doc__},
+
+static PyObject *
+_curses_killchar_impl(PyObject *module);
+
+static PyObject *
+_curses_killchar(PyObject *module, PyObject *Py_UNUSED(ignored))
+{
+ return _curses_killchar_impl(module);
+}
+
+PyDoc_STRVAR(_curses_longname__doc__,
+"longname($module, /)\n"
+"--\n"
+"\n"
+"Return the terminfo long name field describing the current terminal.\n"
+"\n"
+"The maximum length of a verbose description is 128 characters. It is defined\n"
+"only after the call to initscr().");
+
+#define _CURSES_LONGNAME_METHODDEF \
+ {"longname", (PyCFunction)_curses_longname, METH_NOARGS, _curses_longname__doc__},
+
+static PyObject *
+_curses_longname_impl(PyObject *module);
+
+static PyObject *
+_curses_longname(PyObject *module, PyObject *Py_UNUSED(ignored))
+{
+ return _curses_longname_impl(module);
+}
+
+PyDoc_STRVAR(_curses_meta__doc__,
+"meta($module, yes, /)\n"
+"--\n"
+"\n"
+"Enable/disable meta keys.\n"
+"\n"
+"If yes is True, allow 8-bit characters to be input. If yes is False,\n"
+"allow only 7-bit characters.");
+
+#define _CURSES_META_METHODDEF \
+ {"meta", (PyCFunction)_curses_meta, METH_O, _curses_meta__doc__},
+
+static PyObject *
+_curses_meta_impl(PyObject *module, int yes);
+
+static PyObject *
+_curses_meta(PyObject *module, PyObject *arg)
+{
+ PyObject *return_value = NULL;
+ int yes;
+
+ if (!PyArg_Parse(arg, "i:meta", &yes)) {
+ goto exit;
+ }
+ return_value = _curses_meta_impl(module, yes);
+
+exit:
+ return return_value;
+}
+
+#if defined(NCURSES_MOUSE_VERSION)
+
+PyDoc_STRVAR(_curses_mouseinterval__doc__,
+"mouseinterval($module, interval, /)\n"
+"--\n"
+"\n"
+"Set and retrieve the maximum time between press and release in a click.\n"
+"\n"
+" interval\n"
+" Time in milliseconds.\n"
+"\n"
+"Set the maximum time that can elapse between press and release events in\n"
+"order for them to be recognized as a click, and return the previous interval\n"
+"value.");
+
+#define _CURSES_MOUSEINTERVAL_METHODDEF \
+ {"mouseinterval", (PyCFunction)_curses_mouseinterval, METH_O, _curses_mouseinterval__doc__},
+
+static PyObject *
+_curses_mouseinterval_impl(PyObject *module, int interval);
+
+static PyObject *
+_curses_mouseinterval(PyObject *module, PyObject *arg)
+{
+ PyObject *return_value = NULL;
+ int interval;
+
+ if (!PyArg_Parse(arg, "i:mouseinterval", &interval)) {
+ goto exit;
+ }
+ return_value = _curses_mouseinterval_impl(module, interval);
+
+exit:
+ return return_value;
+}
+
+#endif /* defined(NCURSES_MOUSE_VERSION) */
+
+#if defined(NCURSES_MOUSE_VERSION)
+
+PyDoc_STRVAR(_curses_mousemask__doc__,
+"mousemask($module, newmask, /)\n"
+"--\n"
+"\n"
+"Set the mouse events to be reported, and return a tuple (availmask, oldmask).\n"
+"\n"
+"Return a tuple (availmask, oldmask). availmask indicates which of the\n"
+"specified mouse events can be reported; on complete failure it returns 0.\n"
+"oldmask is the previous value of the given window\'s mouse event mask.\n"
+"If this function is never called, no mouse events are ever reported.");
+
+#define _CURSES_MOUSEMASK_METHODDEF \
+ {"mousemask", (PyCFunction)_curses_mousemask, METH_O, _curses_mousemask__doc__},
+
+static PyObject *
+_curses_mousemask_impl(PyObject *module, unsigned long newmask);
+
+static PyObject *
+_curses_mousemask(PyObject *module, PyObject *arg)
+{
+ PyObject *return_value = NULL;
+ unsigned long newmask;
+
+ if (!PyArg_Parse(arg, "k:mousemask", &newmask)) {
+ goto exit;
+ }
+ return_value = _curses_mousemask_impl(module, newmask);
+
+exit:
+ return return_value;
+}
+
+#endif /* defined(NCURSES_MOUSE_VERSION) */
+
+PyDoc_STRVAR(_curses_napms__doc__,
+"napms($module, ms, /)\n"
+"--\n"
+"\n"
+"Sleep for specified time.\n"
+"\n"
+" ms\n"
+" Duration in milliseconds.");
+
+#define _CURSES_NAPMS_METHODDEF \
+ {"napms", (PyCFunction)_curses_napms, METH_O, _curses_napms__doc__},
+
+static PyObject *
+_curses_napms_impl(PyObject *module, int ms);
+
+static PyObject *
+_curses_napms(PyObject *module, PyObject *arg)
+{
+ PyObject *return_value = NULL;
+ int ms;
+
+ if (!PyArg_Parse(arg, "i:napms", &ms)) {
+ goto exit;
+ }
+ return_value = _curses_napms_impl(module, ms);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_curses_newpad__doc__,
+"newpad($module, nlines, ncols, /)\n"
+"--\n"
+"\n"
+"Create and return a pointer to a new pad data structure.\n"
+"\n"
+" nlines\n"
+" Height.\n"
+" ncols\n"
+" Width.");
+
+#define _CURSES_NEWPAD_METHODDEF \
+ {"newpad", (PyCFunction)_curses_newpad, METH_FASTCALL, _curses_newpad__doc__},
+
+static PyObject *
+_curses_newpad_impl(PyObject *module, int nlines, int ncols);
+
+static PyObject *
+_curses_newpad(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
+{
+ PyObject *return_value = NULL;
+ int nlines;
+ int ncols;
+
+ if (!_PyArg_ParseStack(args, nargs, "ii:newpad",
+ &nlines, &ncols)) {
+ goto exit;
+ }
+ return_value = _curses_newpad_impl(module, nlines, ncols);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_curses_newwin__doc__,
+"newwin(nlines, ncols, [begin_y=0, begin_x=0])\n"
+"Return a new window.\n"
+"\n"
+" nlines\n"
+" Height.\n"
+" ncols\n"
+" Width.\n"
+" begin_y\n"
+" Top side y-coordinate.\n"
+" begin_x\n"
+" Left side x-coordinate.\n"
+"\n"
+"By default, the window will extend from the specified position to the lower\n"
+"right corner of the screen.");
+
+#define _CURSES_NEWWIN_METHODDEF \
+ {"newwin", (PyCFunction)_curses_newwin, METH_VARARGS, _curses_newwin__doc__},
+
+static PyObject *
+_curses_newwin_impl(PyObject *module, int nlines, int ncols,
+ int group_right_1, int begin_y, int begin_x);
+
+static PyObject *
+_curses_newwin(PyObject *module, PyObject *args)
+{
+ PyObject *return_value = NULL;
+ int nlines;
+ int ncols;
+ int group_right_1 = 0;
+ int begin_y = 0;
+ int begin_x = 0;
+
+ switch (PyTuple_GET_SIZE(args)) {
+ case 2:
+ if (!PyArg_ParseTuple(args, "ii:newwin", &nlines, &ncols)) {
+ goto exit;
+ }
+ break;
+ case 4:
+ if (!PyArg_ParseTuple(args, "iiii:newwin", &nlines, &ncols, &begin_y, &begin_x)) {
+ goto exit;
+ }
+ group_right_1 = 1;
+ break;
+ default:
+ PyErr_SetString(PyExc_TypeError, "_curses.newwin requires 2 to 4 arguments");
+ goto exit;
+ }
+ return_value = _curses_newwin_impl(module, nlines, ncols, group_right_1, begin_y, begin_x);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_curses_nl__doc__,
+"nl($module, flag=True, /)\n"
+"--\n"
+"\n"
+"Enter newline mode.\n"
+"\n"
+" flag\n"
+" If false, the effect is the same as calling nonl().\n"
+"\n"
+"This mode translates the return key into newline on input, and translates\n"
+"newline into return and line-feed on output. Newline mode is initially on.");
+
+#define _CURSES_NL_METHODDEF \
+ {"nl", (PyCFunction)_curses_nl, METH_FASTCALL, _curses_nl__doc__},
+
+static PyObject *
+_curses_nl_impl(PyObject *module, int flag);
+
+static PyObject *
+_curses_nl(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
+{
+ PyObject *return_value = NULL;
+ int flag = 1;
+
+ if (!_PyArg_ParseStack(args, nargs, "|i:nl",
+ &flag)) {
+ goto exit;
+ }
+ return_value = _curses_nl_impl(module, flag);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_curses_nocbreak__doc__,
+"nocbreak($module, /)\n"
+"--\n"
+"\n"
+"Leave cbreak mode.\n"
+"\n"
+"Return to normal \"cooked\" mode with line buffering.");
+
+#define _CURSES_NOCBREAK_METHODDEF \
+ {"nocbreak", (PyCFunction)_curses_nocbreak, METH_NOARGS, _curses_nocbreak__doc__},
+
+static PyObject *
+_curses_nocbreak_impl(PyObject *module);
+
+static PyObject *
+_curses_nocbreak(PyObject *module, PyObject *Py_UNUSED(ignored))
+{
+ return _curses_nocbreak_impl(module);
+}
+
+PyDoc_STRVAR(_curses_noecho__doc__,
+"noecho($module, /)\n"
+"--\n"
+"\n"
+"Leave echo mode.\n"
+"\n"
+"Echoing of input characters is turned off.");
+
+#define _CURSES_NOECHO_METHODDEF \
+ {"noecho", (PyCFunction)_curses_noecho, METH_NOARGS, _curses_noecho__doc__},
+
+static PyObject *
+_curses_noecho_impl(PyObject *module);
+
+static PyObject *
+_curses_noecho(PyObject *module, PyObject *Py_UNUSED(ignored))
+{
+ return _curses_noecho_impl(module);
+}
+
+PyDoc_STRVAR(_curses_nonl__doc__,
+"nonl($module, /)\n"
+"--\n"
+"\n"
+"Leave newline mode.\n"
+"\n"
+"Disable translation of return into newline on input, and disable low-level\n"
+"translation of newline into newline/return on output.");
+
+#define _CURSES_NONL_METHODDEF \
+ {"nonl", (PyCFunction)_curses_nonl, METH_NOARGS, _curses_nonl__doc__},
+
+static PyObject *
+_curses_nonl_impl(PyObject *module);
+
+static PyObject *
+_curses_nonl(PyObject *module, PyObject *Py_UNUSED(ignored))
+{
+ return _curses_nonl_impl(module);
+}
+
+PyDoc_STRVAR(_curses_noqiflush__doc__,
+"noqiflush($module, /)\n"
+"--\n"
+"\n"
+"Disable queue flushing.\n"
+"\n"
+"When queue flushing is disabled, normal flush of input and output queues\n"
+"associated with the INTR, QUIT and SUSP characters will not be done.");
+
+#define _CURSES_NOQIFLUSH_METHODDEF \
+ {"noqiflush", (PyCFunction)_curses_noqiflush, METH_NOARGS, _curses_noqiflush__doc__},
+
+static PyObject *
+_curses_noqiflush_impl(PyObject *module);
+
+static PyObject *
+_curses_noqiflush(PyObject *module, PyObject *Py_UNUSED(ignored))
+{
+ return _curses_noqiflush_impl(module);
+}
+
+PyDoc_STRVAR(_curses_noraw__doc__,
+"noraw($module, /)\n"
+"--\n"
+"\n"
+"Leave raw mode.\n"
+"\n"
+"Return to normal \"cooked\" mode with line buffering.");
+
+#define _CURSES_NORAW_METHODDEF \
+ {"noraw", (PyCFunction)_curses_noraw, METH_NOARGS, _curses_noraw__doc__},
+
+static PyObject *
+_curses_noraw_impl(PyObject *module);
+
+static PyObject *
+_curses_noraw(PyObject *module, PyObject *Py_UNUSED(ignored))
+{
+ return _curses_noraw_impl(module);
+}
+
+PyDoc_STRVAR(_curses_pair_content__doc__,
+"pair_content($module, pair_number, /)\n"
+"--\n"
+"\n"
+"Return a tuple (fg, bg) containing the colors for the requested color pair.\n"
+"\n"
+" pair_number\n"
+" The number of the color pair (1 - (COLOR_PAIRS-1)).");
+
+#define _CURSES_PAIR_CONTENT_METHODDEF \
+ {"pair_content", (PyCFunction)_curses_pair_content, METH_O, _curses_pair_content__doc__},
+
+static PyObject *
+_curses_pair_content_impl(PyObject *module, short pair_number);
+
+static PyObject *
+_curses_pair_content(PyObject *module, PyObject *arg)
+{
+ PyObject *return_value = NULL;
+ short pair_number;
+
+ if (!PyArg_Parse(arg, "h:pair_content", &pair_number)) {
+ goto exit;
+ }
+ return_value = _curses_pair_content_impl(module, pair_number);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_curses_pair_number__doc__,
+"pair_number($module, attr, /)\n"
+"--\n"
+"\n"
+"Return the number of the color-pair set by the specified attribute value.\n"
+"\n"
+"color_pair() is the counterpart to this function.");
+
+#define _CURSES_PAIR_NUMBER_METHODDEF \
+ {"pair_number", (PyCFunction)_curses_pair_number, METH_O, _curses_pair_number__doc__},
+
+static PyObject *
+_curses_pair_number_impl(PyObject *module, int attr);
+
+static PyObject *
+_curses_pair_number(PyObject *module, PyObject *arg)
+{
+ PyObject *return_value = NULL;
+ int attr;
+
+ if (!PyArg_Parse(arg, "i:pair_number", &attr)) {
+ goto exit;
+ }
+ return_value = _curses_pair_number_impl(module, attr);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_curses_putp__doc__,
+"putp($module, string, /)\n"
+"--\n"
+"\n"
+"Emit the value of a specified terminfo capability for the current terminal.\n"
+"\n"
+"Note that the output of putp() always goes to standard output.");
+
+#define _CURSES_PUTP_METHODDEF \
+ {"putp", (PyCFunction)_curses_putp, METH_O, _curses_putp__doc__},
+
+static PyObject *
+_curses_putp_impl(PyObject *module, const char *string);
+
+static PyObject *
+_curses_putp(PyObject *module, PyObject *arg)
+{
+ PyObject *return_value = NULL;
+ const char *string;
+
+ if (!PyArg_Parse(arg, "y:putp", &string)) {
+ goto exit;
+ }
+ return_value = _curses_putp_impl(module, string);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_curses_qiflush__doc__,
+"qiflush($module, flag=True, /)\n"
+"--\n"
+"\n"
+"Enable queue flushing.\n"
+"\n"
+" flag\n"
+" If false, the effect is the same as calling noqiflush().\n"
+"\n"
+"If queue flushing is enabled, all output in the display driver queue\n"
+"will be flushed when the INTR, QUIT and SUSP characters are read.");
+
+#define _CURSES_QIFLUSH_METHODDEF \
+ {"qiflush", (PyCFunction)_curses_qiflush, METH_FASTCALL, _curses_qiflush__doc__},
+
+static PyObject *
+_curses_qiflush_impl(PyObject *module, int flag);
+
+static PyObject *
+_curses_qiflush(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
+{
+ PyObject *return_value = NULL;
+ int flag = 1;
+
+ if (!_PyArg_ParseStack(args, nargs, "|i:qiflush",
+ &flag)) {
+ goto exit;
+ }
+ return_value = _curses_qiflush_impl(module, flag);
+
+exit:
+ return return_value;
+}
+
+#if (defined(HAVE_CURSES_RESIZETERM) || defined(HAVE_CURSES_RESIZE_TERM))
+
+PyDoc_STRVAR(_curses_update_lines_cols__doc__,
+"update_lines_cols($module, /)\n"
+"--\n"
+"\n");
+
+#define _CURSES_UPDATE_LINES_COLS_METHODDEF \
+ {"update_lines_cols", (PyCFunction)_curses_update_lines_cols, METH_NOARGS, _curses_update_lines_cols__doc__},
+
+static int
+_curses_update_lines_cols_impl(PyObject *module);
+
+static PyObject *
+_curses_update_lines_cols(PyObject *module, PyObject *Py_UNUSED(ignored))
+{
+ PyObject *return_value = NULL;
+ int _return_value;
+
+ _return_value = _curses_update_lines_cols_impl(module);
+ if ((_return_value == -1) && PyErr_Occurred()) {
+ goto exit;
+ }
+ return_value = PyLong_FromLong((long)_return_value);
+
+exit:
+ return return_value;
+}
+
+#endif /* (defined(HAVE_CURSES_RESIZETERM) || defined(HAVE_CURSES_RESIZE_TERM)) */
+
+PyDoc_STRVAR(_curses_raw__doc__,
+"raw($module, flag=True, /)\n"
+"--\n"
+"\n"
+"Enter raw mode.\n"
+"\n"
+" flag\n"
+" If false, the effect is the same as calling noraw().\n"
+"\n"
+"In raw mode, normal line buffering and processing of interrupt, quit,\n"
+"suspend, and flow control keys are turned off; characters are presented to\n"
+"curses input functions one by one.");
+
+#define _CURSES_RAW_METHODDEF \
+ {"raw", (PyCFunction)_curses_raw, METH_FASTCALL, _curses_raw__doc__},
+
+static PyObject *
+_curses_raw_impl(PyObject *module, int flag);
+
+static PyObject *
+_curses_raw(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
+{
+ PyObject *return_value = NULL;
+ int flag = 1;
+
+ if (!_PyArg_ParseStack(args, nargs, "|i:raw",
+ &flag)) {
+ goto exit;
+ }
+ return_value = _curses_raw_impl(module, flag);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_curses_reset_prog_mode__doc__,
+"reset_prog_mode($module, /)\n"
+"--\n"
+"\n"
+"Restore the terminal to \"program\" mode, as previously saved by def_prog_mode().");
+
+#define _CURSES_RESET_PROG_MODE_METHODDEF \
+ {"reset_prog_mode", (PyCFunction)_curses_reset_prog_mode, METH_NOARGS, _curses_reset_prog_mode__doc__},
+
+static PyObject *
+_curses_reset_prog_mode_impl(PyObject *module);
+
+static PyObject *
+_curses_reset_prog_mode(PyObject *module, PyObject *Py_UNUSED(ignored))
+{
+ return _curses_reset_prog_mode_impl(module);
+}
+
+PyDoc_STRVAR(_curses_reset_shell_mode__doc__,
+"reset_shell_mode($module, /)\n"
+"--\n"
+"\n"
+"Restore the terminal to \"shell\" mode, as previously saved by def_shell_mode().");
+
+#define _CURSES_RESET_SHELL_MODE_METHODDEF \
+ {"reset_shell_mode", (PyCFunction)_curses_reset_shell_mode, METH_NOARGS, _curses_reset_shell_mode__doc__},
+
+static PyObject *
+_curses_reset_shell_mode_impl(PyObject *module);
+
+static PyObject *
+_curses_reset_shell_mode(PyObject *module, PyObject *Py_UNUSED(ignored))
+{
+ return _curses_reset_shell_mode_impl(module);
+}
+
+PyDoc_STRVAR(_curses_resetty__doc__,
+"resetty($module, /)\n"
+"--\n"
+"\n"
+"Restore terminal mode.");
+
+#define _CURSES_RESETTY_METHODDEF \
+ {"resetty", (PyCFunction)_curses_resetty, METH_NOARGS, _curses_resetty__doc__},
+
+static PyObject *
+_curses_resetty_impl(PyObject *module);
+
+static PyObject *
+_curses_resetty(PyObject *module, PyObject *Py_UNUSED(ignored))
+{
+ return _curses_resetty_impl(module);
+}
+
+#if defined(HAVE_CURSES_RESIZETERM)
+
+PyDoc_STRVAR(_curses_resizeterm__doc__,
+"resizeterm($module, nlines, ncols, /)\n"
+"--\n"
+"\n"
+"Resize the standard and current windows to the specified dimensions.\n"
+"\n"
+" nlines\n"
+" Height.\n"
+" ncols\n"
+" Width.\n"
+"\n"
+"Adjusts other bookkeeping data used by the curses library that record the\n"
+"window dimensions (in particular the SIGWINCH handler).");
+
+#define _CURSES_RESIZETERM_METHODDEF \
+ {"resizeterm", (PyCFunction)_curses_resizeterm, METH_FASTCALL, _curses_resizeterm__doc__},
+
+static PyObject *
+_curses_resizeterm_impl(PyObject *module, int nlines, int ncols);
+
+static PyObject *
+_curses_resizeterm(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
+{
+ PyObject *return_value = NULL;
+ int nlines;
+ int ncols;
+
+ if (!_PyArg_ParseStack(args, nargs, "ii:resizeterm",
+ &nlines, &ncols)) {
+ goto exit;
+ }
+ return_value = _curses_resizeterm_impl(module, nlines, ncols);
+
+exit:
+ return return_value;
+}
+
+#endif /* defined(HAVE_CURSES_RESIZETERM) */
+
+#if defined(HAVE_CURSES_RESIZE_TERM)
+
+PyDoc_STRVAR(_curses_resize_term__doc__,
+"resize_term($module, nlines, ncols, /)\n"
+"--\n"
+"\n"
+"Backend function used by resizeterm(), performing most of the work.\n"
+"\n"
+" nlines\n"
+" Height.\n"
+" ncols\n"
+" Width.\n"
+"\n"
+"When resizing the windows, resize_term() blank-fills the areas that are\n"
+"extended. The calling application should fill in these areas with appropriate\n"
+"data. The resize_term() function attempts to resize all windows. However,\n"
+"due to the calling convention of pads, it is not possible to resize these\n"
+"without additional interaction with the application.");
+
+#define _CURSES_RESIZE_TERM_METHODDEF \
+ {"resize_term", (PyCFunction)_curses_resize_term, METH_FASTCALL, _curses_resize_term__doc__},
+
+static PyObject *
+_curses_resize_term_impl(PyObject *module, int nlines, int ncols);
+
+static PyObject *
+_curses_resize_term(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
+{
+ PyObject *return_value = NULL;
+ int nlines;
+ int ncols;
+
+ if (!_PyArg_ParseStack(args, nargs, "ii:resize_term",
+ &nlines, &ncols)) {
+ goto exit;
+ }
+ return_value = _curses_resize_term_impl(module, nlines, ncols);
+
+exit:
+ return return_value;
+}
+
+#endif /* defined(HAVE_CURSES_RESIZE_TERM) */
+
+PyDoc_STRVAR(_curses_savetty__doc__,
+"savetty($module, /)\n"
+"--\n"
+"\n"
+"Save terminal mode.");
+
+#define _CURSES_SAVETTY_METHODDEF \
+ {"savetty", (PyCFunction)_curses_savetty, METH_NOARGS, _curses_savetty__doc__},
+
+static PyObject *
+_curses_savetty_impl(PyObject *module);
+
+static PyObject *
+_curses_savetty(PyObject *module, PyObject *Py_UNUSED(ignored))
+{
+ return _curses_savetty_impl(module);
+}
+
+#if defined(getsyx)
+
+PyDoc_STRVAR(_curses_setsyx__doc__,
+"setsyx($module, y, x, /)\n"
+"--\n"
+"\n"
+"Set the virtual screen cursor.\n"
+"\n"
+" y\n"
+" Y-coordinate.\n"
+" x\n"
+" X-coordinate.\n"
+"\n"
+"If y and x are both -1, then leaveok is set.");
+
+#define _CURSES_SETSYX_METHODDEF \
+ {"setsyx", (PyCFunction)_curses_setsyx, METH_FASTCALL, _curses_setsyx__doc__},
+
+static PyObject *
+_curses_setsyx_impl(PyObject *module, int y, int x);
+
+static PyObject *
+_curses_setsyx(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
+{
+ PyObject *return_value = NULL;
+ int y;
+ int x;
+
+ if (!_PyArg_ParseStack(args, nargs, "ii:setsyx",
+ &y, &x)) {
+ goto exit;
+ }
+ return_value = _curses_setsyx_impl(module, y, x);
+
+exit:
+ return return_value;
+}
+
+#endif /* defined(getsyx) */
+
+PyDoc_STRVAR(_curses_start_color__doc__,
+"start_color($module, /)\n"
+"--\n"
+"\n"
+"Initializes eight basic colors and global variables COLORS and COLOR_PAIRS.\n"
+"\n"
+"Must be called if the programmer wants to use colors, and before any other\n"
+"color manipulation routine is called. It is good practice to call this\n"
+"routine right after initscr().\n"
+"\n"
+"It also restores the colors on the terminal to the values they had when the\n"
+"terminal was just turned on.");
+
+#define _CURSES_START_COLOR_METHODDEF \
+ {"start_color", (PyCFunction)_curses_start_color, METH_NOARGS, _curses_start_color__doc__},
+
+static PyObject *
+_curses_start_color_impl(PyObject *module);
+
+static PyObject *
+_curses_start_color(PyObject *module, PyObject *Py_UNUSED(ignored))
+{
+ return _curses_start_color_impl(module);
+}
+
+PyDoc_STRVAR(_curses_termattrs__doc__,
+"termattrs($module, /)\n"
+"--\n"
+"\n"
+"Return a logical OR of all video attributes supported by the terminal.");
+
+#define _CURSES_TERMATTRS_METHODDEF \
+ {"termattrs", (PyCFunction)_curses_termattrs, METH_NOARGS, _curses_termattrs__doc__},
+
+static PyObject *
+_curses_termattrs_impl(PyObject *module);
+
+static PyObject *
+_curses_termattrs(PyObject *module, PyObject *Py_UNUSED(ignored))
+{
+ return _curses_termattrs_impl(module);
+}
+
+PyDoc_STRVAR(_curses_termname__doc__,
+"termname($module, /)\n"
+"--\n"
+"\n"
+"Return the value of the environment variable TERM, truncated to 14 characters.");
+
+#define _CURSES_TERMNAME_METHODDEF \
+ {"termname", (PyCFunction)_curses_termname, METH_NOARGS, _curses_termname__doc__},
+
+static PyObject *
+_curses_termname_impl(PyObject *module);
+
+static PyObject *
+_curses_termname(PyObject *module, PyObject *Py_UNUSED(ignored))
+{
+ return _curses_termname_impl(module);
+}
+
+PyDoc_STRVAR(_curses_tigetflag__doc__,
+"tigetflag($module, capname, /)\n"
+"--\n"
+"\n"
+"Return the value of the Boolean capability.\n"
+"\n"
+" capname\n"
+" The terminfo capability name.\n"
+"\n"
+"The value -1 is returned if capname is not a Boolean capability, or 0 if\n"
+"it is canceled or absent from the terminal description.");
+
+#define _CURSES_TIGETFLAG_METHODDEF \
+ {"tigetflag", (PyCFunction)_curses_tigetflag, METH_O, _curses_tigetflag__doc__},
+
+static PyObject *
+_curses_tigetflag_impl(PyObject *module, const char *capname);
+
+static PyObject *
+_curses_tigetflag(PyObject *module, PyObject *arg)
+{
+ PyObject *return_value = NULL;
+ const char *capname;
+
+ if (!PyArg_Parse(arg, "s:tigetflag", &capname)) {
+ goto exit;
+ }
+ return_value = _curses_tigetflag_impl(module, capname);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_curses_tigetnum__doc__,
+"tigetnum($module, capname, /)\n"
+"--\n"
+"\n"
+"Return the value of the numeric capability.\n"
+"\n"
+" capname\n"
+" The terminfo capability name.\n"
+"\n"
+"The value -2 is returned if capname is not a numeric capability, or -1 if\n"
+"it is canceled or absent from the terminal description.");
+
+#define _CURSES_TIGETNUM_METHODDEF \
+ {"tigetnum", (PyCFunction)_curses_tigetnum, METH_O, _curses_tigetnum__doc__},
+
+static PyObject *
+_curses_tigetnum_impl(PyObject *module, const char *capname);
+
+static PyObject *
+_curses_tigetnum(PyObject *module, PyObject *arg)
+{
+ PyObject *return_value = NULL;
+ const char *capname;
+
+ if (!PyArg_Parse(arg, "s:tigetnum", &capname)) {
+ goto exit;
+ }
+ return_value = _curses_tigetnum_impl(module, capname);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_curses_tigetstr__doc__,
+"tigetstr($module, capname, /)\n"
+"--\n"
+"\n"
+"Return the value of the string capability.\n"
+"\n"
+" capname\n"
+" The terminfo capability name.\n"
+"\n"
+"None is returned if capname is not a string capability, or is canceled or\n"
+"absent from the terminal description.");
+
+#define _CURSES_TIGETSTR_METHODDEF \
+ {"tigetstr", (PyCFunction)_curses_tigetstr, METH_O, _curses_tigetstr__doc__},
+
+static PyObject *
+_curses_tigetstr_impl(PyObject *module, const char *capname);
+
+static PyObject *
+_curses_tigetstr(PyObject *module, PyObject *arg)
+{
+ PyObject *return_value = NULL;
+ const char *capname;
+
+ if (!PyArg_Parse(arg, "s:tigetstr", &capname)) {
+ goto exit;
+ }
+ return_value = _curses_tigetstr_impl(module, capname);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_curses_tparm__doc__,
+"tparm($module, str, i1=0, i2=0, i3=0, i4=0, i5=0, i6=0, i7=0, i8=0,\n"
+" i9=0, /)\n"
+"--\n"
+"\n"
+"Instantiate the specified byte string with the supplied parameters.\n"
+"\n"
+" str\n"
+" Parameterized byte string obtained from the terminfo database.");
+
+#define _CURSES_TPARM_METHODDEF \
+ {"tparm", (PyCFunction)_curses_tparm, METH_FASTCALL, _curses_tparm__doc__},
+
+static PyObject *
+_curses_tparm_impl(PyObject *module, const char *str, int i1, int i2, int i3,
+ int i4, int i5, int i6, int i7, int i8, int i9);
+
+static PyObject *
+_curses_tparm(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
+{
+ PyObject *return_value = NULL;
+ const char *str;
+ int i1 = 0;
+ int i2 = 0;
+ int i3 = 0;
+ int i4 = 0;
+ int i5 = 0;
+ int i6 = 0;
+ int i7 = 0;
+ int i8 = 0;
+ int i9 = 0;
+
+ if (!_PyArg_ParseStack(args, nargs, "y|iiiiiiiii:tparm",
+ &str, &i1, &i2, &i3, &i4, &i5, &i6, &i7, &i8, &i9)) {
+ goto exit;
+ }
+ return_value = _curses_tparm_impl(module, str, i1, i2, i3, i4, i5, i6, i7, i8, i9);
+
+exit:
+ return return_value;
+}
+
+#if defined(HAVE_CURSES_TYPEAHEAD)
+
+PyDoc_STRVAR(_curses_typeahead__doc__,
+"typeahead($module, fd, /)\n"
+"--\n"
+"\n"
+"Specify that the file descriptor fd be used for typeahead checking.\n"
+"\n"
+" fd\n"
+" File descriptor.\n"
+"\n"
+"If fd is -1, then no typeahead checking is done.");
+
+#define _CURSES_TYPEAHEAD_METHODDEF \
+ {"typeahead", (PyCFunction)_curses_typeahead, METH_O, _curses_typeahead__doc__},
+
+static PyObject *
+_curses_typeahead_impl(PyObject *module, int fd);
+
+static PyObject *
+_curses_typeahead(PyObject *module, PyObject *arg)
+{
+ PyObject *return_value = NULL;
+ int fd;
+
+ if (!PyArg_Parse(arg, "i:typeahead", &fd)) {
+ goto exit;
+ }
+ return_value = _curses_typeahead_impl(module, fd);
+
+exit:
+ return return_value;
+}
+
+#endif /* defined(HAVE_CURSES_TYPEAHEAD) */
+
+PyDoc_STRVAR(_curses_unctrl__doc__,
+"unctrl($module, ch, /)\n"
+"--\n"
+"\n"
+"Return a string which is a printable representation of the character ch.\n"
+"\n"
+"Control characters are displayed as a caret followed by the character,\n"
+"for example as ^C. Printing characters are left as they are.");
+
+#define _CURSES_UNCTRL_METHODDEF \
+ {"unctrl", (PyCFunction)_curses_unctrl, METH_O, _curses_unctrl__doc__},
+
+PyDoc_STRVAR(_curses_ungetch__doc__,
+"ungetch($module, ch, /)\n"
+"--\n"
+"\n"
+"Push ch so the next getch() will return it.");
+
+#define _CURSES_UNGETCH_METHODDEF \
+ {"ungetch", (PyCFunction)_curses_ungetch, METH_O, _curses_ungetch__doc__},
+
+#if defined(HAVE_NCURSESW)
+
+PyDoc_STRVAR(_curses_unget_wch__doc__,
+"unget_wch($module, ch, /)\n"
+"--\n"
+"\n"
+"Push ch so the next get_wch() will return it.");
+
+#define _CURSES_UNGET_WCH_METHODDEF \
+ {"unget_wch", (PyCFunction)_curses_unget_wch, METH_O, _curses_unget_wch__doc__},
+
+#endif /* defined(HAVE_NCURSESW) */
+
+#if defined(HAVE_CURSES_USE_ENV)
+
+PyDoc_STRVAR(_curses_use_env__doc__,
+"use_env($module, flag, /)\n"
+"--\n"
+"\n"
+"Use environment variables LINES and COLUMNS.\n"
+"\n"
+"If used, this function should be called before initscr() or newterm() are\n"
+"called.\n"
+"\n"
+"When flag is False, the values of lines and columns specified in the terminfo\n"
+"database will be used, even if environment variables LINES and COLUMNS (used\n"
+"by default) are set, or if curses is running in a window (in which case\n"
+"default behavior would be to use the window size if LINES and COLUMNS are\n"
+"not set).");
+
+#define _CURSES_USE_ENV_METHODDEF \
+ {"use_env", (PyCFunction)_curses_use_env, METH_O, _curses_use_env__doc__},
+
+static PyObject *
+_curses_use_env_impl(PyObject *module, int flag);
+
+static PyObject *
+_curses_use_env(PyObject *module, PyObject *arg)
+{
+ PyObject *return_value = NULL;
+ int flag;
+
+ if (!PyArg_Parse(arg, "i:use_env", &flag)) {
+ goto exit;
+ }
+ return_value = _curses_use_env_impl(module, flag);
+
+exit:
+ return return_value;
+}
+
+#endif /* defined(HAVE_CURSES_USE_ENV) */
+
+#if !defined(STRICT_SYSV_CURSES)
+
+PyDoc_STRVAR(_curses_use_default_colors__doc__,
+"use_default_colors($module, /)\n"
+"--\n"
+"\n"
+"Allow use of default values for colors on terminals supporting this feature.\n"
+"\n"
+"Use this to support transparency in your application. The default color\n"
+"is assigned to the color number -1.");
+
+#define _CURSES_USE_DEFAULT_COLORS_METHODDEF \
+ {"use_default_colors", (PyCFunction)_curses_use_default_colors, METH_NOARGS, _curses_use_default_colors__doc__},
+
+static PyObject *
+_curses_use_default_colors_impl(PyObject *module);
+
+static PyObject *
+_curses_use_default_colors(PyObject *module, PyObject *Py_UNUSED(ignored))
+{
+ return _curses_use_default_colors_impl(module);
+}
+
+#endif /* !defined(STRICT_SYSV_CURSES) */
+
+#ifndef _CURSES_WINDOW_ENCLOSE_METHODDEF
+ #define _CURSES_WINDOW_ENCLOSE_METHODDEF
+#endif /* !defined(_CURSES_WINDOW_ENCLOSE_METHODDEF) */
+
+#ifndef _CURSES_WINDOW_GET_WCH_METHODDEF
+ #define _CURSES_WINDOW_GET_WCH_METHODDEF
+#endif /* !defined(_CURSES_WINDOW_GET_WCH_METHODDEF) */
+
+#ifndef _CURSES_WINDOW_NOUTREFRESH_METHODDEF
+ #define _CURSES_WINDOW_NOUTREFRESH_METHODDEF
+#endif /* !defined(_CURSES_WINDOW_NOUTREFRESH_METHODDEF) */
+
+#ifndef _CURSES_FILTER_METHODDEF
+ #define _CURSES_FILTER_METHODDEF
+#endif /* !defined(_CURSES_FILTER_METHODDEF) */
+
+#ifndef _CURSES_GETSYX_METHODDEF
+ #define _CURSES_GETSYX_METHODDEF
+#endif /* !defined(_CURSES_GETSYX_METHODDEF) */
+
+#ifndef _CURSES_GETMOUSE_METHODDEF
+ #define _CURSES_GETMOUSE_METHODDEF
+#endif /* !defined(_CURSES_GETMOUSE_METHODDEF) */
+
+#ifndef _CURSES_UNGETMOUSE_METHODDEF
+ #define _CURSES_UNGETMOUSE_METHODDEF
+#endif /* !defined(_CURSES_UNGETMOUSE_METHODDEF) */
+
+#ifndef _CURSES_HAS_KEY_METHODDEF
+ #define _CURSES_HAS_KEY_METHODDEF
+#endif /* !defined(_CURSES_HAS_KEY_METHODDEF) */
+
+#ifndef _CURSES_IS_TERM_RESIZED_METHODDEF
+ #define _CURSES_IS_TERM_RESIZED_METHODDEF
+#endif /* !defined(_CURSES_IS_TERM_RESIZED_METHODDEF) */
+
+#ifndef _CURSES_MOUSEINTERVAL_METHODDEF
+ #define _CURSES_MOUSEINTERVAL_METHODDEF
+#endif /* !defined(_CURSES_MOUSEINTERVAL_METHODDEF) */
+
+#ifndef _CURSES_MOUSEMASK_METHODDEF
+ #define _CURSES_MOUSEMASK_METHODDEF
+#endif /* !defined(_CURSES_MOUSEMASK_METHODDEF) */
+
+#ifndef _CURSES_UPDATE_LINES_COLS_METHODDEF
+ #define _CURSES_UPDATE_LINES_COLS_METHODDEF
+#endif /* !defined(_CURSES_UPDATE_LINES_COLS_METHODDEF) */
+
+#ifndef _CURSES_RESIZETERM_METHODDEF
+ #define _CURSES_RESIZETERM_METHODDEF
+#endif /* !defined(_CURSES_RESIZETERM_METHODDEF) */
+
+#ifndef _CURSES_RESIZE_TERM_METHODDEF
+ #define _CURSES_RESIZE_TERM_METHODDEF
+#endif /* !defined(_CURSES_RESIZE_TERM_METHODDEF) */
+
+#ifndef _CURSES_SETSYX_METHODDEF
+ #define _CURSES_SETSYX_METHODDEF
+#endif /* !defined(_CURSES_SETSYX_METHODDEF) */
+
+#ifndef _CURSES_TYPEAHEAD_METHODDEF
+ #define _CURSES_TYPEAHEAD_METHODDEF
+#endif /* !defined(_CURSES_TYPEAHEAD_METHODDEF) */
+
+#ifndef _CURSES_UNGET_WCH_METHODDEF
+ #define _CURSES_UNGET_WCH_METHODDEF
+#endif /* !defined(_CURSES_UNGET_WCH_METHODDEF) */
+
+#ifndef _CURSES_USE_ENV_METHODDEF
+ #define _CURSES_USE_ENV_METHODDEF
+#endif /* !defined(_CURSES_USE_ENV_METHODDEF) */
+
+#ifndef _CURSES_USE_DEFAULT_COLORS_METHODDEF
+ #define _CURSES_USE_DEFAULT_COLORS_METHODDEF
+#endif /* !defined(_CURSES_USE_DEFAULT_COLORS_METHODDEF) */
+/*[clinic end generated code: output=763ffe3abc3a97c7 input=a9049054013a1b77]*/