blob: 62ff1c8ae18a5a072cef694e2e2a7d9a0bf7dc05 [file] [log] [blame]
Serhiy Storchaka1009bf12015-04-03 23:53:51 +03001/*[clinic input]
2preserve
3[clinic start generated code]*/
4
5PyDoc_STRVAR(curses_window_addch__doc__,
6"addch([y, x,] ch, [attr])\n"
7"Paint character ch at (y, x) with attributes attr.\n"
8"\n"
9" y\n"
10" Y-coordinate.\n"
11" x\n"
12" X-coordinate.\n"
13" ch\n"
14" Character to add.\n"
15" attr\n"
16" Attributes for the character.\n"
17"\n"
18"Paint character ch at (y, x) with attributes attr,\n"
19"overwriting any character previously painted at that location.\n"
20"By default, the character position and attributes are the\n"
21"current settings for the window object.");
22
23#define CURSES_WINDOW_ADDCH_METHODDEF \
24 {"addch", (PyCFunction)curses_window_addch, METH_VARARGS, curses_window_addch__doc__},
25
26static PyObject *
Larry Hastings89964c42015-04-14 18:07:59 -040027curses_window_addch_impl(PyCursesWindowObject *self, int group_left_1, int y,
28 int x, PyObject *ch, int group_right_1, long attr);
Serhiy Storchaka1009bf12015-04-03 23:53:51 +030029
30static PyObject *
31curses_window_addch(PyCursesWindowObject *self, PyObject *args)
32{
33 PyObject *return_value = NULL;
34 int group_left_1 = 0;
35 int y = 0;
36 int x = 0;
37 PyObject *ch;
38 int group_right_1 = 0;
39 long attr = 0;
40
41 switch (PyTuple_GET_SIZE(args)) {
42 case 1:
Serhiy Storchaka5dee6552016-06-09 16:16:06 +030043 if (!PyArg_ParseTuple(args, "O:addch", &ch)) {
Serhiy Storchaka1009bf12015-04-03 23:53:51 +030044 goto exit;
Serhiy Storchaka5dee6552016-06-09 16:16:06 +030045 }
Serhiy Storchaka1009bf12015-04-03 23:53:51 +030046 break;
47 case 2:
Serhiy Storchaka5dee6552016-06-09 16:16:06 +030048 if (!PyArg_ParseTuple(args, "Ol:addch", &ch, &attr)) {
Serhiy Storchaka1009bf12015-04-03 23:53:51 +030049 goto exit;
Serhiy Storchaka5dee6552016-06-09 16:16:06 +030050 }
Serhiy Storchaka1009bf12015-04-03 23:53:51 +030051 group_right_1 = 1;
52 break;
53 case 3:
Serhiy Storchaka5dee6552016-06-09 16:16:06 +030054 if (!PyArg_ParseTuple(args, "iiO:addch", &y, &x, &ch)) {
Serhiy Storchaka1009bf12015-04-03 23:53:51 +030055 goto exit;
Serhiy Storchaka5dee6552016-06-09 16:16:06 +030056 }
Serhiy Storchaka1009bf12015-04-03 23:53:51 +030057 group_left_1 = 1;
58 break;
59 case 4:
Serhiy Storchaka5dee6552016-06-09 16:16:06 +030060 if (!PyArg_ParseTuple(args, "iiOl:addch", &y, &x, &ch, &attr)) {
Serhiy Storchaka1009bf12015-04-03 23:53:51 +030061 goto exit;
Serhiy Storchaka5dee6552016-06-09 16:16:06 +030062 }
Serhiy Storchaka1009bf12015-04-03 23:53:51 +030063 group_right_1 = 1;
64 group_left_1 = 1;
65 break;
66 default:
67 PyErr_SetString(PyExc_TypeError, "curses.window.addch requires 1 to 4 arguments");
68 goto exit;
69 }
70 return_value = curses_window_addch_impl(self, group_left_1, y, x, ch, group_right_1, attr);
71
72exit:
73 return return_value;
74}
Serhiy Storchaka5dee6552016-06-09 16:16:06 +030075/*[clinic end generated code: output=13ffc5f8d79cbfbf input=a9049054013a1b77]*/