Skip to content

Commit

Permalink
Updates window box default parameters and regenerates clinic headers …
Browse files Browse the repository at this point in the history
…for py312.

Fixes #50.
  • Loading branch information
gotyaoi committed May 5, 2024
1 parent bc21fad commit 04a9968
Show file tree
Hide file tree
Showing 3 changed files with 150 additions and 104 deletions.
6 changes: 3 additions & 3 deletions py312/_cursesmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -1119,9 +1119,9 @@ _curses_window_border_impl(PyCursesWindowObject *self, PyObject *ls,
_curses.window.box
[
verch: object(c_default="_PyLong_GetZero()") = 0
verch: object(c_default="PyLong_FromLong(0)") = 0
Left and right side.
horch: object(c_default="_PyLong_GetZero()") = 0
horch: object(c_default="PyLong_FromLong(0)") = 0
Top and bottom side.
]
/
Expand All @@ -1135,7 +1135,7 @@ horch. The default corner characters are always used by this function.
static PyObject *
_curses_window_box_impl(PyCursesWindowObject *self, int group_right_1,
PyObject *verch, PyObject *horch)
/*[clinic end generated code: output=f3fcb038bb287192 input=f00435f9c8c98f60]*/
/*[clinic end generated code: output=f3fcb038bb287192 input=07797b056d82f6ab]*/
{
chtype ch1 = 0, ch2 = 0;
if (group_right_1) {
Expand Down
167 changes: 94 additions & 73 deletions py312/clinic/_curses_panel.c.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,33 +2,32 @@
preserve
[clinic start generated code]*/

#if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
# include "pycore_gc.h" // PyGC_Head
# include "pycore_runtime.h" // _Py_ID()
#endif


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)(void(*)(void))_curses_panel_panel_bottom, METH_METHOD|METH_FASTCALL|METH_KEYWORDS, _curses_panel_panel_bottom__doc__},
{"bottom", _PyCFunction_CAST(_curses_panel_panel_bottom), METH_METHOD|METH_FASTCALL|METH_KEYWORDS, _curses_panel_panel_bottom__doc__},

static PyObject *
_curses_panel_panel_bottom_impl(PyCursesPanelObject *self, PyTypeObject *cls);

static PyObject *
_curses_panel_panel_bottom(PyCursesPanelObject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
static const char * const _keywords[] = { NULL};
static _PyArg_Parser _parser = {":bottom", _keywords, 0};

if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser
)) {
goto exit;
if (nargs || (kwnames && PyTuple_GET_SIZE(kwnames))) {
PyErr_SetString(PyExc_TypeError, "bottom() takes no arguments");
return NULL;
}
return_value = _curses_panel_panel_bottom_impl(self, cls);

exit:
return return_value;
return _curses_panel_panel_bottom_impl(self, cls);
}

PyDoc_STRVAR(_curses_panel_panel_hide__doc__,
Expand All @@ -40,26 +39,19 @@ PyDoc_STRVAR(_curses_panel_panel_hide__doc__,
"This does not delete the object, it just makes the window on screen invisible.");

#define _CURSES_PANEL_PANEL_HIDE_METHODDEF \
{"hide", (PyCFunction)(void(*)(void))_curses_panel_panel_hide, METH_METHOD|METH_FASTCALL|METH_KEYWORDS, _curses_panel_panel_hide__doc__},
{"hide", _PyCFunction_CAST(_curses_panel_panel_hide), METH_METHOD|METH_FASTCALL|METH_KEYWORDS, _curses_panel_panel_hide__doc__},

static PyObject *
_curses_panel_panel_hide_impl(PyCursesPanelObject *self, PyTypeObject *cls);

static PyObject *
_curses_panel_panel_hide(PyCursesPanelObject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
static const char * const _keywords[] = { NULL};
static _PyArg_Parser _parser = {":hide", _keywords, 0};

if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser
)) {
goto exit;
if (nargs || (kwnames && PyTuple_GET_SIZE(kwnames))) {
PyErr_SetString(PyExc_TypeError, "hide() takes no arguments");
return NULL;
}
return_value = _curses_panel_panel_hide_impl(self, cls);

exit:
return return_value;
return _curses_panel_panel_hide_impl(self, cls);
}

PyDoc_STRVAR(_curses_panel_panel_show__doc__,
Expand All @@ -69,26 +61,19 @@ PyDoc_STRVAR(_curses_panel_panel_show__doc__,
"Display the panel (which might have been hidden).");

#define _CURSES_PANEL_PANEL_SHOW_METHODDEF \
{"show", (PyCFunction)(void(*)(void))_curses_panel_panel_show, METH_METHOD|METH_FASTCALL|METH_KEYWORDS, _curses_panel_panel_show__doc__},
{"show", _PyCFunction_CAST(_curses_panel_panel_show), METH_METHOD|METH_FASTCALL|METH_KEYWORDS, _curses_panel_panel_show__doc__},

static PyObject *
_curses_panel_panel_show_impl(PyCursesPanelObject *self, PyTypeObject *cls);

static PyObject *
_curses_panel_panel_show(PyCursesPanelObject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
static const char * const _keywords[] = { NULL};
static _PyArg_Parser _parser = {":show", _keywords, 0};

if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser
)) {
goto exit;
if (nargs || (kwnames && PyTuple_GET_SIZE(kwnames))) {
PyErr_SetString(PyExc_TypeError, "show() takes no arguments");
return NULL;
}
return_value = _curses_panel_panel_show_impl(self, cls);

exit:
return return_value;
return _curses_panel_panel_show_impl(self, cls);
}

PyDoc_STRVAR(_curses_panel_panel_top__doc__,
Expand All @@ -98,26 +83,19 @@ PyDoc_STRVAR(_curses_panel_panel_top__doc__,
"Push panel to the top of the stack.");

#define _CURSES_PANEL_PANEL_TOP_METHODDEF \
{"top", (PyCFunction)(void(*)(void))_curses_panel_panel_top, METH_METHOD|METH_FASTCALL|METH_KEYWORDS, _curses_panel_panel_top__doc__},
{"top", _PyCFunction_CAST(_curses_panel_panel_top), METH_METHOD|METH_FASTCALL|METH_KEYWORDS, _curses_panel_panel_top__doc__},

static PyObject *
_curses_panel_panel_top_impl(PyCursesPanelObject *self, PyTypeObject *cls);

static PyObject *
_curses_panel_panel_top(PyCursesPanelObject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
static const char * const _keywords[] = { NULL};
static _PyArg_Parser _parser = {":top", _keywords, 0};

if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser
)) {
goto exit;
if (nargs || (kwnames && PyTuple_GET_SIZE(kwnames))) {
PyErr_SetString(PyExc_TypeError, "top() takes no arguments");
return NULL;
}
return_value = _curses_panel_panel_top_impl(self, cls);

exit:
return return_value;
return _curses_panel_panel_top_impl(self, cls);
}

PyDoc_STRVAR(_curses_panel_panel_above__doc__,
Expand Down Expand Up @@ -181,7 +159,7 @@ PyDoc_STRVAR(_curses_panel_panel_move__doc__,
"Move the panel to the screen coordinates (y, x).");

#define _CURSES_PANEL_PANEL_MOVE_METHODDEF \
{"move", (PyCFunction)(void(*)(void))_curses_panel_panel_move, METH_METHOD|METH_FASTCALL|METH_KEYWORDS, _curses_panel_panel_move__doc__},
{"move", _PyCFunction_CAST(_curses_panel_panel_move), METH_METHOD|METH_FASTCALL|METH_KEYWORDS, _curses_panel_panel_move__doc__},

static PyObject *
_curses_panel_panel_move_impl(PyCursesPanelObject *self, PyTypeObject *cls,
Expand All @@ -191,13 +169,33 @@ static PyObject *
_curses_panel_panel_move(PyCursesPanelObject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
#if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
# define KWTUPLE (PyObject *)&_Py_SINGLETON(tuple_empty)
#else
# define KWTUPLE NULL
#endif

static const char * const _keywords[] = {"", "", NULL};
static _PyArg_Parser _parser = {"ii:move", _keywords, 0};
static _PyArg_Parser _parser = {
.keywords = _keywords,
.fname = "move",
.kwtuple = KWTUPLE,
};
#undef KWTUPLE
PyObject *argsbuf[2];
int y;
int x;

if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
&y, &x)) {
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 2, 2, 0, argsbuf);
if (!args) {
goto exit;
}
y = _PyLong_AsInt(args[0]);
if (y == -1 && PyErr_Occurred()) {
goto exit;
}
x = _PyLong_AsInt(args[1]);
if (x == -1 && PyErr_Occurred()) {
goto exit;
}
return_value = _curses_panel_panel_move_impl(self, cls, y, x);
Expand Down Expand Up @@ -231,7 +229,7 @@ PyDoc_STRVAR(_curses_panel_panel_replace__doc__,
"Change the window associated with the panel to the window win.");

#define _CURSES_PANEL_PANEL_REPLACE_METHODDEF \
{"replace", (PyCFunction)(void(*)(void))_curses_panel_panel_replace, METH_METHOD|METH_FASTCALL|METH_KEYWORDS, _curses_panel_panel_replace__doc__},
{"replace", _PyCFunction_CAST(_curses_panel_panel_replace), METH_METHOD|METH_FASTCALL|METH_KEYWORDS, _curses_panel_panel_replace__doc__},

static PyObject *
_curses_panel_panel_replace_impl(PyCursesPanelObject *self,
Expand All @@ -242,14 +240,31 @@ static PyObject *
_curses_panel_panel_replace(PyCursesPanelObject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
#if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
# define KWTUPLE (PyObject *)&_Py_SINGLETON(tuple_empty)
#else
# define KWTUPLE NULL
#endif

static const char * const _keywords[] = {"", NULL};
static _PyArg_Parser _parser = {"O!:replace", _keywords, 0};
static _PyArg_Parser _parser = {
.keywords = _keywords,
.fname = "replace",
.kwtuple = KWTUPLE,
};
#undef KWTUPLE
PyObject *argsbuf[1];
PyCursesWindowObject *win;

if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
&PyCursesWindow_Type, &win)) {
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, argsbuf);
if (!args) {
goto exit;
}
if (!PyObject_TypeCheck(args[0], &PyCursesWindow_Type)) {
_PyArg_BadArgument("replace", "argument 1", (&PyCursesWindow_Type)->tp_name, args[0]);
goto exit;
}
win = (PyCursesWindowObject *)args[0];
return_value = _curses_panel_panel_replace_impl(self, cls, win);

exit:
Expand All @@ -263,7 +278,7 @@ PyDoc_STRVAR(_curses_panel_panel_set_userptr__doc__,
"Set the panel\'s user pointer to obj.");

#define _CURSES_PANEL_PANEL_SET_USERPTR_METHODDEF \
{"set_userptr", (PyCFunction)(void(*)(void))_curses_panel_panel_set_userptr, METH_METHOD|METH_FASTCALL|METH_KEYWORDS, _curses_panel_panel_set_userptr__doc__},
{"set_userptr", _PyCFunction_CAST(_curses_panel_panel_set_userptr), METH_METHOD|METH_FASTCALL|METH_KEYWORDS, _curses_panel_panel_set_userptr__doc__},

static PyObject *
_curses_panel_panel_set_userptr_impl(PyCursesPanelObject *self,
Expand All @@ -273,14 +288,27 @@ static PyObject *
_curses_panel_panel_set_userptr(PyCursesPanelObject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
#if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
# define KWTUPLE (PyObject *)&_Py_SINGLETON(tuple_empty)
#else
# define KWTUPLE NULL
#endif

static const char * const _keywords[] = {"", NULL};
static _PyArg_Parser _parser = {"O:set_userptr", _keywords, 0};
static _PyArg_Parser _parser = {
.keywords = _keywords,
.fname = "set_userptr",
.kwtuple = KWTUPLE,
};
#undef KWTUPLE
PyObject *argsbuf[1];
PyObject *obj;

if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
&obj)) {
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, argsbuf);
if (!args) {
goto exit;
}
obj = args[0];
return_value = _curses_panel_panel_set_userptr_impl(self, cls, obj);

exit:
Expand All @@ -294,7 +322,7 @@ PyDoc_STRVAR(_curses_panel_panel_userptr__doc__,
"Return the user pointer for the panel.");

#define _CURSES_PANEL_PANEL_USERPTR_METHODDEF \
{"userptr", (PyCFunction)(void(*)(void))_curses_panel_panel_userptr, METH_METHOD|METH_FASTCALL|METH_KEYWORDS, _curses_panel_panel_userptr__doc__},
{"userptr", _PyCFunction_CAST(_curses_panel_panel_userptr), METH_METHOD|METH_FASTCALL|METH_KEYWORDS, _curses_panel_panel_userptr__doc__},

static PyObject *
_curses_panel_panel_userptr_impl(PyCursesPanelObject *self,
Expand All @@ -303,18 +331,11 @@ _curses_panel_panel_userptr_impl(PyCursesPanelObject *self,
static PyObject *
_curses_panel_panel_userptr(PyCursesPanelObject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
static const char * const _keywords[] = { NULL};
static _PyArg_Parser _parser = {":userptr", _keywords, 0};

if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser
)) {
goto exit;
if (nargs || (kwnames && PyTuple_GET_SIZE(kwnames))) {
PyErr_SetString(PyExc_TypeError, "userptr() takes no arguments");
return NULL;
}
return_value = _curses_panel_panel_userptr_impl(self, cls);

exit:
return return_value;
return _curses_panel_panel_userptr_impl(self, cls);
}

PyDoc_STRVAR(_curses_panel_bottom_panel__doc__,
Expand Down Expand Up @@ -401,4 +422,4 @@ _curses_panel_update_panels(PyObject *module, PyObject *Py_UNUSED(ignored))
{
return _curses_panel_update_panels_impl(module);
}
/*[clinic end generated code: output=3081ef24e5560cb0 input=a9049054013a1b77]*/
/*[clinic end generated code: output=550ee3ad1ce9ec07 input=a9049054013a1b77]*/
Loading

0 comments on commit 04a9968

Please sign in to comment.