blob: b32797fc74ee92b909b8d5602a821ceb24fd7f96 [file] [log] [blame]
Serhiy Storchaka1009bf12015-04-03 23:53:51 +03001/*[clinic input]
2preserve
3[clinic start generated code]*/
4
Serhiy Storchakab00854c2018-05-10 11:27:23 +03005PyDoc_STRVAR(_curses_window_addch__doc__,
6"addch([y, x,] ch, [attr=_curses.A_NORMAL])\n"
7"Paint the character.\n"
Serhiy Storchaka1009bf12015-04-03 23:53:51 +03008"\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
Serhiy Storchakab00854c2018-05-10 11:27:23 +030023#define _CURSES_WINDOW_ADDCH_METHODDEF \
24 {"addch", (PyCFunction)_curses_window_addch, METH_VARARGS, _curses_window_addch__doc__},
Serhiy Storchaka1009bf12015-04-03 23:53:51 +030025
26static PyObject *
Serhiy Storchakab00854c2018-05-10 11:27:23 +030027_curses_window_addch_impl(PyCursesWindowObject *self, int group_left_1,
28 int y, int x, PyObject *ch, int group_right_1,
29 long attr);
Serhiy Storchaka1009bf12015-04-03 23:53:51 +030030
31static PyObject *
Serhiy Storchakab00854c2018-05-10 11:27:23 +030032_curses_window_addch(PyCursesWindowObject *self, PyObject *args)
Serhiy Storchaka1009bf12015-04-03 23:53:51 +030033{
34 PyObject *return_value = NULL;
35 int group_left_1 = 0;
36 int y = 0;
37 int x = 0;
38 PyObject *ch;
39 int group_right_1 = 0;
Serhiy Storchakab00854c2018-05-10 11:27:23 +030040 long attr = A_NORMAL;
Serhiy Storchaka1009bf12015-04-03 23:53:51 +030041
42 switch (PyTuple_GET_SIZE(args)) {
43 case 1:
Serhiy Storchaka5dee6552016-06-09 16:16:06 +030044 if (!PyArg_ParseTuple(args, "O:addch", &ch)) {
Serhiy Storchaka1009bf12015-04-03 23:53:51 +030045 goto exit;
Serhiy Storchaka5dee6552016-06-09 16:16:06 +030046 }
Serhiy Storchaka1009bf12015-04-03 23:53:51 +030047 break;
48 case 2:
Serhiy Storchaka5dee6552016-06-09 16:16:06 +030049 if (!PyArg_ParseTuple(args, "Ol:addch", &ch, &attr)) {
Serhiy Storchaka1009bf12015-04-03 23:53:51 +030050 goto exit;
Serhiy Storchaka5dee6552016-06-09 16:16:06 +030051 }
Serhiy Storchaka1009bf12015-04-03 23:53:51 +030052 group_right_1 = 1;
53 break;
54 case 3:
Serhiy Storchaka5dee6552016-06-09 16:16:06 +030055 if (!PyArg_ParseTuple(args, "iiO:addch", &y, &x, &ch)) {
Serhiy Storchaka1009bf12015-04-03 23:53:51 +030056 goto exit;
Serhiy Storchaka5dee6552016-06-09 16:16:06 +030057 }
Serhiy Storchaka1009bf12015-04-03 23:53:51 +030058 group_left_1 = 1;
59 break;
60 case 4:
Serhiy Storchaka5dee6552016-06-09 16:16:06 +030061 if (!PyArg_ParseTuple(args, "iiOl:addch", &y, &x, &ch, &attr)) {
Serhiy Storchaka1009bf12015-04-03 23:53:51 +030062 goto exit;
Serhiy Storchaka5dee6552016-06-09 16:16:06 +030063 }
Serhiy Storchaka1009bf12015-04-03 23:53:51 +030064 group_right_1 = 1;
65 group_left_1 = 1;
66 break;
67 default:
Serhiy Storchakab00854c2018-05-10 11:27:23 +030068 PyErr_SetString(PyExc_TypeError, "_curses.window.addch requires 1 to 4 arguments");
Serhiy Storchaka1009bf12015-04-03 23:53:51 +030069 goto exit;
70 }
Serhiy Storchakab00854c2018-05-10 11:27:23 +030071 return_value = _curses_window_addch_impl(self, group_left_1, y, x, ch, group_right_1, attr);
Serhiy Storchaka1009bf12015-04-03 23:53:51 +030072
73exit:
74 return return_value;
75}
Serhiy Storchakab00854c2018-05-10 11:27:23 +030076
77PyDoc_STRVAR(_curses_window_addstr__doc__,
78"addstr([y, x,] str, [attr])\n"
79"Paint the string.\n"
80"\n"
81" y\n"
82" Y-coordinate.\n"
83" x\n"
84" X-coordinate.\n"
85" str\n"
86" String to add.\n"
87" attr\n"
88" Attributes for characters.\n"
89"\n"
90"Paint the string str at (y, x) with attributes attr,\n"
91"overwriting anything previously on the display.\n"
92"By default, the character position and attributes are the\n"
93"current settings for the window object.");
94
95#define _CURSES_WINDOW_ADDSTR_METHODDEF \
96 {"addstr", (PyCFunction)_curses_window_addstr, METH_VARARGS, _curses_window_addstr__doc__},
97
98static PyObject *
99_curses_window_addstr_impl(PyCursesWindowObject *self, int group_left_1,
100 int y, int x, PyObject *str, int group_right_1,
101 long attr);
102
103static PyObject *
104_curses_window_addstr(PyCursesWindowObject *self, PyObject *args)
105{
106 PyObject *return_value = NULL;
107 int group_left_1 = 0;
108 int y = 0;
109 int x = 0;
110 PyObject *str;
111 int group_right_1 = 0;
112 long attr = 0;
113
114 switch (PyTuple_GET_SIZE(args)) {
115 case 1:
116 if (!PyArg_ParseTuple(args, "O:addstr", &str)) {
117 goto exit;
118 }
119 break;
120 case 2:
121 if (!PyArg_ParseTuple(args, "Ol:addstr", &str, &attr)) {
122 goto exit;
123 }
124 group_right_1 = 1;
125 break;
126 case 3:
127 if (!PyArg_ParseTuple(args, "iiO:addstr", &y, &x, &str)) {
128 goto exit;
129 }
130 group_left_1 = 1;
131 break;
132 case 4:
133 if (!PyArg_ParseTuple(args, "iiOl:addstr", &y, &x, &str, &attr)) {
134 goto exit;
135 }
136 group_right_1 = 1;
137 group_left_1 = 1;
138 break;
139 default:
140 PyErr_SetString(PyExc_TypeError, "_curses.window.addstr requires 1 to 4 arguments");
141 goto exit;
142 }
143 return_value = _curses_window_addstr_impl(self, group_left_1, y, x, str, group_right_1, attr);
144
145exit:
146 return return_value;
147}
148
149PyDoc_STRVAR(_curses_window_addnstr__doc__,
150"addnstr([y, x,] str, n, [attr])\n"
151"Paint at most n characters of the string.\n"
152"\n"
153" y\n"
154" Y-coordinate.\n"
155" x\n"
156" X-coordinate.\n"
157" str\n"
158" String to add.\n"
159" n\n"
160" Maximal number of characters.\n"
161" attr\n"
162" Attributes for characters.\n"
163"\n"
164"Paint at most n characters of the string str at (y, x) with\n"
165"attributes attr, overwriting anything previously on the display.\n"
166"By default, the character position and attributes are the\n"
167"current settings for the window object.");
168
169#define _CURSES_WINDOW_ADDNSTR_METHODDEF \
170 {"addnstr", (PyCFunction)_curses_window_addnstr, METH_VARARGS, _curses_window_addnstr__doc__},
171
172static PyObject *
173_curses_window_addnstr_impl(PyCursesWindowObject *self, int group_left_1,
174 int y, int x, PyObject *str, int n,
175 int group_right_1, long attr);
176
177static PyObject *
178_curses_window_addnstr(PyCursesWindowObject *self, PyObject *args)
179{
180 PyObject *return_value = NULL;
181 int group_left_1 = 0;
182 int y = 0;
183 int x = 0;
184 PyObject *str;
185 int n;
186 int group_right_1 = 0;
187 long attr = 0;
188
189 switch (PyTuple_GET_SIZE(args)) {
190 case 2:
191 if (!PyArg_ParseTuple(args, "Oi:addnstr", &str, &n)) {
192 goto exit;
193 }
194 break;
195 case 3:
196 if (!PyArg_ParseTuple(args, "Oil:addnstr", &str, &n, &attr)) {
197 goto exit;
198 }
199 group_right_1 = 1;
200 break;
201 case 4:
202 if (!PyArg_ParseTuple(args, "iiOi:addnstr", &y, &x, &str, &n)) {
203 goto exit;
204 }
205 group_left_1 = 1;
206 break;
207 case 5:
208 if (!PyArg_ParseTuple(args, "iiOil:addnstr", &y, &x, &str, &n, &attr)) {
209 goto exit;
210 }
211 group_right_1 = 1;
212 group_left_1 = 1;
213 break;
214 default:
215 PyErr_SetString(PyExc_TypeError, "_curses.window.addnstr requires 2 to 5 arguments");
216 goto exit;
217 }
218 return_value = _curses_window_addnstr_impl(self, group_left_1, y, x, str, n, group_right_1, attr);
219
220exit:
221 return return_value;
222}
223
224PyDoc_STRVAR(_curses_window_bkgd__doc__,
225"bkgd($self, ch, attr=_curses.A_NORMAL, /)\n"
226"--\n"
227"\n"
228"Set the background property of the window.\n"
229"\n"
230" ch\n"
231" Background character.\n"
232" attr\n"
233" Background attributes.");
234
235#define _CURSES_WINDOW_BKGD_METHODDEF \
236 {"bkgd", (PyCFunction)_curses_window_bkgd, METH_FASTCALL, _curses_window_bkgd__doc__},
237
238static PyObject *
239_curses_window_bkgd_impl(PyCursesWindowObject *self, PyObject *ch, long attr);
240
241static PyObject *
242_curses_window_bkgd(PyCursesWindowObject *self, PyObject *const *args, Py_ssize_t nargs)
243{
244 PyObject *return_value = NULL;
245 PyObject *ch;
246 long attr = A_NORMAL;
247
248 if (!_PyArg_ParseStack(args, nargs, "O|l:bkgd",
249 &ch, &attr)) {
250 goto exit;
251 }
252 return_value = _curses_window_bkgd_impl(self, ch, attr);
253
254exit:
255 return return_value;
256}
257
258PyDoc_STRVAR(_curses_window_attroff__doc__,
259"attroff($self, attr, /)\n"
260"--\n"
261"\n"
262"Remove attribute attr from the \"background\" set.");
263
264#define _CURSES_WINDOW_ATTROFF_METHODDEF \
265 {"attroff", (PyCFunction)_curses_window_attroff, METH_O, _curses_window_attroff__doc__},
266
267static PyObject *
268_curses_window_attroff_impl(PyCursesWindowObject *self, long attr);
269
270static PyObject *
271_curses_window_attroff(PyCursesWindowObject *self, PyObject *arg)
272{
273 PyObject *return_value = NULL;
274 long attr;
275
276 if (!PyArg_Parse(arg, "l:attroff", &attr)) {
277 goto exit;
278 }
279 return_value = _curses_window_attroff_impl(self, attr);
280
281exit:
282 return return_value;
283}
284
285PyDoc_STRVAR(_curses_window_attron__doc__,
286"attron($self, attr, /)\n"
287"--\n"
288"\n"
289"Add attribute attr from the \"background\" set.");
290
291#define _CURSES_WINDOW_ATTRON_METHODDEF \
292 {"attron", (PyCFunction)_curses_window_attron, METH_O, _curses_window_attron__doc__},
293
294static PyObject *
295_curses_window_attron_impl(PyCursesWindowObject *self, long attr);
296
297static PyObject *
298_curses_window_attron(PyCursesWindowObject *self, PyObject *arg)
299{
300 PyObject *return_value = NULL;
301 long attr;
302
303 if (!PyArg_Parse(arg, "l:attron", &attr)) {
304 goto exit;
305 }
306 return_value = _curses_window_attron_impl(self, attr);
307
308exit:
309 return return_value;
310}
311
312PyDoc_STRVAR(_curses_window_attrset__doc__,
313"attrset($self, attr, /)\n"
314"--\n"
315"\n"
316"Set the \"background\" set of attributes.");
317
318#define _CURSES_WINDOW_ATTRSET_METHODDEF \
319 {"attrset", (PyCFunction)_curses_window_attrset, METH_O, _curses_window_attrset__doc__},
320
321static PyObject *
322_curses_window_attrset_impl(PyCursesWindowObject *self, long attr);
323
324static PyObject *
325_curses_window_attrset(PyCursesWindowObject *self, PyObject *arg)
326{
327 PyObject *return_value = NULL;
328 long attr;
329
330 if (!PyArg_Parse(arg, "l:attrset", &attr)) {
331 goto exit;
332 }
333 return_value = _curses_window_attrset_impl(self, attr);
334
335exit:
336 return return_value;
337}
338
339PyDoc_STRVAR(_curses_window_bkgdset__doc__,
340"bkgdset($self, ch, attr=_curses.A_NORMAL, /)\n"
341"--\n"
342"\n"
343"Set the window\'s background.\n"
344"\n"
345" ch\n"
346" Background character.\n"
347" attr\n"
348" Background attributes.");
349
350#define _CURSES_WINDOW_BKGDSET_METHODDEF \
351 {"bkgdset", (PyCFunction)_curses_window_bkgdset, METH_FASTCALL, _curses_window_bkgdset__doc__},
352
353static PyObject *
354_curses_window_bkgdset_impl(PyCursesWindowObject *self, PyObject *ch,
355 long attr);
356
357static PyObject *
358_curses_window_bkgdset(PyCursesWindowObject *self, PyObject *const *args, Py_ssize_t nargs)
359{
360 PyObject *return_value = NULL;
361 PyObject *ch;
362 long attr = A_NORMAL;
363
364 if (!_PyArg_ParseStack(args, nargs, "O|l:bkgdset",
365 &ch, &attr)) {
366 goto exit;
367 }
368 return_value = _curses_window_bkgdset_impl(self, ch, attr);
369
370exit:
371 return return_value;
372}
373
374PyDoc_STRVAR(_curses_window_border__doc__,
375"border($self, ls=_curses.ACS_VLINE, rs=_curses.ACS_VLINE,\n"
376" ts=_curses.ACS_HLINE, bs=_curses.ACS_HLINE,\n"
377" tl=_curses.ACS_ULCORNER, tr=_curses.ACS_URCORNER,\n"
378" bl=_curses.ACS_LLCORNER, br=_curses.ACS_LRCORNER, /)\n"
379"--\n"
380"\n"
381"Draw a border around the edges of the window.\n"
382"\n"
383" ls\n"
384" Left side.\n"
385" rs\n"
386" Right side.\n"
387" ts\n"
388" Top side.\n"
389" bs\n"
390" Bottom side.\n"
391" tl\n"
392" Upper-left corner.\n"
393" tr\n"
394" Upper-right corner.\n"
395" bl\n"
396" Bottom-left corner.\n"
397" br\n"
398" Bottom-right corner.\n"
399"\n"
400"Each parameter specifies the character to use for a specific part of the\n"
401"border. The characters can be specified as integers or as one-character\n"
402"strings. A 0 value for any parameter will cause the default character to be\n"
403"used for that parameter.");
404
405#define _CURSES_WINDOW_BORDER_METHODDEF \
406 {"border", (PyCFunction)_curses_window_border, METH_FASTCALL, _curses_window_border__doc__},
407
408static PyObject *
409_curses_window_border_impl(PyCursesWindowObject *self, PyObject *ls,
410 PyObject *rs, PyObject *ts, PyObject *bs,
411 PyObject *tl, PyObject *tr, PyObject *bl,
412 PyObject *br);
413
414static PyObject *
415_curses_window_border(PyCursesWindowObject *self, PyObject *const *args, Py_ssize_t nargs)
416{
417 PyObject *return_value = NULL;
418 PyObject *ls = NULL;
419 PyObject *rs = NULL;
420 PyObject *ts = NULL;
421 PyObject *bs = NULL;
422 PyObject *tl = NULL;
423 PyObject *tr = NULL;
424 PyObject *bl = NULL;
425 PyObject *br = NULL;
426
427 if (!_PyArg_UnpackStack(args, nargs, "border",
428 0, 8,
429 &ls, &rs, &ts, &bs, &tl, &tr, &bl, &br)) {
430 goto exit;
431 }
432 return_value = _curses_window_border_impl(self, ls, rs, ts, bs, tl, tr, bl, br);
433
434exit:
435 return return_value;
436}
437
438PyDoc_STRVAR(_curses_window_box__doc__,
439"box([verch=0, horch=0])\n"
440"Draw a border around the edges of the window.\n"
441"\n"
442" verch\n"
443" Left and right side.\n"
444" horch\n"
445" Top and bottom side.\n"
446"\n"
447"Similar to border(), but both ls and rs are verch and both ts and bs are\n"
448"horch. The default corner characters are always used by this function.");
449
450#define _CURSES_WINDOW_BOX_METHODDEF \
451 {"box", (PyCFunction)_curses_window_box, METH_VARARGS, _curses_window_box__doc__},
452
453static PyObject *
454_curses_window_box_impl(PyCursesWindowObject *self, int group_right_1,
455 PyObject *verch, PyObject *horch);
456
457static PyObject *
458_curses_window_box(PyCursesWindowObject *self, PyObject *args)
459{
460 PyObject *return_value = NULL;
461 int group_right_1 = 0;
462 PyObject *verch = _PyLong_Zero;
463 PyObject *horch = _PyLong_Zero;
464
465 switch (PyTuple_GET_SIZE(args)) {
466 case 0:
467 break;
468 case 2:
469 if (!PyArg_ParseTuple(args, "OO:box", &verch, &horch)) {
470 goto exit;
471 }
472 group_right_1 = 1;
473 break;
474 default:
475 PyErr_SetString(PyExc_TypeError, "_curses.window.box requires 0 to 2 arguments");
476 goto exit;
477 }
478 return_value = _curses_window_box_impl(self, group_right_1, verch, horch);
479
480exit:
481 return return_value;
482}
483
484PyDoc_STRVAR(_curses_window_delch__doc__,
485"delch([y, x])\n"
486"Delete any character at (y, x).\n"
487"\n"
488" y\n"
489" Y-coordinate.\n"
490" x\n"
491" X-coordinate.");
492
493#define _CURSES_WINDOW_DELCH_METHODDEF \
494 {"delch", (PyCFunction)_curses_window_delch, METH_VARARGS, _curses_window_delch__doc__},
495
496static PyObject *
497_curses_window_delch_impl(PyCursesWindowObject *self, int group_right_1,
498 int y, int x);
499
500static PyObject *
501_curses_window_delch(PyCursesWindowObject *self, PyObject *args)
502{
503 PyObject *return_value = NULL;
504 int group_right_1 = 0;
505 int y = 0;
506 int x = 0;
507
508 switch (PyTuple_GET_SIZE(args)) {
509 case 0:
510 break;
511 case 2:
512 if (!PyArg_ParseTuple(args, "ii:delch", &y, &x)) {
513 goto exit;
514 }
515 group_right_1 = 1;
516 break;
517 default:
518 PyErr_SetString(PyExc_TypeError, "_curses.window.delch requires 0 to 2 arguments");
519 goto exit;
520 }
521 return_value = _curses_window_delch_impl(self, group_right_1, y, x);
522
523exit:
524 return return_value;
525}
526
527PyDoc_STRVAR(_curses_window_derwin__doc__,
528"derwin([nlines=0, ncols=0,] begin_y, begin_x)\n"
529"Create a sub-window (window-relative coordinates).\n"
530"\n"
531" nlines\n"
532" Height.\n"
533" ncols\n"
534" Width.\n"
535" begin_y\n"
536" Top side y-coordinate.\n"
537" begin_x\n"
538" Left side x-coordinate.\n"
539"\n"
540"derwin() is the same as calling subwin(), except that begin_y and begin_x\n"
541"are relative to the origin of the window, rather than relative to the entire\n"
542"screen.");
543
544#define _CURSES_WINDOW_DERWIN_METHODDEF \
545 {"derwin", (PyCFunction)_curses_window_derwin, METH_VARARGS, _curses_window_derwin__doc__},
546
547static PyObject *
548_curses_window_derwin_impl(PyCursesWindowObject *self, int group_left_1,
549 int nlines, int ncols, int begin_y, int begin_x);
550
551static PyObject *
552_curses_window_derwin(PyCursesWindowObject *self, PyObject *args)
553{
554 PyObject *return_value = NULL;
555 int group_left_1 = 0;
556 int nlines = 0;
557 int ncols = 0;
558 int begin_y;
559 int begin_x;
560
561 switch (PyTuple_GET_SIZE(args)) {
562 case 2:
563 if (!PyArg_ParseTuple(args, "ii:derwin", &begin_y, &begin_x)) {
564 goto exit;
565 }
566 break;
567 case 4:
568 if (!PyArg_ParseTuple(args, "iiii:derwin", &nlines, &ncols, &begin_y, &begin_x)) {
569 goto exit;
570 }
571 group_left_1 = 1;
572 break;
573 default:
574 PyErr_SetString(PyExc_TypeError, "_curses.window.derwin requires 2 to 4 arguments");
575 goto exit;
576 }
577 return_value = _curses_window_derwin_impl(self, group_left_1, nlines, ncols, begin_y, begin_x);
578
579exit:
580 return return_value;
581}
582
583PyDoc_STRVAR(_curses_window_echochar__doc__,
584"echochar($self, ch, attr=_curses.A_NORMAL, /)\n"
585"--\n"
586"\n"
587"Add character ch with attribute attr, and refresh.\n"
588"\n"
589" ch\n"
590" Character to add.\n"
591" attr\n"
592" Attributes for the character.");
593
594#define _CURSES_WINDOW_ECHOCHAR_METHODDEF \
595 {"echochar", (PyCFunction)_curses_window_echochar, METH_FASTCALL, _curses_window_echochar__doc__},
596
597static PyObject *
598_curses_window_echochar_impl(PyCursesWindowObject *self, PyObject *ch,
599 long attr);
600
601static PyObject *
602_curses_window_echochar(PyCursesWindowObject *self, PyObject *const *args, Py_ssize_t nargs)
603{
604 PyObject *return_value = NULL;
605 PyObject *ch;
606 long attr = A_NORMAL;
607
608 if (!_PyArg_ParseStack(args, nargs, "O|l:echochar",
609 &ch, &attr)) {
610 goto exit;
611 }
612 return_value = _curses_window_echochar_impl(self, ch, attr);
613
614exit:
615 return return_value;
616}
617
618#if defined(NCURSES_MOUSE_VERSION)
619
620PyDoc_STRVAR(_curses_window_enclose__doc__,
621"enclose($self, y, x, /)\n"
622"--\n"
623"\n"
624"Return True if the screen-relative coordinates are enclosed by the window.\n"
625"\n"
626" y\n"
627" Y-coordinate.\n"
628" x\n"
629" X-coordinate.");
630
631#define _CURSES_WINDOW_ENCLOSE_METHODDEF \
632 {"enclose", (PyCFunction)_curses_window_enclose, METH_FASTCALL, _curses_window_enclose__doc__},
633
634static long
635_curses_window_enclose_impl(PyCursesWindowObject *self, int y, int x);
636
637static PyObject *
638_curses_window_enclose(PyCursesWindowObject *self, PyObject *const *args, Py_ssize_t nargs)
639{
640 PyObject *return_value = NULL;
641 int y;
642 int x;
643 long _return_value;
644
645 if (!_PyArg_ParseStack(args, nargs, "ii:enclose",
646 &y, &x)) {
647 goto exit;
648 }
649 _return_value = _curses_window_enclose_impl(self, y, x);
650 if ((_return_value == -1) && PyErr_Occurred()) {
651 goto exit;
652 }
653 return_value = PyLong_FromLong(_return_value);
654
655exit:
656 return return_value;
657}
658
659#endif /* defined(NCURSES_MOUSE_VERSION) */
660
661PyDoc_STRVAR(_curses_window_getbkgd__doc__,
662"getbkgd($self, /)\n"
663"--\n"
664"\n"
665"Return the window\'s current background character/attribute pair.");
666
667#define _CURSES_WINDOW_GETBKGD_METHODDEF \
668 {"getbkgd", (PyCFunction)_curses_window_getbkgd, METH_NOARGS, _curses_window_getbkgd__doc__},
669
670static long
671_curses_window_getbkgd_impl(PyCursesWindowObject *self);
672
673static PyObject *
674_curses_window_getbkgd(PyCursesWindowObject *self, PyObject *Py_UNUSED(ignored))
675{
676 PyObject *return_value = NULL;
677 long _return_value;
678
679 _return_value = _curses_window_getbkgd_impl(self);
680 if ((_return_value == -1) && PyErr_Occurred()) {
681 goto exit;
682 }
683 return_value = PyLong_FromLong(_return_value);
684
685exit:
686 return return_value;
687}
688
689PyDoc_STRVAR(_curses_window_getch__doc__,
690"getch([y, x])\n"
691"Get a character code from terminal keyboard.\n"
692"\n"
693" y\n"
694" Y-coordinate.\n"
695" x\n"
696" X-coordinate.\n"
697"\n"
698"The integer returned does not have to be in ASCII range: function keys,\n"
699"keypad keys and so on return numbers higher than 256. In no-delay mode, -1\n"
700"is returned if there is no input, else getch() waits until a key is pressed.");
701
702#define _CURSES_WINDOW_GETCH_METHODDEF \
703 {"getch", (PyCFunction)_curses_window_getch, METH_VARARGS, _curses_window_getch__doc__},
704
705static int
706_curses_window_getch_impl(PyCursesWindowObject *self, int group_right_1,
707 int y, int x);
708
709static PyObject *
710_curses_window_getch(PyCursesWindowObject *self, PyObject *args)
711{
712 PyObject *return_value = NULL;
713 int group_right_1 = 0;
714 int y = 0;
715 int x = 0;
716 int _return_value;
717
718 switch (PyTuple_GET_SIZE(args)) {
719 case 0:
720 break;
721 case 2:
722 if (!PyArg_ParseTuple(args, "ii:getch", &y, &x)) {
723 goto exit;
724 }
725 group_right_1 = 1;
726 break;
727 default:
728 PyErr_SetString(PyExc_TypeError, "_curses.window.getch requires 0 to 2 arguments");
729 goto exit;
730 }
731 _return_value = _curses_window_getch_impl(self, group_right_1, y, x);
732 if ((_return_value == -1) && PyErr_Occurred()) {
733 goto exit;
734 }
735 return_value = PyLong_FromLong((long)_return_value);
736
737exit:
738 return return_value;
739}
740
741PyDoc_STRVAR(_curses_window_getkey__doc__,
742"getkey([y, x])\n"
743"Get a character (string) from terminal keyboard.\n"
744"\n"
745" y\n"
746" Y-coordinate.\n"
747" x\n"
748" X-coordinate.\n"
749"\n"
750"Returning a string instead of an integer, as getch() does. Function keys,\n"
751"keypad keys and other special keys return a multibyte string containing the\n"
752"key name. In no-delay mode, an exception is raised if there is no input.");
753
754#define _CURSES_WINDOW_GETKEY_METHODDEF \
755 {"getkey", (PyCFunction)_curses_window_getkey, METH_VARARGS, _curses_window_getkey__doc__},
756
757static PyObject *
758_curses_window_getkey_impl(PyCursesWindowObject *self, int group_right_1,
759 int y, int x);
760
761static PyObject *
762_curses_window_getkey(PyCursesWindowObject *self, PyObject *args)
763{
764 PyObject *return_value = NULL;
765 int group_right_1 = 0;
766 int y = 0;
767 int x = 0;
768
769 switch (PyTuple_GET_SIZE(args)) {
770 case 0:
771 break;
772 case 2:
773 if (!PyArg_ParseTuple(args, "ii:getkey", &y, &x)) {
774 goto exit;
775 }
776 group_right_1 = 1;
777 break;
778 default:
779 PyErr_SetString(PyExc_TypeError, "_curses.window.getkey requires 0 to 2 arguments");
780 goto exit;
781 }
782 return_value = _curses_window_getkey_impl(self, group_right_1, y, x);
783
784exit:
785 return return_value;
786}
787
788#if defined(HAVE_NCURSESW)
789
790PyDoc_STRVAR(_curses_window_get_wch__doc__,
791"get_wch([y, x])\n"
792"Get a wide character from terminal keyboard.\n"
793"\n"
794" y\n"
795" Y-coordinate.\n"
796" x\n"
797" X-coordinate.\n"
798"\n"
799"Return a character for most keys, or an integer for function keys,\n"
800"keypad keys, and other special keys.");
801
802#define _CURSES_WINDOW_GET_WCH_METHODDEF \
803 {"get_wch", (PyCFunction)_curses_window_get_wch, METH_VARARGS, _curses_window_get_wch__doc__},
804
805static PyObject *
806_curses_window_get_wch_impl(PyCursesWindowObject *self, int group_right_1,
807 int y, int x);
808
809static PyObject *
810_curses_window_get_wch(PyCursesWindowObject *self, PyObject *args)
811{
812 PyObject *return_value = NULL;
813 int group_right_1 = 0;
814 int y = 0;
815 int x = 0;
816
817 switch (PyTuple_GET_SIZE(args)) {
818 case 0:
819 break;
820 case 2:
821 if (!PyArg_ParseTuple(args, "ii:get_wch", &y, &x)) {
822 goto exit;
823 }
824 group_right_1 = 1;
825 break;
826 default:
827 PyErr_SetString(PyExc_TypeError, "_curses.window.get_wch requires 0 to 2 arguments");
828 goto exit;
829 }
830 return_value = _curses_window_get_wch_impl(self, group_right_1, y, x);
831
832exit:
833 return return_value;
834}
835
836#endif /* defined(HAVE_NCURSESW) */
837
838PyDoc_STRVAR(_curses_window_hline__doc__,
839"hline([y, x,] ch, n, [attr=_curses.A_NORMAL])\n"
840"Display a horizontal line.\n"
841"\n"
842" y\n"
843" Starting Y-coordinate.\n"
844" x\n"
845" Starting X-coordinate.\n"
846" ch\n"
847" Character to draw.\n"
848" n\n"
849" Line length.\n"
850" attr\n"
851" Attributes for the characters.");
852
853#define _CURSES_WINDOW_HLINE_METHODDEF \
854 {"hline", (PyCFunction)_curses_window_hline, METH_VARARGS, _curses_window_hline__doc__},
855
856static PyObject *
857_curses_window_hline_impl(PyCursesWindowObject *self, int group_left_1,
858 int y, int x, PyObject *ch, int n,
859 int group_right_1, long attr);
860
861static PyObject *
862_curses_window_hline(PyCursesWindowObject *self, PyObject *args)
863{
864 PyObject *return_value = NULL;
865 int group_left_1 = 0;
866 int y = 0;
867 int x = 0;
868 PyObject *ch;
869 int n;
870 int group_right_1 = 0;
871 long attr = A_NORMAL;
872
873 switch (PyTuple_GET_SIZE(args)) {
874 case 2:
875 if (!PyArg_ParseTuple(args, "Oi:hline", &ch, &n)) {
876 goto exit;
877 }
878 break;
879 case 3:
880 if (!PyArg_ParseTuple(args, "Oil:hline", &ch, &n, &attr)) {
881 goto exit;
882 }
883 group_right_1 = 1;
884 break;
885 case 4:
886 if (!PyArg_ParseTuple(args, "iiOi:hline", &y, &x, &ch, &n)) {
887 goto exit;
888 }
889 group_left_1 = 1;
890 break;
891 case 5:
892 if (!PyArg_ParseTuple(args, "iiOil:hline", &y, &x, &ch, &n, &attr)) {
893 goto exit;
894 }
895 group_right_1 = 1;
896 group_left_1 = 1;
897 break;
898 default:
899 PyErr_SetString(PyExc_TypeError, "_curses.window.hline requires 2 to 5 arguments");
900 goto exit;
901 }
902 return_value = _curses_window_hline_impl(self, group_left_1, y, x, ch, n, group_right_1, attr);
903
904exit:
905 return return_value;
906}
907
908PyDoc_STRVAR(_curses_window_insch__doc__,
909"insch([y, x,] ch, [attr=_curses.A_NORMAL])\n"
910"Insert a character before the current or specified position.\n"
911"\n"
912" y\n"
913" Y-coordinate.\n"
914" x\n"
915" X-coordinate.\n"
916" ch\n"
917" Character to insert.\n"
918" attr\n"
919" Attributes for the character.\n"
920"\n"
921"All characters to the right of the cursor are shifted one position right, with\n"
922"the rightmost characters on the line being lost.");
923
924#define _CURSES_WINDOW_INSCH_METHODDEF \
925 {"insch", (PyCFunction)_curses_window_insch, METH_VARARGS, _curses_window_insch__doc__},
926
927static PyObject *
928_curses_window_insch_impl(PyCursesWindowObject *self, int group_left_1,
929 int y, int x, PyObject *ch, int group_right_1,
930 long attr);
931
932static PyObject *
933_curses_window_insch(PyCursesWindowObject *self, PyObject *args)
934{
935 PyObject *return_value = NULL;
936 int group_left_1 = 0;
937 int y = 0;
938 int x = 0;
939 PyObject *ch;
940 int group_right_1 = 0;
941 long attr = A_NORMAL;
942
943 switch (PyTuple_GET_SIZE(args)) {
944 case 1:
945 if (!PyArg_ParseTuple(args, "O:insch", &ch)) {
946 goto exit;
947 }
948 break;
949 case 2:
950 if (!PyArg_ParseTuple(args, "Ol:insch", &ch, &attr)) {
951 goto exit;
952 }
953 group_right_1 = 1;
954 break;
955 case 3:
956 if (!PyArg_ParseTuple(args, "iiO:insch", &y, &x, &ch)) {
957 goto exit;
958 }
959 group_left_1 = 1;
960 break;
961 case 4:
962 if (!PyArg_ParseTuple(args, "iiOl:insch", &y, &x, &ch, &attr)) {
963 goto exit;
964 }
965 group_right_1 = 1;
966 group_left_1 = 1;
967 break;
968 default:
969 PyErr_SetString(PyExc_TypeError, "_curses.window.insch requires 1 to 4 arguments");
970 goto exit;
971 }
972 return_value = _curses_window_insch_impl(self, group_left_1, y, x, ch, group_right_1, attr);
973
974exit:
975 return return_value;
976}
977
978PyDoc_STRVAR(_curses_window_inch__doc__,
979"inch([y, x])\n"
980"Return the character at the given position in the window.\n"
981"\n"
982" y\n"
983" Y-coordinate.\n"
984" x\n"
985" X-coordinate.\n"
986"\n"
987"The bottom 8 bits are the character proper, and upper bits are the attributes.");
988
989#define _CURSES_WINDOW_INCH_METHODDEF \
990 {"inch", (PyCFunction)_curses_window_inch, METH_VARARGS, _curses_window_inch__doc__},
991
992static unsigned long
993_curses_window_inch_impl(PyCursesWindowObject *self, int group_right_1,
994 int y, int x);
995
996static PyObject *
997_curses_window_inch(PyCursesWindowObject *self, PyObject *args)
998{
999 PyObject *return_value = NULL;
1000 int group_right_1 = 0;
1001 int y = 0;
1002 int x = 0;
1003 unsigned long _return_value;
1004
1005 switch (PyTuple_GET_SIZE(args)) {
1006 case 0:
1007 break;
1008 case 2:
1009 if (!PyArg_ParseTuple(args, "ii:inch", &y, &x)) {
1010 goto exit;
1011 }
1012 group_right_1 = 1;
1013 break;
1014 default:
1015 PyErr_SetString(PyExc_TypeError, "_curses.window.inch requires 0 to 2 arguments");
1016 goto exit;
1017 }
1018 _return_value = _curses_window_inch_impl(self, group_right_1, y, x);
1019 if ((_return_value == (unsigned long)-1) && PyErr_Occurred()) {
1020 goto exit;
1021 }
1022 return_value = PyLong_FromUnsignedLong(_return_value);
1023
1024exit:
1025 return return_value;
1026}
1027
1028PyDoc_STRVAR(_curses_window_insstr__doc__,
1029"insstr([y, x,] str, [attr])\n"
1030"Insert the string before the current or specified position.\n"
1031"\n"
1032" y\n"
1033" Y-coordinate.\n"
1034" x\n"
1035" X-coordinate.\n"
1036" str\n"
1037" String to insert.\n"
1038" attr\n"
1039" Attributes for characters.\n"
1040"\n"
1041"Insert a character string (as many characters as will fit on the line)\n"
1042"before the character under the cursor. All characters to the right of\n"
1043"the cursor are shifted right, with the rightmost characters on the line\n"
1044"being lost. The cursor position does not change (after moving to y, x,\n"
1045"if specified).");
1046
1047#define _CURSES_WINDOW_INSSTR_METHODDEF \
1048 {"insstr", (PyCFunction)_curses_window_insstr, METH_VARARGS, _curses_window_insstr__doc__},
1049
1050static PyObject *
1051_curses_window_insstr_impl(PyCursesWindowObject *self, int group_left_1,
1052 int y, int x, PyObject *str, int group_right_1,
1053 long attr);
1054
1055static PyObject *
1056_curses_window_insstr(PyCursesWindowObject *self, PyObject *args)
1057{
1058 PyObject *return_value = NULL;
1059 int group_left_1 = 0;
1060 int y = 0;
1061 int x = 0;
1062 PyObject *str;
1063 int group_right_1 = 0;
1064 long attr = 0;
1065
1066 switch (PyTuple_GET_SIZE(args)) {
1067 case 1:
1068 if (!PyArg_ParseTuple(args, "O:insstr", &str)) {
1069 goto exit;
1070 }
1071 break;
1072 case 2:
1073 if (!PyArg_ParseTuple(args, "Ol:insstr", &str, &attr)) {
1074 goto exit;
1075 }
1076 group_right_1 = 1;
1077 break;
1078 case 3:
1079 if (!PyArg_ParseTuple(args, "iiO:insstr", &y, &x, &str)) {
1080 goto exit;
1081 }
1082 group_left_1 = 1;
1083 break;
1084 case 4:
1085 if (!PyArg_ParseTuple(args, "iiOl:insstr", &y, &x, &str, &attr)) {
1086 goto exit;
1087 }
1088 group_right_1 = 1;
1089 group_left_1 = 1;
1090 break;
1091 default:
1092 PyErr_SetString(PyExc_TypeError, "_curses.window.insstr requires 1 to 4 arguments");
1093 goto exit;
1094 }
1095 return_value = _curses_window_insstr_impl(self, group_left_1, y, x, str, group_right_1, attr);
1096
1097exit:
1098 return return_value;
1099}
1100
1101PyDoc_STRVAR(_curses_window_insnstr__doc__,
1102"insnstr([y, x,] str, n, [attr])\n"
1103"Insert at most n characters of the string.\n"
1104"\n"
1105" y\n"
1106" Y-coordinate.\n"
1107" x\n"
1108" X-coordinate.\n"
1109" str\n"
1110" String to insert.\n"
1111" n\n"
1112" Maximal number of characters.\n"
1113" attr\n"
1114" Attributes for characters.\n"
1115"\n"
1116"Insert a character string (as many characters as will fit on the line)\n"
1117"before the character under the cursor, up to n characters. If n is zero\n"
1118"or negative, the entire string is inserted. All characters to the right\n"
1119"of the cursor are shifted right, with the rightmost characters on the line\n"
1120"being lost. The cursor position does not change (after moving to y, x, if\n"
1121"specified).");
1122
1123#define _CURSES_WINDOW_INSNSTR_METHODDEF \
1124 {"insnstr", (PyCFunction)_curses_window_insnstr, METH_VARARGS, _curses_window_insnstr__doc__},
1125
1126static PyObject *
1127_curses_window_insnstr_impl(PyCursesWindowObject *self, int group_left_1,
1128 int y, int x, PyObject *str, int n,
1129 int group_right_1, long attr);
1130
1131static PyObject *
1132_curses_window_insnstr(PyCursesWindowObject *self, PyObject *args)
1133{
1134 PyObject *return_value = NULL;
1135 int group_left_1 = 0;
1136 int y = 0;
1137 int x = 0;
1138 PyObject *str;
1139 int n;
1140 int group_right_1 = 0;
1141 long attr = 0;
1142
1143 switch (PyTuple_GET_SIZE(args)) {
1144 case 2:
1145 if (!PyArg_ParseTuple(args, "Oi:insnstr", &str, &n)) {
1146 goto exit;
1147 }
1148 break;
1149 case 3:
1150 if (!PyArg_ParseTuple(args, "Oil:insnstr", &str, &n, &attr)) {
1151 goto exit;
1152 }
1153 group_right_1 = 1;
1154 break;
1155 case 4:
1156 if (!PyArg_ParseTuple(args, "iiOi:insnstr", &y, &x, &str, &n)) {
1157 goto exit;
1158 }
1159 group_left_1 = 1;
1160 break;
1161 case 5:
1162 if (!PyArg_ParseTuple(args, "iiOil:insnstr", &y, &x, &str, &n, &attr)) {
1163 goto exit;
1164 }
1165 group_right_1 = 1;
1166 group_left_1 = 1;
1167 break;
1168 default:
1169 PyErr_SetString(PyExc_TypeError, "_curses.window.insnstr requires 2 to 5 arguments");
1170 goto exit;
1171 }
1172 return_value = _curses_window_insnstr_impl(self, group_left_1, y, x, str, n, group_right_1, attr);
1173
1174exit:
1175 return return_value;
1176}
1177
1178PyDoc_STRVAR(_curses_window_is_linetouched__doc__,
1179"is_linetouched($self, line, /)\n"
1180"--\n"
1181"\n"
1182"Return True if the specified line was modified, otherwise return False.\n"
1183"\n"
1184" line\n"
1185" Line number.\n"
1186"\n"
1187"Raise a curses.error exception if line is not valid for the given window.");
1188
1189#define _CURSES_WINDOW_IS_LINETOUCHED_METHODDEF \
1190 {"is_linetouched", (PyCFunction)_curses_window_is_linetouched, METH_O, _curses_window_is_linetouched__doc__},
1191
1192static PyObject *
1193_curses_window_is_linetouched_impl(PyCursesWindowObject *self, int line);
1194
1195static PyObject *
1196_curses_window_is_linetouched(PyCursesWindowObject *self, PyObject *arg)
1197{
1198 PyObject *return_value = NULL;
1199 int line;
1200
1201 if (!PyArg_Parse(arg, "i:is_linetouched", &line)) {
1202 goto exit;
1203 }
1204 return_value = _curses_window_is_linetouched_impl(self, line);
1205
1206exit:
1207 return return_value;
1208}
1209
1210#if defined(py_is_pad)
1211
1212PyDoc_STRVAR(_curses_window_noutrefresh__doc__,
1213"noutrefresh([pminrow, pmincol, sminrow, smincol, smaxrow, smaxcol])\n"
1214"Mark for refresh but wait.\n"
1215"\n"
1216"This function updates the data structure representing the desired state of the\n"
1217"window, but does not force an update of the physical screen. To accomplish\n"
1218"that, call doupdate().");
1219
1220#define _CURSES_WINDOW_NOUTREFRESH_METHODDEF \
1221 {"noutrefresh", (PyCFunction)_curses_window_noutrefresh, METH_VARARGS, _curses_window_noutrefresh__doc__},
1222
1223static PyObject *
1224_curses_window_noutrefresh_impl(PyCursesWindowObject *self,
1225 int group_right_1, int pminrow, int pmincol,
1226 int sminrow, int smincol, int smaxrow,
1227 int smaxcol);
1228
1229static PyObject *
1230_curses_window_noutrefresh(PyCursesWindowObject *self, PyObject *args)
1231{
1232 PyObject *return_value = NULL;
1233 int group_right_1 = 0;
1234 int pminrow = 0;
1235 int pmincol = 0;
1236 int sminrow = 0;
1237 int smincol = 0;
1238 int smaxrow = 0;
1239 int smaxcol = 0;
1240
1241 switch (PyTuple_GET_SIZE(args)) {
1242 case 0:
1243 break;
1244 case 6:
1245 if (!PyArg_ParseTuple(args, "iiiiii:noutrefresh", &pminrow, &pmincol, &sminrow, &smincol, &smaxrow, &smaxcol)) {
1246 goto exit;
1247 }
1248 group_right_1 = 1;
1249 break;
1250 default:
1251 PyErr_SetString(PyExc_TypeError, "_curses.window.noutrefresh requires 0 to 6 arguments");
1252 goto exit;
1253 }
1254 return_value = _curses_window_noutrefresh_impl(self, group_right_1, pminrow, pmincol, sminrow, smincol, smaxrow, smaxcol);
1255
1256exit:
1257 return return_value;
1258}
1259
1260#endif /* defined(py_is_pad) */
1261
1262#if !defined(py_is_pad)
1263
1264PyDoc_STRVAR(_curses_window_noutrefresh__doc__,
1265"noutrefresh($self, /)\n"
1266"--\n"
1267"\n"
1268"Mark for refresh but wait.\n"
1269"\n"
1270"This function updates the data structure representing the desired state of the\n"
1271"window, but does not force an update of the physical screen. To accomplish\n"
1272"that, call doupdate().");
1273
1274#define _CURSES_WINDOW_NOUTREFRESH_METHODDEF \
1275 {"noutrefresh", (PyCFunction)_curses_window_noutrefresh, METH_NOARGS, _curses_window_noutrefresh__doc__},
1276
1277static PyObject *
1278_curses_window_noutrefresh_impl(PyCursesWindowObject *self);
1279
1280static PyObject *
1281_curses_window_noutrefresh(PyCursesWindowObject *self, PyObject *Py_UNUSED(ignored))
1282{
1283 return _curses_window_noutrefresh_impl(self);
1284}
1285
1286#endif /* !defined(py_is_pad) */
1287
1288PyDoc_STRVAR(_curses_window_overlay__doc__,
1289"overlay(destwin, [sminrow, smincol, dminrow, dmincol, dmaxrow, dmaxcol])\n"
1290"Overlay the window on top of destwin.\n"
1291"\n"
1292"The windows need not be the same size, only the overlapping region is copied.\n"
1293"This copy is non-destructive, which means that the current background\n"
1294"character does not overwrite the old contents of destwin.\n"
1295"\n"
1296"To get fine-grained control over the copied region, the second form of\n"
1297"overlay() can be used. sminrow and smincol are the upper-left coordinates\n"
1298"of the source window, and the other variables mark a rectangle in the\n"
1299"destination window.");
1300
1301#define _CURSES_WINDOW_OVERLAY_METHODDEF \
1302 {"overlay", (PyCFunction)_curses_window_overlay, METH_VARARGS, _curses_window_overlay__doc__},
1303
1304static PyObject *
1305_curses_window_overlay_impl(PyCursesWindowObject *self,
1306 PyCursesWindowObject *destwin, int group_right_1,
1307 int sminrow, int smincol, int dminrow,
1308 int dmincol, int dmaxrow, int dmaxcol);
1309
1310static PyObject *
1311_curses_window_overlay(PyCursesWindowObject *self, PyObject *args)
1312{
1313 PyObject *return_value = NULL;
1314 PyCursesWindowObject *destwin;
1315 int group_right_1 = 0;
1316 int sminrow = 0;
1317 int smincol = 0;
1318 int dminrow = 0;
1319 int dmincol = 0;
1320 int dmaxrow = 0;
1321 int dmaxcol = 0;
1322
1323 switch (PyTuple_GET_SIZE(args)) {
1324 case 1:
1325 if (!PyArg_ParseTuple(args, "O!:overlay", &PyCursesWindow_Type, &destwin)) {
1326 goto exit;
1327 }
1328 break;
1329 case 7:
1330 if (!PyArg_ParseTuple(args, "O!iiiiii:overlay", &PyCursesWindow_Type, &destwin, &sminrow, &smincol, &dminrow, &dmincol, &dmaxrow, &dmaxcol)) {
1331 goto exit;
1332 }
1333 group_right_1 = 1;
1334 break;
1335 default:
1336 PyErr_SetString(PyExc_TypeError, "_curses.window.overlay requires 1 to 7 arguments");
1337 goto exit;
1338 }
1339 return_value = _curses_window_overlay_impl(self, destwin, group_right_1, sminrow, smincol, dminrow, dmincol, dmaxrow, dmaxcol);
1340
1341exit:
1342 return return_value;
1343}
1344
1345PyDoc_STRVAR(_curses_window_overwrite__doc__,
1346"overwrite(destwin, [sminrow, smincol, dminrow, dmincol, dmaxrow,\n"
1347" dmaxcol])\n"
1348"Overwrite the window on top of destwin.\n"
1349"\n"
1350"The windows need not be the same size, in which case only the overlapping\n"
1351"region is copied. This copy is destructive, which means that the current\n"
1352"background character overwrites the old contents of destwin.\n"
1353"\n"
1354"To get fine-grained control over the copied region, the second form of\n"
1355"overwrite() can be used. sminrow and smincol are the upper-left coordinates\n"
1356"of the source window, the other variables mark a rectangle in the destination\n"
1357"window.");
1358
1359#define _CURSES_WINDOW_OVERWRITE_METHODDEF \
1360 {"overwrite", (PyCFunction)_curses_window_overwrite, METH_VARARGS, _curses_window_overwrite__doc__},
1361
1362static PyObject *
1363_curses_window_overwrite_impl(PyCursesWindowObject *self,
1364 PyCursesWindowObject *destwin,
1365 int group_right_1, int sminrow, int smincol,
1366 int dminrow, int dmincol, int dmaxrow,
1367 int dmaxcol);
1368
1369static PyObject *
1370_curses_window_overwrite(PyCursesWindowObject *self, PyObject *args)
1371{
1372 PyObject *return_value = NULL;
1373 PyCursesWindowObject *destwin;
1374 int group_right_1 = 0;
1375 int sminrow = 0;
1376 int smincol = 0;
1377 int dminrow = 0;
1378 int dmincol = 0;
1379 int dmaxrow = 0;
1380 int dmaxcol = 0;
1381
1382 switch (PyTuple_GET_SIZE(args)) {
1383 case 1:
1384 if (!PyArg_ParseTuple(args, "O!:overwrite", &PyCursesWindow_Type, &destwin)) {
1385 goto exit;
1386 }
1387 break;
1388 case 7:
1389 if (!PyArg_ParseTuple(args, "O!iiiiii:overwrite", &PyCursesWindow_Type, &destwin, &sminrow, &smincol, &dminrow, &dmincol, &dmaxrow, &dmaxcol)) {
1390 goto exit;
1391 }
1392 group_right_1 = 1;
1393 break;
1394 default:
1395 PyErr_SetString(PyExc_TypeError, "_curses.window.overwrite requires 1 to 7 arguments");
1396 goto exit;
1397 }
1398 return_value = _curses_window_overwrite_impl(self, destwin, group_right_1, sminrow, smincol, dminrow, dmincol, dmaxrow, dmaxcol);
1399
1400exit:
1401 return return_value;
1402}
1403
1404PyDoc_STRVAR(_curses_window_putwin__doc__,
1405"putwin($self, file, /)\n"
1406"--\n"
1407"\n"
1408"Write all data associated with the window into the provided file object.\n"
1409"\n"
1410"This information can be later retrieved using the getwin() function.");
1411
1412#define _CURSES_WINDOW_PUTWIN_METHODDEF \
1413 {"putwin", (PyCFunction)_curses_window_putwin, METH_O, _curses_window_putwin__doc__},
1414
1415PyDoc_STRVAR(_curses_window_redrawln__doc__,
1416"redrawln($self, beg, num, /)\n"
1417"--\n"
1418"\n"
1419"Mark the specified lines corrupted.\n"
1420"\n"
1421" beg\n"
1422" Starting line number.\n"
1423" num\n"
1424" The number of lines.\n"
1425"\n"
1426"They should be completely redrawn on the next refresh() call.");
1427
1428#define _CURSES_WINDOW_REDRAWLN_METHODDEF \
1429 {"redrawln", (PyCFunction)_curses_window_redrawln, METH_FASTCALL, _curses_window_redrawln__doc__},
1430
1431static PyObject *
1432_curses_window_redrawln_impl(PyCursesWindowObject *self, int beg, int num);
1433
1434static PyObject *
1435_curses_window_redrawln(PyCursesWindowObject *self, PyObject *const *args, Py_ssize_t nargs)
1436{
1437 PyObject *return_value = NULL;
1438 int beg;
1439 int num;
1440
1441 if (!_PyArg_ParseStack(args, nargs, "ii:redrawln",
1442 &beg, &num)) {
1443 goto exit;
1444 }
1445 return_value = _curses_window_redrawln_impl(self, beg, num);
1446
1447exit:
1448 return return_value;
1449}
1450
1451PyDoc_STRVAR(_curses_window_refresh__doc__,
1452"refresh([pminrow, pmincol, sminrow, smincol, smaxrow, smaxcol])\n"
1453"Update the display immediately.\n"
1454"\n"
1455"Synchronize actual screen with previous drawing/deleting methods.\n"
1456"The 6 optional arguments can only be specified when the window is a pad\n"
1457"created with newpad(). The additional parameters are needed to indicate\n"
1458"what part of the pad and screen are involved. pminrow and pmincol specify\n"
1459"the upper left-hand corner of the rectangle to be displayed in the pad.\n"
1460"sminrow, smincol, smaxrow, and smaxcol specify the edges of the rectangle to\n"
1461"be displayed on the screen. The lower right-hand corner of the rectangle to\n"
1462"be displayed in the pad is calculated from the screen coordinates, since the\n"
1463"rectangles must be the same size. Both rectangles must be entirely contained\n"
1464"within their respective structures. Negative values of pminrow, pmincol,\n"
1465"sminrow, or smincol are treated as if they were zero.");
1466
1467#define _CURSES_WINDOW_REFRESH_METHODDEF \
1468 {"refresh", (PyCFunction)_curses_window_refresh, METH_VARARGS, _curses_window_refresh__doc__},
1469
1470static PyObject *
1471_curses_window_refresh_impl(PyCursesWindowObject *self, int group_right_1,
1472 int pminrow, int pmincol, int sminrow,
1473 int smincol, int smaxrow, int smaxcol);
1474
1475static PyObject *
1476_curses_window_refresh(PyCursesWindowObject *self, PyObject *args)
1477{
1478 PyObject *return_value = NULL;
1479 int group_right_1 = 0;
1480 int pminrow = 0;
1481 int pmincol = 0;
1482 int sminrow = 0;
1483 int smincol = 0;
1484 int smaxrow = 0;
1485 int smaxcol = 0;
1486
1487 switch (PyTuple_GET_SIZE(args)) {
1488 case 0:
1489 break;
1490 case 6:
1491 if (!PyArg_ParseTuple(args, "iiiiii:refresh", &pminrow, &pmincol, &sminrow, &smincol, &smaxrow, &smaxcol)) {
1492 goto exit;
1493 }
1494 group_right_1 = 1;
1495 break;
1496 default:
1497 PyErr_SetString(PyExc_TypeError, "_curses.window.refresh requires 0 to 6 arguments");
1498 goto exit;
1499 }
1500 return_value = _curses_window_refresh_impl(self, group_right_1, pminrow, pmincol, sminrow, smincol, smaxrow, smaxcol);
1501
1502exit:
1503 return return_value;
1504}
1505
1506PyDoc_STRVAR(_curses_window_setscrreg__doc__,
1507"setscrreg($self, top, bottom, /)\n"
1508"--\n"
1509"\n"
1510"Define a software scrolling region.\n"
1511"\n"
1512" top\n"
1513" First line number.\n"
1514" bottom\n"
1515" Last line number.\n"
1516"\n"
1517"All scrolling actions will take place in this region.");
1518
1519#define _CURSES_WINDOW_SETSCRREG_METHODDEF \
1520 {"setscrreg", (PyCFunction)_curses_window_setscrreg, METH_FASTCALL, _curses_window_setscrreg__doc__},
1521
1522static PyObject *
1523_curses_window_setscrreg_impl(PyCursesWindowObject *self, int top,
1524 int bottom);
1525
1526static PyObject *
1527_curses_window_setscrreg(PyCursesWindowObject *self, PyObject *const *args, Py_ssize_t nargs)
1528{
1529 PyObject *return_value = NULL;
1530 int top;
1531 int bottom;
1532
1533 if (!_PyArg_ParseStack(args, nargs, "ii:setscrreg",
1534 &top, &bottom)) {
1535 goto exit;
1536 }
1537 return_value = _curses_window_setscrreg_impl(self, top, bottom);
1538
1539exit:
1540 return return_value;
1541}
1542
1543PyDoc_STRVAR(_curses_window_subwin__doc__,
1544"subwin([nlines=0, ncols=0,] begin_y, begin_x)\n"
1545"Create a sub-window (screen-relative coordinates).\n"
1546"\n"
1547" nlines\n"
1548" Height.\n"
1549" ncols\n"
1550" Width.\n"
1551" begin_y\n"
1552" Top side y-coordinate.\n"
1553" begin_x\n"
1554" Left side x-coordinate.\n"
1555"\n"
1556"By default, the sub-window will extend from the specified position to the\n"
1557"lower right corner of the window.");
1558
1559#define _CURSES_WINDOW_SUBWIN_METHODDEF \
1560 {"subwin", (PyCFunction)_curses_window_subwin, METH_VARARGS, _curses_window_subwin__doc__},
1561
1562static PyObject *
1563_curses_window_subwin_impl(PyCursesWindowObject *self, int group_left_1,
1564 int nlines, int ncols, int begin_y, int begin_x);
1565
1566static PyObject *
1567_curses_window_subwin(PyCursesWindowObject *self, PyObject *args)
1568{
1569 PyObject *return_value = NULL;
1570 int group_left_1 = 0;
1571 int nlines = 0;
1572 int ncols = 0;
1573 int begin_y;
1574 int begin_x;
1575
1576 switch (PyTuple_GET_SIZE(args)) {
1577 case 2:
1578 if (!PyArg_ParseTuple(args, "ii:subwin", &begin_y, &begin_x)) {
1579 goto exit;
1580 }
1581 break;
1582 case 4:
1583 if (!PyArg_ParseTuple(args, "iiii:subwin", &nlines, &ncols, &begin_y, &begin_x)) {
1584 goto exit;
1585 }
1586 group_left_1 = 1;
1587 break;
1588 default:
1589 PyErr_SetString(PyExc_TypeError, "_curses.window.subwin requires 2 to 4 arguments");
1590 goto exit;
1591 }
1592 return_value = _curses_window_subwin_impl(self, group_left_1, nlines, ncols, begin_y, begin_x);
1593
1594exit:
1595 return return_value;
1596}
1597
1598PyDoc_STRVAR(_curses_window_scroll__doc__,
1599"scroll([lines=1])\n"
1600"Scroll the screen or scrolling region.\n"
1601"\n"
1602" lines\n"
1603" Number of lines to scroll.\n"
1604"\n"
1605"Scroll upward if the argument is positive and downward if it is negative.");
1606
1607#define _CURSES_WINDOW_SCROLL_METHODDEF \
1608 {"scroll", (PyCFunction)_curses_window_scroll, METH_VARARGS, _curses_window_scroll__doc__},
1609
1610static PyObject *
1611_curses_window_scroll_impl(PyCursesWindowObject *self, int group_right_1,
1612 int lines);
1613
1614static PyObject *
1615_curses_window_scroll(PyCursesWindowObject *self, PyObject *args)
1616{
1617 PyObject *return_value = NULL;
1618 int group_right_1 = 0;
1619 int lines = 1;
1620
1621 switch (PyTuple_GET_SIZE(args)) {
1622 case 0:
1623 break;
1624 case 1:
1625 if (!PyArg_ParseTuple(args, "i:scroll", &lines)) {
1626 goto exit;
1627 }
1628 group_right_1 = 1;
1629 break;
1630 default:
1631 PyErr_SetString(PyExc_TypeError, "_curses.window.scroll requires 0 to 1 arguments");
1632 goto exit;
1633 }
1634 return_value = _curses_window_scroll_impl(self, group_right_1, lines);
1635
1636exit:
1637 return return_value;
1638}
1639
1640PyDoc_STRVAR(_curses_window_touchline__doc__,
1641"touchline(start, count, [changed=True])\n"
1642"Pretend count lines have been changed, starting with line start.\n"
1643"\n"
1644"If changed is supplied, it specifies whether the affected lines are marked\n"
1645"as having been changed (changed=True) or unchanged (changed=False).");
1646
1647#define _CURSES_WINDOW_TOUCHLINE_METHODDEF \
1648 {"touchline", (PyCFunction)_curses_window_touchline, METH_VARARGS, _curses_window_touchline__doc__},
1649
1650static PyObject *
1651_curses_window_touchline_impl(PyCursesWindowObject *self, int start,
1652 int count, int group_right_1, int changed);
1653
1654static PyObject *
1655_curses_window_touchline(PyCursesWindowObject *self, PyObject *args)
1656{
1657 PyObject *return_value = NULL;
1658 int start;
1659 int count;
1660 int group_right_1 = 0;
1661 int changed = 1;
1662
1663 switch (PyTuple_GET_SIZE(args)) {
1664 case 2:
1665 if (!PyArg_ParseTuple(args, "ii:touchline", &start, &count)) {
1666 goto exit;
1667 }
1668 break;
1669 case 3:
1670 if (!PyArg_ParseTuple(args, "iii:touchline", &start, &count, &changed)) {
1671 goto exit;
1672 }
1673 group_right_1 = 1;
1674 break;
1675 default:
1676 PyErr_SetString(PyExc_TypeError, "_curses.window.touchline requires 2 to 3 arguments");
1677 goto exit;
1678 }
1679 return_value = _curses_window_touchline_impl(self, start, count, group_right_1, changed);
1680
1681exit:
1682 return return_value;
1683}
1684
1685PyDoc_STRVAR(_curses_window_vline__doc__,
1686"vline([y, x,] ch, n, [attr=_curses.A_NORMAL])\n"
1687"Display a vertical line.\n"
1688"\n"
1689" y\n"
1690" Starting Y-coordinate.\n"
1691" x\n"
1692" Starting X-coordinate.\n"
1693" ch\n"
1694" Character to draw.\n"
1695" n\n"
1696" Line length.\n"
1697" attr\n"
1698" Attributes for the character.");
1699
1700#define _CURSES_WINDOW_VLINE_METHODDEF \
1701 {"vline", (PyCFunction)_curses_window_vline, METH_VARARGS, _curses_window_vline__doc__},
1702
1703static PyObject *
1704_curses_window_vline_impl(PyCursesWindowObject *self, int group_left_1,
1705 int y, int x, PyObject *ch, int n,
1706 int group_right_1, long attr);
1707
1708static PyObject *
1709_curses_window_vline(PyCursesWindowObject *self, PyObject *args)
1710{
1711 PyObject *return_value = NULL;
1712 int group_left_1 = 0;
1713 int y = 0;
1714 int x = 0;
1715 PyObject *ch;
1716 int n;
1717 int group_right_1 = 0;
1718 long attr = A_NORMAL;
1719
1720 switch (PyTuple_GET_SIZE(args)) {
1721 case 2:
1722 if (!PyArg_ParseTuple(args, "Oi:vline", &ch, &n)) {
1723 goto exit;
1724 }
1725 break;
1726 case 3:
1727 if (!PyArg_ParseTuple(args, "Oil:vline", &ch, &n, &attr)) {
1728 goto exit;
1729 }
1730 group_right_1 = 1;
1731 break;
1732 case 4:
1733 if (!PyArg_ParseTuple(args, "iiOi:vline", &y, &x, &ch, &n)) {
1734 goto exit;
1735 }
1736 group_left_1 = 1;
1737 break;
1738 case 5:
1739 if (!PyArg_ParseTuple(args, "iiOil:vline", &y, &x, &ch, &n, &attr)) {
1740 goto exit;
1741 }
1742 group_right_1 = 1;
1743 group_left_1 = 1;
1744 break;
1745 default:
1746 PyErr_SetString(PyExc_TypeError, "_curses.window.vline requires 2 to 5 arguments");
1747 goto exit;
1748 }
1749 return_value = _curses_window_vline_impl(self, group_left_1, y, x, ch, n, group_right_1, attr);
1750
1751exit:
1752 return return_value;
1753}
1754
1755#if defined(HAVE_CURSES_FILTER)
1756
1757PyDoc_STRVAR(_curses_filter__doc__,
1758"filter($module, /)\n"
1759"--\n"
1760"\n");
1761
1762#define _CURSES_FILTER_METHODDEF \
1763 {"filter", (PyCFunction)_curses_filter, METH_NOARGS, _curses_filter__doc__},
1764
1765static PyObject *
1766_curses_filter_impl(PyObject *module);
1767
1768static PyObject *
1769_curses_filter(PyObject *module, PyObject *Py_UNUSED(ignored))
1770{
1771 return _curses_filter_impl(module);
1772}
1773
1774#endif /* defined(HAVE_CURSES_FILTER) */
1775
1776PyDoc_STRVAR(_curses_baudrate__doc__,
1777"baudrate($module, /)\n"
1778"--\n"
1779"\n"
1780"Return the output speed of the terminal in bits per second.");
1781
1782#define _CURSES_BAUDRATE_METHODDEF \
1783 {"baudrate", (PyCFunction)_curses_baudrate, METH_NOARGS, _curses_baudrate__doc__},
1784
1785static PyObject *
1786_curses_baudrate_impl(PyObject *module);
1787
1788static PyObject *
1789_curses_baudrate(PyObject *module, PyObject *Py_UNUSED(ignored))
1790{
1791 return _curses_baudrate_impl(module);
1792}
1793
1794PyDoc_STRVAR(_curses_beep__doc__,
1795"beep($module, /)\n"
1796"--\n"
1797"\n"
1798"Emit a short attention sound.");
1799
1800#define _CURSES_BEEP_METHODDEF \
1801 {"beep", (PyCFunction)_curses_beep, METH_NOARGS, _curses_beep__doc__},
1802
1803static PyObject *
1804_curses_beep_impl(PyObject *module);
1805
1806static PyObject *
1807_curses_beep(PyObject *module, PyObject *Py_UNUSED(ignored))
1808{
1809 return _curses_beep_impl(module);
1810}
1811
1812PyDoc_STRVAR(_curses_can_change_color__doc__,
1813"can_change_color($module, /)\n"
1814"--\n"
1815"\n"
1816"Return True if the programmer can change the colors displayed by the terminal.");
1817
1818#define _CURSES_CAN_CHANGE_COLOR_METHODDEF \
1819 {"can_change_color", (PyCFunction)_curses_can_change_color, METH_NOARGS, _curses_can_change_color__doc__},
1820
1821static PyObject *
1822_curses_can_change_color_impl(PyObject *module);
1823
1824static PyObject *
1825_curses_can_change_color(PyObject *module, PyObject *Py_UNUSED(ignored))
1826{
1827 return _curses_can_change_color_impl(module);
1828}
1829
1830PyDoc_STRVAR(_curses_cbreak__doc__,
1831"cbreak($module, flag=True, /)\n"
1832"--\n"
1833"\n"
1834"Enter cbreak mode.\n"
1835"\n"
1836" flag\n"
1837" If false, the effect is the same as calling nocbreak().\n"
1838"\n"
1839"In cbreak mode (sometimes called \"rare\" mode) normal tty line buffering is\n"
1840"turned off and characters are available to be read one by one. However,\n"
1841"unlike raw mode, special characters (interrupt, quit, suspend, and flow\n"
1842"control) retain their effects on the tty driver and calling program.\n"
1843"Calling first raw() then cbreak() leaves the terminal in cbreak mode.");
1844
1845#define _CURSES_CBREAK_METHODDEF \
1846 {"cbreak", (PyCFunction)_curses_cbreak, METH_FASTCALL, _curses_cbreak__doc__},
1847
1848static PyObject *
1849_curses_cbreak_impl(PyObject *module, int flag);
1850
1851static PyObject *
1852_curses_cbreak(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
1853{
1854 PyObject *return_value = NULL;
1855 int flag = 1;
1856
1857 if (!_PyArg_ParseStack(args, nargs, "|i:cbreak",
1858 &flag)) {
1859 goto exit;
1860 }
1861 return_value = _curses_cbreak_impl(module, flag);
1862
1863exit:
1864 return return_value;
1865}
1866
1867PyDoc_STRVAR(_curses_color_content__doc__,
1868"color_content($module, color_number, /)\n"
1869"--\n"
1870"\n"
1871"Return the red, green, and blue (RGB) components of the specified color.\n"
1872"\n"
1873" color_number\n"
1874" The number of the color (0 - COLORS).\n"
1875"\n"
1876"A 3-tuple is returned, containing the R, G, B values for the given color,\n"
1877"which will be between 0 (no component) and 1000 (maximum amount of component).");
1878
1879#define _CURSES_COLOR_CONTENT_METHODDEF \
1880 {"color_content", (PyCFunction)_curses_color_content, METH_O, _curses_color_content__doc__},
1881
1882static PyObject *
1883_curses_color_content_impl(PyObject *module, short color_number);
1884
1885static PyObject *
1886_curses_color_content(PyObject *module, PyObject *arg)
1887{
1888 PyObject *return_value = NULL;
1889 short color_number;
1890
1891 if (!PyArg_Parse(arg, "h:color_content", &color_number)) {
1892 goto exit;
1893 }
1894 return_value = _curses_color_content_impl(module, color_number);
1895
1896exit:
1897 return return_value;
1898}
1899
1900PyDoc_STRVAR(_curses_color_pair__doc__,
1901"color_pair($module, color_number, /)\n"
1902"--\n"
1903"\n"
1904"Return the attribute value for displaying text in the specified color.\n"
1905"\n"
1906" color_number\n"
1907" The number of the color (0 - COLORS).\n"
1908"\n"
1909"This attribute value can be combined with A_STANDOUT, A_REVERSE, and the\n"
1910"other A_* attributes. pair_number() is the counterpart to this function.");
1911
1912#define _CURSES_COLOR_PAIR_METHODDEF \
1913 {"color_pair", (PyCFunction)_curses_color_pair, METH_O, _curses_color_pair__doc__},
1914
1915static PyObject *
1916_curses_color_pair_impl(PyObject *module, short color_number);
1917
1918static PyObject *
1919_curses_color_pair(PyObject *module, PyObject *arg)
1920{
1921 PyObject *return_value = NULL;
1922 short color_number;
1923
1924 if (!PyArg_Parse(arg, "h:color_pair", &color_number)) {
1925 goto exit;
1926 }
1927 return_value = _curses_color_pair_impl(module, color_number);
1928
1929exit:
1930 return return_value;
1931}
1932
1933PyDoc_STRVAR(_curses_curs_set__doc__,
1934"curs_set($module, visibility, /)\n"
1935"--\n"
1936"\n"
1937"Set the cursor state.\n"
1938"\n"
1939" visibility\n"
1940" 0 for invisible, 1 for normal visible, or 2 for very visible.\n"
1941"\n"
1942"If the terminal supports the visibility requested, the previous cursor\n"
1943"state is returned; otherwise, an exception is raised. On many terminals,\n"
1944"the \"visible\" mode is an underline cursor and the \"very visible\" mode is\n"
1945"a block cursor.");
1946
1947#define _CURSES_CURS_SET_METHODDEF \
1948 {"curs_set", (PyCFunction)_curses_curs_set, METH_O, _curses_curs_set__doc__},
1949
1950static PyObject *
1951_curses_curs_set_impl(PyObject *module, int visibility);
1952
1953static PyObject *
1954_curses_curs_set(PyObject *module, PyObject *arg)
1955{
1956 PyObject *return_value = NULL;
1957 int visibility;
1958
1959 if (!PyArg_Parse(arg, "i:curs_set", &visibility)) {
1960 goto exit;
1961 }
1962 return_value = _curses_curs_set_impl(module, visibility);
1963
1964exit:
1965 return return_value;
1966}
1967
1968PyDoc_STRVAR(_curses_def_prog_mode__doc__,
1969"def_prog_mode($module, /)\n"
1970"--\n"
1971"\n"
1972"Save the current terminal mode as the \"program\" mode.\n"
1973"\n"
1974"The \"program\" mode is the mode when the running program is using curses.\n"
1975"\n"
1976"Subsequent calls to reset_prog_mode() will restore this mode.");
1977
1978#define _CURSES_DEF_PROG_MODE_METHODDEF \
1979 {"def_prog_mode", (PyCFunction)_curses_def_prog_mode, METH_NOARGS, _curses_def_prog_mode__doc__},
1980
1981static PyObject *
1982_curses_def_prog_mode_impl(PyObject *module);
1983
1984static PyObject *
1985_curses_def_prog_mode(PyObject *module, PyObject *Py_UNUSED(ignored))
1986{
1987 return _curses_def_prog_mode_impl(module);
1988}
1989
1990PyDoc_STRVAR(_curses_def_shell_mode__doc__,
1991"def_shell_mode($module, /)\n"
1992"--\n"
1993"\n"
1994"Save the current terminal mode as the \"shell\" mode.\n"
1995"\n"
1996"The \"shell\" mode is the mode when the running program is not using curses.\n"
1997"\n"
1998"Subsequent calls to reset_shell_mode() will restore this mode.");
1999
2000#define _CURSES_DEF_SHELL_MODE_METHODDEF \
2001 {"def_shell_mode", (PyCFunction)_curses_def_shell_mode, METH_NOARGS, _curses_def_shell_mode__doc__},
2002
2003static PyObject *
2004_curses_def_shell_mode_impl(PyObject *module);
2005
2006static PyObject *
2007_curses_def_shell_mode(PyObject *module, PyObject *Py_UNUSED(ignored))
2008{
2009 return _curses_def_shell_mode_impl(module);
2010}
2011
2012PyDoc_STRVAR(_curses_delay_output__doc__,
2013"delay_output($module, ms, /)\n"
2014"--\n"
2015"\n"
2016"Insert a pause in output.\n"
2017"\n"
2018" ms\n"
2019" Duration in milliseconds.");
2020
2021#define _CURSES_DELAY_OUTPUT_METHODDEF \
2022 {"delay_output", (PyCFunction)_curses_delay_output, METH_O, _curses_delay_output__doc__},
2023
2024static PyObject *
2025_curses_delay_output_impl(PyObject *module, int ms);
2026
2027static PyObject *
2028_curses_delay_output(PyObject *module, PyObject *arg)
2029{
2030 PyObject *return_value = NULL;
2031 int ms;
2032
2033 if (!PyArg_Parse(arg, "i:delay_output", &ms)) {
2034 goto exit;
2035 }
2036 return_value = _curses_delay_output_impl(module, ms);
2037
2038exit:
2039 return return_value;
2040}
2041
2042PyDoc_STRVAR(_curses_doupdate__doc__,
2043"doupdate($module, /)\n"
2044"--\n"
2045"\n"
2046"Update the physical screen to match the virtual screen.");
2047
2048#define _CURSES_DOUPDATE_METHODDEF \
2049 {"doupdate", (PyCFunction)_curses_doupdate, METH_NOARGS, _curses_doupdate__doc__},
2050
2051static PyObject *
2052_curses_doupdate_impl(PyObject *module);
2053
2054static PyObject *
2055_curses_doupdate(PyObject *module, PyObject *Py_UNUSED(ignored))
2056{
2057 return _curses_doupdate_impl(module);
2058}
2059
2060PyDoc_STRVAR(_curses_echo__doc__,
2061"echo($module, flag=True, /)\n"
2062"--\n"
2063"\n"
2064"Enter echo mode.\n"
2065"\n"
2066" flag\n"
2067" If false, the effect is the same as calling noecho().\n"
2068"\n"
2069"In echo mode, each character input is echoed to the screen as it is entered.");
2070
2071#define _CURSES_ECHO_METHODDEF \
2072 {"echo", (PyCFunction)_curses_echo, METH_FASTCALL, _curses_echo__doc__},
2073
2074static PyObject *
2075_curses_echo_impl(PyObject *module, int flag);
2076
2077static PyObject *
2078_curses_echo(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
2079{
2080 PyObject *return_value = NULL;
2081 int flag = 1;
2082
2083 if (!_PyArg_ParseStack(args, nargs, "|i:echo",
2084 &flag)) {
2085 goto exit;
2086 }
2087 return_value = _curses_echo_impl(module, flag);
2088
2089exit:
2090 return return_value;
2091}
2092
2093PyDoc_STRVAR(_curses_endwin__doc__,
2094"endwin($module, /)\n"
2095"--\n"
2096"\n"
2097"De-initialize the library, and return terminal to normal status.");
2098
2099#define _CURSES_ENDWIN_METHODDEF \
2100 {"endwin", (PyCFunction)_curses_endwin, METH_NOARGS, _curses_endwin__doc__},
2101
2102static PyObject *
2103_curses_endwin_impl(PyObject *module);
2104
2105static PyObject *
2106_curses_endwin(PyObject *module, PyObject *Py_UNUSED(ignored))
2107{
2108 return _curses_endwin_impl(module);
2109}
2110
2111PyDoc_STRVAR(_curses_erasechar__doc__,
2112"erasechar($module, /)\n"
2113"--\n"
2114"\n"
2115"Return the user\'s current erase character.");
2116
2117#define _CURSES_ERASECHAR_METHODDEF \
2118 {"erasechar", (PyCFunction)_curses_erasechar, METH_NOARGS, _curses_erasechar__doc__},
2119
2120static PyObject *
2121_curses_erasechar_impl(PyObject *module);
2122
2123static PyObject *
2124_curses_erasechar(PyObject *module, PyObject *Py_UNUSED(ignored))
2125{
2126 return _curses_erasechar_impl(module);
2127}
2128
2129PyDoc_STRVAR(_curses_flash__doc__,
2130"flash($module, /)\n"
2131"--\n"
2132"\n"
2133"Flash the screen.\n"
2134"\n"
2135"That is, change it to reverse-video and then change it back in a short interval.");
2136
2137#define _CURSES_FLASH_METHODDEF \
2138 {"flash", (PyCFunction)_curses_flash, METH_NOARGS, _curses_flash__doc__},
2139
2140static PyObject *
2141_curses_flash_impl(PyObject *module);
2142
2143static PyObject *
2144_curses_flash(PyObject *module, PyObject *Py_UNUSED(ignored))
2145{
2146 return _curses_flash_impl(module);
2147}
2148
2149PyDoc_STRVAR(_curses_flushinp__doc__,
2150"flushinp($module, /)\n"
2151"--\n"
2152"\n"
2153"Flush all input buffers.\n"
2154"\n"
2155"This throws away any typeahead that has been typed by the user and has not\n"
2156"yet been processed by the program.");
2157
2158#define _CURSES_FLUSHINP_METHODDEF \
2159 {"flushinp", (PyCFunction)_curses_flushinp, METH_NOARGS, _curses_flushinp__doc__},
2160
2161static PyObject *
2162_curses_flushinp_impl(PyObject *module);
2163
2164static PyObject *
2165_curses_flushinp(PyObject *module, PyObject *Py_UNUSED(ignored))
2166{
2167 return _curses_flushinp_impl(module);
2168}
2169
2170#if defined(getsyx)
2171
2172PyDoc_STRVAR(_curses_getsyx__doc__,
2173"getsyx($module, /)\n"
2174"--\n"
2175"\n"
2176"Return the current coordinates of the virtual screen cursor.\n"
2177"\n"
2178"Return a (y, x) tuple. If leaveok is currently true, return (-1, -1).");
2179
2180#define _CURSES_GETSYX_METHODDEF \
2181 {"getsyx", (PyCFunction)_curses_getsyx, METH_NOARGS, _curses_getsyx__doc__},
2182
2183static PyObject *
2184_curses_getsyx_impl(PyObject *module);
2185
2186static PyObject *
2187_curses_getsyx(PyObject *module, PyObject *Py_UNUSED(ignored))
2188{
2189 return _curses_getsyx_impl(module);
2190}
2191
2192#endif /* defined(getsyx) */
2193
2194#if defined(NCURSES_MOUSE_VERSION)
2195
2196PyDoc_STRVAR(_curses_getmouse__doc__,
2197"getmouse($module, /)\n"
2198"--\n"
2199"\n"
2200"Retrieve the queued mouse event.\n"
2201"\n"
2202"After getch() returns KEY_MOUSE to signal a mouse event, this function\n"
2203"returns a 5-tuple (id, x, y, z, bstate).");
2204
2205#define _CURSES_GETMOUSE_METHODDEF \
2206 {"getmouse", (PyCFunction)_curses_getmouse, METH_NOARGS, _curses_getmouse__doc__},
2207
2208static PyObject *
2209_curses_getmouse_impl(PyObject *module);
2210
2211static PyObject *
2212_curses_getmouse(PyObject *module, PyObject *Py_UNUSED(ignored))
2213{
2214 return _curses_getmouse_impl(module);
2215}
2216
2217#endif /* defined(NCURSES_MOUSE_VERSION) */
2218
2219#if defined(NCURSES_MOUSE_VERSION)
2220
2221PyDoc_STRVAR(_curses_ungetmouse__doc__,
2222"ungetmouse($module, id, x, y, z, bstate, /)\n"
2223"--\n"
2224"\n"
2225"Push a KEY_MOUSE event onto the input queue.\n"
2226"\n"
2227"The following getmouse() will return the given state data.");
2228
2229#define _CURSES_UNGETMOUSE_METHODDEF \
2230 {"ungetmouse", (PyCFunction)_curses_ungetmouse, METH_FASTCALL, _curses_ungetmouse__doc__},
2231
2232static PyObject *
2233_curses_ungetmouse_impl(PyObject *module, short id, int x, int y, int z,
2234 unsigned long bstate);
2235
2236static PyObject *
2237_curses_ungetmouse(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
2238{
2239 PyObject *return_value = NULL;
2240 short id;
2241 int x;
2242 int y;
2243 int z;
2244 unsigned long bstate;
2245
2246 if (!_PyArg_ParseStack(args, nargs, "hiiik:ungetmouse",
2247 &id, &x, &y, &z, &bstate)) {
2248 goto exit;
2249 }
2250 return_value = _curses_ungetmouse_impl(module, id, x, y, z, bstate);
2251
2252exit:
2253 return return_value;
2254}
2255
2256#endif /* defined(NCURSES_MOUSE_VERSION) */
2257
2258PyDoc_STRVAR(_curses_getwin__doc__,
2259"getwin($module, file, /)\n"
2260"--\n"
2261"\n"
2262"Read window related data stored in the file by an earlier putwin() call.\n"
2263"\n"
2264"The routine then creates and initializes a new window using that data,\n"
2265"returning the new window object.");
2266
2267#define _CURSES_GETWIN_METHODDEF \
2268 {"getwin", (PyCFunction)_curses_getwin, METH_O, _curses_getwin__doc__},
2269
2270PyDoc_STRVAR(_curses_halfdelay__doc__,
2271"halfdelay($module, tenths, /)\n"
2272"--\n"
2273"\n"
2274"Enter half-delay mode.\n"
2275"\n"
2276" tenths\n"
2277" Maximal blocking delay in tenths of seconds (1 - 255).\n"
2278"\n"
2279"Use nocbreak() to leave half-delay mode.");
2280
2281#define _CURSES_HALFDELAY_METHODDEF \
2282 {"halfdelay", (PyCFunction)_curses_halfdelay, METH_O, _curses_halfdelay__doc__},
2283
2284static PyObject *
2285_curses_halfdelay_impl(PyObject *module, unsigned char tenths);
2286
2287static PyObject *
2288_curses_halfdelay(PyObject *module, PyObject *arg)
2289{
2290 PyObject *return_value = NULL;
2291 unsigned char tenths;
2292
2293 if (!PyArg_Parse(arg, "b:halfdelay", &tenths)) {
2294 goto exit;
2295 }
2296 return_value = _curses_halfdelay_impl(module, tenths);
2297
2298exit:
2299 return return_value;
2300}
2301
2302PyDoc_STRVAR(_curses_has_colors__doc__,
2303"has_colors($module, /)\n"
2304"--\n"
2305"\n"
2306"Return True if the terminal can display colors; otherwise, return False.");
2307
2308#define _CURSES_HAS_COLORS_METHODDEF \
2309 {"has_colors", (PyCFunction)_curses_has_colors, METH_NOARGS, _curses_has_colors__doc__},
2310
2311static PyObject *
2312_curses_has_colors_impl(PyObject *module);
2313
2314static PyObject *
2315_curses_has_colors(PyObject *module, PyObject *Py_UNUSED(ignored))
2316{
2317 return _curses_has_colors_impl(module);
2318}
2319
2320PyDoc_STRVAR(_curses_has_ic__doc__,
2321"has_ic($module, /)\n"
2322"--\n"
2323"\n"
2324"Return True if the terminal has insert- and delete-character capabilities.");
2325
2326#define _CURSES_HAS_IC_METHODDEF \
2327 {"has_ic", (PyCFunction)_curses_has_ic, METH_NOARGS, _curses_has_ic__doc__},
2328
2329static PyObject *
2330_curses_has_ic_impl(PyObject *module);
2331
2332static PyObject *
2333_curses_has_ic(PyObject *module, PyObject *Py_UNUSED(ignored))
2334{
2335 return _curses_has_ic_impl(module);
2336}
2337
2338PyDoc_STRVAR(_curses_has_il__doc__,
2339"has_il($module, /)\n"
2340"--\n"
2341"\n"
2342"Return True if the terminal has insert- and delete-line capabilities.");
2343
2344#define _CURSES_HAS_IL_METHODDEF \
2345 {"has_il", (PyCFunction)_curses_has_il, METH_NOARGS, _curses_has_il__doc__},
2346
2347static PyObject *
2348_curses_has_il_impl(PyObject *module);
2349
2350static PyObject *
2351_curses_has_il(PyObject *module, PyObject *Py_UNUSED(ignored))
2352{
2353 return _curses_has_il_impl(module);
2354}
2355
2356#if defined(HAVE_CURSES_HAS_KEY)
2357
2358PyDoc_STRVAR(_curses_has_key__doc__,
2359"has_key($module, key, /)\n"
2360"--\n"
2361"\n"
2362"Return True if the current terminal type recognizes a key with that value.\n"
2363"\n"
2364" key\n"
2365" Key number.");
2366
2367#define _CURSES_HAS_KEY_METHODDEF \
2368 {"has_key", (PyCFunction)_curses_has_key, METH_O, _curses_has_key__doc__},
2369
2370static PyObject *
2371_curses_has_key_impl(PyObject *module, int key);
2372
2373static PyObject *
2374_curses_has_key(PyObject *module, PyObject *arg)
2375{
2376 PyObject *return_value = NULL;
2377 int key;
2378
2379 if (!PyArg_Parse(arg, "i:has_key", &key)) {
2380 goto exit;
2381 }
2382 return_value = _curses_has_key_impl(module, key);
2383
2384exit:
2385 return return_value;
2386}
2387
2388#endif /* defined(HAVE_CURSES_HAS_KEY) */
2389
2390PyDoc_STRVAR(_curses_init_color__doc__,
2391"init_color($module, color_number, r, g, b, /)\n"
2392"--\n"
2393"\n"
2394"Change the definition of a color.\n"
2395"\n"
2396" color_number\n"
2397" The number of the color to be changed (0 - COLORS).\n"
2398" r\n"
2399" Red component (0 - 1000).\n"
2400" g\n"
2401" Green component (0 - 1000).\n"
2402" b\n"
2403" Blue component (0 - 1000).\n"
2404"\n"
2405"When init_color() is used, all occurrences of that color on the screen\n"
2406"immediately change to the new definition. This function is a no-op on\n"
2407"most terminals; it is active only if can_change_color() returns 1.");
2408
2409#define _CURSES_INIT_COLOR_METHODDEF \
2410 {"init_color", (PyCFunction)_curses_init_color, METH_FASTCALL, _curses_init_color__doc__},
2411
2412static PyObject *
2413_curses_init_color_impl(PyObject *module, short color_number, short r,
2414 short g, short b);
2415
2416static PyObject *
2417_curses_init_color(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
2418{
2419 PyObject *return_value = NULL;
2420 short color_number;
2421 short r;
2422 short g;
2423 short b;
2424
2425 if (!_PyArg_ParseStack(args, nargs, "hhhh:init_color",
2426 &color_number, &r, &g, &b)) {
2427 goto exit;
2428 }
2429 return_value = _curses_init_color_impl(module, color_number, r, g, b);
2430
2431exit:
2432 return return_value;
2433}
2434
2435PyDoc_STRVAR(_curses_init_pair__doc__,
2436"init_pair($module, pair_number, fg, bg, /)\n"
2437"--\n"
2438"\n"
2439"Change the definition of a color-pair.\n"
2440"\n"
2441" pair_number\n"
2442" The number of the color-pair to be changed (1 - (COLOR_PAIRS-1)).\n"
2443" fg\n"
2444" Foreground color number (0 - COLORS).\n"
2445" bg\n"
2446" Background color number (0 - COLORS).\n"
2447"\n"
2448"If the color-pair was previously initialized, the screen is refreshed and\n"
2449"all occurrences of that color-pair are changed to the new definition.");
2450
2451#define _CURSES_INIT_PAIR_METHODDEF \
2452 {"init_pair", (PyCFunction)_curses_init_pair, METH_FASTCALL, _curses_init_pair__doc__},
2453
2454static PyObject *
2455_curses_init_pair_impl(PyObject *module, short pair_number, short fg,
2456 short bg);
2457
2458static PyObject *
2459_curses_init_pair(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
2460{
2461 PyObject *return_value = NULL;
2462 short pair_number;
2463 short fg;
2464 short bg;
2465
2466 if (!_PyArg_ParseStack(args, nargs, "hhh:init_pair",
2467 &pair_number, &fg, &bg)) {
2468 goto exit;
2469 }
2470 return_value = _curses_init_pair_impl(module, pair_number, fg, bg);
2471
2472exit:
2473 return return_value;
2474}
2475
2476PyDoc_STRVAR(_curses_initscr__doc__,
2477"initscr($module, /)\n"
2478"--\n"
2479"\n"
2480"Initialize the library.\n"
2481"\n"
2482"Return a WindowObject which represents the whole screen.");
2483
2484#define _CURSES_INITSCR_METHODDEF \
2485 {"initscr", (PyCFunction)_curses_initscr, METH_NOARGS, _curses_initscr__doc__},
2486
2487static PyObject *
2488_curses_initscr_impl(PyObject *module);
2489
2490static PyObject *
2491_curses_initscr(PyObject *module, PyObject *Py_UNUSED(ignored))
2492{
2493 return _curses_initscr_impl(module);
2494}
2495
2496PyDoc_STRVAR(_curses_setupterm__doc__,
2497"setupterm($module, /, term=None, fd=-1)\n"
2498"--\n"
2499"\n"
2500"Initialize the terminal.\n"
2501"\n"
2502" term\n"
2503" Terminal name.\n"
2504" If omitted, the value of the TERM environment variable will be used.\n"
2505" fd\n"
2506" File descriptor to which any initialization sequences will be sent.\n"
2507" If not supplied, the file descriptor for sys.stdout will be used.");
2508
2509#define _CURSES_SETUPTERM_METHODDEF \
2510 {"setupterm", (PyCFunction)_curses_setupterm, METH_FASTCALL|METH_KEYWORDS, _curses_setupterm__doc__},
2511
2512static PyObject *
2513_curses_setupterm_impl(PyObject *module, const char *term, int fd);
2514
2515static PyObject *
2516_curses_setupterm(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
2517{
2518 PyObject *return_value = NULL;
2519 static const char * const _keywords[] = {"term", "fd", NULL};
2520 static _PyArg_Parser _parser = {"|zi:setupterm", _keywords, 0};
2521 const char *term = NULL;
2522 int fd = -1;
2523
2524 if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
2525 &term, &fd)) {
2526 goto exit;
2527 }
2528 return_value = _curses_setupterm_impl(module, term, fd);
2529
2530exit:
2531 return return_value;
2532}
2533
2534PyDoc_STRVAR(_curses_intrflush__doc__,
2535"intrflush($module, flag, /)\n"
2536"--\n"
2537"\n");
2538
2539#define _CURSES_INTRFLUSH_METHODDEF \
2540 {"intrflush", (PyCFunction)_curses_intrflush, METH_O, _curses_intrflush__doc__},
2541
2542static PyObject *
2543_curses_intrflush_impl(PyObject *module, int flag);
2544
2545static PyObject *
2546_curses_intrflush(PyObject *module, PyObject *arg)
2547{
2548 PyObject *return_value = NULL;
2549 int flag;
2550
2551 if (!PyArg_Parse(arg, "i:intrflush", &flag)) {
2552 goto exit;
2553 }
2554 return_value = _curses_intrflush_impl(module, flag);
2555
2556exit:
2557 return return_value;
2558}
2559
2560PyDoc_STRVAR(_curses_isendwin__doc__,
2561"isendwin($module, /)\n"
2562"--\n"
2563"\n"
2564"Return True if endwin() has been called.");
2565
2566#define _CURSES_ISENDWIN_METHODDEF \
2567 {"isendwin", (PyCFunction)_curses_isendwin, METH_NOARGS, _curses_isendwin__doc__},
2568
2569static PyObject *
2570_curses_isendwin_impl(PyObject *module);
2571
2572static PyObject *
2573_curses_isendwin(PyObject *module, PyObject *Py_UNUSED(ignored))
2574{
2575 return _curses_isendwin_impl(module);
2576}
2577
2578#if defined(HAVE_CURSES_IS_TERM_RESIZED)
2579
2580PyDoc_STRVAR(_curses_is_term_resized__doc__,
2581"is_term_resized($module, nlines, ncols, /)\n"
2582"--\n"
2583"\n"
2584"Return True if resize_term() would modify the window structure, False otherwise.\n"
2585"\n"
2586" nlines\n"
2587" Height.\n"
2588" ncols\n"
2589" Width.");
2590
2591#define _CURSES_IS_TERM_RESIZED_METHODDEF \
2592 {"is_term_resized", (PyCFunction)_curses_is_term_resized, METH_FASTCALL, _curses_is_term_resized__doc__},
2593
2594static PyObject *
2595_curses_is_term_resized_impl(PyObject *module, int nlines, int ncols);
2596
2597static PyObject *
2598_curses_is_term_resized(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
2599{
2600 PyObject *return_value = NULL;
2601 int nlines;
2602 int ncols;
2603
2604 if (!_PyArg_ParseStack(args, nargs, "ii:is_term_resized",
2605 &nlines, &ncols)) {
2606 goto exit;
2607 }
2608 return_value = _curses_is_term_resized_impl(module, nlines, ncols);
2609
2610exit:
2611 return return_value;
2612}
2613
2614#endif /* defined(HAVE_CURSES_IS_TERM_RESIZED) */
2615
2616PyDoc_STRVAR(_curses_keyname__doc__,
2617"keyname($module, key, /)\n"
2618"--\n"
2619"\n"
2620"Return the name of specified key.\n"
2621"\n"
2622" key\n"
2623" Key number.");
2624
2625#define _CURSES_KEYNAME_METHODDEF \
2626 {"keyname", (PyCFunction)_curses_keyname, METH_O, _curses_keyname__doc__},
2627
2628static PyObject *
2629_curses_keyname_impl(PyObject *module, int key);
2630
2631static PyObject *
2632_curses_keyname(PyObject *module, PyObject *arg)
2633{
2634 PyObject *return_value = NULL;
2635 int key;
2636
2637 if (!PyArg_Parse(arg, "i:keyname", &key)) {
2638 goto exit;
2639 }
2640 return_value = _curses_keyname_impl(module, key);
2641
2642exit:
2643 return return_value;
2644}
2645
2646PyDoc_STRVAR(_curses_killchar__doc__,
2647"killchar($module, /)\n"
2648"--\n"
2649"\n"
2650"Return the user\'s current line kill character.");
2651
2652#define _CURSES_KILLCHAR_METHODDEF \
2653 {"killchar", (PyCFunction)_curses_killchar, METH_NOARGS, _curses_killchar__doc__},
2654
2655static PyObject *
2656_curses_killchar_impl(PyObject *module);
2657
2658static PyObject *
2659_curses_killchar(PyObject *module, PyObject *Py_UNUSED(ignored))
2660{
2661 return _curses_killchar_impl(module);
2662}
2663
2664PyDoc_STRVAR(_curses_longname__doc__,
2665"longname($module, /)\n"
2666"--\n"
2667"\n"
2668"Return the terminfo long name field describing the current terminal.\n"
2669"\n"
2670"The maximum length of a verbose description is 128 characters. It is defined\n"
2671"only after the call to initscr().");
2672
2673#define _CURSES_LONGNAME_METHODDEF \
2674 {"longname", (PyCFunction)_curses_longname, METH_NOARGS, _curses_longname__doc__},
2675
2676static PyObject *
2677_curses_longname_impl(PyObject *module);
2678
2679static PyObject *
2680_curses_longname(PyObject *module, PyObject *Py_UNUSED(ignored))
2681{
2682 return _curses_longname_impl(module);
2683}
2684
2685PyDoc_STRVAR(_curses_meta__doc__,
2686"meta($module, yes, /)\n"
2687"--\n"
2688"\n"
2689"Enable/disable meta keys.\n"
2690"\n"
2691"If yes is True, allow 8-bit characters to be input. If yes is False,\n"
2692"allow only 7-bit characters.");
2693
2694#define _CURSES_META_METHODDEF \
2695 {"meta", (PyCFunction)_curses_meta, METH_O, _curses_meta__doc__},
2696
2697static PyObject *
2698_curses_meta_impl(PyObject *module, int yes);
2699
2700static PyObject *
2701_curses_meta(PyObject *module, PyObject *arg)
2702{
2703 PyObject *return_value = NULL;
2704 int yes;
2705
2706 if (!PyArg_Parse(arg, "i:meta", &yes)) {
2707 goto exit;
2708 }
2709 return_value = _curses_meta_impl(module, yes);
2710
2711exit:
2712 return return_value;
2713}
2714
2715#if defined(NCURSES_MOUSE_VERSION)
2716
2717PyDoc_STRVAR(_curses_mouseinterval__doc__,
2718"mouseinterval($module, interval, /)\n"
2719"--\n"
2720"\n"
2721"Set and retrieve the maximum time between press and release in a click.\n"
2722"\n"
2723" interval\n"
2724" Time in milliseconds.\n"
2725"\n"
2726"Set the maximum time that can elapse between press and release events in\n"
2727"order for them to be recognized as a click, and return the previous interval\n"
2728"value.");
2729
2730#define _CURSES_MOUSEINTERVAL_METHODDEF \
2731 {"mouseinterval", (PyCFunction)_curses_mouseinterval, METH_O, _curses_mouseinterval__doc__},
2732
2733static PyObject *
2734_curses_mouseinterval_impl(PyObject *module, int interval);
2735
2736static PyObject *
2737_curses_mouseinterval(PyObject *module, PyObject *arg)
2738{
2739 PyObject *return_value = NULL;
2740 int interval;
2741
2742 if (!PyArg_Parse(arg, "i:mouseinterval", &interval)) {
2743 goto exit;
2744 }
2745 return_value = _curses_mouseinterval_impl(module, interval);
2746
2747exit:
2748 return return_value;
2749}
2750
2751#endif /* defined(NCURSES_MOUSE_VERSION) */
2752
2753#if defined(NCURSES_MOUSE_VERSION)
2754
2755PyDoc_STRVAR(_curses_mousemask__doc__,
2756"mousemask($module, newmask, /)\n"
2757"--\n"
2758"\n"
2759"Set the mouse events to be reported, and return a tuple (availmask, oldmask).\n"
2760"\n"
2761"Return a tuple (availmask, oldmask). availmask indicates which of the\n"
2762"specified mouse events can be reported; on complete failure it returns 0.\n"
2763"oldmask is the previous value of the given window\'s mouse event mask.\n"
2764"If this function is never called, no mouse events are ever reported.");
2765
2766#define _CURSES_MOUSEMASK_METHODDEF \
2767 {"mousemask", (PyCFunction)_curses_mousemask, METH_O, _curses_mousemask__doc__},
2768
2769static PyObject *
2770_curses_mousemask_impl(PyObject *module, unsigned long newmask);
2771
2772static PyObject *
2773_curses_mousemask(PyObject *module, PyObject *arg)
2774{
2775 PyObject *return_value = NULL;
2776 unsigned long newmask;
2777
2778 if (!PyArg_Parse(arg, "k:mousemask", &newmask)) {
2779 goto exit;
2780 }
2781 return_value = _curses_mousemask_impl(module, newmask);
2782
2783exit:
2784 return return_value;
2785}
2786
2787#endif /* defined(NCURSES_MOUSE_VERSION) */
2788
2789PyDoc_STRVAR(_curses_napms__doc__,
2790"napms($module, ms, /)\n"
2791"--\n"
2792"\n"
2793"Sleep for specified time.\n"
2794"\n"
2795" ms\n"
2796" Duration in milliseconds.");
2797
2798#define _CURSES_NAPMS_METHODDEF \
2799 {"napms", (PyCFunction)_curses_napms, METH_O, _curses_napms__doc__},
2800
2801static PyObject *
2802_curses_napms_impl(PyObject *module, int ms);
2803
2804static PyObject *
2805_curses_napms(PyObject *module, PyObject *arg)
2806{
2807 PyObject *return_value = NULL;
2808 int ms;
2809
2810 if (!PyArg_Parse(arg, "i:napms", &ms)) {
2811 goto exit;
2812 }
2813 return_value = _curses_napms_impl(module, ms);
2814
2815exit:
2816 return return_value;
2817}
2818
2819PyDoc_STRVAR(_curses_newpad__doc__,
2820"newpad($module, nlines, ncols, /)\n"
2821"--\n"
2822"\n"
2823"Create and return a pointer to a new pad data structure.\n"
2824"\n"
2825" nlines\n"
2826" Height.\n"
2827" ncols\n"
2828" Width.");
2829
2830#define _CURSES_NEWPAD_METHODDEF \
2831 {"newpad", (PyCFunction)_curses_newpad, METH_FASTCALL, _curses_newpad__doc__},
2832
2833static PyObject *
2834_curses_newpad_impl(PyObject *module, int nlines, int ncols);
2835
2836static PyObject *
2837_curses_newpad(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
2838{
2839 PyObject *return_value = NULL;
2840 int nlines;
2841 int ncols;
2842
2843 if (!_PyArg_ParseStack(args, nargs, "ii:newpad",
2844 &nlines, &ncols)) {
2845 goto exit;
2846 }
2847 return_value = _curses_newpad_impl(module, nlines, ncols);
2848
2849exit:
2850 return return_value;
2851}
2852
2853PyDoc_STRVAR(_curses_newwin__doc__,
2854"newwin(nlines, ncols, [begin_y=0, begin_x=0])\n"
2855"Return a new window.\n"
2856"\n"
2857" nlines\n"
2858" Height.\n"
2859" ncols\n"
2860" Width.\n"
2861" begin_y\n"
2862" Top side y-coordinate.\n"
2863" begin_x\n"
2864" Left side x-coordinate.\n"
2865"\n"
2866"By default, the window will extend from the specified position to the lower\n"
2867"right corner of the screen.");
2868
2869#define _CURSES_NEWWIN_METHODDEF \
2870 {"newwin", (PyCFunction)_curses_newwin, METH_VARARGS, _curses_newwin__doc__},
2871
2872static PyObject *
2873_curses_newwin_impl(PyObject *module, int nlines, int ncols,
2874 int group_right_1, int begin_y, int begin_x);
2875
2876static PyObject *
2877_curses_newwin(PyObject *module, PyObject *args)
2878{
2879 PyObject *return_value = NULL;
2880 int nlines;
2881 int ncols;
2882 int group_right_1 = 0;
2883 int begin_y = 0;
2884 int begin_x = 0;
2885
2886 switch (PyTuple_GET_SIZE(args)) {
2887 case 2:
2888 if (!PyArg_ParseTuple(args, "ii:newwin", &nlines, &ncols)) {
2889 goto exit;
2890 }
2891 break;
2892 case 4:
2893 if (!PyArg_ParseTuple(args, "iiii:newwin", &nlines, &ncols, &begin_y, &begin_x)) {
2894 goto exit;
2895 }
2896 group_right_1 = 1;
2897 break;
2898 default:
2899 PyErr_SetString(PyExc_TypeError, "_curses.newwin requires 2 to 4 arguments");
2900 goto exit;
2901 }
2902 return_value = _curses_newwin_impl(module, nlines, ncols, group_right_1, begin_y, begin_x);
2903
2904exit:
2905 return return_value;
2906}
2907
2908PyDoc_STRVAR(_curses_nl__doc__,
2909"nl($module, flag=True, /)\n"
2910"--\n"
2911"\n"
2912"Enter newline mode.\n"
2913"\n"
2914" flag\n"
2915" If false, the effect is the same as calling nonl().\n"
2916"\n"
2917"This mode translates the return key into newline on input, and translates\n"
2918"newline into return and line-feed on output. Newline mode is initially on.");
2919
2920#define _CURSES_NL_METHODDEF \
2921 {"nl", (PyCFunction)_curses_nl, METH_FASTCALL, _curses_nl__doc__},
2922
2923static PyObject *
2924_curses_nl_impl(PyObject *module, int flag);
2925
2926static PyObject *
2927_curses_nl(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
2928{
2929 PyObject *return_value = NULL;
2930 int flag = 1;
2931
2932 if (!_PyArg_ParseStack(args, nargs, "|i:nl",
2933 &flag)) {
2934 goto exit;
2935 }
2936 return_value = _curses_nl_impl(module, flag);
2937
2938exit:
2939 return return_value;
2940}
2941
2942PyDoc_STRVAR(_curses_nocbreak__doc__,
2943"nocbreak($module, /)\n"
2944"--\n"
2945"\n"
2946"Leave cbreak mode.\n"
2947"\n"
2948"Return to normal \"cooked\" mode with line buffering.");
2949
2950#define _CURSES_NOCBREAK_METHODDEF \
2951 {"nocbreak", (PyCFunction)_curses_nocbreak, METH_NOARGS, _curses_nocbreak__doc__},
2952
2953static PyObject *
2954_curses_nocbreak_impl(PyObject *module);
2955
2956static PyObject *
2957_curses_nocbreak(PyObject *module, PyObject *Py_UNUSED(ignored))
2958{
2959 return _curses_nocbreak_impl(module);
2960}
2961
2962PyDoc_STRVAR(_curses_noecho__doc__,
2963"noecho($module, /)\n"
2964"--\n"
2965"\n"
2966"Leave echo mode.\n"
2967"\n"
2968"Echoing of input characters is turned off.");
2969
2970#define _CURSES_NOECHO_METHODDEF \
2971 {"noecho", (PyCFunction)_curses_noecho, METH_NOARGS, _curses_noecho__doc__},
2972
2973static PyObject *
2974_curses_noecho_impl(PyObject *module);
2975
2976static PyObject *
2977_curses_noecho(PyObject *module, PyObject *Py_UNUSED(ignored))
2978{
2979 return _curses_noecho_impl(module);
2980}
2981
2982PyDoc_STRVAR(_curses_nonl__doc__,
2983"nonl($module, /)\n"
2984"--\n"
2985"\n"
2986"Leave newline mode.\n"
2987"\n"
2988"Disable translation of return into newline on input, and disable low-level\n"
2989"translation of newline into newline/return on output.");
2990
2991#define _CURSES_NONL_METHODDEF \
2992 {"nonl", (PyCFunction)_curses_nonl, METH_NOARGS, _curses_nonl__doc__},
2993
2994static PyObject *
2995_curses_nonl_impl(PyObject *module);
2996
2997static PyObject *
2998_curses_nonl(PyObject *module, PyObject *Py_UNUSED(ignored))
2999{
3000 return _curses_nonl_impl(module);
3001}
3002
3003PyDoc_STRVAR(_curses_noqiflush__doc__,
3004"noqiflush($module, /)\n"
3005"--\n"
3006"\n"
3007"Disable queue flushing.\n"
3008"\n"
3009"When queue flushing is disabled, normal flush of input and output queues\n"
3010"associated with the INTR, QUIT and SUSP characters will not be done.");
3011
3012#define _CURSES_NOQIFLUSH_METHODDEF \
3013 {"noqiflush", (PyCFunction)_curses_noqiflush, METH_NOARGS, _curses_noqiflush__doc__},
3014
3015static PyObject *
3016_curses_noqiflush_impl(PyObject *module);
3017
3018static PyObject *
3019_curses_noqiflush(PyObject *module, PyObject *Py_UNUSED(ignored))
3020{
3021 return _curses_noqiflush_impl(module);
3022}
3023
3024PyDoc_STRVAR(_curses_noraw__doc__,
3025"noraw($module, /)\n"
3026"--\n"
3027"\n"
3028"Leave raw mode.\n"
3029"\n"
3030"Return to normal \"cooked\" mode with line buffering.");
3031
3032#define _CURSES_NORAW_METHODDEF \
3033 {"noraw", (PyCFunction)_curses_noraw, METH_NOARGS, _curses_noraw__doc__},
3034
3035static PyObject *
3036_curses_noraw_impl(PyObject *module);
3037
3038static PyObject *
3039_curses_noraw(PyObject *module, PyObject *Py_UNUSED(ignored))
3040{
3041 return _curses_noraw_impl(module);
3042}
3043
3044PyDoc_STRVAR(_curses_pair_content__doc__,
3045"pair_content($module, pair_number, /)\n"
3046"--\n"
3047"\n"
3048"Return a tuple (fg, bg) containing the colors for the requested color pair.\n"
3049"\n"
3050" pair_number\n"
3051" The number of the color pair (1 - (COLOR_PAIRS-1)).");
3052
3053#define _CURSES_PAIR_CONTENT_METHODDEF \
3054 {"pair_content", (PyCFunction)_curses_pair_content, METH_O, _curses_pair_content__doc__},
3055
3056static PyObject *
3057_curses_pair_content_impl(PyObject *module, short pair_number);
3058
3059static PyObject *
3060_curses_pair_content(PyObject *module, PyObject *arg)
3061{
3062 PyObject *return_value = NULL;
3063 short pair_number;
3064
3065 if (!PyArg_Parse(arg, "h:pair_content", &pair_number)) {
3066 goto exit;
3067 }
3068 return_value = _curses_pair_content_impl(module, pair_number);
3069
3070exit:
3071 return return_value;
3072}
3073
3074PyDoc_STRVAR(_curses_pair_number__doc__,
3075"pair_number($module, attr, /)\n"
3076"--\n"
3077"\n"
3078"Return the number of the color-pair set by the specified attribute value.\n"
3079"\n"
3080"color_pair() is the counterpart to this function.");
3081
3082#define _CURSES_PAIR_NUMBER_METHODDEF \
3083 {"pair_number", (PyCFunction)_curses_pair_number, METH_O, _curses_pair_number__doc__},
3084
3085static PyObject *
3086_curses_pair_number_impl(PyObject *module, int attr);
3087
3088static PyObject *
3089_curses_pair_number(PyObject *module, PyObject *arg)
3090{
3091 PyObject *return_value = NULL;
3092 int attr;
3093
3094 if (!PyArg_Parse(arg, "i:pair_number", &attr)) {
3095 goto exit;
3096 }
3097 return_value = _curses_pair_number_impl(module, attr);
3098
3099exit:
3100 return return_value;
3101}
3102
3103PyDoc_STRVAR(_curses_putp__doc__,
3104"putp($module, string, /)\n"
3105"--\n"
3106"\n"
3107"Emit the value of a specified terminfo capability for the current terminal.\n"
3108"\n"
3109"Note that the output of putp() always goes to standard output.");
3110
3111#define _CURSES_PUTP_METHODDEF \
3112 {"putp", (PyCFunction)_curses_putp, METH_O, _curses_putp__doc__},
3113
3114static PyObject *
3115_curses_putp_impl(PyObject *module, const char *string);
3116
3117static PyObject *
3118_curses_putp(PyObject *module, PyObject *arg)
3119{
3120 PyObject *return_value = NULL;
3121 const char *string;
3122
3123 if (!PyArg_Parse(arg, "y:putp", &string)) {
3124 goto exit;
3125 }
3126 return_value = _curses_putp_impl(module, string);
3127
3128exit:
3129 return return_value;
3130}
3131
3132PyDoc_STRVAR(_curses_qiflush__doc__,
3133"qiflush($module, flag=True, /)\n"
3134"--\n"
3135"\n"
3136"Enable queue flushing.\n"
3137"\n"
3138" flag\n"
3139" If false, the effect is the same as calling noqiflush().\n"
3140"\n"
3141"If queue flushing is enabled, all output in the display driver queue\n"
3142"will be flushed when the INTR, QUIT and SUSP characters are read.");
3143
3144#define _CURSES_QIFLUSH_METHODDEF \
3145 {"qiflush", (PyCFunction)_curses_qiflush, METH_FASTCALL, _curses_qiflush__doc__},
3146
3147static PyObject *
3148_curses_qiflush_impl(PyObject *module, int flag);
3149
3150static PyObject *
3151_curses_qiflush(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
3152{
3153 PyObject *return_value = NULL;
3154 int flag = 1;
3155
3156 if (!_PyArg_ParseStack(args, nargs, "|i:qiflush",
3157 &flag)) {
3158 goto exit;
3159 }
3160 return_value = _curses_qiflush_impl(module, flag);
3161
3162exit:
3163 return return_value;
3164}
3165
3166#if (defined(HAVE_CURSES_RESIZETERM) || defined(HAVE_CURSES_RESIZE_TERM))
3167
3168PyDoc_STRVAR(_curses_update_lines_cols__doc__,
3169"update_lines_cols($module, /)\n"
3170"--\n"
3171"\n");
3172
3173#define _CURSES_UPDATE_LINES_COLS_METHODDEF \
3174 {"update_lines_cols", (PyCFunction)_curses_update_lines_cols, METH_NOARGS, _curses_update_lines_cols__doc__},
3175
3176static int
3177_curses_update_lines_cols_impl(PyObject *module);
3178
3179static PyObject *
3180_curses_update_lines_cols(PyObject *module, PyObject *Py_UNUSED(ignored))
3181{
3182 PyObject *return_value = NULL;
3183 int _return_value;
3184
3185 _return_value = _curses_update_lines_cols_impl(module);
3186 if ((_return_value == -1) && PyErr_Occurred()) {
3187 goto exit;
3188 }
3189 return_value = PyLong_FromLong((long)_return_value);
3190
3191exit:
3192 return return_value;
3193}
3194
3195#endif /* (defined(HAVE_CURSES_RESIZETERM) || defined(HAVE_CURSES_RESIZE_TERM)) */
3196
3197PyDoc_STRVAR(_curses_raw__doc__,
3198"raw($module, flag=True, /)\n"
3199"--\n"
3200"\n"
3201"Enter raw mode.\n"
3202"\n"
3203" flag\n"
3204" If false, the effect is the same as calling noraw().\n"
3205"\n"
3206"In raw mode, normal line buffering and processing of interrupt, quit,\n"
3207"suspend, and flow control keys are turned off; characters are presented to\n"
3208"curses input functions one by one.");
3209
3210#define _CURSES_RAW_METHODDEF \
3211 {"raw", (PyCFunction)_curses_raw, METH_FASTCALL, _curses_raw__doc__},
3212
3213static PyObject *
3214_curses_raw_impl(PyObject *module, int flag);
3215
3216static PyObject *
3217_curses_raw(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
3218{
3219 PyObject *return_value = NULL;
3220 int flag = 1;
3221
3222 if (!_PyArg_ParseStack(args, nargs, "|i:raw",
3223 &flag)) {
3224 goto exit;
3225 }
3226 return_value = _curses_raw_impl(module, flag);
3227
3228exit:
3229 return return_value;
3230}
3231
3232PyDoc_STRVAR(_curses_reset_prog_mode__doc__,
3233"reset_prog_mode($module, /)\n"
3234"--\n"
3235"\n"
3236"Restore the terminal to \"program\" mode, as previously saved by def_prog_mode().");
3237
3238#define _CURSES_RESET_PROG_MODE_METHODDEF \
3239 {"reset_prog_mode", (PyCFunction)_curses_reset_prog_mode, METH_NOARGS, _curses_reset_prog_mode__doc__},
3240
3241static PyObject *
3242_curses_reset_prog_mode_impl(PyObject *module);
3243
3244static PyObject *
3245_curses_reset_prog_mode(PyObject *module, PyObject *Py_UNUSED(ignored))
3246{
3247 return _curses_reset_prog_mode_impl(module);
3248}
3249
3250PyDoc_STRVAR(_curses_reset_shell_mode__doc__,
3251"reset_shell_mode($module, /)\n"
3252"--\n"
3253"\n"
3254"Restore the terminal to \"shell\" mode, as previously saved by def_shell_mode().");
3255
3256#define _CURSES_RESET_SHELL_MODE_METHODDEF \
3257 {"reset_shell_mode", (PyCFunction)_curses_reset_shell_mode, METH_NOARGS, _curses_reset_shell_mode__doc__},
3258
3259static PyObject *
3260_curses_reset_shell_mode_impl(PyObject *module);
3261
3262static PyObject *
3263_curses_reset_shell_mode(PyObject *module, PyObject *Py_UNUSED(ignored))
3264{
3265 return _curses_reset_shell_mode_impl(module);
3266}
3267
3268PyDoc_STRVAR(_curses_resetty__doc__,
3269"resetty($module, /)\n"
3270"--\n"
3271"\n"
3272"Restore terminal mode.");
3273
3274#define _CURSES_RESETTY_METHODDEF \
3275 {"resetty", (PyCFunction)_curses_resetty, METH_NOARGS, _curses_resetty__doc__},
3276
3277static PyObject *
3278_curses_resetty_impl(PyObject *module);
3279
3280static PyObject *
3281_curses_resetty(PyObject *module, PyObject *Py_UNUSED(ignored))
3282{
3283 return _curses_resetty_impl(module);
3284}
3285
3286#if defined(HAVE_CURSES_RESIZETERM)
3287
3288PyDoc_STRVAR(_curses_resizeterm__doc__,
3289"resizeterm($module, nlines, ncols, /)\n"
3290"--\n"
3291"\n"
3292"Resize the standard and current windows to the specified dimensions.\n"
3293"\n"
3294" nlines\n"
3295" Height.\n"
3296" ncols\n"
3297" Width.\n"
3298"\n"
3299"Adjusts other bookkeeping data used by the curses library that record the\n"
3300"window dimensions (in particular the SIGWINCH handler).");
3301
3302#define _CURSES_RESIZETERM_METHODDEF \
3303 {"resizeterm", (PyCFunction)_curses_resizeterm, METH_FASTCALL, _curses_resizeterm__doc__},
3304
3305static PyObject *
3306_curses_resizeterm_impl(PyObject *module, int nlines, int ncols);
3307
3308static PyObject *
3309_curses_resizeterm(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
3310{
3311 PyObject *return_value = NULL;
3312 int nlines;
3313 int ncols;
3314
3315 if (!_PyArg_ParseStack(args, nargs, "ii:resizeterm",
3316 &nlines, &ncols)) {
3317 goto exit;
3318 }
3319 return_value = _curses_resizeterm_impl(module, nlines, ncols);
3320
3321exit:
3322 return return_value;
3323}
3324
3325#endif /* defined(HAVE_CURSES_RESIZETERM) */
3326
3327#if defined(HAVE_CURSES_RESIZE_TERM)
3328
3329PyDoc_STRVAR(_curses_resize_term__doc__,
3330"resize_term($module, nlines, ncols, /)\n"
3331"--\n"
3332"\n"
3333"Backend function used by resizeterm(), performing most of the work.\n"
3334"\n"
3335" nlines\n"
3336" Height.\n"
3337" ncols\n"
3338" Width.\n"
3339"\n"
3340"When resizing the windows, resize_term() blank-fills the areas that are\n"
3341"extended. The calling application should fill in these areas with appropriate\n"
3342"data. The resize_term() function attempts to resize all windows. However,\n"
3343"due to the calling convention of pads, it is not possible to resize these\n"
3344"without additional interaction with the application.");
3345
3346#define _CURSES_RESIZE_TERM_METHODDEF \
3347 {"resize_term", (PyCFunction)_curses_resize_term, METH_FASTCALL, _curses_resize_term__doc__},
3348
3349static PyObject *
3350_curses_resize_term_impl(PyObject *module, int nlines, int ncols);
3351
3352static PyObject *
3353_curses_resize_term(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
3354{
3355 PyObject *return_value = NULL;
3356 int nlines;
3357 int ncols;
3358
3359 if (!_PyArg_ParseStack(args, nargs, "ii:resize_term",
3360 &nlines, &ncols)) {
3361 goto exit;
3362 }
3363 return_value = _curses_resize_term_impl(module, nlines, ncols);
3364
3365exit:
3366 return return_value;
3367}
3368
3369#endif /* defined(HAVE_CURSES_RESIZE_TERM) */
3370
3371PyDoc_STRVAR(_curses_savetty__doc__,
3372"savetty($module, /)\n"
3373"--\n"
3374"\n"
3375"Save terminal mode.");
3376
3377#define _CURSES_SAVETTY_METHODDEF \
3378 {"savetty", (PyCFunction)_curses_savetty, METH_NOARGS, _curses_savetty__doc__},
3379
3380static PyObject *
3381_curses_savetty_impl(PyObject *module);
3382
3383static PyObject *
3384_curses_savetty(PyObject *module, PyObject *Py_UNUSED(ignored))
3385{
3386 return _curses_savetty_impl(module);
3387}
3388
3389#if defined(getsyx)
3390
3391PyDoc_STRVAR(_curses_setsyx__doc__,
3392"setsyx($module, y, x, /)\n"
3393"--\n"
3394"\n"
3395"Set the virtual screen cursor.\n"
3396"\n"
3397" y\n"
3398" Y-coordinate.\n"
3399" x\n"
3400" X-coordinate.\n"
3401"\n"
3402"If y and x are both -1, then leaveok is set.");
3403
3404#define _CURSES_SETSYX_METHODDEF \
3405 {"setsyx", (PyCFunction)_curses_setsyx, METH_FASTCALL, _curses_setsyx__doc__},
3406
3407static PyObject *
3408_curses_setsyx_impl(PyObject *module, int y, int x);
3409
3410static PyObject *
3411_curses_setsyx(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
3412{
3413 PyObject *return_value = NULL;
3414 int y;
3415 int x;
3416
3417 if (!_PyArg_ParseStack(args, nargs, "ii:setsyx",
3418 &y, &x)) {
3419 goto exit;
3420 }
3421 return_value = _curses_setsyx_impl(module, y, x);
3422
3423exit:
3424 return return_value;
3425}
3426
3427#endif /* defined(getsyx) */
3428
3429PyDoc_STRVAR(_curses_start_color__doc__,
3430"start_color($module, /)\n"
3431"--\n"
3432"\n"
3433"Initializes eight basic colors and global variables COLORS and COLOR_PAIRS.\n"
3434"\n"
3435"Must be called if the programmer wants to use colors, and before any other\n"
3436"color manipulation routine is called. It is good practice to call this\n"
3437"routine right after initscr().\n"
3438"\n"
3439"It also restores the colors on the terminal to the values they had when the\n"
3440"terminal was just turned on.");
3441
3442#define _CURSES_START_COLOR_METHODDEF \
3443 {"start_color", (PyCFunction)_curses_start_color, METH_NOARGS, _curses_start_color__doc__},
3444
3445static PyObject *
3446_curses_start_color_impl(PyObject *module);
3447
3448static PyObject *
3449_curses_start_color(PyObject *module, PyObject *Py_UNUSED(ignored))
3450{
3451 return _curses_start_color_impl(module);
3452}
3453
3454PyDoc_STRVAR(_curses_termattrs__doc__,
3455"termattrs($module, /)\n"
3456"--\n"
3457"\n"
3458"Return a logical OR of all video attributes supported by the terminal.");
3459
3460#define _CURSES_TERMATTRS_METHODDEF \
3461 {"termattrs", (PyCFunction)_curses_termattrs, METH_NOARGS, _curses_termattrs__doc__},
3462
3463static PyObject *
3464_curses_termattrs_impl(PyObject *module);
3465
3466static PyObject *
3467_curses_termattrs(PyObject *module, PyObject *Py_UNUSED(ignored))
3468{
3469 return _curses_termattrs_impl(module);
3470}
3471
3472PyDoc_STRVAR(_curses_termname__doc__,
3473"termname($module, /)\n"
3474"--\n"
3475"\n"
3476"Return the value of the environment variable TERM, truncated to 14 characters.");
3477
3478#define _CURSES_TERMNAME_METHODDEF \
3479 {"termname", (PyCFunction)_curses_termname, METH_NOARGS, _curses_termname__doc__},
3480
3481static PyObject *
3482_curses_termname_impl(PyObject *module);
3483
3484static PyObject *
3485_curses_termname(PyObject *module, PyObject *Py_UNUSED(ignored))
3486{
3487 return _curses_termname_impl(module);
3488}
3489
3490PyDoc_STRVAR(_curses_tigetflag__doc__,
3491"tigetflag($module, capname, /)\n"
3492"--\n"
3493"\n"
3494"Return the value of the Boolean capability.\n"
3495"\n"
3496" capname\n"
3497" The terminfo capability name.\n"
3498"\n"
3499"The value -1 is returned if capname is not a Boolean capability, or 0 if\n"
3500"it is canceled or absent from the terminal description.");
3501
3502#define _CURSES_TIGETFLAG_METHODDEF \
3503 {"tigetflag", (PyCFunction)_curses_tigetflag, METH_O, _curses_tigetflag__doc__},
3504
3505static PyObject *
3506_curses_tigetflag_impl(PyObject *module, const char *capname);
3507
3508static PyObject *
3509_curses_tigetflag(PyObject *module, PyObject *arg)
3510{
3511 PyObject *return_value = NULL;
3512 const char *capname;
3513
3514 if (!PyArg_Parse(arg, "s:tigetflag", &capname)) {
3515 goto exit;
3516 }
3517 return_value = _curses_tigetflag_impl(module, capname);
3518
3519exit:
3520 return return_value;
3521}
3522
3523PyDoc_STRVAR(_curses_tigetnum__doc__,
3524"tigetnum($module, capname, /)\n"
3525"--\n"
3526"\n"
3527"Return the value of the numeric capability.\n"
3528"\n"
3529" capname\n"
3530" The terminfo capability name.\n"
3531"\n"
3532"The value -2 is returned if capname is not a numeric capability, or -1 if\n"
3533"it is canceled or absent from the terminal description.");
3534
3535#define _CURSES_TIGETNUM_METHODDEF \
3536 {"tigetnum", (PyCFunction)_curses_tigetnum, METH_O, _curses_tigetnum__doc__},
3537
3538static PyObject *
3539_curses_tigetnum_impl(PyObject *module, const char *capname);
3540
3541static PyObject *
3542_curses_tigetnum(PyObject *module, PyObject *arg)
3543{
3544 PyObject *return_value = NULL;
3545 const char *capname;
3546
3547 if (!PyArg_Parse(arg, "s:tigetnum", &capname)) {
3548 goto exit;
3549 }
3550 return_value = _curses_tigetnum_impl(module, capname);
3551
3552exit:
3553 return return_value;
3554}
3555
3556PyDoc_STRVAR(_curses_tigetstr__doc__,
3557"tigetstr($module, capname, /)\n"
3558"--\n"
3559"\n"
3560"Return the value of the string capability.\n"
3561"\n"
3562" capname\n"
3563" The terminfo capability name.\n"
3564"\n"
3565"None is returned if capname is not a string capability, or is canceled or\n"
3566"absent from the terminal description.");
3567
3568#define _CURSES_TIGETSTR_METHODDEF \
3569 {"tigetstr", (PyCFunction)_curses_tigetstr, METH_O, _curses_tigetstr__doc__},
3570
3571static PyObject *
3572_curses_tigetstr_impl(PyObject *module, const char *capname);
3573
3574static PyObject *
3575_curses_tigetstr(PyObject *module, PyObject *arg)
3576{
3577 PyObject *return_value = NULL;
3578 const char *capname;
3579
3580 if (!PyArg_Parse(arg, "s:tigetstr", &capname)) {
3581 goto exit;
3582 }
3583 return_value = _curses_tigetstr_impl(module, capname);
3584
3585exit:
3586 return return_value;
3587}
3588
3589PyDoc_STRVAR(_curses_tparm__doc__,
3590"tparm($module, str, i1=0, i2=0, i3=0, i4=0, i5=0, i6=0, i7=0, i8=0,\n"
3591" i9=0, /)\n"
3592"--\n"
3593"\n"
3594"Instantiate the specified byte string with the supplied parameters.\n"
3595"\n"
3596" str\n"
3597" Parameterized byte string obtained from the terminfo database.");
3598
3599#define _CURSES_TPARM_METHODDEF \
3600 {"tparm", (PyCFunction)_curses_tparm, METH_FASTCALL, _curses_tparm__doc__},
3601
3602static PyObject *
3603_curses_tparm_impl(PyObject *module, const char *str, int i1, int i2, int i3,
3604 int i4, int i5, int i6, int i7, int i8, int i9);
3605
3606static PyObject *
3607_curses_tparm(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
3608{
3609 PyObject *return_value = NULL;
3610 const char *str;
3611 int i1 = 0;
3612 int i2 = 0;
3613 int i3 = 0;
3614 int i4 = 0;
3615 int i5 = 0;
3616 int i6 = 0;
3617 int i7 = 0;
3618 int i8 = 0;
3619 int i9 = 0;
3620
3621 if (!_PyArg_ParseStack(args, nargs, "y|iiiiiiiii:tparm",
3622 &str, &i1, &i2, &i3, &i4, &i5, &i6, &i7, &i8, &i9)) {
3623 goto exit;
3624 }
3625 return_value = _curses_tparm_impl(module, str, i1, i2, i3, i4, i5, i6, i7, i8, i9);
3626
3627exit:
3628 return return_value;
3629}
3630
3631#if defined(HAVE_CURSES_TYPEAHEAD)
3632
3633PyDoc_STRVAR(_curses_typeahead__doc__,
3634"typeahead($module, fd, /)\n"
3635"--\n"
3636"\n"
3637"Specify that the file descriptor fd be used for typeahead checking.\n"
3638"\n"
3639" fd\n"
3640" File descriptor.\n"
3641"\n"
3642"If fd is -1, then no typeahead checking is done.");
3643
3644#define _CURSES_TYPEAHEAD_METHODDEF \
3645 {"typeahead", (PyCFunction)_curses_typeahead, METH_O, _curses_typeahead__doc__},
3646
3647static PyObject *
3648_curses_typeahead_impl(PyObject *module, int fd);
3649
3650static PyObject *
3651_curses_typeahead(PyObject *module, PyObject *arg)
3652{
3653 PyObject *return_value = NULL;
3654 int fd;
3655
3656 if (!PyArg_Parse(arg, "i:typeahead", &fd)) {
3657 goto exit;
3658 }
3659 return_value = _curses_typeahead_impl(module, fd);
3660
3661exit:
3662 return return_value;
3663}
3664
3665#endif /* defined(HAVE_CURSES_TYPEAHEAD) */
3666
3667PyDoc_STRVAR(_curses_unctrl__doc__,
3668"unctrl($module, ch, /)\n"
3669"--\n"
3670"\n"
3671"Return a string which is a printable representation of the character ch.\n"
3672"\n"
3673"Control characters are displayed as a caret followed by the character,\n"
3674"for example as ^C. Printing characters are left as they are.");
3675
3676#define _CURSES_UNCTRL_METHODDEF \
3677 {"unctrl", (PyCFunction)_curses_unctrl, METH_O, _curses_unctrl__doc__},
3678
3679PyDoc_STRVAR(_curses_ungetch__doc__,
3680"ungetch($module, ch, /)\n"
3681"--\n"
3682"\n"
3683"Push ch so the next getch() will return it.");
3684
3685#define _CURSES_UNGETCH_METHODDEF \
3686 {"ungetch", (PyCFunction)_curses_ungetch, METH_O, _curses_ungetch__doc__},
3687
3688#if defined(HAVE_NCURSESW)
3689
3690PyDoc_STRVAR(_curses_unget_wch__doc__,
3691"unget_wch($module, ch, /)\n"
3692"--\n"
3693"\n"
3694"Push ch so the next get_wch() will return it.");
3695
3696#define _CURSES_UNGET_WCH_METHODDEF \
3697 {"unget_wch", (PyCFunction)_curses_unget_wch, METH_O, _curses_unget_wch__doc__},
3698
3699#endif /* defined(HAVE_NCURSESW) */
3700
3701#if defined(HAVE_CURSES_USE_ENV)
3702
3703PyDoc_STRVAR(_curses_use_env__doc__,
3704"use_env($module, flag, /)\n"
3705"--\n"
3706"\n"
3707"Use environment variables LINES and COLUMNS.\n"
3708"\n"
3709"If used, this function should be called before initscr() or newterm() are\n"
3710"called.\n"
3711"\n"
3712"When flag is False, the values of lines and columns specified in the terminfo\n"
3713"database will be used, even if environment variables LINES and COLUMNS (used\n"
3714"by default) are set, or if curses is running in a window (in which case\n"
3715"default behavior would be to use the window size if LINES and COLUMNS are\n"
3716"not set).");
3717
3718#define _CURSES_USE_ENV_METHODDEF \
3719 {"use_env", (PyCFunction)_curses_use_env, METH_O, _curses_use_env__doc__},
3720
3721static PyObject *
3722_curses_use_env_impl(PyObject *module, int flag);
3723
3724static PyObject *
3725_curses_use_env(PyObject *module, PyObject *arg)
3726{
3727 PyObject *return_value = NULL;
3728 int flag;
3729
3730 if (!PyArg_Parse(arg, "i:use_env", &flag)) {
3731 goto exit;
3732 }
3733 return_value = _curses_use_env_impl(module, flag);
3734
3735exit:
3736 return return_value;
3737}
3738
3739#endif /* defined(HAVE_CURSES_USE_ENV) */
3740
3741#if !defined(STRICT_SYSV_CURSES)
3742
3743PyDoc_STRVAR(_curses_use_default_colors__doc__,
3744"use_default_colors($module, /)\n"
3745"--\n"
3746"\n"
3747"Allow use of default values for colors on terminals supporting this feature.\n"
3748"\n"
3749"Use this to support transparency in your application. The default color\n"
3750"is assigned to the color number -1.");
3751
3752#define _CURSES_USE_DEFAULT_COLORS_METHODDEF \
3753 {"use_default_colors", (PyCFunction)_curses_use_default_colors, METH_NOARGS, _curses_use_default_colors__doc__},
3754
3755static PyObject *
3756_curses_use_default_colors_impl(PyObject *module);
3757
3758static PyObject *
3759_curses_use_default_colors(PyObject *module, PyObject *Py_UNUSED(ignored))
3760{
3761 return _curses_use_default_colors_impl(module);
3762}
3763
3764#endif /* !defined(STRICT_SYSV_CURSES) */
3765
3766#ifndef _CURSES_WINDOW_ENCLOSE_METHODDEF
3767 #define _CURSES_WINDOW_ENCLOSE_METHODDEF
3768#endif /* !defined(_CURSES_WINDOW_ENCLOSE_METHODDEF) */
3769
3770#ifndef _CURSES_WINDOW_GET_WCH_METHODDEF
3771 #define _CURSES_WINDOW_GET_WCH_METHODDEF
3772#endif /* !defined(_CURSES_WINDOW_GET_WCH_METHODDEF) */
3773
3774#ifndef _CURSES_WINDOW_NOUTREFRESH_METHODDEF
3775 #define _CURSES_WINDOW_NOUTREFRESH_METHODDEF
3776#endif /* !defined(_CURSES_WINDOW_NOUTREFRESH_METHODDEF) */
3777
3778#ifndef _CURSES_FILTER_METHODDEF
3779 #define _CURSES_FILTER_METHODDEF
3780#endif /* !defined(_CURSES_FILTER_METHODDEF) */
3781
3782#ifndef _CURSES_GETSYX_METHODDEF
3783 #define _CURSES_GETSYX_METHODDEF
3784#endif /* !defined(_CURSES_GETSYX_METHODDEF) */
3785
3786#ifndef _CURSES_GETMOUSE_METHODDEF
3787 #define _CURSES_GETMOUSE_METHODDEF
3788#endif /* !defined(_CURSES_GETMOUSE_METHODDEF) */
3789
3790#ifndef _CURSES_UNGETMOUSE_METHODDEF
3791 #define _CURSES_UNGETMOUSE_METHODDEF
3792#endif /* !defined(_CURSES_UNGETMOUSE_METHODDEF) */
3793
3794#ifndef _CURSES_HAS_KEY_METHODDEF
3795 #define _CURSES_HAS_KEY_METHODDEF
3796#endif /* !defined(_CURSES_HAS_KEY_METHODDEF) */
3797
3798#ifndef _CURSES_IS_TERM_RESIZED_METHODDEF
3799 #define _CURSES_IS_TERM_RESIZED_METHODDEF
3800#endif /* !defined(_CURSES_IS_TERM_RESIZED_METHODDEF) */
3801
3802#ifndef _CURSES_MOUSEINTERVAL_METHODDEF
3803 #define _CURSES_MOUSEINTERVAL_METHODDEF
3804#endif /* !defined(_CURSES_MOUSEINTERVAL_METHODDEF) */
3805
3806#ifndef _CURSES_MOUSEMASK_METHODDEF
3807 #define _CURSES_MOUSEMASK_METHODDEF
3808#endif /* !defined(_CURSES_MOUSEMASK_METHODDEF) */
3809
3810#ifndef _CURSES_UPDATE_LINES_COLS_METHODDEF
3811 #define _CURSES_UPDATE_LINES_COLS_METHODDEF
3812#endif /* !defined(_CURSES_UPDATE_LINES_COLS_METHODDEF) */
3813
3814#ifndef _CURSES_RESIZETERM_METHODDEF
3815 #define _CURSES_RESIZETERM_METHODDEF
3816#endif /* !defined(_CURSES_RESIZETERM_METHODDEF) */
3817
3818#ifndef _CURSES_RESIZE_TERM_METHODDEF
3819 #define _CURSES_RESIZE_TERM_METHODDEF
3820#endif /* !defined(_CURSES_RESIZE_TERM_METHODDEF) */
3821
3822#ifndef _CURSES_SETSYX_METHODDEF
3823 #define _CURSES_SETSYX_METHODDEF
3824#endif /* !defined(_CURSES_SETSYX_METHODDEF) */
3825
3826#ifndef _CURSES_TYPEAHEAD_METHODDEF
3827 #define _CURSES_TYPEAHEAD_METHODDEF
3828#endif /* !defined(_CURSES_TYPEAHEAD_METHODDEF) */
3829
3830#ifndef _CURSES_UNGET_WCH_METHODDEF
3831 #define _CURSES_UNGET_WCH_METHODDEF
3832#endif /* !defined(_CURSES_UNGET_WCH_METHODDEF) */
3833
3834#ifndef _CURSES_USE_ENV_METHODDEF
3835 #define _CURSES_USE_ENV_METHODDEF
3836#endif /* !defined(_CURSES_USE_ENV_METHODDEF) */
3837
3838#ifndef _CURSES_USE_DEFAULT_COLORS_METHODDEF
3839 #define _CURSES_USE_DEFAULT_COLORS_METHODDEF
3840#endif /* !defined(_CURSES_USE_DEFAULT_COLORS_METHODDEF) */
3841/*[clinic end generated code: output=763ffe3abc3a97c7 input=a9049054013a1b77]*/