blob: 5e1174249901d386cde011be735560651c9579ed [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:
43 if (!PyArg_ParseTuple(args, "O:addch", &ch))
44 goto exit;
45 break;
46 case 2:
47 if (!PyArg_ParseTuple(args, "Ol:addch", &ch, &attr))
48 goto exit;
49 group_right_1 = 1;
50 break;
51 case 3:
52 if (!PyArg_ParseTuple(args, "iiO:addch", &y, &x, &ch))
53 goto exit;
54 group_left_1 = 1;
55 break;
56 case 4:
57 if (!PyArg_ParseTuple(args, "iiOl:addch", &y, &x, &ch, &attr))
58 goto exit;
59 group_right_1 = 1;
60 group_left_1 = 1;
61 break;
62 default:
63 PyErr_SetString(PyExc_TypeError, "curses.window.addch requires 1 to 4 arguments");
64 goto exit;
65 }
66 return_value = curses_window_addch_impl(self, group_left_1, y, x, ch, group_right_1, attr);
67
68exit:
69 return return_value;
70}
Larry Hastings89964c42015-04-14 18:07:59 -040071/*[clinic end generated code: output=982b1e709577f3ec input=a9049054013a1b77]*/