Mercurial > cpython-lru_cache-weakref
annotate Modules/_cursesmodule.c @ 58765:2ba7677bfa95 legacy-trunk
testCopysign was defined twice in test_math; combine the definitions
| author | Mark Dickinson <dickinsm@gmail.com> |
|---|---|
| date | Sat, 06 Feb 2010 23:11:25 +0000 |
| parents | 2bfaddb19c3a |
| children | 23115015e5b9 |
| rev | line source |
|---|---|
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1 /* |
|
12738
3d26cb3808a7
Changes by AMK: Use HAVE_NCURSES_H to include correct header file
Andrew M. Kuchling <amk@amk.ca>
parents:
12737
diff
changeset
|
2 * This is a curses module for Python. |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
3 * |
|
12738
3d26cb3808a7
Changes by AMK: Use HAVE_NCURSES_H to include correct header file
Andrew M. Kuchling <amk@amk.ca>
parents:
12737
diff
changeset
|
4 * Based on prior work by Lance Ellinghaus and Oliver Andrich |
|
3d26cb3808a7
Changes by AMK: Use HAVE_NCURSES_H to include correct header file
Andrew M. Kuchling <amk@amk.ca>
parents:
12737
diff
changeset
|
5 * Version 1.2 of this module: Copyright 1994 by Lance Ellinghouse, |
|
3d26cb3808a7
Changes by AMK: Use HAVE_NCURSES_H to include correct header file
Andrew M. Kuchling <amk@amk.ca>
parents:
12737
diff
changeset
|
6 * Cathedral City, California Republic, United States of America. |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
7 * |
|
12738
3d26cb3808a7
Changes by AMK: Use HAVE_NCURSES_H to include correct header file
Andrew M. Kuchling <amk@amk.ca>
parents:
12737
diff
changeset
|
8 * Version 1.5b1, heavily extended for ncurses by Oliver Andrich: |
|
3d26cb3808a7
Changes by AMK: Use HAVE_NCURSES_H to include correct header file
Andrew M. Kuchling <amk@amk.ca>
parents:
12737
diff
changeset
|
9 * Copyright 1996,1997 by Oliver Andrich, Koblenz, Germany. |
|
3d26cb3808a7
Changes by AMK: Use HAVE_NCURSES_H to include correct header file
Andrew M. Kuchling <amk@amk.ca>
parents:
12737
diff
changeset
|
10 * |
|
25966
5b828ffe1b35
Use personal e-mail address
Andrew M. Kuchling <amk@amk.ca>
parents:
25922
diff
changeset
|
11 * Tidied for Python 1.6, and currently maintained by <amk@amk.ca>. |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
12 * |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
13 * Permission is hereby granted, free of charge, to any person obtaining |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
14 * a copy of this source file to use, copy, modify, merge, or publish it |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
15 * subject to the following conditions: |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
16 * |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
17 * The above copyright notice and this permission notice shall be included |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
18 * in all copies or in any new file that contains a substantial portion of |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
19 * this file. |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
20 * |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
21 * THE AUTHOR MAKES NO REPRESENTATIONS ABOUT THE SUITABILITY OF |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
22 * THE SOFTWARE FOR ANY PURPOSE. IT IS PROVIDED "AS IS" WITHOUT |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
23 * EXPRESS OR IMPLIED WARRANTY. THE AUTHOR DISCLAIMS ALL WARRANTIES |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
24 * WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
25 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
26 * NON-INFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
27 * AUTHOR BE LIABLE TO YOU OR ANY OTHER PARTY FOR ANY SPECIAL, |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
28 * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
29 * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE, STRICT LIABILITY OR |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
30 * ANY OTHER ACTION ARISING OUT OF OR IN CONNECTION WITH THE USE OR |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
31 * PERFORMANCE OF THIS SOFTWARE. |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
32 */ |
| 1858 | 33 |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
34 /* CVS: $Id$ */ |
| 1858 | 35 |
|
13728
b769e2dd6a51
Added list of missing functions as a comment
Andrew M. Kuchling <amk@amk.ca>
parents:
13721
diff
changeset
|
36 /* |
|
b769e2dd6a51
Added list of missing functions as a comment
Andrew M. Kuchling <amk@amk.ca>
parents:
13721
diff
changeset
|
37 |
|
41428
15f34ad4681b
Point readers at the patch submission instructions
Andrew M. Kuchling <amk@amk.ca>
parents:
41427
diff
changeset
|
38 A number of SysV or ncurses functions don't have wrappers yet; if you |
|
15f34ad4681b
Point readers at the patch submission instructions
Andrew M. Kuchling <amk@amk.ca>
parents:
41427
diff
changeset
|
39 need a given function, add it and send a patch. See |
|
15f34ad4681b
Point readers at the patch submission instructions
Andrew M. Kuchling <amk@amk.ca>
parents:
41427
diff
changeset
|
40 http://www.python.org/dev/patches/ for instructions on how to submit |
|
15f34ad4681b
Point readers at the patch submission instructions
Andrew M. Kuchling <amk@amk.ca>
parents:
41427
diff
changeset
|
41 patches to Python. |
|
15f34ad4681b
Point readers at the patch submission instructions
Andrew M. Kuchling <amk@amk.ca>
parents:
41427
diff
changeset
|
42 |
|
15f34ad4681b
Point readers at the patch submission instructions
Andrew M. Kuchling <amk@amk.ca>
parents:
41427
diff
changeset
|
43 Here's a list of currently unsupported functions: |
|
13728
b769e2dd6a51
Added list of missing functions as a comment
Andrew M. Kuchling <amk@amk.ca>
parents:
13721
diff
changeset
|
44 |
|
41427
40110d06e82a
Add window.chgat() method, submitted via e-mail by Fabian Kreutz
Andrew M. Kuchling <amk@amk.ca>
parents:
41039
diff
changeset
|
45 addchnstr addchstr color_set define_key |
|
13728
b769e2dd6a51
Added list of missing functions as a comment
Andrew M. Kuchling <amk@amk.ca>
parents:
13721
diff
changeset
|
46 del_curterm delscreen dupwin inchnstr inchstr innstr keyok |
|
41427
40110d06e82a
Add window.chgat() method, submitted via e-mail by Fabian Kreutz
Andrew M. Kuchling <amk@amk.ca>
parents:
41039
diff
changeset
|
47 mcprint mvaddchnstr mvaddchstr mvcur mvinchnstr |
|
40110d06e82a
Add window.chgat() method, submitted via e-mail by Fabian Kreutz
Andrew M. Kuchling <amk@amk.ca>
parents:
41039
diff
changeset
|
48 mvinchstr mvinnstr mmvwaddchnstr mvwaddchstr |
|
39191
9f3f1edd9c35
[Bug #1471938] Fix build problem on Solaris 8 by conditionalizing the use of mvwgetnstr(); it was conditionalized a few lines below. Fix from Paul Eggert. I also tried out the STRICT_SYSV_CURSES case and am therefore removing the 'untested' comment.
Andrew M. Kuchling <amk@amk.ca>
parents:
38876
diff
changeset
|
49 mvwinchnstr mvwinchstr mvwinnstr newterm |
|
38876
4a766024043a
Patch #1506645: add Python wrappers for the curses functions
Walter Dörwald <walter@livinglogic.de>
parents:
36675
diff
changeset
|
50 restartterm ripoffline scr_dump |
|
15418
06465ed81826
Patch #102412 from mwh: Add support for the setupterm() function, to
Andrew M. Kuchling <amk@amk.ca>
parents:
15384
diff
changeset
|
51 scr_init scr_restore scr_set scrl set_curterm set_term setterm |
|
06465ed81826
Patch #102412 from mwh: Add support for the setupterm() function, to
Andrew M. Kuchling <amk@amk.ca>
parents:
15384
diff
changeset
|
52 tgetent tgetflag tgetnum tgetstr tgoto timeout tputs |
|
41427
40110d06e82a
Add window.chgat() method, submitted via e-mail by Fabian Kreutz
Andrew M. Kuchling <amk@amk.ca>
parents:
41039
diff
changeset
|
53 vidattr vidputs waddchnstr waddchstr |
|
15418
06465ed81826
Patch #102412 from mwh: Add support for the setupterm() function, to
Andrew M. Kuchling <amk@amk.ca>
parents:
15384
diff
changeset
|
54 wcolor_set winchnstr winchstr winnstr wmouse_trafo wscrl |
|
13728
b769e2dd6a51
Added list of missing functions as a comment
Andrew M. Kuchling <amk@amk.ca>
parents:
13721
diff
changeset
|
55 |
|
b769e2dd6a51
Added list of missing functions as a comment
Andrew M. Kuchling <amk@amk.ca>
parents:
13721
diff
changeset
|
56 Low-priority: |
|
b769e2dd6a51
Added list of missing functions as a comment
Andrew M. Kuchling <amk@amk.ca>
parents:
13721
diff
changeset
|
57 slk_attr slk_attr_off slk_attr_on slk_attr_set slk_attroff |
|
b769e2dd6a51
Added list of missing functions as a comment
Andrew M. Kuchling <amk@amk.ca>
parents:
13721
diff
changeset
|
58 slk_attron slk_attrset slk_clear slk_color slk_init slk_label |
|
b769e2dd6a51
Added list of missing functions as a comment
Andrew M. Kuchling <amk@amk.ca>
parents:
13721
diff
changeset
|
59 slk_noutrefresh slk_refresh slk_restore slk_set slk_touch |
|
b769e2dd6a51
Added list of missing functions as a comment
Andrew M. Kuchling <amk@amk.ca>
parents:
13721
diff
changeset
|
60 |
|
15574
4a9f1552ba68
Wrapper for napms() function, contributed by Thomas Gellekum <tg@FreeBSD.org>
Andrew M. Kuchling <amk@amk.ca>
parents:
15418
diff
changeset
|
61 Menu extension (ncurses and probably SYSV): |
|
4a9f1552ba68
Wrapper for napms() function, contributed by Thomas Gellekum <tg@FreeBSD.org>
Andrew M. Kuchling <amk@amk.ca>
parents:
15418
diff
changeset
|
62 current_item free_item free_menu item_count item_description |
|
4a9f1552ba68
Wrapper for napms() function, contributed by Thomas Gellekum <tg@FreeBSD.org>
Andrew M. Kuchling <amk@amk.ca>
parents:
15418
diff
changeset
|
63 item_index item_init item_name item_opts item_opts_off |
|
4a9f1552ba68
Wrapper for napms() function, contributed by Thomas Gellekum <tg@FreeBSD.org>
Andrew M. Kuchling <amk@amk.ca>
parents:
15418
diff
changeset
|
64 item_opts_on item_term item_userptr item_value item_visible |
|
4a9f1552ba68
Wrapper for napms() function, contributed by Thomas Gellekum <tg@FreeBSD.org>
Andrew M. Kuchling <amk@amk.ca>
parents:
15418
diff
changeset
|
65 menu_back menu_driver menu_fore menu_format menu_grey |
|
4a9f1552ba68
Wrapper for napms() function, contributed by Thomas Gellekum <tg@FreeBSD.org>
Andrew M. Kuchling <amk@amk.ca>
parents:
15418
diff
changeset
|
66 menu_init menu_items menu_mark menu_opts menu_opts_off |
|
4a9f1552ba68
Wrapper for napms() function, contributed by Thomas Gellekum <tg@FreeBSD.org>
Andrew M. Kuchling <amk@amk.ca>
parents:
15418
diff
changeset
|
67 menu_opts_on menu_pad menu_pattern menu_request_by_name |
|
4a9f1552ba68
Wrapper for napms() function, contributed by Thomas Gellekum <tg@FreeBSD.org>
Andrew M. Kuchling <amk@amk.ca>
parents:
15418
diff
changeset
|
68 menu_request_name menu_spacing menu_sub menu_term menu_userptr |
|
4a9f1552ba68
Wrapper for napms() function, contributed by Thomas Gellekum <tg@FreeBSD.org>
Andrew M. Kuchling <amk@amk.ca>
parents:
15418
diff
changeset
|
69 menu_win new_item new_menu pos_menu_cursor post_menu |
|
4a9f1552ba68
Wrapper for napms() function, contributed by Thomas Gellekum <tg@FreeBSD.org>
Andrew M. Kuchling <amk@amk.ca>
parents:
15418
diff
changeset
|
70 scale_menu set_current_item set_item_init set_item_opts |
|
4a9f1552ba68
Wrapper for napms() function, contributed by Thomas Gellekum <tg@FreeBSD.org>
Andrew M. Kuchling <amk@amk.ca>
parents:
15418
diff
changeset
|
71 set_item_term set_item_userptr set_item_value set_menu_back |
|
4a9f1552ba68
Wrapper for napms() function, contributed by Thomas Gellekum <tg@FreeBSD.org>
Andrew M. Kuchling <amk@amk.ca>
parents:
15418
diff
changeset
|
72 set_menu_fore set_menu_format set_menu_grey set_menu_init |
|
4a9f1552ba68
Wrapper for napms() function, contributed by Thomas Gellekum <tg@FreeBSD.org>
Andrew M. Kuchling <amk@amk.ca>
parents:
15418
diff
changeset
|
73 set_menu_items set_menu_mark set_menu_opts set_menu_pad |
|
4a9f1552ba68
Wrapper for napms() function, contributed by Thomas Gellekum <tg@FreeBSD.org>
Andrew M. Kuchling <amk@amk.ca>
parents:
15418
diff
changeset
|
74 set_menu_pattern set_menu_spacing set_menu_sub set_menu_term |
|
4a9f1552ba68
Wrapper for napms() function, contributed by Thomas Gellekum <tg@FreeBSD.org>
Andrew M. Kuchling <amk@amk.ca>
parents:
15418
diff
changeset
|
75 set_menu_userptr set_menu_win set_top_row top_row unpost_menu |
|
4a9f1552ba68
Wrapper for napms() function, contributed by Thomas Gellekum <tg@FreeBSD.org>
Andrew M. Kuchling <amk@amk.ca>
parents:
15418
diff
changeset
|
76 |
|
4a9f1552ba68
Wrapper for napms() function, contributed by Thomas Gellekum <tg@FreeBSD.org>
Andrew M. Kuchling <amk@amk.ca>
parents:
15418
diff
changeset
|
77 Form extension (ncurses and probably SYSV): |
|
4a9f1552ba68
Wrapper for napms() function, contributed by Thomas Gellekum <tg@FreeBSD.org>
Andrew M. Kuchling <amk@amk.ca>
parents:
15418
diff
changeset
|
78 current_field data_ahead data_behind dup_field |
|
4a9f1552ba68
Wrapper for napms() function, contributed by Thomas Gellekum <tg@FreeBSD.org>
Andrew M. Kuchling <amk@amk.ca>
parents:
15418
diff
changeset
|
79 dynamic_fieldinfo field_arg field_back field_buffer |
|
4a9f1552ba68
Wrapper for napms() function, contributed by Thomas Gellekum <tg@FreeBSD.org>
Andrew M. Kuchling <amk@amk.ca>
parents:
15418
diff
changeset
|
80 field_count field_fore field_index field_info field_init |
|
4a9f1552ba68
Wrapper for napms() function, contributed by Thomas Gellekum <tg@FreeBSD.org>
Andrew M. Kuchling <amk@amk.ca>
parents:
15418
diff
changeset
|
81 field_just field_opts field_opts_off field_opts_on field_pad |
|
4a9f1552ba68
Wrapper for napms() function, contributed by Thomas Gellekum <tg@FreeBSD.org>
Andrew M. Kuchling <amk@amk.ca>
parents:
15418
diff
changeset
|
82 field_status field_term field_type field_userptr form_driver |
|
4a9f1552ba68
Wrapper for napms() function, contributed by Thomas Gellekum <tg@FreeBSD.org>
Andrew M. Kuchling <amk@amk.ca>
parents:
15418
diff
changeset
|
83 form_fields form_init form_opts form_opts_off form_opts_on |
|
4a9f1552ba68
Wrapper for napms() function, contributed by Thomas Gellekum <tg@FreeBSD.org>
Andrew M. Kuchling <amk@amk.ca>
parents:
15418
diff
changeset
|
84 form_page form_request_by_name form_request_name form_sub |
|
4a9f1552ba68
Wrapper for napms() function, contributed by Thomas Gellekum <tg@FreeBSD.org>
Andrew M. Kuchling <amk@amk.ca>
parents:
15418
diff
changeset
|
85 form_term form_userptr form_win free_field free_form |
|
4a9f1552ba68
Wrapper for napms() function, contributed by Thomas Gellekum <tg@FreeBSD.org>
Andrew M. Kuchling <amk@amk.ca>
parents:
15418
diff
changeset
|
86 link_field link_fieldtype move_field new_field new_form |
|
4a9f1552ba68
Wrapper for napms() function, contributed by Thomas Gellekum <tg@FreeBSD.org>
Andrew M. Kuchling <amk@amk.ca>
parents:
15418
diff
changeset
|
87 new_page pos_form_cursor post_form scale_form |
|
4a9f1552ba68
Wrapper for napms() function, contributed by Thomas Gellekum <tg@FreeBSD.org>
Andrew M. Kuchling <amk@amk.ca>
parents:
15418
diff
changeset
|
88 set_current_field set_field_back set_field_buffer |
|
4a9f1552ba68
Wrapper for napms() function, contributed by Thomas Gellekum <tg@FreeBSD.org>
Andrew M. Kuchling <amk@amk.ca>
parents:
15418
diff
changeset
|
89 set_field_fore set_field_init set_field_just set_field_opts |
|
4a9f1552ba68
Wrapper for napms() function, contributed by Thomas Gellekum <tg@FreeBSD.org>
Andrew M. Kuchling <amk@amk.ca>
parents:
15418
diff
changeset
|
90 set_field_pad set_field_status set_field_term set_field_type |
|
4a9f1552ba68
Wrapper for napms() function, contributed by Thomas Gellekum <tg@FreeBSD.org>
Andrew M. Kuchling <amk@amk.ca>
parents:
15418
diff
changeset
|
91 set_field_userptr set_fieldtype_arg set_fieldtype_choice |
|
4a9f1552ba68
Wrapper for napms() function, contributed by Thomas Gellekum <tg@FreeBSD.org>
Andrew M. Kuchling <amk@amk.ca>
parents:
15418
diff
changeset
|
92 set_form_fields set_form_init set_form_opts set_form_page |
|
4a9f1552ba68
Wrapper for napms() function, contributed by Thomas Gellekum <tg@FreeBSD.org>
Andrew M. Kuchling <amk@amk.ca>
parents:
15418
diff
changeset
|
93 set_form_sub set_form_term set_form_userptr set_form_win |
|
4a9f1552ba68
Wrapper for napms() function, contributed by Thomas Gellekum <tg@FreeBSD.org>
Andrew M. Kuchling <amk@amk.ca>
parents:
15418
diff
changeset
|
94 set_max_field set_new_page unpost_form |
|
4a9f1552ba68
Wrapper for napms() function, contributed by Thomas Gellekum <tg@FreeBSD.org>
Andrew M. Kuchling <amk@amk.ca>
parents:
15418
diff
changeset
|
95 |
|
4a9f1552ba68
Wrapper for napms() function, contributed by Thomas Gellekum <tg@FreeBSD.org>
Andrew M. Kuchling <amk@amk.ca>
parents:
15418
diff
changeset
|
96 |
|
13728
b769e2dd6a51
Added list of missing functions as a comment
Andrew M. Kuchling <amk@amk.ca>
parents:
13721
diff
changeset
|
97 */ |
|
b769e2dd6a51
Added list of missing functions as a comment
Andrew M. Kuchling <amk@amk.ca>
parents:
13721
diff
changeset
|
98 |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
99 /* Release Number */ |
| 1858 | 100 |
|
20583
b5ca0687ba6a
Add two forgotten 'break' statements
Andrew M. Kuchling <amk@amk.ca>
parents:
20412
diff
changeset
|
101 char *PyCursesVersion = "2.2"; |
| 1858 | 102 |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
103 /* Includes */ |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
104 |
|
1888
be956b1efb97
* various modules: #include "Python.h" and remove most remporary
Guido van Rossum <guido@python.org>
parents:
1867
diff
changeset
|
105 #include "Python.h" |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
106 |
|
13040
12ac2c267b93
Fixes for compiling on Tru64.
Andrew M. Kuchling <amk@amk.ca>
parents:
13039
diff
changeset
|
107 #ifdef __osf__ |
|
13708
fe89ea1c9108
Modified version of patch #100963 from Mark Favas: has_key() is an
Andrew M. Kuchling <amk@amk.ca>
parents:
13706
diff
changeset
|
108 #define STRICT_SYSV_CURSES /* Don't use ncurses extensions */ |
|
13040
12ac2c267b93
Fixes for compiling on Tru64.
Andrew M. Kuchling <amk@amk.ca>
parents:
13039
diff
changeset
|
109 #endif |
|
12ac2c267b93
Fixes for compiling on Tru64.
Andrew M. Kuchling <amk@amk.ca>
parents:
13039
diff
changeset
|
110 |
|
20647
dd78b1a71f3e
Check for HP/UX curses problems. Define _XOPEN_SOURCE_EXTENDED and
Martin v. Löwis <martin@v.loewis.de>
parents:
20583
diff
changeset
|
111 #ifdef __hpux |
|
dd78b1a71f3e
Check for HP/UX curses problems. Define _XOPEN_SOURCE_EXTENDED and
Martin v. Löwis <martin@v.loewis.de>
parents:
20583
diff
changeset
|
112 #define STRICT_SYSV_CURSES |
|
dd78b1a71f3e
Check for HP/UX curses problems. Define _XOPEN_SOURCE_EXTENDED and
Martin v. Löwis <martin@v.loewis.de>
parents:
20583
diff
changeset
|
113 #endif |
|
dd78b1a71f3e
Check for HP/UX curses problems. Define _XOPEN_SOURCE_EXTENDED and
Martin v. Löwis <martin@v.loewis.de>
parents:
20583
diff
changeset
|
114 |
|
17387
0ec06b4755db
Include py_curses.h *after* defining _XOPEN_SOURCE_EXTENDED.
Guido van Rossum <guido@python.org>
parents:
16351
diff
changeset
|
115 #define CURSES_MODULE |
|
0ec06b4755db
Include py_curses.h *after* defining _XOPEN_SOURCE_EXTENDED.
Guido van Rossum <guido@python.org>
parents:
16351
diff
changeset
|
116 #include "py_curses.h" |
|
0ec06b4755db
Include py_curses.h *after* defining _XOPEN_SOURCE_EXTENDED.
Guido van Rossum <guido@python.org>
parents:
16351
diff
changeset
|
117 |
|
15418
06465ed81826
Patch #102412 from mwh: Add support for the setupterm() function, to
Andrew M. Kuchling <amk@amk.ca>
parents:
15384
diff
changeset
|
118 /* These prototypes are in <term.h>, but including this header |
|
06465ed81826
Patch #102412 from mwh: Add support for the setupterm() function, to
Andrew M. Kuchling <amk@amk.ca>
parents:
15384
diff
changeset
|
119 #defines many common symbols (such as "lines") which breaks the |
|
06465ed81826
Patch #102412 from mwh: Add support for the setupterm() function, to
Andrew M. Kuchling <amk@amk.ca>
parents:
15384
diff
changeset
|
120 curses module in other ways. So the code will just specify |
|
06465ed81826
Patch #102412 from mwh: Add support for the setupterm() function, to
Andrew M. Kuchling <amk@amk.ca>
parents:
15384
diff
changeset
|
121 explicit prototypes here. */ |
|
06465ed81826
Patch #102412 from mwh: Add support for the setupterm() function, to
Andrew M. Kuchling <amk@amk.ca>
parents:
15384
diff
changeset
|
122 extern int setupterm(char *,int,int *); |
|
18749
c6ef71e943dd
Remove warnings from the SGI compiler.
Fred Drake <fdrake@acm.org>
parents:
18602
diff
changeset
|
123 #ifdef __sgi |
|
c6ef71e943dd
Remove warnings from the SGI compiler.
Fred Drake <fdrake@acm.org>
parents:
18602
diff
changeset
|
124 #include <term.h> |
|
15369
3abcb6966617
Patch from Randall Hopper to fix PR #116172, "curses module fails to
Andrew M. Kuchling <amk@amk.ca>
parents:
14334
diff
changeset
|
125 #endif |
|
3abcb6966617
Patch from Randall Hopper to fix PR #116172, "curses module fails to
Andrew M. Kuchling <amk@amk.ca>
parents:
14334
diff
changeset
|
126 |
|
25497
b526e12b941b
Patch #615069: Fix build problems on SCO Open Server 5. Backported to 2.2.
Martin v. Löwis <martin@v.loewis.de>
parents:
24471
diff
changeset
|
127 #if !defined(HAVE_NCURSES_H) && (defined(sgi) || defined(__sun) || defined(SCO5)) |
|
13708
fe89ea1c9108
Modified version of patch #100963 from Mark Favas: has_key() is an
Andrew M. Kuchling <amk@amk.ca>
parents:
13706
diff
changeset
|
128 #define STRICT_SYSV_CURSES /* Don't use ncurses extensions */ |
|
13040
12ac2c267b93
Fixes for compiling on Tru64.
Andrew M. Kuchling <amk@amk.ca>
parents:
13039
diff
changeset
|
129 typedef chtype attr_t; /* No attr_t type is available */ |
|
3417
e1df90205a33
Include ncurses.h where needed
Guido van Rossum <guido@python.org>
parents:
2569
diff
changeset
|
130 #endif |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
131 |
|
16351
ef32bfa5f5c6
Patch #103485 from Donn Cave: patches to make the module compile on AIX and
Andrew M. Kuchling <amk@amk.ca>
parents:
16350
diff
changeset
|
132 #if defined(_AIX) |
|
ef32bfa5f5c6
Patch #103485 from Donn Cave: patches to make the module compile on AIX and
Andrew M. Kuchling <amk@amk.ca>
parents:
16350
diff
changeset
|
133 #define STRICT_SYSV_CURSES |
|
ef32bfa5f5c6
Patch #103485 from Donn Cave: patches to make the module compile on AIX and
Andrew M. Kuchling <amk@amk.ca>
parents:
16350
diff
changeset
|
134 #endif |
|
ef32bfa5f5c6
Patch #103485 from Donn Cave: patches to make the module compile on AIX and
Andrew M. Kuchling <amk@amk.ca>
parents:
16350
diff
changeset
|
135 |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
136 /* Definition of exception curses.error */ |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
137 |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
138 static PyObject *PyCursesError; |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
139 |
|
15418
06465ed81826
Patch #102412 from mwh: Add support for the setupterm() function, to
Andrew M. Kuchling <amk@amk.ca>
parents:
15384
diff
changeset
|
140 /* Tells whether setupterm() has been called to initialise terminfo. */ |
|
06465ed81826
Patch #102412 from mwh: Add support for the setupterm() function, to
Andrew M. Kuchling <amk@amk.ca>
parents:
15384
diff
changeset
|
141 static int initialised_setupterm = FALSE; |
|
06465ed81826
Patch #102412 from mwh: Add support for the setupterm() function, to
Andrew M. Kuchling <amk@amk.ca>
parents:
15384
diff
changeset
|
142 |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
143 /* Tells whether initscr() has been called to initialise curses. */ |
|
2423
73eeff4d43f8
more fixes by Steve Clift
Guido van Rossum <guido@python.org>
parents:
2358
diff
changeset
|
144 static int initialised = FALSE; |
|
73eeff4d43f8
more fixes by Steve Clift
Guido van Rossum <guido@python.org>
parents:
2358
diff
changeset
|
145 |
|
15646
5b158fc0ed55
Export C API from this module.
Andrew M. Kuchling <amk@amk.ca>
parents:
15638
diff
changeset
|
146 /* Tells whether start_color() has been called to initialise color usage. */ |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
147 static int initialisedcolors = FALSE; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
148 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
149 /* Utility Macros */ |
|
15418
06465ed81826
Patch #102412 from mwh: Add support for the setupterm() function, to
Andrew M. Kuchling <amk@amk.ca>
parents:
15384
diff
changeset
|
150 #define PyCursesSetupTermCalled \ |
|
06465ed81826
Patch #102412 from mwh: Add support for the setupterm() function, to
Andrew M. Kuchling <amk@amk.ca>
parents:
15384
diff
changeset
|
151 if (initialised_setupterm != TRUE) { \ |
|
06465ed81826
Patch #102412 from mwh: Add support for the setupterm() function, to
Andrew M. Kuchling <amk@amk.ca>
parents:
15384
diff
changeset
|
152 PyErr_SetString(PyCursesError, \ |
|
06465ed81826
Patch #102412 from mwh: Add support for the setupterm() function, to
Andrew M. Kuchling <amk@amk.ca>
parents:
15384
diff
changeset
|
153 "must call (at least) setupterm() first"); \ |
|
15646
5b158fc0ed55
Export C API from this module.
Andrew M. Kuchling <amk@amk.ca>
parents:
15638
diff
changeset
|
154 return 0; } |
|
15418
06465ed81826
Patch #102412 from mwh: Add support for the setupterm() function, to
Andrew M. Kuchling <amk@amk.ca>
parents:
15384
diff
changeset
|
155 |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
156 #define PyCursesInitialised \ |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
157 if (initialised != TRUE) { \ |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
158 PyErr_SetString(PyCursesError, \ |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
159 "must call initscr() first"); \ |
|
15646
5b158fc0ed55
Export C API from this module.
Andrew M. Kuchling <amk@amk.ca>
parents:
15638
diff
changeset
|
160 return 0; } |
| 2357 | 161 |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
162 #define PyCursesInitialisedColor \ |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
163 if (initialisedcolors != TRUE) { \ |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
164 PyErr_SetString(PyCursesError, \ |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
165 "must call start_color() first"); \ |
|
15646
5b158fc0ed55
Export C API from this module.
Andrew M. Kuchling <amk@amk.ca>
parents:
15638
diff
changeset
|
166 return 0; } |
| 2357 | 167 |
|
35056
ee99db06c0eb
[Bug #1200134] Fix buffer overflow by constraining size of .getstr(), .instr() to size of allocated buffer
Andrew M. Kuchling <amk@amk.ca>
parents:
32959
diff
changeset
|
168 #ifndef MIN |
|
ee99db06c0eb
[Bug #1200134] Fix buffer overflow by constraining size of .getstr(), .instr() to size of allocated buffer
Andrew M. Kuchling <amk@amk.ca>
parents:
32959
diff
changeset
|
169 #define MIN(x,y) ((x) < (y) ? (x) : (y)) |
|
ee99db06c0eb
[Bug #1200134] Fix buffer overflow by constraining size of .getstr(), .instr() to size of allocated buffer
Andrew M. Kuchling <amk@amk.ca>
parents:
32959
diff
changeset
|
170 #endif |
|
ee99db06c0eb
[Bug #1200134] Fix buffer overflow by constraining size of .getstr(), .instr() to size of allocated buffer
Andrew M. Kuchling <amk@amk.ca>
parents:
32959
diff
changeset
|
171 |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
172 /* Utility Functions */ |
| 1858 | 173 |
| 2357 | 174 /* |
| 175 * Check the return code from a curses function and return None | |
|
15646
5b158fc0ed55
Export C API from this module.
Andrew M. Kuchling <amk@amk.ca>
parents:
15638
diff
changeset
|
176 * or raise an exception as appropriate. These are exported using the |
|
5b158fc0ed55
Export C API from this module.
Andrew M. Kuchling <amk@amk.ca>
parents:
15638
diff
changeset
|
177 * CObject API. |
| 2357 | 178 */ |
| 179 | |
| 180 static PyObject * | |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
181 PyCursesCheckERR(int code, char *fname) |
| 2357 | 182 { |
| 183 if (code != ERR) { | |
| 184 Py_INCREF(Py_None); | |
| 185 return Py_None; | |
| 186 } else { | |
| 187 if (fname == NULL) { | |
| 188 PyErr_SetString(PyCursesError, catchall_ERR); | |
| 189 } else { | |
|
12738
3d26cb3808a7
Changes by AMK: Use HAVE_NCURSES_H to include correct header file
Andrew M. Kuchling <amk@amk.ca>
parents:
12737
diff
changeset
|
190 PyErr_Format(PyCursesError, "%s() returned ERR", fname); |
| 2357 | 191 } |
| 192 return NULL; | |
| 193 } | |
| 194 } | |
| 195 | |
|
12738
3d26cb3808a7
Changes by AMK: Use HAVE_NCURSES_H to include correct header file
Andrew M. Kuchling <amk@amk.ca>
parents:
12737
diff
changeset
|
196 static int |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
197 PyCurses_ConvertToChtype(PyObject *obj, chtype *ch) |
|
2423
73eeff4d43f8
more fixes by Steve Clift
Guido van Rossum <guido@python.org>
parents:
2358
diff
changeset
|
198 { |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
199 if (PyInt_Check(obj)) { |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
200 *ch = (chtype) PyInt_AsLong(obj); |
|
47527
52294af4b663
This reverts r63675 based on the discussion in this thread:
Gregory P. Smith <greg@mad-scientist.com>
parents:
47294
diff
changeset
|
201 } else if(PyString_Check(obj) |
|
52294af4b663
This reverts r63675 based on the discussion in this thread:
Gregory P. Smith <greg@mad-scientist.com>
parents:
47294
diff
changeset
|
202 && (PyString_Size(obj) == 1)) { |
|
52294af4b663
This reverts r63675 based on the discussion in this thread:
Gregory P. Smith <greg@mad-scientist.com>
parents:
47294
diff
changeset
|
203 *ch = (chtype) *PyString_AsString(obj); |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
204 } else { |
|
2423
73eeff4d43f8
more fixes by Steve Clift
Guido van Rossum <guido@python.org>
parents:
2358
diff
changeset
|
205 return 0; |
|
73eeff4d43f8
more fixes by Steve Clift
Guido van Rossum <guido@python.org>
parents:
2358
diff
changeset
|
206 } |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
207 return 1; |
|
2423
73eeff4d43f8
more fixes by Steve Clift
Guido van Rossum <guido@python.org>
parents:
2358
diff
changeset
|
208 } |
|
73eeff4d43f8
more fixes by Steve Clift
Guido van Rossum <guido@python.org>
parents:
2358
diff
changeset
|
209 |
|
15646
5b158fc0ed55
Export C API from this module.
Andrew M. Kuchling <amk@amk.ca>
parents:
15638
diff
changeset
|
210 /* Function versions of the 3 functions for tested whether curses has been |
|
5b158fc0ed55
Export C API from this module.
Andrew M. Kuchling <amk@amk.ca>
parents:
15638
diff
changeset
|
211 initialised or not. */ |
|
5b158fc0ed55
Export C API from this module.
Andrew M. Kuchling <amk@amk.ca>
parents:
15638
diff
changeset
|
212 |
|
5b158fc0ed55
Export C API from this module.
Andrew M. Kuchling <amk@amk.ca>
parents:
15638
diff
changeset
|
213 static int func_PyCursesSetupTermCalled(void) |
|
5b158fc0ed55
Export C API from this module.
Andrew M. Kuchling <amk@amk.ca>
parents:
15638
diff
changeset
|
214 { |
|
5b158fc0ed55
Export C API from this module.
Andrew M. Kuchling <amk@amk.ca>
parents:
15638
diff
changeset
|
215 PyCursesSetupTermCalled; |
|
5b158fc0ed55
Export C API from this module.
Andrew M. Kuchling <amk@amk.ca>
parents:
15638
diff
changeset
|
216 return 1; |
|
5b158fc0ed55
Export C API from this module.
Andrew M. Kuchling <amk@amk.ca>
parents:
15638
diff
changeset
|
217 } |
|
5b158fc0ed55
Export C API from this module.
Andrew M. Kuchling <amk@amk.ca>
parents:
15638
diff
changeset
|
218 |
|
5b158fc0ed55
Export C API from this module.
Andrew M. Kuchling <amk@amk.ca>
parents:
15638
diff
changeset
|
219 static int func_PyCursesInitialised(void) |
|
5b158fc0ed55
Export C API from this module.
Andrew M. Kuchling <amk@amk.ca>
parents:
15638
diff
changeset
|
220 { |
|
5b158fc0ed55
Export C API from this module.
Andrew M. Kuchling <amk@amk.ca>
parents:
15638
diff
changeset
|
221 PyCursesInitialised; |
|
5b158fc0ed55
Export C API from this module.
Andrew M. Kuchling <amk@amk.ca>
parents:
15638
diff
changeset
|
222 return 1; |
|
5b158fc0ed55
Export C API from this module.
Andrew M. Kuchling <amk@amk.ca>
parents:
15638
diff
changeset
|
223 } |
|
5b158fc0ed55
Export C API from this module.
Andrew M. Kuchling <amk@amk.ca>
parents:
15638
diff
changeset
|
224 |
|
5b158fc0ed55
Export C API from this module.
Andrew M. Kuchling <amk@amk.ca>
parents:
15638
diff
changeset
|
225 static int func_PyCursesInitialisedColor(void) |
|
5b158fc0ed55
Export C API from this module.
Andrew M. Kuchling <amk@amk.ca>
parents:
15638
diff
changeset
|
226 { |
|
5b158fc0ed55
Export C API from this module.
Andrew M. Kuchling <amk@amk.ca>
parents:
15638
diff
changeset
|
227 PyCursesInitialisedColor; |
|
5b158fc0ed55
Export C API from this module.
Andrew M. Kuchling <amk@amk.ca>
parents:
15638
diff
changeset
|
228 return 1; |
|
5b158fc0ed55
Export C API from this module.
Andrew M. Kuchling <amk@amk.ca>
parents:
15638
diff
changeset
|
229 } |
|
5b158fc0ed55
Export C API from this module.
Andrew M. Kuchling <amk@amk.ca>
parents:
15638
diff
changeset
|
230 |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
231 /***************************************************************************** |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
232 The Window Object |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
233 ******************************************************************************/ |
|
2423
73eeff4d43f8
more fixes by Steve Clift
Guido van Rossum <guido@python.org>
parents:
2358
diff
changeset
|
234 |
|
15646
5b158fc0ed55
Export C API from this module.
Andrew M. Kuchling <amk@amk.ca>
parents:
15638
diff
changeset
|
235 /* Definition of the window type */ |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
236 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
237 PyTypeObject PyCursesWindow_Type; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
238 |
|
15646
5b158fc0ed55
Export C API from this module.
Andrew M. Kuchling <amk@amk.ca>
parents:
15638
diff
changeset
|
239 /* Function prototype macros for Window object |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
240 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
241 X - function name |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
242 TYPE - parameter Type |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
243 ERGSTR - format string for construction of the return value |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
244 PARSESTR - format string for argument parsing |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
245 */ |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
246 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
247 #define Window_NoArgNoReturnFunction(X) \ |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
248 static PyObject *PyCursesWindow_ ## X (PyCursesWindowObject *self, PyObject *args) \ |
|
21756
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
249 { return PyCursesCheckERR(X(self->win), # X); } |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
250 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
251 #define Window_NoArgTrueFalseFunction(X) \ |
|
21756
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
252 static PyObject * PyCursesWindow_ ## X (PyCursesWindowObject *self) \ |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
253 { \ |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
254 if (X (self->win) == FALSE) { Py_INCREF(Py_False); return Py_False; } \ |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
255 else { Py_INCREF(Py_True); return Py_True; } } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
256 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
257 #define Window_NoArgNoReturnVoidFunction(X) \ |
|
21756
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
258 static PyObject * PyCursesWindow_ ## X (PyCursesWindowObject *self) \ |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
259 { \ |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
260 X(self->win); Py_INCREF(Py_None); return Py_None; } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
261 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
262 #define Window_NoArg2TupleReturnFunction(X, TYPE, ERGSTR) \ |
|
21756
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
263 static PyObject * PyCursesWindow_ ## X (PyCursesWindowObject *self) \ |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
264 { \ |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
265 TYPE arg1, arg2; \ |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
266 X(self->win,arg1,arg2); return Py_BuildValue(ERGSTR, arg1, arg2); } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
267 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
268 #define Window_OneArgNoReturnVoidFunction(X, TYPE, PARSESTR) \ |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
269 static PyObject * PyCursesWindow_ ## X (PyCursesWindowObject *self, PyObject *args) \ |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
270 { \ |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
271 TYPE arg1; \ |
|
21756
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
272 if (!PyArg_ParseTuple(args, PARSESTR, &arg1)) return NULL; \ |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
273 X(self->win,arg1); Py_INCREF(Py_None); return Py_None; } |
| 2357 | 274 |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
275 #define Window_OneArgNoReturnFunction(X, TYPE, PARSESTR) \ |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
276 static PyObject * PyCursesWindow_ ## X (PyCursesWindowObject *self, PyObject *args) \ |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
277 { \ |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
278 TYPE arg1; \ |
|
21756
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
279 if (!PyArg_ParseTuple(args,PARSESTR, &arg1)) return NULL; \ |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
280 return PyCursesCheckERR(X(self->win, arg1), # X); } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
281 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
282 #define Window_TwoArgNoReturnFunction(X, TYPE, PARSESTR) \ |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
283 static PyObject * PyCursesWindow_ ## X (PyCursesWindowObject *self, PyObject *args) \ |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
284 { \ |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
285 TYPE arg1, arg2; \ |
|
21756
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
286 if (!PyArg_ParseTuple(args,PARSESTR, &arg1, &arg2)) return NULL; \ |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
287 return PyCursesCheckERR(X(self->win, arg1, arg2), # X); } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
288 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
289 /* ------------- WINDOW routines --------------- */ |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
290 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
291 Window_NoArgNoReturnFunction(untouchwin) |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
292 Window_NoArgNoReturnFunction(touchwin) |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
293 Window_NoArgNoReturnFunction(redrawwin) |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
294 Window_NoArgNoReturnFunction(winsertln) |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
295 Window_NoArgNoReturnFunction(werase) |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
296 Window_NoArgNoReturnFunction(wdeleteln) |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
297 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
298 Window_NoArgTrueFalseFunction(is_wintouched) |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
299 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
300 Window_NoArgNoReturnVoidFunction(wsyncup) |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
301 Window_NoArgNoReturnVoidFunction(wsyncdown) |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
302 Window_NoArgNoReturnVoidFunction(wstandend) |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
303 Window_NoArgNoReturnVoidFunction(wstandout) |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
304 Window_NoArgNoReturnVoidFunction(wcursyncup) |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
305 Window_NoArgNoReturnVoidFunction(wclrtoeol) |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
306 Window_NoArgNoReturnVoidFunction(wclrtobot) |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
307 Window_NoArgNoReturnVoidFunction(wclear) |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
308 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
309 Window_OneArgNoReturnVoidFunction(idcok, int, "i;True(1) or False(0)") |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
310 Window_OneArgNoReturnVoidFunction(immedok, int, "i;True(1) or False(0)") |
|
12974
e7992d0d6808
Added .timeout() method and .typeahead() function
Andrew M. Kuchling <amk@amk.ca>
parents:
12913
diff
changeset
|
311 Window_OneArgNoReturnVoidFunction(wtimeout, int, "i;delay") |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
312 |
|
21756
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
313 Window_NoArg2TupleReturnFunction(getyx, int, "ii") |
|
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
314 Window_NoArg2TupleReturnFunction(getbegyx, int, "ii") |
|
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
315 Window_NoArg2TupleReturnFunction(getmaxyx, int, "ii") |
|
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
316 Window_NoArg2TupleReturnFunction(getparyx, int, "ii") |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
317 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
318 Window_OneArgNoReturnFunction(clearok, int, "i;True(1) or False(0)") |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
319 Window_OneArgNoReturnFunction(idlok, int, "i;True(1) or False(0)") |
|
16351
ef32bfa5f5c6
Patch #103485 from Donn Cave: patches to make the module compile on AIX and
Andrew M. Kuchling <amk@amk.ca>
parents:
16350
diff
changeset
|
320 #if defined(__NetBSD__) |
|
ef32bfa5f5c6
Patch #103485 from Donn Cave: patches to make the module compile on AIX and
Andrew M. Kuchling <amk@amk.ca>
parents:
16350
diff
changeset
|
321 Window_OneArgNoReturnVoidFunction(keypad, int, "i;True(1) or False(0)") |
|
ef32bfa5f5c6
Patch #103485 from Donn Cave: patches to make the module compile on AIX and
Andrew M. Kuchling <amk@amk.ca>
parents:
16350
diff
changeset
|
322 #else |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
323 Window_OneArgNoReturnFunction(keypad, int, "i;True(1) or False(0)") |
|
16351
ef32bfa5f5c6
Patch #103485 from Donn Cave: patches to make the module compile on AIX and
Andrew M. Kuchling <amk@amk.ca>
parents:
16350
diff
changeset
|
324 #endif |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
325 Window_OneArgNoReturnFunction(leaveok, int, "i;True(1) or False(0)") |
|
16351
ef32bfa5f5c6
Patch #103485 from Donn Cave: patches to make the module compile on AIX and
Andrew M. Kuchling <amk@amk.ca>
parents:
16350
diff
changeset
|
326 #if defined(__NetBSD__) |
|
ef32bfa5f5c6
Patch #103485 from Donn Cave: patches to make the module compile on AIX and
Andrew M. Kuchling <amk@amk.ca>
parents:
16350
diff
changeset
|
327 Window_OneArgNoReturnVoidFunction(nodelay, int, "i;True(1) or False(0)") |
|
ef32bfa5f5c6
Patch #103485 from Donn Cave: patches to make the module compile on AIX and
Andrew M. Kuchling <amk@amk.ca>
parents:
16350
diff
changeset
|
328 #else |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
329 Window_OneArgNoReturnFunction(nodelay, int, "i;True(1) or False(0)") |
|
16351
ef32bfa5f5c6
Patch #103485 from Donn Cave: patches to make the module compile on AIX and
Andrew M. Kuchling <amk@amk.ca>
parents:
16350
diff
changeset
|
330 #endif |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
331 Window_OneArgNoReturnFunction(notimeout, int, "i;True(1) or False(0)") |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
332 Window_OneArgNoReturnFunction(scrollok, int, "i;True(1) or False(0)") |
|
12738
3d26cb3808a7
Changes by AMK: Use HAVE_NCURSES_H to include correct header file
Andrew M. Kuchling <amk@amk.ca>
parents:
12737
diff
changeset
|
333 Window_OneArgNoReturnFunction(winsdelln, int, "i;nlines") |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
334 Window_OneArgNoReturnFunction(syncok, int, "i;True(1) or False(0)") |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
335 |
|
21756
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
336 Window_TwoArgNoReturnFunction(mvwin, int, "ii;y,x") |
|
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
337 Window_TwoArgNoReturnFunction(mvderwin, int, "ii;y,x") |
|
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
338 Window_TwoArgNoReturnFunction(wmove, int, "ii;y,x") |
|
13040
12ac2c267b93
Fixes for compiling on Tru64.
Andrew M. Kuchling <amk@amk.ca>
parents:
13039
diff
changeset
|
339 #ifndef STRICT_SYSV_CURSES |
|
21756
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
340 Window_TwoArgNoReturnFunction(wresize, int, "ii;lines,columns") |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
341 #endif |
| 2357 | 342 |
|
12738
3d26cb3808a7
Changes by AMK: Use HAVE_NCURSES_H to include correct header file
Andrew M. Kuchling <amk@amk.ca>
parents:
12737
diff
changeset
|
343 /* Allocation and deallocation of Window Objects */ |
| 2357 | 344 |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
345 static PyObject * |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
346 PyCursesWindow_New(WINDOW *win) |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
347 { |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
348 PyCursesWindowObject *wo; |
| 2357 | 349 |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
350 wo = PyObject_NEW(PyCursesWindowObject, &PyCursesWindow_Type); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
351 if (wo == NULL) return NULL; |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
352 wo->win = win; |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
353 return (PyObject *)wo; |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
354 } |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
355 |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
356 static void |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
357 PyCursesWindow_Dealloc(PyCursesWindowObject *wo) |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
358 { |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
359 if (wo->win != stdscr) delwin(wo->win); |
| 21845 | 360 PyObject_DEL(wo); |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
361 } |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
362 |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
363 /* Addch, Addstr, Addnstr */ |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
364 |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
365 static PyObject * |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
366 PyCursesWindow_AddCh(PyCursesWindowObject *self, PyObject *args) |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
367 { |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
368 int rtn, x, y, use_xy = FALSE; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
369 PyObject *temp; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
370 chtype ch = 0; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
371 attr_t attr = A_NORMAL; |
|
44595
d1a1ba502579
Patch 1114: fix compilation of curses module on 64-bit AIX, and any other LP64 platforms where attr_t isn't a C long
Andrew M. Kuchling <amk@amk.ca>
parents:
44439
diff
changeset
|
372 long lattr; |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
373 |
|
21756
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
374 switch (PyTuple_Size(args)) { |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
375 case 1: |
|
21756
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
376 if (!PyArg_ParseTuple(args, "O;ch or int", &temp)) |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
377 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
378 break; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
379 case 2: |
|
44595
d1a1ba502579
Patch 1114: fix compilation of curses module on 64-bit AIX, and any other LP64 platforms where attr_t isn't a C long
Andrew M. Kuchling <amk@amk.ca>
parents:
44439
diff
changeset
|
380 if (!PyArg_ParseTuple(args, "Ol;ch or int,attr", &temp, &lattr)) |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
381 return NULL; |
|
44595
d1a1ba502579
Patch 1114: fix compilation of curses module on 64-bit AIX, and any other LP64 platforms where attr_t isn't a C long
Andrew M. Kuchling <amk@amk.ca>
parents:
44439
diff
changeset
|
382 attr = lattr; |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
383 break; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
384 case 3: |
|
21756
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
385 if (!PyArg_ParseTuple(args,"iiO;y,x,ch or int", &y, &x, &temp)) |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
386 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
387 use_xy = TRUE; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
388 break; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
389 case 4: |
|
21756
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
390 if (!PyArg_ParseTuple(args,"iiOl;y,x,ch or int, attr", |
|
44595
d1a1ba502579
Patch 1114: fix compilation of curses module on 64-bit AIX, and any other LP64 platforms where attr_t isn't a C long
Andrew M. Kuchling <amk@amk.ca>
parents:
44439
diff
changeset
|
391 &y, &x, &temp, &lattr)) |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
392 return NULL; |
|
44595
d1a1ba502579
Patch 1114: fix compilation of curses module on 64-bit AIX, and any other LP64 platforms where attr_t isn't a C long
Andrew M. Kuchling <amk@amk.ca>
parents:
44439
diff
changeset
|
393 attr = lattr; |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
394 use_xy = TRUE; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
395 break; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
396 default: |
|
20583
b5ca0687ba6a
Add two forgotten 'break' statements
Andrew M. Kuchling <amk@amk.ca>
parents:
20412
diff
changeset
|
397 PyErr_SetString(PyExc_TypeError, "addch requires 1 to 4 arguments"); |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
398 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
399 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
400 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
401 if (!PyCurses_ConvertToChtype(temp, &ch)) { |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
402 PyErr_SetString(PyExc_TypeError, "argument 1 or 3 must be a ch or an int"); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
403 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
404 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
405 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
406 if (use_xy == TRUE) |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
407 rtn = mvwaddch(self->win,y,x, ch | attr); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
408 else { |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
409 rtn = waddch(self->win, ch | attr); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
410 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
411 return PyCursesCheckERR(rtn, "addch"); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
412 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
413 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
414 static PyObject * |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
415 PyCursesWindow_AddStr(PyCursesWindowObject *self, PyObject *args) |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
416 { |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
417 int rtn; |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
418 int x, y; |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
419 char *str; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
420 attr_t attr = A_NORMAL , attr_old = A_NORMAL; |
|
44595
d1a1ba502579
Patch 1114: fix compilation of curses module on 64-bit AIX, and any other LP64 platforms where attr_t isn't a C long
Andrew M. Kuchling <amk@amk.ca>
parents:
44439
diff
changeset
|
421 long lattr; |
| 2357 | 422 int use_xy = FALSE, use_attr = FALSE; |
| 423 | |
|
21756
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
424 switch (PyTuple_Size(args)) { |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
425 case 1: |
|
21756
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
426 if (!PyArg_ParseTuple(args,"s;str", &str)) |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
427 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
428 break; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
429 case 2: |
|
44595
d1a1ba502579
Patch 1114: fix compilation of curses module on 64-bit AIX, and any other LP64 platforms where attr_t isn't a C long
Andrew M. Kuchling <amk@amk.ca>
parents:
44439
diff
changeset
|
430 if (!PyArg_ParseTuple(args,"sl;str,attr", &str, &lattr)) |
| 2357 | 431 return NULL; |
|
44595
d1a1ba502579
Patch 1114: fix compilation of curses module on 64-bit AIX, and any other LP64 platforms where attr_t isn't a C long
Andrew M. Kuchling <amk@amk.ca>
parents:
44439
diff
changeset
|
432 attr = lattr; |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
433 use_attr = TRUE; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
434 break; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
435 case 3: |
|
21756
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
436 if (!PyArg_ParseTuple(args,"iis;int,int,str", &y, &x, &str)) |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
437 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
438 use_xy = TRUE; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
439 break; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
440 case 4: |
|
44595
d1a1ba502579
Patch 1114: fix compilation of curses module on 64-bit AIX, and any other LP64 platforms where attr_t isn't a C long
Andrew M. Kuchling <amk@amk.ca>
parents:
44439
diff
changeset
|
441 if (!PyArg_ParseTuple(args,"iisl;int,int,str,attr", &y, &x, &str, &lattr)) |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
442 return NULL; |
|
44595
d1a1ba502579
Patch 1114: fix compilation of curses module on 64-bit AIX, and any other LP64 platforms where attr_t isn't a C long
Andrew M. Kuchling <amk@amk.ca>
parents:
44439
diff
changeset
|
443 attr = lattr; |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
444 use_xy = use_attr = TRUE; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
445 break; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
446 default: |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
447 PyErr_SetString(PyExc_TypeError, "addstr requires 1 to 4 arguments"); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
448 return NULL; |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
449 } |
| 2357 | 450 |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
451 if (use_attr == TRUE) { |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
452 attr_old = getattrs(self->win); |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
453 wattrset(self->win,attr); |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
454 } |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
455 if (use_xy == TRUE) |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
456 rtn = mvwaddstr(self->win,y,x,str); |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
457 else |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
458 rtn = waddstr(self->win,str); |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
459 if (use_attr == TRUE) |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
460 wattrset(self->win,attr_old); |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
461 return PyCursesCheckERR(rtn, "addstr"); |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
462 } |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
463 |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
464 static PyObject * |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
465 PyCursesWindow_AddNStr(PyCursesWindowObject *self, PyObject *args) |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
466 { |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
467 int rtn, x, y, n; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
468 char *str; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
469 attr_t attr = A_NORMAL , attr_old = A_NORMAL; |
|
44595
d1a1ba502579
Patch 1114: fix compilation of curses module on 64-bit AIX, and any other LP64 platforms where attr_t isn't a C long
Andrew M. Kuchling <amk@amk.ca>
parents:
44439
diff
changeset
|
470 long lattr; |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
471 int use_xy = FALSE, use_attr = FALSE; |
| 2357 | 472 |
|
21756
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
473 switch (PyTuple_Size(args)) { |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
474 case 2: |
|
21756
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
475 if (!PyArg_ParseTuple(args,"si;str,n", &str, &n)) |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
476 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
477 break; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
478 case 3: |
|
44595
d1a1ba502579
Patch 1114: fix compilation of curses module on 64-bit AIX, and any other LP64 platforms where attr_t isn't a C long
Andrew M. Kuchling <amk@amk.ca>
parents:
44439
diff
changeset
|
479 if (!PyArg_ParseTuple(args,"sil;str,n,attr", &str, &n, &lattr)) |
| 2357 | 480 return NULL; |
|
44595
d1a1ba502579
Patch 1114: fix compilation of curses module on 64-bit AIX, and any other LP64 platforms where attr_t isn't a C long
Andrew M. Kuchling <amk@amk.ca>
parents:
44439
diff
changeset
|
481 attr = lattr; |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
482 use_attr = TRUE; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
483 break; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
484 case 4: |
|
21756
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
485 if (!PyArg_ParseTuple(args,"iisi;y,x,str,n", &y, &x, &str, &n)) |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
486 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
487 use_xy = TRUE; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
488 break; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
489 case 5: |
|
44595
d1a1ba502579
Patch 1114: fix compilation of curses module on 64-bit AIX, and any other LP64 platforms where attr_t isn't a C long
Andrew M. Kuchling <amk@amk.ca>
parents:
44439
diff
changeset
|
490 if (!PyArg_ParseTuple(args,"iisil;y,x,str,n,attr", &y, &x, &str, &n, &lattr)) |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
491 return NULL; |
|
44595
d1a1ba502579
Patch 1114: fix compilation of curses module on 64-bit AIX, and any other LP64 platforms where attr_t isn't a C long
Andrew M. Kuchling <amk@amk.ca>
parents:
44439
diff
changeset
|
492 attr = lattr; |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
493 use_xy = use_attr = TRUE; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
494 break; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
495 default: |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
496 PyErr_SetString(PyExc_TypeError, "addnstr requires 2 to 5 arguments"); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
497 return NULL; |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
498 } |
| 2357 | 499 |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
500 if (use_attr == TRUE) { |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
501 attr_old = getattrs(self->win); |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
502 wattrset(self->win,attr); |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
503 } |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
504 if (use_xy == TRUE) |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
505 rtn = mvwaddnstr(self->win,y,x,str,n); |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
506 else |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
507 rtn = waddnstr(self->win,str,n); |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
508 if (use_attr == TRUE) |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
509 wattrset(self->win,attr_old); |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
510 return PyCursesCheckERR(rtn, "addnstr"); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
511 } |
| 2357 | 512 |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
513 static PyObject * |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
514 PyCursesWindow_Bkgd(PyCursesWindowObject *self, PyObject *args) |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
515 { |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
516 PyObject *temp; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
517 chtype bkgd; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
518 attr_t attr = A_NORMAL; |
|
44595
d1a1ba502579
Patch 1114: fix compilation of curses module on 64-bit AIX, and any other LP64 platforms where attr_t isn't a C long
Andrew M. Kuchling <amk@amk.ca>
parents:
44439
diff
changeset
|
519 long lattr; |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
520 |
|
21756
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
521 switch (PyTuple_Size(args)) { |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
522 case 1: |
|
21756
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
523 if (!PyArg_ParseTuple(args, "O;ch or int", &temp)) |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
524 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
525 break; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
526 case 2: |
|
44595
d1a1ba502579
Patch 1114: fix compilation of curses module on 64-bit AIX, and any other LP64 platforms where attr_t isn't a C long
Andrew M. Kuchling <amk@amk.ca>
parents:
44439
diff
changeset
|
527 if (!PyArg_ParseTuple(args,"Ol;ch or int,attr", &temp, &lattr)) |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
528 return NULL; |
|
44595
d1a1ba502579
Patch 1114: fix compilation of curses module on 64-bit AIX, and any other LP64 platforms where attr_t isn't a C long
Andrew M. Kuchling <amk@amk.ca>
parents:
44439
diff
changeset
|
529 attr = lattr; |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
530 break; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
531 default: |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
532 PyErr_SetString(PyExc_TypeError, "bkgd requires 1 or 2 arguments"); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
533 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
534 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
535 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
536 if (!PyCurses_ConvertToChtype(temp, &bkgd)) { |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
537 PyErr_SetString(PyExc_TypeError, "argument 1 or 3 must be a ch or an int"); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
538 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
539 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
540 |
|
19696
843da9795381
[Bug #457654] bkgd() used a hard-coded A_NORMAL attribute, when it should
Andrew M. Kuchling <amk@amk.ca>
parents:
18749
diff
changeset
|
541 return PyCursesCheckERR(wbkgd(self->win, bkgd | attr), "bkgd"); |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
542 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
543 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
544 static PyObject * |
|
44595
d1a1ba502579
Patch 1114: fix compilation of curses module on 64-bit AIX, and any other LP64 platforms where attr_t isn't a C long
Andrew M. Kuchling <amk@amk.ca>
parents:
44439
diff
changeset
|
545 PyCursesWindow_AttrOff(PyCursesWindowObject *self, PyObject *args) |
|
d1a1ba502579
Patch 1114: fix compilation of curses module on 64-bit AIX, and any other LP64 platforms where attr_t isn't a C long
Andrew M. Kuchling <amk@amk.ca>
parents:
44439
diff
changeset
|
546 { |
|
d1a1ba502579
Patch 1114: fix compilation of curses module on 64-bit AIX, and any other LP64 platforms where attr_t isn't a C long
Andrew M. Kuchling <amk@amk.ca>
parents:
44439
diff
changeset
|
547 long lattr; |
|
d1a1ba502579
Patch 1114: fix compilation of curses module on 64-bit AIX, and any other LP64 platforms where attr_t isn't a C long
Andrew M. Kuchling <amk@amk.ca>
parents:
44439
diff
changeset
|
548 if (!PyArg_ParseTuple(args,"l;attr", &lattr)) |
|
d1a1ba502579
Patch 1114: fix compilation of curses module on 64-bit AIX, and any other LP64 platforms where attr_t isn't a C long
Andrew M. Kuchling <amk@amk.ca>
parents:
44439
diff
changeset
|
549 return NULL; |
|
d1a1ba502579
Patch 1114: fix compilation of curses module on 64-bit AIX, and any other LP64 platforms where attr_t isn't a C long
Andrew M. Kuchling <amk@amk.ca>
parents:
44439
diff
changeset
|
550 return PyCursesCheckERR(wattroff(self->win, (attr_t)lattr), "attroff"); |
|
d1a1ba502579
Patch 1114: fix compilation of curses module on 64-bit AIX, and any other LP64 platforms where attr_t isn't a C long
Andrew M. Kuchling <amk@amk.ca>
parents:
44439
diff
changeset
|
551 } |
|
d1a1ba502579
Patch 1114: fix compilation of curses module on 64-bit AIX, and any other LP64 platforms where attr_t isn't a C long
Andrew M. Kuchling <amk@amk.ca>
parents:
44439
diff
changeset
|
552 |
|
d1a1ba502579
Patch 1114: fix compilation of curses module on 64-bit AIX, and any other LP64 platforms where attr_t isn't a C long
Andrew M. Kuchling <amk@amk.ca>
parents:
44439
diff
changeset
|
553 static PyObject * |
|
d1a1ba502579
Patch 1114: fix compilation of curses module on 64-bit AIX, and any other LP64 platforms where attr_t isn't a C long
Andrew M. Kuchling <amk@amk.ca>
parents:
44439
diff
changeset
|
554 PyCursesWindow_AttrOn(PyCursesWindowObject *self, PyObject *args) |
|
d1a1ba502579
Patch 1114: fix compilation of curses module on 64-bit AIX, and any other LP64 platforms where attr_t isn't a C long
Andrew M. Kuchling <amk@amk.ca>
parents:
44439
diff
changeset
|
555 { |
|
d1a1ba502579
Patch 1114: fix compilation of curses module on 64-bit AIX, and any other LP64 platforms where attr_t isn't a C long
Andrew M. Kuchling <amk@amk.ca>
parents:
44439
diff
changeset
|
556 long lattr; |
|
d1a1ba502579
Patch 1114: fix compilation of curses module on 64-bit AIX, and any other LP64 platforms where attr_t isn't a C long
Andrew M. Kuchling <amk@amk.ca>
parents:
44439
diff
changeset
|
557 if (!PyArg_ParseTuple(args,"l;attr", &lattr)) |
|
d1a1ba502579
Patch 1114: fix compilation of curses module on 64-bit AIX, and any other LP64 platforms where attr_t isn't a C long
Andrew M. Kuchling <amk@amk.ca>
parents:
44439
diff
changeset
|
558 return NULL; |
|
d1a1ba502579
Patch 1114: fix compilation of curses module on 64-bit AIX, and any other LP64 platforms where attr_t isn't a C long
Andrew M. Kuchling <amk@amk.ca>
parents:
44439
diff
changeset
|
559 return PyCursesCheckERR(wattron(self->win, (attr_t)lattr), "attron"); |
|
d1a1ba502579
Patch 1114: fix compilation of curses module on 64-bit AIX, and any other LP64 platforms where attr_t isn't a C long
Andrew M. Kuchling <amk@amk.ca>
parents:
44439
diff
changeset
|
560 } |
|
d1a1ba502579
Patch 1114: fix compilation of curses module on 64-bit AIX, and any other LP64 platforms where attr_t isn't a C long
Andrew M. Kuchling <amk@amk.ca>
parents:
44439
diff
changeset
|
561 |
|
d1a1ba502579
Patch 1114: fix compilation of curses module on 64-bit AIX, and any other LP64 platforms where attr_t isn't a C long
Andrew M. Kuchling <amk@amk.ca>
parents:
44439
diff
changeset
|
562 static PyObject * |
|
d1a1ba502579
Patch 1114: fix compilation of curses module on 64-bit AIX, and any other LP64 platforms where attr_t isn't a C long
Andrew M. Kuchling <amk@amk.ca>
parents:
44439
diff
changeset
|
563 PyCursesWindow_AttrSet(PyCursesWindowObject *self, PyObject *args) |
|
d1a1ba502579
Patch 1114: fix compilation of curses module on 64-bit AIX, and any other LP64 platforms where attr_t isn't a C long
Andrew M. Kuchling <amk@amk.ca>
parents:
44439
diff
changeset
|
564 { |
|
d1a1ba502579
Patch 1114: fix compilation of curses module on 64-bit AIX, and any other LP64 platforms where attr_t isn't a C long
Andrew M. Kuchling <amk@amk.ca>
parents:
44439
diff
changeset
|
565 long lattr; |
|
d1a1ba502579
Patch 1114: fix compilation of curses module on 64-bit AIX, and any other LP64 platforms where attr_t isn't a C long
Andrew M. Kuchling <amk@amk.ca>
parents:
44439
diff
changeset
|
566 if (!PyArg_ParseTuple(args,"l;attr", &lattr)) |
|
d1a1ba502579
Patch 1114: fix compilation of curses module on 64-bit AIX, and any other LP64 platforms where attr_t isn't a C long
Andrew M. Kuchling <amk@amk.ca>
parents:
44439
diff
changeset
|
567 return NULL; |
|
d1a1ba502579
Patch 1114: fix compilation of curses module on 64-bit AIX, and any other LP64 platforms where attr_t isn't a C long
Andrew M. Kuchling <amk@amk.ca>
parents:
44439
diff
changeset
|
568 return PyCursesCheckERR(wattrset(self->win, (attr_t)lattr), "attrset"); |
|
d1a1ba502579
Patch 1114: fix compilation of curses module on 64-bit AIX, and any other LP64 platforms where attr_t isn't a C long
Andrew M. Kuchling <amk@amk.ca>
parents:
44439
diff
changeset
|
569 } |
|
d1a1ba502579
Patch 1114: fix compilation of curses module on 64-bit AIX, and any other LP64 platforms where attr_t isn't a C long
Andrew M. Kuchling <amk@amk.ca>
parents:
44439
diff
changeset
|
570 |
|
d1a1ba502579
Patch 1114: fix compilation of curses module on 64-bit AIX, and any other LP64 platforms where attr_t isn't a C long
Andrew M. Kuchling <amk@amk.ca>
parents:
44439
diff
changeset
|
571 static PyObject * |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
572 PyCursesWindow_BkgdSet(PyCursesWindowObject *self, PyObject *args) |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
573 { |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
574 PyObject *temp; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
575 chtype bkgd; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
576 attr_t attr = A_NORMAL; |
|
44595
d1a1ba502579
Patch 1114: fix compilation of curses module on 64-bit AIX, and any other LP64 platforms where attr_t isn't a C long
Andrew M. Kuchling <amk@amk.ca>
parents:
44439
diff
changeset
|
577 long lattr; |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
578 |
|
21756
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
579 switch (PyTuple_Size(args)) { |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
580 case 1: |
|
21756
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
581 if (!PyArg_ParseTuple(args, "O;ch or int", &temp)) |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
582 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
583 break; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
584 case 2: |
|
44595
d1a1ba502579
Patch 1114: fix compilation of curses module on 64-bit AIX, and any other LP64 platforms where attr_t isn't a C long
Andrew M. Kuchling <amk@amk.ca>
parents:
44439
diff
changeset
|
585 if (!PyArg_ParseTuple(args,"Ol;ch or int,attr", &temp, &lattr)) |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
586 return NULL; |
|
44595
d1a1ba502579
Patch 1114: fix compilation of curses module on 64-bit AIX, and any other LP64 platforms where attr_t isn't a C long
Andrew M. Kuchling <amk@amk.ca>
parents:
44439
diff
changeset
|
587 attr = lattr; |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
588 break; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
589 default: |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
590 PyErr_SetString(PyExc_TypeError, "bkgdset requires 1 or 2 arguments"); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
591 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
592 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
593 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
594 if (!PyCurses_ConvertToChtype(temp, &bkgd)) { |
|
12738
3d26cb3808a7
Changes by AMK: Use HAVE_NCURSES_H to include correct header file
Andrew M. Kuchling <amk@amk.ca>
parents:
12737
diff
changeset
|
595 PyErr_SetString(PyExc_TypeError, "argument 1 must be a ch or an int"); |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
596 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
597 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
598 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
599 wbkgdset(self->win, bkgd | attr); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
600 return PyCursesCheckERR(0, "bkgdset"); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
601 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
602 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
603 static PyObject * |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
604 PyCursesWindow_Border(PyCursesWindowObject *self, PyObject *args) |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
605 { |
|
20583
b5ca0687ba6a
Add two forgotten 'break' statements
Andrew M. Kuchling <amk@amk.ca>
parents:
20412
diff
changeset
|
606 PyObject *temp[8]; |
|
b5ca0687ba6a
Add two forgotten 'break' statements
Andrew M. Kuchling <amk@amk.ca>
parents:
20412
diff
changeset
|
607 chtype ch[8]; |
|
b5ca0687ba6a
Add two forgotten 'break' statements
Andrew M. Kuchling <amk@amk.ca>
parents:
20412
diff
changeset
|
608 int i; |
|
b5ca0687ba6a
Add two forgotten 'break' statements
Andrew M. Kuchling <amk@amk.ca>
parents:
20412
diff
changeset
|
609 |
|
b5ca0687ba6a
Add two forgotten 'break' statements
Andrew M. Kuchling <amk@amk.ca>
parents:
20412
diff
changeset
|
610 /* Clear the array of parameters */ |
|
b5ca0687ba6a
Add two forgotten 'break' statements
Andrew M. Kuchling <amk@amk.ca>
parents:
20412
diff
changeset
|
611 for(i=0; i<8; i++) { |
|
b5ca0687ba6a
Add two forgotten 'break' statements
Andrew M. Kuchling <amk@amk.ca>
parents:
20412
diff
changeset
|
612 temp[i] = NULL; |
|
b5ca0687ba6a
Add two forgotten 'break' statements
Andrew M. Kuchling <amk@amk.ca>
parents:
20412
diff
changeset
|
613 ch[i] = 0; |
|
b5ca0687ba6a
Add two forgotten 'break' statements
Andrew M. Kuchling <amk@amk.ca>
parents:
20412
diff
changeset
|
614 } |
|
b5ca0687ba6a
Add two forgotten 'break' statements
Andrew M. Kuchling <amk@amk.ca>
parents:
20412
diff
changeset
|
615 |
|
b5ca0687ba6a
Add two forgotten 'break' statements
Andrew M. Kuchling <amk@amk.ca>
parents:
20412
diff
changeset
|
616 if (!PyArg_ParseTuple(args,"|OOOOOOOO;ls,rs,ts,bs,tl,tr,bl,br", |
|
b5ca0687ba6a
Add two forgotten 'break' statements
Andrew M. Kuchling <amk@amk.ca>
parents:
20412
diff
changeset
|
617 &temp[0], &temp[1], &temp[2], &temp[3], |
|
b5ca0687ba6a
Add two forgotten 'break' statements
Andrew M. Kuchling <amk@amk.ca>
parents:
20412
diff
changeset
|
618 &temp[4], &temp[5], &temp[6], &temp[7])) |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
619 return NULL; |
|
20583
b5ca0687ba6a
Add two forgotten 'break' statements
Andrew M. Kuchling <amk@amk.ca>
parents:
20412
diff
changeset
|
620 |
|
b5ca0687ba6a
Add two forgotten 'break' statements
Andrew M. Kuchling <amk@amk.ca>
parents:
20412
diff
changeset
|
621 for(i=0; i<8; i++) { |
|
b5ca0687ba6a
Add two forgotten 'break' statements
Andrew M. Kuchling <amk@amk.ca>
parents:
20412
diff
changeset
|
622 if (temp[i] != NULL && !PyCurses_ConvertToChtype(temp[i], &ch[i])) { |
|
b5ca0687ba6a
Add two forgotten 'break' statements
Andrew M. Kuchling <amk@amk.ca>
parents:
20412
diff
changeset
|
623 PyErr_Format(PyExc_TypeError, |
|
b5ca0687ba6a
Add two forgotten 'break' statements
Andrew M. Kuchling <amk@amk.ca>
parents:
20412
diff
changeset
|
624 "argument %i must be a ch or an int", i+1); |
|
b5ca0687ba6a
Add two forgotten 'break' statements
Andrew M. Kuchling <amk@amk.ca>
parents:
20412
diff
changeset
|
625 return NULL; |
|
b5ca0687ba6a
Add two forgotten 'break' statements
Andrew M. Kuchling <amk@amk.ca>
parents:
20412
diff
changeset
|
626 } |
|
b5ca0687ba6a
Add two forgotten 'break' statements
Andrew M. Kuchling <amk@amk.ca>
parents:
20412
diff
changeset
|
627 } |
|
b5ca0687ba6a
Add two forgotten 'break' statements
Andrew M. Kuchling <amk@amk.ca>
parents:
20412
diff
changeset
|
628 |
|
b5ca0687ba6a
Add two forgotten 'break' statements
Andrew M. Kuchling <amk@amk.ca>
parents:
20412
diff
changeset
|
629 wborder(self->win, |
|
b5ca0687ba6a
Add two forgotten 'break' statements
Andrew M. Kuchling <amk@amk.ca>
parents:
20412
diff
changeset
|
630 ch[0], ch[1], ch[2], ch[3], |
|
b5ca0687ba6a
Add two forgotten 'break' statements
Andrew M. Kuchling <amk@amk.ca>
parents:
20412
diff
changeset
|
631 ch[4], ch[5], ch[6], ch[7]); |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
632 Py_INCREF(Py_None); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
633 return Py_None; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
634 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
635 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
636 static PyObject * |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
637 PyCursesWindow_Box(PyCursesWindowObject *self, PyObject *args) |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
638 { |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
639 chtype ch1=0,ch2=0; |
|
21756
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
640 switch(PyTuple_Size(args)){ |
|
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
641 case 0: break; |
|
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
642 default: |
|
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
643 if (!PyArg_ParseTuple(args,"ll;vertint,horint", &ch1, &ch2)) |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
644 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
645 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
646 box(self->win,ch1,ch2); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
647 Py_INCREF(Py_None); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
648 return Py_None; |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
649 } |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
650 |
|
20647
dd78b1a71f3e
Check for HP/UX curses problems. Define _XOPEN_SOURCE_EXTENDED and
Martin v. Löwis <martin@v.loewis.de>
parents:
20583
diff
changeset
|
651 #if defined(HAVE_NCURSES_H) || defined(MVWDELCH_IS_EXPRESSION) |
|
dd78b1a71f3e
Check for HP/UX curses problems. Define _XOPEN_SOURCE_EXTENDED and
Martin v. Löwis <martin@v.loewis.de>
parents:
20583
diff
changeset
|
652 #define py_mvwdelch mvwdelch |
|
dd78b1a71f3e
Check for HP/UX curses problems. Define _XOPEN_SOURCE_EXTENDED and
Martin v. Löwis <martin@v.loewis.de>
parents:
20583
diff
changeset
|
653 #else |
|
dd78b1a71f3e
Check for HP/UX curses problems. Define _XOPEN_SOURCE_EXTENDED and
Martin v. Löwis <martin@v.loewis.de>
parents:
20583
diff
changeset
|
654 int py_mvwdelch(WINDOW *w, int y, int x) |
|
dd78b1a71f3e
Check for HP/UX curses problems. Define _XOPEN_SOURCE_EXTENDED and
Martin v. Löwis <martin@v.loewis.de>
parents:
20583
diff
changeset
|
655 { |
|
dd78b1a71f3e
Check for HP/UX curses problems. Define _XOPEN_SOURCE_EXTENDED and
Martin v. Löwis <martin@v.loewis.de>
parents:
20583
diff
changeset
|
656 mvwdelch(w,y,x); |
|
dd78b1a71f3e
Check for HP/UX curses problems. Define _XOPEN_SOURCE_EXTENDED and
Martin v. Löwis <martin@v.loewis.de>
parents:
20583
diff
changeset
|
657 /* On HP/UX, mvwdelch already returns. On other systems, |
|
dd78b1a71f3e
Check for HP/UX curses problems. Define _XOPEN_SOURCE_EXTENDED and
Martin v. Löwis <martin@v.loewis.de>
parents:
20583
diff
changeset
|
658 we may well run into this return statement. */ |
|
dd78b1a71f3e
Check for HP/UX curses problems. Define _XOPEN_SOURCE_EXTENDED and
Martin v. Löwis <martin@v.loewis.de>
parents:
20583
diff
changeset
|
659 return 0; |
|
dd78b1a71f3e
Check for HP/UX curses problems. Define _XOPEN_SOURCE_EXTENDED and
Martin v. Löwis <martin@v.loewis.de>
parents:
20583
diff
changeset
|
660 } |
|
dd78b1a71f3e
Check for HP/UX curses problems. Define _XOPEN_SOURCE_EXTENDED and
Martin v. Löwis <martin@v.loewis.de>
parents:
20583
diff
changeset
|
661 #endif |
|
dd78b1a71f3e
Check for HP/UX curses problems. Define _XOPEN_SOURCE_EXTENDED and
Martin v. Löwis <martin@v.loewis.de>
parents:
20583
diff
changeset
|
662 |
|
41427
40110d06e82a
Add window.chgat() method, submitted via e-mail by Fabian Kreutz
Andrew M. Kuchling <amk@amk.ca>
parents:
41039
diff
changeset
|
663 /* chgat, added by Fabian Kreutz <fabian.kreutz at gmx.net> */ |
|
40110d06e82a
Add window.chgat() method, submitted via e-mail by Fabian Kreutz
Andrew M. Kuchling <amk@amk.ca>
parents:
41039
diff
changeset
|
664 |
|
40110d06e82a
Add window.chgat() method, submitted via e-mail by Fabian Kreutz
Andrew M. Kuchling <amk@amk.ca>
parents:
41039
diff
changeset
|
665 static PyObject * |
|
40110d06e82a
Add window.chgat() method, submitted via e-mail by Fabian Kreutz
Andrew M. Kuchling <amk@amk.ca>
parents:
41039
diff
changeset
|
666 PyCursesWindow_ChgAt(PyCursesWindowObject *self, PyObject *args) |
|
40110d06e82a
Add window.chgat() method, submitted via e-mail by Fabian Kreutz
Andrew M. Kuchling <amk@amk.ca>
parents:
41039
diff
changeset
|
667 { |
|
40110d06e82a
Add window.chgat() method, submitted via e-mail by Fabian Kreutz
Andrew M. Kuchling <amk@amk.ca>
parents:
41039
diff
changeset
|
668 int rtn; |
|
40110d06e82a
Add window.chgat() method, submitted via e-mail by Fabian Kreutz
Andrew M. Kuchling <amk@amk.ca>
parents:
41039
diff
changeset
|
669 int x, y; |
|
40110d06e82a
Add window.chgat() method, submitted via e-mail by Fabian Kreutz
Andrew M. Kuchling <amk@amk.ca>
parents:
41039
diff
changeset
|
670 int num = -1; |
|
40110d06e82a
Add window.chgat() method, submitted via e-mail by Fabian Kreutz
Andrew M. Kuchling <amk@amk.ca>
parents:
41039
diff
changeset
|
671 short color; |
|
40110d06e82a
Add window.chgat() method, submitted via e-mail by Fabian Kreutz
Andrew M. Kuchling <amk@amk.ca>
parents:
41039
diff
changeset
|
672 attr_t attr = A_NORMAL; |
|
44610
50869e747e76
Related to patch #1114: fix another place where attr_t is assumed to be a long
Andrew M. Kuchling <amk@amk.ca>
parents:
44595
diff
changeset
|
673 long lattr; |
|
41427
40110d06e82a
Add window.chgat() method, submitted via e-mail by Fabian Kreutz
Andrew M. Kuchling <amk@amk.ca>
parents:
41039
diff
changeset
|
674 int use_xy = FALSE; |
|
40110d06e82a
Add window.chgat() method, submitted via e-mail by Fabian Kreutz
Andrew M. Kuchling <amk@amk.ca>
parents:
41039
diff
changeset
|
675 |
|
40110d06e82a
Add window.chgat() method, submitted via e-mail by Fabian Kreutz
Andrew M. Kuchling <amk@amk.ca>
parents:
41039
diff
changeset
|
676 switch (PyTuple_Size(args)) { |
|
40110d06e82a
Add window.chgat() method, submitted via e-mail by Fabian Kreutz
Andrew M. Kuchling <amk@amk.ca>
parents:
41039
diff
changeset
|
677 case 1: |
|
44610
50869e747e76
Related to patch #1114: fix another place where attr_t is assumed to be a long
Andrew M. Kuchling <amk@amk.ca>
parents:
44595
diff
changeset
|
678 if (!PyArg_ParseTuple(args,"l;attr", &lattr)) |
|
41427
40110d06e82a
Add window.chgat() method, submitted via e-mail by Fabian Kreutz
Andrew M. Kuchling <amk@amk.ca>
parents:
41039
diff
changeset
|
679 return NULL; |
|
44610
50869e747e76
Related to patch #1114: fix another place where attr_t is assumed to be a long
Andrew M. Kuchling <amk@amk.ca>
parents:
44595
diff
changeset
|
680 attr = lattr; |
|
41427
40110d06e82a
Add window.chgat() method, submitted via e-mail by Fabian Kreutz
Andrew M. Kuchling <amk@amk.ca>
parents:
41039
diff
changeset
|
681 break; |
|
40110d06e82a
Add window.chgat() method, submitted via e-mail by Fabian Kreutz
Andrew M. Kuchling <amk@amk.ca>
parents:
41039
diff
changeset
|
682 case 2: |
|
44610
50869e747e76
Related to patch #1114: fix another place where attr_t is assumed to be a long
Andrew M. Kuchling <amk@amk.ca>
parents:
44595
diff
changeset
|
683 if (!PyArg_ParseTuple(args,"il;n,attr", &num, &lattr)) |
|
41427
40110d06e82a
Add window.chgat() method, submitted via e-mail by Fabian Kreutz
Andrew M. Kuchling <amk@amk.ca>
parents:
41039
diff
changeset
|
684 return NULL; |
|
44610
50869e747e76
Related to patch #1114: fix another place where attr_t is assumed to be a long
Andrew M. Kuchling <amk@amk.ca>
parents:
44595
diff
changeset
|
685 attr = lattr; |
|
41427
40110d06e82a
Add window.chgat() method, submitted via e-mail by Fabian Kreutz
Andrew M. Kuchling <amk@amk.ca>
parents:
41039
diff
changeset
|
686 break; |
|
40110d06e82a
Add window.chgat() method, submitted via e-mail by Fabian Kreutz
Andrew M. Kuchling <amk@amk.ca>
parents:
41039
diff
changeset
|
687 case 3: |
|
44610
50869e747e76
Related to patch #1114: fix another place where attr_t is assumed to be a long
Andrew M. Kuchling <amk@amk.ca>
parents:
44595
diff
changeset
|
688 if (!PyArg_ParseTuple(args,"iil;int,int,attr", &y, &x, &lattr)) |
|
41427
40110d06e82a
Add window.chgat() method, submitted via e-mail by Fabian Kreutz
Andrew M. Kuchling <amk@amk.ca>
parents:
41039
diff
changeset
|
689 return NULL; |
|
44610
50869e747e76
Related to patch #1114: fix another place where attr_t is assumed to be a long
Andrew M. Kuchling <amk@amk.ca>
parents:
44595
diff
changeset
|
690 attr = lattr; |
|
41427
40110d06e82a
Add window.chgat() method, submitted via e-mail by Fabian Kreutz
Andrew M. Kuchling <amk@amk.ca>
parents:
41039
diff
changeset
|
691 use_xy = TRUE; |
|
40110d06e82a
Add window.chgat() method, submitted via e-mail by Fabian Kreutz
Andrew M. Kuchling <amk@amk.ca>
parents:
41039
diff
changeset
|
692 break; |
|
40110d06e82a
Add window.chgat() method, submitted via e-mail by Fabian Kreutz
Andrew M. Kuchling <amk@amk.ca>
parents:
41039
diff
changeset
|
693 case 4: |
|
44610
50869e747e76
Related to patch #1114: fix another place where attr_t is assumed to be a long
Andrew M. Kuchling <amk@amk.ca>
parents:
44595
diff
changeset
|
694 if (!PyArg_ParseTuple(args,"iiil;int,int,n,attr", &y, &x, &num, &lattr)) |
|
41427
40110d06e82a
Add window.chgat() method, submitted via e-mail by Fabian Kreutz
Andrew M. Kuchling <amk@amk.ca>
parents:
41039
diff
changeset
|
695 return NULL; |
|
44610
50869e747e76
Related to patch #1114: fix another place where attr_t is assumed to be a long
Andrew M. Kuchling <amk@amk.ca>
parents:
44595
diff
changeset
|
696 attr = lattr; |
|
41427
40110d06e82a
Add window.chgat() method, submitted via e-mail by Fabian Kreutz
Andrew M. Kuchling <amk@amk.ca>
parents:
41039
diff
changeset
|
697 use_xy = TRUE; |
|
40110d06e82a
Add window.chgat() method, submitted via e-mail by Fabian Kreutz
Andrew M. Kuchling <amk@amk.ca>
parents:
41039
diff
changeset
|
698 break; |
|
40110d06e82a
Add window.chgat() method, submitted via e-mail by Fabian Kreutz
Andrew M. Kuchling <amk@amk.ca>
parents:
41039
diff
changeset
|
699 default: |
|
40110d06e82a
Add window.chgat() method, submitted via e-mail by Fabian Kreutz
Andrew M. Kuchling <amk@amk.ca>
parents:
41039
diff
changeset
|
700 PyErr_SetString(PyExc_TypeError, "chgat requires 1 to 4 arguments"); |
|
40110d06e82a
Add window.chgat() method, submitted via e-mail by Fabian Kreutz
Andrew M. Kuchling <amk@amk.ca>
parents:
41039
diff
changeset
|
701 return NULL; |
|
40110d06e82a
Add window.chgat() method, submitted via e-mail by Fabian Kreutz
Andrew M. Kuchling <amk@amk.ca>
parents:
41039
diff
changeset
|
702 } |
|
40110d06e82a
Add window.chgat() method, submitted via e-mail by Fabian Kreutz
Andrew M. Kuchling <amk@amk.ca>
parents:
41039
diff
changeset
|
703 |
|
40110d06e82a
Add window.chgat() method, submitted via e-mail by Fabian Kreutz
Andrew M. Kuchling <amk@amk.ca>
parents:
41039
diff
changeset
|
704 color = (short)((attr >> 8) & 0xff); |
|
40110d06e82a
Add window.chgat() method, submitted via e-mail by Fabian Kreutz
Andrew M. Kuchling <amk@amk.ca>
parents:
41039
diff
changeset
|
705 attr = attr - (color << 8); |
|
40110d06e82a
Add window.chgat() method, submitted via e-mail by Fabian Kreutz
Andrew M. Kuchling <amk@amk.ca>
parents:
41039
diff
changeset
|
706 |
|
40110d06e82a
Add window.chgat() method, submitted via e-mail by Fabian Kreutz
Andrew M. Kuchling <amk@amk.ca>
parents:
41039
diff
changeset
|
707 if (use_xy == TRUE) { |
|
40110d06e82a
Add window.chgat() method, submitted via e-mail by Fabian Kreutz
Andrew M. Kuchling <amk@amk.ca>
parents:
41039
diff
changeset
|
708 rtn = mvwchgat(self->win,y,x,num,attr,color,NULL); |
|
40110d06e82a
Add window.chgat() method, submitted via e-mail by Fabian Kreutz
Andrew M. Kuchling <amk@amk.ca>
parents:
41039
diff
changeset
|
709 touchline(self->win,y,1); |
|
40110d06e82a
Add window.chgat() method, submitted via e-mail by Fabian Kreutz
Andrew M. Kuchling <amk@amk.ca>
parents:
41039
diff
changeset
|
710 } else { |
|
40110d06e82a
Add window.chgat() method, submitted via e-mail by Fabian Kreutz
Andrew M. Kuchling <amk@amk.ca>
parents:
41039
diff
changeset
|
711 getyx(self->win,y,x); |
|
40110d06e82a
Add window.chgat() method, submitted via e-mail by Fabian Kreutz
Andrew M. Kuchling <amk@amk.ca>
parents:
41039
diff
changeset
|
712 rtn = wchgat(self->win,num,attr,color,NULL); |
|
40110d06e82a
Add window.chgat() method, submitted via e-mail by Fabian Kreutz
Andrew M. Kuchling <amk@amk.ca>
parents:
41039
diff
changeset
|
713 touchline(self->win,y,1); |
|
40110d06e82a
Add window.chgat() method, submitted via e-mail by Fabian Kreutz
Andrew M. Kuchling <amk@amk.ca>
parents:
41039
diff
changeset
|
714 } |
|
40110d06e82a
Add window.chgat() method, submitted via e-mail by Fabian Kreutz
Andrew M. Kuchling <amk@amk.ca>
parents:
41039
diff
changeset
|
715 return PyCursesCheckERR(rtn, "chgat"); |
|
40110d06e82a
Add window.chgat() method, submitted via e-mail by Fabian Kreutz
Andrew M. Kuchling <amk@amk.ca>
parents:
41039
diff
changeset
|
716 } |
|
40110d06e82a
Add window.chgat() method, submitted via e-mail by Fabian Kreutz
Andrew M. Kuchling <amk@amk.ca>
parents:
41039
diff
changeset
|
717 |
|
20647
dd78b1a71f3e
Check for HP/UX curses problems. Define _XOPEN_SOURCE_EXTENDED and
Martin v. Löwis <martin@v.loewis.de>
parents:
20583
diff
changeset
|
718 |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
719 static PyObject * |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
720 PyCursesWindow_DelCh(PyCursesWindowObject *self, PyObject *args) |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
721 { |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
722 int rtn; |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
723 int x, y; |
| 2357 | 724 |
|
21756
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
725 switch (PyTuple_Size(args)) { |
| 2357 | 726 case 0: |
| 727 rtn = wdelch(self->win); | |
| 728 break; | |
| 729 case 2: | |
|
21756
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
730 if (!PyArg_ParseTuple(args,"ii;y,x", &y, &x)) |
| 2357 | 731 return NULL; |
|
20647
dd78b1a71f3e
Check for HP/UX curses problems. Define _XOPEN_SOURCE_EXTENDED and
Martin v. Löwis <martin@v.loewis.de>
parents:
20583
diff
changeset
|
732 rtn = py_mvwdelch(self->win,y,x); |
| 2357 | 733 break; |
| 734 default: | |
| 735 PyErr_SetString(PyExc_TypeError, "delch requires 0 or 2 arguments"); | |
| 736 return NULL; | |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
737 } |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
738 return PyCursesCheckERR(rtn, "[mv]wdelch"); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
739 } |
| 2357 | 740 |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
741 static PyObject * |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
742 PyCursesWindow_DerWin(PyCursesWindowObject *self, PyObject *args) |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
743 { |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
744 WINDOW *win; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
745 int nlines, ncols, begin_y, begin_x; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
746 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
747 nlines = 0; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
748 ncols = 0; |
|
21756
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
749 switch (PyTuple_Size(args)) { |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
750 case 2: |
|
21756
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
751 if (!PyArg_ParseTuple(args,"ii;begin_y,begin_x",&begin_y,&begin_x)) |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
752 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
753 break; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
754 case 4: |
|
21756
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
755 if (!PyArg_ParseTuple(args, "iiii;nlines,ncols,begin_y,begin_x", |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
756 &nlines,&ncols,&begin_y,&begin_x)) |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
757 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
758 break; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
759 default: |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
760 PyErr_SetString(PyExc_TypeError, "derwin requires 2 or 4 arguments"); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
761 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
762 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
763 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
764 win = derwin(self->win,nlines,ncols,begin_y,begin_x); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
765 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
766 if (win == NULL) { |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
767 PyErr_SetString(PyCursesError, catchall_NULL); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
768 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
769 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
770 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
771 return (PyObject *)PyCursesWindow_New(win); |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
772 } |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
773 |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
774 static PyObject * |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
775 PyCursesWindow_EchoChar(PyCursesWindowObject *self, PyObject *args) |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
776 { |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
777 PyObject *temp; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
778 chtype ch; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
779 attr_t attr = A_NORMAL; |
|
44595
d1a1ba502579
Patch 1114: fix compilation of curses module on 64-bit AIX, and any other LP64 platforms where attr_t isn't a C long
Andrew M. Kuchling <amk@amk.ca>
parents:
44439
diff
changeset
|
780 long lattr; |
| 2357 | 781 |
|
21756
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
782 switch (PyTuple_Size(args)) { |
| 2357 | 783 case 1: |
|
21756
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
784 if (!PyArg_ParseTuple(args,"O;ch or int", &temp)) |
| 2357 | 785 return NULL; |
| 786 break; | |
| 787 case 2: | |
|
44595
d1a1ba502579
Patch 1114: fix compilation of curses module on 64-bit AIX, and any other LP64 platforms where attr_t isn't a C long
Andrew M. Kuchling <amk@amk.ca>
parents:
44439
diff
changeset
|
788 if (!PyArg_ParseTuple(args,"Ol;ch or int,attr", &temp, &lattr)) |
| 2357 | 789 return NULL; |
|
44595
d1a1ba502579
Patch 1114: fix compilation of curses module on 64-bit AIX, and any other LP64 platforms where attr_t isn't a C long
Andrew M. Kuchling <amk@amk.ca>
parents:
44439
diff
changeset
|
790 attr = lattr; |
| 2357 | 791 break; |
| 792 default: | |
| 793 PyErr_SetString(PyExc_TypeError, "echochar requires 1 or 2 arguments"); | |
| 794 | |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
795 |
| 2357 | 796 return NULL; |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
797 } |
| 2357 | 798 |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
799 if (!PyCurses_ConvertToChtype(temp, &ch)) { |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
800 PyErr_SetString(PyExc_TypeError, "argument 1 must be a ch or an int"); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
801 return NULL; |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
802 } |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
803 |
|
20647
dd78b1a71f3e
Check for HP/UX curses problems. Define _XOPEN_SOURCE_EXTENDED and
Martin v. Löwis <martin@v.loewis.de>
parents:
20583
diff
changeset
|
804 #ifdef WINDOW_HAS_FLAGS |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
805 if (self->win->_flags & _ISPAD) |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
806 return PyCursesCheckERR(pechochar(self->win, ch | attr), |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
807 "echochar"); |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
808 else |
|
16351
ef32bfa5f5c6
Patch #103485 from Donn Cave: patches to make the module compile on AIX and
Andrew M. Kuchling <amk@amk.ca>
parents:
16350
diff
changeset
|
809 #endif |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
810 return PyCursesCheckERR(wechochar(self->win, ch | attr), |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
811 "echochar"); |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
812 } |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
813 |
|
13036
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
814 #ifdef NCURSES_MOUSE_VERSION |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
815 static PyObject * |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
816 PyCursesWindow_Enclose(PyCursesWindowObject *self, PyObject *args) |
|
13036
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
817 { |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
818 int x, y; |
|
21756
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
819 if (!PyArg_ParseTuple(args,"ii;y,x", &y, &x)) |
|
13036
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
820 return NULL; |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
821 |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
822 return PyInt_FromLong( wenclose(self->win,y,x) ); |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
823 } |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
824 #endif |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
825 |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
826 static PyObject * |
|
21756
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
827 PyCursesWindow_GetBkgd(PyCursesWindowObject *self) |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
828 { |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
829 return PyInt_FromLong((long) getbkgd(self->win)); |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
830 } |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
831 |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
832 static PyObject * |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
833 PyCursesWindow_GetCh(PyCursesWindowObject *self, PyObject *args) |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
834 { |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
835 int x, y; |
|
26075
1afca375f2a9
[Patch #633635 from David M. Cooke]
Andrew M. Kuchling <amk@amk.ca>
parents:
25966
diff
changeset
|
836 int rtn; |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
837 |
|
21756
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
838 switch (PyTuple_Size(args)) { |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
839 case 0: |
|
12988
0eb531ce08d1
Release the global interpreter lock around the most important
Andrew M. Kuchling <amk@amk.ca>
parents:
12974
diff
changeset
|
840 Py_BEGIN_ALLOW_THREADS |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
841 rtn = wgetch(self->win); |
|
12988
0eb531ce08d1
Release the global interpreter lock around the most important
Andrew M. Kuchling <amk@amk.ca>
parents:
12974
diff
changeset
|
842 Py_END_ALLOW_THREADS |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
843 break; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
844 case 2: |
|
21756
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
845 if (!PyArg_ParseTuple(args,"ii;y,x",&y,&x)) |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
846 return NULL; |
|
12988
0eb531ce08d1
Release the global interpreter lock around the most important
Andrew M. Kuchling <amk@amk.ca>
parents:
12974
diff
changeset
|
847 Py_BEGIN_ALLOW_THREADS |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
848 rtn = mvwgetch(self->win,y,x); |
|
12988
0eb531ce08d1
Release the global interpreter lock around the most important
Andrew M. Kuchling <amk@amk.ca>
parents:
12974
diff
changeset
|
849 Py_END_ALLOW_THREADS |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
850 break; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
851 default: |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
852 PyErr_SetString(PyExc_TypeError, "getch requires 0 or 2 arguments"); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
853 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
854 } |
|
18749
c6ef71e943dd
Remove warnings from the SGI compiler.
Fred Drake <fdrake@acm.org>
parents:
18602
diff
changeset
|
855 return PyInt_FromLong((long)rtn); |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
856 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
857 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
858 static PyObject * |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
859 PyCursesWindow_GetKey(PyCursesWindowObject *self, PyObject *args) |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
860 { |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
861 int x, y; |
|
26075
1afca375f2a9
[Patch #633635 from David M. Cooke]
Andrew M. Kuchling <amk@amk.ca>
parents:
25966
diff
changeset
|
862 int rtn; |
| 2357 | 863 |
|
21756
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
864 switch (PyTuple_Size(args)) { |
| 2357 | 865 case 0: |
|
12988
0eb531ce08d1
Release the global interpreter lock around the most important
Andrew M. Kuchling <amk@amk.ca>
parents:
12974
diff
changeset
|
866 Py_BEGIN_ALLOW_THREADS |
| 2357 | 867 rtn = wgetch(self->win); |
|
12988
0eb531ce08d1
Release the global interpreter lock around the most important
Andrew M. Kuchling <amk@amk.ca>
parents:
12974
diff
changeset
|
868 Py_END_ALLOW_THREADS |
| 2357 | 869 break; |
| 870 case 2: | |
|
21756
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
871 if (!PyArg_ParseTuple(args,"ii;y,x",&y,&x)) |
| 2357 | 872 return NULL; |
|
12988
0eb531ce08d1
Release the global interpreter lock around the most important
Andrew M. Kuchling <amk@amk.ca>
parents:
12974
diff
changeset
|
873 Py_BEGIN_ALLOW_THREADS |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
874 rtn = mvwgetch(self->win,y,x); |
|
12988
0eb531ce08d1
Release the global interpreter lock around the most important
Andrew M. Kuchling <amk@amk.ca>
parents:
12974
diff
changeset
|
875 Py_END_ALLOW_THREADS |
| 2357 | 876 break; |
| 877 default: | |
|
12738
3d26cb3808a7
Changes by AMK: Use HAVE_NCURSES_H to include correct header file
Andrew M. Kuchling <amk@amk.ca>
parents:
12737
diff
changeset
|
878 PyErr_SetString(PyExc_TypeError, "getkey requires 0 or 2 arguments"); |
| 2357 | 879 return NULL; |
| 880 } | |
|
26075
1afca375f2a9
[Patch #633635 from David M. Cooke]
Andrew M. Kuchling <amk@amk.ca>
parents:
25966
diff
changeset
|
881 if (rtn == ERR) { |
|
1afca375f2a9
[Patch #633635 from David M. Cooke]
Andrew M. Kuchling <amk@amk.ca>
parents:
25966
diff
changeset
|
882 /* getch() returns ERR in nodelay mode */ |
|
1afca375f2a9
[Patch #633635 from David M. Cooke]
Andrew M. Kuchling <amk@amk.ca>
parents:
25966
diff
changeset
|
883 PyErr_SetString(PyCursesError, "no input"); |
|
1afca375f2a9
[Patch #633635 from David M. Cooke]
Andrew M. Kuchling <amk@amk.ca>
parents:
25966
diff
changeset
|
884 return NULL; |
|
56224
2bfaddb19c3a
#6243: fix segfault when keyname() returns a NULL pointer.
Andrew M. Kuchling <amk@amk.ca>
parents:
55297
diff
changeset
|
885 } else if (rtn<=255) { |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
886 return Py_BuildValue("c", rtn); |
|
56224
2bfaddb19c3a
#6243: fix segfault when keyname() returns a NULL pointer.
Andrew M. Kuchling <amk@amk.ca>
parents:
55297
diff
changeset
|
887 } else { |
|
2bfaddb19c3a
#6243: fix segfault when keyname() returns a NULL pointer.
Andrew M. Kuchling <amk@amk.ca>
parents:
55297
diff
changeset
|
888 const char *knp; |
|
16351
ef32bfa5f5c6
Patch #103485 from Donn Cave: patches to make the module compile on AIX and
Andrew M. Kuchling <amk@amk.ca>
parents:
16350
diff
changeset
|
889 #if defined(__NetBSD__) |
|
56224
2bfaddb19c3a
#6243: fix segfault when keyname() returns a NULL pointer.
Andrew M. Kuchling <amk@amk.ca>
parents:
55297
diff
changeset
|
890 knp = unctrl(rtn); |
|
16351
ef32bfa5f5c6
Patch #103485 from Donn Cave: patches to make the module compile on AIX and
Andrew M. Kuchling <amk@amk.ca>
parents:
16350
diff
changeset
|
891 #else |
|
56224
2bfaddb19c3a
#6243: fix segfault when keyname() returns a NULL pointer.
Andrew M. Kuchling <amk@amk.ca>
parents:
55297
diff
changeset
|
892 knp = keyname(rtn); |
|
16351
ef32bfa5f5c6
Patch #103485 from Donn Cave: patches to make the module compile on AIX and
Andrew M. Kuchling <amk@amk.ca>
parents:
16350
diff
changeset
|
893 #endif |
|
56224
2bfaddb19c3a
#6243: fix segfault when keyname() returns a NULL pointer.
Andrew M. Kuchling <amk@amk.ca>
parents:
55297
diff
changeset
|
894 return PyString_FromString((knp == NULL) ? "" : knp); |
|
2bfaddb19c3a
#6243: fix segfault when keyname() returns a NULL pointer.
Andrew M. Kuchling <amk@amk.ca>
parents:
55297
diff
changeset
|
895 } |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
896 } |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
897 |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
898 static PyObject * |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
899 PyCursesWindow_GetStr(PyCursesWindowObject *self, PyObject *args) |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
900 { |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
901 int x, y, n; |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
902 char rtn[1024]; /* This should be big enough.. I hope */ |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
903 int rtn2; |
| 2357 | 904 |
|
21756
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
905 switch (PyTuple_Size(args)) { |
| 2357 | 906 case 0: |
|
12988
0eb531ce08d1
Release the global interpreter lock around the most important
Andrew M. Kuchling <amk@amk.ca>
parents:
12974
diff
changeset
|
907 Py_BEGIN_ALLOW_THREADS |
|
35056
ee99db06c0eb
[Bug #1200134] Fix buffer overflow by constraining size of .getstr(), .instr() to size of allocated buffer
Andrew M. Kuchling <amk@amk.ca>
parents:
32959
diff
changeset
|
908 rtn2 = wgetnstr(self->win,rtn, 1023); |
|
12988
0eb531ce08d1
Release the global interpreter lock around the most important
Andrew M. Kuchling <amk@amk.ca>
parents:
12974
diff
changeset
|
909 Py_END_ALLOW_THREADS |
| 2357 | 910 break; |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
911 case 1: |
|
21756
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
912 if (!PyArg_ParseTuple(args,"i;n", &n)) |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
913 return NULL; |
|
12988
0eb531ce08d1
Release the global interpreter lock around the most important
Andrew M. Kuchling <amk@amk.ca>
parents:
12974
diff
changeset
|
914 Py_BEGIN_ALLOW_THREADS |
|
35056
ee99db06c0eb
[Bug #1200134] Fix buffer overflow by constraining size of .getstr(), .instr() to size of allocated buffer
Andrew M. Kuchling <amk@amk.ca>
parents:
32959
diff
changeset
|
915 rtn2 = wgetnstr(self->win,rtn,MIN(n, 1023)); |
|
12988
0eb531ce08d1
Release the global interpreter lock around the most important
Andrew M. Kuchling <amk@amk.ca>
parents:
12974
diff
changeset
|
916 Py_END_ALLOW_THREADS |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
917 break; |
| 2357 | 918 case 2: |
|
21756
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
919 if (!PyArg_ParseTuple(args,"ii;y,x",&y,&x)) |
| 2357 | 920 return NULL; |
|
12988
0eb531ce08d1
Release the global interpreter lock around the most important
Andrew M. Kuchling <amk@amk.ca>
parents:
12974
diff
changeset
|
921 Py_BEGIN_ALLOW_THREADS |
|
39191
9f3f1edd9c35
[Bug #1471938] Fix build problem on Solaris 8 by conditionalizing the use of mvwgetnstr(); it was conditionalized a few lines below. Fix from Paul Eggert. I also tried out the STRICT_SYSV_CURSES case and am therefore removing the 'untested' comment.
Andrew M. Kuchling <amk@amk.ca>
parents:
38876
diff
changeset
|
922 #ifdef STRICT_SYSV_CURSES |
|
9f3f1edd9c35
[Bug #1471938] Fix build problem on Solaris 8 by conditionalizing the use of mvwgetnstr(); it was conditionalized a few lines below. Fix from Paul Eggert. I also tried out the STRICT_SYSV_CURSES case and am therefore removing the 'untested' comment.
Andrew M. Kuchling <amk@amk.ca>
parents:
38876
diff
changeset
|
923 rtn2 = wmove(self->win,y,x)==ERR ? ERR : wgetnstr(self->win, rtn, 1023); |
|
9f3f1edd9c35
[Bug #1471938] Fix build problem on Solaris 8 by conditionalizing the use of mvwgetnstr(); it was conditionalized a few lines below. Fix from Paul Eggert. I also tried out the STRICT_SYSV_CURSES case and am therefore removing the 'untested' comment.
Andrew M. Kuchling <amk@amk.ca>
parents:
38876
diff
changeset
|
924 #else |
|
35056
ee99db06c0eb
[Bug #1200134] Fix buffer overflow by constraining size of .getstr(), .instr() to size of allocated buffer
Andrew M. Kuchling <amk@amk.ca>
parents:
32959
diff
changeset
|
925 rtn2 = mvwgetnstr(self->win,y,x,rtn, 1023); |
|
39191
9f3f1edd9c35
[Bug #1471938] Fix build problem on Solaris 8 by conditionalizing the use of mvwgetnstr(); it was conditionalized a few lines below. Fix from Paul Eggert. I also tried out the STRICT_SYSV_CURSES case and am therefore removing the 'untested' comment.
Andrew M. Kuchling <amk@amk.ca>
parents:
38876
diff
changeset
|
926 #endif |
|
12988
0eb531ce08d1
Release the global interpreter lock around the most important
Andrew M. Kuchling <amk@amk.ca>
parents:
12974
diff
changeset
|
927 Py_END_ALLOW_THREADS |
| 2357 | 928 break; |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
929 case 3: |
|
21756
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
930 if (!PyArg_ParseTuple(args,"iii;y,x,n", &y, &x, &n)) |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
931 return NULL; |
|
13040
12ac2c267b93
Fixes for compiling on Tru64.
Andrew M. Kuchling <amk@amk.ca>
parents:
13039
diff
changeset
|
932 #ifdef STRICT_SYSV_CURSES |
|
12988
0eb531ce08d1
Release the global interpreter lock around the most important
Andrew M. Kuchling <amk@amk.ca>
parents:
12974
diff
changeset
|
933 Py_BEGIN_ALLOW_THREADS |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
934 rtn2 = wmove(self->win,y,x)==ERR ? ERR : |
|
35056
ee99db06c0eb
[Bug #1200134] Fix buffer overflow by constraining size of .getstr(), .instr() to size of allocated buffer
Andrew M. Kuchling <amk@amk.ca>
parents:
32959
diff
changeset
|
935 wgetnstr(self->win, rtn, MIN(n, 1023)); |
|
12988
0eb531ce08d1
Release the global interpreter lock around the most important
Andrew M. Kuchling <amk@amk.ca>
parents:
12974
diff
changeset
|
936 Py_END_ALLOW_THREADS |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
937 #else |
|
12988
0eb531ce08d1
Release the global interpreter lock around the most important
Andrew M. Kuchling <amk@amk.ca>
parents:
12974
diff
changeset
|
938 Py_BEGIN_ALLOW_THREADS |
|
35056
ee99db06c0eb
[Bug #1200134] Fix buffer overflow by constraining size of .getstr(), .instr() to size of allocated buffer
Andrew M. Kuchling <amk@amk.ca>
parents:
32959
diff
changeset
|
939 rtn2 = mvwgetnstr(self->win, y, x, rtn, MIN(n, 1023)); |
|
12988
0eb531ce08d1
Release the global interpreter lock around the most important
Andrew M. Kuchling <amk@amk.ca>
parents:
12974
diff
changeset
|
940 Py_END_ALLOW_THREADS |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
941 #endif |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
942 break; |
| 2357 | 943 default: |
| 39192 | 944 PyErr_SetString(PyExc_TypeError, "getstr requires 0 to 3 arguments"); |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
945 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
946 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
947 if (rtn2 == ERR) |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
948 rtn[0] = 0; |
|
47527
52294af4b663
This reverts r63675 based on the discussion in this thread:
Gregory P. Smith <greg@mad-scientist.com>
parents:
47294
diff
changeset
|
949 return PyString_FromString(rtn); |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
950 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
951 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
952 static PyObject * |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
953 PyCursesWindow_Hline(PyCursesWindowObject *self, PyObject *args) |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
954 { |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
955 PyObject *temp; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
956 chtype ch; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
957 int n, x, y, code = OK; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
958 attr_t attr = A_NORMAL; |
|
44595
d1a1ba502579
Patch 1114: fix compilation of curses module on 64-bit AIX, and any other LP64 platforms where attr_t isn't a C long
Andrew M. Kuchling <amk@amk.ca>
parents:
44439
diff
changeset
|
959 long lattr; |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
960 |
|
21756
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
961 switch (PyTuple_Size(args)) { |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
962 case 2: |
|
21756
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
963 if (!PyArg_ParseTuple(args, "Oi;ch or int,n", &temp, &n)) |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
964 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
965 break; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
966 case 3: |
|
44595
d1a1ba502579
Patch 1114: fix compilation of curses module on 64-bit AIX, and any other LP64 platforms where attr_t isn't a C long
Andrew M. Kuchling <amk@amk.ca>
parents:
44439
diff
changeset
|
967 if (!PyArg_ParseTuple(args, "Oil;ch or int,n,attr", &temp, &n, &lattr)) |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
968 return NULL; |
|
44595
d1a1ba502579
Patch 1114: fix compilation of curses module on 64-bit AIX, and any other LP64 platforms where attr_t isn't a C long
Andrew M. Kuchling <amk@amk.ca>
parents:
44439
diff
changeset
|
969 attr = lattr; |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
970 break; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
971 case 4: |
|
21756
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
972 if (!PyArg_ParseTuple(args, "iiOi;y,x,ch or int,n", &y, &x, &temp, &n)) |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
973 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
974 code = wmove(self->win, y, x); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
975 break; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
976 case 5: |
|
21756
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
977 if (!PyArg_ParseTuple(args, "iiOil; y,x,ch or int,n,attr", |
|
44595
d1a1ba502579
Patch 1114: fix compilation of curses module on 64-bit AIX, and any other LP64 platforms where attr_t isn't a C long
Andrew M. Kuchling <amk@amk.ca>
parents:
44439
diff
changeset
|
978 &y, &x, &temp, &n, &lattr)) |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
979 return NULL; |
|
44595
d1a1ba502579
Patch 1114: fix compilation of curses module on 64-bit AIX, and any other LP64 platforms where attr_t isn't a C long
Andrew M. Kuchling <amk@amk.ca>
parents:
44439
diff
changeset
|
980 attr = lattr; |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
981 code = wmove(self->win, y, x); |
|
20583
b5ca0687ba6a
Add two forgotten 'break' statements
Andrew M. Kuchling <amk@amk.ca>
parents:
20412
diff
changeset
|
982 break; |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
983 default: |
|
20583
b5ca0687ba6a
Add two forgotten 'break' statements
Andrew M. Kuchling <amk@amk.ca>
parents:
20412
diff
changeset
|
984 PyErr_SetString(PyExc_TypeError, "hline requires 2 to 5 arguments"); |
| 2357 | 985 return NULL; |
| 986 } | |
| 987 | |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
988 if (code != ERR) { |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
989 if (!PyCurses_ConvertToChtype(temp, &ch)) { |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
990 PyErr_SetString(PyExc_TypeError, |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
991 "argument 1 or 3 must be a ch or an int"); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
992 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
993 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
994 return PyCursesCheckERR(whline(self->win, ch | attr, n), "hline"); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
995 } else |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
996 return PyCursesCheckERR(code, "wmove"); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
997 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
998 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
999 static PyObject * |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
1000 PyCursesWindow_InsCh(PyCursesWindowObject *self, PyObject *args) |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1001 { |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1002 int rtn, x, y, use_xy = FALSE; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1003 PyObject *temp; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1004 chtype ch = 0; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1005 attr_t attr = A_NORMAL; |
|
44595
d1a1ba502579
Patch 1114: fix compilation of curses module on 64-bit AIX, and any other LP64 platforms where attr_t isn't a C long
Andrew M. Kuchling <amk@amk.ca>
parents:
44439
diff
changeset
|
1006 long lattr; |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1007 |
|
21756
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
1008 switch (PyTuple_Size(args)) { |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1009 case 1: |
|
21756
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
1010 if (!PyArg_ParseTuple(args, "O;ch or int", &temp)) |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1011 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1012 break; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1013 case 2: |
|
44595
d1a1ba502579
Patch 1114: fix compilation of curses module on 64-bit AIX, and any other LP64 platforms where attr_t isn't a C long
Andrew M. Kuchling <amk@amk.ca>
parents:
44439
diff
changeset
|
1014 if (!PyArg_ParseTuple(args, "Ol;ch or int,attr", &temp, &lattr)) |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1015 return NULL; |
|
44595
d1a1ba502579
Patch 1114: fix compilation of curses module on 64-bit AIX, and any other LP64 platforms where attr_t isn't a C long
Andrew M. Kuchling <amk@amk.ca>
parents:
44439
diff
changeset
|
1016 attr = lattr; |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1017 break; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1018 case 3: |
|
21756
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
1019 if (!PyArg_ParseTuple(args,"iiO;y,x,ch or int", &y, &x, &temp)) |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1020 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1021 use_xy = TRUE; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1022 break; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1023 case 4: |
|
44595
d1a1ba502579
Patch 1114: fix compilation of curses module on 64-bit AIX, and any other LP64 platforms where attr_t isn't a C long
Andrew M. Kuchling <amk@amk.ca>
parents:
44439
diff
changeset
|
1024 if (!PyArg_ParseTuple(args,"iiOl;y,x,ch or int, attr", &y, &x, &temp, &lattr)) |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1025 return NULL; |
|
44595
d1a1ba502579
Patch 1114: fix compilation of curses module on 64-bit AIX, and any other LP64 platforms where attr_t isn't a C long
Andrew M. Kuchling <amk@amk.ca>
parents:
44439
diff
changeset
|
1026 attr = lattr; |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1027 use_xy = TRUE; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1028 break; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1029 default: |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1030 PyErr_SetString(PyExc_TypeError, "insch requires 1 or 4 arguments"); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1031 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1032 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1033 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1034 if (!PyCurses_ConvertToChtype(temp, &ch)) { |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1035 PyErr_SetString(PyExc_TypeError, |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1036 "argument 1 or 3 must be a ch or an int"); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1037 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1038 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1039 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1040 if (use_xy == TRUE) |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1041 rtn = mvwinsch(self->win,y,x, ch | attr); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1042 else { |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1043 rtn = winsch(self->win, ch | attr); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1044 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1045 return PyCursesCheckERR(rtn, "insch"); |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1046 } |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1047 |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1048 static PyObject * |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
1049 PyCursesWindow_InCh(PyCursesWindowObject *self, PyObject *args) |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1050 { |
| 2357 | 1051 int x, y, rtn; |
| 1052 | |
|
21756
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
1053 switch (PyTuple_Size(args)) { |
| 2357 | 1054 case 0: |
| 1055 rtn = winch(self->win); | |
| 1056 break; | |
| 1057 case 2: | |
|
21756
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
1058 if (!PyArg_ParseTuple(args,"ii;y,x",&y,&x)) |
| 2357 | 1059 return NULL; |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1060 rtn = mvwinch(self->win,y,x); |
| 2357 | 1061 break; |
| 1062 default: | |
| 1063 PyErr_SetString(PyExc_TypeError, "inch requires 0 or 2 arguments"); | |
| 1064 return NULL; | |
| 1065 } | |
| 1066 return PyInt_FromLong((long) rtn); | |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1067 } |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1068 |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1069 static PyObject * |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
1070 PyCursesWindow_InStr(PyCursesWindowObject *self, PyObject *args) |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1071 { |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1072 int x, y, n; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1073 char rtn[1024]; /* This should be big enough.. I hope */ |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1074 int rtn2; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1075 |
|
21756
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
1076 switch (PyTuple_Size(args)) { |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1077 case 0: |
|
35056
ee99db06c0eb
[Bug #1200134] Fix buffer overflow by constraining size of .getstr(), .instr() to size of allocated buffer
Andrew M. Kuchling <amk@amk.ca>
parents:
32959
diff
changeset
|
1078 rtn2 = winnstr(self->win,rtn, 1023); |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1079 break; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1080 case 1: |
|
21756
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
1081 if (!PyArg_ParseTuple(args,"i;n", &n)) |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1082 return NULL; |
|
35056
ee99db06c0eb
[Bug #1200134] Fix buffer overflow by constraining size of .getstr(), .instr() to size of allocated buffer
Andrew M. Kuchling <amk@amk.ca>
parents:
32959
diff
changeset
|
1083 rtn2 = winnstr(self->win,rtn,MIN(n,1023)); |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1084 break; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1085 case 2: |
|
21756
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
1086 if (!PyArg_ParseTuple(args,"ii;y,x",&y,&x)) |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1087 return NULL; |
|
35056
ee99db06c0eb
[Bug #1200134] Fix buffer overflow by constraining size of .getstr(), .instr() to size of allocated buffer
Andrew M. Kuchling <amk@amk.ca>
parents:
32959
diff
changeset
|
1088 rtn2 = mvwinnstr(self->win,y,x,rtn,1023); |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1089 break; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1090 case 3: |
|
21756
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
1091 if (!PyArg_ParseTuple(args, "iii;y,x,n", &y, &x, &n)) |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1092 return NULL; |
|
35056
ee99db06c0eb
[Bug #1200134] Fix buffer overflow by constraining size of .getstr(), .instr() to size of allocated buffer
Andrew M. Kuchling <amk@amk.ca>
parents:
32959
diff
changeset
|
1093 rtn2 = mvwinnstr(self->win, y, x, rtn, MIN(n,1023)); |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1094 break; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1095 default: |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1096 PyErr_SetString(PyExc_TypeError, "instr requires 0 or 3 arguments"); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1097 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1098 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1099 if (rtn2 == ERR) |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1100 rtn[0] = 0; |
|
47527
52294af4b663
This reverts r63675 based on the discussion in this thread:
Gregory P. Smith <greg@mad-scientist.com>
parents:
47294
diff
changeset
|
1101 return PyString_FromString(rtn); |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1102 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1103 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1104 static PyObject * |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
1105 PyCursesWindow_InsStr(PyCursesWindowObject *self, PyObject *args) |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1106 { |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1107 int rtn; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1108 int x, y; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1109 char *str; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1110 attr_t attr = A_NORMAL , attr_old = A_NORMAL; |
|
44595
d1a1ba502579
Patch 1114: fix compilation of curses module on 64-bit AIX, and any other LP64 platforms where attr_t isn't a C long
Andrew M. Kuchling <amk@amk.ca>
parents:
44439
diff
changeset
|
1111 long lattr; |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1112 int use_xy = FALSE, use_attr = FALSE; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1113 |
|
21756
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
1114 switch (PyTuple_Size(args)) { |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1115 case 1: |
|
21756
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
1116 if (!PyArg_ParseTuple(args,"s;str", &str)) |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1117 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1118 break; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1119 case 2: |
|
44595
d1a1ba502579
Patch 1114: fix compilation of curses module on 64-bit AIX, and any other LP64 platforms where attr_t isn't a C long
Andrew M. Kuchling <amk@amk.ca>
parents:
44439
diff
changeset
|
1120 if (!PyArg_ParseTuple(args,"sl;str,attr", &str, &lattr)) |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1121 return NULL; |
|
44595
d1a1ba502579
Patch 1114: fix compilation of curses module on 64-bit AIX, and any other LP64 platforms where attr_t isn't a C long
Andrew M. Kuchling <amk@amk.ca>
parents:
44439
diff
changeset
|
1122 attr = lattr; |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1123 use_attr = TRUE; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1124 break; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1125 case 3: |
|
21756
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
1126 if (!PyArg_ParseTuple(args,"iis;y,x,str", &y, &x, &str)) |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1127 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1128 use_xy = TRUE; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1129 break; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1130 case 4: |
|
44595
d1a1ba502579
Patch 1114: fix compilation of curses module on 64-bit AIX, and any other LP64 platforms where attr_t isn't a C long
Andrew M. Kuchling <amk@amk.ca>
parents:
44439
diff
changeset
|
1131 if (!PyArg_ParseTuple(args,"iisl;y,x,str,attr", &y, &x, &str, &lattr)) |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1132 return NULL; |
|
44595
d1a1ba502579
Patch 1114: fix compilation of curses module on 64-bit AIX, and any other LP64 platforms where attr_t isn't a C long
Andrew M. Kuchling <amk@amk.ca>
parents:
44439
diff
changeset
|
1133 attr = lattr; |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1134 use_xy = use_attr = TRUE; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1135 break; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1136 default: |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1137 PyErr_SetString(PyExc_TypeError, "insstr requires 1 to 4 arguments"); |
| 2357 | 1138 return NULL; |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1139 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1140 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1141 if (use_attr == TRUE) { |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1142 attr_old = getattrs(self->win); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1143 wattrset(self->win,attr); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1144 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1145 if (use_xy == TRUE) |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1146 rtn = mvwinsstr(self->win,y,x,str); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1147 else |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1148 rtn = winsstr(self->win,str); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1149 if (use_attr == TRUE) |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1150 wattrset(self->win,attr_old); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1151 return PyCursesCheckERR(rtn, "insstr"); |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1152 } |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1153 |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1154 static PyObject * |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
1155 PyCursesWindow_InsNStr(PyCursesWindowObject *self, PyObject *args) |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1156 { |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1157 int rtn, x, y, n; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1158 char *str; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1159 attr_t attr = A_NORMAL , attr_old = A_NORMAL; |
|
44595
d1a1ba502579
Patch 1114: fix compilation of curses module on 64-bit AIX, and any other LP64 platforms where attr_t isn't a C long
Andrew M. Kuchling <amk@amk.ca>
parents:
44439
diff
changeset
|
1160 long lattr; |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1161 int use_xy = FALSE, use_attr = FALSE; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1162 |
|
21756
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
1163 switch (PyTuple_Size(args)) { |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1164 case 2: |
|
21756
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
1165 if (!PyArg_ParseTuple(args,"si;str,n", &str, &n)) |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1166 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1167 break; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1168 case 3: |
|
44595
d1a1ba502579
Patch 1114: fix compilation of curses module on 64-bit AIX, and any other LP64 platforms where attr_t isn't a C long
Andrew M. Kuchling <amk@amk.ca>
parents:
44439
diff
changeset
|
1169 if (!PyArg_ParseTuple(args,"sil;str,n,attr", &str, &n, &lattr)) |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1170 return NULL; |
|
44595
d1a1ba502579
Patch 1114: fix compilation of curses module on 64-bit AIX, and any other LP64 platforms where attr_t isn't a C long
Andrew M. Kuchling <amk@amk.ca>
parents:
44439
diff
changeset
|
1171 attr = lattr; |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1172 use_attr = TRUE; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1173 break; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1174 case 4: |
|
21756
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
1175 if (!PyArg_ParseTuple(args,"iisi;y,x,str,n", &y, &x, &str, &n)) |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1176 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1177 use_xy = TRUE; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1178 break; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1179 case 5: |
|
44595
d1a1ba502579
Patch 1114: fix compilation of curses module on 64-bit AIX, and any other LP64 platforms where attr_t isn't a C long
Andrew M. Kuchling <amk@amk.ca>
parents:
44439
diff
changeset
|
1180 if (!PyArg_ParseTuple(args,"iisil;y,x,str,n,attr", &y, &x, &str, &n, &lattr)) |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1181 return NULL; |
|
44595
d1a1ba502579
Patch 1114: fix compilation of curses module on 64-bit AIX, and any other LP64 platforms where attr_t isn't a C long
Andrew M. Kuchling <amk@amk.ca>
parents:
44439
diff
changeset
|
1182 attr = lattr; |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1183 use_xy = use_attr = TRUE; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1184 break; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1185 default: |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1186 PyErr_SetString(PyExc_TypeError, "insnstr requires 2 to 5 arguments"); |
| 2357 | 1187 return NULL; |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1188 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1189 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1190 if (use_attr == TRUE) { |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1191 attr_old = getattrs(self->win); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1192 wattrset(self->win,attr); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1193 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1194 if (use_xy == TRUE) |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1195 rtn = mvwinsnstr(self->win,y,x,str,n); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1196 else |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1197 rtn = winsnstr(self->win,str,n); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1198 if (use_attr == TRUE) |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1199 wattrset(self->win,attr_old); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1200 return PyCursesCheckERR(rtn, "insnstr"); |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1201 } |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1202 |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1203 static PyObject * |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
1204 PyCursesWindow_Is_LineTouched(PyCursesWindowObject *self, PyObject *args) |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1205 { |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1206 int line, erg; |
|
21756
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
1207 if (!PyArg_ParseTuple(args,"i;line", &line)) |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1208 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1209 erg = is_linetouched(self->win, line); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1210 if (erg == ERR) { |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1211 PyErr_SetString(PyExc_TypeError, |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1212 "is_linetouched: line number outside of boundaries"); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1213 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1214 } else |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1215 if (erg == FALSE) { |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1216 Py_INCREF(Py_False); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1217 return Py_False; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1218 } else { |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1219 Py_INCREF(Py_True); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1220 return Py_True; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1221 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1222 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1223 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1224 static PyObject * |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
1225 PyCursesWindow_NoOutRefresh(PyCursesWindowObject *self, PyObject *args) |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1226 { |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1227 int pminrow,pmincol,sminrow,smincol,smaxrow,smaxcol; |
|
12988
0eb531ce08d1
Release the global interpreter lock around the most important
Andrew M. Kuchling <amk@amk.ca>
parents:
12974
diff
changeset
|
1228 int rtn; |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1229 |
|
20647
dd78b1a71f3e
Check for HP/UX curses problems. Define _XOPEN_SOURCE_EXTENDED and
Martin v. Löwis <martin@v.loewis.de>
parents:
20583
diff
changeset
|
1230 #ifndef WINDOW_HAS_FLAGS |
|
16351
ef32bfa5f5c6
Patch #103485 from Donn Cave: patches to make the module compile on AIX and
Andrew M. Kuchling <amk@amk.ca>
parents:
16350
diff
changeset
|
1231 if (0) { |
|
ef32bfa5f5c6
Patch #103485 from Donn Cave: patches to make the module compile on AIX and
Andrew M. Kuchling <amk@amk.ca>
parents:
16350
diff
changeset
|
1232 #else |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1233 if (self->win->_flags & _ISPAD) { |
|
16351
ef32bfa5f5c6
Patch #103485 from Donn Cave: patches to make the module compile on AIX and
Andrew M. Kuchling <amk@amk.ca>
parents:
16350
diff
changeset
|
1234 #endif |
|
21756
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
1235 switch(PyTuple_Size(args)) { |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1236 case 6: |
|
21756
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
1237 if (!PyArg_ParseTuple(args, |
|
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
1238 "iiiiii;" \ |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1239 "pminrow,pmincol,sminrow,smincol,smaxrow,smaxcol", |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1240 &pminrow, &pmincol, &sminrow, |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1241 &smincol, &smaxrow, &smaxcol)) |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1242 return NULL; |
|
12988
0eb531ce08d1
Release the global interpreter lock around the most important
Andrew M. Kuchling <amk@amk.ca>
parents:
12974
diff
changeset
|
1243 Py_BEGIN_ALLOW_THREADS |
|
0eb531ce08d1
Release the global interpreter lock around the most important
Andrew M. Kuchling <amk@amk.ca>
parents:
12974
diff
changeset
|
1244 rtn = pnoutrefresh(self->win, |
|
0eb531ce08d1
Release the global interpreter lock around the most important
Andrew M. Kuchling <amk@amk.ca>
parents:
12974
diff
changeset
|
1245 pminrow, pmincol, sminrow, |
|
13039
1c8c101f2be1
Fix two typos (, instead of ;)
Andrew M. Kuchling <amk@amk.ca>
parents:
13036
diff
changeset
|
1246 smincol, smaxrow, smaxcol); |
|
12988
0eb531ce08d1
Release the global interpreter lock around the most important
Andrew M. Kuchling <amk@amk.ca>
parents:
12974
diff
changeset
|
1247 Py_END_ALLOW_THREADS |
|
0eb531ce08d1
Release the global interpreter lock around the most important
Andrew M. Kuchling <amk@amk.ca>
parents:
12974
diff
changeset
|
1248 return PyCursesCheckERR(rtn, "pnoutrefresh"); |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1249 default: |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1250 PyErr_SetString(PyCursesError, |
|
12988
0eb531ce08d1
Release the global interpreter lock around the most important
Andrew M. Kuchling <amk@amk.ca>
parents:
12974
diff
changeset
|
1251 "noutrefresh() called for a pad " |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1252 "requires 6 arguments"); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1253 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1254 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1255 } else { |
|
21756
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
1256 if (!PyArg_ParseTuple(args, ":noutrefresh")) |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1257 return NULL; |
|
12988
0eb531ce08d1
Release the global interpreter lock around the most important
Andrew M. Kuchling <amk@amk.ca>
parents:
12974
diff
changeset
|
1258 |
|
0eb531ce08d1
Release the global interpreter lock around the most important
Andrew M. Kuchling <amk@amk.ca>
parents:
12974
diff
changeset
|
1259 Py_BEGIN_ALLOW_THREADS |
|
0eb531ce08d1
Release the global interpreter lock around the most important
Andrew M. Kuchling <amk@amk.ca>
parents:
12974
diff
changeset
|
1260 rtn = wnoutrefresh(self->win); |
|
0eb531ce08d1
Release the global interpreter lock around the most important
Andrew M. Kuchling <amk@amk.ca>
parents:
12974
diff
changeset
|
1261 Py_END_ALLOW_THREADS |
|
0eb531ce08d1
Release the global interpreter lock around the most important
Andrew M. Kuchling <amk@amk.ca>
parents:
12974
diff
changeset
|
1262 return PyCursesCheckERR(rtn, "wnoutrefresh"); |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1263 } |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1264 } |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1265 |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1266 static PyObject * |
|
15638
7639a9552479
Another patch from Thomas Gellekum: add .overlay() and .overwrite()
Andrew M. Kuchling <amk@amk.ca>
parents:
15574
diff
changeset
|
1267 PyCursesWindow_Overlay(PyCursesWindowObject *self, PyObject *args) |
|
7639a9552479
Another patch from Thomas Gellekum: add .overlay() and .overwrite()
Andrew M. Kuchling <amk@amk.ca>
parents:
15574
diff
changeset
|
1268 { |
|
7639a9552479
Another patch from Thomas Gellekum: add .overlay() and .overwrite()
Andrew M. Kuchling <amk@amk.ca>
parents:
15574
diff
changeset
|
1269 PyCursesWindowObject *temp; |
|
7639a9552479
Another patch from Thomas Gellekum: add .overlay() and .overwrite()
Andrew M. Kuchling <amk@amk.ca>
parents:
15574
diff
changeset
|
1270 int use_copywin = FALSE; |
|
7639a9552479
Another patch from Thomas Gellekum: add .overlay() and .overwrite()
Andrew M. Kuchling <amk@amk.ca>
parents:
15574
diff
changeset
|
1271 int sminrow, smincol, dminrow, dmincol, dmaxrow, dmaxcol; |
|
7639a9552479
Another patch from Thomas Gellekum: add .overlay() and .overwrite()
Andrew M. Kuchling <amk@amk.ca>
parents:
15574
diff
changeset
|
1272 int rtn; |
|
7639a9552479
Another patch from Thomas Gellekum: add .overlay() and .overwrite()
Andrew M. Kuchling <amk@amk.ca>
parents:
15574
diff
changeset
|
1273 |
|
21756
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
1274 switch (PyTuple_Size(args)) { |
|
15638
7639a9552479
Another patch from Thomas Gellekum: add .overlay() and .overwrite()
Andrew M. Kuchling <amk@amk.ca>
parents:
15574
diff
changeset
|
1275 case 1: |
|
7639a9552479
Another patch from Thomas Gellekum: add .overlay() and .overwrite()
Andrew M. Kuchling <amk@amk.ca>
parents:
15574
diff
changeset
|
1276 if (!PyArg_ParseTuple(args, "O!;window object", |
|
7639a9552479
Another patch from Thomas Gellekum: add .overlay() and .overwrite()
Andrew M. Kuchling <amk@amk.ca>
parents:
15574
diff
changeset
|
1277 &PyCursesWindow_Type, &temp)) |
|
7639a9552479
Another patch from Thomas Gellekum: add .overlay() and .overwrite()
Andrew M. Kuchling <amk@amk.ca>
parents:
15574
diff
changeset
|
1278 return NULL; |
|
7639a9552479
Another patch from Thomas Gellekum: add .overlay() and .overwrite()
Andrew M. Kuchling <amk@amk.ca>
parents:
15574
diff
changeset
|
1279 break; |
|
7639a9552479
Another patch from Thomas Gellekum: add .overlay() and .overwrite()
Andrew M. Kuchling <amk@amk.ca>
parents:
15574
diff
changeset
|
1280 case 7: |
|
36263
3c030edff985
SF bug #1400822, Extended version of _curses over{lay,write} does not work
Neal Norwitz <nnorwitz@gmail.com>
parents:
35999
diff
changeset
|
1281 if (!PyArg_ParseTuple(args, "O!iiiiii;window object, int, int, int, int, int, int", |
|
15638
7639a9552479
Another patch from Thomas Gellekum: add .overlay() and .overwrite()
Andrew M. Kuchling <amk@amk.ca>
parents:
15574
diff
changeset
|
1282 &PyCursesWindow_Type, &temp, &sminrow, &smincol, |
|
7639a9552479
Another patch from Thomas Gellekum: add .overlay() and .overwrite()
Andrew M. Kuchling <amk@amk.ca>
parents:
15574
diff
changeset
|
1283 &dminrow, &dmincol, &dmaxrow, &dmaxcol)) |
|
7639a9552479
Another patch from Thomas Gellekum: add .overlay() and .overwrite()
Andrew M. Kuchling <amk@amk.ca>
parents:
15574
diff
changeset
|
1284 return NULL; |
|
7639a9552479
Another patch from Thomas Gellekum: add .overlay() and .overwrite()
Andrew M. Kuchling <amk@amk.ca>
parents:
15574
diff
changeset
|
1285 use_copywin = TRUE; |
|
7639a9552479
Another patch from Thomas Gellekum: add .overlay() and .overwrite()
Andrew M. Kuchling <amk@amk.ca>
parents:
15574
diff
changeset
|
1286 break; |
|
7639a9552479
Another patch from Thomas Gellekum: add .overlay() and .overwrite()
Andrew M. Kuchling <amk@amk.ca>
parents:
15574
diff
changeset
|
1287 default: |
|
7639a9552479
Another patch from Thomas Gellekum: add .overlay() and .overwrite()
Andrew M. Kuchling <amk@amk.ca>
parents:
15574
diff
changeset
|
1288 PyErr_SetString(PyExc_TypeError, |
|
7639a9552479
Another patch from Thomas Gellekum: add .overlay() and .overwrite()
Andrew M. Kuchling <amk@amk.ca>
parents:
15574
diff
changeset
|
1289 "overlay requires one or seven arguments"); |
|
7639a9552479
Another patch from Thomas Gellekum: add .overlay() and .overwrite()
Andrew M. Kuchling <amk@amk.ca>
parents:
15574
diff
changeset
|
1290 return NULL; |
|
7639a9552479
Another patch from Thomas Gellekum: add .overlay() and .overwrite()
Andrew M. Kuchling <amk@amk.ca>
parents:
15574
diff
changeset
|
1291 } |
|
7639a9552479
Another patch from Thomas Gellekum: add .overlay() and .overwrite()
Andrew M. Kuchling <amk@amk.ca>
parents:
15574
diff
changeset
|
1292 |
|
7639a9552479
Another patch from Thomas Gellekum: add .overlay() and .overwrite()
Andrew M. Kuchling <amk@amk.ca>
parents:
15574
diff
changeset
|
1293 if (use_copywin == TRUE) { |
|
7639a9552479
Another patch from Thomas Gellekum: add .overlay() and .overwrite()
Andrew M. Kuchling <amk@amk.ca>
parents:
15574
diff
changeset
|
1294 rtn = copywin(self->win, temp->win, sminrow, smincol, |
|
7639a9552479
Another patch from Thomas Gellekum: add .overlay() and .overwrite()
Andrew M. Kuchling <amk@amk.ca>
parents:
15574
diff
changeset
|
1295 dminrow, dmincol, dmaxrow, dmaxcol, TRUE); |
|
7639a9552479
Another patch from Thomas Gellekum: add .overlay() and .overwrite()
Andrew M. Kuchling <amk@amk.ca>
parents:
15574
diff
changeset
|
1296 return PyCursesCheckERR(rtn, "copywin"); |
|
7639a9552479
Another patch from Thomas Gellekum: add .overlay() and .overwrite()
Andrew M. Kuchling <amk@amk.ca>
parents:
15574
diff
changeset
|
1297 } |
|
7639a9552479
Another patch from Thomas Gellekum: add .overlay() and .overwrite()
Andrew M. Kuchling <amk@amk.ca>
parents:
15574
diff
changeset
|
1298 else { |
|
7639a9552479
Another patch from Thomas Gellekum: add .overlay() and .overwrite()
Andrew M. Kuchling <amk@amk.ca>
parents:
15574
diff
changeset
|
1299 rtn = overlay(self->win, temp->win); |
|
7639a9552479
Another patch from Thomas Gellekum: add .overlay() and .overwrite()
Andrew M. Kuchling <amk@amk.ca>
parents:
15574
diff
changeset
|
1300 return PyCursesCheckERR(rtn, "overlay"); |
|
7639a9552479
Another patch from Thomas Gellekum: add .overlay() and .overwrite()
Andrew M. Kuchling <amk@amk.ca>
parents:
15574
diff
changeset
|
1301 } |
|
7639a9552479
Another patch from Thomas Gellekum: add .overlay() and .overwrite()
Andrew M. Kuchling <amk@amk.ca>
parents:
15574
diff
changeset
|
1302 } |
|
7639a9552479
Another patch from Thomas Gellekum: add .overlay() and .overwrite()
Andrew M. Kuchling <amk@amk.ca>
parents:
15574
diff
changeset
|
1303 |
|
7639a9552479
Another patch from Thomas Gellekum: add .overlay() and .overwrite()
Andrew M. Kuchling <amk@amk.ca>
parents:
15574
diff
changeset
|
1304 static PyObject * |
|
7639a9552479
Another patch from Thomas Gellekum: add .overlay() and .overwrite()
Andrew M. Kuchling <amk@amk.ca>
parents:
15574
diff
changeset
|
1305 PyCursesWindow_Overwrite(PyCursesWindowObject *self, PyObject *args) |
|
7639a9552479
Another patch from Thomas Gellekum: add .overlay() and .overwrite()
Andrew M. Kuchling <amk@amk.ca>
parents:
15574
diff
changeset
|
1306 { |
|
7639a9552479
Another patch from Thomas Gellekum: add .overlay() and .overwrite()
Andrew M. Kuchling <amk@amk.ca>
parents:
15574
diff
changeset
|
1307 PyCursesWindowObject *temp; |
|
7639a9552479
Another patch from Thomas Gellekum: add .overlay() and .overwrite()
Andrew M. Kuchling <amk@amk.ca>
parents:
15574
diff
changeset
|
1308 int use_copywin = FALSE; |
|
7639a9552479
Another patch from Thomas Gellekum: add .overlay() and .overwrite()
Andrew M. Kuchling <amk@amk.ca>
parents:
15574
diff
changeset
|
1309 int sminrow, smincol, dminrow, dmincol, dmaxrow, dmaxcol; |
|
7639a9552479
Another patch from Thomas Gellekum: add .overlay() and .overwrite()
Andrew M. Kuchling <amk@amk.ca>
parents:
15574
diff
changeset
|
1310 int rtn; |
|
7639a9552479
Another patch from Thomas Gellekum: add .overlay() and .overwrite()
Andrew M. Kuchling <amk@amk.ca>
parents:
15574
diff
changeset
|
1311 |
|
21756
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
1312 switch (PyTuple_Size(args)) { |
|
15638
7639a9552479
Another patch from Thomas Gellekum: add .overlay() and .overwrite()
Andrew M. Kuchling <amk@amk.ca>
parents:
15574
diff
changeset
|
1313 case 1: |
|
7639a9552479
Another patch from Thomas Gellekum: add .overlay() and .overwrite()
Andrew M. Kuchling <amk@amk.ca>
parents:
15574
diff
changeset
|
1314 if (!PyArg_ParseTuple(args, "O!;window object", |
|
7639a9552479
Another patch from Thomas Gellekum: add .overlay() and .overwrite()
Andrew M. Kuchling <amk@amk.ca>
parents:
15574
diff
changeset
|
1315 &PyCursesWindow_Type, &temp)) |
|
7639a9552479
Another patch from Thomas Gellekum: add .overlay() and .overwrite()
Andrew M. Kuchling <amk@amk.ca>
parents:
15574
diff
changeset
|
1316 return NULL; |
|
7639a9552479
Another patch from Thomas Gellekum: add .overlay() and .overwrite()
Andrew M. Kuchling <amk@amk.ca>
parents:
15574
diff
changeset
|
1317 break; |
|
7639a9552479
Another patch from Thomas Gellekum: add .overlay() and .overwrite()
Andrew M. Kuchling <amk@amk.ca>
parents:
15574
diff
changeset
|
1318 case 7: |
|
36263
3c030edff985
SF bug #1400822, Extended version of _curses over{lay,write} does not work
Neal Norwitz <nnorwitz@gmail.com>
parents:
35999
diff
changeset
|
1319 if (!PyArg_ParseTuple(args, "O!iiiiii;window object, int, int, int, int, int, int", |
|
15638
7639a9552479
Another patch from Thomas Gellekum: add .overlay() and .overwrite()
Andrew M. Kuchling <amk@amk.ca>
parents:
15574
diff
changeset
|
1320 &PyCursesWindow_Type, &temp, &sminrow, &smincol, |
|
7639a9552479
Another patch from Thomas Gellekum: add .overlay() and .overwrite()
Andrew M. Kuchling <amk@amk.ca>
parents:
15574
diff
changeset
|
1321 &dminrow, &dmincol, &dmaxrow, &dmaxcol)) |
|
7639a9552479
Another patch from Thomas Gellekum: add .overlay() and .overwrite()
Andrew M. Kuchling <amk@amk.ca>
parents:
15574
diff
changeset
|
1322 return NULL; |
|
7639a9552479
Another patch from Thomas Gellekum: add .overlay() and .overwrite()
Andrew M. Kuchling <amk@amk.ca>
parents:
15574
diff
changeset
|
1323 use_copywin = TRUE; |
|
7639a9552479
Another patch from Thomas Gellekum: add .overlay() and .overwrite()
Andrew M. Kuchling <amk@amk.ca>
parents:
15574
diff
changeset
|
1324 break; |
|
7639a9552479
Another patch from Thomas Gellekum: add .overlay() and .overwrite()
Andrew M. Kuchling <amk@amk.ca>
parents:
15574
diff
changeset
|
1325 default: |
|
7639a9552479
Another patch from Thomas Gellekum: add .overlay() and .overwrite()
Andrew M. Kuchling <amk@amk.ca>
parents:
15574
diff
changeset
|
1326 PyErr_SetString(PyExc_TypeError, |
|
7639a9552479
Another patch from Thomas Gellekum: add .overlay() and .overwrite()
Andrew M. Kuchling <amk@amk.ca>
parents:
15574
diff
changeset
|
1327 "overwrite requires one or seven arguments"); |
|
7639a9552479
Another patch from Thomas Gellekum: add .overlay() and .overwrite()
Andrew M. Kuchling <amk@amk.ca>
parents:
15574
diff
changeset
|
1328 return NULL; |
|
7639a9552479
Another patch from Thomas Gellekum: add .overlay() and .overwrite()
Andrew M. Kuchling <amk@amk.ca>
parents:
15574
diff
changeset
|
1329 } |
|
7639a9552479
Another patch from Thomas Gellekum: add .overlay() and .overwrite()
Andrew M. Kuchling <amk@amk.ca>
parents:
15574
diff
changeset
|
1330 |
|
7639a9552479
Another patch from Thomas Gellekum: add .overlay() and .overwrite()
Andrew M. Kuchling <amk@amk.ca>
parents:
15574
diff
changeset
|
1331 if (use_copywin == TRUE) { |
|
7639a9552479
Another patch from Thomas Gellekum: add .overlay() and .overwrite()
Andrew M. Kuchling <amk@amk.ca>
parents:
15574
diff
changeset
|
1332 rtn = copywin(self->win, temp->win, sminrow, smincol, |
|
7639a9552479
Another patch from Thomas Gellekum: add .overlay() and .overwrite()
Andrew M. Kuchling <amk@amk.ca>
parents:
15574
diff
changeset
|
1333 dminrow, dmincol, dmaxrow, dmaxcol, FALSE); |
|
7639a9552479
Another patch from Thomas Gellekum: add .overlay() and .overwrite()
Andrew M. Kuchling <amk@amk.ca>
parents:
15574
diff
changeset
|
1334 return PyCursesCheckERR(rtn, "copywin"); |
|
7639a9552479
Another patch from Thomas Gellekum: add .overlay() and .overwrite()
Andrew M. Kuchling <amk@amk.ca>
parents:
15574
diff
changeset
|
1335 } |
|
7639a9552479
Another patch from Thomas Gellekum: add .overlay() and .overwrite()
Andrew M. Kuchling <amk@amk.ca>
parents:
15574
diff
changeset
|
1336 else { |
|
7639a9552479
Another patch from Thomas Gellekum: add .overlay() and .overwrite()
Andrew M. Kuchling <amk@amk.ca>
parents:
15574
diff
changeset
|
1337 rtn = overwrite(self->win, temp->win); |
|
7639a9552479
Another patch from Thomas Gellekum: add .overlay() and .overwrite()
Andrew M. Kuchling <amk@amk.ca>
parents:
15574
diff
changeset
|
1338 return PyCursesCheckERR(rtn, "overwrite"); |
|
7639a9552479
Another patch from Thomas Gellekum: add .overlay() and .overwrite()
Andrew M. Kuchling <amk@amk.ca>
parents:
15574
diff
changeset
|
1339 } |
|
7639a9552479
Another patch from Thomas Gellekum: add .overlay() and .overwrite()
Andrew M. Kuchling <amk@amk.ca>
parents:
15574
diff
changeset
|
1340 } |
|
7639a9552479
Another patch from Thomas Gellekum: add .overlay() and .overwrite()
Andrew M. Kuchling <amk@amk.ca>
parents:
15574
diff
changeset
|
1341 |
|
7639a9552479
Another patch from Thomas Gellekum: add .overlay() and .overwrite()
Andrew M. Kuchling <amk@amk.ca>
parents:
15574
diff
changeset
|
1342 static PyObject * |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
1343 PyCursesWindow_PutWin(PyCursesWindowObject *self, PyObject *args) |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1344 { |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1345 PyObject *temp; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1346 |
|
21756
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
1347 if (!PyArg_ParseTuple(args, "O;fileobj", &temp)) |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1348 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1349 if (!PyFile_Check(temp)) { |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1350 PyErr_SetString(PyExc_TypeError, "argument must be a file object"); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1351 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1352 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1353 return PyCursesCheckERR(putwin(self->win, PyFile_AsFile(temp)), |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1354 "putwin"); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1355 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1356 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1357 static PyObject * |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
1358 PyCursesWindow_RedrawLine(PyCursesWindowObject *self, PyObject *args) |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1359 { |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1360 int beg, num; |
|
41816
ec83d21065aa
Stop using METH_OLDARGS implicitly
Neal Norwitz <nnorwitz@gmail.com>
parents:
41428
diff
changeset
|
1361 if (!PyArg_ParseTuple(args, "ii;beg,num", &beg, &num)) |
| 2357 | 1362 return NULL; |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1363 return PyCursesCheckERR(wredrawln(self->win,beg,num), "redrawln"); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1364 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1365 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1366 static PyObject * |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
1367 PyCursesWindow_Refresh(PyCursesWindowObject *self, PyObject *args) |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1368 { |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1369 int pminrow,pmincol,sminrow,smincol,smaxrow,smaxcol; |
|
12988
0eb531ce08d1
Release the global interpreter lock around the most important
Andrew M. Kuchling <amk@amk.ca>
parents:
12974
diff
changeset
|
1370 int rtn; |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1371 |
|
20647
dd78b1a71f3e
Check for HP/UX curses problems. Define _XOPEN_SOURCE_EXTENDED and
Martin v. Löwis <martin@v.loewis.de>
parents:
20583
diff
changeset
|
1372 #ifndef WINDOW_HAS_FLAGS |
|
16351
ef32bfa5f5c6
Patch #103485 from Donn Cave: patches to make the module compile on AIX and
Andrew M. Kuchling <amk@amk.ca>
parents:
16350
diff
changeset
|
1373 if (0) { |
|
ef32bfa5f5c6
Patch #103485 from Donn Cave: patches to make the module compile on AIX and
Andrew M. Kuchling <amk@amk.ca>
parents:
16350
diff
changeset
|
1374 #else |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1375 if (self->win->_flags & _ISPAD) { |
|
16351
ef32bfa5f5c6
Patch #103485 from Donn Cave: patches to make the module compile on AIX and
Andrew M. Kuchling <amk@amk.ca>
parents:
16350
diff
changeset
|
1376 #endif |
|
21756
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
1377 switch(PyTuple_Size(args)) { |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1378 case 6: |
|
21756
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
1379 if (!PyArg_ParseTuple(args, |
|
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
1380 "iiiiii;" \ |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1381 "pminrow,pmincol,sminrow,smincol,smaxrow,smaxcol", |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1382 &pminrow, &pmincol, &sminrow, |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1383 &smincol, &smaxrow, &smaxcol)) |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1384 return NULL; |
|
12988
0eb531ce08d1
Release the global interpreter lock around the most important
Andrew M. Kuchling <amk@amk.ca>
parents:
12974
diff
changeset
|
1385 |
|
0eb531ce08d1
Release the global interpreter lock around the most important
Andrew M. Kuchling <amk@amk.ca>
parents:
12974
diff
changeset
|
1386 Py_BEGIN_ALLOW_THREADS |
|
0eb531ce08d1
Release the global interpreter lock around the most important
Andrew M. Kuchling <amk@amk.ca>
parents:
12974
diff
changeset
|
1387 rtn = prefresh(self->win, |
|
0eb531ce08d1
Release the global interpreter lock around the most important
Andrew M. Kuchling <amk@amk.ca>
parents:
12974
diff
changeset
|
1388 pminrow, pmincol, sminrow, |
|
13039
1c8c101f2be1
Fix two typos (, instead of ;)
Andrew M. Kuchling <amk@amk.ca>
parents:
13036
diff
changeset
|
1389 smincol, smaxrow, smaxcol); |
|
12988
0eb531ce08d1
Release the global interpreter lock around the most important
Andrew M. Kuchling <amk@amk.ca>
parents:
12974
diff
changeset
|
1390 Py_END_ALLOW_THREADS |
|
0eb531ce08d1
Release the global interpreter lock around the most important
Andrew M. Kuchling <amk@amk.ca>
parents:
12974
diff
changeset
|
1391 return PyCursesCheckERR(rtn, "prefresh"); |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1392 default: |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1393 PyErr_SetString(PyCursesError, |
|
12988
0eb531ce08d1
Release the global interpreter lock around the most important
Andrew M. Kuchling <amk@amk.ca>
parents:
12974
diff
changeset
|
1394 "refresh() for a pad requires 6 arguments"); |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1395 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1396 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1397 } else { |
|
21756
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
1398 if (!PyArg_ParseTuple(args, ":refresh")) |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1399 return NULL; |
|
12988
0eb531ce08d1
Release the global interpreter lock around the most important
Andrew M. Kuchling <amk@amk.ca>
parents:
12974
diff
changeset
|
1400 Py_BEGIN_ALLOW_THREADS |
|
0eb531ce08d1
Release the global interpreter lock around the most important
Andrew M. Kuchling <amk@amk.ca>
parents:
12974
diff
changeset
|
1401 rtn = wrefresh(self->win); |
|
0eb531ce08d1
Release the global interpreter lock around the most important
Andrew M. Kuchling <amk@amk.ca>
parents:
12974
diff
changeset
|
1402 Py_END_ALLOW_THREADS |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
1403 return PyCursesCheckERR(rtn, "prefresh"); |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1404 } |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1405 } |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1406 |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1407 static PyObject * |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
1408 PyCursesWindow_SetScrollRegion(PyCursesWindowObject *self, PyObject *args) |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1409 { |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1410 int x, y; |
|
21756
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
1411 if (!PyArg_ParseTuple(args,"ii;top, bottom",&y,&x)) |
| 2357 | 1412 return NULL; |
| 1413 return PyCursesCheckERR(wsetscrreg(self->win,y,x), "wsetscrreg"); | |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1414 } |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1415 |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1416 static PyObject * |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
1417 PyCursesWindow_SubWin(PyCursesWindowObject *self, PyObject *args) |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1418 { |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1419 WINDOW *win; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1420 int nlines, ncols, begin_y, begin_x; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1421 |
|
12738
3d26cb3808a7
Changes by AMK: Use HAVE_NCURSES_H to include correct header file
Andrew M. Kuchling <amk@amk.ca>
parents:
12737
diff
changeset
|
1422 nlines = 0; |
|
3d26cb3808a7
Changes by AMK: Use HAVE_NCURSES_H to include correct header file
Andrew M. Kuchling <amk@amk.ca>
parents:
12737
diff
changeset
|
1423 ncols = 0; |
|
21756
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
1424 switch (PyTuple_Size(args)) { |
|
12738
3d26cb3808a7
Changes by AMK: Use HAVE_NCURSES_H to include correct header file
Andrew M. Kuchling <amk@amk.ca>
parents:
12737
diff
changeset
|
1425 case 2: |
|
21756
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
1426 if (!PyArg_ParseTuple(args,"ii;begin_y,begin_x",&begin_y,&begin_x)) |
|
12738
3d26cb3808a7
Changes by AMK: Use HAVE_NCURSES_H to include correct header file
Andrew M. Kuchling <amk@amk.ca>
parents:
12737
diff
changeset
|
1427 return NULL; |
|
3d26cb3808a7
Changes by AMK: Use HAVE_NCURSES_H to include correct header file
Andrew M. Kuchling <amk@amk.ca>
parents:
12737
diff
changeset
|
1428 break; |
|
3d26cb3808a7
Changes by AMK: Use HAVE_NCURSES_H to include correct header file
Andrew M. Kuchling <amk@amk.ca>
parents:
12737
diff
changeset
|
1429 case 4: |
|
21756
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
1430 if (!PyArg_ParseTuple(args, "iiii;nlines,ncols,begin_y,begin_x", |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1431 &nlines,&ncols,&begin_y,&begin_x)) |
|
12738
3d26cb3808a7
Changes by AMK: Use HAVE_NCURSES_H to include correct header file
Andrew M. Kuchling <amk@amk.ca>
parents:
12737
diff
changeset
|
1432 return NULL; |
|
3d26cb3808a7
Changes by AMK: Use HAVE_NCURSES_H to include correct header file
Andrew M. Kuchling <amk@amk.ca>
parents:
12737
diff
changeset
|
1433 break; |
|
3d26cb3808a7
Changes by AMK: Use HAVE_NCURSES_H to include correct header file
Andrew M. Kuchling <amk@amk.ca>
parents:
12737
diff
changeset
|
1434 default: |
|
3d26cb3808a7
Changes by AMK: Use HAVE_NCURSES_H to include correct header file
Andrew M. Kuchling <amk@amk.ca>
parents:
12737
diff
changeset
|
1435 PyErr_SetString(PyExc_TypeError, "subwin requires 2 or 4 arguments"); |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1436 return NULL; |
|
12738
3d26cb3808a7
Changes by AMK: Use HAVE_NCURSES_H to include correct header file
Andrew M. Kuchling <amk@amk.ca>
parents:
12737
diff
changeset
|
1437 } |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1438 |
|
13721
05d59f4476ad
Comment out a debugging print (spotted by Michael Deegan)
Andrew M. Kuchling <amk@amk.ca>
parents:
13715
diff
changeset
|
1439 /* printf("Subwin: %i %i %i %i \n", nlines, ncols, begin_y, begin_x); */ |
|
20647
dd78b1a71f3e
Check for HP/UX curses problems. Define _XOPEN_SOURCE_EXTENDED and
Martin v. Löwis <martin@v.loewis.de>
parents:
20583
diff
changeset
|
1440 #ifdef WINDOW_HAS_FLAGS |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1441 if (self->win->_flags & _ISPAD) |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1442 win = subpad(self->win, nlines, ncols, begin_y, begin_x); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1443 else |
|
16351
ef32bfa5f5c6
Patch #103485 from Donn Cave: patches to make the module compile on AIX and
Andrew M. Kuchling <amk@amk.ca>
parents:
16350
diff
changeset
|
1444 #endif |
|
12738
3d26cb3808a7
Changes by AMK: Use HAVE_NCURSES_H to include correct header file
Andrew M. Kuchling <amk@amk.ca>
parents:
12737
diff
changeset
|
1445 win = subwin(self->win, nlines, ncols, begin_y, begin_x); |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1446 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1447 if (win == NULL) { |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1448 PyErr_SetString(PyCursesError, catchall_NULL); |
| 2357 | 1449 return NULL; |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1450 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1451 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1452 return (PyObject *)PyCursesWindow_New(win); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1453 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1454 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1455 static PyObject * |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
1456 PyCursesWindow_Scroll(PyCursesWindowObject *self, PyObject *args) |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1457 { |
|
16350
66d4bf56e32d
Rename 'lines' variable to 'nlines' to avoid conflict with a macro defined
Andrew M. Kuchling <amk@amk.ca>
parents:
16323
diff
changeset
|
1458 int nlines; |
|
21756
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
1459 switch(PyTuple_Size(args)) { |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1460 case 0: |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1461 return PyCursesCheckERR(scroll(self->win), "scroll"); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1462 case 1: |
|
21756
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
1463 if (!PyArg_ParseTuple(args, "i;nlines", &nlines)) |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1464 return NULL; |
|
16350
66d4bf56e32d
Rename 'lines' variable to 'nlines' to avoid conflict with a macro defined
Andrew M. Kuchling <amk@amk.ca>
parents:
16323
diff
changeset
|
1465 return PyCursesCheckERR(wscrl(self->win, nlines), "scroll"); |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1466 default: |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1467 PyErr_SetString(PyExc_TypeError, "scroll requires 0 or 1 arguments"); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1468 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1469 } |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1470 } |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1471 |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1472 static PyObject * |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
1473 PyCursesWindow_TouchLine(PyCursesWindowObject *self, PyObject *args) |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1474 { |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1475 int st, cnt, val; |
|
21756
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
1476 switch (PyTuple_Size(args)) { |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1477 case 2: |
|
21756
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
1478 if (!PyArg_ParseTuple(args,"ii;start,count",&st,&cnt)) |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1479 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1480 return PyCursesCheckERR(touchline(self->win,st,cnt), "touchline"); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1481 case 3: |
|
21756
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
1482 if (!PyArg_ParseTuple(args, "iii;start,count,val", &st, &cnt, &val)) |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1483 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1484 return PyCursesCheckERR(wtouchln(self->win, st, cnt, val), "touchline"); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1485 default: |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1486 PyErr_SetString(PyExc_TypeError, "touchline requires 2 or 3 arguments"); |
| 2357 | 1487 return NULL; |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1488 } |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1489 } |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1490 |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1491 static PyObject * |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
1492 PyCursesWindow_Vline(PyCursesWindowObject *self, PyObject *args) |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1493 { |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1494 PyObject *temp; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1495 chtype ch; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1496 int n, x, y, code = OK; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1497 attr_t attr = A_NORMAL; |
|
44595
d1a1ba502579
Patch 1114: fix compilation of curses module on 64-bit AIX, and any other LP64 platforms where attr_t isn't a C long
Andrew M. Kuchling <amk@amk.ca>
parents:
44439
diff
changeset
|
1498 long lattr; |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1499 |
|
21756
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
1500 switch (PyTuple_Size(args)) { |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1501 case 2: |
|
21756
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
1502 if (!PyArg_ParseTuple(args, "Oi;ch or int,n", &temp, &n)) |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1503 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1504 break; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1505 case 3: |
|
44595
d1a1ba502579
Patch 1114: fix compilation of curses module on 64-bit AIX, and any other LP64 platforms where attr_t isn't a C long
Andrew M. Kuchling <amk@amk.ca>
parents:
44439
diff
changeset
|
1506 if (!PyArg_ParseTuple(args, "Oil;ch or int,n,attr", &temp, &n, &lattr)) |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1507 return NULL; |
|
44595
d1a1ba502579
Patch 1114: fix compilation of curses module on 64-bit AIX, and any other LP64 platforms where attr_t isn't a C long
Andrew M. Kuchling <amk@amk.ca>
parents:
44439
diff
changeset
|
1508 attr = lattr; |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1509 break; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1510 case 4: |
|
21756
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
1511 if (!PyArg_ParseTuple(args, "iiOi;y,x,ch or int,n", &y, &x, &temp, &n)) |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1512 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1513 code = wmove(self->win, y, x); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1514 break; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1515 case 5: |
|
21756
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
1516 if (!PyArg_ParseTuple(args, "iiOil; y,x,ch or int,n,attr", |
|
44595
d1a1ba502579
Patch 1114: fix compilation of curses module on 64-bit AIX, and any other LP64 platforms where attr_t isn't a C long
Andrew M. Kuchling <amk@amk.ca>
parents:
44439
diff
changeset
|
1517 &y, &x, &temp, &n, &lattr)) |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1518 return NULL; |
|
44595
d1a1ba502579
Patch 1114: fix compilation of curses module on 64-bit AIX, and any other LP64 platforms where attr_t isn't a C long
Andrew M. Kuchling <amk@amk.ca>
parents:
44439
diff
changeset
|
1519 attr = lattr; |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1520 code = wmove(self->win, y, x); |
|
20583
b5ca0687ba6a
Add two forgotten 'break' statements
Andrew M. Kuchling <amk@amk.ca>
parents:
20412
diff
changeset
|
1521 break; |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1522 default: |
|
20583
b5ca0687ba6a
Add two forgotten 'break' statements
Andrew M. Kuchling <amk@amk.ca>
parents:
20412
diff
changeset
|
1523 PyErr_SetString(PyExc_TypeError, "vline requires 2 to 5 arguments"); |
| 2357 | 1524 return NULL; |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1525 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1526 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1527 if (code != ERR) { |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1528 if (!PyCurses_ConvertToChtype(temp, &ch)) { |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1529 PyErr_SetString(PyExc_TypeError, |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1530 "argument 1 or 3 must be a ch or an int"); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1531 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1532 } |
|
12738
3d26cb3808a7
Changes by AMK: Use HAVE_NCURSES_H to include correct header file
Andrew M. Kuchling <amk@amk.ca>
parents:
12737
diff
changeset
|
1533 return PyCursesCheckERR(wvline(self->win, ch | attr, n), "vline"); |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1534 } else |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1535 return PyCursesCheckERR(code, "wmove"); |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1536 } |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1537 |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1538 static PyMethodDef PyCursesWindow_Methods[] = { |
|
21756
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
1539 {"addch", (PyCFunction)PyCursesWindow_AddCh, METH_VARARGS}, |
|
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
1540 {"addnstr", (PyCFunction)PyCursesWindow_AddNStr, METH_VARARGS}, |
|
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
1541 {"addstr", (PyCFunction)PyCursesWindow_AddStr, METH_VARARGS}, |
|
44595
d1a1ba502579
Patch 1114: fix compilation of curses module on 64-bit AIX, and any other LP64 platforms where attr_t isn't a C long
Andrew M. Kuchling <amk@amk.ca>
parents:
44439
diff
changeset
|
1542 {"attroff", (PyCFunction)PyCursesWindow_AttrOff, METH_VARARGS}, |
|
d1a1ba502579
Patch 1114: fix compilation of curses module on 64-bit AIX, and any other LP64 platforms where attr_t isn't a C long
Andrew M. Kuchling <amk@amk.ca>
parents:
44439
diff
changeset
|
1543 {"attron", (PyCFunction)PyCursesWindow_AttrOn, METH_VARARGS}, |
|
d1a1ba502579
Patch 1114: fix compilation of curses module on 64-bit AIX, and any other LP64 platforms where attr_t isn't a C long
Andrew M. Kuchling <amk@amk.ca>
parents:
44439
diff
changeset
|
1544 {"attrset", (PyCFunction)PyCursesWindow_AttrSet, METH_VARARGS}, |
|
21756
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
1545 {"bkgd", (PyCFunction)PyCursesWindow_Bkgd, METH_VARARGS}, |
|
41427
40110d06e82a
Add window.chgat() method, submitted via e-mail by Fabian Kreutz
Andrew M. Kuchling <amk@amk.ca>
parents:
41039
diff
changeset
|
1546 {"chgat", (PyCFunction)PyCursesWindow_ChgAt, METH_VARARGS}, |
|
21756
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
1547 {"bkgdset", (PyCFunction)PyCursesWindow_BkgdSet, METH_VARARGS}, |
|
2569
7a3733732901
Added some (method) casts.
Sjoerd Mullender <sjoerd@acm.org>
parents:
2423
diff
changeset
|
1548 {"border", (PyCFunction)PyCursesWindow_Border, METH_VARARGS}, |
|
21756
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
1549 {"box", (PyCFunction)PyCursesWindow_Box, METH_VARARGS}, |
|
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
1550 {"clear", (PyCFunction)PyCursesWindow_wclear, METH_NOARGS}, |
|
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
1551 {"clearok", (PyCFunction)PyCursesWindow_clearok, METH_VARARGS}, |
|
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
1552 {"clrtobot", (PyCFunction)PyCursesWindow_wclrtobot, METH_NOARGS}, |
|
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
1553 {"clrtoeol", (PyCFunction)PyCursesWindow_wclrtoeol, METH_NOARGS}, |
|
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
1554 {"cursyncup", (PyCFunction)PyCursesWindow_wcursyncup, METH_NOARGS}, |
|
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
1555 {"delch", (PyCFunction)PyCursesWindow_DelCh, METH_VARARGS}, |
|
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
1556 {"deleteln", (PyCFunction)PyCursesWindow_wdeleteln, METH_NOARGS}, |
|
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
1557 {"derwin", (PyCFunction)PyCursesWindow_DerWin, METH_VARARGS}, |
|
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
1558 {"echochar", (PyCFunction)PyCursesWindow_EchoChar, METH_VARARGS}, |
|
13036
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
1559 #ifdef NCURSES_MOUSE_VERSION |
|
21756
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
1560 {"enclose", (PyCFunction)PyCursesWindow_Enclose, METH_VARARGS}, |
|
13036
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
1561 #endif |
|
21756
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
1562 {"erase", (PyCFunction)PyCursesWindow_werase, METH_NOARGS}, |
|
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
1563 {"getbegyx", (PyCFunction)PyCursesWindow_getbegyx, METH_NOARGS}, |
|
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
1564 {"getbkgd", (PyCFunction)PyCursesWindow_GetBkgd, METH_NOARGS}, |
|
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
1565 {"getch", (PyCFunction)PyCursesWindow_GetCh, METH_VARARGS}, |
|
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
1566 {"getkey", (PyCFunction)PyCursesWindow_GetKey, METH_VARARGS}, |
|
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
1567 {"getmaxyx", (PyCFunction)PyCursesWindow_getmaxyx, METH_NOARGS}, |
|
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
1568 {"getparyx", (PyCFunction)PyCursesWindow_getparyx, METH_NOARGS}, |
|
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
1569 {"getstr", (PyCFunction)PyCursesWindow_GetStr, METH_VARARGS}, |
|
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
1570 {"getyx", (PyCFunction)PyCursesWindow_getyx, METH_NOARGS}, |
|
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
1571 {"hline", (PyCFunction)PyCursesWindow_Hline, METH_VARARGS}, |
|
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
1572 {"idcok", (PyCFunction)PyCursesWindow_idcok, METH_VARARGS}, |
|
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
1573 {"idlok", (PyCFunction)PyCursesWindow_idlok, METH_VARARGS}, |
|
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
1574 {"immedok", (PyCFunction)PyCursesWindow_immedok, METH_VARARGS}, |
|
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
1575 {"inch", (PyCFunction)PyCursesWindow_InCh, METH_VARARGS}, |
|
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
1576 {"insch", (PyCFunction)PyCursesWindow_InsCh, METH_VARARGS}, |
|
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
1577 {"insdelln", (PyCFunction)PyCursesWindow_winsdelln, METH_VARARGS}, |
|
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
1578 {"insertln", (PyCFunction)PyCursesWindow_winsertln, METH_NOARGS}, |
|
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
1579 {"insnstr", (PyCFunction)PyCursesWindow_InsNStr, METH_VARARGS}, |
|
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
1580 {"insstr", (PyCFunction)PyCursesWindow_InsStr, METH_VARARGS}, |
|
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
1581 {"instr", (PyCFunction)PyCursesWindow_InStr, METH_VARARGS}, |
|
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
1582 {"is_linetouched", (PyCFunction)PyCursesWindow_Is_LineTouched, METH_VARARGS}, |
|
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
1583 {"is_wintouched", (PyCFunction)PyCursesWindow_is_wintouched, METH_NOARGS}, |
|
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
1584 {"keypad", (PyCFunction)PyCursesWindow_keypad, METH_VARARGS}, |
|
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
1585 {"leaveok", (PyCFunction)PyCursesWindow_leaveok, METH_VARARGS}, |
|
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
1586 {"move", (PyCFunction)PyCursesWindow_wmove, METH_VARARGS}, |
|
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
1587 {"mvderwin", (PyCFunction)PyCursesWindow_mvderwin, METH_VARARGS}, |
|
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
1588 {"mvwin", (PyCFunction)PyCursesWindow_mvwin, METH_VARARGS}, |
|
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
1589 {"nodelay", (PyCFunction)PyCursesWindow_nodelay, METH_VARARGS}, |
|
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
1590 {"notimeout", (PyCFunction)PyCursesWindow_notimeout, METH_VARARGS}, |
|
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
1591 {"noutrefresh", (PyCFunction)PyCursesWindow_NoOutRefresh, METH_VARARGS}, |
|
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
1592 /* Backward compatibility alias -- remove in Python 2.3 */ |
|
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
1593 {"nooutrefresh", (PyCFunction)PyCursesWindow_NoOutRefresh, METH_VARARGS}, |
|
20583
b5ca0687ba6a
Add two forgotten 'break' statements
Andrew M. Kuchling <amk@amk.ca>
parents:
20412
diff
changeset
|
1594 {"overlay", (PyCFunction)PyCursesWindow_Overlay, METH_VARARGS}, |
|
b5ca0687ba6a
Add two forgotten 'break' statements
Andrew M. Kuchling <amk@amk.ca>
parents:
20412
diff
changeset
|
1595 {"overwrite", (PyCFunction)PyCursesWindow_Overwrite, |
|
b5ca0687ba6a
Add two forgotten 'break' statements
Andrew M. Kuchling <amk@amk.ca>
parents:
20412
diff
changeset
|
1596 METH_VARARGS}, |
|
21756
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
1597 {"putwin", (PyCFunction)PyCursesWindow_PutWin, METH_VARARGS}, |
|
41816
ec83d21065aa
Stop using METH_OLDARGS implicitly
Neal Norwitz <nnorwitz@gmail.com>
parents:
41428
diff
changeset
|
1598 {"redrawln", (PyCFunction)PyCursesWindow_RedrawLine, METH_VARARGS}, |
|
21756
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
1599 {"redrawwin", (PyCFunction)PyCursesWindow_redrawwin, METH_NOARGS}, |
|
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
1600 {"refresh", (PyCFunction)PyCursesWindow_Refresh, METH_VARARGS}, |
|
13040
12ac2c267b93
Fixes for compiling on Tru64.
Andrew M. Kuchling <amk@amk.ca>
parents:
13039
diff
changeset
|
1601 #ifndef STRICT_SYSV_CURSES |
|
21756
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
1602 {"resize", (PyCFunction)PyCursesWindow_wresize, METH_VARARGS}, |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1603 #endif |
|
21756
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
1604 {"scroll", (PyCFunction)PyCursesWindow_Scroll, METH_VARARGS}, |
|
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
1605 {"scrollok", (PyCFunction)PyCursesWindow_scrollok, METH_VARARGS}, |
|
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
1606 {"setscrreg", (PyCFunction)PyCursesWindow_SetScrollRegion, METH_VARARGS}, |
|
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
1607 {"standend", (PyCFunction)PyCursesWindow_wstandend, METH_NOARGS}, |
|
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
1608 {"standout", (PyCFunction)PyCursesWindow_wstandout, METH_NOARGS}, |
|
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
1609 {"subpad", (PyCFunction)PyCursesWindow_SubWin, METH_VARARGS}, |
|
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
1610 {"subwin", (PyCFunction)PyCursesWindow_SubWin, METH_VARARGS}, |
|
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
1611 {"syncdown", (PyCFunction)PyCursesWindow_wsyncdown, METH_NOARGS}, |
|
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
1612 {"syncok", (PyCFunction)PyCursesWindow_syncok, METH_VARARGS}, |
|
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
1613 {"syncup", (PyCFunction)PyCursesWindow_wsyncup, METH_NOARGS}, |
|
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
1614 {"timeout", (PyCFunction)PyCursesWindow_wtimeout, METH_VARARGS}, |
|
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
1615 {"touchline", (PyCFunction)PyCursesWindow_TouchLine, METH_VARARGS}, |
|
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
1616 {"touchwin", (PyCFunction)PyCursesWindow_touchwin, METH_NOARGS}, |
|
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
1617 {"untouchwin", (PyCFunction)PyCursesWindow_untouchwin, METH_NOARGS}, |
|
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
1618 {"vline", (PyCFunction)PyCursesWindow_Vline, METH_VARARGS}, |
|
20583
b5ca0687ba6a
Add two forgotten 'break' statements
Andrew M. Kuchling <amk@amk.ca>
parents:
20412
diff
changeset
|
1619 {NULL, NULL} /* sentinel */ |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1620 }; |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1621 |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1622 static PyObject * |
|
13651
8a063423e0b7
Bunch of minor ANSIfications: 'void initfunc()' -> 'void initfunc(void)',
Thomas Wouters <thomas@python.org>
parents:
13465
diff
changeset
|
1623 PyCursesWindow_GetAttr(PyCursesWindowObject *self, char *name) |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1624 { |
|
2123
fd5ab7e828fc
cosmetic changes so these modules will work with the strict new naming scheme
Guido van Rossum <guido@python.org>
parents:
1888
diff
changeset
|
1625 return Py_FindMethod(PyCursesWindow_Methods, (PyObject *)self, name); |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1626 } |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1627 |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1628 /* -------------------------------------------------------*/ |
| 2357 | 1629 |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1630 PyTypeObject PyCursesWindow_Type = { |
|
42333
6620a510e9a9
PEP 3123: Provide forward compatibility with Python 3.0, while keeping
Martin v. Löwis <martin@v.loewis.de>
parents:
41816
diff
changeset
|
1631 PyVarObject_HEAD_INIT(NULL, 0) |
|
21313
91dd223829c6
Patch supplied by Burton Radons for his own SF bug #487390: Modifying
Guido van Rossum <guido@python.org>
parents:
20956
diff
changeset
|
1632 "_curses.curses window", /*tp_name*/ |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1633 sizeof(PyCursesWindowObject), /*tp_basicsize*/ |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1634 0, /*tp_itemsize*/ |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1635 /* methods */ |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1636 (destructor)PyCursesWindow_Dealloc, /*tp_dealloc*/ |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1637 0, /*tp_print*/ |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1638 (getattrfunc)PyCursesWindow_GetAttr, /*tp_getattr*/ |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1639 (setattrfunc)0, /*tp_setattr*/ |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1640 0, /*tp_compare*/ |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1641 0, /*tp_repr*/ |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1642 0, /*tp_as_number*/ |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1643 0, /*tp_as_sequence*/ |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1644 0, /*tp_as_mapping*/ |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1645 0, /*tp_hash*/ |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1646 }; |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1647 |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1648 /********************************************************************* |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1649 Global Functions |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1650 **********************************************************************/ |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1651 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1652 NoArgNoReturnFunction(beep) |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1653 NoArgNoReturnFunction(def_prog_mode) |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1654 NoArgNoReturnFunction(def_shell_mode) |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1655 NoArgNoReturnFunction(doupdate) |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1656 NoArgNoReturnFunction(endwin) |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1657 NoArgNoReturnFunction(flash) |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1658 NoArgNoReturnFunction(nocbreak) |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1659 NoArgNoReturnFunction(noecho) |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1660 NoArgNoReturnFunction(nonl) |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1661 NoArgNoReturnFunction(noraw) |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1662 NoArgNoReturnFunction(reset_prog_mode) |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1663 NoArgNoReturnFunction(reset_shell_mode) |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1664 NoArgNoReturnFunction(resetty) |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1665 NoArgNoReturnFunction(savetty) |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1666 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1667 NoArgOrFlagNoReturnFunction(cbreak) |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1668 NoArgOrFlagNoReturnFunction(echo) |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1669 NoArgOrFlagNoReturnFunction(nl) |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1670 NoArgOrFlagNoReturnFunction(raw) |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1671 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1672 NoArgReturnIntFunction(baudrate) |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1673 NoArgReturnIntFunction(termattrs) |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1674 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1675 NoArgReturnStringFunction(termname) |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1676 NoArgReturnStringFunction(longname) |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1677 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1678 NoArgTrueFalseFunction(can_change_color) |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1679 NoArgTrueFalseFunction(has_colors) |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1680 NoArgTrueFalseFunction(has_ic) |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1681 NoArgTrueFalseFunction(has_il) |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1682 NoArgTrueFalseFunction(isendwin) |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1683 NoArgNoReturnVoidFunction(flushinp) |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1684 NoArgNoReturnVoidFunction(noqiflush) |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1685 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1686 static PyObject * |
|
44974
5e0b460f294a
#1940: make it possible to use curses.filter() before curses.initscr()
Georg Brandl <georg@python.org>
parents:
44610
diff
changeset
|
1687 PyCurses_filter(PyObject *self) |
|
5e0b460f294a
#1940: make it possible to use curses.filter() before curses.initscr()
Georg Brandl <georg@python.org>
parents:
44610
diff
changeset
|
1688 { |
|
5e0b460f294a
#1940: make it possible to use curses.filter() before curses.initscr()
Georg Brandl <georg@python.org>
parents:
44610
diff
changeset
|
1689 /* not checking for PyCursesInitialised here since filter() must |
|
5e0b460f294a
#1940: make it possible to use curses.filter() before curses.initscr()
Georg Brandl <georg@python.org>
parents:
44610
diff
changeset
|
1690 be called before initscr() */ |
|
5e0b460f294a
#1940: make it possible to use curses.filter() before curses.initscr()
Georg Brandl <georg@python.org>
parents:
44610
diff
changeset
|
1691 filter(); |
|
5e0b460f294a
#1940: make it possible to use curses.filter() before curses.initscr()
Georg Brandl <georg@python.org>
parents:
44610
diff
changeset
|
1692 Py_INCREF(Py_None); |
|
5e0b460f294a
#1940: make it possible to use curses.filter() before curses.initscr()
Georg Brandl <georg@python.org>
parents:
44610
diff
changeset
|
1693 return Py_None; |
|
5e0b460f294a
#1940: make it possible to use curses.filter() before curses.initscr()
Georg Brandl <georg@python.org>
parents:
44610
diff
changeset
|
1694 } |
|
5e0b460f294a
#1940: make it possible to use curses.filter() before curses.initscr()
Georg Brandl <georg@python.org>
parents:
44610
diff
changeset
|
1695 |
|
5e0b460f294a
#1940: make it possible to use curses.filter() before curses.initscr()
Georg Brandl <georg@python.org>
parents:
44610
diff
changeset
|
1696 static PyObject * |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
1697 PyCurses_Color_Content(PyObject *self, PyObject *args) |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1698 { |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1699 short color,r,g,b; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1700 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1701 PyCursesInitialised |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1702 PyCursesInitialisedColor |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1703 |
|
21756
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
1704 if (!PyArg_ParseTuple(args, "h:color_content", &color)) return NULL; |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1705 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1706 if (color_content(color, &r, &g, &b) != ERR) |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1707 return Py_BuildValue("(iii)", r, g, b); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1708 else { |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1709 PyErr_SetString(PyCursesError, |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1710 "Argument 1 was out of range. Check value of COLORS."); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1711 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1712 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1713 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1714 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1715 static PyObject * |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
1716 PyCurses_color_pair(PyObject *self, PyObject *args) |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1717 { |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1718 int n; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1719 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1720 PyCursesInitialised |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1721 PyCursesInitialisedColor |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1722 |
|
21756
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
1723 if (!PyArg_ParseTuple(args, "i:color_pair", &n)) return NULL; |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1724 return PyInt_FromLong((long) (n << 8)); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1725 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1726 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1727 static PyObject * |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
1728 PyCurses_Curs_Set(PyObject *self, PyObject *args) |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1729 { |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1730 int vis,erg; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1731 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1732 PyCursesInitialised |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1733 |
|
21756
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
1734 if (!PyArg_ParseTuple(args, "i:curs_set", &vis)) return NULL; |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1735 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1736 erg = curs_set(vis); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1737 if (erg == ERR) return PyCursesCheckERR(erg, "curs_set"); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1738 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1739 return PyInt_FromLong((long) erg); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1740 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1741 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1742 static PyObject * |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
1743 PyCurses_Delay_Output(PyObject *self, PyObject *args) |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1744 { |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1745 int ms; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1746 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1747 PyCursesInitialised |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1748 |
|
21756
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
1749 if (!PyArg_ParseTuple(args, "i:delay_output", &ms)) return NULL; |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1750 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1751 return PyCursesCheckERR(delay_output(ms), "delay_output"); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1752 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1753 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1754 static PyObject * |
|
21756
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
1755 PyCurses_EraseChar(PyObject *self) |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1756 { |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1757 char ch; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1758 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1759 PyCursesInitialised |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1760 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1761 ch = erasechar(); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1762 |
|
47527
52294af4b663
This reverts r63675 based on the discussion in this thread:
Gregory P. Smith <greg@mad-scientist.com>
parents:
47294
diff
changeset
|
1763 return PyString_FromStringAndSize(&ch, 1); |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1764 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1765 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1766 static PyObject * |
|
21756
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
1767 PyCurses_getsyx(PyObject *self) |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1768 { |
|
55297
a29babb54884
Initialize variables in PyCurses_getsyx() to avoid compiler warnings.
Alexandre Vassalotti <alexandre@peadrop.com>
parents:
47768
diff
changeset
|
1769 int x = 0; |
|
a29babb54884
Initialize variables in PyCurses_getsyx() to avoid compiler warnings.
Alexandre Vassalotti <alexandre@peadrop.com>
parents:
47768
diff
changeset
|
1770 int y = 0; |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1771 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1772 PyCursesInitialised |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1773 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1774 getsyx(y, x); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1775 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1776 return Py_BuildValue("(ii)", y, x); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1777 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1778 |
|
13036
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
1779 #ifdef NCURSES_MOUSE_VERSION |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
1780 static PyObject * |
|
21756
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
1781 PyCurses_GetMouse(PyObject *self) |
|
13036
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
1782 { |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
1783 int rtn; |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
1784 MEVENT event; |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
1785 |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
1786 PyCursesInitialised |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
1787 |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
1788 rtn = getmouse( &event ); |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
1789 if (rtn == ERR) { |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
1790 PyErr_SetString(PyCursesError, "getmouse() returned ERR"); |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
1791 return NULL; |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
1792 } |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
1793 return Py_BuildValue("(hiiil)", |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
1794 (short)event.id, |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
1795 event.x, event.y, event.z, |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
1796 (long) event.bstate); |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
1797 } |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
1798 |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
1799 static PyObject * |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
1800 PyCurses_UngetMouse(PyObject *self, PyObject *args) |
|
13036
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
1801 { |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
1802 MEVENT event; |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
1803 |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
1804 PyCursesInitialised |
|
36263
3c030edff985
SF bug #1400822, Extended version of _curses over{lay,write} does not work
Neal Norwitz <nnorwitz@gmail.com>
parents:
35999
diff
changeset
|
1805 if (!PyArg_ParseTuple(args, "hiiil", |
|
13036
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
1806 &event.id, |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
1807 &event.x, &event.y, &event.z, |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
1808 (int *) &event.bstate)) |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
1809 return NULL; |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
1810 |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
1811 return PyCursesCheckERR(ungetmouse(&event), "ungetmouse"); |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
1812 } |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
1813 #endif |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
1814 |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1815 static PyObject * |
|
21756
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
1816 PyCurses_GetWin(PyCursesWindowObject *self, PyObject *temp) |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1817 { |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1818 WINDOW *win; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1819 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1820 PyCursesInitialised |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1821 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1822 if (!PyFile_Check(temp)) { |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1823 PyErr_SetString(PyExc_TypeError, "argument must be a file object"); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1824 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1825 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1826 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1827 win = getwin(PyFile_AsFile(temp)); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1828 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1829 if (win == NULL) { |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1830 PyErr_SetString(PyCursesError, catchall_NULL); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1831 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1832 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1833 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1834 return PyCursesWindow_New(win); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1835 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1836 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1837 static PyObject * |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
1838 PyCurses_HalfDelay(PyObject *self, PyObject *args) |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1839 { |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1840 unsigned char tenths; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1841 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1842 PyCursesInitialised |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1843 |
|
21756
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
1844 if (!PyArg_ParseTuple(args, "b:halfdelay", &tenths)) return NULL; |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1845 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1846 return PyCursesCheckERR(halfdelay(tenths), "halfdelay"); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1847 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1848 |
|
13708
fe89ea1c9108
Modified version of patch #100963 from Mark Favas: has_key() is an
Andrew M. Kuchling <amk@amk.ca>
parents:
13706
diff
changeset
|
1849 #ifndef STRICT_SYSV_CURSES |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1850 /* No has_key! */ |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
1851 static PyObject * PyCurses_has_key(PyObject *self, PyObject *args) |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1852 { |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1853 int ch; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1854 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1855 PyCursesInitialised |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1856 |
|
21756
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
1857 if (!PyArg_ParseTuple(args,"i",&ch)) return NULL; |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1858 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1859 if (has_key(ch) == FALSE) { |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1860 Py_INCREF(Py_False); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1861 return Py_False; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1862 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1863 Py_INCREF(Py_True); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1864 return Py_True; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1865 } |
|
13708
fe89ea1c9108
Modified version of patch #100963 from Mark Favas: has_key() is an
Andrew M. Kuchling <amk@amk.ca>
parents:
13706
diff
changeset
|
1866 #endif /* STRICT_SYSV_CURSES */ |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1867 |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1868 static PyObject * |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
1869 PyCurses_Init_Color(PyObject *self, PyObject *args) |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1870 { |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1871 short color, r, g, b; |
| 2357 | 1872 |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1873 PyCursesInitialised |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1874 PyCursesInitialisedColor |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1875 |
|
21756
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
1876 switch(PyTuple_Size(args)) { |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1877 case 4: |
|
21756
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
1878 if (!PyArg_ParseTuple(args, "hhhh;color,r,g,b", &color, &r, &g, &b)) return NULL; |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1879 break; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1880 default: |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1881 PyErr_SetString(PyExc_TypeError, "init_color requires 4 arguments"); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1882 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1883 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1884 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1885 return PyCursesCheckERR(init_color(color, r, g, b), "init_color"); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1886 } |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1887 |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1888 static PyObject * |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
1889 PyCurses_Init_Pair(PyObject *self, PyObject *args) |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1890 { |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1891 short pair, f, b; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1892 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1893 PyCursesInitialised |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1894 PyCursesInitialisedColor |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1895 |
|
21756
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
1896 if (PyTuple_Size(args) != 3) { |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1897 PyErr_SetString(PyExc_TypeError, "init_pair requires 3 arguments"); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1898 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1899 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1900 |
|
21756
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
1901 if (!PyArg_ParseTuple(args, "hhh;pair, f, b", &pair, &f, &b)) return NULL; |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1902 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1903 return PyCursesCheckERR(init_pair(pair, f, b), "init_pair"); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1904 } |
|
1867
758c1374f303
Setup.in: added tkinter; rearranged the definition of PYTHONPATH so
Guido van Rossum <guido@python.org>
parents:
1859
diff
changeset
|
1905 |
|
15646
5b158fc0ed55
Export C API from this module.
Andrew M. Kuchling <amk@amk.ca>
parents:
15638
diff
changeset
|
1906 static PyObject *ModDict; |
|
5b158fc0ed55
Export C API from this module.
Andrew M. Kuchling <amk@amk.ca>
parents:
15638
diff
changeset
|
1907 |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1908 static PyObject * |
|
21756
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
1909 PyCurses_InitScr(PyObject *self) |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1910 { |
|
1859
54fdc9a95f48
Lance's release 1.1 -- fixes some problems with 1.0
Guido van Rossum <guido@python.org>
parents:
1858
diff
changeset
|
1911 WINDOW *win; |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1912 |
|
2423
73eeff4d43f8
more fixes by Steve Clift
Guido van Rossum <guido@python.org>
parents:
2358
diff
changeset
|
1913 if (initialised == TRUE) { |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1914 wrefresh(stdscr); |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1915 return (PyObject *)PyCursesWindow_New(stdscr); |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1916 } |
|
1859
54fdc9a95f48
Lance's release 1.1 -- fixes some problems with 1.0
Guido van Rossum <guido@python.org>
parents:
1858
diff
changeset
|
1917 |
|
54fdc9a95f48
Lance's release 1.1 -- fixes some problems with 1.0
Guido van Rossum <guido@python.org>
parents:
1858
diff
changeset
|
1918 win = initscr(); |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1919 |
| 2357 | 1920 if (win == NULL) { |
| 1921 PyErr_SetString(PyCursesError, catchall_NULL); | |
| 1922 return NULL; | |
| 1923 } | |
| 1924 | |
|
15418
06465ed81826
Patch #102412 from mwh: Add support for the setupterm() function, to
Andrew M. Kuchling <amk@amk.ca>
parents:
15384
diff
changeset
|
1925 initialised = initialised_setupterm = TRUE; |
|
1859
54fdc9a95f48
Lance's release 1.1 -- fixes some problems with 1.0
Guido van Rossum <guido@python.org>
parents:
1858
diff
changeset
|
1926 |
|
12738
3d26cb3808a7
Changes by AMK: Use HAVE_NCURSES_H to include correct header file
Andrew M. Kuchling <amk@amk.ca>
parents:
12737
diff
changeset
|
1927 /* This was moved from initcurses() because it core dumped on SGI, |
|
3d26cb3808a7
Changes by AMK: Use HAVE_NCURSES_H to include correct header file
Andrew M. Kuchling <amk@amk.ca>
parents:
12737
diff
changeset
|
1928 where they're not defined until you've called initscr() */ |
|
3d26cb3808a7
Changes by AMK: Use HAVE_NCURSES_H to include correct header file
Andrew M. Kuchling <amk@amk.ca>
parents:
12737
diff
changeset
|
1929 #define SetDictInt(string,ch) \ |
|
39474
24d2cc33000c
Handle failure from PyModule_GetDict() (Klocwork 208).
Neal Norwitz <nnorwitz@gmail.com>
parents:
39192
diff
changeset
|
1930 do { \ |
|
24d2cc33000c
Handle failure from PyModule_GetDict() (Klocwork 208).
Neal Norwitz <nnorwitz@gmail.com>
parents:
39192
diff
changeset
|
1931 PyObject *o = PyInt_FromLong((long) (ch)); \ |
|
24d2cc33000c
Handle failure from PyModule_GetDict() (Klocwork 208).
Neal Norwitz <nnorwitz@gmail.com>
parents:
39192
diff
changeset
|
1932 if (o && PyDict_SetItemString(ModDict, string, o) == 0) { \ |
|
24d2cc33000c
Handle failure from PyModule_GetDict() (Klocwork 208).
Neal Norwitz <nnorwitz@gmail.com>
parents:
39192
diff
changeset
|
1933 Py_DECREF(o); \ |
|
24d2cc33000c
Handle failure from PyModule_GetDict() (Klocwork 208).
Neal Norwitz <nnorwitz@gmail.com>
parents:
39192
diff
changeset
|
1934 } \ |
|
24d2cc33000c
Handle failure from PyModule_GetDict() (Klocwork 208).
Neal Norwitz <nnorwitz@gmail.com>
parents:
39192
diff
changeset
|
1935 } while (0) |
|
12738
3d26cb3808a7
Changes by AMK: Use HAVE_NCURSES_H to include correct header file
Andrew M. Kuchling <amk@amk.ca>
parents:
12737
diff
changeset
|
1936 |
|
3d26cb3808a7
Changes by AMK: Use HAVE_NCURSES_H to include correct header file
Andrew M. Kuchling <amk@amk.ca>
parents:
12737
diff
changeset
|
1937 /* Here are some graphic symbols you can use */ |
|
3d26cb3808a7
Changes by AMK: Use HAVE_NCURSES_H to include correct header file
Andrew M. Kuchling <amk@amk.ca>
parents:
12737
diff
changeset
|
1938 SetDictInt("ACS_ULCORNER", (ACS_ULCORNER)); |
|
3d26cb3808a7
Changes by AMK: Use HAVE_NCURSES_H to include correct header file
Andrew M. Kuchling <amk@amk.ca>
parents:
12737
diff
changeset
|
1939 SetDictInt("ACS_LLCORNER", (ACS_LLCORNER)); |
|
3d26cb3808a7
Changes by AMK: Use HAVE_NCURSES_H to include correct header file
Andrew M. Kuchling <amk@amk.ca>
parents:
12737
diff
changeset
|
1940 SetDictInt("ACS_URCORNER", (ACS_URCORNER)); |
|
3d26cb3808a7
Changes by AMK: Use HAVE_NCURSES_H to include correct header file
Andrew M. Kuchling <amk@amk.ca>
parents:
12737
diff
changeset
|
1941 SetDictInt("ACS_LRCORNER", (ACS_LRCORNER)); |
|
3d26cb3808a7
Changes by AMK: Use HAVE_NCURSES_H to include correct header file
Andrew M. Kuchling <amk@amk.ca>
parents:
12737
diff
changeset
|
1942 SetDictInt("ACS_LTEE", (ACS_LTEE)); |
|
3d26cb3808a7
Changes by AMK: Use HAVE_NCURSES_H to include correct header file
Andrew M. Kuchling <amk@amk.ca>
parents:
12737
diff
changeset
|
1943 SetDictInt("ACS_RTEE", (ACS_RTEE)); |
|
3d26cb3808a7
Changes by AMK: Use HAVE_NCURSES_H to include correct header file
Andrew M. Kuchling <amk@amk.ca>
parents:
12737
diff
changeset
|
1944 SetDictInt("ACS_BTEE", (ACS_BTEE)); |
|
3d26cb3808a7
Changes by AMK: Use HAVE_NCURSES_H to include correct header file
Andrew M. Kuchling <amk@amk.ca>
parents:
12737
diff
changeset
|
1945 SetDictInt("ACS_TTEE", (ACS_TTEE)); |
|
3d26cb3808a7
Changes by AMK: Use HAVE_NCURSES_H to include correct header file
Andrew M. Kuchling <amk@amk.ca>
parents:
12737
diff
changeset
|
1946 SetDictInt("ACS_HLINE", (ACS_HLINE)); |
|
3d26cb3808a7
Changes by AMK: Use HAVE_NCURSES_H to include correct header file
Andrew M. Kuchling <amk@amk.ca>
parents:
12737
diff
changeset
|
1947 SetDictInt("ACS_VLINE", (ACS_VLINE)); |
|
3d26cb3808a7
Changes by AMK: Use HAVE_NCURSES_H to include correct header file
Andrew M. Kuchling <amk@amk.ca>
parents:
12737
diff
changeset
|
1948 SetDictInt("ACS_PLUS", (ACS_PLUS)); |
|
20647
dd78b1a71f3e
Check for HP/UX curses problems. Define _XOPEN_SOURCE_EXTENDED and
Martin v. Löwis <martin@v.loewis.de>
parents:
20583
diff
changeset
|
1949 #if !defined(__hpux) || defined(HAVE_NCURSES_H) |
|
dd78b1a71f3e
Check for HP/UX curses problems. Define _XOPEN_SOURCE_EXTENDED and
Martin v. Löwis <martin@v.loewis.de>
parents:
20583
diff
changeset
|
1950 /* On HP/UX 11, these are of type cchar_t, which is not an |
|
dd78b1a71f3e
Check for HP/UX curses problems. Define _XOPEN_SOURCE_EXTENDED and
Martin v. Löwis <martin@v.loewis.de>
parents:
20583
diff
changeset
|
1951 integral type. If this is a problem on more platforms, a |
|
dd78b1a71f3e
Check for HP/UX curses problems. Define _XOPEN_SOURCE_EXTENDED and
Martin v. Löwis <martin@v.loewis.de>
parents:
20583
diff
changeset
|
1952 configure test should be added to determine whether ACS_S1 |
|
dd78b1a71f3e
Check for HP/UX curses problems. Define _XOPEN_SOURCE_EXTENDED and
Martin v. Löwis <martin@v.loewis.de>
parents:
20583
diff
changeset
|
1953 is of integral type. */ |
|
12738
3d26cb3808a7
Changes by AMK: Use HAVE_NCURSES_H to include correct header file
Andrew M. Kuchling <amk@amk.ca>
parents:
12737
diff
changeset
|
1954 SetDictInt("ACS_S1", (ACS_S1)); |
|
3d26cb3808a7
Changes by AMK: Use HAVE_NCURSES_H to include correct header file
Andrew M. Kuchling <amk@amk.ca>
parents:
12737
diff
changeset
|
1955 SetDictInt("ACS_S9", (ACS_S9)); |
|
3d26cb3808a7
Changes by AMK: Use HAVE_NCURSES_H to include correct header file
Andrew M. Kuchling <amk@amk.ca>
parents:
12737
diff
changeset
|
1956 SetDictInt("ACS_DIAMOND", (ACS_DIAMOND)); |
|
3d26cb3808a7
Changes by AMK: Use HAVE_NCURSES_H to include correct header file
Andrew M. Kuchling <amk@amk.ca>
parents:
12737
diff
changeset
|
1957 SetDictInt("ACS_CKBOARD", (ACS_CKBOARD)); |
|
3d26cb3808a7
Changes by AMK: Use HAVE_NCURSES_H to include correct header file
Andrew M. Kuchling <amk@amk.ca>
parents:
12737
diff
changeset
|
1958 SetDictInt("ACS_DEGREE", (ACS_DEGREE)); |
|
3d26cb3808a7
Changes by AMK: Use HAVE_NCURSES_H to include correct header file
Andrew M. Kuchling <amk@amk.ca>
parents:
12737
diff
changeset
|
1959 SetDictInt("ACS_PLMINUS", (ACS_PLMINUS)); |
|
3d26cb3808a7
Changes by AMK: Use HAVE_NCURSES_H to include correct header file
Andrew M. Kuchling <amk@amk.ca>
parents:
12737
diff
changeset
|
1960 SetDictInt("ACS_BULLET", (ACS_BULLET)); |
|
3d26cb3808a7
Changes by AMK: Use HAVE_NCURSES_H to include correct header file
Andrew M. Kuchling <amk@amk.ca>
parents:
12737
diff
changeset
|
1961 SetDictInt("ACS_LARROW", (ACS_LARROW)); |
|
3d26cb3808a7
Changes by AMK: Use HAVE_NCURSES_H to include correct header file
Andrew M. Kuchling <amk@amk.ca>
parents:
12737
diff
changeset
|
1962 SetDictInt("ACS_RARROW", (ACS_RARROW)); |
|
3d26cb3808a7
Changes by AMK: Use HAVE_NCURSES_H to include correct header file
Andrew M. Kuchling <amk@amk.ca>
parents:
12737
diff
changeset
|
1963 SetDictInt("ACS_DARROW", (ACS_DARROW)); |
|
3d26cb3808a7
Changes by AMK: Use HAVE_NCURSES_H to include correct header file
Andrew M. Kuchling <amk@amk.ca>
parents:
12737
diff
changeset
|
1964 SetDictInt("ACS_UARROW", (ACS_UARROW)); |
|
3d26cb3808a7
Changes by AMK: Use HAVE_NCURSES_H to include correct header file
Andrew M. Kuchling <amk@amk.ca>
parents:
12737
diff
changeset
|
1965 SetDictInt("ACS_BOARD", (ACS_BOARD)); |
|
3d26cb3808a7
Changes by AMK: Use HAVE_NCURSES_H to include correct header file
Andrew M. Kuchling <amk@amk.ca>
parents:
12737
diff
changeset
|
1966 SetDictInt("ACS_LANTERN", (ACS_LANTERN)); |
|
3d26cb3808a7
Changes by AMK: Use HAVE_NCURSES_H to include correct header file
Andrew M. Kuchling <amk@amk.ca>
parents:
12737
diff
changeset
|
1967 SetDictInt("ACS_BLOCK", (ACS_BLOCK)); |
|
20647
dd78b1a71f3e
Check for HP/UX curses problems. Define _XOPEN_SOURCE_EXTENDED and
Martin v. Löwis <martin@v.loewis.de>
parents:
20583
diff
changeset
|
1968 #endif |
|
12738
3d26cb3808a7
Changes by AMK: Use HAVE_NCURSES_H to include correct header file
Andrew M. Kuchling <amk@amk.ca>
parents:
12737
diff
changeset
|
1969 SetDictInt("ACS_BSSB", (ACS_ULCORNER)); |
|
3d26cb3808a7
Changes by AMK: Use HAVE_NCURSES_H to include correct header file
Andrew M. Kuchling <amk@amk.ca>
parents:
12737
diff
changeset
|
1970 SetDictInt("ACS_SSBB", (ACS_LLCORNER)); |
|
3d26cb3808a7
Changes by AMK: Use HAVE_NCURSES_H to include correct header file
Andrew M. Kuchling <amk@amk.ca>
parents:
12737
diff
changeset
|
1971 SetDictInt("ACS_BBSS", (ACS_URCORNER)); |
|
3d26cb3808a7
Changes by AMK: Use HAVE_NCURSES_H to include correct header file
Andrew M. Kuchling <amk@amk.ca>
parents:
12737
diff
changeset
|
1972 SetDictInt("ACS_SBBS", (ACS_LRCORNER)); |
|
3d26cb3808a7
Changes by AMK: Use HAVE_NCURSES_H to include correct header file
Andrew M. Kuchling <amk@amk.ca>
parents:
12737
diff
changeset
|
1973 SetDictInt("ACS_SBSS", (ACS_RTEE)); |
|
3d26cb3808a7
Changes by AMK: Use HAVE_NCURSES_H to include correct header file
Andrew M. Kuchling <amk@amk.ca>
parents:
12737
diff
changeset
|
1974 SetDictInt("ACS_SSSB", (ACS_LTEE)); |
|
3d26cb3808a7
Changes by AMK: Use HAVE_NCURSES_H to include correct header file
Andrew M. Kuchling <amk@amk.ca>
parents:
12737
diff
changeset
|
1975 SetDictInt("ACS_SSBS", (ACS_BTEE)); |
|
3d26cb3808a7
Changes by AMK: Use HAVE_NCURSES_H to include correct header file
Andrew M. Kuchling <amk@amk.ca>
parents:
12737
diff
changeset
|
1976 SetDictInt("ACS_BSSS", (ACS_TTEE)); |
|
3d26cb3808a7
Changes by AMK: Use HAVE_NCURSES_H to include correct header file
Andrew M. Kuchling <amk@amk.ca>
parents:
12737
diff
changeset
|
1977 SetDictInt("ACS_BSBS", (ACS_HLINE)); |
|
3d26cb3808a7
Changes by AMK: Use HAVE_NCURSES_H to include correct header file
Andrew M. Kuchling <amk@amk.ca>
parents:
12737
diff
changeset
|
1978 SetDictInt("ACS_SBSB", (ACS_VLINE)); |
|
3d26cb3808a7
Changes by AMK: Use HAVE_NCURSES_H to include correct header file
Andrew M. Kuchling <amk@amk.ca>
parents:
12737
diff
changeset
|
1979 SetDictInt("ACS_SSSS", (ACS_PLUS)); |
|
15369
3abcb6966617
Patch from Randall Hopper to fix PR #116172, "curses module fails to
Andrew M. Kuchling <amk@amk.ca>
parents:
14334
diff
changeset
|
1980 |
|
3abcb6966617
Patch from Randall Hopper to fix PR #116172, "curses module fails to
Andrew M. Kuchling <amk@amk.ca>
parents:
14334
diff
changeset
|
1981 /* The following are never available with strict SYSV curses */ |
|
3abcb6966617
Patch from Randall Hopper to fix PR #116172, "curses module fails to
Andrew M. Kuchling <amk@amk.ca>
parents:
14334
diff
changeset
|
1982 #ifdef ACS_S3 |
|
12738
3d26cb3808a7
Changes by AMK: Use HAVE_NCURSES_H to include correct header file
Andrew M. Kuchling <amk@amk.ca>
parents:
12737
diff
changeset
|
1983 SetDictInt("ACS_S3", (ACS_S3)); |
|
15369
3abcb6966617
Patch from Randall Hopper to fix PR #116172, "curses module fails to
Andrew M. Kuchling <amk@amk.ca>
parents:
14334
diff
changeset
|
1984 #endif |
|
3abcb6966617
Patch from Randall Hopper to fix PR #116172, "curses module fails to
Andrew M. Kuchling <amk@amk.ca>
parents:
14334
diff
changeset
|
1985 #ifdef ACS_S7 |
|
3abcb6966617
Patch from Randall Hopper to fix PR #116172, "curses module fails to
Andrew M. Kuchling <amk@amk.ca>
parents:
14334
diff
changeset
|
1986 SetDictInt("ACS_S7", (ACS_S7)); |
|
3abcb6966617
Patch from Randall Hopper to fix PR #116172, "curses module fails to
Andrew M. Kuchling <amk@amk.ca>
parents:
14334
diff
changeset
|
1987 #endif |
|
3abcb6966617
Patch from Randall Hopper to fix PR #116172, "curses module fails to
Andrew M. Kuchling <amk@amk.ca>
parents:
14334
diff
changeset
|
1988 #ifdef ACS_LEQUAL |
|
12738
3d26cb3808a7
Changes by AMK: Use HAVE_NCURSES_H to include correct header file
Andrew M. Kuchling <amk@amk.ca>
parents:
12737
diff
changeset
|
1989 SetDictInt("ACS_LEQUAL", (ACS_LEQUAL)); |
|
15369
3abcb6966617
Patch from Randall Hopper to fix PR #116172, "curses module fails to
Andrew M. Kuchling <amk@amk.ca>
parents:
14334
diff
changeset
|
1990 #endif |
|
3abcb6966617
Patch from Randall Hopper to fix PR #116172, "curses module fails to
Andrew M. Kuchling <amk@amk.ca>
parents:
14334
diff
changeset
|
1991 #ifdef ACS_GEQUAL |
|
12738
3d26cb3808a7
Changes by AMK: Use HAVE_NCURSES_H to include correct header file
Andrew M. Kuchling <amk@amk.ca>
parents:
12737
diff
changeset
|
1992 SetDictInt("ACS_GEQUAL", (ACS_GEQUAL)); |
|
15369
3abcb6966617
Patch from Randall Hopper to fix PR #116172, "curses module fails to
Andrew M. Kuchling <amk@amk.ca>
parents:
14334
diff
changeset
|
1993 #endif |
|
3abcb6966617
Patch from Randall Hopper to fix PR #116172, "curses module fails to
Andrew M. Kuchling <amk@amk.ca>
parents:
14334
diff
changeset
|
1994 #ifdef ACS_PI |
|
12738
3d26cb3808a7
Changes by AMK: Use HAVE_NCURSES_H to include correct header file
Andrew M. Kuchling <amk@amk.ca>
parents:
12737
diff
changeset
|
1995 SetDictInt("ACS_PI", (ACS_PI)); |
|
15369
3abcb6966617
Patch from Randall Hopper to fix PR #116172, "curses module fails to
Andrew M. Kuchling <amk@amk.ca>
parents:
14334
diff
changeset
|
1996 #endif |
|
3abcb6966617
Patch from Randall Hopper to fix PR #116172, "curses module fails to
Andrew M. Kuchling <amk@amk.ca>
parents:
14334
diff
changeset
|
1997 #ifdef ACS_NEQUAL |
|
12738
3d26cb3808a7
Changes by AMK: Use HAVE_NCURSES_H to include correct header file
Andrew M. Kuchling <amk@amk.ca>
parents:
12737
diff
changeset
|
1998 SetDictInt("ACS_NEQUAL", (ACS_NEQUAL)); |
|
15369
3abcb6966617
Patch from Randall Hopper to fix PR #116172, "curses module fails to
Andrew M. Kuchling <amk@amk.ca>
parents:
14334
diff
changeset
|
1999 #endif |
|
3abcb6966617
Patch from Randall Hopper to fix PR #116172, "curses module fails to
Andrew M. Kuchling <amk@amk.ca>
parents:
14334
diff
changeset
|
2000 #ifdef ACS_STERLING |
|
12738
3d26cb3808a7
Changes by AMK: Use HAVE_NCURSES_H to include correct header file
Andrew M. Kuchling <amk@amk.ca>
parents:
12737
diff
changeset
|
2001 SetDictInt("ACS_STERLING", (ACS_STERLING)); |
|
3d26cb3808a7
Changes by AMK: Use HAVE_NCURSES_H to include correct header file
Andrew M. Kuchling <amk@amk.ca>
parents:
12737
diff
changeset
|
2002 #endif |
|
3d26cb3808a7
Changes by AMK: Use HAVE_NCURSES_H to include correct header file
Andrew M. Kuchling <amk@amk.ca>
parents:
12737
diff
changeset
|
2003 |
|
39474
24d2cc33000c
Handle failure from PyModule_GetDict() (Klocwork 208).
Neal Norwitz <nnorwitz@gmail.com>
parents:
39192
diff
changeset
|
2004 SetDictInt("LINES", LINES); |
|
24d2cc33000c
Handle failure from PyModule_GetDict() (Klocwork 208).
Neal Norwitz <nnorwitz@gmail.com>
parents:
39192
diff
changeset
|
2005 SetDictInt("COLS", COLS); |
|
1859
54fdc9a95f48
Lance's release 1.1 -- fixes some problems with 1.0
Guido van Rossum <guido@python.org>
parents:
1858
diff
changeset
|
2006 |
|
54fdc9a95f48
Lance's release 1.1 -- fixes some problems with 1.0
Guido van Rossum <guido@python.org>
parents:
1858
diff
changeset
|
2007 return (PyObject *)PyCursesWindow_New(win); |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2008 } |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2009 |
|
15418
06465ed81826
Patch #102412 from mwh: Add support for the setupterm() function, to
Andrew M. Kuchling <amk@amk.ca>
parents:
15384
diff
changeset
|
2010 static PyObject * |
|
06465ed81826
Patch #102412 from mwh: Add support for the setupterm() function, to
Andrew M. Kuchling <amk@amk.ca>
parents:
15384
diff
changeset
|
2011 PyCurses_setupterm(PyObject* self, PyObject *args, PyObject* keywds) |
|
06465ed81826
Patch #102412 from mwh: Add support for the setupterm() function, to
Andrew M. Kuchling <amk@amk.ca>
parents:
15384
diff
changeset
|
2012 { |
|
06465ed81826
Patch #102412 from mwh: Add support for the setupterm() function, to
Andrew M. Kuchling <amk@amk.ca>
parents:
15384
diff
changeset
|
2013 int fd = -1; |
|
06465ed81826
Patch #102412 from mwh: Add support for the setupterm() function, to
Andrew M. Kuchling <amk@amk.ca>
parents:
15384
diff
changeset
|
2014 int err; |
|
06465ed81826
Patch #102412 from mwh: Add support for the setupterm() function, to
Andrew M. Kuchling <amk@amk.ca>
parents:
15384
diff
changeset
|
2015 char* termstr = NULL; |
|
06465ed81826
Patch #102412 from mwh: Add support for the setupterm() function, to
Andrew M. Kuchling <amk@amk.ca>
parents:
15384
diff
changeset
|
2016 |
|
36675
dba6494735d0
Revert backwards-incompatible const changes.
Martin v. Löwis <martin@v.loewis.de>
parents:
36324
diff
changeset
|
2017 static char *kwlist[] = {"term", "fd", NULL}; |
|
15418
06465ed81826
Patch #102412 from mwh: Add support for the setupterm() function, to
Andrew M. Kuchling <amk@amk.ca>
parents:
15384
diff
changeset
|
2018 |
|
06465ed81826
Patch #102412 from mwh: Add support for the setupterm() function, to
Andrew M. Kuchling <amk@amk.ca>
parents:
15384
diff
changeset
|
2019 if (!PyArg_ParseTupleAndKeywords( |
|
35999
9541369b0dca
Add const to several API functions that take char *.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
35094
diff
changeset
|
2020 args, keywds, "|zi:setupterm", kwlist, &termstr, &fd)) { |
|
15418
06465ed81826
Patch #102412 from mwh: Add support for the setupterm() function, to
Andrew M. Kuchling <amk@amk.ca>
parents:
15384
diff
changeset
|
2021 return NULL; |
|
06465ed81826
Patch #102412 from mwh: Add support for the setupterm() function, to
Andrew M. Kuchling <amk@amk.ca>
parents:
15384
diff
changeset
|
2022 } |
|
06465ed81826
Patch #102412 from mwh: Add support for the setupterm() function, to
Andrew M. Kuchling <amk@amk.ca>
parents:
15384
diff
changeset
|
2023 |
|
06465ed81826
Patch #102412 from mwh: Add support for the setupterm() function, to
Andrew M. Kuchling <amk@amk.ca>
parents:
15384
diff
changeset
|
2024 if (fd == -1) { |
|
06465ed81826
Patch #102412 from mwh: Add support for the setupterm() function, to
Andrew M. Kuchling <amk@amk.ca>
parents:
15384
diff
changeset
|
2025 PyObject* sys_stdout; |
|
06465ed81826
Patch #102412 from mwh: Add support for the setupterm() function, to
Andrew M. Kuchling <amk@amk.ca>
parents:
15384
diff
changeset
|
2026 |
|
06465ed81826
Patch #102412 from mwh: Add support for the setupterm() function, to
Andrew M. Kuchling <amk@amk.ca>
parents:
15384
diff
changeset
|
2027 sys_stdout = PySys_GetObject("stdout"); |
|
06465ed81826
Patch #102412 from mwh: Add support for the setupterm() function, to
Andrew M. Kuchling <amk@amk.ca>
parents:
15384
diff
changeset
|
2028 |
|
06465ed81826
Patch #102412 from mwh: Add support for the setupterm() function, to
Andrew M. Kuchling <amk@amk.ca>
parents:
15384
diff
changeset
|
2029 if (sys_stdout == NULL) { |
|
06465ed81826
Patch #102412 from mwh: Add support for the setupterm() function, to
Andrew M. Kuchling <amk@amk.ca>
parents:
15384
diff
changeset
|
2030 PyErr_SetString( |
|
06465ed81826
Patch #102412 from mwh: Add support for the setupterm() function, to
Andrew M. Kuchling <amk@amk.ca>
parents:
15384
diff
changeset
|
2031 PyCursesError, |
|
06465ed81826
Patch #102412 from mwh: Add support for the setupterm() function, to
Andrew M. Kuchling <amk@amk.ca>
parents:
15384
diff
changeset
|
2032 "lost sys.stdout"); |
|
06465ed81826
Patch #102412 from mwh: Add support for the setupterm() function, to
Andrew M. Kuchling <amk@amk.ca>
parents:
15384
diff
changeset
|
2033 return NULL; |
|
06465ed81826
Patch #102412 from mwh: Add support for the setupterm() function, to
Andrew M. Kuchling <amk@amk.ca>
parents:
15384
diff
changeset
|
2034 } |
|
06465ed81826
Patch #102412 from mwh: Add support for the setupterm() function, to
Andrew M. Kuchling <amk@amk.ca>
parents:
15384
diff
changeset
|
2035 |
|
06465ed81826
Patch #102412 from mwh: Add support for the setupterm() function, to
Andrew M. Kuchling <amk@amk.ca>
parents:
15384
diff
changeset
|
2036 fd = PyObject_AsFileDescriptor(sys_stdout); |
|
06465ed81826
Patch #102412 from mwh: Add support for the setupterm() function, to
Andrew M. Kuchling <amk@amk.ca>
parents:
15384
diff
changeset
|
2037 |
|
06465ed81826
Patch #102412 from mwh: Add support for the setupterm() function, to
Andrew M. Kuchling <amk@amk.ca>
parents:
15384
diff
changeset
|
2038 if (fd == -1) { |
|
06465ed81826
Patch #102412 from mwh: Add support for the setupterm() function, to
Andrew M. Kuchling <amk@amk.ca>
parents:
15384
diff
changeset
|
2039 return NULL; |
|
06465ed81826
Patch #102412 from mwh: Add support for the setupterm() function, to
Andrew M. Kuchling <amk@amk.ca>
parents:
15384
diff
changeset
|
2040 } |
|
06465ed81826
Patch #102412 from mwh: Add support for the setupterm() function, to
Andrew M. Kuchling <amk@amk.ca>
parents:
15384
diff
changeset
|
2041 } |
|
06465ed81826
Patch #102412 from mwh: Add support for the setupterm() function, to
Andrew M. Kuchling <amk@amk.ca>
parents:
15384
diff
changeset
|
2042 |
|
06465ed81826
Patch #102412 from mwh: Add support for the setupterm() function, to
Andrew M. Kuchling <amk@amk.ca>
parents:
15384
diff
changeset
|
2043 if (setupterm(termstr,fd,&err) == ERR) { |
|
06465ed81826
Patch #102412 from mwh: Add support for the setupterm() function, to
Andrew M. Kuchling <amk@amk.ca>
parents:
15384
diff
changeset
|
2044 char* s = "setupterm: unknown error"; |
|
06465ed81826
Patch #102412 from mwh: Add support for the setupterm() function, to
Andrew M. Kuchling <amk@amk.ca>
parents:
15384
diff
changeset
|
2045 |
|
06465ed81826
Patch #102412 from mwh: Add support for the setupterm() function, to
Andrew M. Kuchling <amk@amk.ca>
parents:
15384
diff
changeset
|
2046 if (err == 0) { |
|
06465ed81826
Patch #102412 from mwh: Add support for the setupterm() function, to
Andrew M. Kuchling <amk@amk.ca>
parents:
15384
diff
changeset
|
2047 s = "setupterm: could not find terminal"; |
|
06465ed81826
Patch #102412 from mwh: Add support for the setupterm() function, to
Andrew M. Kuchling <amk@amk.ca>
parents:
15384
diff
changeset
|
2048 } else if (err == -1) { |
|
06465ed81826
Patch #102412 from mwh: Add support for the setupterm() function, to
Andrew M. Kuchling <amk@amk.ca>
parents:
15384
diff
changeset
|
2049 s = "setupterm: could not find terminfo database"; |
|
06465ed81826
Patch #102412 from mwh: Add support for the setupterm() function, to
Andrew M. Kuchling <amk@amk.ca>
parents:
15384
diff
changeset
|
2050 } |
|
06465ed81826
Patch #102412 from mwh: Add support for the setupterm() function, to
Andrew M. Kuchling <amk@amk.ca>
parents:
15384
diff
changeset
|
2051 |
|
06465ed81826
Patch #102412 from mwh: Add support for the setupterm() function, to
Andrew M. Kuchling <amk@amk.ca>
parents:
15384
diff
changeset
|
2052 PyErr_SetString(PyCursesError,s); |
|
06465ed81826
Patch #102412 from mwh: Add support for the setupterm() function, to
Andrew M. Kuchling <amk@amk.ca>
parents:
15384
diff
changeset
|
2053 return NULL; |
|
06465ed81826
Patch #102412 from mwh: Add support for the setupterm() function, to
Andrew M. Kuchling <amk@amk.ca>
parents:
15384
diff
changeset
|
2054 } |
|
06465ed81826
Patch #102412 from mwh: Add support for the setupterm() function, to
Andrew M. Kuchling <amk@amk.ca>
parents:
15384
diff
changeset
|
2055 |
|
06465ed81826
Patch #102412 from mwh: Add support for the setupterm() function, to
Andrew M. Kuchling <amk@amk.ca>
parents:
15384
diff
changeset
|
2056 initialised_setupterm = TRUE; |
|
06465ed81826
Patch #102412 from mwh: Add support for the setupterm() function, to
Andrew M. Kuchling <amk@amk.ca>
parents:
15384
diff
changeset
|
2057 |
|
06465ed81826
Patch #102412 from mwh: Add support for the setupterm() function, to
Andrew M. Kuchling <amk@amk.ca>
parents:
15384
diff
changeset
|
2058 Py_INCREF(Py_None); |
|
06465ed81826
Patch #102412 from mwh: Add support for the setupterm() function, to
Andrew M. Kuchling <amk@amk.ca>
parents:
15384
diff
changeset
|
2059 return Py_None; |
|
06465ed81826
Patch #102412 from mwh: Add support for the setupterm() function, to
Andrew M. Kuchling <amk@amk.ca>
parents:
15384
diff
changeset
|
2060 } |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2061 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2062 static PyObject * |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
2063 PyCurses_IntrFlush(PyObject *self, PyObject *args) |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2064 { |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2065 int ch; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2066 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2067 PyCursesInitialised |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2068 |
|
21756
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
2069 switch(PyTuple_Size(args)) { |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2070 case 1: |
|
21756
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
2071 if (!PyArg_ParseTuple(args,"i;True(1), False(0)",&ch)) return NULL; |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2072 break; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2073 default: |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2074 PyErr_SetString(PyExc_TypeError, "intrflush requires 1 argument"); |
| 2357 | 2075 return NULL; |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2076 } |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2077 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2078 return PyCursesCheckERR(intrflush(NULL,ch), "intrflush"); |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2079 } |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2080 |
|
38876
4a766024043a
Patch #1506645: add Python wrappers for the curses functions
Walter Dörwald <walter@livinglogic.de>
parents:
36675
diff
changeset
|
2081 #ifdef HAVE_CURSES_IS_TERM_RESIZED |
|
4a766024043a
Patch #1506645: add Python wrappers for the curses functions
Walter Dörwald <walter@livinglogic.de>
parents:
36675
diff
changeset
|
2082 static PyObject * |
|
4a766024043a
Patch #1506645: add Python wrappers for the curses functions
Walter Dörwald <walter@livinglogic.de>
parents:
36675
diff
changeset
|
2083 PyCurses_Is_Term_Resized(PyObject *self, PyObject *args) |
|
4a766024043a
Patch #1506645: add Python wrappers for the curses functions
Walter Dörwald <walter@livinglogic.de>
parents:
36675
diff
changeset
|
2084 { |
|
4a766024043a
Patch #1506645: add Python wrappers for the curses functions
Walter Dörwald <walter@livinglogic.de>
parents:
36675
diff
changeset
|
2085 int lines; |
|
4a766024043a
Patch #1506645: add Python wrappers for the curses functions
Walter Dörwald <walter@livinglogic.de>
parents:
36675
diff
changeset
|
2086 int columns; |
|
4a766024043a
Patch #1506645: add Python wrappers for the curses functions
Walter Dörwald <walter@livinglogic.de>
parents:
36675
diff
changeset
|
2087 int result; |
|
4a766024043a
Patch #1506645: add Python wrappers for the curses functions
Walter Dörwald <walter@livinglogic.de>
parents:
36675
diff
changeset
|
2088 |
|
4a766024043a
Patch #1506645: add Python wrappers for the curses functions
Walter Dörwald <walter@livinglogic.de>
parents:
36675
diff
changeset
|
2089 PyCursesInitialised |
|
4a766024043a
Patch #1506645: add Python wrappers for the curses functions
Walter Dörwald <walter@livinglogic.de>
parents:
36675
diff
changeset
|
2090 |
|
4a766024043a
Patch #1506645: add Python wrappers for the curses functions
Walter Dörwald <walter@livinglogic.de>
parents:
36675
diff
changeset
|
2091 if (!PyArg_ParseTuple(args,"ii:is_term_resized", &lines, &columns)) |
|
4a766024043a
Patch #1506645: add Python wrappers for the curses functions
Walter Dörwald <walter@livinglogic.de>
parents:
36675
diff
changeset
|
2092 return NULL; |
|
4a766024043a
Patch #1506645: add Python wrappers for the curses functions
Walter Dörwald <walter@livinglogic.de>
parents:
36675
diff
changeset
|
2093 result = is_term_resized(lines, columns); |
|
4a766024043a
Patch #1506645: add Python wrappers for the curses functions
Walter Dörwald <walter@livinglogic.de>
parents:
36675
diff
changeset
|
2094 if (result == TRUE) { |
|
4a766024043a
Patch #1506645: add Python wrappers for the curses functions
Walter Dörwald <walter@livinglogic.de>
parents:
36675
diff
changeset
|
2095 Py_INCREF(Py_True); |
|
4a766024043a
Patch #1506645: add Python wrappers for the curses functions
Walter Dörwald <walter@livinglogic.de>
parents:
36675
diff
changeset
|
2096 return Py_True; |
|
4a766024043a
Patch #1506645: add Python wrappers for the curses functions
Walter Dörwald <walter@livinglogic.de>
parents:
36675
diff
changeset
|
2097 } else { |
|
4a766024043a
Patch #1506645: add Python wrappers for the curses functions
Walter Dörwald <walter@livinglogic.de>
parents:
36675
diff
changeset
|
2098 Py_INCREF(Py_False); |
|
4a766024043a
Patch #1506645: add Python wrappers for the curses functions
Walter Dörwald <walter@livinglogic.de>
parents:
36675
diff
changeset
|
2099 return Py_False; |
|
4a766024043a
Patch #1506645: add Python wrappers for the curses functions
Walter Dörwald <walter@livinglogic.de>
parents:
36675
diff
changeset
|
2100 } |
|
4a766024043a
Patch #1506645: add Python wrappers for the curses functions
Walter Dörwald <walter@livinglogic.de>
parents:
36675
diff
changeset
|
2101 } |
|
4a766024043a
Patch #1506645: add Python wrappers for the curses functions
Walter Dörwald <walter@livinglogic.de>
parents:
36675
diff
changeset
|
2102 #endif /* HAVE_CURSES_IS_TERM_RESIZED */ |
|
4a766024043a
Patch #1506645: add Python wrappers for the curses functions
Walter Dörwald <walter@livinglogic.de>
parents:
36675
diff
changeset
|
2103 |
|
16351
ef32bfa5f5c6
Patch #103485 from Donn Cave: patches to make the module compile on AIX and
Andrew M. Kuchling <amk@amk.ca>
parents:
16350
diff
changeset
|
2104 #if !defined(__NetBSD__) |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2105 static PyObject * |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
2106 PyCurses_KeyName(PyObject *self, PyObject *args) |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2107 { |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2108 const char *knp; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2109 int ch; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2110 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2111 PyCursesInitialised |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2112 |
|
21756
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
2113 if (!PyArg_ParseTuple(args,"i",&ch)) return NULL; |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2114 |
|
26075
1afca375f2a9
[Patch #633635 from David M. Cooke]
Andrew M. Kuchling <amk@amk.ca>
parents:
25966
diff
changeset
|
2115 if (ch < 0) { |
|
1afca375f2a9
[Patch #633635 from David M. Cooke]
Andrew M. Kuchling <amk@amk.ca>
parents:
25966
diff
changeset
|
2116 PyErr_SetString(PyExc_ValueError, "invalid key number"); |
|
1afca375f2a9
[Patch #633635 from David M. Cooke]
Andrew M. Kuchling <amk@amk.ca>
parents:
25966
diff
changeset
|
2117 return NULL; |
|
1afca375f2a9
[Patch #633635 from David M. Cooke]
Andrew M. Kuchling <amk@amk.ca>
parents:
25966
diff
changeset
|
2118 } |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2119 knp = keyname(ch); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2120 |
|
47527
52294af4b663
This reverts r63675 based on the discussion in this thread:
Gregory P. Smith <greg@mad-scientist.com>
parents:
47294
diff
changeset
|
2121 return PyString_FromString((knp == NULL) ? "" : (char *)knp); |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2122 } |
|
16351
ef32bfa5f5c6
Patch #103485 from Donn Cave: patches to make the module compile on AIX and
Andrew M. Kuchling <amk@amk.ca>
parents:
16350
diff
changeset
|
2123 #endif |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2124 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2125 static PyObject * |
|
21756
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
2126 PyCurses_KillChar(PyObject *self) |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2127 { |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2128 char ch; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2129 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2130 ch = killchar(); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2131 |
|
47527
52294af4b663
This reverts r63675 based on the discussion in this thread:
Gregory P. Smith <greg@mad-scientist.com>
parents:
47294
diff
changeset
|
2132 return PyString_FromStringAndSize(&ch, 1); |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2133 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2134 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2135 static PyObject * |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
2136 PyCurses_Meta(PyObject *self, PyObject *args) |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2137 { |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2138 int ch; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2139 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2140 PyCursesInitialised |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2141 |
|
21756
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
2142 switch(PyTuple_Size(args)) { |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2143 case 1: |
|
21756
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
2144 if (!PyArg_ParseTuple(args,"i;True(1), False(0)",&ch)) return NULL; |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2145 break; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2146 default: |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2147 PyErr_SetString(PyExc_TypeError, "meta requires 1 argument"); |
| 2357 | 2148 return NULL; |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2149 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2150 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2151 return PyCursesCheckERR(meta(stdscr, ch), "meta"); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2152 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2153 |
|
13036
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
2154 #ifdef NCURSES_MOUSE_VERSION |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
2155 static PyObject * |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
2156 PyCurses_MouseInterval(PyObject *self, PyObject *args) |
|
13036
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
2157 { |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
2158 int interval; |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
2159 PyCursesInitialised |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
2160 |
|
21756
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
2161 if (!PyArg_ParseTuple(args,"i;interval",&interval)) |
|
13036
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
2162 return NULL; |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
2163 return PyCursesCheckERR(mouseinterval(interval), "mouseinterval"); |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
2164 } |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
2165 |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
2166 static PyObject * |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
2167 PyCurses_MouseMask(PyObject *self, PyObject *args) |
|
13036
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
2168 { |
|
13385
aff1c4146c1c
Removed unused variables.
Andrew M. Kuchling <amk@amk.ca>
parents:
13040
diff
changeset
|
2169 int newmask; |
|
13036
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
2170 mmask_t oldmask, availmask; |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
2171 |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
2172 PyCursesInitialised |
|
21756
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
2173 if (!PyArg_ParseTuple(args,"i;mousemask",&newmask)) |
|
13036
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
2174 return NULL; |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
2175 availmask = mousemask(newmask, &oldmask); |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
2176 return Py_BuildValue("(ll)", (long)availmask, (long)oldmask); |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
2177 } |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
2178 #endif |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
2179 |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2180 static PyObject * |
|
15574
4a9f1552ba68
Wrapper for napms() function, contributed by Thomas Gellekum <tg@FreeBSD.org>
Andrew M. Kuchling <amk@amk.ca>
parents:
15418
diff
changeset
|
2181 PyCurses_Napms(PyObject *self, PyObject *args) |
|
4a9f1552ba68
Wrapper for napms() function, contributed by Thomas Gellekum <tg@FreeBSD.org>
Andrew M. Kuchling <amk@amk.ca>
parents:
15418
diff
changeset
|
2182 { |
|
4a9f1552ba68
Wrapper for napms() function, contributed by Thomas Gellekum <tg@FreeBSD.org>
Andrew M. Kuchling <amk@amk.ca>
parents:
15418
diff
changeset
|
2183 int ms; |
|
4a9f1552ba68
Wrapper for napms() function, contributed by Thomas Gellekum <tg@FreeBSD.org>
Andrew M. Kuchling <amk@amk.ca>
parents:
15418
diff
changeset
|
2184 |
|
4a9f1552ba68
Wrapper for napms() function, contributed by Thomas Gellekum <tg@FreeBSD.org>
Andrew M. Kuchling <amk@amk.ca>
parents:
15418
diff
changeset
|
2185 PyCursesInitialised |
|
21756
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
2186 if (!PyArg_ParseTuple(args, "i;ms", &ms)) return NULL; |
|
15574
4a9f1552ba68
Wrapper for napms() function, contributed by Thomas Gellekum <tg@FreeBSD.org>
Andrew M. Kuchling <amk@amk.ca>
parents:
15418
diff
changeset
|
2187 |
|
4a9f1552ba68
Wrapper for napms() function, contributed by Thomas Gellekum <tg@FreeBSD.org>
Andrew M. Kuchling <amk@amk.ca>
parents:
15418
diff
changeset
|
2188 return Py_BuildValue("i", napms(ms)); |
|
4a9f1552ba68
Wrapper for napms() function, contributed by Thomas Gellekum <tg@FreeBSD.org>
Andrew M. Kuchling <amk@amk.ca>
parents:
15418
diff
changeset
|
2189 } |
|
4a9f1552ba68
Wrapper for napms() function, contributed by Thomas Gellekum <tg@FreeBSD.org>
Andrew M. Kuchling <amk@amk.ca>
parents:
15418
diff
changeset
|
2190 |
|
4a9f1552ba68
Wrapper for napms() function, contributed by Thomas Gellekum <tg@FreeBSD.org>
Andrew M. Kuchling <amk@amk.ca>
parents:
15418
diff
changeset
|
2191 |
|
4a9f1552ba68
Wrapper for napms() function, contributed by Thomas Gellekum <tg@FreeBSD.org>
Andrew M. Kuchling <amk@amk.ca>
parents:
15418
diff
changeset
|
2192 static PyObject * |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
2193 PyCurses_NewPad(PyObject *self, PyObject *args) |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2194 { |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2195 WINDOW *win; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2196 int nlines, ncols; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2197 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2198 PyCursesInitialised |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2199 |
|
21756
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
2200 if (!PyArg_ParseTuple(args,"ii;nlines,ncols",&nlines,&ncols)) return NULL; |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2201 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2202 win = newpad(nlines, ncols); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2203 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2204 if (win == NULL) { |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2205 PyErr_SetString(PyCursesError, catchall_NULL); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2206 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2207 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2208 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2209 return (PyObject *)PyCursesWindow_New(win); |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2210 } |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2211 |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2212 static PyObject * |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
2213 PyCurses_NewWindow(PyObject *self, PyObject *args) |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2214 { |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2215 WINDOW *win; |
|
18602
9f43e3a9bb6e
Fix bug #417212: "curses.newwin can return pads" by changing the Python
Andrew M. Kuchling <amk@amk.ca>
parents:
18248
diff
changeset
|
2216 int nlines, ncols, begin_y=0, begin_x=0; |
| 2357 | 2217 |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2218 PyCursesInitialised |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2219 |
|
21756
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
2220 switch (PyTuple_Size(args)) { |
| 2357 | 2221 case 2: |
|
21756
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
2222 if (!PyArg_ParseTuple(args,"ii;nlines,ncols",&nlines,&ncols)) |
| 2357 | 2223 return NULL; |
| 2224 break; | |
| 2225 case 4: | |
|
21756
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
2226 if (!PyArg_ParseTuple(args, "iiii;nlines,ncols,begin_y,begin_x", |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2227 &nlines,&ncols,&begin_y,&begin_x)) |
| 2357 | 2228 return NULL; |
| 2229 break; | |
| 2230 default: | |
| 2231 PyErr_SetString(PyExc_TypeError, "newwin requires 2 or 4 arguments"); | |
| 2232 return NULL; | |
| 2233 } | |
| 2234 | |
|
18602
9f43e3a9bb6e
Fix bug #417212: "curses.newwin can return pads" by changing the Python
Andrew M. Kuchling <amk@amk.ca>
parents:
18248
diff
changeset
|
2235 win = newwin(nlines,ncols,begin_y,begin_x); |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2236 if (win == NULL) { |
| 2357 | 2237 PyErr_SetString(PyCursesError, catchall_NULL); |
| 2238 return NULL; | |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2239 } |
| 2357 | 2240 |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2241 return (PyObject *)PyCursesWindow_New(win); |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2242 } |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2243 |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2244 static PyObject * |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
2245 PyCurses_Pair_Content(PyObject *self, PyObject *args) |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2246 { |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2247 short pair,f,b; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2248 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2249 PyCursesInitialised |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2250 PyCursesInitialisedColor |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2251 |
|
21756
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
2252 switch(PyTuple_Size(args)) { |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2253 case 1: |
|
21756
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
2254 if (!PyArg_ParseTuple(args, "h;pair", &pair)) return NULL; |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2255 break; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2256 default: |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2257 PyErr_SetString(PyExc_TypeError, "pair_content requires 1 argument"); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2258 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2259 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2260 |
|
35094
98179c8281cd
Fix check for error condition
Andrew M. Kuchling <amk@amk.ca>
parents:
35056
diff
changeset
|
2261 if (pair_content(pair, &f, &b)==ERR) { |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2262 PyErr_SetString(PyCursesError, |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2263 "Argument 1 was out of range. (1..COLOR_PAIRS-1)"); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2264 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2265 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2266 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2267 return Py_BuildValue("(ii)", f, b); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2268 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2269 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2270 static PyObject * |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
2271 PyCurses_pair_number(PyObject *self, PyObject *args) |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2272 { |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2273 int n; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2274 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2275 PyCursesInitialised |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2276 PyCursesInitialisedColor |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2277 |
|
21756
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
2278 switch(PyTuple_Size(args)) { |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2279 case 1: |
|
21756
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
2280 if (!PyArg_ParseTuple(args, "i;pairvalue", &n)) return NULL; |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2281 break; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2282 default: |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2283 PyErr_SetString(PyExc_TypeError, |
|
12738
3d26cb3808a7
Changes by AMK: Use HAVE_NCURSES_H to include correct header file
Andrew M. Kuchling <amk@amk.ca>
parents:
12737
diff
changeset
|
2284 "pair_number requires 1 argument"); |
| 2357 | 2285 return NULL; |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2286 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2287 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2288 return PyInt_FromLong((long) ((n & A_COLOR) >> 8)); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2289 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2290 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2291 static PyObject * |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
2292 PyCurses_Putp(PyObject *self, PyObject *args) |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2293 { |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2294 char *str; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2295 |
|
21756
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
2296 if (!PyArg_ParseTuple(args,"s;str", &str)) return NULL; |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2297 return PyCursesCheckERR(putp(str), "putp"); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2298 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2299 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2300 static PyObject * |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
2301 PyCurses_QiFlush(PyObject *self, PyObject *args) |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2302 { |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2303 int flag = 0; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2304 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2305 PyCursesInitialised |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2306 |
|
21756
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
2307 switch(PyTuple_Size(args)) { |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2308 case 0: |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2309 qiflush(); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2310 Py_INCREF(Py_None); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2311 return Py_None; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2312 case 1: |
|
21756
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
2313 if (!PyArg_ParseTuple(args, "i;True(1) or False(0)", &flag)) return NULL; |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2314 if (flag) qiflush(); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2315 else noqiflush(); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2316 Py_INCREF(Py_None); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2317 return Py_None; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2318 default: |
|
12738
3d26cb3808a7
Changes by AMK: Use HAVE_NCURSES_H to include correct header file
Andrew M. Kuchling <amk@amk.ca>
parents:
12737
diff
changeset
|
2319 PyErr_SetString(PyExc_TypeError, "qiflush requires 0 or 1 arguments"); |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2320 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2321 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2322 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2323 |
|
41039
3ac24c0110e9
Patch for bug #1633621: if curses.resizeterm() or
Walter Dörwald <walter@livinglogic.de>
parents:
39719
diff
changeset
|
2324 /* Internal helper used for updating curses.LINES, curses.COLS, _curses.LINES |
|
3ac24c0110e9
Patch for bug #1633621: if curses.resizeterm() or
Walter Dörwald <walter@livinglogic.de>
parents:
39719
diff
changeset
|
2325 * and _curses.COLS */ |
|
47768
be07f379d87a
Only include update_lines_cols() function when it's actually going to be used
Andrew M. Kuchling <amk@amk.ca>
parents:
47527
diff
changeset
|
2326 #if defined(HAVE_CURSES_RESIZETERM) || defined(HAVE_CURSES_RESIZE_TERM) |
|
41039
3ac24c0110e9
Patch for bug #1633621: if curses.resizeterm() or
Walter Dörwald <walter@livinglogic.de>
parents:
39719
diff
changeset
|
2327 static int |
|
3ac24c0110e9
Patch for bug #1633621: if curses.resizeterm() or
Walter Dörwald <walter@livinglogic.de>
parents:
39719
diff
changeset
|
2328 update_lines_cols(void) |
|
3ac24c0110e9
Patch for bug #1633621: if curses.resizeterm() or
Walter Dörwald <walter@livinglogic.de>
parents:
39719
diff
changeset
|
2329 { |
|
3ac24c0110e9
Patch for bug #1633621: if curses.resizeterm() or
Walter Dörwald <walter@livinglogic.de>
parents:
39719
diff
changeset
|
2330 PyObject *o; |
|
44439
0cbe94bea2c7
Modified PyImport_Import and PyImport_ImportModule to always use absolute imports by calling __import__ with an explicit level of 0
Christian Heimes <christian@cheimes.de>
parents:
44350
diff
changeset
|
2331 PyObject *m = PyImport_ImportModuleNoBlock("curses"); |
|
41039
3ac24c0110e9
Patch for bug #1633621: if curses.resizeterm() or
Walter Dörwald <walter@livinglogic.de>
parents:
39719
diff
changeset
|
2332 |
|
3ac24c0110e9
Patch for bug #1633621: if curses.resizeterm() or
Walter Dörwald <walter@livinglogic.de>
parents:
39719
diff
changeset
|
2333 if (!m) |
|
3ac24c0110e9
Patch for bug #1633621: if curses.resizeterm() or
Walter Dörwald <walter@livinglogic.de>
parents:
39719
diff
changeset
|
2334 return 0; |
|
3ac24c0110e9
Patch for bug #1633621: if curses.resizeterm() or
Walter Dörwald <walter@livinglogic.de>
parents:
39719
diff
changeset
|
2335 |
|
3ac24c0110e9
Patch for bug #1633621: if curses.resizeterm() or
Walter Dörwald <walter@livinglogic.de>
parents:
39719
diff
changeset
|
2336 o = PyInt_FromLong(LINES); |
|
3ac24c0110e9
Patch for bug #1633621: if curses.resizeterm() or
Walter Dörwald <walter@livinglogic.de>
parents:
39719
diff
changeset
|
2337 if (!o) { |
|
3ac24c0110e9
Patch for bug #1633621: if curses.resizeterm() or
Walter Dörwald <walter@livinglogic.de>
parents:
39719
diff
changeset
|
2338 Py_DECREF(m); |
|
3ac24c0110e9
Patch for bug #1633621: if curses.resizeterm() or
Walter Dörwald <walter@livinglogic.de>
parents:
39719
diff
changeset
|
2339 return 0; |
|
3ac24c0110e9
Patch for bug #1633621: if curses.resizeterm() or
Walter Dörwald <walter@livinglogic.de>
parents:
39719
diff
changeset
|
2340 } |
|
3ac24c0110e9
Patch for bug #1633621: if curses.resizeterm() or
Walter Dörwald <walter@livinglogic.de>
parents:
39719
diff
changeset
|
2341 if (PyObject_SetAttrString(m, "LINES", o)) { |
|
3ac24c0110e9
Patch for bug #1633621: if curses.resizeterm() or
Walter Dörwald <walter@livinglogic.de>
parents:
39719
diff
changeset
|
2342 Py_DECREF(m); |
|
3ac24c0110e9
Patch for bug #1633621: if curses.resizeterm() or
Walter Dörwald <walter@livinglogic.de>
parents:
39719
diff
changeset
|
2343 Py_DECREF(o); |
|
3ac24c0110e9
Patch for bug #1633621: if curses.resizeterm() or
Walter Dörwald <walter@livinglogic.de>
parents:
39719
diff
changeset
|
2344 return 0; |
|
3ac24c0110e9
Patch for bug #1633621: if curses.resizeterm() or
Walter Dörwald <walter@livinglogic.de>
parents:
39719
diff
changeset
|
2345 } |
|
3ac24c0110e9
Patch for bug #1633621: if curses.resizeterm() or
Walter Dörwald <walter@livinglogic.de>
parents:
39719
diff
changeset
|
2346 if (PyDict_SetItemString(ModDict, "LINES", o)) { |
|
3ac24c0110e9
Patch for bug #1633621: if curses.resizeterm() or
Walter Dörwald <walter@livinglogic.de>
parents:
39719
diff
changeset
|
2347 Py_DECREF(m); |
|
3ac24c0110e9
Patch for bug #1633621: if curses.resizeterm() or
Walter Dörwald <walter@livinglogic.de>
parents:
39719
diff
changeset
|
2348 Py_DECREF(o); |
|
3ac24c0110e9
Patch for bug #1633621: if curses.resizeterm() or
Walter Dörwald <walter@livinglogic.de>
parents:
39719
diff
changeset
|
2349 return 0; |
|
3ac24c0110e9
Patch for bug #1633621: if curses.resizeterm() or
Walter Dörwald <walter@livinglogic.de>
parents:
39719
diff
changeset
|
2350 } |
|
3ac24c0110e9
Patch for bug #1633621: if curses.resizeterm() or
Walter Dörwald <walter@livinglogic.de>
parents:
39719
diff
changeset
|
2351 Py_DECREF(o); |
|
3ac24c0110e9
Patch for bug #1633621: if curses.resizeterm() or
Walter Dörwald <walter@livinglogic.de>
parents:
39719
diff
changeset
|
2352 o = PyInt_FromLong(COLS); |
|
3ac24c0110e9
Patch for bug #1633621: if curses.resizeterm() or
Walter Dörwald <walter@livinglogic.de>
parents:
39719
diff
changeset
|
2353 if (!o) { |
|
3ac24c0110e9
Patch for bug #1633621: if curses.resizeterm() or
Walter Dörwald <walter@livinglogic.de>
parents:
39719
diff
changeset
|
2354 Py_DECREF(m); |
|
3ac24c0110e9
Patch for bug #1633621: if curses.resizeterm() or
Walter Dörwald <walter@livinglogic.de>
parents:
39719
diff
changeset
|
2355 return 0; |
|
3ac24c0110e9
Patch for bug #1633621: if curses.resizeterm() or
Walter Dörwald <walter@livinglogic.de>
parents:
39719
diff
changeset
|
2356 } |
|
3ac24c0110e9
Patch for bug #1633621: if curses.resizeterm() or
Walter Dörwald <walter@livinglogic.de>
parents:
39719
diff
changeset
|
2357 if (PyObject_SetAttrString(m, "COLS", o)) { |
|
3ac24c0110e9
Patch for bug #1633621: if curses.resizeterm() or
Walter Dörwald <walter@livinglogic.de>
parents:
39719
diff
changeset
|
2358 Py_DECREF(m); |
|
3ac24c0110e9
Patch for bug #1633621: if curses.resizeterm() or
Walter Dörwald <walter@livinglogic.de>
parents:
39719
diff
changeset
|
2359 Py_DECREF(o); |
|
3ac24c0110e9
Patch for bug #1633621: if curses.resizeterm() or
Walter Dörwald <walter@livinglogic.de>
parents:
39719
diff
changeset
|
2360 return 0; |
|
3ac24c0110e9
Patch for bug #1633621: if curses.resizeterm() or
Walter Dörwald <walter@livinglogic.de>
parents:
39719
diff
changeset
|
2361 } |
|
3ac24c0110e9
Patch for bug #1633621: if curses.resizeterm() or
Walter Dörwald <walter@livinglogic.de>
parents:
39719
diff
changeset
|
2362 if (PyDict_SetItemString(ModDict, "COLS", o)) { |
|
3ac24c0110e9
Patch for bug #1633621: if curses.resizeterm() or
Walter Dörwald <walter@livinglogic.de>
parents:
39719
diff
changeset
|
2363 Py_DECREF(m); |
|
3ac24c0110e9
Patch for bug #1633621: if curses.resizeterm() or
Walter Dörwald <walter@livinglogic.de>
parents:
39719
diff
changeset
|
2364 Py_DECREF(o); |
|
3ac24c0110e9
Patch for bug #1633621: if curses.resizeterm() or
Walter Dörwald <walter@livinglogic.de>
parents:
39719
diff
changeset
|
2365 return 0; |
|
3ac24c0110e9
Patch for bug #1633621: if curses.resizeterm() or
Walter Dörwald <walter@livinglogic.de>
parents:
39719
diff
changeset
|
2366 } |
|
3ac24c0110e9
Patch for bug #1633621: if curses.resizeterm() or
Walter Dörwald <walter@livinglogic.de>
parents:
39719
diff
changeset
|
2367 Py_DECREF(o); |
|
3ac24c0110e9
Patch for bug #1633621: if curses.resizeterm() or
Walter Dörwald <walter@livinglogic.de>
parents:
39719
diff
changeset
|
2368 Py_DECREF(m); |
|
3ac24c0110e9
Patch for bug #1633621: if curses.resizeterm() or
Walter Dörwald <walter@livinglogic.de>
parents:
39719
diff
changeset
|
2369 return 1; |
|
3ac24c0110e9
Patch for bug #1633621: if curses.resizeterm() or
Walter Dörwald <walter@livinglogic.de>
parents:
39719
diff
changeset
|
2370 } |
|
47768
be07f379d87a
Only include update_lines_cols() function when it's actually going to be used
Andrew M. Kuchling <amk@amk.ca>
parents:
47527
diff
changeset
|
2371 #endif |
|
41039
3ac24c0110e9
Patch for bug #1633621: if curses.resizeterm() or
Walter Dörwald <walter@livinglogic.de>
parents:
39719
diff
changeset
|
2372 |
|
38876
4a766024043a
Patch #1506645: add Python wrappers for the curses functions
Walter Dörwald <walter@livinglogic.de>
parents:
36675
diff
changeset
|
2373 #ifdef HAVE_CURSES_RESIZETERM |
|
4a766024043a
Patch #1506645: add Python wrappers for the curses functions
Walter Dörwald <walter@livinglogic.de>
parents:
36675
diff
changeset
|
2374 static PyObject * |
|
4a766024043a
Patch #1506645: add Python wrappers for the curses functions
Walter Dörwald <walter@livinglogic.de>
parents:
36675
diff
changeset
|
2375 PyCurses_ResizeTerm(PyObject *self, PyObject *args) |
|
4a766024043a
Patch #1506645: add Python wrappers for the curses functions
Walter Dörwald <walter@livinglogic.de>
parents:
36675
diff
changeset
|
2376 { |
|
4a766024043a
Patch #1506645: add Python wrappers for the curses functions
Walter Dörwald <walter@livinglogic.de>
parents:
36675
diff
changeset
|
2377 int lines; |
|
4a766024043a
Patch #1506645: add Python wrappers for the curses functions
Walter Dörwald <walter@livinglogic.de>
parents:
36675
diff
changeset
|
2378 int columns; |
|
41039
3ac24c0110e9
Patch for bug #1633621: if curses.resizeterm() or
Walter Dörwald <walter@livinglogic.de>
parents:
39719
diff
changeset
|
2379 PyObject *result; |
|
38876
4a766024043a
Patch #1506645: add Python wrappers for the curses functions
Walter Dörwald <walter@livinglogic.de>
parents:
36675
diff
changeset
|
2380 |
|
4a766024043a
Patch #1506645: add Python wrappers for the curses functions
Walter Dörwald <walter@livinglogic.de>
parents:
36675
diff
changeset
|
2381 PyCursesInitialised |
|
4a766024043a
Patch #1506645: add Python wrappers for the curses functions
Walter Dörwald <walter@livinglogic.de>
parents:
36675
diff
changeset
|
2382 |
|
4a766024043a
Patch #1506645: add Python wrappers for the curses functions
Walter Dörwald <walter@livinglogic.de>
parents:
36675
diff
changeset
|
2383 if (!PyArg_ParseTuple(args,"ii:resizeterm", &lines, &columns)) |
|
4a766024043a
Patch #1506645: add Python wrappers for the curses functions
Walter Dörwald <walter@livinglogic.de>
parents:
36675
diff
changeset
|
2384 return NULL; |
|
4a766024043a
Patch #1506645: add Python wrappers for the curses functions
Walter Dörwald <walter@livinglogic.de>
parents:
36675
diff
changeset
|
2385 |
|
41039
3ac24c0110e9
Patch for bug #1633621: if curses.resizeterm() or
Walter Dörwald <walter@livinglogic.de>
parents:
39719
diff
changeset
|
2386 result = PyCursesCheckERR(resizeterm(lines, columns), "resizeterm"); |
|
3ac24c0110e9
Patch for bug #1633621: if curses.resizeterm() or
Walter Dörwald <walter@livinglogic.de>
parents:
39719
diff
changeset
|
2387 if (!result) |
|
3ac24c0110e9
Patch for bug #1633621: if curses.resizeterm() or
Walter Dörwald <walter@livinglogic.de>
parents:
39719
diff
changeset
|
2388 return NULL; |
|
3ac24c0110e9
Patch for bug #1633621: if curses.resizeterm() or
Walter Dörwald <walter@livinglogic.de>
parents:
39719
diff
changeset
|
2389 if (!update_lines_cols()) |
|
3ac24c0110e9
Patch for bug #1633621: if curses.resizeterm() or
Walter Dörwald <walter@livinglogic.de>
parents:
39719
diff
changeset
|
2390 return NULL; |
|
3ac24c0110e9
Patch for bug #1633621: if curses.resizeterm() or
Walter Dörwald <walter@livinglogic.de>
parents:
39719
diff
changeset
|
2391 return result; |
|
38876
4a766024043a
Patch #1506645: add Python wrappers for the curses functions
Walter Dörwald <walter@livinglogic.de>
parents:
36675
diff
changeset
|
2392 } |
|
4a766024043a
Patch #1506645: add Python wrappers for the curses functions
Walter Dörwald <walter@livinglogic.de>
parents:
36675
diff
changeset
|
2393 |
|
4a766024043a
Patch #1506645: add Python wrappers for the curses functions
Walter Dörwald <walter@livinglogic.de>
parents:
36675
diff
changeset
|
2394 #endif |
|
4a766024043a
Patch #1506645: add Python wrappers for the curses functions
Walter Dörwald <walter@livinglogic.de>
parents:
36675
diff
changeset
|
2395 |
|
4a766024043a
Patch #1506645: add Python wrappers for the curses functions
Walter Dörwald <walter@livinglogic.de>
parents:
36675
diff
changeset
|
2396 #ifdef HAVE_CURSES_RESIZE_TERM |
|
4a766024043a
Patch #1506645: add Python wrappers for the curses functions
Walter Dörwald <walter@livinglogic.de>
parents:
36675
diff
changeset
|
2397 static PyObject * |
|
4a766024043a
Patch #1506645: add Python wrappers for the curses functions
Walter Dörwald <walter@livinglogic.de>
parents:
36675
diff
changeset
|
2398 PyCurses_Resize_Term(PyObject *self, PyObject *args) |
|
4a766024043a
Patch #1506645: add Python wrappers for the curses functions
Walter Dörwald <walter@livinglogic.de>
parents:
36675
diff
changeset
|
2399 { |
|
4a766024043a
Patch #1506645: add Python wrappers for the curses functions
Walter Dörwald <walter@livinglogic.de>
parents:
36675
diff
changeset
|
2400 int lines; |
|
4a766024043a
Patch #1506645: add Python wrappers for the curses functions
Walter Dörwald <walter@livinglogic.de>
parents:
36675
diff
changeset
|
2401 int columns; |
|
4a766024043a
Patch #1506645: add Python wrappers for the curses functions
Walter Dörwald <walter@livinglogic.de>
parents:
36675
diff
changeset
|
2402 |
|
41039
3ac24c0110e9
Patch for bug #1633621: if curses.resizeterm() or
Walter Dörwald <walter@livinglogic.de>
parents:
39719
diff
changeset
|
2403 PyObject *result; |
|
3ac24c0110e9
Patch for bug #1633621: if curses.resizeterm() or
Walter Dörwald <walter@livinglogic.de>
parents:
39719
diff
changeset
|
2404 |
|
38876
4a766024043a
Patch #1506645: add Python wrappers for the curses functions
Walter Dörwald <walter@livinglogic.de>
parents:
36675
diff
changeset
|
2405 PyCursesInitialised |
|
4a766024043a
Patch #1506645: add Python wrappers for the curses functions
Walter Dörwald <walter@livinglogic.de>
parents:
36675
diff
changeset
|
2406 |
|
4a766024043a
Patch #1506645: add Python wrappers for the curses functions
Walter Dörwald <walter@livinglogic.de>
parents:
36675
diff
changeset
|
2407 if (!PyArg_ParseTuple(args,"ii:resize_term", &lines, &columns)) |
|
4a766024043a
Patch #1506645: add Python wrappers for the curses functions
Walter Dörwald <walter@livinglogic.de>
parents:
36675
diff
changeset
|
2408 return NULL; |
|
4a766024043a
Patch #1506645: add Python wrappers for the curses functions
Walter Dörwald <walter@livinglogic.de>
parents:
36675
diff
changeset
|
2409 |
|
41039
3ac24c0110e9
Patch for bug #1633621: if curses.resizeterm() or
Walter Dörwald <walter@livinglogic.de>
parents:
39719
diff
changeset
|
2410 result = PyCursesCheckERR(resize_term(lines, columns), "resize_term"); |
|
3ac24c0110e9
Patch for bug #1633621: if curses.resizeterm() or
Walter Dörwald <walter@livinglogic.de>
parents:
39719
diff
changeset
|
2411 if (!result) |
|
3ac24c0110e9
Patch for bug #1633621: if curses.resizeterm() or
Walter Dörwald <walter@livinglogic.de>
parents:
39719
diff
changeset
|
2412 return NULL; |
|
3ac24c0110e9
Patch for bug #1633621: if curses.resizeterm() or
Walter Dörwald <walter@livinglogic.de>
parents:
39719
diff
changeset
|
2413 if (!update_lines_cols()) |
|
3ac24c0110e9
Patch for bug #1633621: if curses.resizeterm() or
Walter Dörwald <walter@livinglogic.de>
parents:
39719
diff
changeset
|
2414 return NULL; |
|
3ac24c0110e9
Patch for bug #1633621: if curses.resizeterm() or
Walter Dörwald <walter@livinglogic.de>
parents:
39719
diff
changeset
|
2415 return result; |
|
38876
4a766024043a
Patch #1506645: add Python wrappers for the curses functions
Walter Dörwald <walter@livinglogic.de>
parents:
36675
diff
changeset
|
2416 } |
|
4a766024043a
Patch #1506645: add Python wrappers for the curses functions
Walter Dörwald <walter@livinglogic.de>
parents:
36675
diff
changeset
|
2417 #endif /* HAVE_CURSES_RESIZE_TERM */ |
|
4a766024043a
Patch #1506645: add Python wrappers for the curses functions
Walter Dörwald <walter@livinglogic.de>
parents:
36675
diff
changeset
|
2418 |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2419 static PyObject * |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
2420 PyCurses_setsyx(PyObject *self, PyObject *args) |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2421 { |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2422 int y,x; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2423 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2424 PyCursesInitialised |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2425 |
|
21756
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
2426 if (PyTuple_Size(args)!=2) { |
|
12738
3d26cb3808a7
Changes by AMK: Use HAVE_NCURSES_H to include correct header file
Andrew M. Kuchling <amk@amk.ca>
parents:
12737
diff
changeset
|
2427 PyErr_SetString(PyExc_TypeError, "setsyx requires 2 arguments"); |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2428 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2429 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2430 |
|
21756
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
2431 if (!PyArg_ParseTuple(args, "ii;y, x", &y, &x)) return NULL; |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2432 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2433 setsyx(y,x); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2434 |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2435 Py_INCREF(Py_None); |
| 2357 | 2436 return Py_None; |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2437 } |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2438 |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2439 static PyObject * |
|
21756
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
2440 PyCurses_Start_Color(PyObject *self) |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2441 { |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2442 int code; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2443 PyObject *c, *cp; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2444 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2445 PyCursesInitialised |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2446 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2447 code = start_color(); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2448 if (code != ERR) { |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2449 initialisedcolors = TRUE; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2450 c = PyInt_FromLong((long) COLORS); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2451 PyDict_SetItemString(ModDict, "COLORS", c); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2452 Py_DECREF(c); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2453 cp = PyInt_FromLong((long) COLOR_PAIRS); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2454 PyDict_SetItemString(ModDict, "COLOR_PAIRS", cp); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2455 Py_DECREF(cp); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2456 Py_INCREF(Py_None); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2457 return Py_None; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2458 } else { |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2459 PyErr_SetString(PyCursesError, "start_color() returned ERR"); |
| 2357 | 2460 return NULL; |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2461 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2462 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2463 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2464 static PyObject * |
|
13715
06d4225919d4
Added wrappers for tiget{flag,num,str}, for querying terminfo capabilities
Andrew M. Kuchling <amk@amk.ca>
parents:
13708
diff
changeset
|
2465 PyCurses_tigetflag(PyObject *self, PyObject *args) |
|
06d4225919d4
Added wrappers for tiget{flag,num,str}, for querying terminfo capabilities
Andrew M. Kuchling <amk@amk.ca>
parents:
13708
diff
changeset
|
2466 { |
|
06d4225919d4
Added wrappers for tiget{flag,num,str}, for querying terminfo capabilities
Andrew M. Kuchling <amk@amk.ca>
parents:
13708
diff
changeset
|
2467 char *capname; |
|
06d4225919d4
Added wrappers for tiget{flag,num,str}, for querying terminfo capabilities
Andrew M. Kuchling <amk@amk.ca>
parents:
13708
diff
changeset
|
2468 |
|
15418
06465ed81826
Patch #102412 from mwh: Add support for the setupterm() function, to
Andrew M. Kuchling <amk@amk.ca>
parents:
15384
diff
changeset
|
2469 PyCursesSetupTermCalled; |
|
13715
06d4225919d4
Added wrappers for tiget{flag,num,str}, for querying terminfo capabilities
Andrew M. Kuchling <amk@amk.ca>
parents:
13708
diff
changeset
|
2470 |
|
06d4225919d4
Added wrappers for tiget{flag,num,str}, for querying terminfo capabilities
Andrew M. Kuchling <amk@amk.ca>
parents:
13708
diff
changeset
|
2471 if (!PyArg_ParseTuple(args, "z", &capname)) |
|
06d4225919d4
Added wrappers for tiget{flag,num,str}, for querying terminfo capabilities
Andrew M. Kuchling <amk@amk.ca>
parents:
13708
diff
changeset
|
2472 return NULL; |
|
06d4225919d4
Added wrappers for tiget{flag,num,str}, for querying terminfo capabilities
Andrew M. Kuchling <amk@amk.ca>
parents:
13708
diff
changeset
|
2473 |
|
06d4225919d4
Added wrappers for tiget{flag,num,str}, for querying terminfo capabilities
Andrew M. Kuchling <amk@amk.ca>
parents:
13708
diff
changeset
|
2474 return PyInt_FromLong( (long) tigetflag( capname ) ); |
|
06d4225919d4
Added wrappers for tiget{flag,num,str}, for querying terminfo capabilities
Andrew M. Kuchling <amk@amk.ca>
parents:
13708
diff
changeset
|
2475 } |
|
06d4225919d4
Added wrappers for tiget{flag,num,str}, for querying terminfo capabilities
Andrew M. Kuchling <amk@amk.ca>
parents:
13708
diff
changeset
|
2476 |
|
06d4225919d4
Added wrappers for tiget{flag,num,str}, for querying terminfo capabilities
Andrew M. Kuchling <amk@amk.ca>
parents:
13708
diff
changeset
|
2477 static PyObject * |
|
06d4225919d4
Added wrappers for tiget{flag,num,str}, for querying terminfo capabilities
Andrew M. Kuchling <amk@amk.ca>
parents:
13708
diff
changeset
|
2478 PyCurses_tigetnum(PyObject *self, PyObject *args) |
|
06d4225919d4
Added wrappers for tiget{flag,num,str}, for querying terminfo capabilities
Andrew M. Kuchling <amk@amk.ca>
parents:
13708
diff
changeset
|
2479 { |
|
06d4225919d4
Added wrappers for tiget{flag,num,str}, for querying terminfo capabilities
Andrew M. Kuchling <amk@amk.ca>
parents:
13708
diff
changeset
|
2480 char *capname; |
|
06d4225919d4
Added wrappers for tiget{flag,num,str}, for querying terminfo capabilities
Andrew M. Kuchling <amk@amk.ca>
parents:
13708
diff
changeset
|
2481 |
|
15418
06465ed81826
Patch #102412 from mwh: Add support for the setupterm() function, to
Andrew M. Kuchling <amk@amk.ca>
parents:
15384
diff
changeset
|
2482 PyCursesSetupTermCalled; |
|
13715
06d4225919d4
Added wrappers for tiget{flag,num,str}, for querying terminfo capabilities
Andrew M. Kuchling <amk@amk.ca>
parents:
13708
diff
changeset
|
2483 |
|
06d4225919d4
Added wrappers for tiget{flag,num,str}, for querying terminfo capabilities
Andrew M. Kuchling <amk@amk.ca>
parents:
13708
diff
changeset
|
2484 if (!PyArg_ParseTuple(args, "z", &capname)) |
|
06d4225919d4
Added wrappers for tiget{flag,num,str}, for querying terminfo capabilities
Andrew M. Kuchling <amk@amk.ca>
parents:
13708
diff
changeset
|
2485 return NULL; |
|
06d4225919d4
Added wrappers for tiget{flag,num,str}, for querying terminfo capabilities
Andrew M. Kuchling <amk@amk.ca>
parents:
13708
diff
changeset
|
2486 |
|
06d4225919d4
Added wrappers for tiget{flag,num,str}, for querying terminfo capabilities
Andrew M. Kuchling <amk@amk.ca>
parents:
13708
diff
changeset
|
2487 return PyInt_FromLong( (long) tigetnum( capname ) ); |
|
06d4225919d4
Added wrappers for tiget{flag,num,str}, for querying terminfo capabilities
Andrew M. Kuchling <amk@amk.ca>
parents:
13708
diff
changeset
|
2488 } |
|
06d4225919d4
Added wrappers for tiget{flag,num,str}, for querying terminfo capabilities
Andrew M. Kuchling <amk@amk.ca>
parents:
13708
diff
changeset
|
2489 |
|
06d4225919d4
Added wrappers for tiget{flag,num,str}, for querying terminfo capabilities
Andrew M. Kuchling <amk@amk.ca>
parents:
13708
diff
changeset
|
2490 static PyObject * |
|
06d4225919d4
Added wrappers for tiget{flag,num,str}, for querying terminfo capabilities
Andrew M. Kuchling <amk@amk.ca>
parents:
13708
diff
changeset
|
2491 PyCurses_tigetstr(PyObject *self, PyObject *args) |
|
06d4225919d4
Added wrappers for tiget{flag,num,str}, for querying terminfo capabilities
Andrew M. Kuchling <amk@amk.ca>
parents:
13708
diff
changeset
|
2492 { |
|
06d4225919d4
Added wrappers for tiget{flag,num,str}, for querying terminfo capabilities
Andrew M. Kuchling <amk@amk.ca>
parents:
13708
diff
changeset
|
2493 char *capname; |
|
06d4225919d4
Added wrappers for tiget{flag,num,str}, for querying terminfo capabilities
Andrew M. Kuchling <amk@amk.ca>
parents:
13708
diff
changeset
|
2494 |
|
15418
06465ed81826
Patch #102412 from mwh: Add support for the setupterm() function, to
Andrew M. Kuchling <amk@amk.ca>
parents:
15384
diff
changeset
|
2495 PyCursesSetupTermCalled; |
|
13715
06d4225919d4
Added wrappers for tiget{flag,num,str}, for querying terminfo capabilities
Andrew M. Kuchling <amk@amk.ca>
parents:
13708
diff
changeset
|
2496 |
|
06d4225919d4
Added wrappers for tiget{flag,num,str}, for querying terminfo capabilities
Andrew M. Kuchling <amk@amk.ca>
parents:
13708
diff
changeset
|
2497 if (!PyArg_ParseTuple(args, "z", &capname)) |
|
06d4225919d4
Added wrappers for tiget{flag,num,str}, for querying terminfo capabilities
Andrew M. Kuchling <amk@amk.ca>
parents:
13708
diff
changeset
|
2498 return NULL; |
|
06d4225919d4
Added wrappers for tiget{flag,num,str}, for querying terminfo capabilities
Andrew M. Kuchling <amk@amk.ca>
parents:
13708
diff
changeset
|
2499 |
|
06d4225919d4
Added wrappers for tiget{flag,num,str}, for querying terminfo capabilities
Andrew M. Kuchling <amk@amk.ca>
parents:
13708
diff
changeset
|
2500 capname = tigetstr( capname ); |
|
06d4225919d4
Added wrappers for tiget{flag,num,str}, for querying terminfo capabilities
Andrew M. Kuchling <amk@amk.ca>
parents:
13708
diff
changeset
|
2501 if (capname == 0 || capname == (char*) -1) { |
|
06d4225919d4
Added wrappers for tiget{flag,num,str}, for querying terminfo capabilities
Andrew M. Kuchling <amk@amk.ca>
parents:
13708
diff
changeset
|
2502 Py_INCREF(Py_None); |
|
06d4225919d4
Added wrappers for tiget{flag,num,str}, for querying terminfo capabilities
Andrew M. Kuchling <amk@amk.ca>
parents:
13708
diff
changeset
|
2503 return Py_None; |
|
06d4225919d4
Added wrappers for tiget{flag,num,str}, for querying terminfo capabilities
Andrew M. Kuchling <amk@amk.ca>
parents:
13708
diff
changeset
|
2504 } |
|
47527
52294af4b663
This reverts r63675 based on the discussion in this thread:
Gregory P. Smith <greg@mad-scientist.com>
parents:
47294
diff
changeset
|
2505 return PyString_FromString( capname ); |
|
13715
06d4225919d4
Added wrappers for tiget{flag,num,str}, for querying terminfo capabilities
Andrew M. Kuchling <amk@amk.ca>
parents:
13708
diff
changeset
|
2506 } |
|
06d4225919d4
Added wrappers for tiget{flag,num,str}, for querying terminfo capabilities
Andrew M. Kuchling <amk@amk.ca>
parents:
13708
diff
changeset
|
2507 |
|
06d4225919d4
Added wrappers for tiget{flag,num,str}, for querying terminfo capabilities
Andrew M. Kuchling <amk@amk.ca>
parents:
13708
diff
changeset
|
2508 static PyObject * |
|
15384
3cb12e0e7acd
Patch #102278: add tparm() function to _curses module
Andrew M. Kuchling <amk@amk.ca>
parents:
15369
diff
changeset
|
2509 PyCurses_tparm(PyObject *self, PyObject *args) |
|
3cb12e0e7acd
Patch #102278: add tparm() function to _curses module
Andrew M. Kuchling <amk@amk.ca>
parents:
15369
diff
changeset
|
2510 { |
|
3cb12e0e7acd
Patch #102278: add tparm() function to _curses module
Andrew M. Kuchling <amk@amk.ca>
parents:
15369
diff
changeset
|
2511 char* fmt; |
|
3cb12e0e7acd
Patch #102278: add tparm() function to _curses module
Andrew M. Kuchling <amk@amk.ca>
parents:
15369
diff
changeset
|
2512 char* result = NULL; |
|
26313
41ff50b4d097
Always call tparm with 10 arguments. It seems it's not varargs i
Michael W. Hudson <mwh@python.net>
parents:
26075
diff
changeset
|
2513 int i1=0,i2=0,i3=0,i4=0,i5=0,i6=0,i7=0,i8=0,i9=0; |
|
15384
3cb12e0e7acd
Patch #102278: add tparm() function to _curses module
Andrew M. Kuchling <amk@amk.ca>
parents:
15369
diff
changeset
|
2514 |
|
15418
06465ed81826
Patch #102412 from mwh: Add support for the setupterm() function, to
Andrew M. Kuchling <amk@amk.ca>
parents:
15384
diff
changeset
|
2515 PyCursesSetupTermCalled; |
|
15384
3cb12e0e7acd
Patch #102278: add tparm() function to _curses module
Andrew M. Kuchling <amk@amk.ca>
parents:
15369
diff
changeset
|
2516 |
|
3cb12e0e7acd
Patch #102278: add tparm() function to _curses module
Andrew M. Kuchling <amk@amk.ca>
parents:
15369
diff
changeset
|
2517 if (!PyArg_ParseTuple(args, "s|iiiiiiiii:tparm", |
|
3cb12e0e7acd
Patch #102278: add tparm() function to _curses module
Andrew M. Kuchling <amk@amk.ca>
parents:
15369
diff
changeset
|
2518 &fmt, &i1, &i2, &i3, &i4, |
|
3cb12e0e7acd
Patch #102278: add tparm() function to _curses module
Andrew M. Kuchling <amk@amk.ca>
parents:
15369
diff
changeset
|
2519 &i5, &i6, &i7, &i8, &i9)) { |
|
3cb12e0e7acd
Patch #102278: add tparm() function to _curses module
Andrew M. Kuchling <amk@amk.ca>
parents:
15369
diff
changeset
|
2520 return NULL; |
|
3cb12e0e7acd
Patch #102278: add tparm() function to _curses module
Andrew M. Kuchling <amk@amk.ca>
parents:
15369
diff
changeset
|
2521 } |
|
26313
41ff50b4d097
Always call tparm with 10 arguments. It seems it's not varargs i
Michael W. Hudson <mwh@python.net>
parents:
26075
diff
changeset
|
2522 |
|
21741
ea8c8400a4c8
Change some spaces to tabs. I don't *think* that was me, but it
Michael W. Hudson <mwh@python.net>
parents:
21740
diff
changeset
|
2523 result = tparm(fmt,i1,i2,i3,i4,i5,i6,i7,i8,i9); |
|
39719
e905f78eafca
Bug #1548092: fix curses.tparm seg fault on invalid input. Needs backport to 2.5.1 and earlier.
Neal Norwitz <nnorwitz@gmail.com>
parents:
39474
diff
changeset
|
2524 if (!result) { |
|
e905f78eafca
Bug #1548092: fix curses.tparm seg fault on invalid input. Needs backport to 2.5.1 and earlier.
Neal Norwitz <nnorwitz@gmail.com>
parents:
39474
diff
changeset
|
2525 PyErr_SetString(PyCursesError, "tparm() returned NULL"); |
|
e905f78eafca
Bug #1548092: fix curses.tparm seg fault on invalid input. Needs backport to 2.5.1 and earlier.
Neal Norwitz <nnorwitz@gmail.com>
parents:
39474
diff
changeset
|
2526 return NULL; |
|
e905f78eafca
Bug #1548092: fix curses.tparm seg fault on invalid input. Needs backport to 2.5.1 and earlier.
Neal Norwitz <nnorwitz@gmail.com>
parents:
39474
diff
changeset
|
2527 } |
|
26313
41ff50b4d097
Always call tparm with 10 arguments. It seems it's not varargs i
Michael W. Hudson <mwh@python.net>
parents:
26075
diff
changeset
|
2528 |
|
47527
52294af4b663
This reverts r63675 based on the discussion in this thread:
Gregory P. Smith <greg@mad-scientist.com>
parents:
47294
diff
changeset
|
2529 return PyString_FromString(result); |
|
15384
3cb12e0e7acd
Patch #102278: add tparm() function to _curses module
Andrew M. Kuchling <amk@amk.ca>
parents:
15369
diff
changeset
|
2530 } |
|
3cb12e0e7acd
Patch #102278: add tparm() function to _curses module
Andrew M. Kuchling <amk@amk.ca>
parents:
15369
diff
changeset
|
2531 |
|
3cb12e0e7acd
Patch #102278: add tparm() function to _curses module
Andrew M. Kuchling <amk@amk.ca>
parents:
15369
diff
changeset
|
2532 static PyObject * |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
2533 PyCurses_TypeAhead(PyObject *self, PyObject *args) |
|
12974
e7992d0d6808
Added .timeout() method and .typeahead() function
Andrew M. Kuchling <amk@amk.ca>
parents:
12913
diff
changeset
|
2534 { |
|
13385
aff1c4146c1c
Removed unused variables.
Andrew M. Kuchling <amk@amk.ca>
parents:
13040
diff
changeset
|
2535 int fd; |
|
12974
e7992d0d6808
Added .timeout() method and .typeahead() function
Andrew M. Kuchling <amk@amk.ca>
parents:
12913
diff
changeset
|
2536 |
|
e7992d0d6808
Added .timeout() method and .typeahead() function
Andrew M. Kuchling <amk@amk.ca>
parents:
12913
diff
changeset
|
2537 PyCursesInitialised |
|
e7992d0d6808
Added .timeout() method and .typeahead() function
Andrew M. Kuchling <amk@amk.ca>
parents:
12913
diff
changeset
|
2538 |
|
21756
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
2539 if (!PyArg_ParseTuple(args,"i;fd",&fd)) return NULL; |
|
12974
e7992d0d6808
Added .timeout() method and .typeahead() function
Andrew M. Kuchling <amk@amk.ca>
parents:
12913
diff
changeset
|
2540 |
|
32959
2bc332616cd6
Fix a leak of a reference on None.
Michael W. Hudson <mwh@python.net>
parents:
30140
diff
changeset
|
2541 return PyCursesCheckERR(typeahead( fd ), "typeahead"); |
|
12974
e7992d0d6808
Added .timeout() method and .typeahead() function
Andrew M. Kuchling <amk@amk.ca>
parents:
12913
diff
changeset
|
2542 } |
|
e7992d0d6808
Added .timeout() method and .typeahead() function
Andrew M. Kuchling <amk@amk.ca>
parents:
12913
diff
changeset
|
2543 |
|
e7992d0d6808
Added .timeout() method and .typeahead() function
Andrew M. Kuchling <amk@amk.ca>
parents:
12913
diff
changeset
|
2544 static PyObject * |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
2545 PyCurses_UnCtrl(PyObject *self, PyObject *args) |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2546 { |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2547 PyObject *temp; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2548 chtype ch; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2549 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2550 PyCursesInitialised |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2551 |
|
21756
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
2552 if (!PyArg_ParseTuple(args,"O;ch or int",&temp)) return NULL; |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2553 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2554 if (PyInt_Check(temp)) |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2555 ch = (chtype) PyInt_AsLong(temp); |
|
47527
52294af4b663
This reverts r63675 based on the discussion in this thread:
Gregory P. Smith <greg@mad-scientist.com>
parents:
47294
diff
changeset
|
2556 else if (PyString_Check(temp)) |
|
52294af4b663
This reverts r63675 based on the discussion in this thread:
Gregory P. Smith <greg@mad-scientist.com>
parents:
47294
diff
changeset
|
2557 ch = (chtype) *PyString_AsString(temp); |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2558 else { |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2559 PyErr_SetString(PyExc_TypeError, "argument must be a ch or an int"); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2560 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2561 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2562 |
|
47527
52294af4b663
This reverts r63675 based on the discussion in this thread:
Gregory P. Smith <greg@mad-scientist.com>
parents:
47294
diff
changeset
|
2563 return PyString_FromString(unctrl(ch)); |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2564 } |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2565 |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2566 static PyObject * |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
2567 PyCurses_UngetCh(PyObject *self, PyObject *args) |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2568 { |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2569 PyObject *temp; |
|
26075
1afca375f2a9
[Patch #633635 from David M. Cooke]
Andrew M. Kuchling <amk@amk.ca>
parents:
25966
diff
changeset
|
2570 int ch; |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2571 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2572 PyCursesInitialised |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2573 |
|
21756
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
2574 if (!PyArg_ParseTuple(args,"O;ch or int",&temp)) return NULL; |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2575 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2576 if (PyInt_Check(temp)) |
|
26075
1afca375f2a9
[Patch #633635 from David M. Cooke]
Andrew M. Kuchling <amk@amk.ca>
parents:
25966
diff
changeset
|
2577 ch = (int) PyInt_AsLong(temp); |
|
47527
52294af4b663
This reverts r63675 based on the discussion in this thread:
Gregory P. Smith <greg@mad-scientist.com>
parents:
47294
diff
changeset
|
2578 else if (PyString_Check(temp)) |
|
52294af4b663
This reverts r63675 based on the discussion in this thread:
Gregory P. Smith <greg@mad-scientist.com>
parents:
47294
diff
changeset
|
2579 ch = (int) *PyString_AsString(temp); |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2580 else { |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2581 PyErr_SetString(PyExc_TypeError, "argument must be a ch or an int"); |
| 2357 | 2582 return NULL; |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2583 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2584 |
| 2357 | 2585 return PyCursesCheckERR(ungetch(ch), "ungetch"); |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2586 } |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2587 |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2588 static PyObject * |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
2589 PyCurses_Use_Env(PyObject *self, PyObject *args) |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2590 { |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2591 int flag; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2592 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2593 PyCursesInitialised |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2594 |
|
21756
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
2595 switch(PyTuple_Size(args)) { |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2596 case 1: |
|
21756
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
2597 if (!PyArg_ParseTuple(args,"i;True(1), False(0)",&flag)) |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2598 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2599 break; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2600 default: |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2601 PyErr_SetString(PyExc_TypeError, "use_env requires 1 argument"); |
| 2357 | 2602 return NULL; |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2603 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2604 use_env(flag); |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2605 Py_INCREF(Py_None); |
| 2357 | 2606 return Py_None; |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2607 } |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2608 |
|
30140
f3654c5ada94
[Patch #739124] Add use_default_colors() to curses module
Andrew M. Kuchling <amk@amk.ca>
parents:
26313
diff
changeset
|
2609 #ifndef STRICT_SYSV_CURSES |
|
f3654c5ada94
[Patch #739124] Add use_default_colors() to curses module
Andrew M. Kuchling <amk@amk.ca>
parents:
26313
diff
changeset
|
2610 static PyObject * |
|
f3654c5ada94
[Patch #739124] Add use_default_colors() to curses module
Andrew M. Kuchling <amk@amk.ca>
parents:
26313
diff
changeset
|
2611 PyCurses_Use_Default_Colors(PyObject *self) |
|
f3654c5ada94
[Patch #739124] Add use_default_colors() to curses module
Andrew M. Kuchling <amk@amk.ca>
parents:
26313
diff
changeset
|
2612 { |
|
f3654c5ada94
[Patch #739124] Add use_default_colors() to curses module
Andrew M. Kuchling <amk@amk.ca>
parents:
26313
diff
changeset
|
2613 int code; |
|
f3654c5ada94
[Patch #739124] Add use_default_colors() to curses module
Andrew M. Kuchling <amk@amk.ca>
parents:
26313
diff
changeset
|
2614 |
|
f3654c5ada94
[Patch #739124] Add use_default_colors() to curses module
Andrew M. Kuchling <amk@amk.ca>
parents:
26313
diff
changeset
|
2615 PyCursesInitialised |
|
f3654c5ada94
[Patch #739124] Add use_default_colors() to curses module
Andrew M. Kuchling <amk@amk.ca>
parents:
26313
diff
changeset
|
2616 PyCursesInitialisedColor |
|
f3654c5ada94
[Patch #739124] Add use_default_colors() to curses module
Andrew M. Kuchling <amk@amk.ca>
parents:
26313
diff
changeset
|
2617 |
|
f3654c5ada94
[Patch #739124] Add use_default_colors() to curses module
Andrew M. Kuchling <amk@amk.ca>
parents:
26313
diff
changeset
|
2618 code = use_default_colors(); |
|
f3654c5ada94
[Patch #739124] Add use_default_colors() to curses module
Andrew M. Kuchling <amk@amk.ca>
parents:
26313
diff
changeset
|
2619 if (code != ERR) { |
|
f3654c5ada94
[Patch #739124] Add use_default_colors() to curses module
Andrew M. Kuchling <amk@amk.ca>
parents:
26313
diff
changeset
|
2620 Py_INCREF(Py_None); |
|
f3654c5ada94
[Patch #739124] Add use_default_colors() to curses module
Andrew M. Kuchling <amk@amk.ca>
parents:
26313
diff
changeset
|
2621 return Py_None; |
|
f3654c5ada94
[Patch #739124] Add use_default_colors() to curses module
Andrew M. Kuchling <amk@amk.ca>
parents:
26313
diff
changeset
|
2622 } else { |
|
f3654c5ada94
[Patch #739124] Add use_default_colors() to curses module
Andrew M. Kuchling <amk@amk.ca>
parents:
26313
diff
changeset
|
2623 PyErr_SetString(PyCursesError, "use_default_colors() returned ERR"); |
|
f3654c5ada94
[Patch #739124] Add use_default_colors() to curses module
Andrew M. Kuchling <amk@amk.ca>
parents:
26313
diff
changeset
|
2624 return NULL; |
|
f3654c5ada94
[Patch #739124] Add use_default_colors() to curses module
Andrew M. Kuchling <amk@amk.ca>
parents:
26313
diff
changeset
|
2625 } |
|
f3654c5ada94
[Patch #739124] Add use_default_colors() to curses module
Andrew M. Kuchling <amk@amk.ca>
parents:
26313
diff
changeset
|
2626 } |
|
f3654c5ada94
[Patch #739124] Add use_default_colors() to curses module
Andrew M. Kuchling <amk@amk.ca>
parents:
26313
diff
changeset
|
2627 #endif /* STRICT_SYSV_CURSES */ |
|
f3654c5ada94
[Patch #739124] Add use_default_colors() to curses module
Andrew M. Kuchling <amk@amk.ca>
parents:
26313
diff
changeset
|
2628 |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2629 /* List of functions defined in the module */ |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2630 |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2631 static PyMethodDef PyCurses_methods[] = { |
|
21756
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
2632 {"baudrate", (PyCFunction)PyCurses_baudrate, METH_NOARGS}, |
|
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
2633 {"beep", (PyCFunction)PyCurses_beep, METH_NOARGS}, |
|
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
2634 {"can_change_color", (PyCFunction)PyCurses_can_change_color, METH_NOARGS}, |
|
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
2635 {"cbreak", (PyCFunction)PyCurses_cbreak, METH_VARARGS}, |
|
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
2636 {"color_content", (PyCFunction)PyCurses_Color_Content, METH_VARARGS}, |
|
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
2637 {"color_pair", (PyCFunction)PyCurses_color_pair, METH_VARARGS}, |
|
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
2638 {"curs_set", (PyCFunction)PyCurses_Curs_Set, METH_VARARGS}, |
|
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
2639 {"def_prog_mode", (PyCFunction)PyCurses_def_prog_mode, METH_NOARGS}, |
|
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
2640 {"def_shell_mode", (PyCFunction)PyCurses_def_shell_mode, METH_NOARGS}, |
|
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
2641 {"delay_output", (PyCFunction)PyCurses_Delay_Output, METH_VARARGS}, |
|
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
2642 {"doupdate", (PyCFunction)PyCurses_doupdate, METH_NOARGS}, |
|
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
2643 {"echo", (PyCFunction)PyCurses_echo, METH_VARARGS}, |
|
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
2644 {"endwin", (PyCFunction)PyCurses_endwin, METH_NOARGS}, |
|
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
2645 {"erasechar", (PyCFunction)PyCurses_EraseChar, METH_NOARGS}, |
|
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
2646 {"filter", (PyCFunction)PyCurses_filter, METH_NOARGS}, |
|
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
2647 {"flash", (PyCFunction)PyCurses_flash, METH_NOARGS}, |
|
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
2648 {"flushinp", (PyCFunction)PyCurses_flushinp, METH_NOARGS}, |
|
13036
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
2649 #ifdef NCURSES_MOUSE_VERSION |
|
21756
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
2650 {"getmouse", (PyCFunction)PyCurses_GetMouse, METH_NOARGS}, |
|
13036
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
2651 {"ungetmouse", (PyCFunction)PyCurses_UngetMouse, METH_VARARGS}, |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
2652 #endif |
|
21756
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
2653 {"getsyx", (PyCFunction)PyCurses_getsyx, METH_NOARGS}, |
|
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
2654 {"getwin", (PyCFunction)PyCurses_GetWin, METH_O}, |
|
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
2655 {"has_colors", (PyCFunction)PyCurses_has_colors, METH_NOARGS}, |
|
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
2656 {"has_ic", (PyCFunction)PyCurses_has_ic, METH_NOARGS}, |
|
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
2657 {"has_il", (PyCFunction)PyCurses_has_il, METH_NOARGS}, |
|
13708
fe89ea1c9108
Modified version of patch #100963 from Mark Favas: has_key() is an
Andrew M. Kuchling <amk@amk.ca>
parents:
13706
diff
changeset
|
2658 #ifndef STRICT_SYSV_CURSES |
|
21756
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
2659 {"has_key", (PyCFunction)PyCurses_has_key, METH_VARARGS}, |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2660 #endif |
|
21756
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
2661 {"halfdelay", (PyCFunction)PyCurses_HalfDelay, METH_VARARGS}, |
|
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
2662 {"init_color", (PyCFunction)PyCurses_Init_Color, METH_VARARGS}, |
|
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
2663 {"init_pair", (PyCFunction)PyCurses_Init_Pair, METH_VARARGS}, |
|
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
2664 {"initscr", (PyCFunction)PyCurses_InitScr, METH_NOARGS}, |
|
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
2665 {"intrflush", (PyCFunction)PyCurses_IntrFlush, METH_VARARGS}, |
|
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
2666 {"isendwin", (PyCFunction)PyCurses_isendwin, METH_NOARGS}, |
|
38876
4a766024043a
Patch #1506645: add Python wrappers for the curses functions
Walter Dörwald <walter@livinglogic.de>
parents:
36675
diff
changeset
|
2667 #ifdef HAVE_CURSES_IS_TERM_RESIZED |
|
4a766024043a
Patch #1506645: add Python wrappers for the curses functions
Walter Dörwald <walter@livinglogic.de>
parents:
36675
diff
changeset
|
2668 {"is_term_resized", (PyCFunction)PyCurses_Is_Term_Resized, METH_VARARGS}, |
|
4a766024043a
Patch #1506645: add Python wrappers for the curses functions
Walter Dörwald <walter@livinglogic.de>
parents:
36675
diff
changeset
|
2669 #endif |
|
16351
ef32bfa5f5c6
Patch #103485 from Donn Cave: patches to make the module compile on AIX and
Andrew M. Kuchling <amk@amk.ca>
parents:
16350
diff
changeset
|
2670 #if !defined(__NetBSD__) |
|
21756
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
2671 {"keyname", (PyCFunction)PyCurses_KeyName, METH_VARARGS}, |
|
16351
ef32bfa5f5c6
Patch #103485 from Donn Cave: patches to make the module compile on AIX and
Andrew M. Kuchling <amk@amk.ca>
parents:
16350
diff
changeset
|
2672 #endif |
|
21756
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
2673 {"killchar", (PyCFunction)PyCurses_KillChar, METH_NOARGS}, |
|
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
2674 {"longname", (PyCFunction)PyCurses_longname, METH_NOARGS}, |
|
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
2675 {"meta", (PyCFunction)PyCurses_Meta, METH_VARARGS}, |
|
13036
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
2676 #ifdef NCURSES_MOUSE_VERSION |
|
21756
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
2677 {"mouseinterval", (PyCFunction)PyCurses_MouseInterval, METH_VARARGS}, |
|
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
2678 {"mousemask", (PyCFunction)PyCurses_MouseMask, METH_VARARGS}, |
|
13036
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
2679 #endif |
|
21756
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
2680 {"napms", (PyCFunction)PyCurses_Napms, METH_VARARGS}, |
|
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
2681 {"newpad", (PyCFunction)PyCurses_NewPad, METH_VARARGS}, |
|
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
2682 {"newwin", (PyCFunction)PyCurses_NewWindow, METH_VARARGS}, |
|
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
2683 {"nl", (PyCFunction)PyCurses_nl, METH_VARARGS}, |
|
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
2684 {"nocbreak", (PyCFunction)PyCurses_nocbreak, METH_NOARGS}, |
|
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
2685 {"noecho", (PyCFunction)PyCurses_noecho, METH_NOARGS}, |
|
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
2686 {"nonl", (PyCFunction)PyCurses_nonl, METH_NOARGS}, |
|
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
2687 {"noqiflush", (PyCFunction)PyCurses_noqiflush, METH_NOARGS}, |
|
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
2688 {"noraw", (PyCFunction)PyCurses_noraw, METH_NOARGS}, |
|
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
2689 {"pair_content", (PyCFunction)PyCurses_Pair_Content, METH_VARARGS}, |
|
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
2690 {"pair_number", (PyCFunction)PyCurses_pair_number, METH_VARARGS}, |
|
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
2691 {"putp", (PyCFunction)PyCurses_Putp, METH_VARARGS}, |
|
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
2692 {"qiflush", (PyCFunction)PyCurses_QiFlush, METH_VARARGS}, |
|
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
2693 {"raw", (PyCFunction)PyCurses_raw, METH_VARARGS}, |
|
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
2694 {"reset_prog_mode", (PyCFunction)PyCurses_reset_prog_mode, METH_NOARGS}, |
|
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
2695 {"reset_shell_mode", (PyCFunction)PyCurses_reset_shell_mode, METH_NOARGS}, |
|
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
2696 {"resetty", (PyCFunction)PyCurses_resetty, METH_NOARGS}, |
|
38876
4a766024043a
Patch #1506645: add Python wrappers for the curses functions
Walter Dörwald <walter@livinglogic.de>
parents:
36675
diff
changeset
|
2697 #ifdef HAVE_CURSES_RESIZETERM |
|
4a766024043a
Patch #1506645: add Python wrappers for the curses functions
Walter Dörwald <walter@livinglogic.de>
parents:
36675
diff
changeset
|
2698 {"resizeterm", (PyCFunction)PyCurses_ResizeTerm, METH_VARARGS}, |
|
4a766024043a
Patch #1506645: add Python wrappers for the curses functions
Walter Dörwald <walter@livinglogic.de>
parents:
36675
diff
changeset
|
2699 #endif |
|
4a766024043a
Patch #1506645: add Python wrappers for the curses functions
Walter Dörwald <walter@livinglogic.de>
parents:
36675
diff
changeset
|
2700 #ifdef HAVE_CURSES_RESIZE_TERM |
|
4a766024043a
Patch #1506645: add Python wrappers for the curses functions
Walter Dörwald <walter@livinglogic.de>
parents:
36675
diff
changeset
|
2701 {"resize_term", (PyCFunction)PyCurses_Resize_Term, METH_VARARGS}, |
|
4a766024043a
Patch #1506645: add Python wrappers for the curses functions
Walter Dörwald <walter@livinglogic.de>
parents:
36675
diff
changeset
|
2702 #endif |
|
21756
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
2703 {"savetty", (PyCFunction)PyCurses_savetty, METH_NOARGS}, |
|
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
2704 {"setsyx", (PyCFunction)PyCurses_setsyx, METH_VARARGS}, |
|
20583
b5ca0687ba6a
Add two forgotten 'break' statements
Andrew M. Kuchling <amk@amk.ca>
parents:
20412
diff
changeset
|
2705 {"setupterm", (PyCFunction)PyCurses_setupterm, |
|
b5ca0687ba6a
Add two forgotten 'break' statements
Andrew M. Kuchling <amk@amk.ca>
parents:
20412
diff
changeset
|
2706 METH_VARARGS|METH_KEYWORDS}, |
|
21756
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
2707 {"start_color", (PyCFunction)PyCurses_Start_Color, METH_NOARGS}, |
|
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
2708 {"termattrs", (PyCFunction)PyCurses_termattrs, METH_NOARGS}, |
|
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
2709 {"termname", (PyCFunction)PyCurses_termname, METH_NOARGS}, |
|
13715
06d4225919d4
Added wrappers for tiget{flag,num,str}, for querying terminfo capabilities
Andrew M. Kuchling <amk@amk.ca>
parents:
13708
diff
changeset
|
2710 {"tigetflag", (PyCFunction)PyCurses_tigetflag, METH_VARARGS}, |
|
06d4225919d4
Added wrappers for tiget{flag,num,str}, for querying terminfo capabilities
Andrew M. Kuchling <amk@amk.ca>
parents:
13708
diff
changeset
|
2711 {"tigetnum", (PyCFunction)PyCurses_tigetnum, METH_VARARGS}, |
|
06d4225919d4
Added wrappers for tiget{flag,num,str}, for querying terminfo capabilities
Andrew M. Kuchling <amk@amk.ca>
parents:
13708
diff
changeset
|
2712 {"tigetstr", (PyCFunction)PyCurses_tigetstr, METH_VARARGS}, |
|
15384
3cb12e0e7acd
Patch #102278: add tparm() function to _curses module
Andrew M. Kuchling <amk@amk.ca>
parents:
15369
diff
changeset
|
2713 {"tparm", (PyCFunction)PyCurses_tparm, METH_VARARGS}, |
|
21756
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
2714 {"typeahead", (PyCFunction)PyCurses_TypeAhead, METH_VARARGS}, |
|
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
2715 {"unctrl", (PyCFunction)PyCurses_UnCtrl, METH_VARARGS}, |
|
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
2716 {"ungetch", (PyCFunction)PyCurses_UngetCh, METH_VARARGS}, |
|
d60350d71b60
Patch #477752: Drop old-style getargs from curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
21741
diff
changeset
|
2717 {"use_env", (PyCFunction)PyCurses_Use_Env, METH_VARARGS}, |
|
30140
f3654c5ada94
[Patch #739124] Add use_default_colors() to curses module
Andrew M. Kuchling <amk@amk.ca>
parents:
26313
diff
changeset
|
2718 #ifndef STRICT_SYSV_CURSES |
|
f3654c5ada94
[Patch #739124] Add use_default_colors() to curses module
Andrew M. Kuchling <amk@amk.ca>
parents:
26313
diff
changeset
|
2719 {"use_default_colors", (PyCFunction)PyCurses_Use_Default_Colors, METH_NOARGS}, |
|
f3654c5ada94
[Patch #739124] Add use_default_colors() to curses module
Andrew M. Kuchling <amk@amk.ca>
parents:
26313
diff
changeset
|
2720 #endif |
|
20583
b5ca0687ba6a
Add two forgotten 'break' statements
Andrew M. Kuchling <amk@amk.ca>
parents:
20412
diff
changeset
|
2721 {NULL, NULL} /* sentinel */ |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2722 }; |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2723 |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2724 /* Initialization function for the module */ |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2725 |
|
24471
f66b3a3509c7
Excise DL_EXPORT/DL_IMPORT from Modules/*. Required adding a prototype
Mark Hammond <mhammond@skippinet.com.au>
parents:
21845
diff
changeset
|
2726 PyMODINIT_FUNC |
|
13651
8a063423e0b7
Bunch of minor ANSIfications: 'void initfunc()' -> 'void initfunc(void)',
Thomas Wouters <thomas@python.org>
parents:
13465
diff
changeset
|
2727 init_curses(void) |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2728 { |
|
15646
5b158fc0ed55
Export C API from this module.
Andrew M. Kuchling <amk@amk.ca>
parents:
15638
diff
changeset
|
2729 PyObject *m, *d, *v, *c_api_object; |
|
5b158fc0ed55
Export C API from this module.
Andrew M. Kuchling <amk@amk.ca>
parents:
15638
diff
changeset
|
2730 static void *PyCurses_API[PyCurses_API_pointers]; |
|
5b158fc0ed55
Export C API from this module.
Andrew M. Kuchling <amk@amk.ca>
parents:
15638
diff
changeset
|
2731 |
|
16007
32352e120c37
Support building this as a DLL under Cygwin.
Guido van Rossum <guido@python.org>
parents:
15661
diff
changeset
|
2732 /* Initialize object type */ |
|
44350
26384b8180c7
#1629: Renamed Py_Size, Py_Type and Py_Refcnt to Py_SIZE, Py_TYPE and Py_REFCNT. Macros for b/w compatibility are available.
Christian Heimes <christian@cheimes.de>
parents:
42333
diff
changeset
|
2733 Py_TYPE(&PyCursesWindow_Type) = &PyType_Type; |
|
16007
32352e120c37
Support building this as a DLL under Cygwin.
Guido van Rossum <guido@python.org>
parents:
15661
diff
changeset
|
2734 |
|
15646
5b158fc0ed55
Export C API from this module.
Andrew M. Kuchling <amk@amk.ca>
parents:
15638
diff
changeset
|
2735 /* Initialize the C API pointer array */ |
|
5b158fc0ed55
Export C API from this module.
Andrew M. Kuchling <amk@amk.ca>
parents:
15638
diff
changeset
|
2736 PyCurses_API[0] = (void *)&PyCursesWindow_Type; |
|
5b158fc0ed55
Export C API from this module.
Andrew M. Kuchling <amk@amk.ca>
parents:
15638
diff
changeset
|
2737 PyCurses_API[1] = (void *)func_PyCursesSetupTermCalled; |
|
5b158fc0ed55
Export C API from this module.
Andrew M. Kuchling <amk@amk.ca>
parents:
15638
diff
changeset
|
2738 PyCurses_API[2] = (void *)func_PyCursesInitialised; |
|
5b158fc0ed55
Export C API from this module.
Andrew M. Kuchling <amk@amk.ca>
parents:
15638
diff
changeset
|
2739 PyCurses_API[3] = (void *)func_PyCursesInitialisedColor; |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2740 |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2741 /* Create the module and add the functions */ |
|
12913
e5aac9dfacf8
Renamed the C extension for ncurses support from 'curses' to '_curses'.
Andrew M. Kuchling <amk@amk.ca>
parents:
12738
diff
changeset
|
2742 m = Py_InitModule("_curses", PyCurses_methods); |
|
36324
1af7f719ed28
Check return result from Py_InitModule*(). This API can fail.
Neal Norwitz <nnorwitz@gmail.com>
parents:
36263
diff
changeset
|
2743 if (m == NULL) |
|
1af7f719ed28
Check return result from Py_InitModule*(). This API can fail.
Neal Norwitz <nnorwitz@gmail.com>
parents:
36263
diff
changeset
|
2744 return; |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2745 |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2746 /* Add some symbolic constants to the module */ |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2747 d = PyModule_GetDict(m); |
|
39474
24d2cc33000c
Handle failure from PyModule_GetDict() (Klocwork 208).
Neal Norwitz <nnorwitz@gmail.com>
parents:
39192
diff
changeset
|
2748 if (d == NULL) |
|
24d2cc33000c
Handle failure from PyModule_GetDict() (Klocwork 208).
Neal Norwitz <nnorwitz@gmail.com>
parents:
39192
diff
changeset
|
2749 return; |
|
15646
5b158fc0ed55
Export C API from this module.
Andrew M. Kuchling <amk@amk.ca>
parents:
15638
diff
changeset
|
2750 ModDict = d; /* For PyCurses_InitScr to use later */ |
|
5b158fc0ed55
Export C API from this module.
Andrew M. Kuchling <amk@amk.ca>
parents:
15638
diff
changeset
|
2751 |
|
5b158fc0ed55
Export C API from this module.
Andrew M. Kuchling <amk@amk.ca>
parents:
15638
diff
changeset
|
2752 /* Add a CObject for the C API */ |
|
5b158fc0ed55
Export C API from this module.
Andrew M. Kuchling <amk@amk.ca>
parents:
15638
diff
changeset
|
2753 c_api_object = PyCObject_FromVoidPtr((void *)PyCurses_API, NULL); |
|
5b158fc0ed55
Export C API from this module.
Andrew M. Kuchling <amk@amk.ca>
parents:
15638
diff
changeset
|
2754 PyDict_SetItemString(d, "_C_API", c_api_object); |
|
20955
615a4f560268
Patch in bug report #477700: Fix memory leaks in gdbm & curses.
Martin v. Löwis <martin@v.loewis.de>
parents:
20647
diff
changeset
|
2755 Py_DECREF(c_api_object); |
| 1858 | 2756 |
| 2357 | 2757 /* For exception curses.error */ |
|
13388
88044f9df833
Python 2.0 is not supposed to use string exceptions in the standard library
Fred Drake <fdrake@acm.org>
parents:
13385
diff
changeset
|
2758 PyCursesError = PyErr_NewException("_curses.error", NULL, NULL); |
| 2357 | 2759 PyDict_SetItemString(d, "error", PyCursesError); |
| 1858 | 2760 |
| 2357 | 2761 /* Make the version available */ |
|
47527
52294af4b663
This reverts r63675 based on the discussion in this thread:
Gregory P. Smith <greg@mad-scientist.com>
parents:
47294
diff
changeset
|
2762 v = PyString_FromString(PyCursesVersion); |
|
2358
4c43cbdcd524
bump version, add __version__ back in
Guido van Rossum <guido@python.org>
parents:
2357
diff
changeset
|
2763 PyDict_SetItemString(d, "version", v); |
|
4c43cbdcd524
bump version, add __version__ back in
Guido van Rossum <guido@python.org>
parents:
2357
diff
changeset
|
2764 PyDict_SetItemString(d, "__version__", v); |
|
4c43cbdcd524
bump version, add __version__ back in
Guido van Rossum <guido@python.org>
parents:
2357
diff
changeset
|
2765 Py_DECREF(v); |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2766 |
|
15661
afad65975a82
Add the curses constants ERR and OK to the module at TG's suggestion
Andrew M. Kuchling <amk@amk.ca>
parents:
15646
diff
changeset
|
2767 SetDictInt("ERR", ERR); |
|
afad65975a82
Add the curses constants ERR and OK to the module at TG's suggestion
Andrew M. Kuchling <amk@amk.ca>
parents:
15646
diff
changeset
|
2768 SetDictInt("OK", OK); |
|
afad65975a82
Add the curses constants ERR and OK to the module at TG's suggestion
Andrew M. Kuchling <amk@amk.ca>
parents:
15646
diff
changeset
|
2769 |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2770 /* Here are some attributes you can add to chars to print */ |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2771 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2772 SetDictInt("A_ATTRIBUTES", A_ATTRIBUTES); |
|
12738
3d26cb3808a7
Changes by AMK: Use HAVE_NCURSES_H to include correct header file
Andrew M. Kuchling <amk@amk.ca>
parents:
12737
diff
changeset
|
2773 SetDictInt("A_NORMAL", A_NORMAL); |
|
3d26cb3808a7
Changes by AMK: Use HAVE_NCURSES_H to include correct header file
Andrew M. Kuchling <amk@amk.ca>
parents:
12737
diff
changeset
|
2774 SetDictInt("A_STANDOUT", A_STANDOUT); |
|
3d26cb3808a7
Changes by AMK: Use HAVE_NCURSES_H to include correct header file
Andrew M. Kuchling <amk@amk.ca>
parents:
12737
diff
changeset
|
2775 SetDictInt("A_UNDERLINE", A_UNDERLINE); |
|
3d26cb3808a7
Changes by AMK: Use HAVE_NCURSES_H to include correct header file
Andrew M. Kuchling <amk@amk.ca>
parents:
12737
diff
changeset
|
2776 SetDictInt("A_REVERSE", A_REVERSE); |
|
3d26cb3808a7
Changes by AMK: Use HAVE_NCURSES_H to include correct header file
Andrew M. Kuchling <amk@amk.ca>
parents:
12737
diff
changeset
|
2777 SetDictInt("A_BLINK", A_BLINK); |
|
3d26cb3808a7
Changes by AMK: Use HAVE_NCURSES_H to include correct header file
Andrew M. Kuchling <amk@amk.ca>
parents:
12737
diff
changeset
|
2778 SetDictInt("A_DIM", A_DIM); |
|
3d26cb3808a7
Changes by AMK: Use HAVE_NCURSES_H to include correct header file
Andrew M. Kuchling <amk@amk.ca>
parents:
12737
diff
changeset
|
2779 SetDictInt("A_BOLD", A_BOLD); |
|
3d26cb3808a7
Changes by AMK: Use HAVE_NCURSES_H to include correct header file
Andrew M. Kuchling <amk@amk.ca>
parents:
12737
diff
changeset
|
2780 SetDictInt("A_ALTCHARSET", A_ALTCHARSET); |
|
16351
ef32bfa5f5c6
Patch #103485 from Donn Cave: patches to make the module compile on AIX and
Andrew M. Kuchling <amk@amk.ca>
parents:
16350
diff
changeset
|
2781 #if !defined(__NetBSD__) |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2782 SetDictInt("A_INVIS", A_INVIS); |
|
16351
ef32bfa5f5c6
Patch #103485 from Donn Cave: patches to make the module compile on AIX and
Andrew M. Kuchling <amk@amk.ca>
parents:
16350
diff
changeset
|
2783 #endif |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2784 SetDictInt("A_PROTECT", A_PROTECT); |
|
12738
3d26cb3808a7
Changes by AMK: Use HAVE_NCURSES_H to include correct header file
Andrew M. Kuchling <amk@amk.ca>
parents:
12737
diff
changeset
|
2785 SetDictInt("A_CHARTEXT", A_CHARTEXT); |
|
3d26cb3808a7
Changes by AMK: Use HAVE_NCURSES_H to include correct header file
Andrew M. Kuchling <amk@amk.ca>
parents:
12737
diff
changeset
|
2786 SetDictInt("A_COLOR", A_COLOR); |
|
15369
3abcb6966617
Patch from Randall Hopper to fix PR #116172, "curses module fails to
Andrew M. Kuchling <amk@amk.ca>
parents:
14334
diff
changeset
|
2787 |
|
3abcb6966617
Patch from Randall Hopper to fix PR #116172, "curses module fails to
Andrew M. Kuchling <amk@amk.ca>
parents:
14334
diff
changeset
|
2788 /* The following are never available with strict SYSV curses */ |
|
3abcb6966617
Patch from Randall Hopper to fix PR #116172, "curses module fails to
Andrew M. Kuchling <amk@amk.ca>
parents:
14334
diff
changeset
|
2789 #ifdef A_HORIZONTAL |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2790 SetDictInt("A_HORIZONTAL", A_HORIZONTAL); |
|
15369
3abcb6966617
Patch from Randall Hopper to fix PR #116172, "curses module fails to
Andrew M. Kuchling <amk@amk.ca>
parents:
14334
diff
changeset
|
2791 #endif |
|
3abcb6966617
Patch from Randall Hopper to fix PR #116172, "curses module fails to
Andrew M. Kuchling <amk@amk.ca>
parents:
14334
diff
changeset
|
2792 #ifdef A_LEFT |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2793 SetDictInt("A_LEFT", A_LEFT); |
|
15369
3abcb6966617
Patch from Randall Hopper to fix PR #116172, "curses module fails to
Andrew M. Kuchling <amk@amk.ca>
parents:
14334
diff
changeset
|
2794 #endif |
|
3abcb6966617
Patch from Randall Hopper to fix PR #116172, "curses module fails to
Andrew M. Kuchling <amk@amk.ca>
parents:
14334
diff
changeset
|
2795 #ifdef A_LOW |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2796 SetDictInt("A_LOW", A_LOW); |
|
15369
3abcb6966617
Patch from Randall Hopper to fix PR #116172, "curses module fails to
Andrew M. Kuchling <amk@amk.ca>
parents:
14334
diff
changeset
|
2797 #endif |
|
3abcb6966617
Patch from Randall Hopper to fix PR #116172, "curses module fails to
Andrew M. Kuchling <amk@amk.ca>
parents:
14334
diff
changeset
|
2798 #ifdef A_RIGHT |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2799 SetDictInt("A_RIGHT", A_RIGHT); |
|
15369
3abcb6966617
Patch from Randall Hopper to fix PR #116172, "curses module fails to
Andrew M. Kuchling <amk@amk.ca>
parents:
14334
diff
changeset
|
2800 #endif |
|
3abcb6966617
Patch from Randall Hopper to fix PR #116172, "curses module fails to
Andrew M. Kuchling <amk@amk.ca>
parents:
14334
diff
changeset
|
2801 #ifdef A_TOP |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2802 SetDictInt("A_TOP", A_TOP); |
|
15369
3abcb6966617
Patch from Randall Hopper to fix PR #116172, "curses module fails to
Andrew M. Kuchling <amk@amk.ca>
parents:
14334
diff
changeset
|
2803 #endif |
|
3abcb6966617
Patch from Randall Hopper to fix PR #116172, "curses module fails to
Andrew M. Kuchling <amk@amk.ca>
parents:
14334
diff
changeset
|
2804 #ifdef A_VERTICAL |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2805 SetDictInt("A_VERTICAL", A_VERTICAL); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2806 #endif |
|
12738
3d26cb3808a7
Changes by AMK: Use HAVE_NCURSES_H to include correct header file
Andrew M. Kuchling <amk@amk.ca>
parents:
12737
diff
changeset
|
2807 |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2808 SetDictInt("COLOR_BLACK", COLOR_BLACK); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2809 SetDictInt("COLOR_RED", COLOR_RED); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2810 SetDictInt("COLOR_GREEN", COLOR_GREEN); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2811 SetDictInt("COLOR_YELLOW", COLOR_YELLOW); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2812 SetDictInt("COLOR_BLUE", COLOR_BLUE); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2813 SetDictInt("COLOR_MAGENTA", COLOR_MAGENTA); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2814 SetDictInt("COLOR_CYAN", COLOR_CYAN); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2815 SetDictInt("COLOR_WHITE", COLOR_WHITE); |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2816 |
|
13036
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
2817 #ifdef NCURSES_MOUSE_VERSION |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
2818 /* Mouse-related constants */ |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
2819 SetDictInt("BUTTON1_PRESSED", BUTTON1_PRESSED); |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
2820 SetDictInt("BUTTON1_RELEASED", BUTTON1_RELEASED); |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
2821 SetDictInt("BUTTON1_CLICKED", BUTTON1_CLICKED); |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
2822 SetDictInt("BUTTON1_DOUBLE_CLICKED", BUTTON1_DOUBLE_CLICKED); |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
2823 SetDictInt("BUTTON1_TRIPLE_CLICKED", BUTTON1_TRIPLE_CLICKED); |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
2824 |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
2825 SetDictInt("BUTTON2_PRESSED", BUTTON2_PRESSED); |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
2826 SetDictInt("BUTTON2_RELEASED", BUTTON2_RELEASED); |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
2827 SetDictInt("BUTTON2_CLICKED", BUTTON2_CLICKED); |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
2828 SetDictInt("BUTTON2_DOUBLE_CLICKED", BUTTON2_DOUBLE_CLICKED); |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
2829 SetDictInt("BUTTON2_TRIPLE_CLICKED", BUTTON2_TRIPLE_CLICKED); |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
2830 |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
2831 SetDictInt("BUTTON3_PRESSED", BUTTON3_PRESSED); |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
2832 SetDictInt("BUTTON3_RELEASED", BUTTON3_RELEASED); |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
2833 SetDictInt("BUTTON3_CLICKED", BUTTON3_CLICKED); |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
2834 SetDictInt("BUTTON3_DOUBLE_CLICKED", BUTTON3_DOUBLE_CLICKED); |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
2835 SetDictInt("BUTTON3_TRIPLE_CLICKED", BUTTON3_TRIPLE_CLICKED); |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
2836 |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
2837 SetDictInt("BUTTON4_PRESSED", BUTTON4_PRESSED); |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
2838 SetDictInt("BUTTON4_RELEASED", BUTTON4_RELEASED); |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
2839 SetDictInt("BUTTON4_CLICKED", BUTTON4_CLICKED); |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
2840 SetDictInt("BUTTON4_DOUBLE_CLICKED", BUTTON4_DOUBLE_CLICKED); |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
2841 SetDictInt("BUTTON4_TRIPLE_CLICKED", BUTTON4_TRIPLE_CLICKED); |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
2842 |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
2843 SetDictInt("BUTTON_SHIFT", BUTTON_SHIFT); |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
2844 SetDictInt("BUTTON_CTRL", BUTTON_CTRL); |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
2845 SetDictInt("BUTTON_ALT", BUTTON_ALT); |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
2846 |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
2847 SetDictInt("ALL_MOUSE_EVENTS", ALL_MOUSE_EVENTS); |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
2848 SetDictInt("REPORT_MOUSE_POSITION", REPORT_MOUSE_POSITION); |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
2849 #endif |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2850 /* Now set everything up for KEY_ variables */ |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2851 { |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2852 int key; |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2853 char *key_n; |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2854 char *key_n2; |
|
16351
ef32bfa5f5c6
Patch #103485 from Donn Cave: patches to make the module compile on AIX and
Andrew M. Kuchling <amk@amk.ca>
parents:
16350
diff
changeset
|
2855 #if !defined(__NetBSD__) |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2856 for (key=KEY_MIN;key < KEY_MAX; key++) { |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2857 key_n = (char *)keyname(key); |
|
2296
f17d6e6b40da
clear errors between failing calls to PyArg_Parse
Guido van Rossum <guido@python.org>
parents:
2123
diff
changeset
|
2858 if (key_n == NULL || strcmp(key_n,"UNKNOWN KEY")==0) |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2859 continue; |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2860 if (strncmp(key_n,"KEY_F(",6)==0) { |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2861 char *p1, *p2; |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2862 key_n2 = malloc(strlen(key_n)+1); |
|
39474
24d2cc33000c
Handle failure from PyModule_GetDict() (Klocwork 208).
Neal Norwitz <nnorwitz@gmail.com>
parents:
39192
diff
changeset
|
2863 if (!key_n2) { |
|
24d2cc33000c
Handle failure from PyModule_GetDict() (Klocwork 208).
Neal Norwitz <nnorwitz@gmail.com>
parents:
39192
diff
changeset
|
2864 PyErr_NoMemory(); |
|
24d2cc33000c
Handle failure from PyModule_GetDict() (Klocwork 208).
Neal Norwitz <nnorwitz@gmail.com>
parents:
39192
diff
changeset
|
2865 break; |
|
24d2cc33000c
Handle failure from PyModule_GetDict() (Klocwork 208).
Neal Norwitz <nnorwitz@gmail.com>
parents:
39192
diff
changeset
|
2866 } |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2867 p1 = key_n; |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2868 p2 = key_n2; |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2869 while (*p1) { |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2870 if (*p1 != '(' && *p1 != ')') { |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2871 *p2 = *p1; |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2872 p2++; |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2873 } |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2874 p1++; |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2875 } |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2876 *p2 = (char)0; |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2877 } else |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2878 key_n2 = key_n; |
|
39474
24d2cc33000c
Handle failure from PyModule_GetDict() (Klocwork 208).
Neal Norwitz <nnorwitz@gmail.com>
parents:
39192
diff
changeset
|
2879 SetDictInt(key_n2,key); |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2880 if (key_n2 != key_n) |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2881 free(key_n2); |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2882 } |
|
16351
ef32bfa5f5c6
Patch #103485 from Donn Cave: patches to make the module compile on AIX and
Andrew M. Kuchling <amk@amk.ca>
parents:
16350
diff
changeset
|
2883 #endif |
| 2357 | 2884 SetDictInt("KEY_MIN", KEY_MIN); |
| 2885 SetDictInt("KEY_MAX", KEY_MAX); | |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2886 } |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2887 } |
