aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/tools/python3/Modules/clinic/_cursesmodule.c.h
blob: 9d99d41af5d2d9e3c3478140d97a806262629a02 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
/*[clinic input]
preserve
[clinic start generated code]*/

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


PyDoc_STRVAR(_curses_window_addch__doc__,
"addch([y, x,] ch, [attr=_curses.A_NORMAL])\n"
"Paint the character.\n"
"\n"
"  y\n"
"    Y-coordinate.\n"
"  x\n"
"    X-coordinate.\n"
"  ch\n"
"    Character to add.\n"
"  attr\n"
"    Attributes for the character.\n"
"\n"
"Paint character ch at (y, x) with attributes attr,\n"
"overwriting any character previously painted at that location.\n"
"By default, the character position and attributes are the\n"
"current settings for the window object.");

#define _CURSES_WINDOW_ADDCH_METHODDEF    \
    {"addch", (PyCFunction)_curses_window_addch, METH_VARARGS, _curses_window_addch__doc__},

static PyObject *
_curses_window_addch_impl(PyCursesWindowObject *self, int group_left_1,
                          int y, int x, PyObject *ch, int group_right_1,
                          long attr);

static PyObject *
_curses_window_addch(PyCursesWindowObject *self, PyObject *args)
{
    PyObject *return_value = NULL;
    int group_left_1 = 0;
    int y = 0;
    int x = 0;
    PyObject *ch;
    int group_right_1 = 0;
    long attr = A_NORMAL;

    switch (PyTuple_GET_SIZE(args)) {
        case 1:
            if (!PyArg_ParseTuple(args, "O:addch", &ch)) {
                goto exit;
            }
            break;
        case 2:
            if (!PyArg_ParseTuple(args, "Ol:addch", &ch, &attr)) {
                goto exit;
            }
            group_right_1 = 1;
            break;
        case 3:
            if (!PyArg_ParseTuple(args, "iiO:addch", &y, &x, &ch)) {
                goto exit;
            }
            group_left_1 = 1;
            break;
        case 4:
            if (!PyArg_ParseTuple(args, "iiOl:addch", &y, &x, &ch, &attr)) {
                goto exit;
            }
            group_right_1 = 1;
            group_left_1 = 1;
            break;
        default:
            PyErr_SetString(PyExc_TypeError, "_curses.window.addch requires 1 to 4 arguments");
            goto exit;
    }
    return_value = _curses_window_addch_impl(self, group_left_1, y, x, ch, group_right_1, attr);

exit:
    return return_value;
}

PyDoc_STRVAR(_curses_window_addstr__doc__,
"addstr([y, x,] str, [attr])\n"
"Paint the string.\n"
"\n"
"  y\n"
"    Y-coordinate.\n"
"  x\n"
"    X-coordinate.\n"
"  str\n"
"    String to add.\n"
"  attr\n"
"    Attributes for characters.\n"
"\n"
"Paint the string str at (y, x) with attributes attr,\n"
"overwriting anything previously on the display.\n"
"By default, the character position and attributes are the\n"
"current settings for the window object.");

#define _CURSES_WINDOW_ADDSTR_METHODDEF    \
    {"addstr", (PyCFunction)_curses_window_addstr, METH_VARARGS, _curses_window_addstr__doc__},

static PyObject *
_curses_window_addstr_impl(PyCursesWindowObject *self, int group_left_1,
                           int y, int x, PyObject *str, int group_right_1,
                           long attr);

static PyObject *
_curses_window_addstr(PyCursesWindowObject *self, PyObject *args)
{
    PyObject *return_value = NULL;
    int group_left_1 = 0;
    int y = 0;
    int x = 0;
    PyObject *str;
    int group_right_1 = 0;
    long attr = 0;

    switch (PyTuple_GET_SIZE(args)) {
        case 1:
            if (!PyArg_ParseTuple(args, "O:addstr", &str)) {
                goto exit;
            }
            break;
        case 2:
            if (!PyArg_ParseTuple(args, "Ol:addstr", &str, &attr)) {
                goto exit;
            }
            group_right_1 = 1;
            break;
        case 3:
            if (!PyArg_ParseTuple(args, "iiO:addstr", &y, &x, &str)) {
                goto exit;
            }
            group_left_1 = 1;
            break;
        case 4:
            if (!PyArg_ParseTuple(args, "iiOl:addstr", &y, &x, &str, &attr)) {
                goto exit;
            }
            group_right_1 = 1;
            group_left_1 = 1;
            break;
        default:
            PyErr_SetString(PyExc_TypeError, "_curses.window.addstr requires 1 to 4 arguments");
            goto exit;
    }
    return_value = _curses_window_addstr_impl(self, group_left_1, y, x, str, group_right_1, attr);

exit:
    return return_value;
}

PyDoc_STRVAR(_curses_window_addnstr__doc__,
"addnstr([y, x,] str, n, [attr])\n"
"Paint at most n characters of the string.\n"
"\n"
"  y\n"
"    Y-coordinate.\n"
"  x\n"
"    X-coordinate.\n"
"  str\n"
"    String to add.\n"
"  n\n"
"    Maximal number of characters.\n"
"  attr\n"
"    Attributes for characters.\n"
"\n"
"Paint at most n characters of the string str at (y, x) with\n"
"attributes attr, overwriting anything previously on the display.\n"
"By default, the character position and attributes are the\n"
"current settings for the window object.");

#define _CURSES_WINDOW_ADDNSTR_METHODDEF    \
    {"addnstr", (PyCFunction)_curses_window_addnstr, METH_VARARGS, _curses_window_addnstr__doc__},

static PyObject *
_curses_window_addnstr_impl(PyCursesWindowObject *self, int group_left_1,
                            int y, int x, PyObject *str, int n,
                            int group_right_1, long attr);

static PyObject *
_curses_window_addnstr(PyCursesWindowObject *self, PyObject *args)
{
    PyObject *return_value = NULL;
    int group_left_1 = 0;
    int y = 0;
    int x = 0;
    PyObject *str;
    int n;
    int group_right_1 = 0;
    long attr = 0;

    switch (PyTuple_GET_SIZE(args)) {
        case 2:
            if (!PyArg_ParseTuple(args, "Oi:addnstr", &str, &n)) {
                goto exit;
            }
            break;
        case 3:
            if (!PyArg_ParseTuple(args, "Oil:addnstr", &str, &n, &attr)) {
                goto exit;
            }
            group_right_1 = 1;
            break;
        case 4:
            if (!PyArg_ParseTuple(args, "iiOi:addnstr", &y, &x, &str, &n)) {
                goto exit;
            }
            group_left_1 = 1;
            break;
        case 5:
            if (!PyArg_ParseTuple(args, "iiOil:addnstr", &y, &x, &str, &n, &attr)) {
                goto exit;
            }
            group_right_1 = 1;
            group_left_1 = 1;
            break;
        default:
            PyErr_SetString(PyExc_TypeError, "_curses.window.addnstr requires 2 to 5 arguments");
            goto exit;
    }
    return_value = _curses_window_addnstr_impl(self, group_left_1, y, x, str, n, group_right_1, attr);

exit:
    return return_value;
}

PyDoc_STRVAR(_curses_window_bkgd__doc__,
"bkgd($self, ch, attr=_curses.A_NORMAL, /)\n"
"--\n"
"\n"
"Set the background property of the window.\n"
"\n"
"  ch\n"
"    Background character.\n"
"  attr\n"
"    Background attributes.");

#define _CURSES_WINDOW_BKGD_METHODDEF    \
    {"bkgd", _PyCFunction_CAST(_curses_window_bkgd), METH_FASTCALL, _curses_window_bkgd__doc__},

static PyObject *
_curses_window_bkgd_impl(PyCursesWindowObject *self, PyObject *ch, long attr);

static PyObject *
_curses_window_bkgd(PyCursesWindowObject *self, PyObject *const *args, Py_ssize_t nargs)
{
    PyObject *return_value = NULL;
    PyObject *ch;
    long attr = A_NORMAL;

    if (!_PyArg_CheckPositional("bkgd", nargs, 1, 2)) {
        goto exit;
    }
    ch = args[0];
    if (nargs < 2) {
        goto skip_optional;
    }
    attr = PyLong_AsLong(args[1]);
    if (attr == -1 && PyErr_Occurred()) {
        goto exit;
    }
skip_optional:
    return_value = _curses_window_bkgd_impl(self, ch, attr);

exit:
    return return_value;
}

PyDoc_STRVAR(_curses_window_attroff__doc__,
"attroff($self, attr, /)\n"
"--\n"
"\n"
"Remove attribute attr from the \"background\" set.");

#define _CURSES_WINDOW_ATTROFF_METHODDEF    \
    {"attroff", (PyCFunction)_curses_window_attroff, METH_O, _curses_window_attroff__doc__},

static PyObject *
_curses_window_attroff_impl(PyCursesWindowObject *self, long attr);

static PyObject *
_curses_window_attroff(PyCursesWindowObject *self, PyObject *arg)
{
    PyObject *return_value = NULL;
    long attr;

    attr = PyLong_AsLong(arg);
    if (attr == -1 && PyErr_Occurred()) {
        goto exit;
    }
    return_value = _curses_window_attroff_impl(self, attr);

exit:
    return return_value;
}

PyDoc_STRVAR(_curses_window_attron__doc__,
"attron($self, attr, /)\n"
"--\n"
"\n"
"Add attribute attr from the \"background\" set.");

#define _CURSES_WINDOW_ATTRON_METHODDEF    \
    {"attron", (PyCFunction)_curses_window_attron, METH_O, _curses_window_attron__doc__},

static PyObject *
_curses_window_attron_impl(PyCursesWindowObject *self, long attr);

static PyObject *
_curses_window_attron(PyCursesWindowObject *self, PyObject *arg)
{
    PyObject *return_value = NULL;
    long attr;

    attr = PyLong_AsLong(arg);
    if (attr == -1 && PyErr_Occurred()) {
        goto exit;
    }
    return_value = _curses_window_attron_impl(self, attr);

exit:
    return return_value;
}

PyDoc_STRVAR(_curses_window_attrset__doc__,
"attrset($self, attr, /)\n"
"--\n"
"\n"
"Set the \"background\" set of attributes.");

#define _CURSES_WINDOW_ATTRSET_METHODDEF    \
    {"attrset", (PyCFunction)_curses_window_attrset, METH_O, _curses_window_attrset__doc__},

static PyObject *
_curses_window_attrset_impl(PyCursesWindowObject *self, long attr);

static PyObject *
_curses_window_attrset(PyCursesWindowObject *self, PyObject *arg)
{
    PyObject *return_value = NULL;
    long attr;

    attr = PyLong_AsLong(arg);
    if (attr == -1 && PyErr_Occurred()) {
        goto exit;
    }
    return_value = _curses_window_attrset_impl(self, attr);

exit:
    return return_value;
}

PyDoc_STRVAR(_curses_window_bkgdset__doc__,
"bkgdset($self, ch, attr=_curses.A_NORMAL, /)\n"
"--\n"
"\n"
"Set the window\'s background.\n"
"\n"
"  ch\n"
"    Background character.\n"
"  attr\n"
"    Background attributes.");

#define _CURSES_WINDOW_BKGDSET_METHODDEF    \
    {"bkgdset", _PyCFunction_CAST(_curses_window_bkgdset), METH_FASTCALL, _curses_window_bkgdset__doc__},

static PyObject *
_curses_window_bkgdset_impl(PyCursesWindowObject *self, PyObject *ch,
                            long attr);

static PyObject *
_curses_window_bkgdset(PyCursesWindowObject *self, PyObject *const *args, Py_ssize_t nargs)
{
    PyObject *return_value = NULL;
    PyObject *ch;
    long attr = A_NORMAL;

    if (!_PyArg_CheckPositional("bkgdset", nargs, 1, 2)) {
        goto exit;
    }
    ch = args[0];
    if (nargs < 2) {
        goto skip_optional;
    }
    attr = PyLong_AsLong(args[1]);
    if (attr == -1 && PyErr_Occurred()) {
        goto exit;
    }
skip_optional:
    return_value = _curses_window_bkgdset_impl(self, ch, attr);

exit:
    return return_value;
}

PyDoc_STRVAR(_curses_window_border__doc__,
"border($self, ls=_curses.ACS_VLINE, rs=_curses.ACS_VLINE,\n"
"       ts=_curses.ACS_HLINE, bs=_curses.ACS_HLINE,\n"
"       tl=_curses.ACS_ULCORNER, tr=_curses.ACS_URCORNER,\n"
"       bl=_curses.ACS_LLCORNER, br=_curses.ACS_LRCORNER, /)\n"
"--\n"
"\n"
"Draw a border around the edges of the window.\n"
"\n"
"  ls\n"
"    Left side.\n"
"  rs\n"
"    Right side.\n"
"  ts\n"
"    Top side.\n"
"  bs\n"
"    Bottom side.\n"
"  tl\n"
"    Upper-left corner.\n"
"  tr\n"
"    Upper-right corner.\n"
"  bl\n"
"    Bottom-left corner.\n"
"  br\n"
"    Bottom-right corner.\n"
"\n"
"Each parameter specifies the character to use for a specific part of the\n"
"border.  The characters can be specified as integers or as one-character\n"
"strings.  A 0 value for any parameter will cause the default character to be\n"
"used for that parameter.");

#define _CURSES_WINDOW_BORDER_METHODDEF    \
    {"border", _PyCFunction_CAST(_curses_window_border), METH_FASTCALL, _curses_window_border__doc__},

static PyObject *
_curses_window_border_impl(PyCursesWindowObject *self, PyObject *ls,
                           PyObject *rs, PyObject *ts, PyObject *bs,
                           PyObject *tl, PyObject *tr, PyObject *bl,
                           PyObject *br);

static PyObject *
_curses_window_border(PyCursesWindowObject *self, PyObject *const *args, Py_ssize_t nargs)
{
    PyObject *return_value = NULL;
    PyObject *ls = NULL;
    PyObject *rs = NULL;
    PyObject *ts = NULL;
    PyObject *bs = NULL;
    PyObject *tl = NULL;
    PyObject *tr = NULL;
    PyObject *bl = NULL;
    PyObject *br = NULL;

    if (!_PyArg_CheckPositional("border", nargs, 0, 8)) {
        goto exit;
    }
    if (nargs < 1) {
        goto skip_optional;
    }
    ls = args[0];
    if (nargs < 2) {
        goto skip_optional;
    }
    rs = args[1];
    if (nargs < 3) {
        goto skip_optional;
    }
    ts = args[2];
    if (nargs < 4) {
        goto skip_optional;
    }
    bs = args[3];
    if (nargs < 5) {
        goto skip_optional;
    }
    tl = args[4];
    if (nargs < 6) {
        goto skip_optional;
    }
    tr = args[5];
    if (nargs < 7) {
        goto skip_optional;
    }
    bl = args[6];
    if (nargs < 8) {
        goto skip_optional;
    }
    br = args[7];
skip_optional:
    return_value = _curses_window_border_impl(self, ls, rs, ts, bs, tl, tr, bl, br);

exit:
    return return_value;
}

PyDoc_STRVAR(_curses_window_box__doc__,
"box([verch=0, horch=0])\n"
"Draw a border around the edges of the window.\n"
"\n"
"  verch\n"
"    Left and right side.\n"
"  horch\n"
"    Top and bottom side.\n"
"\n"
"Similar to border(), but both ls and rs are verch and both ts and bs are\n"
"horch.  The default corner characters are always used by this function.");

#define _CURSES_WINDOW_BOX_METHODDEF    \
    {"box", (PyCFunction)_curses_window_box, METH_VARARGS, _curses_window_box__doc__},

static PyObject *
_curses_window_box_impl(PyCursesWindowObject *self, int group_right_1,
                        PyObject *verch, PyObject *horch);

static PyObject *
_curses_window_box(PyCursesWindowObject *self, PyObject *args)
{
    PyObject *return_value = NULL;
    int group_right_1 = 0;
    PyObject *verch = _PyLong_GetZero();
    PyObject *horch = _PyLong_GetZero();

    switch (PyTuple_GET_SIZE(args)) {
        case 0:
            break;
        case 2:
            if (!PyArg_ParseTuple(args, "OO:box", &verch, &horch)) {
                goto exit;
            }
            group_right_1 = 1;
            break;
        default:
            PyErr_SetString(PyExc_TypeError, "_curses.window.box requires 0 to 2 arguments");
            goto exit;
    }
    return_value = _curses_window_box_impl(self, group_right_1, verch, horch);

exit:
    return return_value;
}

PyDoc_STRVAR(_curses_window_delch__doc__,
"delch([y, x])\n"
"Delete any character at (y, x).\n"
"\n"
"  y\n"
"    Y-coordinate.\n"
"  x\n"
"    X-coordinate.");

#define _CURSES_WINDOW_DELCH_METHODDEF    \
    {"delch", (PyCFunction)_curses_window_delch, METH_VARARGS, _curses_window_delch__doc__},

static PyObject *
_curses_window_delch_impl(PyCursesWindowObject *self, int group_right_1,
                          int y, int x);

static PyObject *
_curses_window_delch(PyCursesWindowObject *self, PyObject *args)
{
    PyObject *return_value = NULL;
    int group_right_1 = 0;
    int y = 0;
    int x = 0;

    switch (PyTuple_GET_SIZE(args)) {
        case 0:
            break;
        case 2:
            if (!PyArg_ParseTuple(args, "ii:delch", &y, &x)) {
                goto exit;
            }
            group_right_1 = 1;
            break;
        default:
            PyErr_SetString(PyExc_TypeError, "_curses.window.delch requires 0 to 2 arguments");
            goto exit;
    }
    return_value = _curses_window_delch_impl(self, group_right_1, y, x);

exit:
    return return_value;
}

PyDoc_STRVAR(_curses_window_derwin__doc__,
"derwin([nlines=0, ncols=0,] begin_y, begin_x)\n"
"Create a sub-window (window-relative coordinates).\n"
"\n"
"  nlines\n"
"    Height.\n"
"  ncols\n"
"    Width.\n"
"  begin_y\n"
"    Top side y-coordinate.\n"
"  begin_x\n"
"    Left side x-coordinate.\n"
"\n"
"derwin() is the same as calling subwin(), except that begin_y and begin_x\n"
"are relative to the origin of the window, rather than relative to the entire\n"
"screen.");

#define _CURSES_WINDOW_DERWIN_METHODDEF    \
    {"derwin", (PyCFunction)_curses_window_derwin, METH_VARARGS, _curses_window_derwin__doc__},

static PyObject *
_curses_window_derwin_impl(PyCursesWindowObject *self, int group_left_1,
                           int nlines, int ncols, int begin_y, int begin_x);

static PyObject *
_curses_window_derwin(PyCursesWindowObject *self, PyObject *args)
{
    PyObject *return_value = NULL;
    int group_left_1 = 0;
    int nlines = 0;
    int ncols = 0;
    int begin_y;
    int begin_x;

    switch (PyTuple_GET_SIZE(args)) {
        case 2:
            if (!PyArg_ParseTuple(args, "ii:derwin", &begin_y, &begin_x)) {
                goto exit;
            }
            break;
        case 4:
            if (!PyArg_ParseTuple(args, "iiii:derwin", &nlines, &ncols, &begin_y, &begin_x)) {
                goto exit;
            }
            group_left_1 = 1;
            break;
        default:
            PyErr_SetString(PyExc_TypeError, "_curses.window.derwin requires 2 to 4 arguments");
            goto exit;
    }
    return_value = _curses_window_derwin_impl(self, group_left_1, nlines, ncols, begin_y, begin_x);

exit:
    return return_value;
}

PyDoc_STRVAR(_curses_window_echochar__doc__,
"echochar($self, ch, attr=_curses.A_NORMAL, /)\n"
"--\n"
"\n"
"Add character ch with attribute attr, and refresh.\n"
"\n"
"  ch\n"
"    Character to add.\n"
"  attr\n"
"    Attributes for the character.");

#define _CURSES_WINDOW_ECHOCHAR_METHODDEF    \
    {"echochar", _PyCFunction_CAST(_curses_window_echochar), METH_FASTCALL, _curses_window_echochar__doc__},

static PyObject *
_curses_window_echochar_impl(PyCursesWindowObject *self, PyObject *ch,
                             long attr);

static PyObject *
_curses_window_echochar(PyCursesWindowObject *self, PyObject *const *args, Py_ssize_t nargs)
{
    PyObject *return_value = NULL;
    PyObject *ch;
    long attr = A_NORMAL;

    if (!_PyArg_CheckPositional("echochar", nargs, 1, 2)) {
        goto exit;
    }
    ch = args[0];
    if (nargs < 2) {
        goto skip_optional;
    }
    attr = PyLong_AsLong(args[1]);
    if (attr == -1 && PyErr_Occurred()) {
        goto exit;
    }
skip_optional:
    return_value = _curses_window_echochar_impl(self, ch, attr);

exit:
    return return_value;
}

#if defined(NCURSES_MOUSE_VERSION)

PyDoc_STRVAR(_curses_window_enclose__doc__,
"enclose($self, y, x, /)\n"
"--\n"
"\n"
"Return True if the screen-relative coordinates are enclosed by the window.\n"
"\n"
"  y\n"
"    Y-coordinate.\n"
"  x\n"
"    X-coordinate.");

#define _CURSES_WINDOW_ENCLOSE_METHODDEF    \
    {"enclose", _PyCFunction_CAST(_curses_window_enclose), METH_FASTCALL, _curses_window_enclose__doc__},

static PyObject *
_curses_window_enclose_impl(PyCursesWindowObject *self, int y, int x);

static PyObject *
_curses_window_enclose(PyCursesWindowObject *self, PyObject *const *args, Py_ssize_t nargs)
{
    PyObject *return_value = NULL;
    int y;
    int x;

    if (!_PyArg_CheckPositional("enclose", nargs, 2, 2)) {
        goto exit;
    }
    y = _PyLong_AsInt(args[0]);
    if (y == -1 && PyErr_Occurred()) {
        goto exit;
    }
    x = _PyLong_AsInt(args[1]);
    if (x == -1 && PyErr_Occurred()) {
        goto exit;
    }
    return_value = _curses_window_enclose_impl(self, y, x);

exit:
    return return_value;
}

#endif /* defined(NCURSES_MOUSE_VERSION) */

PyDoc_STRVAR(_curses_window_getbkgd__doc__,
"getbkgd($self, /)\n"
"--\n"
"\n"
"Return the window\'s current background character/attribute pair.");

#define _CURSES_WINDOW_GETBKGD_METHODDEF    \
    {"getbkgd", (PyCFunction)_curses_window_getbkgd, METH_NOARGS, _curses_window_getbkgd__doc__},

static long
_curses_window_getbkgd_impl(PyCursesWindowObject *self);

static PyObject *
_curses_window_getbkgd(PyCursesWindowObject *self, PyObject *Py_UNUSED(ignored))
{
    PyObject *return_value = NULL;
    long _return_value;

    _return_value = _curses_window_getbkgd_impl(self);
    if ((_return_value == -1) && PyErr_Occurred()) {
        goto exit;
    }
    return_value = PyLong_FromLong(_return_value);

exit:
    return return_value;
}

PyDoc_STRVAR(_curses_window_getch__doc__,
"getch([y, x])\n"
"Get a character code from terminal keyboard.\n"
"\n"
"  y\n"
"    Y-coordinate.\n"
"  x\n"
"    X-coordinate.\n"
"\n"
"The integer returned does not have to be in ASCII range: function keys,\n"
"keypad keys and so on return numbers higher than 256.  In no-delay mode, -1\n"
"is returned if there is no input, else getch() waits until a key is pressed.");

#define _CURSES_WINDOW_GETCH_METHODDEF    \
    {"getch", (PyCFunction)_curses_window_getch, METH_VARARGS, _curses_window_getch__doc__},

static int
_curses_window_getch_impl(PyCursesWindowObject *self, int group_right_1,
                          int y, int x);

static PyObject *
_curses_window_getch(PyCursesWindowObject *self, PyObject *args)
{
    PyObject *return_value = NULL;
    int group_right_1 = 0;
    int y = 0;
    int x = 0;
    int _return_value;

    switch (PyTuple_GET_SIZE(args)) {
        case 0:
            break;
        case 2:
            if (!PyArg_ParseTuple(args, "ii:getch", &y, &x)) {
                goto exit;
            }
            group_right_1 = 1;
            break;
        default:
            PyErr_SetString(PyExc_TypeError, "_curses.window.getch requires 0 to 2 arguments");
            goto exit;
    }
    _return_value = _curses_window_getch_impl(self, group_right_1, y, x);
    if ((_return_value == -1) && PyErr_Occurred()) {
        goto exit;
    }
    return_value = PyLong_FromLong((long)_return_value);

exit:
    return return_value;
}

PyDoc_STRVAR(_curses_window_getkey__doc__,
"getkey([y, x])\n"
"Get a character (string) from terminal keyboard.\n"
"\n"
"  y\n"
"    Y-coordinate.\n"
"  x\n"
"    X-coordinate.\n"
"\n"
"Returning a string instead of an integer, as getch() does.  Function keys,\n"
"keypad keys and other special keys return a multibyte string containing the\n"
"key name.  In no-delay mode, an exception is raised if there is no input.");

#define _CURSES_WINDOW_GETKEY_METHODDEF    \
    {"getkey", (PyCFunction)_curses_window_getkey, METH_VARARGS, _curses_window_getkey__doc__},

static PyObject *
_curses_window_getkey_impl(PyCursesWindowObject *self, int group_right_1,
                           int y, int x);

static PyObject *
_curses_window_getkey(PyCursesWindowObject *self, PyObject *args)
{
    PyObject *return_value = NULL;
    int group_right_1 = 0;
    int y = 0;
    int x = 0;

    switch (PyTuple_GET_SIZE(args)) {
        case 0:
            break;
        case 2:
            if (!PyArg_ParseTuple(args, "ii:getkey", &y, &x)) {
                goto exit;
            }
            group_right_1 = 1;
            break;
        default:
            PyErr_SetString(PyExc_TypeError, "_curses.window.getkey requires 0 to 2 arguments");
            goto exit;
    }
    return_value = _curses_window_getkey_impl(self, group_right_1, y, x);

exit:
    return return_value;
}

#if defined(HAVE_NCURSESW)

PyDoc_STRVAR(_curses_window_get_wch__doc__,
"get_wch([y, x])\n"
"Get a wide character from terminal keyboard.\n"
"\n"
"  y\n"
"    Y-coordinate.\n"
"  x\n"
"    X-coordinate.\n"
"\n"
"Return a character for most keys, or an integer for function keys,\n"
"keypad keys, and other special keys.");

#define _CURSES_WINDOW_GET_WCH_METHODDEF    \
    {"get_wch", (PyCFunction)_curses_window_get_wch, METH_VARARGS, _curses_window_get_wch__doc__},

static PyObject *
_curses_window_get_wch_impl(PyCursesWindowObject *self, int group_right_1,
                            int y, int x);

static PyObject *
_curses_window_get_wch(PyCursesWindowObject *self, PyObject *args)
{
    PyObject *return_value = NULL;
    int group_right_1 = 0;
    int y = 0;
    int x = 0;

    switch (PyTuple_GET_SIZE(args)) {
        case 0:
            break;
        case 2:
            if (!PyArg_ParseTuple(args, "ii:get_wch", &y, &x)) {
                goto exit;
            }
            group_right_1 = 1;
            break;
        default:
            PyErr_SetString(PyExc_TypeError, "_curses.window.get_wch requires 0 to 2 arguments");
            goto exit;
    }
    return_value = _curses_window_get_wch_impl(self, group_right_1, y, x);

exit:
    return return_value;
}

#endif /* defined(HAVE_NCURSESW) */

PyDoc_STRVAR(_curses_window_hline__doc__,
"hline([y, x,] ch, n, [attr=_curses.A_NORMAL])\n"
"Display a horizontal line.\n"
"\n"
"  y\n"
"    Starting Y-coordinate.\n"
"  x\n"
"    Starting X-coordinate.\n"
"  ch\n"
"    Character to draw.\n"
"  n\n"
"    Line length.\n"
"  attr\n"
"    Attributes for the characters.");

#define _CURSES_WINDOW_HLINE_METHODDEF    \
    {"hline", (PyCFunction)_curses_window_hline, METH_VARARGS, _curses_window_hline__doc__},

static PyObject *
_curses_window_hline_impl(PyCursesWindowObject *self, int group_left_1,
                          int y, int x, PyObject *ch, int n,
                          int group_right_1, long attr);

static PyObject *
_curses_window_hline(PyCursesWindowObject *self, PyObject *args)
{
    PyObject *return_value = NULL;
    int group_left_1 = 0;
    int y = 0;
    int x = 0;
    PyObject *ch;
    int n;
    int group_right_1 = 0;
    long attr = A_NORMAL;

    switch (PyTuple_GET_SIZE(args)) {
        case 2:
            if (!PyArg_ParseTuple(args, "Oi:hline", &ch, &n)) {
                goto exit;
            }
            break;
        case 3:
            if (!PyArg_ParseTuple(args, "Oil:hline", &ch, &n, &attr)) {
                goto exit;
            }
            group_right_1 = 1;
            break;
        case 4:
            if (!PyArg_ParseTuple(args, "iiOi:hline", &y, &x, &ch, &n)) {
                goto exit;
            }
            group_left_1 = 1;
            break;
        case 5:
            if (!PyArg_ParseTuple(args, "iiOil:hline", &y, &x, &ch, &n, &attr)) {
                goto exit;
            }
            group_right_1 = 1;
            group_left_1 = 1;
            break;
        default:
            PyErr_SetString(PyExc_TypeError, "_curses.window.hline requires 2 to 5 arguments");
            goto exit;
    }
    return_value = _curses_window_hline_impl(self, group_left_1, y, x, ch, n, group_right_1, attr);

exit:
    return return_value;
}

PyDoc_STRVAR(_curses_window_insch__doc__,
"insch([y, x,] ch, [attr=_curses.A_NORMAL])\n"
"Insert a character before the current or specified position.\n"
"\n"
"  y\n"
"    Y-coordinate.\n"
"  x\n"
"    X-coordinate.\n"
"  ch\n"
"    Character to insert.\n"
"  attr\n"
"    Attributes for the character.\n"
"\n"
"All characters to the right of the cursor are shifted one position right, with\n"
"the rightmost characters on the line being lost.");

#define _CURSES_WINDOW_INSCH_METHODDEF    \
    {"insch", (PyCFunction)_curses_window_insch, METH_VARARGS, _curses_window_insch__doc__},

static PyObject *
_curses_window_insch_impl(PyCursesWindowObject *self, int group_left_1,
                          int y, int x, PyObject *ch, int group_right_1,
                          long attr);

static PyObject *
_curses_window_insch(PyCursesWindowObject *self, PyObject *args)
{
    PyObject *return_value = NULL;
    int group_left_1 = 0;
    int y = 0;
    int x = 0;
    PyObject *ch;
    int group_right_1 = 0;
    long attr = A_NORMAL;

    switch (PyTuple_GET_SIZE(args)) {
        case 1:
            if (!PyArg_ParseTuple(args, "O:insch", &ch)) {
                goto exit;
            }
            break;
        case 2:
            if (!PyArg_ParseTuple(args, "Ol:insch", &ch, &attr)) {
                goto exit;
            }
            group_right_1 = 1;
            break;
        case 3:
            if (!PyArg_ParseTuple(args, "iiO:insch", &y, &x, &ch)) {
                goto exit;
            }
            group_left_1 = 1;
            break;
        case 4:
            if (!PyArg_ParseTuple(args, "iiOl:insch", &y, &x, &ch, &attr)) {
                goto exit;
            }
            group_right_1 = 1;
            group_left_1 = 1;
            break;
        default:
            PyErr_SetString(PyExc_TypeError, "_curses.window.insch requires 1 to 4 arguments");
            goto exit;
    }
    return_value = _curses_window_insch_impl(self, group_left_1, y, x, ch, group_right_1, attr);

exit:
    return return_value;
}

PyDoc_STRVAR(_curses_window_inch__doc__,
"inch([y, x])\n"
"Return the character at the given position in the window.\n"
"\n"
"  y\n"
"    Y-coordinate.\n"
"  x\n"
"    X-coordinate.\n"
"\n"
"The bottom 8 bits are the character proper, and upper bits are the attributes.");

#define _CURSES_WINDOW_INCH_METHODDEF    \
    {"inch", (PyCFunction)_curses_window_inch, METH_VARARGS, _curses_window_inch__doc__},

static unsigned long
_curses_window_inch_impl(PyCursesWindowObject *self, int group_right_1,
                         int y, int x);

static PyObject *
_curses_window_inch(PyCursesWindowObject *self, PyObject *args)
{
    PyObject *return_value = NULL;
    int group_right_1 = 0;
    int y = 0;
    int x = 0;
    unsigned long _return_value;

    switch (PyTuple_GET_SIZE(args)) {
        case 0:
            break;
        case 2:
            if (!PyArg_ParseTuple(args, "ii:inch", &y, &x)) {
                goto exit;
            }
            group_right_1 = 1;
            break;
        default:
            PyErr_SetString(PyExc_TypeError, "_curses.window.inch requires 0 to 2 arguments");
            goto exit;
    }
    _return_value = _curses_window_inch_impl(self, group_right_1, y, x);
    if ((_return_value == (unsigned long)-1) && PyErr_Occurred()) {
        goto exit;
    }
    return_value = PyLong_FromUnsignedLong(_return_value);

exit:
    return return_value;
}

PyDoc_STRVAR(_curses_window_insstr__doc__,
"insstr([y, x,] str, [attr])\n"
"Insert the string before the current or specified position.\n"
"\n"
"  y\n"
"    Y-coordinate.\n"
"  x\n"
"    X-coordinate.\n"
"  str\n"
"    String to insert.\n"
"  attr\n"
"    Attributes for characters.\n"
"\n"
"Insert a character string (as many characters as will fit on the line)\n"
"before the character under the cursor.  All characters to the right of\n"
"the cursor are shifted right, with the rightmost characters on the line\n"
"being lost.  The cursor position does not change (after moving to y, x,\n"
"if specified).");

#define _CURSES_WINDOW_INSSTR_METHODDEF    \
    {"insstr", (PyCFunction)_curses_window_insstr, METH_VARARGS, _curses_window_insstr__doc__},

static PyObject *
_curses_window_insstr_impl(PyCursesWindowObject *self, int group_left_1,
                           int y, int x, PyObject *str, int group_right_1,
                           long attr);

static PyObject *
_curses_window_insstr(PyCursesWindowObject *self, PyObject *args)
{
    PyObject *return_value = NULL;
    int group_left_1 = 0;
    int y = 0;
    int x = 0;
    PyObject *str;
    int group_right_1 = 0;
    long attr = 0;

    switch (PyTuple_GET_SIZE(args)) {
        case 1:
            if (!PyArg_ParseTuple(args, "O:insstr", &str)) {
                goto exit;
            }
            break;
        case 2:
            if (!PyArg_ParseTuple(args, "Ol:insstr", &str, &attr)) {
                goto exit;
            }
            group_right_1 = 1;
            break;
        case 3:
            if (!PyArg_ParseTuple(args, "iiO:insstr", &y, &x, &str)) {
                goto exit;
            }
            group_left_1 = 1;
            break;
        case 4:
            if (!PyArg_ParseTuple(args, "iiOl:insstr", &y, &x, &str, &attr)) {
                goto exit;
            }
            group_right_1 = 1;
            group_left_1 = 1;
            break;
        default:
            PyErr_SetString(PyExc_TypeError, "_curses.window.insstr requires 1 to 4 arguments");
            goto exit;
    }
    return_value = _curses_window_insstr_impl(self, group_left_1, y, x, str, group_right_1, attr);

exit:
    return return_value;
}

PyDoc_STRVAR(_curses_window_insnstr__doc__,
"insnstr([y, x,] str, n, [attr])\n"
"Insert at most n characters of the string.\n"
"\n"
"  y\n"
"    Y-coordinate.\n"
"  x\n"
"    X-coordinate.\n"
"  str\n"
"    String to insert.\n"
"  n\n"
"    Maximal number of characters.\n"
"  attr\n"
"    Attributes for characters.\n"
"\n"
"Insert a character string (as many characters as will fit on the line)\n"
"before the character under the cursor, up to n characters.  If n is zero\n"
"or negative, the entire string is inserted.  All characters to the right\n"
"of the cursor are shifted right, with the rightmost characters on the line\n"
"being lost.  The cursor position does not change (after moving to y, x, if\n"
"specified).");

#define _CURSES_WINDOW_INSNSTR_METHODDEF    \
    {"insnstr", (PyCFunction)_curses_window_insnstr, METH_VARARGS, _curses_window_insnstr__doc__},

static PyObject *
_curses_window_insnstr_impl(PyCursesWindowObject *self, int group_left_1,
                            int y, int x, PyObject *str, int n,
                            int group_right_1, long attr);

static PyObject *
_curses_window_insnstr(PyCursesWindowObject *self, PyObject *args)
{
    PyObject *return_value = NULL;
    int group_left_1 = 0;
    int y = 0;
    int x = 0;
    PyObject *str;
    int n;
    int group_right_1 = 0;
    long attr = 0;

    switch (PyTuple_GET_SIZE(args)) {
        case 2:
            if (!PyArg_ParseTuple(args, "Oi:insnstr", &str, &n)) {
                goto exit;
            }
            break;
        case 3:
            if (!PyArg_ParseTuple(args, "Oil:insnstr", &str, &n, &attr)) {
                goto exit;
            }
            group_right_1 = 1;
            break;
        case 4:
            if (!PyArg_ParseTuple(args, "iiOi:insnstr", &y, &x, &str, &n)) {
                goto exit;
            }
            group_left_1 = 1;
            break;
        case 5:
            if (!PyArg_ParseTuple(args, "iiOil:insnstr", &y, &x, &str, &n, &attr)) {
                goto exit;
            }
            group_right_1 = 1;
            group_left_1 = 1;
            break;
        default:
            PyErr_SetString(PyExc_TypeError, "_curses.window.insnstr requires 2 to 5 arguments");
            goto exit;
    }
    return_value = _curses_window_insnstr_impl(self, group_left_1, y, x, str, n, group_right_1, attr);

exit:
    return return_value;
}

PyDoc_STRVAR(_curses_window_is_linetouched__doc__,
"is_linetouched($self, line, /)\n"
"--\n"
"\n"
"Return True if the specified line was modified, otherwise return False.\n"
"\n"
"  line\n"
"    Line number.\n"
"\n"
"Raise a curses.error exception if line is not valid for the given window.");

#define _CURSES_WINDOW_IS_LINETOUCHED_METHODDEF    \
    {"is_linetouched", (PyCFunction)_curses_window_is_linetouched, METH_O, _curses_window_is_linetouched__doc__},

static PyObject *
_curses_window_is_linetouched_impl(PyCursesWindowObject *self, int line);

static PyObject *
_curses_window_is_linetouched(PyCursesWindowObject *self, PyObject *arg)
{
    PyObject *return_value = NULL;
    int line;

    line = _PyLong_AsInt(arg);
    if (line == -1 && PyErr_Occurred()) {
        goto exit;
    }
    return_value = _curses_window_is_linetouched_impl(self, line);

exit:
    return return_value;
}

#if defined(py_is_pad)

PyDoc_STRVAR(_curses_window_noutrefresh__doc__,
"noutrefresh([pminrow, pmincol, sminrow, smincol, smaxrow, smaxcol])\n"
"Mark for refresh but wait.\n"
"\n"
"This function updates the data structure representing the desired state of the\n"
"window, but does not force an update of the physical screen.  To accomplish\n"
"that, call doupdate().");

#define _CURSES_WINDOW_NOUTREFRESH_METHODDEF    \
    {"noutrefresh", (PyCFunction)_curses_window_noutrefresh, METH_VARARGS, _curses_window_noutrefresh__doc__},

static PyObject *
_curses_window_noutrefresh_impl(PyCursesWindowObject *self,
                                int group_right_1, int pminrow, int pmincol,
                                int sminrow, int smincol, int smaxrow,
                                int smaxcol);

static PyObject *
_curses_window_noutrefresh(PyCursesWindowObject *self, PyObject *args)
{
    PyObject *return_value = NULL;
    int group_right_1 = 0;
    int pminrow = 0;
    int pmincol = 0;
    int sminrow = 0;
    int smincol = 0;
    int smaxrow = 0;
    int smaxcol = 0;

    switch (PyTuple_GET_SIZE(args)) {
        case 0:
            break;
        case 6:
            if (!PyArg_ParseTuple(args, "iiiiii:noutrefresh", &pminrow, &pmincol, &sminrow, &smincol, &smaxrow, &smaxcol)) {
                goto exit;
            }
            group_right_1 = 1;
            break;
        default:
            PyErr_SetString(PyExc_TypeError, "_curses.window.noutrefresh requires 0 to 6 arguments");
            goto exit;
    }
    return_value = _curses_window_noutrefresh_impl(self, group_right_1, pminrow, pmincol, sminrow, smincol, smaxrow, smaxcol);

exit:
    return return_value;
}

#endif /* defined(py_is_pad) */

#if !defined(py_is_pad)

PyDoc_STRVAR(_curses_window_noutrefresh__doc__,
"noutrefresh($self, /)\n"
"--\n"
"\n"
"Mark for refresh but wait.\n"
"\n"
"This function updates the data structure representing the desired state of the\n"
"window, but does not force an update of the physical screen.  To accomplish\n"
"that, call doupdate().");

#define _CURSES_WINDOW_NOUTREFRESH_METHODDEF    \
    {"noutrefresh", (PyCFunction)_curses_window_noutrefresh, METH_NOARGS, _curses_window_noutrefresh__doc__},

static PyObject *
_curses_window_noutrefresh_impl(PyCursesWindowObject *self);

static PyObject *
_curses_window_noutrefresh(PyCursesWindowObject *self, PyObject *Py_UNUSED(ignored))
{
    return _curses_window_noutrefresh_impl(self);
}

#endif /* !defined(py_is_pad) */

PyDoc_STRVAR(_curses_window_overlay__doc__,
"overlay(destwin, [sminrow, smincol, dminrow, dmincol, dmaxrow, dmaxcol])\n"
"Overlay the window on top of destwin.\n"
"\n"
"The windows need not be the same size, only the overlapping region is copied.\n"
"This copy is non-destructive, which means that the current background\n"
"character does not overwrite the old contents of destwin.\n"
"\n"
"To get fine-grained control over the copied region, the second form of\n"
"overlay() can be used.  sminrow and smincol are the upper-left coordinates\n"
"of the source window, and the other variables mark a rectangle in the\n"
"destination window.");

#define _CURSES_WINDOW_OVERLAY_METHODDEF    \
    {"overlay", (PyCFunction)_curses_window_overlay, METH_VARARGS, _curses_window_overlay__doc__},

static PyObject *
_curses_window_overlay_impl(PyCursesWindowObject *self,
                            PyCursesWindowObject *destwin, int group_right_1,
                            int sminrow, int smincol, int dminrow,
                            int dmincol, int dmaxrow, int dmaxcol);

static PyObject *
_curses_window_overlay(PyCursesWindowObject *self, PyObject *args)
{
    PyObject *return_value = NULL;
    PyCursesWindowObject *destwin;
    int group_right_1 = 0;
    int sminrow = 0;
    int smincol = 0;
    int dminrow = 0;
    int dmincol = 0;
    int dmaxrow = 0;
    int dmaxcol = 0;

    switch (PyTuple_GET_SIZE(args)) {
        case 1:
            if (!PyArg_ParseTuple(args, "O!:overlay", &PyCursesWindow_Type, &destwin)) {
                goto exit;
            }
            break;
        case 7:
            if (!PyArg_ParseTuple(args, "O!iiiiii:overlay", &PyCursesWindow_Type, &destwin, &sminrow, &smincol, &dminrow, &dmincol, &dmaxrow, &dmaxcol)) {
                goto exit;
            }
            group_right_1 = 1;
            break;
        default:
            PyErr_SetString(PyExc_TypeError, "_curses.window.overlay requires 1 to 7 arguments");
            goto exit;
    }
    return_value = _curses_window_overlay_impl(self, destwin, group_right_1, sminrow, smincol, dminrow, dmincol, dmaxrow, dmaxcol);

exit:
    return return_value;
}

PyDoc_STRVAR(_curses_window_overwrite__doc__,
"overwrite(destwin, [sminrow, smincol, dminrow, dmincol, dmaxrow,\n"
"          dmaxcol])\n"
"Overwrite the window on top of destwin.\n"
"\n"
"The windows need not be the same size, in which case only the overlapping\n"
"region is copied.  This copy is destructive, which means that the current\n"
"background character overwrites the old contents of destwin.\n"
"\n"
"To get fine-grained control over the copied region, the second form of\n"
"overwrite() can be used. sminrow and smincol are the upper-left coordinates\n"
"of the source window, the other variables mark a rectangle in the destination\n"
"window.");

#define _CURSES_WINDOW_OVERWRITE_METHODDEF    \
    {"overwrite", (PyCFunction)_curses_window_overwrite, METH_VARARGS, _curses_window_overwrite__doc__},

static PyObject *
_curses_window_overwrite_impl(PyCursesWindowObject *self,
                              PyCursesWindowObject *destwin,
                              int group_right_1, int sminrow, int smincol,
                              int dminrow, int dmincol, int dmaxrow,
                              int dmaxcol);

static PyObject *
_curses_window_overwrite(PyCursesWindowObject *self, PyObject *args)
{
    PyObject *return_value = NULL;
    PyCursesWindowObject *destwin;
    int group_right_1 = 0;
    int sminrow = 0;
    int smincol = 0;
    int dminrow = 0;
    int dmincol = 0;
    int dmaxrow = 0;
    int dmaxcol = 0;

    switch (PyTuple_GET_SIZE(args)) {
        case 1:
            if (!PyArg_ParseTuple(args, "O!:overwrite", &PyCursesWindow_Type, &destwin)) {
                goto exit;
            }
            break;
        case 7:
            if (!PyArg_ParseTuple(args, "O!iiiiii:overwrite", &PyCursesWindow_Type, &destwin, &sminrow, &smincol, &dminrow, &dmincol, &dmaxrow, &dmaxcol)) {
                goto exit;
            }
            group_right_1 = 1;
            break;
        default:
            PyErr_SetString(PyExc_TypeError, "_curses.window.overwrite requires 1 to 7 arguments");
            goto exit;
    }
    return_value = _curses_window_overwrite_impl(self, destwin, group_right_1, sminrow, smincol, dminrow, dmincol, dmaxrow, dmaxcol);

exit:
    return return_value;
}

PyDoc_STRVAR(_curses_window_putwin__doc__,
"putwin($self, file, /)\n"
"--\n"
"\n"
"Write all data associated with the window into the provided file object.\n"
"\n"
"This information can be later retrieved using the getwin() function.");

#define _CURSES_WINDOW_PUTWIN_METHODDEF    \
    {"putwin", (PyCFunction)_curses_window_putwin, METH_O, _curses_window_putwin__doc__},

PyDoc_STRVAR(_curses_window_redrawln__doc__,
"redrawln($self, beg, num, /)\n"
"--\n"
"\n"
"Mark the specified lines corrupted.\n"
"\n"
"  beg\n"
"    Starting line number.\n"
"  num\n"
"    The number of lines.\n"
"\n"
"They should be completely redrawn on the next refresh() call.");

#define _CURSES_WINDOW_REDRAWLN_METHODDEF    \
    {"redrawln", _PyCFunction_CAST(_curses_window_redrawln), METH_FASTCALL, _curses_window_redrawln__doc__},

static PyObject *
_curses_window_redrawln_impl(PyCursesWindowObject *self, int beg, int num);

static PyObject *
_curses_window_redrawln(PyCursesWindowObject *self, PyObject *const *args, Py_ssize_t nargs)
{
    PyObject *return_value = NULL;
    int beg;
    int num;

    if (!_PyArg_CheckPositional("redrawln", nargs, 2, 2)) {
        goto exit;
    }
    beg = _PyLong_AsInt(args[0]);
    if (beg == -1 && PyErr_Occurred()) {
        goto exit;
    }
    num = _PyLong_AsInt(args[1]);
    if (num == -1 && PyErr_Occurred()) {
        goto exit;
    }
    return_value = _curses_window_redrawln_impl(self, beg, num);

exit:
    return return_value;
}

PyDoc_STRVAR(_curses_window_refresh__doc__,
"refresh([pminrow, pmincol, sminrow, smincol, smaxrow, smaxcol])\n"
"Update the display immediately.\n"
"\n"
"Synchronize actual screen with previous drawing/deleting methods.\n"
"The 6 optional arguments can only be specified when the window is a pad\n"
"created with newpad().  The additional parameters are needed to indicate\n"
"what part of the pad and screen are involved.  pminrow and pmincol specify\n"
"the upper left-hand corner of the rectangle to be displayed in the pad.\n"
"sminrow, smincol, smaxrow, and smaxcol specify the edges of the rectangle to\n"
"be displayed on the screen.  The lower right-hand corner of the rectangle to\n"
"be displayed in the pad is calculated from the screen coordinates, since the\n"
"rectangles must be the same size.  Both rectangles must be entirely contained\n"
"within their respective structures.  Negative values of pminrow, pmincol,\n"
"sminrow, or smincol are treated as if they were zero.");

#define _CURSES_WINDOW_REFRESH_METHODDEF    \
    {"refresh", (PyCFunction)_curses_window_refresh, METH_VARARGS, _curses_window_refresh__doc__},

static PyObject *
_curses_window_refresh_impl(PyCursesWindowObject *self, int group_right_1,
                            int pminrow, int pmincol, int sminrow,
                            int smincol, int smaxrow, int smaxcol);

static PyObject *
_curses_window_refresh(PyCursesWindowObject *self, PyObject *args)
{
    PyObject *return_value = NULL;
    int group_right_1 = 0;
    int pminrow = 0;
    int pmincol = 0;
    int sminrow = 0;
    int smincol = 0;
    int smaxrow = 0;
    int smaxcol = 0;

    switch (PyTuple_GET_SIZE(args)) {
        case 0:
            break;
        case 6:
            if (!PyArg_ParseTuple(args, "iiiiii:refresh", &pminrow, &pmincol, &sminrow, &smincol, &smaxrow, &smaxcol)) {
                goto exit;
            }
            group_right_1 = 1;
            break;
        default:
            PyErr_SetString(PyExc_TypeError, "_curses.window.refresh requires 0 to 6 arguments");
            goto exit;
    }
    return_value = _curses_window_refresh_impl(self, group_right_1, pminrow, pmincol, sminrow, smincol, smaxrow, smaxcol);

exit:
    return return_value;
}

PyDoc_STRVAR(_curses_window_setscrreg__doc__,
"setscrreg($self, top, bottom, /)\n"
"--\n"
"\n"
"Define a software scrolling region.\n"
"\n"
"  top\n"
"    First line number.\n"
"  bottom\n"
"    Last line number.\n"
"\n"
"All scrolling actions will take place in this region.");

#define _CURSES_WINDOW_SETSCRREG_METHODDEF    \
    {"setscrreg", _PyCFunction_CAST(_curses_window_setscrreg), METH_FASTCALL, _curses_window_setscrreg__doc__},

static PyObject *
_curses_window_setscrreg_impl(PyCursesWindowObject *self, int top,
                              int bottom);

static PyObject *
_curses_window_setscrreg(PyCursesWindowObject *self, PyObject *const *args, Py_ssize_t nargs)
{
    PyObject *return_value = NULL;
    int top;
    int bottom;

    if (!_PyArg_CheckPositional("setscrreg", nargs, 2, 2)) {
        goto exit;
    }
    top = _PyLong_AsInt(args[0]);
    if (top == -1 && PyErr_Occurred()) {
        goto exit;
    }
    bottom = _PyLong_AsInt(args[1]);
    if (bottom == -1 && PyErr_Occurred()) {
        goto exit;
    }
    return_value = _curses_window_setscrreg_impl(self, top, bottom);

exit:
    return return_value;
}

PyDoc_STRVAR(_curses_window_subwin__doc__,
"subwin([nlines=0, ncols=0,] begin_y, begin_x)\n"
"Create a sub-window (screen-relative coordinates).\n"
"\n"
"  nlines\n"
"    Height.\n"
"  ncols\n"
"    Width.\n"
"  begin_y\n"
"    Top side y-coordinate.\n"
"  begin_x\n"
"    Left side x-coordinate.\n"
"\n"
"By default, the sub-window will extend from the specified position to the\n"
"lower right corner of the window.");

#define _CURSES_WINDOW_SUBWIN_METHODDEF    \
    {"subwin", (PyCFunction)_curses_window_subwin, METH_VARARGS, _curses_window_subwin__doc__},

static PyObject *
_curses_window_subwin_impl(PyCursesWindowObject *self, int group_left_1,
                           int nlines, int ncols, int begin_y, int begin_x);

static PyObject *
_curses_window_subwin(PyCursesWindowObject *self, PyObject *args)
{
    PyObject *return_value = NULL;
    int group_left_1 = 0;
    int nlines = 0;
    int ncols = 0;
    int begin_y;
    int begin_x;

    switch (PyTuple_GET_SIZE(args)) {
        case 2:
            if (!PyArg_ParseTuple(args, "ii:subwin", &begin_y, &begin_x)) {
                goto exit;
            }
            break;
        case 4:
            if (!PyArg_ParseTuple(args, "iiii:subwin", &nlines, &ncols, &begin_y, &begin_x)) {
                goto exit;
            }
            group_left_1 = 1;
            break;
        default:
            PyErr_SetString(PyExc_TypeError, "_curses.window.subwin requires 2 to 4 arguments");
            goto exit;
    }
    return_value = _curses_window_subwin_impl(self, group_left_1, nlines, ncols, begin_y, begin_x);

exit:
    return return_value;
}

PyDoc_STRVAR(_curses_window_scroll__doc__,
"scroll([lines=1])\n"
"Scroll the screen or scrolling region.\n"
"\n"
"  lines\n"
"    Number of lines to scroll.\n"
"\n"
"Scroll upward if the argument is positive and downward if it is negative.");

#define _CURSES_WINDOW_SCROLL_METHODDEF    \
    {"scroll", (PyCFunction)_curses_window_scroll, METH_VARARGS, _curses_window_scroll__doc__},

static PyObject *
_curses_window_scroll_impl(PyCursesWindowObject *self, int group_right_1,
                           int lines);

static PyObject *
_curses_window_scroll(PyCursesWindowObject *self, PyObject *args)
{
    PyObject *return_value = NULL;
    int group_right_1 = 0;
    int lines = 1;

    switch (PyTuple_GET_SIZE(args)) {
        case 0:
            break;
        case 1:
            if (!PyArg_ParseTuple(args, "i:scroll", &lines)) {
                goto exit;
            }
            group_right_1 = 1;
            break;
        default:
            PyErr_SetString(PyExc_TypeError, "_curses.window.scroll requires 0 to 1 arguments");
            goto exit;
    }
    return_value = _curses_window_scroll_impl(self, group_right_1, lines);

exit:
    return return_value;
}

PyDoc_STRVAR(_curses_window_touchline__doc__,
"touchline(start, count, [changed=True])\n"
"Pretend count lines have been changed, starting with line start.\n"
"\n"
"If changed is supplied, it specifies whether the affected lines are marked\n"
"as having been changed (changed=True) or unchanged (changed=False).");

#define _CURSES_WINDOW_TOUCHLINE_METHODDEF    \
    {"touchline", (PyCFunction)_curses_window_touchline, METH_VARARGS, _curses_window_touchline__doc__},

static PyObject *
_curses_window_touchline_impl(PyCursesWindowObject *self, int start,
                              int count, int group_right_1, int changed);

static PyObject *
_curses_window_touchline(PyCursesWindowObject *self, PyObject *args)
{
    PyObject *return_value = NULL;
    int start;
    int count;
    int group_right_1 = 0;
    int changed = 1;

    switch (PyTuple_GET_SIZE(args)) {
        case 2:
            if (!PyArg_ParseTuple(args, "ii:touchline", &start, &count)) {
                goto exit;
            }
            break;
        case 3:
            if (!PyArg_ParseTuple(args, "iip:touchline", &start, &count, &changed)) {
                goto exit;
            }
            group_right_1 = 1;
            break;
        default:
            PyErr_SetString(PyExc_TypeError, "_curses.window.touchline requires 2 to 3 arguments");
            goto exit;
    }
    return_value = _curses_window_touchline_impl(self, start, count, group_right_1, changed);

exit:
    return return_value;
}

PyDoc_STRVAR(_curses_window_vline__doc__,
"vline([y, x,] ch, n, [attr=_curses.A_NORMAL])\n"
"Display a vertical line.\n"
"\n"
"  y\n"
"    Starting Y-coordinate.\n"
"  x\n"
"    Starting X-coordinate.\n"
"  ch\n"
"    Character to draw.\n"
"  n\n"
"    Line length.\n"
"  attr\n"
"    Attributes for the character.");

#define _CURSES_WINDOW_VLINE_METHODDEF    \
    {"vline", (PyCFunction)_curses_window_vline, METH_VARARGS, _curses_window_vline__doc__},

static PyObject *
_curses_window_vline_impl(PyCursesWindowObject *self, int group_left_1,
                          int y, int x, PyObject *ch, int n,
                          int group_right_1, long attr);

static PyObject *
_curses_window_vline(PyCursesWindowObject *self, PyObject *args)
{
    PyObject *return_value = NULL;
    int group_left_1 = 0;
    int y = 0;
    int x = 0;
    PyObject *ch;
    int n;
    int group_right_1 = 0;
    long attr = A_NORMAL;

    switch (PyTuple_GET_SIZE(args)) {
        case 2:
            if (!PyArg_ParseTuple(args, "Oi:vline", &ch, &n)) {
                goto exit;
            }
            break;
        case 3:
            if (!PyArg_ParseTuple(args, "Oil:vline", &ch, &n, &attr)) {
                goto exit;
            }
            group_right_1 = 1;
            break;
        case 4:
            if (!PyArg_ParseTuple(args, "iiOi:vline", &y, &x, &ch, &n)) {
                goto exit;
            }
            group_left_1 = 1;
            break;
        case 5:
            if (!PyArg_ParseTuple(args, "iiOil:vline", &y, &x, &ch, &n, &attr)) {
                goto exit;
            }
            group_right_1 = 1;
            group_left_1 = 1;
            break;
        default:
            PyErr_SetString(PyExc_TypeError, "_curses.window.vline requires 2 to 5 arguments");
            goto exit;
    }
    return_value = _curses_window_vline_impl(self, group_left_1, y, x, ch, n, group_right_1, attr);

exit:
    return return_value;
}

#if defined(HAVE_CURSES_FILTER)

PyDoc_STRVAR(_curses_filter__doc__,
"filter($module, /)\n"
"--\n"
"\n");

#define _CURSES_FILTER_METHODDEF    \
    {"filter", (PyCFunction)_curses_filter, METH_NOARGS, _curses_filter__doc__},

static PyObject *
_curses_filter_impl(PyObject *module);

static PyObject *
_curses_filter(PyObject *module, PyObject *Py_UNUSED(ignored))
{
    return _curses_filter_impl(module);
}

#endif /* defined(HAVE_CURSES_FILTER) */

PyDoc_STRVAR(_curses_baudrate__doc__,
"baudrate($module, /)\n"
"--\n"
"\n"
"Return the output speed of the terminal in bits per second.");

#define _CURSES_BAUDRATE_METHODDEF    \
    {"baudrate", (PyCFunction)_curses_baudrate, METH_NOARGS, _curses_baudrate__doc__},

static PyObject *
_curses_baudrate_impl(PyObject *module);

static PyObject *
_curses_baudrate(PyObject *module, PyObject *Py_UNUSED(ignored))
{
    return _curses_baudrate_impl(module);
}

PyDoc_STRVAR(_curses_beep__doc__,
"beep($module, /)\n"
"--\n"
"\n"
"Emit a short attention sound.");

#define _CURSES_BEEP_METHODDEF    \
    {"beep", (PyCFunction)_curses_beep, METH_NOARGS, _curses_beep__doc__},

static PyObject *
_curses_beep_impl(PyObject *module);

static PyObject *
_curses_beep(PyObject *module, PyObject *Py_UNUSED(ignored))
{
    return _curses_beep_impl(module);
}

PyDoc_STRVAR(_curses_can_change_color__doc__,
"can_change_color($module, /)\n"
"--\n"
"\n"
"Return True if the programmer can change the colors displayed by the terminal.");

#define _CURSES_CAN_CHANGE_COLOR_METHODDEF    \
    {"can_change_color", (PyCFunction)_curses_can_change_color, METH_NOARGS, _curses_can_change_color__doc__},

static PyObject *
_curses_can_change_color_impl(PyObject *module);

static PyObject *
_curses_can_change_color(PyObject *module, PyObject *Py_UNUSED(ignored))
{
    return _curses_can_change_color_impl(module);
}

PyDoc_STRVAR(_curses_cbreak__doc__,
"cbreak($module, flag=True, /)\n"
"--\n"
"\n"
"Enter cbreak mode.\n"
"\n"
"  flag\n"
"    If false, the effect is the same as calling nocbreak().\n"
"\n"
"In cbreak mode (sometimes called \"rare\" mode) normal tty line buffering is\n"
"turned off and characters are available to be read one by one.  However,\n"
"unlike raw mode, special characters (interrupt, quit, suspend, and flow\n"
"control) retain their effects on the tty driver and calling program.\n"
"Calling first raw() then cbreak() leaves the terminal in cbreak mode.");

#define _CURSES_CBREAK_METHODDEF    \
    {"cbreak", _PyCFunction_CAST(_curses_cbreak), METH_FASTCALL, _curses_cbreak__doc__},

static PyObject *
_curses_cbreak_impl(PyObject *module, int flag);

static PyObject *
_curses_cbreak(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
{
    PyObject *return_value = NULL;
    int flag = 1;

    if (!_PyArg_CheckPositional("cbreak", nargs, 0, 1)) {
        goto exit;
    }
    if (nargs < 1) {
        goto skip_optional;
    }
    flag = PyObject_IsTrue(args[0]);
    if (flag < 0) {
        goto exit;
    }
skip_optional:
    return_value = _curses_cbreak_impl(module, flag);

exit:
    return return_value;
}

PyDoc_STRVAR(_curses_color_content__doc__,
"color_content($module, color_number, /)\n"
"--\n"
"\n"
"Return the red, green, and blue (RGB) components of the specified color.\n"
"\n"
"  color_number\n"
"    The number of the color (0 - (COLORS-1)).\n"
"\n"
"A 3-tuple is returned, containing the R, G, B values for the given color,\n"
"which will be between 0 (no component) and 1000 (maximum amount of component).");

#define _CURSES_COLOR_CONTENT_METHODDEF    \
    {"color_content", (PyCFunction)_curses_color_content, METH_O, _curses_color_content__doc__},

static PyObject *
_curses_color_content_impl(PyObject *module, int color_number);

static PyObject *
_curses_color_content(PyObject *module, PyObject *arg)
{
    PyObject *return_value = NULL;
    int color_number;

    if (!color_converter(arg, &color_number)) {
        goto exit;
    }
    return_value = _curses_color_content_impl(module, color_number);

exit:
    return return_value;
}

PyDoc_STRVAR(_curses_color_pair__doc__,
"color_pair($module, pair_number, /)\n"
"--\n"
"\n"
"Return the attribute value for displaying text in the specified color.\n"
"\n"
"  pair_number\n"
"    The number of the color pair.\n"
"\n"
"This attribute value can be combined with A_STANDOUT, A_REVERSE, and the\n"
"other A_* attributes.  pair_number() is the counterpart to this function.");

#define _CURSES_COLOR_PAIR_METHODDEF    \
    {"color_pair", (PyCFunction)_curses_color_pair, METH_O, _curses_color_pair__doc__},

static PyObject *
_curses_color_pair_impl(PyObject *module, int pair_number);

static PyObject *
_curses_color_pair(PyObject *module, PyObject *arg)
{
    PyObject *return_value = NULL;
    int pair_number;

    pair_number = _PyLong_AsInt(arg);
    if (pair_number == -1 && PyErr_Occurred()) {
        goto exit;
    }
    return_value = _curses_color_pair_impl(module, pair_number);

exit:
    return return_value;
}

PyDoc_STRVAR(_curses_curs_set__doc__,
"curs_set($module, visibility, /)\n"
"--\n"
"\n"
"Set the cursor state.\n"
"\n"
"  visibility\n"
"    0 for invisible, 1 for normal visible, or 2 for very visible.\n"
"\n"
"If the terminal supports the visibility requested, the previous cursor\n"
"state is returned; otherwise, an exception is raised.  On many terminals,\n"
"the \"visible\" mode is an underline cursor and the \"very visible\" mode is\n"
"a block cursor.");

#define _CURSES_CURS_SET_METHODDEF    \
    {"curs_set", (PyCFunction)_curses_curs_set, METH_O, _curses_curs_set__doc__},

static PyObject *
_curses_curs_set_impl(PyObject *module, int visibility);

static PyObject *
_curses_curs_set(PyObject *module, PyObject *arg)
{
    PyObject *return_value = NULL;
    int visibility;

    visibility = _PyLong_AsInt(arg);
    if (visibility == -1 && PyErr_Occurred()) {
        goto exit;
    }
    return_value = _curses_curs_set_impl(module, visibility);

exit:
    return return_value;
}

PyDoc_STRVAR(_curses_def_prog_mode__doc__,
"def_prog_mode($module, /)\n"
"--\n"
"\n"
"Save the current terminal mode as the \"program\" mode.\n"
"\n"
"The \"program\" mode is the mode when the running program is using curses.\n"
"\n"
"Subsequent calls to reset_prog_mode() will restore this mode.");

#define _CURSES_DEF_PROG_MODE_METHODDEF    \
    {"def_prog_mode", (PyCFunction)_curses_def_prog_mode, METH_NOARGS, _curses_def_prog_mode__doc__},

static PyObject *
_curses_def_prog_mode_impl(PyObject *module);

static PyObject *
_curses_def_prog_mode(PyObject *module, PyObject *Py_UNUSED(ignored))
{
    return _curses_def_prog_mode_impl(module);
}

PyDoc_STRVAR(_curses_def_shell_mode__doc__,
"def_shell_mode($module, /)\n"
"--\n"
"\n"
"Save the current terminal mode as the \"shell\" mode.\n"
"\n"
"The \"shell\" mode is the mode when the running program is not using curses.\n"
"\n"
"Subsequent calls to reset_shell_mode() will restore this mode.");

#define _CURSES_DEF_SHELL_MODE_METHODDEF    \
    {"def_shell_mode", (PyCFunction)_curses_def_shell_mode, METH_NOARGS, _curses_def_shell_mode__doc__},

static PyObject *
_curses_def_shell_mode_impl(PyObject *module);

static PyObject *
_curses_def_shell_mode(PyObject *module, PyObject *Py_UNUSED(ignored))
{
    return _curses_def_shell_mode_impl(module);
}

PyDoc_STRVAR(_curses_delay_output__doc__,
"delay_output($module, ms, /)\n"
"--\n"
"\n"
"Insert a pause in output.\n"
"\n"
"  ms\n"
"    Duration in milliseconds.");

#define _CURSES_DELAY_OUTPUT_METHODDEF    \
    {"delay_output", (PyCFunction)_curses_delay_output, METH_O, _curses_delay_output__doc__},

static PyObject *
_curses_delay_output_impl(PyObject *module, int ms);

static PyObject *
_curses_delay_output(PyObject *module, PyObject *arg)
{
    PyObject *return_value = NULL;
    int ms;

    ms = _PyLong_AsInt(arg);
    if (ms == -1 && PyErr_Occurred()) {
        goto exit;
    }
    return_value = _curses_delay_output_impl(module, ms);

exit:
    return return_value;
}

PyDoc_STRVAR(_curses_doupdate__doc__,
"doupdate($module, /)\n"
"--\n"
"\n"
"Update the physical screen to match the virtual screen.");

#define _CURSES_DOUPDATE_METHODDEF    \
    {"doupdate", (PyCFunction)_curses_doupdate, METH_NOARGS, _curses_doupdate__doc__},

static PyObject *
_curses_doupdate_impl(PyObject *module);

static PyObject *
_curses_doupdate(PyObject *module, PyObject *Py_UNUSED(ignored))
{
    return _curses_doupdate_impl(module);
}

PyDoc_STRVAR(_curses_echo__doc__,
"echo($module, flag=True, /)\n"
"--\n"
"\n"
"Enter echo mode.\n"
"\n"
"  flag\n"
"    If false, the effect is the same as calling noecho().\n"
"\n"
"In echo mode, each character input is echoed to the screen as it is entered.");

#define _CURSES_ECHO_METHODDEF    \
    {"echo", _PyCFunction_CAST(_curses_echo), METH_FASTCALL, _curses_echo__doc__},

static PyObject *
_curses_echo_impl(PyObject *module, int flag);

static PyObject *
_curses_echo(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
{
    PyObject *return_value = NULL;
    int flag = 1;

    if (!_PyArg_CheckPositional("echo", nargs, 0, 1)) {
        goto exit;
    }
    if (nargs < 1) {
        goto skip_optional;
    }
    flag = PyObject_IsTrue(args[0]);
    if (flag < 0) {
        goto exit;
    }
skip_optional:
    return_value = _curses_echo_impl(module, flag);

exit:
    return return_value;
}

PyDoc_STRVAR(_curses_endwin__doc__,
"endwin($module, /)\n"
"--\n"
"\n"
"De-initialize the library, and return terminal to normal status.");

#define _CURSES_ENDWIN_METHODDEF    \
    {"endwin", (PyCFunction)_curses_endwin, METH_NOARGS, _curses_endwin__doc__},

static PyObject *
_curses_endwin_impl(PyObject *module);

static PyObject *
_curses_endwin(PyObject *module, PyObject *Py_UNUSED(ignored))
{
    return _curses_endwin_impl(module);
}

PyDoc_STRVAR(_curses_erasechar__doc__,
"erasechar($module, /)\n"
"--\n"
"\n"
"Return the user\'s current erase character.");

#define _CURSES_ERASECHAR_METHODDEF    \
    {"erasechar", (PyCFunction)_curses_erasechar, METH_NOARGS, _curses_erasechar__doc__},

static PyObject *
_curses_erasechar_impl(PyObject *module);

static PyObject *
_curses_erasechar(PyObject *module, PyObject *Py_UNUSED(ignored))
{
    return _curses_erasechar_impl(module);
}

PyDoc_STRVAR(_curses_flash__doc__,
"flash($module, /)\n"
"--\n"
"\n"
"Flash the screen.\n"
"\n"
"That is, change it to reverse-video and then change it back in a short interval.");

#define _CURSES_FLASH_METHODDEF    \
    {"flash", (PyCFunction)_curses_flash, METH_NOARGS, _curses_flash__doc__},

static PyObject *
_curses_flash_impl(PyObject *module);

static PyObject *
_curses_flash(PyObject *module, PyObject *Py_UNUSED(ignored))
{
    return _curses_flash_impl(module);
}

PyDoc_STRVAR(_curses_flushinp__doc__,
"flushinp($module, /)\n"
"--\n"
"\n"
"Flush all input buffers.\n"
"\n"
"This throws away any typeahead that has been typed by the user and has not\n"
"yet been processed by the program.");

#define _CURSES_FLUSHINP_METHODDEF    \
    {"flushinp", (PyCFunction)_curses_flushinp, METH_NOARGS, _curses_flushinp__doc__},

static PyObject *
_curses_flushinp_impl(PyObject *module);

static PyObject *
_curses_flushinp(PyObject *module, PyObject *Py_UNUSED(ignored))
{
    return _curses_flushinp_impl(module);
}

#if defined(getsyx)

PyDoc_STRVAR(_curses_getsyx__doc__,
"getsyx($module, /)\n"
"--\n"
"\n"
"Return the current coordinates of the virtual screen cursor.\n"
"\n"
"Return a (y, x) tuple.  If leaveok is currently true, return (-1, -1).");

#define _CURSES_GETSYX_METHODDEF    \
    {"getsyx", (PyCFunction)_curses_getsyx, METH_NOARGS, _curses_getsyx__doc__},

static PyObject *
_curses_getsyx_impl(PyObject *module);

static PyObject *
_curses_getsyx(PyObject *module, PyObject *Py_UNUSED(ignored))
{
    return _curses_getsyx_impl(module);
}

#endif /* defined(getsyx) */

#if defined(NCURSES_MOUSE_VERSION)

PyDoc_STRVAR(_curses_getmouse__doc__,
"getmouse($module, /)\n"
"--\n"
"\n"
"Retrieve the queued mouse event.\n"
"\n"
"After getch() returns KEY_MOUSE to signal a mouse event, this function\n"
"returns a 5-tuple (id, x, y, z, bstate).");

#define _CURSES_GETMOUSE_METHODDEF    \
    {"getmouse", (PyCFunction)_curses_getmouse, METH_NOARGS, _curses_getmouse__doc__},

static PyObject *
_curses_getmouse_impl(PyObject *module);

static PyObject *
_curses_getmouse(PyObject *module, PyObject *Py_UNUSED(ignored))
{
    return _curses_getmouse_impl(module);
}

#endif /* defined(NCURSES_MOUSE_VERSION) */

#if defined(NCURSES_MOUSE_VERSION)

PyDoc_STRVAR(_curses_ungetmouse__doc__,
"ungetmouse($module, id, x, y, z, bstate, /)\n"
"--\n"
"\n"
"Push a KEY_MOUSE event onto the input queue.\n"
"\n"
"The following getmouse() will return the given state data.");

#define _CURSES_UNGETMOUSE_METHODDEF    \
    {"ungetmouse", _PyCFunction_CAST(_curses_ungetmouse), METH_FASTCALL, _curses_ungetmouse__doc__},

static PyObject *
_curses_ungetmouse_impl(PyObject *module, short id, int x, int y, int z,
                        unsigned long bstate);

static PyObject *
_curses_ungetmouse(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
{
    PyObject *return_value = NULL;
    short id;
    int x;
    int y;
    int z;
    unsigned long bstate;

    if (!_PyArg_CheckPositional("ungetmouse", nargs, 5, 5)) {
        goto exit;
    }
    {
        long ival = PyLong_AsLong(args[0]);
        if (ival == -1 && PyErr_Occurred()) {
            goto exit;
        }
        else if (ival < SHRT_MIN) {
            PyErr_SetString(PyExc_OverflowError,
                            "signed short integer is less than minimum");
            goto exit;
        }
        else if (ival > SHRT_MAX) {
            PyErr_SetString(PyExc_OverflowError,
                            "signed short integer is greater than maximum");
            goto exit;
        }
        else {
            id = (short) ival;
        }
    }
    x = _PyLong_AsInt(args[1]);
    if (x == -1 && PyErr_Occurred()) {
        goto exit;
    }
    y = _PyLong_AsInt(args[2]);
    if (y == -1 && PyErr_Occurred()) {
        goto exit;
    }
    z = _PyLong_AsInt(args[3]);
    if (z == -1 && PyErr_Occurred()) {
        goto exit;
    }
    if (!PyLong_Check(args[4])) {
        _PyArg_BadArgument("ungetmouse", "argument 5", "int", args[4]);
        goto exit;
    }
    bstate = PyLong_AsUnsignedLongMask(args[4]);
    return_value = _curses_ungetmouse_impl(module, id, x, y, z, bstate);

exit:
    return return_value;
}

#endif /* defined(NCURSES_MOUSE_VERSION) */

PyDoc_STRVAR(_curses_getwin__doc__,
"getwin($module, file, /)\n"
"--\n"
"\n"
"Read window related data stored in the file by an earlier putwin() call.\n"
"\n"
"The routine then creates and initializes a new window using that data,\n"
"returning the new window object.");

#define _CURSES_GETWIN_METHODDEF    \
    {"getwin", (PyCFunction)_curses_getwin, METH_O, _curses_getwin__doc__},

PyDoc_STRVAR(_curses_halfdelay__doc__,
"halfdelay($module, tenths, /)\n"
"--\n"
"\n"
"Enter half-delay mode.\n"
"\n"
"  tenths\n"
"    Maximal blocking delay in tenths of seconds (1 - 255).\n"
"\n"
"Use nocbreak() to leave half-delay mode.");

#define _CURSES_HALFDELAY_METHODDEF    \
    {"halfdelay", (PyCFunction)_curses_halfdelay, METH_O, _curses_halfdelay__doc__},

static PyObject *
_curses_halfdelay_impl(PyObject *module, unsigned char tenths);

static PyObject *
_curses_halfdelay(PyObject *module, PyObject *arg)
{
    PyObject *return_value = NULL;
    unsigned char tenths;

    {
        long ival = PyLong_AsLong(arg);
        if (ival == -1 && PyErr_Occurred()) {
            goto exit;
        }
        else if (ival < 0) {
            PyErr_SetString(PyExc_OverflowError,
                            "unsigned byte integer is less than minimum");
            goto exit;
        }
        else if (ival > UCHAR_MAX) {
            PyErr_SetString(PyExc_OverflowError,
                            "unsigned byte integer is greater than maximum");
            goto exit;
        }
        else {
            tenths = (unsigned char) ival;
        }
    }
    return_value = _curses_halfdelay_impl(module, tenths);

exit:
    return return_value;
}

PyDoc_STRVAR(_curses_has_colors__doc__,
"has_colors($module, /)\n"
"--\n"
"\n"
"Return True if the terminal can display colors; otherwise, return False.");

#define _CURSES_HAS_COLORS_METHODDEF    \
    {"has_colors", (PyCFunction)_curses_has_colors, METH_NOARGS, _curses_has_colors__doc__},

static PyObject *
_curses_has_colors_impl(PyObject *module);

static PyObject *
_curses_has_colors(PyObject *module, PyObject *Py_UNUSED(ignored))
{
    return _curses_has_colors_impl(module);
}

PyDoc_STRVAR(_curses_has_ic__doc__,
"has_ic($module, /)\n"
"--\n"
"\n"
"Return True if the terminal has insert- and delete-character capabilities.");

#define _CURSES_HAS_IC_METHODDEF    \
    {"has_ic", (PyCFunction)_curses_has_ic, METH_NOARGS, _curses_has_ic__doc__},

static PyObject *
_curses_has_ic_impl(PyObject *module);

static PyObject *
_curses_has_ic(PyObject *module, PyObject *Py_UNUSED(ignored))
{
    return _curses_has_ic_impl(module);
}

PyDoc_STRVAR(_curses_has_il__doc__,
"has_il($module, /)\n"
"--\n"
"\n"
"Return True if the terminal has insert- and delete-line capabilities.");

#define _CURSES_HAS_IL_METHODDEF    \
    {"has_il", (PyCFunction)_curses_has_il, METH_NOARGS, _curses_has_il__doc__},

static PyObject *
_curses_has_il_impl(PyObject *module);

static PyObject *
_curses_has_il(PyObject *module, PyObject *Py_UNUSED(ignored))
{
    return _curses_has_il_impl(module);
}

#if defined(HAVE_CURSES_HAS_KEY)

PyDoc_STRVAR(_curses_has_key__doc__,
"has_key($module, key, /)\n"
"--\n"
"\n"
"Return True if the current terminal type recognizes a key with that value.\n"
"\n"
"  key\n"
"    Key number.");

#define _CURSES_HAS_KEY_METHODDEF    \
    {"has_key", (PyCFunction)_curses_has_key, METH_O, _curses_has_key__doc__},

static PyObject *
_curses_has_key_impl(PyObject *module, int key);

static PyObject *
_curses_has_key(PyObject *module, PyObject *arg)
{
    PyObject *return_value = NULL;
    int key;

    key = _PyLong_AsInt(arg);
    if (key == -1 && PyErr_Occurred()) {
        goto exit;
    }
    return_value = _curses_has_key_impl(module, key);

exit:
    return return_value;
}

#endif /* defined(HAVE_CURSES_HAS_KEY) */

PyDoc_STRVAR(_curses_init_color__doc__,
"init_color($module, color_number, r, g, b, /)\n"
"--\n"
"\n"
"Change the definition of a color.\n"
"\n"
"  color_number\n"
"    The number of the color to be changed (0 - (COLORS-1)).\n"
"  r\n"
"    Red component (0 - 1000).\n"
"  g\n"
"    Green component (0 - 1000).\n"
"  b\n"
"    Blue component (0 - 1000).\n"
"\n"
"When init_color() is used, all occurrences of that color on the screen\n"
"immediately change to the new definition.  This function is a no-op on\n"
"most terminals; it is active only if can_change_color() returns true.");

#define _CURSES_INIT_COLOR_METHODDEF    \
    {"init_color", _PyCFunction_CAST(_curses_init_color), METH_FASTCALL, _curses_init_color__doc__},

static PyObject *
_curses_init_color_impl(PyObject *module, int color_number, short r, short g,
                        short b);

static PyObject *
_curses_init_color(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
{
    PyObject *return_value = NULL;
    int color_number;
    short r;
    short g;
    short b;

    if (!_PyArg_CheckPositional("init_color", nargs, 4, 4)) {
        goto exit;
    }
    if (!color_converter(args[0], &color_number)) {
        goto exit;
    }
    if (!component_converter(args[1], &r)) {
        goto exit;
    }
    if (!component_converter(args[2], &g)) {
        goto exit;
    }
    if (!component_converter(args[3], &b)) {
        goto exit;
    }
    return_value = _curses_init_color_impl(module, color_number, r, g, b);

exit:
    return return_value;
}

PyDoc_STRVAR(_curses_init_pair__doc__,
"init_pair($module, pair_number, fg, bg, /)\n"
"--\n"
"\n"
"Change the definition of a color-pair.\n"
"\n"
"  pair_number\n"
"    The number of the color-pair to be changed (1 - (COLOR_PAIRS-1)).\n"
"  fg\n"
"    Foreground color number (-1 - (COLORS-1)).\n"
"  bg\n"
"    Background color number (-1 - (COLORS-1)).\n"
"\n"
"If the color-pair was previously initialized, the screen is refreshed and\n"
"all occurrences of that color-pair are changed to the new definition.");

#define _CURSES_INIT_PAIR_METHODDEF    \
    {"init_pair", _PyCFunction_CAST(_curses_init_pair), METH_FASTCALL, _curses_init_pair__doc__},

static PyObject *
_curses_init_pair_impl(PyObject *module, int pair_number, int fg, int bg);

static PyObject *
_curses_init_pair(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
{
    PyObject *return_value = NULL;
    int pair_number;
    int fg;
    int bg;

    if (!_PyArg_CheckPositional("init_pair", nargs, 3, 3)) {
        goto exit;
    }
    if (!pair_converter(args[0], &pair_number)) {
        goto exit;
    }
    if (!color_allow_default_converter(args[1], &fg)) {
        goto exit;
    }
    if (!color_allow_default_converter(args[2], &bg)) {
        goto exit;
    }
    return_value = _curses_init_pair_impl(module, pair_number, fg, bg);

exit:
    return return_value;
}

PyDoc_STRVAR(_curses_initscr__doc__,
"initscr($module, /)\n"
"--\n"
"\n"
"Initialize the library.\n"
"\n"
"Return a WindowObject which represents the whole screen.");

#define _CURSES_INITSCR_METHODDEF    \
    {"initscr", (PyCFunction)_curses_initscr, METH_NOARGS, _curses_initscr__doc__},

static PyObject *
_curses_initscr_impl(PyObject *module);

static PyObject *
_curses_initscr(PyObject *module, PyObject *Py_UNUSED(ignored))
{
    return _curses_initscr_impl(module);
}

PyDoc_STRVAR(_curses_setupterm__doc__,
"setupterm($module, /, term=None, fd=-1)\n"
"--\n"
"\n"
"Initialize the terminal.\n"
"\n"
"  term\n"
"    Terminal name.\n"
"    If omitted, the value of the TERM environment variable will be used.\n"
"  fd\n"
"    File descriptor to which any initialization sequences will be sent.\n"
"    If not supplied, the file descriptor for sys.stdout will be used.");

#define _CURSES_SETUPTERM_METHODDEF    \
    {"setupterm", _PyCFunction_CAST(_curses_setupterm), METH_FASTCALL|METH_KEYWORDS, _curses_setupterm__doc__},

static PyObject *
_curses_setupterm_impl(PyObject *module, const char *term, int fd);

static PyObject *
_curses_setupterm(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
{
    PyObject *return_value = NULL;
    #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)

    #define NUM_KEYWORDS 2
    static struct {
        PyGC_Head _this_is_not_used;
        PyObject_VAR_HEAD
        PyObject *ob_item[NUM_KEYWORDS];
    } _kwtuple = {
        .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS)
        .ob_item = { &_Py_ID(term), &_Py_ID(fd), },
    };
    #undef NUM_KEYWORDS
    #define KWTUPLE (&_kwtuple.ob_base.ob_base)

    #else  // !Py_BUILD_CORE
    #  define KWTUPLE NULL
    #endif  // !Py_BUILD_CORE

    static const char * const _keywords[] = {"term", "fd", NULL};
    static _PyArg_Parser _parser = {
        .keywords = _keywords,
        .fname = "setupterm",
        .kwtuple = KWTUPLE,
    };
    #undef KWTUPLE
    PyObject *argsbuf[2];
    Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 0;
    const char *term = NULL;
    int fd = -1;

    args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 0, 2, 0, argsbuf);
    if (!args) {
        goto exit;
    }
    if (!noptargs) {
        goto skip_optional_pos;
    }
    if (args[0]) {
        if (args[0] == Py_None) {
            term = NULL;
        }
        else if (PyUnicode_Check(args[0])) {
            Py_ssize_t term_length;
            term = PyUnicode_AsUTF8AndSize(args[0], &term_length);
            if (term == NULL) {
                goto exit;
            }
            if (strlen(term) != (size_t)term_length) {
                PyErr_SetString(PyExc_ValueError, "embedded null character");
                goto exit;
            }
        }
        else {
            _PyArg_BadArgument("setupterm", "argument 'term'", "str or None", args[0]);
            goto exit;
        }
        if (!--noptargs) {
            goto skip_optional_pos;
        }
    }
    fd = _PyLong_AsInt(args[1]);
    if (fd == -1 && PyErr_Occurred()) {
        goto exit;
    }
skip_optional_pos:
    return_value = _curses_setupterm_impl(module, term, fd);

exit:
    return return_value;
}

#if (defined(NCURSES_EXT_FUNCS) && NCURSES_EXT_FUNCS >= 20081102)

PyDoc_STRVAR(_curses_get_escdelay__doc__,
"get_escdelay($module, /)\n"
"--\n"
"\n"
"Gets the curses ESCDELAY setting.\n"
"\n"
"Gets the number of milliseconds to wait after reading an escape character,\n"
"to distinguish between an individual escape character entered on the\n"
"keyboard from escape sequences sent by cursor and function keys.");

#define _CURSES_GET_ESCDELAY_METHODDEF    \
    {"get_escdelay", (PyCFunction)_curses_get_escdelay, METH_NOARGS, _curses_get_escdelay__doc__},

static PyObject *
_curses_get_escdelay_impl(PyObject *module);

static PyObject *
_curses_get_escdelay(PyObject *module, PyObject *Py_UNUSED(ignored))
{
    return _curses_get_escdelay_impl(module);
}

#endif /* (defined(NCURSES_EXT_FUNCS) && NCURSES_EXT_FUNCS >= 20081102) */

#if (defined(NCURSES_EXT_FUNCS) && NCURSES_EXT_FUNCS >= 20081102)

PyDoc_STRVAR(_curses_set_escdelay__doc__,
"set_escdelay($module, ms, /)\n"
"--\n"
"\n"
"Sets the curses ESCDELAY setting.\n"
"\n"
"  ms\n"
"    length of the delay in milliseconds.\n"
"\n"
"Sets the number of milliseconds to wait after reading an escape character,\n"
"to distinguish between an individual escape character entered on the\n"
"keyboard from escape sequences sent by cursor and function keys.");

#define _CURSES_SET_ESCDELAY_METHODDEF    \
    {"set_escdelay", (PyCFunction)_curses_set_escdelay, METH_O, _curses_set_escdelay__doc__},

static PyObject *
_curses_set_escdelay_impl(PyObject *module, int ms);

static PyObject *
_curses_set_escdelay(PyObject *module, PyObject *arg)
{
    PyObject *return_value = NULL;
    int ms;

    ms = _PyLong_AsInt(arg);
    if (ms == -1 && PyErr_Occurred()) {
        goto exit;
    }
    return_value = _curses_set_escdelay_impl(module, ms);

exit:
    return return_value;
}

#endif /* (defined(NCURSES_EXT_FUNCS) && NCURSES_EXT_FUNCS >= 20081102) */

#if (defined(NCURSES_EXT_FUNCS) && NCURSES_EXT_FUNCS >= 20081102)

PyDoc_STRVAR(_curses_get_tabsize__doc__,
"get_tabsize($module, /)\n"
"--\n"
"\n"
"Gets the curses TABSIZE setting.\n"
"\n"
"Gets the number of columns used by the curses library when converting a tab\n"
"character to spaces as it adds the tab to a window.");

#define _CURSES_GET_TABSIZE_METHODDEF    \
    {"get_tabsize", (PyCFunction)_curses_get_tabsize, METH_NOARGS, _curses_get_tabsize__doc__},

static PyObject *
_curses_get_tabsize_impl(PyObject *module);

static PyObject *
_curses_get_tabsize(PyObject *module, PyObject *Py_UNUSED(ignored))
{
    return _curses_get_tabsize_impl(module);
}

#endif /* (defined(NCURSES_EXT_FUNCS) && NCURSES_EXT_FUNCS >= 20081102) */

#if (defined(NCURSES_EXT_FUNCS) && NCURSES_EXT_FUNCS >= 20081102)

PyDoc_STRVAR(_curses_set_tabsize__doc__,
"set_tabsize($module, size, /)\n"
"--\n"
"\n"
"Sets the curses TABSIZE setting.\n"
"\n"
"  size\n"
"    rendered cell width of a tab character.\n"
"\n"
"Sets the number of columns used by the curses library when converting a tab\n"
"character to spaces as it adds the tab to a window.");

#define _CURSES_SET_TABSIZE_METHODDEF    \
    {"set_tabsize", (PyCFunction)_curses_set_tabsize, METH_O, _curses_set_tabsize__doc__},

static PyObject *
_curses_set_tabsize_impl(PyObject *module, int size);

static PyObject *
_curses_set_tabsize(PyObject *module, PyObject *arg)
{
    PyObject *return_value = NULL;
    int size;

    size = _PyLong_AsInt(arg);
    if (size == -1 && PyErr_Occurred()) {
        goto exit;
    }
    return_value = _curses_set_tabsize_impl(module, size);

exit:
    return return_value;
}

#endif /* (defined(NCURSES_EXT_FUNCS) && NCURSES_EXT_FUNCS >= 20081102) */

PyDoc_STRVAR(_curses_intrflush__doc__,
"intrflush($module, flag, /)\n"
"--\n"
"\n");

#define _CURSES_INTRFLUSH_METHODDEF    \
    {"intrflush", (PyCFunction)_curses_intrflush, METH_O, _curses_intrflush__doc__},

static PyObject *
_curses_intrflush_impl(PyObject *module, int flag);

static PyObject *
_curses_intrflush(PyObject *module, PyObject *arg)
{
    PyObject *return_value = NULL;
    int flag;

    flag = PyObject_IsTrue(arg);
    if (flag < 0) {
        goto exit;
    }
    return_value = _curses_intrflush_impl(module, flag);

exit:
    return return_value;
}

PyDoc_STRVAR(_curses_isendwin__doc__,
"isendwin($module, /)\n"
"--\n"
"\n"
"Return True if endwin() has been called.");

#define _CURSES_ISENDWIN_METHODDEF    \
    {"isendwin", (PyCFunction)_curses_isendwin, METH_NOARGS, _curses_isendwin__doc__},

static PyObject *
_curses_isendwin_impl(PyObject *module);

static PyObject *
_curses_isendwin(PyObject *module, PyObject *Py_UNUSED(ignored))
{
    return _curses_isendwin_impl(module);
}

#if defined(HAVE_CURSES_IS_TERM_RESIZED)

PyDoc_STRVAR(_curses_is_term_resized__doc__,
"is_term_resized($module, nlines, ncols, /)\n"
"--\n"
"\n"
"Return True if resize_term() would modify the window structure, False otherwise.\n"
"\n"
"  nlines\n"
"    Height.\n"
"  ncols\n"
"    Width.");

#define _CURSES_IS_TERM_RESIZED_METHODDEF    \
    {"is_term_resized", _PyCFunction_CAST(_curses_is_term_resized), METH_FASTCALL, _curses_is_term_resized__doc__},

static PyObject *
_curses_is_term_resized_impl(PyObject *module, int nlines, int ncols);

static PyObject *
_curses_is_term_resized(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
{
    PyObject *return_value = NULL;
    int nlines;
    int ncols;

    if (!_PyArg_CheckPositional("is_term_resized", nargs, 2, 2)) {
        goto exit;
    }
    nlines = _PyLong_AsInt(args[0]);
    if (nlines == -1 && PyErr_Occurred()) {
        goto exit;
    }
    ncols = _PyLong_AsInt(args[1]);
    if (ncols == -1 && PyErr_Occurred()) {
        goto exit;
    }
    return_value = _curses_is_term_resized_impl(module, nlines, ncols);

exit:
    return return_value;
}

#endif /* defined(HAVE_CURSES_IS_TERM_RESIZED) */

PyDoc_STRVAR(_curses_keyname__doc__,
"keyname($module, key, /)\n"
"--\n"
"\n"
"Return the name of specified key.\n"
"\n"
"  key\n"
"    Key number.");

#define _CURSES_KEYNAME_METHODDEF    \
    {"keyname", (PyCFunction)_curses_keyname, METH_O, _curses_keyname__doc__},

static PyObject *
_curses_keyname_impl(PyObject *module, int key);

static PyObject *
_curses_keyname(PyObject *module, PyObject *arg)
{
    PyObject *return_value = NULL;
    int key;

    key = _PyLong_AsInt(arg);
    if (key == -1 && PyErr_Occurred()) {
        goto exit;
    }
    return_value = _curses_keyname_impl(module, key);

exit:
    return return_value;
}

PyDoc_STRVAR(_curses_killchar__doc__,
"killchar($module, /)\n"
"--\n"
"\n"
"Return the user\'s current line kill character.");

#define _CURSES_KILLCHAR_METHODDEF    \
    {"killchar", (PyCFunction)_curses_killchar, METH_NOARGS, _curses_killchar__doc__},

static PyObject *
_curses_killchar_impl(PyObject *module);

static PyObject *
_curses_killchar(PyObject *module, PyObject *Py_UNUSED(ignored))
{
    return _curses_killchar_impl(module);
}

PyDoc_STRVAR(_curses_longname__doc__,
"longname($module, /)\n"
"--\n"
"\n"
"Return the terminfo long name field describing the current terminal.\n"
"\n"
"The maximum length of a verbose description is 128 characters.  It is defined\n"
"only after the call to initscr().");

#define _CURSES_LONGNAME_METHODDEF    \
    {"longname", (PyCFunction)_curses_longname, METH_NOARGS, _curses_longname__doc__},

static PyObject *
_curses_longname_impl(PyObject *module);

static PyObject *
_curses_longname(PyObject *module, PyObject *Py_UNUSED(ignored))
{
    return _curses_longname_impl(module);
}

PyDoc_STRVAR(_curses_meta__doc__,
"meta($module, yes, /)\n"
"--\n"
"\n"
"Enable/disable meta keys.\n"
"\n"
"If yes is True, allow 8-bit characters to be input.  If yes is False,\n"
"allow only 7-bit characters.");

#define _CURSES_META_METHODDEF    \
    {"meta", (PyCFunction)_curses_meta, METH_O, _curses_meta__doc__},

static PyObject *
_curses_meta_impl(PyObject *module, int yes);

static PyObject *
_curses_meta(PyObject *module, PyObject *arg)
{
    PyObject *return_value = NULL;
    int yes;

    yes = PyObject_IsTrue(arg);
    if (yes < 0) {
        goto exit;
    }
    return_value = _curses_meta_impl(module, yes);

exit:
    return return_value;
}

#if defined(NCURSES_MOUSE_VERSION)

PyDoc_STRVAR(_curses_mouseinterval__doc__,
"mouseinterval($module, interval, /)\n"
"--\n"
"\n"
"Set and retrieve the maximum time between press and release in a click.\n"
"\n"
"  interval\n"
"    Time in milliseconds.\n"
"\n"
"Set the maximum time that can elapse between press and release events in\n"
"order for them to be recognized as a click, and return the previous interval\n"
"value.");

#define _CURSES_MOUSEINTERVAL_METHODDEF    \
    {"mouseinterval", (PyCFunction)_curses_mouseinterval, METH_O, _curses_mouseinterval__doc__},

static PyObject *
_curses_mouseinterval_impl(PyObject *module, int interval);

static PyObject *
_curses_mouseinterval(PyObject *module, PyObject *arg)
{
    PyObject *return_value = NULL;
    int interval;

    interval = _PyLong_AsInt(arg);
    if (interval == -1 && PyErr_Occurred()) {
        goto exit;
    }
    return_value = _curses_mouseinterval_impl(module, interval);

exit:
    return return_value;
}

#endif /* defined(NCURSES_MOUSE_VERSION) */

#if defined(NCURSES_MOUSE_VERSION)

PyDoc_STRVAR(_curses_mousemask__doc__,
"mousemask($module, newmask, /)\n"
"--\n"
"\n"
"Set the mouse events to be reported, and return a tuple (availmask, oldmask).\n"
"\n"
"Return a tuple (availmask, oldmask).  availmask indicates which of the\n"
"specified mouse events can be reported; on complete failure it returns 0.\n"
"oldmask is the previous value of the given window\'s mouse event mask.\n"
"If this function is never called, no mouse events are ever reported.");

#define _CURSES_MOUSEMASK_METHODDEF    \
    {"mousemask", (PyCFunction)_curses_mousemask, METH_O, _curses_mousemask__doc__},

static PyObject *
_curses_mousemask_impl(PyObject *module, unsigned long newmask);

static PyObject *
_curses_mousemask(PyObject *module, PyObject *arg)
{
    PyObject *return_value = NULL;
    unsigned long newmask;

    if (!PyLong_Check(arg)) {
        _PyArg_BadArgument("mousemask", "argument", "int", arg);
        goto exit;
    }
    newmask = PyLong_AsUnsignedLongMask(arg);
    return_value = _curses_mousemask_impl(module, newmask);

exit:
    return return_value;
}

#endif /* defined(NCURSES_MOUSE_VERSION) */

PyDoc_STRVAR(_curses_napms__doc__,
"napms($module, ms, /)\n"
"--\n"
"\n"
"Sleep for specified time.\n"
"\n"
"  ms\n"
"    Duration in milliseconds.");

#define _CURSES_NAPMS_METHODDEF    \
    {"napms", (PyCFunction)_curses_napms, METH_O, _curses_napms__doc__},

static PyObject *
_curses_napms_impl(PyObject *module, int ms);

static PyObject *
_curses_napms(PyObject *module, PyObject *arg)
{
    PyObject *return_value = NULL;
    int ms;

    ms = _PyLong_AsInt(arg);
    if (ms == -1 && PyErr_Occurred()) {
        goto exit;
    }
    return_value = _curses_napms_impl(module, ms);

exit:
    return return_value;
}

PyDoc_STRVAR(_curses_newpad__doc__,
"newpad($module, nlines, ncols, /)\n"
"--\n"
"\n"
"Create and return a pointer to a new pad data structure.\n"
"\n"
"  nlines\n"
"    Height.\n"
"  ncols\n"
"    Width.");

#define _CURSES_NEWPAD_METHODDEF    \
    {"newpad", _PyCFunction_CAST(_curses_newpad), METH_FASTCALL, _curses_newpad__doc__},

static PyObject *
_curses_newpad_impl(PyObject *module, int nlines, int ncols);

static PyObject *
_curses_newpad(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
{
    PyObject *return_value = NULL;
    int nlines;
    int ncols;

    if (!_PyArg_CheckPositional("newpad", nargs, 2, 2)) {
        goto exit;
    }
    nlines = _PyLong_AsInt(args[0]);
    if (nlines == -1 && PyErr_Occurred()) {
        goto exit;
    }
    ncols = _PyLong_AsInt(args[1]);
    if (ncols == -1 && PyErr_Occurred()) {
        goto exit;
    }
    return_value = _curses_newpad_impl(module, nlines, ncols);

exit:
    return return_value;
}

PyDoc_STRVAR(_curses_newwin__doc__,
"newwin(nlines, ncols, [begin_y=0, begin_x=0])\n"
"Return a new window.\n"
"\n"
"  nlines\n"
"    Height.\n"
"  ncols\n"
"    Width.\n"
"  begin_y\n"
"    Top side y-coordinate.\n"
"  begin_x\n"
"    Left side x-coordinate.\n"
"\n"
"By default, the window will extend from the specified position to the lower\n"
"right corner of the screen.");

#define _CURSES_NEWWIN_METHODDEF    \
    {"newwin", (PyCFunction)_curses_newwin, METH_VARARGS, _curses_newwin__doc__},

static PyObject *
_curses_newwin_impl(PyObject *module, int nlines, int ncols,
                    int group_right_1, int begin_y, int begin_x);

static PyObject *
_curses_newwin(PyObject *module, PyObject *args)
{
    PyObject *return_value = NULL;
    int nlines;
    int ncols;
    int group_right_1 = 0;
    int begin_y = 0;
    int begin_x = 0;

    switch (PyTuple_GET_SIZE(args)) {
        case 2:
            if (!PyArg_ParseTuple(args, "ii:newwin", &nlines, &ncols)) {
                goto exit;
            }
            break;
        case 4:
            if (!PyArg_ParseTuple(args, "iiii:newwin", &nlines, &ncols, &begin_y, &begin_x)) {
                goto exit;
            }
            group_right_1 = 1;
            break;
        default:
            PyErr_SetString(PyExc_TypeError, "_curses.newwin requires 2 to 4 arguments");
            goto exit;
    }
    return_value = _curses_newwin_impl(module, nlines, ncols, group_right_1, begin_y, begin_x);

exit:
    return return_value;
}

PyDoc_STRVAR(_curses_nl__doc__,
"nl($module, flag=True, /)\n"
"--\n"
"\n"
"Enter newline mode.\n"
"\n"
"  flag\n"
"    If false, the effect is the same as calling nonl().\n"
"\n"
"This mode translates the return key into newline on input, and translates\n"
"newline into return and line-feed on output.  Newline mode is initially on.");

#define _CURSES_NL_METHODDEF    \
    {"nl", _PyCFunction_CAST(_curses_nl), METH_FASTCALL, _curses_nl__doc__},

static PyObject *
_curses_nl_impl(PyObject *module, int flag);

static PyObject *
_curses_nl(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
{
    PyObject *return_value = NULL;
    int flag = 1;

    if (!_PyArg_CheckPositional("nl", nargs, 0, 1)) {
        goto exit;
    }
    if (nargs < 1) {
        goto skip_optional;
    }
    flag = PyObject_IsTrue(args[0]);
    if (flag < 0) {
        goto exit;
    }
skip_optional:
    return_value = _curses_nl_impl(module, flag);

exit:
    return return_value;
}

PyDoc_STRVAR(_curses_nocbreak__doc__,
"nocbreak($module, /)\n"
"--\n"
"\n"
"Leave cbreak mode.\n"
"\n"
"Return to normal \"cooked\" mode with line buffering.");

#define _CURSES_NOCBREAK_METHODDEF    \
    {"nocbreak", (PyCFunction)_curses_nocbreak, METH_NOARGS, _curses_nocbreak__doc__},

static PyObject *
_curses_nocbreak_impl(PyObject *module);

static PyObject *
_curses_nocbreak(PyObject *module, PyObject *Py_UNUSED(ignored))
{
    return _curses_nocbreak_impl(module);
}

PyDoc_STRVAR(_curses_noecho__doc__,
"noecho($module, /)\n"
"--\n"
"\n"
"Leave echo mode.\n"
"\n"
"Echoing of input characters is turned off.");

#define _CURSES_NOECHO_METHODDEF    \
    {"noecho", (PyCFunction)_curses_noecho, METH_NOARGS, _curses_noecho__doc__},

static PyObject *
_curses_noecho_impl(PyObject *module);

static PyObject *
_curses_noecho(PyObject *module, PyObject *Py_UNUSED(ignored))
{
    return _curses_noecho_impl(module);
}

PyDoc_STRVAR(_curses_nonl__doc__,
"nonl($module, /)\n"
"--\n"
"\n"
"Leave newline mode.\n"
"\n"
"Disable translation of return into newline on input, and disable low-level\n"
"translation of newline into newline/return on output.");

#define _CURSES_NONL_METHODDEF    \
    {"nonl", (PyCFunction)_curses_nonl, METH_NOARGS, _curses_nonl__doc__},

static PyObject *
_curses_nonl_impl(PyObject *module);

static PyObject *
_curses_nonl(PyObject *module, PyObject *Py_UNUSED(ignored))
{
    return _curses_nonl_impl(module);
}

PyDoc_STRVAR(_curses_noqiflush__doc__,
"noqiflush($module, /)\n"
"--\n"
"\n"
"Disable queue flushing.\n"
"\n"
"When queue flushing is disabled, normal flush of input and output queues\n"
"associated with the INTR, QUIT and SUSP characters will not be done.");

#define _CURSES_NOQIFLUSH_METHODDEF    \
    {"noqiflush", (PyCFunction)_curses_noqiflush, METH_NOARGS, _curses_noqiflush__doc__},

static PyObject *
_curses_noqiflush_impl(PyObject *module);

static PyObject *
_curses_noqiflush(PyObject *module, PyObject *Py_UNUSED(ignored))
{
    return _curses_noqiflush_impl(module);
}

PyDoc_STRVAR(_curses_noraw__doc__,
"noraw($module, /)\n"
"--\n"
"\n"
"Leave raw mode.\n"
"\n"
"Return to normal \"cooked\" mode with line buffering.");

#define _CURSES_NORAW_METHODDEF    \
    {"noraw", (PyCFunction)_curses_noraw, METH_NOARGS, _curses_noraw__doc__},

static PyObject *
_curses_noraw_impl(PyObject *module);

static PyObject *
_curses_noraw(PyObject *module, PyObject *Py_UNUSED(ignored))
{
    return _curses_noraw_impl(module);
}

PyDoc_STRVAR(_curses_pair_content__doc__,
"pair_content($module, pair_number, /)\n"
"--\n"
"\n"
"Return a tuple (fg, bg) containing the colors for the requested color pair.\n"
"\n"
"  pair_number\n"
"    The number of the color pair (0 - (COLOR_PAIRS-1)).");

#define _CURSES_PAIR_CONTENT_METHODDEF    \
    {"pair_content", (PyCFunction)_curses_pair_content, METH_O, _curses_pair_content__doc__},

static PyObject *
_curses_pair_content_impl(PyObject *module, int pair_number);

static PyObject *
_curses_pair_content(PyObject *module, PyObject *arg)
{
    PyObject *return_value = NULL;
    int pair_number;

    if (!pair_converter(arg, &pair_number)) {
        goto exit;
    }
    return_value = _curses_pair_content_impl(module, pair_number);

exit:
    return return_value;
}

PyDoc_STRVAR(_curses_pair_number__doc__,
"pair_number($module, attr, /)\n"
"--\n"
"\n"
"Return the number of the color-pair set by the specified attribute value.\n"
"\n"
"color_pair() is the counterpart to this function.");

#define _CURSES_PAIR_NUMBER_METHODDEF    \
    {"pair_number", (PyCFunction)_curses_pair_number, METH_O, _curses_pair_number__doc__},

static PyObject *
_curses_pair_number_impl(PyObject *module, int attr);

static PyObject *
_curses_pair_number(PyObject *module, PyObject *arg)
{
    PyObject *return_value = NULL;
    int attr;

    attr = _PyLong_AsInt(arg);
    if (attr == -1 && PyErr_Occurred()) {
        goto exit;
    }
    return_value = _curses_pair_number_impl(module, attr);

exit:
    return return_value;
}

PyDoc_STRVAR(_curses_putp__doc__,
"putp($module, string, /)\n"
"--\n"
"\n"
"Emit the value of a specified terminfo capability for the current terminal.\n"
"\n"
"Note that the output of putp() always goes to standard output.");

#define _CURSES_PUTP_METHODDEF    \
    {"putp", (PyCFunction)_curses_putp, METH_O, _curses_putp__doc__},

static PyObject *
_curses_putp_impl(PyObject *module, const char *string);

static PyObject *
_curses_putp(PyObject *module, PyObject *arg)
{
    PyObject *return_value = NULL;
    const char *string;

    if (!PyArg_Parse(arg, "y:putp", &string)) {
        goto exit;
    }
    return_value = _curses_putp_impl(module, string);

exit:
    return return_value;
}

PyDoc_STRVAR(_curses_qiflush__doc__,
"qiflush($module, flag=True, /)\n"
"--\n"
"\n"
"Enable queue flushing.\n"
"\n"
"  flag\n"
"    If false, the effect is the same as calling noqiflush().\n"
"\n"
"If queue flushing is enabled, all output in the display driver queue\n"
"will be flushed when the INTR, QUIT and SUSP characters are read.");

#define _CURSES_QIFLUSH_METHODDEF    \
    {"qiflush", _PyCFunction_CAST(_curses_qiflush), METH_FASTCALL, _curses_qiflush__doc__},

static PyObject *
_curses_qiflush_impl(PyObject *module, int flag);

static PyObject *
_curses_qiflush(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
{
    PyObject *return_value = NULL;
    int flag = 1;

    if (!_PyArg_CheckPositional("qiflush", nargs, 0, 1)) {
        goto exit;
    }
    if (nargs < 1) {
        goto skip_optional;
    }
    flag = PyObject_IsTrue(args[0]);
    if (flag < 0) {
        goto exit;
    }
skip_optional:
    return_value = _curses_qiflush_impl(module, flag);

exit:
    return return_value;
}

#if (defined(HAVE_CURSES_RESIZETERM) || defined(HAVE_CURSES_RESIZE_TERM))

PyDoc_STRVAR(_curses_update_lines_cols__doc__,
"update_lines_cols($module, /)\n"
"--\n"
"\n");

#define _CURSES_UPDATE_LINES_COLS_METHODDEF    \
    {"update_lines_cols", (PyCFunction)_curses_update_lines_cols, METH_NOARGS, _curses_update_lines_cols__doc__},

static PyObject *
_curses_update_lines_cols_impl(PyObject *module);

static PyObject *
_curses_update_lines_cols(PyObject *module, PyObject *Py_UNUSED(ignored))
{
    return _curses_update_lines_cols_impl(module);
}

#endif /* (defined(HAVE_CURSES_RESIZETERM) || defined(HAVE_CURSES_RESIZE_TERM)) */

PyDoc_STRVAR(_curses_raw__doc__,
"raw($module, flag=True, /)\n"
"--\n"
"\n"
"Enter raw mode.\n"
"\n"
"  flag\n"
"    If false, the effect is the same as calling noraw().\n"
"\n"
"In raw mode, normal line buffering and processing of interrupt, quit,\n"
"suspend, and flow control keys are turned off; characters are presented to\n"
"curses input functions one by one.");

#define _CURSES_RAW_METHODDEF    \
    {"raw", _PyCFunction_CAST(_curses_raw), METH_FASTCALL, _curses_raw__doc__},

static PyObject *
_curses_raw_impl(PyObject *module, int flag);

static PyObject *
_curses_raw(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
{
    PyObject *return_value = NULL;
    int flag = 1;

    if (!_PyArg_CheckPositional("raw", nargs, 0, 1)) {
        goto exit;
    }
    if (nargs < 1) {
        goto skip_optional;
    }
    flag = PyObject_IsTrue(args[0]);
    if (flag < 0) {
        goto exit;
    }
skip_optional:
    return_value = _curses_raw_impl(module, flag);

exit:
    return return_value;
}

PyDoc_STRVAR(_curses_reset_prog_mode__doc__,
"reset_prog_mode($module, /)\n"
"--\n"
"\n"
"Restore the terminal to \"program\" mode, as previously saved by def_prog_mode().");

#define _CURSES_RESET_PROG_MODE_METHODDEF    \
    {"reset_prog_mode", (PyCFunction)_curses_reset_prog_mode, METH_NOARGS, _curses_reset_prog_mode__doc__},

static PyObject *
_curses_reset_prog_mode_impl(PyObject *module);

static PyObject *
_curses_reset_prog_mode(PyObject *module, PyObject *Py_UNUSED(ignored))
{
    return _curses_reset_prog_mode_impl(module);
}

PyDoc_STRVAR(_curses_reset_shell_mode__doc__,
"reset_shell_mode($module, /)\n"
"--\n"
"\n"
"Restore the terminal to \"shell\" mode, as previously saved by def_shell_mode().");

#define _CURSES_RESET_SHELL_MODE_METHODDEF    \
    {"reset_shell_mode", (PyCFunction)_curses_reset_shell_mode, METH_NOARGS, _curses_reset_shell_mode__doc__},

static PyObject *
_curses_reset_shell_mode_impl(PyObject *module);

static PyObject *
_curses_reset_shell_mode(PyObject *module, PyObject *Py_UNUSED(ignored))
{
    return _curses_reset_shell_mode_impl(module);
}

PyDoc_STRVAR(_curses_resetty__doc__,
"resetty($module, /)\n"
"--\n"
"\n"
"Restore terminal mode.");

#define _CURSES_RESETTY_METHODDEF    \
    {"resetty", (PyCFunction)_curses_resetty, METH_NOARGS, _curses_resetty__doc__},

static PyObject *
_curses_resetty_impl(PyObject *module);

static PyObject *
_curses_resetty(PyObject *module, PyObject *Py_UNUSED(ignored))
{
    return _curses_resetty_impl(module);
}

#if defined(HAVE_CURSES_RESIZETERM)

PyDoc_STRVAR(_curses_resizeterm__doc__,
"resizeterm($module, nlines, ncols, /)\n"
"--\n"
"\n"
"Resize the standard and current windows to the specified dimensions.\n"
"\n"
"  nlines\n"
"    Height.\n"
"  ncols\n"
"    Width.\n"
"\n"
"Adjusts other bookkeeping data used by the curses library that record the\n"
"window dimensions (in particular the SIGWINCH handler).");

#define _CURSES_RESIZETERM_METHODDEF    \
    {"resizeterm", _PyCFunction_CAST(_curses_resizeterm), METH_FASTCALL, _curses_resizeterm__doc__},

static PyObject *
_curses_resizeterm_impl(PyObject *module, int nlines, int ncols);

static PyObject *
_curses_resizeterm(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
{
    PyObject *return_value = NULL;
    int nlines;
    int ncols;

    if (!_PyArg_CheckPositional("resizeterm", nargs, 2, 2)) {
        goto exit;
    }
    nlines = _PyLong_AsInt(args[0]);
    if (nlines == -1 && PyErr_Occurred()) {
        goto exit;
    }
    ncols = _PyLong_AsInt(args[1]);
    if (ncols == -1 && PyErr_Occurred()) {
        goto exit;
    }
    return_value = _curses_resizeterm_impl(module, nlines, ncols);

exit:
    return return_value;
}

#endif /* defined(HAVE_CURSES_RESIZETERM) */

#if defined(HAVE_CURSES_RESIZE_TERM)

PyDoc_STRVAR(_curses_resize_term__doc__,
"resize_term($module, nlines, ncols, /)\n"
"--\n"
"\n"
"Backend function used by resizeterm(), performing most of the work.\n"
"\n"
"  nlines\n"
"    Height.\n"
"  ncols\n"
"    Width.\n"
"\n"
"When resizing the windows, resize_term() blank-fills the areas that are\n"
"extended.  The calling application should fill in these areas with appropriate\n"
"data.  The resize_term() function attempts to resize all windows.  However,\n"
"due to the calling convention of pads, it is not possible to resize these\n"
"without additional interaction with the application.");

#define _CURSES_RESIZE_TERM_METHODDEF    \
    {"resize_term", _PyCFunction_CAST(_curses_resize_term), METH_FASTCALL, _curses_resize_term__doc__},

static PyObject *
_curses_resize_term_impl(PyObject *module, int nlines, int ncols);

static PyObject *
_curses_resize_term(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
{
    PyObject *return_value = NULL;
    int nlines;
    int ncols;

    if (!_PyArg_CheckPositional("resize_term", nargs, 2, 2)) {
        goto exit;
    }
    nlines = _PyLong_AsInt(args[0]);
    if (nlines == -1 && PyErr_Occurred()) {
        goto exit;
    }
    ncols = _PyLong_AsInt(args[1]);
    if (ncols == -1 && PyErr_Occurred()) {
        goto exit;
    }
    return_value = _curses_resize_term_impl(module, nlines, ncols);

exit:
    return return_value;
}

#endif /* defined(HAVE_CURSES_RESIZE_TERM) */

PyDoc_STRVAR(_curses_savetty__doc__,
"savetty($module, /)\n"
"--\n"
"\n"
"Save terminal mode.");

#define _CURSES_SAVETTY_METHODDEF    \
    {"savetty", (PyCFunction)_curses_savetty, METH_NOARGS, _curses_savetty__doc__},

static PyObject *
_curses_savetty_impl(PyObject *module);

static PyObject *
_curses_savetty(PyObject *module, PyObject *Py_UNUSED(ignored))
{
    return _curses_savetty_impl(module);
}

#if defined(getsyx)

PyDoc_STRVAR(_curses_setsyx__doc__,
"setsyx($module, y, x, /)\n"
"--\n"
"\n"
"Set the virtual screen cursor.\n"
"\n"
"  y\n"
"    Y-coordinate.\n"
"  x\n"
"    X-coordinate.\n"
"\n"
"If y and x are both -1, then leaveok is set.");

#define _CURSES_SETSYX_METHODDEF    \
    {"setsyx", _PyCFunction_CAST(_curses_setsyx), METH_FASTCALL, _curses_setsyx__doc__},

static PyObject *
_curses_setsyx_impl(PyObject *module, int y, int x);

static PyObject *
_curses_setsyx(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
{
    PyObject *return_value = NULL;
    int y;
    int x;

    if (!_PyArg_CheckPositional("setsyx", nargs, 2, 2)) {
        goto exit;
    }
    y = _PyLong_AsInt(args[0]);
    if (y == -1 && PyErr_Occurred()) {
        goto exit;
    }
    x = _PyLong_AsInt(args[1]);
    if (x == -1 && PyErr_Occurred()) {
        goto exit;
    }
    return_value = _curses_setsyx_impl(module, y, x);

exit:
    return return_value;
}

#endif /* defined(getsyx) */

PyDoc_STRVAR(_curses_start_color__doc__,
"start_color($module, /)\n"
"--\n"
"\n"
"Initializes eight basic colors and global variables COLORS and COLOR_PAIRS.\n"
"\n"
"Must be called if the programmer wants to use colors, and before any other\n"
"color manipulation routine is called.  It is good practice to call this\n"
"routine right after initscr().\n"
"\n"
"It also restores the colors on the terminal to the values they had when the\n"
"terminal was just turned on.");

#define _CURSES_START_COLOR_METHODDEF    \
    {"start_color", (PyCFunction)_curses_start_color, METH_NOARGS, _curses_start_color__doc__},

static PyObject *
_curses_start_color_impl(PyObject *module);

static PyObject *
_curses_start_color(PyObject *module, PyObject *Py_UNUSED(ignored))
{
    return _curses_start_color_impl(module);
}

PyDoc_STRVAR(_curses_termattrs__doc__,
"termattrs($module, /)\n"
"--\n"
"\n"
"Return a logical OR of all video attributes supported by the terminal.");

#define _CURSES_TERMATTRS_METHODDEF    \
    {"termattrs", (PyCFunction)_curses_termattrs, METH_NOARGS, _curses_termattrs__doc__},

static PyObject *
_curses_termattrs_impl(PyObject *module);

static PyObject *
_curses_termattrs(PyObject *module, PyObject *Py_UNUSED(ignored))
{
    return _curses_termattrs_impl(module);
}

PyDoc_STRVAR(_curses_termname__doc__,
"termname($module, /)\n"
"--\n"
"\n"
"Return the value of the environment variable TERM, truncated to 14 characters.");

#define _CURSES_TERMNAME_METHODDEF    \
    {"termname", (PyCFunction)_curses_termname, METH_NOARGS, _curses_termname__doc__},

static PyObject *
_curses_termname_impl(PyObject *module);

static PyObject *
_curses_termname(PyObject *module, PyObject *Py_UNUSED(ignored))
{
    return _curses_termname_impl(module);
}

PyDoc_STRVAR(_curses_tigetflag__doc__,
"tigetflag($module, capname, /)\n"
"--\n"
"\n"
"Return the value of the Boolean capability.\n"
"\n"
"  capname\n"
"    The terminfo capability name.\n"
"\n"
"The value -1 is returned if capname is not a Boolean capability, or 0 if\n"
"it is canceled or absent from the terminal description.");

#define _CURSES_TIGETFLAG_METHODDEF    \
    {"tigetflag", (PyCFunction)_curses_tigetflag, METH_O, _curses_tigetflag__doc__},

static PyObject *
_curses_tigetflag_impl(PyObject *module, const char *capname);

static PyObject *
_curses_tigetflag(PyObject *module, PyObject *arg)
{
    PyObject *return_value = NULL;
    const char *capname;

    if (!PyUnicode_Check(arg)) {
        _PyArg_BadArgument("tigetflag", "argument", "str", arg);
        goto exit;
    }
    Py_ssize_t capname_length;
    capname = PyUnicode_AsUTF8AndSize(arg, &capname_length);
    if (capname == NULL) {
        goto exit;
    }
    if (strlen(capname) != (size_t)capname_length) {
        PyErr_SetString(PyExc_ValueError, "embedded null character");
        goto exit;
    }
    return_value = _curses_tigetflag_impl(module, capname);

exit:
    return return_value;
}

PyDoc_STRVAR(_curses_tigetnum__doc__,
"tigetnum($module, capname, /)\n"
"--\n"
"\n"
"Return the value of the numeric capability.\n"
"\n"
"  capname\n"
"    The terminfo capability name.\n"
"\n"
"The value -2 is returned if capname is not a numeric capability, or -1 if\n"
"it is canceled or absent from the terminal description.");

#define _CURSES_TIGETNUM_METHODDEF    \
    {"tigetnum", (PyCFunction)_curses_tigetnum, METH_O, _curses_tigetnum__doc__},

static PyObject *
_curses_tigetnum_impl(PyObject *module, const char *capname);

static PyObject *
_curses_tigetnum(PyObject *module, PyObject *arg)
{
    PyObject *return_value = NULL;
    const char *capname;

    if (!PyUnicode_Check(arg)) {
        _PyArg_BadArgument("tigetnum", "argument", "str", arg);
        goto exit;
    }
    Py_ssize_t capname_length;
    capname = PyUnicode_AsUTF8AndSize(arg, &capname_length);
    if (capname == NULL) {
        goto exit;
    }
    if (strlen(capname) != (size_t)capname_length) {
        PyErr_SetString(PyExc_ValueError, "embedded null character");
        goto exit;
    }
    return_value = _curses_tigetnum_impl(module, capname);

exit:
    return return_value;
}

PyDoc_STRVAR(_curses_tigetstr__doc__,
"tigetstr($module, capname, /)\n"
"--\n"
"\n"
"Return the value of the string capability.\n"
"\n"
"  capname\n"
"    The terminfo capability name.\n"
"\n"
"None is returned if capname is not a string capability, or is canceled or\n"
"absent from the terminal description.");

#define _CURSES_TIGETSTR_METHODDEF    \
    {"tigetstr", (PyCFunction)_curses_tigetstr, METH_O, _curses_tigetstr__doc__},

static PyObject *
_curses_tigetstr_impl(PyObject *module, const char *capname);

static PyObject *
_curses_tigetstr(PyObject *module, PyObject *arg)
{
    PyObject *return_value = NULL;
    const char *capname;

    if (!PyUnicode_Check(arg)) {
        _PyArg_BadArgument("tigetstr", "argument", "str", arg);
        goto exit;
    }
    Py_ssize_t capname_length;
    capname = PyUnicode_AsUTF8AndSize(arg, &capname_length);
    if (capname == NULL) {
        goto exit;
    }
    if (strlen(capname) != (size_t)capname_length) {
        PyErr_SetString(PyExc_ValueError, "embedded null character");
        goto exit;
    }
    return_value = _curses_tigetstr_impl(module, capname);

exit:
    return return_value;
}

PyDoc_STRVAR(_curses_tparm__doc__,
"tparm($module, str, i1=0, i2=0, i3=0, i4=0, i5=0, i6=0, i7=0, i8=0,\n"
"      i9=0, /)\n"
"--\n"
"\n"
"Instantiate the specified byte string with the supplied parameters.\n"
"\n"
"  str\n"
"    Parameterized byte string obtained from the terminfo database.");

#define _CURSES_TPARM_METHODDEF    \
    {"tparm", _PyCFunction_CAST(_curses_tparm), METH_FASTCALL, _curses_tparm__doc__},

static PyObject *
_curses_tparm_impl(PyObject *module, const char *str, int i1, int i2, int i3,
                   int i4, int i5, int i6, int i7, int i8, int i9);

static PyObject *
_curses_tparm(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
{
    PyObject *return_value = NULL;
    const char *str;
    int i1 = 0;
    int i2 = 0;
    int i3 = 0;
    int i4 = 0;
    int i5 = 0;
    int i6 = 0;
    int i7 = 0;
    int i8 = 0;
    int i9 = 0;

    if (!_PyArg_ParseStack(args, nargs, "y|iiiiiiiii:tparm",
        &str, &i1, &i2, &i3, &i4, &i5, &i6, &i7, &i8, &i9)) {
        goto exit;
    }
    return_value = _curses_tparm_impl(module, str, i1, i2, i3, i4, i5, i6, i7, i8, i9);

exit:
    return return_value;
}

#if defined(HAVE_CURSES_TYPEAHEAD)

PyDoc_STRVAR(_curses_typeahead__doc__,
"typeahead($module, fd, /)\n"
"--\n"
"\n"
"Specify that the file descriptor fd be used for typeahead checking.\n"
"\n"
"  fd\n"
"    File descriptor.\n"
"\n"
"If fd is -1, then no typeahead checking is done.");

#define _CURSES_TYPEAHEAD_METHODDEF    \
    {"typeahead", (PyCFunction)_curses_typeahead, METH_O, _curses_typeahead__doc__},

static PyObject *
_curses_typeahead_impl(PyObject *module, int fd);

static PyObject *
_curses_typeahead(PyObject *module, PyObject *arg)
{
    PyObject *return_value = NULL;
    int fd;

    fd = _PyLong_AsInt(arg);
    if (fd == -1 && PyErr_Occurred()) {
        goto exit;
    }
    return_value = _curses_typeahead_impl(module, fd);

exit:
    return return_value;
}

#endif /* defined(HAVE_CURSES_TYPEAHEAD) */

PyDoc_STRVAR(_curses_unctrl__doc__,
"unctrl($module, ch, /)\n"
"--\n"
"\n"
"Return a string which is a printable representation of the character ch.\n"
"\n"
"Control characters are displayed as a caret followed by the character,\n"
"for example as ^C.  Printing characters are left as they are.");

#define _CURSES_UNCTRL_METHODDEF    \
    {"unctrl", (PyCFunction)_curses_unctrl, METH_O, _curses_unctrl__doc__},

PyDoc_STRVAR(_curses_ungetch__doc__,
"ungetch($module, ch, /)\n"
"--\n"
"\n"
"Push ch so the next getch() will return it.");

#define _CURSES_UNGETCH_METHODDEF    \
    {"ungetch", (PyCFunction)_curses_ungetch, METH_O, _curses_ungetch__doc__},

#if defined(HAVE_NCURSESW)

PyDoc_STRVAR(_curses_unget_wch__doc__,
"unget_wch($module, ch, /)\n"
"--\n"
"\n"
"Push ch so the next get_wch() will return it.");

#define _CURSES_UNGET_WCH_METHODDEF    \
    {"unget_wch", (PyCFunction)_curses_unget_wch, METH_O, _curses_unget_wch__doc__},

#endif /* defined(HAVE_NCURSESW) */

#if defined(HAVE_CURSES_USE_ENV)

PyDoc_STRVAR(_curses_use_env__doc__,
"use_env($module, flag, /)\n"
"--\n"
"\n"
"Use environment variables LINES and COLUMNS.\n"
"\n"
"If used, this function should be called before initscr() or newterm() are\n"
"called.\n"
"\n"
"When flag is False, the values of lines and columns specified in the terminfo\n"
"database will be used, even if environment variables LINES and COLUMNS (used\n"
"by default) are set, or if curses is running in a window (in which case\n"
"default behavior would be to use the window size if LINES and COLUMNS are\n"
"not set).");

#define _CURSES_USE_ENV_METHODDEF    \
    {"use_env", (PyCFunction)_curses_use_env, METH_O, _curses_use_env__doc__},

static PyObject *
_curses_use_env_impl(PyObject *module, int flag);

static PyObject *
_curses_use_env(PyObject *module, PyObject *arg)
{
    PyObject *return_value = NULL;
    int flag;

    flag = PyObject_IsTrue(arg);
    if (flag < 0) {
        goto exit;
    }
    return_value = _curses_use_env_impl(module, flag);

exit:
    return return_value;
}

#endif /* defined(HAVE_CURSES_USE_ENV) */

#if !defined(STRICT_SYSV_CURSES)

PyDoc_STRVAR(_curses_use_default_colors__doc__,
"use_default_colors($module, /)\n"
"--\n"
"\n"
"Allow use of default values for colors on terminals supporting this feature.\n"
"\n"
"Use this to support transparency in your application.  The default color\n"
"is assigned to the color number -1.");

#define _CURSES_USE_DEFAULT_COLORS_METHODDEF    \
    {"use_default_colors", (PyCFunction)_curses_use_default_colors, METH_NOARGS, _curses_use_default_colors__doc__},

static PyObject *
_curses_use_default_colors_impl(PyObject *module);

static PyObject *
_curses_use_default_colors(PyObject *module, PyObject *Py_UNUSED(ignored))
{
    return _curses_use_default_colors_impl(module);
}

#endif /* !defined(STRICT_SYSV_CURSES) */

PyDoc_STRVAR(_curses_has_extended_color_support__doc__,
"has_extended_color_support($module, /)\n"
"--\n"
"\n"
"Return True if the module supports extended colors; otherwise, return False.\n"
"\n"
"Extended color support allows more than 256 color-pairs for terminals\n"
"that support more than 16 colors (e.g. xterm-256color).");

#define _CURSES_HAS_EXTENDED_COLOR_SUPPORT_METHODDEF    \
    {"has_extended_color_support", (PyCFunction)_curses_has_extended_color_support, METH_NOARGS, _curses_has_extended_color_support__doc__},

static PyObject *
_curses_has_extended_color_support_impl(PyObject *module);

static PyObject *
_curses_has_extended_color_support(PyObject *module, PyObject *Py_UNUSED(ignored))
{
    return _curses_has_extended_color_support_impl(module);
}

#ifndef _CURSES_WINDOW_ENCLOSE_METHODDEF
    #define _CURSES_WINDOW_ENCLOSE_METHODDEF
#endif /* !defined(_CURSES_WINDOW_ENCLOSE_METHODDEF) */

#ifndef _CURSES_WINDOW_GET_WCH_METHODDEF
    #define _CURSES_WINDOW_GET_WCH_METHODDEF
#endif /* !defined(_CURSES_WINDOW_GET_WCH_METHODDEF) */

#ifndef _CURSES_WINDOW_NOUTREFRESH_METHODDEF
    #define _CURSES_WINDOW_NOUTREFRESH_METHODDEF
#endif /* !defined(_CURSES_WINDOW_NOUTREFRESH_METHODDEF) */

#ifndef _CURSES_FILTER_METHODDEF
    #define _CURSES_FILTER_METHODDEF
#endif /* !defined(_CURSES_FILTER_METHODDEF) */

#ifndef _CURSES_GETSYX_METHODDEF
    #define _CURSES_GETSYX_METHODDEF
#endif /* !defined(_CURSES_GETSYX_METHODDEF) */

#ifndef _CURSES_GETMOUSE_METHODDEF
    #define _CURSES_GETMOUSE_METHODDEF
#endif /* !defined(_CURSES_GETMOUSE_METHODDEF) */

#ifndef _CURSES_UNGETMOUSE_METHODDEF
    #define _CURSES_UNGETMOUSE_METHODDEF
#endif /* !defined(_CURSES_UNGETMOUSE_METHODDEF) */

#ifndef _CURSES_HAS_KEY_METHODDEF
    #define _CURSES_HAS_KEY_METHODDEF
#endif /* !defined(_CURSES_HAS_KEY_METHODDEF) */

#ifndef _CURSES_GET_ESCDELAY_METHODDEF
    #define _CURSES_GET_ESCDELAY_METHODDEF
#endif /* !defined(_CURSES_GET_ESCDELAY_METHODDEF) */

#ifndef _CURSES_SET_ESCDELAY_METHODDEF
    #define _CURSES_SET_ESCDELAY_METHODDEF
#endif /* !defined(_CURSES_SET_ESCDELAY_METHODDEF) */

#ifndef _CURSES_GET_TABSIZE_METHODDEF
    #define _CURSES_GET_TABSIZE_METHODDEF
#endif /* !defined(_CURSES_GET_TABSIZE_METHODDEF) */

#ifndef _CURSES_SET_TABSIZE_METHODDEF
    #define _CURSES_SET_TABSIZE_METHODDEF
#endif /* !defined(_CURSES_SET_TABSIZE_METHODDEF) */

#ifndef _CURSES_IS_TERM_RESIZED_METHODDEF
    #define _CURSES_IS_TERM_RESIZED_METHODDEF
#endif /* !defined(_CURSES_IS_TERM_RESIZED_METHODDEF) */

#ifndef _CURSES_MOUSEINTERVAL_METHODDEF
    #define _CURSES_MOUSEINTERVAL_METHODDEF
#endif /* !defined(_CURSES_MOUSEINTERVAL_METHODDEF) */

#ifndef _CURSES_MOUSEMASK_METHODDEF
    #define _CURSES_MOUSEMASK_METHODDEF
#endif /* !defined(_CURSES_MOUSEMASK_METHODDEF) */

#ifndef _CURSES_UPDATE_LINES_COLS_METHODDEF
    #define _CURSES_UPDATE_LINES_COLS_METHODDEF
#endif /* !defined(_CURSES_UPDATE_LINES_COLS_METHODDEF) */

#ifndef _CURSES_RESIZETERM_METHODDEF
    #define _CURSES_RESIZETERM_METHODDEF
#endif /* !defined(_CURSES_RESIZETERM_METHODDEF) */

#ifndef _CURSES_RESIZE_TERM_METHODDEF
    #define _CURSES_RESIZE_TERM_METHODDEF
#endif /* !defined(_CURSES_RESIZE_TERM_METHODDEF) */

#ifndef _CURSES_SETSYX_METHODDEF
    #define _CURSES_SETSYX_METHODDEF
#endif /* !defined(_CURSES_SETSYX_METHODDEF) */

#ifndef _CURSES_TYPEAHEAD_METHODDEF
    #define _CURSES_TYPEAHEAD_METHODDEF
#endif /* !defined(_CURSES_TYPEAHEAD_METHODDEF) */

#ifndef _CURSES_UNGET_WCH_METHODDEF
    #define _CURSES_UNGET_WCH_METHODDEF
#endif /* !defined(_CURSES_UNGET_WCH_METHODDEF) */

#ifndef _CURSES_USE_ENV_METHODDEF
    #define _CURSES_USE_ENV_METHODDEF
#endif /* !defined(_CURSES_USE_ENV_METHODDEF) */

#ifndef _CURSES_USE_DEFAULT_COLORS_METHODDEF
    #define _CURSES_USE_DEFAULT_COLORS_METHODDEF
#endif /* !defined(_CURSES_USE_DEFAULT_COLORS_METHODDEF) */
/*[clinic end generated code: output=27a2364193b503c1 input=a9049054013a1b77]*/