Home | History | Annotate | Download | only in clinic
      1 /*[clinic input]
      2 preserve
      3 [clinic start generated code]*/
      4 
      5 PyDoc_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 
     26 static PyObject *
     27 curses_window_addch_impl(PyCursesWindowObject *self, int group_left_1, int y,
     28                          int x, PyObject *ch, int group_right_1, long attr);
     29 
     30 static PyObject *
     31 curses_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             }
     46             break;
     47         case 2:
     48             if (!PyArg_ParseTuple(args, "Ol:addch", &ch, &attr)) {
     49                 goto exit;
     50             }
     51             group_right_1 = 1;
     52             break;
     53         case 3:
     54             if (!PyArg_ParseTuple(args, "iiO:addch", &y, &x, &ch)) {
     55                 goto exit;
     56             }
     57             group_left_1 = 1;
     58             break;
     59         case 4:
     60             if (!PyArg_ParseTuple(args, "iiOl:addch", &y, &x, &ch, &attr)) {
     61                 goto exit;
     62             }
     63             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 
     72 exit:
     73     return return_value;
     74 }
     75 /*[clinic end generated code: output=13ffc5f8d79cbfbf input=a9049054013a1b77]*/
     76