Mercurial > cpython-lru_cache-weakref
annotate Modules/_cursesmodule.c @ 16798:258dcafe2d0b legacy-trunk
Gustavo Niemeyer <niemeyer@conectiva.com>:
Fixed recno support (keys are integers rather than strings).
Work around DB bug that cause stdin to be closed by rnopen() when the
DB file needed to exist but did not (no longer segfaults).
This closes SF tracker patch #403445.
Also wrapped some long lines and added whitespace around operators -- FLD.
| author | Fred Drake <fdrake@acm.org> |
|---|---|
| date | Tue, 27 Feb 2001 18:56:46 +0000 |
| parents | ef32bfa5f5c6 |
| children | 0ec06b4755db |
| 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 * |
|
3d26cb3808a7
Changes by AMK: Use HAVE_NCURSES_H to include correct header file
Andrew M. Kuchling <amk@amk.ca>
parents:
12737
diff
changeset
|
11 * Tidied for Python 1.6, and currently maintained by AMK (amk1@bigfoot.com) |
|
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 |
|
b769e2dd6a51
Added list of missing functions as a comment
Andrew M. Kuchling <amk@amk.ca>
parents:
13721
diff
changeset
|
38 A number of SysV or ncurses functions don't have wrappers yet; if you need |
|
b769e2dd6a51
Added list of missing functions as a comment
Andrew M. Kuchling <amk@amk.ca>
parents:
13721
diff
changeset
|
39 a given function, add it and send a patch. Here's a list of currently |
|
b769e2dd6a51
Added list of missing functions as a comment
Andrew M. Kuchling <amk@amk.ca>
parents:
13721
diff
changeset
|
40 unsupported functions: |
|
b769e2dd6a51
Added list of missing functions as a comment
Andrew M. Kuchling <amk@amk.ca>
parents:
13721
diff
changeset
|
41 |
|
15638
7639a9552479
Another patch from Thomas Gellekum: add .overlay() and .overwrite()
Andrew M. Kuchling <amk@amk.ca>
parents:
15574
diff
changeset
|
42 addchnstr addchstr chgat color_set define_key |
|
13728
b769e2dd6a51
Added list of missing functions as a comment
Andrew M. Kuchling <amk@amk.ca>
parents:
13721
diff
changeset
|
43 del_curterm delscreen dupwin inchnstr inchstr innstr keyok |
|
b769e2dd6a51
Added list of missing functions as a comment
Andrew M. Kuchling <amk@amk.ca>
parents:
13721
diff
changeset
|
44 mcprint mvaddchnstr mvaddchstr mvchgat mvcur mvinchnstr |
|
b769e2dd6a51
Added list of missing functions as a comment
Andrew M. Kuchling <amk@amk.ca>
parents:
13721
diff
changeset
|
45 mvinchstr mvinnstr mmvwaddchnstr mvwaddchstr mvwchgat |
|
15574
4a9f1552ba68
Wrapper for napms() function, contributed by Thomas Gellekum <tg@FreeBSD.org>
Andrew M. Kuchling <amk@amk.ca>
parents:
15418
diff
changeset
|
46 mvwgetnstr mvwinchnstr mvwinchstr mvwinnstr newterm |
|
15638
7639a9552479
Another patch from Thomas Gellekum: add .overlay() and .overwrite()
Andrew M. Kuchling <amk@amk.ca>
parents:
15574
diff
changeset
|
47 resizeterm 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
|
48 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
|
49 tgetent tgetflag tgetnum tgetstr tgoto timeout tputs |
|
06465ed81826
Patch #102412 from mwh: Add support for the setupterm() function, to
Andrew M. Kuchling <amk@amk.ca>
parents:
15384
diff
changeset
|
50 use_default_colors vidattr vidputs waddchnstr waddchstr wchgat |
|
06465ed81826
Patch #102412 from mwh: Add support for the setupterm() function, to
Andrew M. Kuchling <amk@amk.ca>
parents:
15384
diff
changeset
|
51 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
|
52 |
|
b769e2dd6a51
Added list of missing functions as a comment
Andrew M. Kuchling <amk@amk.ca>
parents:
13721
diff
changeset
|
53 Low-priority: |
|
b769e2dd6a51
Added list of missing functions as a comment
Andrew M. Kuchling <amk@amk.ca>
parents:
13721
diff
changeset
|
54 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
|
55 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
|
56 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
|
57 |
|
15574
4a9f1552ba68
Wrapper for napms() function, contributed by Thomas Gellekum <tg@FreeBSD.org>
Andrew M. Kuchling <amk@amk.ca>
parents:
15418
diff
changeset
|
58 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
|
59 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
|
60 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
|
61 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
|
62 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
|
63 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
|
64 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
|
65 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
|
66 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
|
67 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
|
68 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
|
69 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
|
70 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
|
71 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
|
72 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
|
73 |
|
4a9f1552ba68
Wrapper for napms() function, contributed by Thomas Gellekum <tg@FreeBSD.org>
Andrew M. Kuchling <amk@amk.ca>
parents:
15418
diff
changeset
|
74 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
|
75 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
|
76 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
|
77 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
|
78 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
|
79 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
|
80 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
|
81 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
|
82 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
|
83 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
|
84 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
|
85 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
|
86 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
|
87 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
|
88 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
|
89 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
|
90 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
|
91 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
|
92 |
|
4a9f1552ba68
Wrapper for napms() function, contributed by Thomas Gellekum <tg@FreeBSD.org>
Andrew M. Kuchling <amk@amk.ca>
parents:
15418
diff
changeset
|
93 |
|
13728
b769e2dd6a51
Added list of missing functions as a comment
Andrew M. Kuchling <amk@amk.ca>
parents:
13721
diff
changeset
|
94 */ |
|
b769e2dd6a51
Added list of missing functions as a comment
Andrew M. Kuchling <amk@amk.ca>
parents:
13721
diff
changeset
|
95 |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
96 /* Release Number */ |
| 1858 | 97 |
|
15646
5b158fc0ed55
Export C API from this module.
Andrew M. Kuchling <amk@amk.ca>
parents:
15638
diff
changeset
|
98 char *PyCursesVersion = "2.1"; |
| 1858 | 99 |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
100 /* Includes */ |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
101 |
|
1888
be956b1efb97
* various modules: #include "Python.h" and remove most remporary
Guido van Rossum <guido@python.org>
parents:
1867
diff
changeset
|
102 #include "Python.h" |
|
15646
5b158fc0ed55
Export C API from this module.
Andrew M. Kuchling <amk@amk.ca>
parents:
15638
diff
changeset
|
103 #define CURSES_MODULE |
|
5b158fc0ed55
Export C API from this module.
Andrew M. Kuchling <amk@amk.ca>
parents:
15638
diff
changeset
|
104 #include "py_curses.h" |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
105 |
|
13040
12ac2c267b93
Fixes for compiling on Tru64.
Andrew M. Kuchling <amk@amk.ca>
parents:
13039
diff
changeset
|
106 #ifdef __osf__ |
|
12ac2c267b93
Fixes for compiling on Tru64.
Andrew M. Kuchling <amk@amk.ca>
parents:
13039
diff
changeset
|
107 #define _XOPEN_SOURCE_EXTENDED /* Define macro for OSF/1 */ |
|
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 |
|
15418
06465ed81826
Patch #102412 from mwh: Add support for the setupterm() function, to
Andrew M. Kuchling <amk@amk.ca>
parents:
15384
diff
changeset
|
111 /* 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
|
112 #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
|
113 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
|
114 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
|
115 extern int setupterm(char *,int,int *); |
|
15369
3abcb6966617
Patch from Randall Hopper to fix PR #116172, "curses module fails to
Andrew M. Kuchling <amk@amk.ca>
parents:
14334
diff
changeset
|
116 #ifdef sgi |
|
3abcb6966617
Patch from Randall Hopper to fix PR #116172, "curses module fails to
Andrew M. Kuchling <amk@amk.ca>
parents:
14334
diff
changeset
|
117 extern char *tigetstr(char *); |
|
16323
afd0930f8683
Bug #130117: add a prototype required to compile cleanly on IRIX
Andrew M. Kuchling <amk@amk.ca>
parents:
16007
diff
changeset
|
118 extern char *tparm(char *instring, ...); |
|
15369
3abcb6966617
Patch from Randall Hopper to fix PR #116172, "curses module fails to
Andrew M. Kuchling <amk@amk.ca>
parents:
14334
diff
changeset
|
119 #endif |
|
3abcb6966617
Patch from Randall Hopper to fix PR #116172, "curses module fails to
Andrew M. Kuchling <amk@amk.ca>
parents:
14334
diff
changeset
|
120 |
|
3abcb6966617
Patch from Randall Hopper to fix PR #116172, "curses module fails to
Andrew M. Kuchling <amk@amk.ca>
parents:
14334
diff
changeset
|
121 #if defined(sgi) || defined(__sun__) |
|
13708
fe89ea1c9108
Modified version of patch #100963 from Mark Favas: has_key() is an
Andrew M. Kuchling <amk@amk.ca>
parents:
13706
diff
changeset
|
122 #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
|
123 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
|
124 #endif |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
125 |
|
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
|
126 #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
|
127 #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
|
128 #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
|
129 |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
130 /* 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
|
131 |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
132 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
|
133 |
|
15418
06465ed81826
Patch #102412 from mwh: Add support for the setupterm() function, to
Andrew M. Kuchling <amk@amk.ca>
parents:
15384
diff
changeset
|
134 /* 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
|
135 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
|
136 |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
137 /* 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
|
138 static int initialised = FALSE; |
|
73eeff4d43f8
more fixes by Steve Clift
Guido van Rossum <guido@python.org>
parents:
2358
diff
changeset
|
139 |
|
15646
5b158fc0ed55
Export C API from this module.
Andrew M. Kuchling <amk@amk.ca>
parents:
15638
diff
changeset
|
140 /* 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
|
141 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
|
142 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
143 /* 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
|
144 #define PyCursesSetupTermCalled \ |
|
06465ed81826
Patch #102412 from mwh: Add support for the setupterm() function, to
Andrew M. Kuchling <amk@amk.ca>
parents:
15384
diff
changeset
|
145 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
|
146 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
|
147 "must call (at least) setupterm() first"); \ |
|
15646
5b158fc0ed55
Export C API from this module.
Andrew M. Kuchling <amk@amk.ca>
parents:
15638
diff
changeset
|
148 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
|
149 |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
150 #define PyCursesInitialised \ |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
151 if (initialised != TRUE) { \ |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
152 PyErr_SetString(PyCursesError, \ |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
153 "must call initscr() first"); \ |
|
15646
5b158fc0ed55
Export C API from this module.
Andrew M. Kuchling <amk@amk.ca>
parents:
15638
diff
changeset
|
154 return 0; } |
| 2357 | 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 PyCursesInitialisedColor \ |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
157 if (initialisedcolors != 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 start_color() 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 /* Utility Functions */ |
| 1858 | 163 |
| 2357 | 164 /* |
| 165 * 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
|
166 * 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
|
167 * CObject API. |
| 2357 | 168 */ |
| 169 | |
| 170 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
|
171 PyCursesCheckERR(int code, char *fname) |
| 2357 | 172 { |
| 173 if (code != ERR) { | |
| 174 Py_INCREF(Py_None); | |
| 175 return Py_None; | |
| 176 } else { | |
| 177 if (fname == NULL) { | |
| 178 PyErr_SetString(PyCursesError, catchall_ERR); | |
| 179 } 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
|
180 PyErr_Format(PyCursesError, "%s() returned ERR", fname); |
| 2357 | 181 } |
| 182 return NULL; | |
| 183 } | |
| 184 } | |
| 185 | |
|
12738
3d26cb3808a7
Changes by AMK: Use HAVE_NCURSES_H to include correct header file
Andrew M. Kuchling <amk@amk.ca>
parents:
12737
diff
changeset
|
186 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
|
187 PyCurses_ConvertToChtype(PyObject *obj, chtype *ch) |
|
2423
73eeff4d43f8
more fixes by Steve Clift
Guido van Rossum <guido@python.org>
parents:
2358
diff
changeset
|
188 { |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
189 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
|
190 *ch = (chtype) PyInt_AsLong(obj); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
191 } else if(PyString_Check(obj) & |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
192 (PyString_Size(obj) == 1)) { |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
193 *ch = (chtype) *PyString_AsString(obj); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
194 } else { |
|
2423
73eeff4d43f8
more fixes by Steve Clift
Guido van Rossum <guido@python.org>
parents:
2358
diff
changeset
|
195 return 0; |
|
73eeff4d43f8
more fixes by Steve Clift
Guido van Rossum <guido@python.org>
parents:
2358
diff
changeset
|
196 } |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
197 return 1; |
|
2423
73eeff4d43f8
more fixes by Steve Clift
Guido van Rossum <guido@python.org>
parents:
2358
diff
changeset
|
198 } |
|
73eeff4d43f8
more fixes by Steve Clift
Guido van Rossum <guido@python.org>
parents:
2358
diff
changeset
|
199 |
|
15646
5b158fc0ed55
Export C API from this module.
Andrew M. Kuchling <amk@amk.ca>
parents:
15638
diff
changeset
|
200 /* 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
|
201 initialised or not. */ |
|
5b158fc0ed55
Export C API from this module.
Andrew M. Kuchling <amk@amk.ca>
parents:
15638
diff
changeset
|
202 |
|
5b158fc0ed55
Export C API from this module.
Andrew M. Kuchling <amk@amk.ca>
parents:
15638
diff
changeset
|
203 static int func_PyCursesSetupTermCalled(void) |
|
5b158fc0ed55
Export C API from this module.
Andrew M. Kuchling <amk@amk.ca>
parents:
15638
diff
changeset
|
204 { |
|
5b158fc0ed55
Export C API from this module.
Andrew M. Kuchling <amk@amk.ca>
parents:
15638
diff
changeset
|
205 PyCursesSetupTermCalled; |
|
5b158fc0ed55
Export C API from this module.
Andrew M. Kuchling <amk@amk.ca>
parents:
15638
diff
changeset
|
206 return 1; |
|
5b158fc0ed55
Export C API from this module.
Andrew M. Kuchling <amk@amk.ca>
parents:
15638
diff
changeset
|
207 } |
|
5b158fc0ed55
Export C API from this module.
Andrew M. Kuchling <amk@amk.ca>
parents:
15638
diff
changeset
|
208 |
|
5b158fc0ed55
Export C API from this module.
Andrew M. Kuchling <amk@amk.ca>
parents:
15638
diff
changeset
|
209 static int func_PyCursesInitialised(void) |
|
5b158fc0ed55
Export C API from this module.
Andrew M. Kuchling <amk@amk.ca>
parents:
15638
diff
changeset
|
210 { |
|
5b158fc0ed55
Export C API from this module.
Andrew M. Kuchling <amk@amk.ca>
parents:
15638
diff
changeset
|
211 PyCursesInitialised; |
|
5b158fc0ed55
Export C API from this module.
Andrew M. Kuchling <amk@amk.ca>
parents:
15638
diff
changeset
|
212 return 1; |
|
5b158fc0ed55
Export C API from this module.
Andrew M. Kuchling <amk@amk.ca>
parents:
15638
diff
changeset
|
213 } |
|
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 static int func_PyCursesInitialisedColor(void) |
|
5b158fc0ed55
Export C API from this module.
Andrew M. Kuchling <amk@amk.ca>
parents:
15638
diff
changeset
|
216 { |
|
5b158fc0ed55
Export C API from this module.
Andrew M. Kuchling <amk@amk.ca>
parents:
15638
diff
changeset
|
217 PyCursesInitialisedColor; |
|
5b158fc0ed55
Export C API from this module.
Andrew M. Kuchling <amk@amk.ca>
parents:
15638
diff
changeset
|
218 return 1; |
|
5b158fc0ed55
Export C API from this module.
Andrew M. Kuchling <amk@amk.ca>
parents:
15638
diff
changeset
|
219 } |
|
5b158fc0ed55
Export C API from this module.
Andrew M. Kuchling <amk@amk.ca>
parents:
15638
diff
changeset
|
220 |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
221 /***************************************************************************** |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
222 The Window Object |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
223 ******************************************************************************/ |
|
2423
73eeff4d43f8
more fixes by Steve Clift
Guido van Rossum <guido@python.org>
parents:
2358
diff
changeset
|
224 |
|
15646
5b158fc0ed55
Export C API from this module.
Andrew M. Kuchling <amk@amk.ca>
parents:
15638
diff
changeset
|
225 /* 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
|
226 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
227 PyTypeObject PyCursesWindow_Type; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
228 |
|
15646
5b158fc0ed55
Export C API from this module.
Andrew M. Kuchling <amk@amk.ca>
parents:
15638
diff
changeset
|
229 /* 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
|
230 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
231 X - function name |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
232 TYPE - parameter Type |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
233 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
|
234 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
|
235 */ |
|
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 #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
|
238 static PyObject *PyCursesWindow_ ## X (PyCursesWindowObject *self, PyObject *args) \ |
|
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
239 { if (!PyArg_NoArgs(args)) return NULL; \ |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
240 return PyCursesCheckERR(X(self->win), # X); } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
241 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
242 #define Window_NoArgTrueFalseFunction(X) \ |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
243 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
|
244 { \ |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
245 if (!PyArg_NoArgs(args)) return NULL; \ |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
246 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
|
247 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
|
248 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
249 #define Window_NoArgNoReturnVoidFunction(X) \ |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
250 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
|
251 { \ |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
252 if (!PyArg_NoArgs(args)) return NULL; \ |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
253 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
|
254 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
255 #define Window_NoArg2TupleReturnFunction(X, TYPE, ERGSTR) \ |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
256 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
|
257 { \ |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
258 TYPE arg1, arg2; \ |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
259 if (!PyArg_NoArgs(args)) return NULL; \ |
|
12737
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,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
|
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_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
|
263 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
|
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; \ |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
266 if (!PyArg_Parse(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
|
267 X(self->win,arg1); Py_INCREF(Py_None); return Py_None; } |
| 2357 | 268 |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
269 #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
|
270 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
|
271 { \ |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
272 TYPE arg1; \ |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
273 if (!PyArg_Parse(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
|
274 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
|
275 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
276 #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
|
277 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
|
278 { \ |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
279 TYPE arg1, arg2; \ |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
280 if (!PyArg_Parse(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
|
281 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
|
282 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
283 /* ------------- WINDOW routines --------------- */ |
|
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 Window_NoArgNoReturnFunction(untouchwin) |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
286 Window_NoArgNoReturnFunction(touchwin) |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
287 Window_NoArgNoReturnFunction(redrawwin) |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
288 Window_NoArgNoReturnFunction(winsertln) |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
289 Window_NoArgNoReturnFunction(werase) |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
290 Window_NoArgNoReturnFunction(wdeleteln) |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
291 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
292 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
|
293 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
294 Window_NoArgNoReturnVoidFunction(wsyncup) |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
295 Window_NoArgNoReturnVoidFunction(wsyncdown) |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
296 Window_NoArgNoReturnVoidFunction(wstandend) |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
297 Window_NoArgNoReturnVoidFunction(wstandout) |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
298 Window_NoArgNoReturnVoidFunction(wcursyncup) |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
299 Window_NoArgNoReturnVoidFunction(wclrtoeol) |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
300 Window_NoArgNoReturnVoidFunction(wclrtobot) |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
301 Window_NoArgNoReturnVoidFunction(wclear) |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
302 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
303 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
|
304 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
|
305 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
|
306 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
307 Window_NoArg2TupleReturnFunction(getyx, int, "(ii)") |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
308 Window_NoArg2TupleReturnFunction(getbegyx, int, "(ii)") |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
309 Window_NoArg2TupleReturnFunction(getmaxyx, int, "(ii)") |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
310 Window_NoArg2TupleReturnFunction(getparyx, int, "(ii)") |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
311 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
312 Window_OneArgNoReturnFunction(wattron, attr_t, "l;attr") |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
313 Window_OneArgNoReturnFunction(wattroff, attr_t, "l;attr") |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
314 Window_OneArgNoReturnFunction(wattrset, attr_t, "l;attr") |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
315 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
|
316 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
|
317 #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
|
318 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
|
319 #else |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
320 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
|
321 #endif |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
322 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
|
323 #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
|
324 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
|
325 #else |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
326 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
|
327 #endif |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
328 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
|
329 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
|
330 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
|
331 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
|
332 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
333 Window_TwoArgNoReturnFunction(mvwin, int, "(ii);y,x") |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
334 Window_TwoArgNoReturnFunction(mvderwin, int, "(ii);y,x") |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
335 Window_TwoArgNoReturnFunction(wmove, int, "(ii);y,x") |
|
13040
12ac2c267b93
Fixes for compiling on Tru64.
Andrew M. Kuchling <amk@amk.ca>
parents:
13039
diff
changeset
|
336 #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
|
337 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
|
338 #endif |
| 2357 | 339 |
|
12738
3d26cb3808a7
Changes by AMK: Use HAVE_NCURSES_H to include correct header file
Andrew M. Kuchling <amk@amk.ca>
parents:
12737
diff
changeset
|
340 /* Allocation and deallocation of Window Objects */ |
| 2357 | 341 |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
342 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
|
343 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
|
344 { |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
345 PyCursesWindowObject *wo; |
| 2357 | 346 |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
347 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
|
348 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
|
349 wo->win = win; |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
350 return (PyObject *)wo; |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
351 } |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
352 |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
353 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
|
354 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
|
355 { |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
356 if (wo->win != stdscr) delwin(wo->win); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
357 PyMem_DEL(wo); |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
358 } |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
359 |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
360 /* 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
|
361 |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
362 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
|
363 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
|
364 { |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
365 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
|
366 PyObject *temp; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
367 chtype ch = 0; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
368 attr_t attr = A_NORMAL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
369 |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
370 switch (ARG_COUNT(args)) { |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
371 case 1: |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
372 if (!PyArg_Parse(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
|
373 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
374 break; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
375 case 2: |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
376 if (!PyArg_Parse(args, "(Ol);ch or int,attr", &temp, &attr)) |
|
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 3: |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
380 if (!PyArg_Parse(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
|
381 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
382 use_xy = TRUE; |
|
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 4: |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
385 if (!PyArg_Parse(args,"(iiOl);y,x,ch or int, attr", |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
386 &y, &x, &temp, &attr)) |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
387 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
388 use_xy = TRUE; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
389 break; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
390 default: |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
391 PyErr_SetString(PyExc_TypeError, "addch 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
|
392 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
393 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
394 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
395 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
|
396 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
|
397 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
398 } |
|
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 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
|
401 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
|
402 else { |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
403 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
|
404 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
405 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
|
406 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
407 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
408 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
|
409 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
|
410 { |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
411 int rtn; |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
412 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
|
413 char *str; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
414 attr_t attr = A_NORMAL , attr_old = A_NORMAL; |
| 2357 | 415 int use_xy = FALSE, use_attr = FALSE; |
| 416 | |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
417 switch (ARG_COUNT(args)) { |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
418 case 1: |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
419 if (!PyArg_Parse(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
|
420 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
421 break; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
422 case 2: |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
423 if (!PyArg_Parse(args,"(sl);str,attr", &str, &attr)) |
| 2357 | 424 return NULL; |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
425 use_attr = TRUE; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
426 break; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
427 case 3: |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
428 if (!PyArg_Parse(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
|
429 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
430 use_xy = TRUE; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
431 break; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
432 case 4: |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
433 if (!PyArg_Parse(args,"(iisl);int,int,str,attr", &y, &x, &str, &attr)) |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
434 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
435 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
|
436 break; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
437 default: |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
438 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
|
439 return NULL; |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
440 } |
| 2357 | 441 |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
442 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
|
443 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
|
444 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
|
445 } |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
446 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
|
447 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
|
448 else |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
449 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
|
450 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
|
451 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
|
452 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
|
453 } |
|
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 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
|
456 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
|
457 { |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
458 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
|
459 char *str; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
460 attr_t attr = A_NORMAL , attr_old = A_NORMAL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
461 int use_xy = FALSE, use_attr = FALSE; |
| 2357 | 462 |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
463 switch (ARG_COUNT(args)) { |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
464 case 2: |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
465 if (!PyArg_Parse(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
|
466 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
467 break; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
468 case 3: |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
469 if (!PyArg_Parse(args,"(sil);str,n,attr", &str, &n, &attr)) |
| 2357 | 470 return NULL; |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
471 use_attr = TRUE; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
472 break; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
473 case 4: |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
474 if (!PyArg_Parse(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
|
475 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
476 use_xy = TRUE; |
|
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 5: |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
479 if (!PyArg_Parse(args,"(iisil);y,x,str,n,attr", &y, &x, &str, &n, &attr)) |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
480 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
481 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
|
482 break; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
483 default: |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
484 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
|
485 return NULL; |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
486 } |
| 2357 | 487 |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
488 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
|
489 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
|
490 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
|
491 } |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
492 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
|
493 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
|
494 else |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
495 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
|
496 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
|
497 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
|
498 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
|
499 } |
| 2357 | 500 |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
501 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
|
502 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
|
503 { |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
504 PyObject *temp; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
505 chtype bkgd; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
506 attr_t attr = A_NORMAL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
507 |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
508 switch (ARG_COUNT(args)) { |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
509 case 1: |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
510 if (!PyArg_Parse(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
|
511 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
512 break; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
513 case 2: |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
514 if (!PyArg_Parse(args,"(Ol);ch or int,attr", &temp, &attr)) |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
515 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
516 break; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
517 default: |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
518 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
|
519 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
520 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
521 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
522 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
|
523 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
|
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 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
526 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
527 return PyCursesCheckERR(wbkgd(self->win, bkgd | A_NORMAL), "bkgd"); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
528 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
529 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
530 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
|
531 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
|
532 { |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
533 PyObject *temp; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
534 chtype bkgd; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
535 attr_t attr = A_NORMAL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
536 |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
537 switch (ARG_COUNT(args)) { |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
538 case 1: |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
539 if (!PyArg_Parse(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
|
540 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
541 break; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
542 case 2: |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
543 if (!PyArg_Parse(args,"(Ol);ch or int,attr", &temp, &attr)) |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
544 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
545 break; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
546 default: |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
547 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
|
548 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
549 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
550 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
551 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
|
552 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
|
553 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
554 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
555 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
556 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
|
557 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
|
558 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
559 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
560 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
|
561 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
|
562 { |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
563 chtype ls, rs, ts, bs, tl, tr, bl, br; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
564 ls = rs = ts = bs = tl = tr = bl = br = 0; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
565 if (!PyArg_Parse(args,"|llllllll;ls,rs,ts,bs,tl,tr,bl,br", |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
566 &ls, &rs, &ts, &bs, &tl, &tr, &bl, &br)) |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
567 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
568 wborder(self->win, ls, rs, ts, bs, tl, tr, bl, br); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
569 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
|
570 return Py_None; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
571 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
572 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
573 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
|
574 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
|
575 { |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
576 chtype ch1=0,ch2=0; |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
577 if (!PyArg_NoArgs(args)) { |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
578 PyErr_Clear(); |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
579 if (!PyArg_Parse(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
|
580 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
581 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
582 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
|
583 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
|
584 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
|
585 } |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
586 |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
587 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
|
588 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
|
589 { |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
590 int rtn; |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
591 int x, y; |
| 2357 | 592 |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
593 switch (ARG_COUNT(args)) { |
| 2357 | 594 case 0: |
| 595 rtn = wdelch(self->win); | |
| 596 break; | |
| 597 case 2: | |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
598 if (!PyArg_Parse(args,"(ii);y,x", &y, &x)) |
| 2357 | 599 return NULL; |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
600 rtn = mvwdelch(self->win,y,x); |
| 2357 | 601 break; |
| 602 default: | |
| 603 PyErr_SetString(PyExc_TypeError, "delch requires 0 or 2 arguments"); | |
| 604 return NULL; | |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
605 } |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
606 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
|
607 } |
| 2357 | 608 |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
609 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
|
610 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
|
611 { |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
612 WINDOW *win; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
613 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
|
614 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
615 nlines = 0; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
616 ncols = 0; |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
617 switch (ARG_COUNT(args)) { |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
618 case 2: |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
619 if (!PyArg_Parse(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
|
620 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
621 break; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
622 case 4: |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
623 if (!PyArg_Parse(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
|
624 &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
|
625 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
626 break; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
627 default: |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
628 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
|
629 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
630 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
631 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
632 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
|
633 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
634 if (win == NULL) { |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
635 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
|
636 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
637 } |
|
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 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
|
640 } |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
641 |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
642 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
|
643 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
|
644 { |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
645 PyObject *temp; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
646 chtype ch; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
647 attr_t attr = A_NORMAL; |
| 2357 | 648 |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
649 switch (ARG_COUNT(args)) { |
| 2357 | 650 case 1: |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
651 if (!PyArg_Parse(args,"O;ch or int", &temp)) |
| 2357 | 652 return NULL; |
| 653 break; | |
| 654 case 2: | |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
655 if (!PyArg_Parse(args,"(Ol);ch or int,attr", &temp, &attr)) |
| 2357 | 656 return NULL; |
| 657 break; | |
| 658 default: | |
| 659 PyErr_SetString(PyExc_TypeError, "echochar requires 1 or 2 arguments"); | |
| 660 | |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
661 |
| 2357 | 662 return NULL; |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
663 } |
| 2357 | 664 |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
665 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
|
666 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
|
667 return NULL; |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
668 } |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
669 |
|
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
|
670 #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
|
671 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
|
672 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
|
673 "echochar"); |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
674 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
|
675 #endif |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
676 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
|
677 "echochar"); |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
678 } |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
679 |
|
13036
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
680 #ifdef NCURSES_MOUSE_VERSION |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
681 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
|
682 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
|
683 { |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
684 int x, y; |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
685 if (!PyArg_Parse(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
|
686 return NULL; |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
687 |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
688 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
|
689 } |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
690 #endif |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
691 |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
692 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
|
693 PyCursesWindow_GetBkgd(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
|
694 { |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
695 if (!PyArg_NoArgs(args)) |
|
9771
eaf93d5bb46c
Patch by Charles Waldman to implement an optional nlines argument to
Guido van Rossum <guido@python.org>
parents:
9719
diff
changeset
|
696 return NULL; |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
697 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
|
698 } |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
699 |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
700 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
|
701 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
|
702 { |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
703 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
|
704 chtype rtn; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
705 |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
706 switch (ARG_COUNT(args)) { |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
707 case 0: |
|
12988
0eb531ce08d1
Release the global interpreter lock around the most important
Andrew M. Kuchling <amk@amk.ca>
parents:
12974
diff
changeset
|
708 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
|
709 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
|
710 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
|
711 break; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
712 case 2: |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
713 if (!PyArg_Parse(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
|
714 return NULL; |
|
12988
0eb531ce08d1
Release the global interpreter lock around the most important
Andrew M. Kuchling <amk@amk.ca>
parents:
12974
diff
changeset
|
715 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
|
716 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
|
717 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
|
718 break; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
719 default: |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
720 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
|
721 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
722 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
723 return PyInt_FromLong(rtn); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
724 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
725 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
726 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
|
727 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
|
728 { |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
729 int x, y; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
730 chtype rtn; |
| 2357 | 731 |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
732 switch (ARG_COUNT(args)) { |
| 2357 | 733 case 0: |
|
12988
0eb531ce08d1
Release the global interpreter lock around the most important
Andrew M. Kuchling <amk@amk.ca>
parents:
12974
diff
changeset
|
734 Py_BEGIN_ALLOW_THREADS |
| 2357 | 735 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
|
736 Py_END_ALLOW_THREADS |
| 2357 | 737 break; |
| 738 case 2: | |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
739 if (!PyArg_Parse(args,"(ii);y,x",&y,&x)) |
| 2357 | 740 return NULL; |
|
12988
0eb531ce08d1
Release the global interpreter lock around the most important
Andrew M. Kuchling <amk@amk.ca>
parents:
12974
diff
changeset
|
741 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
|
742 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
|
743 Py_END_ALLOW_THREADS |
| 2357 | 744 break; |
| 745 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
|
746 PyErr_SetString(PyExc_TypeError, "getkey requires 0 or 2 arguments"); |
| 2357 | 747 return NULL; |
| 748 } | |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
749 if (rtn<=255) |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
750 return Py_BuildValue("c", rtn); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
751 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
|
752 #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
|
753 return PyString_FromString(unctrl(rtn)); |
|
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
|
754 #else |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
755 return PyString_FromString((char *)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
|
756 #endif |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
757 } |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
758 |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
759 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
|
760 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
|
761 { |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
762 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
|
763 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
|
764 int rtn2; |
| 2357 | 765 |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
766 switch (ARG_COUNT(args)) { |
| 2357 | 767 case 0: |
|
12988
0eb531ce08d1
Release the global interpreter lock around the most important
Andrew M. Kuchling <amk@amk.ca>
parents:
12974
diff
changeset
|
768 Py_BEGIN_ALLOW_THREADS |
| 2357 | 769 rtn2 = wgetstr(self->win,rtn); |
|
12988
0eb531ce08d1
Release the global interpreter lock around the most important
Andrew M. Kuchling <amk@amk.ca>
parents:
12974
diff
changeset
|
770 Py_END_ALLOW_THREADS |
| 2357 | 771 break; |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
772 case 1: |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
773 if (!PyArg_Parse(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
|
774 return NULL; |
|
12988
0eb531ce08d1
Release the global interpreter lock around the most important
Andrew M. Kuchling <amk@amk.ca>
parents:
12974
diff
changeset
|
775 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
|
776 rtn2 = wgetnstr(self->win,rtn,n); |
|
12988
0eb531ce08d1
Release the global interpreter lock around the most important
Andrew M. Kuchling <amk@amk.ca>
parents:
12974
diff
changeset
|
777 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
|
778 break; |
| 2357 | 779 case 2: |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
780 if (!PyArg_Parse(args,"(ii);y,x",&y,&x)) |
| 2357 | 781 return NULL; |
|
12988
0eb531ce08d1
Release the global interpreter lock around the most important
Andrew M. Kuchling <amk@amk.ca>
parents:
12974
diff
changeset
|
782 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
|
783 rtn2 = mvwgetstr(self->win,y,x,rtn); |
|
12988
0eb531ce08d1
Release the global interpreter lock around the most important
Andrew M. Kuchling <amk@amk.ca>
parents:
12974
diff
changeset
|
784 Py_END_ALLOW_THREADS |
| 2357 | 785 break; |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
786 case 3: |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
787 if (!PyArg_Parse(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
|
788 return NULL; |
|
13040
12ac2c267b93
Fixes for compiling on Tru64.
Andrew M. Kuchling <amk@amk.ca>
parents:
13039
diff
changeset
|
789 #ifdef 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
|
790 /* Untested */ |
|
12988
0eb531ce08d1
Release the global interpreter lock around the most important
Andrew M. Kuchling <amk@amk.ca>
parents:
12974
diff
changeset
|
791 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
|
792 rtn2 = wmove(self->win,y,x)==ERR ? ERR : |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
793 wgetnstr(self->win, rtn, n); |
|
12988
0eb531ce08d1
Release the global interpreter lock around the most important
Andrew M. Kuchling <amk@amk.ca>
parents:
12974
diff
changeset
|
794 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
|
795 #else |
|
12988
0eb531ce08d1
Release the global interpreter lock around the most important
Andrew M. Kuchling <amk@amk.ca>
parents:
12974
diff
changeset
|
796 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
|
797 rtn2 = mvwgetnstr(self->win, y, x, rtn, n); |
|
12988
0eb531ce08d1
Release the global interpreter lock around the most important
Andrew M. Kuchling <amk@amk.ca>
parents:
12974
diff
changeset
|
798 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
|
799 #endif |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
800 break; |
| 2357 | 801 default: |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
802 PyErr_SetString(PyExc_TypeError, "getstr requires 0 to 2 arguments"); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
803 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
804 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
805 if (rtn2 == ERR) |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
806 rtn[0] = 0; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
807 return PyString_FromString(rtn); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
808 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
809 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
810 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
|
811 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
|
812 { |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
813 PyObject *temp; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
814 chtype ch; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
815 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
|
816 attr_t attr = A_NORMAL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
817 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
818 switch (ARG_COUNT(args)) { |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
819 case 2: |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
820 if (!PyArg_Parse(args, "(Oi);ch or int,n", &temp, &n)) |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
821 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
822 break; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
823 case 3: |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
824 if (!PyArg_Parse(args, "(Oil);ch or int,n,attr", &temp, &n, &attr)) |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
825 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
826 break; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
827 case 4: |
|
12738
3d26cb3808a7
Changes by AMK: Use HAVE_NCURSES_H to include correct header file
Andrew M. Kuchling <amk@amk.ca>
parents:
12737
diff
changeset
|
828 if (!PyArg_Parse(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
|
829 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
830 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
|
831 break; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
832 case 5: |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
833 if (!PyArg_Parse(args, "(iiOil); y,x,ch or int,n,attr", |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
834 &y, &x, &temp, &n, &attr)) |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
835 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
836 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
|
837 default: |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
838 PyErr_SetString(PyExc_TypeError, "hline requires 2 or 5 arguments"); |
| 2357 | 839 return NULL; |
| 840 } | |
| 841 | |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
842 if (code != ERR) { |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
843 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
|
844 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
|
845 "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
|
846 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
847 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
848 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
|
849 } else |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
850 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
|
851 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
852 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
853 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
|
854 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
|
855 { |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
856 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
|
857 PyObject *temp; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
858 chtype ch = 0; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
859 attr_t attr = A_NORMAL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
860 |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
861 switch (ARG_COUNT(args)) { |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
862 case 1: |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
863 if (!PyArg_Parse(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
|
864 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
865 break; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
866 case 2: |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
867 if (!PyArg_Parse(args, "(Ol);ch or int,attr", &temp, &attr)) |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
868 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
869 break; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
870 case 3: |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
871 if (!PyArg_Parse(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
|
872 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
873 use_xy = TRUE; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
874 break; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
875 case 4: |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
876 if (!PyArg_Parse(args,"(iiOl);y,x,ch or int, attr", &y, &x, &temp, &attr)) |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
877 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
878 use_xy = TRUE; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
879 break; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
880 default: |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
881 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
|
882 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
883 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
884 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
885 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
|
886 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
|
887 "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
|
888 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
889 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
890 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
891 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
|
892 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
|
893 else { |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
894 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
|
895 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
896 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
|
897 } |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
898 |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
899 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
|
900 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
|
901 { |
| 2357 | 902 int x, y, rtn; |
| 903 | |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
904 switch (ARG_COUNT(args)) { |
| 2357 | 905 case 0: |
| 906 rtn = winch(self->win); | |
| 907 break; | |
| 908 case 2: | |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
909 if (!PyArg_Parse(args,"(ii);y,x",&y,&x)) |
| 2357 | 910 return NULL; |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
911 rtn = mvwinch(self->win,y,x); |
| 2357 | 912 break; |
| 913 default: | |
| 914 PyErr_SetString(PyExc_TypeError, "inch requires 0 or 2 arguments"); | |
| 915 return NULL; | |
| 916 } | |
| 917 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
|
918 } |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
919 |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
920 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
|
921 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
|
922 { |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
923 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
|
924 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
|
925 int rtn2; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
926 |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
927 switch (ARG_COUNT(args)) { |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
928 case 0: |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
929 rtn2 = winstr(self->win,rtn); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
930 break; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
931 case 1: |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
932 if (!PyArg_Parse(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
|
933 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
934 rtn2 = winnstr(self->win,rtn,n); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
935 break; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
936 case 2: |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
937 if (!PyArg_Parse(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
|
938 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
939 rtn2 = mvwinstr(self->win,y,x,rtn); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
940 break; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
941 case 3: |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
942 if (!PyArg_Parse(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
|
943 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
944 rtn2 = mvwinnstr(self->win, y, x, rtn, n); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
945 break; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
946 default: |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
947 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
|
948 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
949 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
950 if (rtn2 == ERR) |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
951 rtn[0] = 0; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
952 return PyString_FromString(rtn); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
953 } |
|
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 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
|
956 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
|
957 { |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
958 int rtn; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
959 int x, y; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
960 char *str; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
961 attr_t attr = A_NORMAL , attr_old = A_NORMAL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
962 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
|
963 |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
964 switch (ARG_COUNT(args)) { |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
965 case 1: |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
966 if (!PyArg_Parse(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
|
967 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
968 break; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
969 case 2: |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
970 if (!PyArg_Parse(args,"(sl);str,attr", &str, &attr)) |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
971 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
972 use_attr = TRUE; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
973 break; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
974 case 3: |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
975 if (!PyArg_Parse(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
|
976 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
977 use_xy = TRUE; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
978 break; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
979 case 4: |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
980 if (!PyArg_Parse(args,"(iisl);y,x,str,attr", &y, &x, &str, &attr)) |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
981 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
982 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
|
983 break; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
984 default: |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
985 PyErr_SetString(PyExc_TypeError, "insstr requires 1 to 4 arguments"); |
| 2357 | 986 return NULL; |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
987 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
988 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
989 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
|
990 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
|
991 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
|
992 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
993 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
|
994 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
|
995 else |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
996 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
|
997 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
|
998 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
|
999 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
|
1000 } |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1001 |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1002 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
|
1003 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
|
1004 { |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1005 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
|
1006 char *str; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1007 attr_t attr = A_NORMAL , attr_old = A_NORMAL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1008 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
|
1009 |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
1010 switch (ARG_COUNT(args)) { |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1011 case 2: |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
1012 if (!PyArg_Parse(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
|
1013 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1014 break; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1015 case 3: |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
1016 if (!PyArg_Parse(args,"(sil);str,n,attr", &str, &n, &attr)) |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1017 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1018 use_attr = TRUE; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1019 break; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1020 case 4: |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
1021 if (!PyArg_Parse(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
|
1022 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1023 use_xy = TRUE; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1024 break; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1025 case 5: |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
1026 if (!PyArg_Parse(args,"(iisil);y,x,str,n,attr", &y, &x, &str, &n, &attr)) |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1027 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1028 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
|
1029 break; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1030 default: |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1031 PyErr_SetString(PyExc_TypeError, "insnstr requires 2 to 5 arguments"); |
| 2357 | 1032 return NULL; |
|
12737
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 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1035 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
|
1036 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
|
1037 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
|
1038 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1039 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
|
1040 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
|
1041 else |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1042 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
|
1043 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
|
1044 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
|
1045 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
|
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_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
|
1050 { |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1051 int line, erg; |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
1052 if (!PyArg_Parse(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
|
1053 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1054 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
|
1055 if (erg == ERR) { |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1056 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
|
1057 "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
|
1058 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1059 } else |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1060 if (erg == FALSE) { |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1061 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
|
1062 return Py_False; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1063 } else { |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1064 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
|
1065 return Py_True; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1066 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1067 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1068 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
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_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
|
1071 { |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1072 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
|
1073 int rtn; |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1074 |
|
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
|
1075 #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
|
1076 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
|
1077 #else |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1078 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
|
1079 #endif |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
1080 switch(ARG_COUNT(args)) { |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1081 case 6: |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
1082 if (!PyArg_Parse(args, |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1083 "(iiiiii);" \ |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1084 "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
|
1085 &pminrow, &pmincol, &sminrow, |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1086 &smincol, &smaxrow, &smaxcol)) |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1087 return NULL; |
|
12988
0eb531ce08d1
Release the global interpreter lock around the most important
Andrew M. Kuchling <amk@amk.ca>
parents:
12974
diff
changeset
|
1088 Py_BEGIN_ALLOW_THREADS |
|
0eb531ce08d1
Release the global interpreter lock around the most important
Andrew M. Kuchling <amk@amk.ca>
parents:
12974
diff
changeset
|
1089 rtn = pnoutrefresh(self->win, |
|
0eb531ce08d1
Release the global interpreter lock around the most important
Andrew M. Kuchling <amk@amk.ca>
parents:
12974
diff
changeset
|
1090 pminrow, pmincol, sminrow, |
|
13039
1c8c101f2be1
Fix two typos (, instead of ;)
Andrew M. Kuchling <amk@amk.ca>
parents:
13036
diff
changeset
|
1091 smincol, smaxrow, smaxcol); |
|
12988
0eb531ce08d1
Release the global interpreter lock around the most important
Andrew M. Kuchling <amk@amk.ca>
parents:
12974
diff
changeset
|
1092 Py_END_ALLOW_THREADS |
|
0eb531ce08d1
Release the global interpreter lock around the most important
Andrew M. Kuchling <amk@amk.ca>
parents:
12974
diff
changeset
|
1093 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
|
1094 default: |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1095 PyErr_SetString(PyCursesError, |
|
12988
0eb531ce08d1
Release the global interpreter lock around the most important
Andrew M. Kuchling <amk@amk.ca>
parents:
12974
diff
changeset
|
1096 "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
|
1097 "requires 6 arguments"); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1098 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1099 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1100 } else { |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
1101 if (!PyArg_NoArgs(args)) |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1102 return NULL; |
|
12988
0eb531ce08d1
Release the global interpreter lock around the most important
Andrew M. Kuchling <amk@amk.ca>
parents:
12974
diff
changeset
|
1103 |
|
0eb531ce08d1
Release the global interpreter lock around the most important
Andrew M. Kuchling <amk@amk.ca>
parents:
12974
diff
changeset
|
1104 Py_BEGIN_ALLOW_THREADS |
|
0eb531ce08d1
Release the global interpreter lock around the most important
Andrew M. Kuchling <amk@amk.ca>
parents:
12974
diff
changeset
|
1105 rtn = wnoutrefresh(self->win); |
|
0eb531ce08d1
Release the global interpreter lock around the most important
Andrew M. Kuchling <amk@amk.ca>
parents:
12974
diff
changeset
|
1106 Py_END_ALLOW_THREADS |
|
0eb531ce08d1
Release the global interpreter lock around the most important
Andrew M. Kuchling <amk@amk.ca>
parents:
12974
diff
changeset
|
1107 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
|
1108 } |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1109 } |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1110 |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1111 static PyObject * |
|
15638
7639a9552479
Another patch from Thomas Gellekum: add .overlay() and .overwrite()
Andrew M. Kuchling <amk@amk.ca>
parents:
15574
diff
changeset
|
1112 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
|
1113 { |
|
7639a9552479
Another patch from Thomas Gellekum: add .overlay() and .overwrite()
Andrew M. Kuchling <amk@amk.ca>
parents:
15574
diff
changeset
|
1114 PyCursesWindowObject *temp; |
|
7639a9552479
Another patch from Thomas Gellekum: add .overlay() and .overwrite()
Andrew M. Kuchling <amk@amk.ca>
parents:
15574
diff
changeset
|
1115 int use_copywin = FALSE; |
|
7639a9552479
Another patch from Thomas Gellekum: add .overlay() and .overwrite()
Andrew M. Kuchling <amk@amk.ca>
parents:
15574
diff
changeset
|
1116 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
|
1117 int rtn; |
|
7639a9552479
Another patch from Thomas Gellekum: add .overlay() and .overwrite()
Andrew M. Kuchling <amk@amk.ca>
parents:
15574
diff
changeset
|
1118 |
|
7639a9552479
Another patch from Thomas Gellekum: add .overlay() and .overwrite()
Andrew M. Kuchling <amk@amk.ca>
parents:
15574
diff
changeset
|
1119 switch (ARG_COUNT(args)) { |
|
7639a9552479
Another patch from Thomas Gellekum: add .overlay() and .overwrite()
Andrew M. Kuchling <amk@amk.ca>
parents:
15574
diff
changeset
|
1120 case 1: |
|
7639a9552479
Another patch from Thomas Gellekum: add .overlay() and .overwrite()
Andrew M. Kuchling <amk@amk.ca>
parents:
15574
diff
changeset
|
1121 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
|
1122 &PyCursesWindow_Type, &temp)) |
|
7639a9552479
Another patch from Thomas Gellekum: add .overlay() and .overwrite()
Andrew M. Kuchling <amk@amk.ca>
parents:
15574
diff
changeset
|
1123 return NULL; |
|
7639a9552479
Another patch from Thomas Gellekum: add .overlay() and .overwrite()
Andrew M. Kuchling <amk@amk.ca>
parents:
15574
diff
changeset
|
1124 break; |
|
7639a9552479
Another patch from Thomas Gellekum: add .overlay() and .overwrite()
Andrew M. Kuchling <amk@amk.ca>
parents:
15574
diff
changeset
|
1125 case 7: |
|
7639a9552479
Another patch from Thomas Gellekum: add .overlay() and .overwrite()
Andrew M. Kuchling <amk@amk.ca>
parents:
15574
diff
changeset
|
1126 if (!PyArg_ParseTuple(args, "(O!iiiiii);window object, int, int, int, int, int, int", |
|
7639a9552479
Another patch from Thomas Gellekum: add .overlay() and .overwrite()
Andrew M. Kuchling <amk@amk.ca>
parents:
15574
diff
changeset
|
1127 &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
|
1128 &dminrow, &dmincol, &dmaxrow, &dmaxcol)) |
|
7639a9552479
Another patch from Thomas Gellekum: add .overlay() and .overwrite()
Andrew M. Kuchling <amk@amk.ca>
parents:
15574
diff
changeset
|
1129 return NULL; |
|
7639a9552479
Another patch from Thomas Gellekum: add .overlay() and .overwrite()
Andrew M. Kuchling <amk@amk.ca>
parents:
15574
diff
changeset
|
1130 use_copywin = TRUE; |
|
7639a9552479
Another patch from Thomas Gellekum: add .overlay() and .overwrite()
Andrew M. Kuchling <amk@amk.ca>
parents:
15574
diff
changeset
|
1131 break; |
|
7639a9552479
Another patch from Thomas Gellekum: add .overlay() and .overwrite()
Andrew M. Kuchling <amk@amk.ca>
parents:
15574
diff
changeset
|
1132 default: |
|
7639a9552479
Another patch from Thomas Gellekum: add .overlay() and .overwrite()
Andrew M. Kuchling <amk@amk.ca>
parents:
15574
diff
changeset
|
1133 PyErr_SetString(PyExc_TypeError, |
|
7639a9552479
Another patch from Thomas Gellekum: add .overlay() and .overwrite()
Andrew M. Kuchling <amk@amk.ca>
parents:
15574
diff
changeset
|
1134 "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
|
1135 return NULL; |
|
7639a9552479
Another patch from Thomas Gellekum: add .overlay() and .overwrite()
Andrew M. Kuchling <amk@amk.ca>
parents:
15574
diff
changeset
|
1136 } |
|
7639a9552479
Another patch from Thomas Gellekum: add .overlay() and .overwrite()
Andrew M. Kuchling <amk@amk.ca>
parents:
15574
diff
changeset
|
1137 |
|
7639a9552479
Another patch from Thomas Gellekum: add .overlay() and .overwrite()
Andrew M. Kuchling <amk@amk.ca>
parents:
15574
diff
changeset
|
1138 if (use_copywin == TRUE) { |
|
7639a9552479
Another patch from Thomas Gellekum: add .overlay() and .overwrite()
Andrew M. Kuchling <amk@amk.ca>
parents:
15574
diff
changeset
|
1139 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
|
1140 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
|
1141 return PyCursesCheckERR(rtn, "copywin"); |
|
7639a9552479
Another patch from Thomas Gellekum: add .overlay() and .overwrite()
Andrew M. Kuchling <amk@amk.ca>
parents:
15574
diff
changeset
|
1142 } |
|
7639a9552479
Another patch from Thomas Gellekum: add .overlay() and .overwrite()
Andrew M. Kuchling <amk@amk.ca>
parents:
15574
diff
changeset
|
1143 else { |
|
7639a9552479
Another patch from Thomas Gellekum: add .overlay() and .overwrite()
Andrew M. Kuchling <amk@amk.ca>
parents:
15574
diff
changeset
|
1144 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
|
1145 return PyCursesCheckERR(rtn, "overlay"); |
|
7639a9552479
Another patch from Thomas Gellekum: add .overlay() and .overwrite()
Andrew M. Kuchling <amk@amk.ca>
parents:
15574
diff
changeset
|
1146 } |
|
7639a9552479
Another patch from Thomas Gellekum: add .overlay() and .overwrite()
Andrew M. Kuchling <amk@amk.ca>
parents:
15574
diff
changeset
|
1147 } |
|
7639a9552479
Another patch from Thomas Gellekum: add .overlay() and .overwrite()
Andrew M. Kuchling <amk@amk.ca>
parents:
15574
diff
changeset
|
1148 |
|
7639a9552479
Another patch from Thomas Gellekum: add .overlay() and .overwrite()
Andrew M. Kuchling <amk@amk.ca>
parents:
15574
diff
changeset
|
1149 static PyObject * |
|
7639a9552479
Another patch from Thomas Gellekum: add .overlay() and .overwrite()
Andrew M. Kuchling <amk@amk.ca>
parents:
15574
diff
changeset
|
1150 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
|
1151 { |
|
7639a9552479
Another patch from Thomas Gellekum: add .overlay() and .overwrite()
Andrew M. Kuchling <amk@amk.ca>
parents:
15574
diff
changeset
|
1152 PyCursesWindowObject *temp; |
|
7639a9552479
Another patch from Thomas Gellekum: add .overlay() and .overwrite()
Andrew M. Kuchling <amk@amk.ca>
parents:
15574
diff
changeset
|
1153 int use_copywin = FALSE; |
|
7639a9552479
Another patch from Thomas Gellekum: add .overlay() and .overwrite()
Andrew M. Kuchling <amk@amk.ca>
parents:
15574
diff
changeset
|
1154 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
|
1155 int rtn; |
|
7639a9552479
Another patch from Thomas Gellekum: add .overlay() and .overwrite()
Andrew M. Kuchling <amk@amk.ca>
parents:
15574
diff
changeset
|
1156 |
|
7639a9552479
Another patch from Thomas Gellekum: add .overlay() and .overwrite()
Andrew M. Kuchling <amk@amk.ca>
parents:
15574
diff
changeset
|
1157 switch (ARG_COUNT(args)) { |
|
7639a9552479
Another patch from Thomas Gellekum: add .overlay() and .overwrite()
Andrew M. Kuchling <amk@amk.ca>
parents:
15574
diff
changeset
|
1158 case 1: |
|
7639a9552479
Another patch from Thomas Gellekum: add .overlay() and .overwrite()
Andrew M. Kuchling <amk@amk.ca>
parents:
15574
diff
changeset
|
1159 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
|
1160 &PyCursesWindow_Type, &temp)) |
|
7639a9552479
Another patch from Thomas Gellekum: add .overlay() and .overwrite()
Andrew M. Kuchling <amk@amk.ca>
parents:
15574
diff
changeset
|
1161 return NULL; |
|
7639a9552479
Another patch from Thomas Gellekum: add .overlay() and .overwrite()
Andrew M. Kuchling <amk@amk.ca>
parents:
15574
diff
changeset
|
1162 break; |
|
7639a9552479
Another patch from Thomas Gellekum: add .overlay() and .overwrite()
Andrew M. Kuchling <amk@amk.ca>
parents:
15574
diff
changeset
|
1163 case 7: |
|
7639a9552479
Another patch from Thomas Gellekum: add .overlay() and .overwrite()
Andrew M. Kuchling <amk@amk.ca>
parents:
15574
diff
changeset
|
1164 if (!PyArg_ParseTuple(args, "(O!iiiiii);window object, int, int, int, int, int, int", |
|
7639a9552479
Another patch from Thomas Gellekum: add .overlay() and .overwrite()
Andrew M. Kuchling <amk@amk.ca>
parents:
15574
diff
changeset
|
1165 &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
|
1166 &dminrow, &dmincol, &dmaxrow, &dmaxcol)) |
|
7639a9552479
Another patch from Thomas Gellekum: add .overlay() and .overwrite()
Andrew M. Kuchling <amk@amk.ca>
parents:
15574
diff
changeset
|
1167 return NULL; |
|
7639a9552479
Another patch from Thomas Gellekum: add .overlay() and .overwrite()
Andrew M. Kuchling <amk@amk.ca>
parents:
15574
diff
changeset
|
1168 use_copywin = TRUE; |
|
7639a9552479
Another patch from Thomas Gellekum: add .overlay() and .overwrite()
Andrew M. Kuchling <amk@amk.ca>
parents:
15574
diff
changeset
|
1169 break; |
|
7639a9552479
Another patch from Thomas Gellekum: add .overlay() and .overwrite()
Andrew M. Kuchling <amk@amk.ca>
parents:
15574
diff
changeset
|
1170 default: |
|
7639a9552479
Another patch from Thomas Gellekum: add .overlay() and .overwrite()
Andrew M. Kuchling <amk@amk.ca>
parents:
15574
diff
changeset
|
1171 PyErr_SetString(PyExc_TypeError, |
|
7639a9552479
Another patch from Thomas Gellekum: add .overlay() and .overwrite()
Andrew M. Kuchling <amk@amk.ca>
parents:
15574
diff
changeset
|
1172 "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
|
1173 return NULL; |
|
7639a9552479
Another patch from Thomas Gellekum: add .overlay() and .overwrite()
Andrew M. Kuchling <amk@amk.ca>
parents:
15574
diff
changeset
|
1174 } |
|
7639a9552479
Another patch from Thomas Gellekum: add .overlay() and .overwrite()
Andrew M. Kuchling <amk@amk.ca>
parents:
15574
diff
changeset
|
1175 |
|
7639a9552479
Another patch from Thomas Gellekum: add .overlay() and .overwrite()
Andrew M. Kuchling <amk@amk.ca>
parents:
15574
diff
changeset
|
1176 if (use_copywin == TRUE) { |
|
7639a9552479
Another patch from Thomas Gellekum: add .overlay() and .overwrite()
Andrew M. Kuchling <amk@amk.ca>
parents:
15574
diff
changeset
|
1177 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
|
1178 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
|
1179 return PyCursesCheckERR(rtn, "copywin"); |
|
7639a9552479
Another patch from Thomas Gellekum: add .overlay() and .overwrite()
Andrew M. Kuchling <amk@amk.ca>
parents:
15574
diff
changeset
|
1180 } |
|
7639a9552479
Another patch from Thomas Gellekum: add .overlay() and .overwrite()
Andrew M. Kuchling <amk@amk.ca>
parents:
15574
diff
changeset
|
1181 else { |
|
7639a9552479
Another patch from Thomas Gellekum: add .overlay() and .overwrite()
Andrew M. Kuchling <amk@amk.ca>
parents:
15574
diff
changeset
|
1182 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
|
1183 return PyCursesCheckERR(rtn, "overwrite"); |
|
7639a9552479
Another patch from Thomas Gellekum: add .overlay() and .overwrite()
Andrew M. Kuchling <amk@amk.ca>
parents:
15574
diff
changeset
|
1184 } |
|
7639a9552479
Another patch from Thomas Gellekum: add .overlay() and .overwrite()
Andrew M. Kuchling <amk@amk.ca>
parents:
15574
diff
changeset
|
1185 } |
|
7639a9552479
Another patch from Thomas Gellekum: add .overlay() and .overwrite()
Andrew M. Kuchling <amk@amk.ca>
parents:
15574
diff
changeset
|
1186 |
|
7639a9552479
Another patch from Thomas Gellekum: add .overlay() and .overwrite()
Andrew M. Kuchling <amk@amk.ca>
parents:
15574
diff
changeset
|
1187 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
|
1188 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
|
1189 { |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1190 PyObject *temp; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1191 |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
1192 if (!PyArg_Parse(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
|
1193 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1194 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
|
1195 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
|
1196 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1197 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1198 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
|
1199 "putwin"); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1200 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1201 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1202 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
|
1203 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
|
1204 { |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1205 int beg, num; |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
1206 if (!PyArg_Parse(args,"(ii);beg,num", &beg, &num)) |
| 2357 | 1207 return NULL; |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1208 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
|
1209 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1210 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1211 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
|
1212 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
|
1213 { |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1214 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
|
1215 int rtn; |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1216 |
|
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
|
1217 #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
|
1218 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
|
1219 #else |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1220 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
|
1221 #endif |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
1222 switch(ARG_COUNT(args)) { |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1223 case 6: |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
1224 if (!PyArg_Parse(args, |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1225 "(iiiiii);" \ |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1226 "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
|
1227 &pminrow, &pmincol, &sminrow, |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1228 &smincol, &smaxrow, &smaxcol)) |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1229 return NULL; |
|
12988
0eb531ce08d1
Release the global interpreter lock around the most important
Andrew M. Kuchling <amk@amk.ca>
parents:
12974
diff
changeset
|
1230 |
|
0eb531ce08d1
Release the global interpreter lock around the most important
Andrew M. Kuchling <amk@amk.ca>
parents:
12974
diff
changeset
|
1231 Py_BEGIN_ALLOW_THREADS |
|
0eb531ce08d1
Release the global interpreter lock around the most important
Andrew M. Kuchling <amk@amk.ca>
parents:
12974
diff
changeset
|
1232 rtn = prefresh(self->win, |
|
0eb531ce08d1
Release the global interpreter lock around the most important
Andrew M. Kuchling <amk@amk.ca>
parents:
12974
diff
changeset
|
1233 pminrow, pmincol, sminrow, |
|
13039
1c8c101f2be1
Fix two typos (, instead of ;)
Andrew M. Kuchling <amk@amk.ca>
parents:
13036
diff
changeset
|
1234 smincol, smaxrow, smaxcol); |
|
12988
0eb531ce08d1
Release the global interpreter lock around the most important
Andrew M. Kuchling <amk@amk.ca>
parents:
12974
diff
changeset
|
1235 Py_END_ALLOW_THREADS |
|
0eb531ce08d1
Release the global interpreter lock around the most important
Andrew M. Kuchling <amk@amk.ca>
parents:
12974
diff
changeset
|
1236 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
|
1237 default: |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1238 PyErr_SetString(PyCursesError, |
|
12988
0eb531ce08d1
Release the global interpreter lock around the most important
Andrew M. Kuchling <amk@amk.ca>
parents:
12974
diff
changeset
|
1239 "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
|
1240 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1241 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1242 } else { |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
1243 if (!PyArg_NoArgs(args)) |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1244 return NULL; |
|
12988
0eb531ce08d1
Release the global interpreter lock around the most important
Andrew M. Kuchling <amk@amk.ca>
parents:
12974
diff
changeset
|
1245 Py_BEGIN_ALLOW_THREADS |
|
0eb531ce08d1
Release the global interpreter lock around the most important
Andrew M. Kuchling <amk@amk.ca>
parents:
12974
diff
changeset
|
1246 rtn = wrefresh(self->win); |
|
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 |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
1248 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
|
1249 } |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1250 } |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1251 |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1252 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
|
1253 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
|
1254 { |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1255 int x, y; |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
1256 if (!PyArg_Parse(args,"(ii);top, bottom",&y,&x)) |
| 2357 | 1257 return NULL; |
| 1258 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
|
1259 } |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1260 |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1261 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
|
1262 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
|
1263 { |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1264 WINDOW *win; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1265 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
|
1266 |
|
12738
3d26cb3808a7
Changes by AMK: Use HAVE_NCURSES_H to include correct header file
Andrew M. Kuchling <amk@amk.ca>
parents:
12737
diff
changeset
|
1267 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
|
1268 ncols = 0; |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
1269 switch (ARG_COUNT(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
|
1270 case 2: |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
1271 if (!PyArg_Parse(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
|
1272 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
|
1273 break; |
|
3d26cb3808a7
Changes by AMK: Use HAVE_NCURSES_H to include correct header file
Andrew M. Kuchling <amk@amk.ca>
parents:
12737
diff
changeset
|
1274 case 4: |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
1275 if (!PyArg_Parse(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
|
1276 &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
|
1277 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
|
1278 break; |
|
3d26cb3808a7
Changes by AMK: Use HAVE_NCURSES_H to include correct header file
Andrew M. Kuchling <amk@amk.ca>
parents:
12737
diff
changeset
|
1279 default: |
|
3d26cb3808a7
Changes by AMK: Use HAVE_NCURSES_H to include correct header file
Andrew M. Kuchling <amk@amk.ca>
parents:
12737
diff
changeset
|
1280 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
|
1281 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
|
1282 } |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1283 |
|
13721
05d59f4476ad
Comment out a debugging print (spotted by Michael Deegan)
Andrew M. Kuchling <amk@amk.ca>
parents:
13715
diff
changeset
|
1284 /* printf("Subwin: %i %i %i %i \n", nlines, ncols, begin_y, begin_x); */ |
|
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
|
1285 #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
|
1286 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
|
1287 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
|
1288 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
|
1289 #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
|
1290 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
|
1291 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1292 if (win == NULL) { |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1293 PyErr_SetString(PyCursesError, catchall_NULL); |
| 2357 | 1294 return NULL; |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1295 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1296 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1297 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
|
1298 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1299 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1300 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
|
1301 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
|
1302 { |
|
16350
66d4bf56e32d
Rename 'lines' variable to 'nlines' to avoid conflict with a macro defined
Andrew M. Kuchling <amk@amk.ca>
parents:
16323
diff
changeset
|
1303 int nlines; |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
1304 switch(ARG_COUNT(args)) { |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1305 case 0: |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1306 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
|
1307 break; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1308 case 1: |
|
16350
66d4bf56e32d
Rename 'lines' variable to 'nlines' to avoid conflict with a macro defined
Andrew M. Kuchling <amk@amk.ca>
parents:
16323
diff
changeset
|
1309 if (!PyArg_Parse(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
|
1310 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
|
1311 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
|
1312 default: |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1313 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
|
1314 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1315 } |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1316 } |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1317 |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1318 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
|
1319 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
|
1320 { |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1321 int st, cnt, val; |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
1322 switch (ARG_COUNT(args)) { |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1323 case 2: |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
1324 if (!PyArg_Parse(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
|
1325 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1326 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
|
1327 break; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1328 case 3: |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
1329 if (!PyArg_Parse(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
|
1330 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1331 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
|
1332 default: |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1333 PyErr_SetString(PyExc_TypeError, "touchline requires 2 or 3 arguments"); |
| 2357 | 1334 return NULL; |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1335 } |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1336 } |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1337 |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1338 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
|
1339 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
|
1340 { |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1341 PyObject *temp; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1342 chtype ch; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1343 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
|
1344 attr_t attr = A_NORMAL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1345 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1346 switch (ARG_COUNT(args)) { |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1347 case 2: |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1348 if (!PyArg_Parse(args, "(Oi);ch or int,n", &temp, &n)) |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1349 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1350 break; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1351 case 3: |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1352 if (!PyArg_Parse(args, "(Oil);ch or int,n,attr", &temp, &n, &attr)) |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1353 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1354 break; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1355 case 4: |
|
12738
3d26cb3808a7
Changes by AMK: Use HAVE_NCURSES_H to include correct header file
Andrew M. Kuchling <amk@amk.ca>
parents:
12737
diff
changeset
|
1356 if (!PyArg_Parse(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
|
1357 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1358 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
|
1359 break; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1360 case 5: |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1361 if (!PyArg_Parse(args, "(iiOil); y,x,ch or int,n,attr", |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1362 &y, &x, &temp, &n, &attr)) |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1363 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1364 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
|
1365 default: |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1366 PyErr_SetString(PyExc_TypeError, "vline requires 2 or 5 arguments"); |
| 2357 | 1367 return NULL; |
|
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 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1370 if (code != ERR) { |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1371 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
|
1372 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
|
1373 "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
|
1374 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1375 } |
|
12738
3d26cb3808a7
Changes by AMK: Use HAVE_NCURSES_H to include correct header file
Andrew M. Kuchling <amk@amk.ca>
parents:
12737
diff
changeset
|
1376 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
|
1377 } else |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1378 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
|
1379 } |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1380 |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1381 static PyMethodDef PyCursesWindow_Methods[] = { |
|
2569
7a3733732901
Added some (method) casts.
Sjoerd Mullender <sjoerd@acm.org>
parents:
2423
diff
changeset
|
1382 {"addch", (PyCFunction)PyCursesWindow_AddCh}, |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1383 {"addnstr", (PyCFunction)PyCursesWindow_AddNStr}, |
|
2569
7a3733732901
Added some (method) casts.
Sjoerd Mullender <sjoerd@acm.org>
parents:
2423
diff
changeset
|
1384 {"addstr", (PyCFunction)PyCursesWindow_AddStr}, |
|
12738
3d26cb3808a7
Changes by AMK: Use HAVE_NCURSES_H to include correct header file
Andrew M. Kuchling <amk@amk.ca>
parents:
12737
diff
changeset
|
1385 {"attroff", (PyCFunction)PyCursesWindow_wattroff}, |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1386 {"attron", (PyCFunction)PyCursesWindow_wattron}, |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1387 {"attrset", (PyCFunction)PyCursesWindow_wattrset}, |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1388 {"bkgd", (PyCFunction)PyCursesWindow_Bkgd}, |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1389 {"bkgdset", (PyCFunction)PyCursesWindow_BkgdSet}, |
|
2569
7a3733732901
Added some (method) casts.
Sjoerd Mullender <sjoerd@acm.org>
parents:
2423
diff
changeset
|
1390 {"border", (PyCFunction)PyCursesWindow_Border, METH_VARARGS}, |
|
7a3733732901
Added some (method) casts.
Sjoerd Mullender <sjoerd@acm.org>
parents:
2423
diff
changeset
|
1391 {"box", (PyCFunction)PyCursesWindow_Box}, |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1392 {"clear", (PyCFunction)PyCursesWindow_wclear}, |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1393 {"clearok", (PyCFunction)PyCursesWindow_clearok}, |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1394 {"clrtobot", (PyCFunction)PyCursesWindow_wclrtobot}, |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1395 {"clrtoeol", (PyCFunction)PyCursesWindow_wclrtoeol}, |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1396 {"cursyncup", (PyCFunction)PyCursesWindow_wcursyncup}, |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1397 {"delch", (PyCFunction)PyCursesWindow_DelCh}, |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1398 {"deleteln", (PyCFunction)PyCursesWindow_wdeleteln}, |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1399 {"derwin", (PyCFunction)PyCursesWindow_DerWin}, |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1400 {"echochar", (PyCFunction)PyCursesWindow_EchoChar}, |
|
13036
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
1401 #ifdef NCURSES_MOUSE_VERSION |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
1402 {"enclose", (PyCFunction)PyCursesWindow_Enclose}, |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
1403 #endif |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1404 {"erase", (PyCFunction)PyCursesWindow_werase}, |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1405 {"getbegyx", (PyCFunction)PyCursesWindow_getbegyx}, |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1406 {"getbkgd", (PyCFunction)PyCursesWindow_GetBkgd}, |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1407 {"getch", (PyCFunction)PyCursesWindow_GetCh}, |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1408 {"getkey", (PyCFunction)PyCursesWindow_GetKey}, |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1409 {"getmaxyx", (PyCFunction)PyCursesWindow_getmaxyx}, |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1410 {"getparyx", (PyCFunction)PyCursesWindow_getparyx}, |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1411 {"getstr", (PyCFunction)PyCursesWindow_GetStr}, |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1412 {"getyx", (PyCFunction)PyCursesWindow_getyx}, |
|
2569
7a3733732901
Added some (method) casts.
Sjoerd Mullender <sjoerd@acm.org>
parents:
2423
diff
changeset
|
1413 {"hline", (PyCFunction)PyCursesWindow_Hline}, |
|
12738
3d26cb3808a7
Changes by AMK: Use HAVE_NCURSES_H to include correct header file
Andrew M. Kuchling <amk@amk.ca>
parents:
12737
diff
changeset
|
1414 {"idcok", (PyCFunction)PyCursesWindow_idcok}, |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1415 {"idlok", (PyCFunction)PyCursesWindow_idlok}, |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1416 {"immedok", (PyCFunction)PyCursesWindow_immedok}, |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1417 {"inch", (PyCFunction)PyCursesWindow_InCh}, |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1418 {"insch", (PyCFunction)PyCursesWindow_InsCh}, |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1419 {"insdelln", (PyCFunction)PyCursesWindow_winsdelln}, |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1420 {"insertln", (PyCFunction)PyCursesWindow_winsertln}, |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1421 {"insnstr", (PyCFunction)PyCursesWindow_InsNStr}, |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1422 {"insstr", (PyCFunction)PyCursesWindow_InsStr}, |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1423 {"instr", (PyCFunction)PyCursesWindow_InStr}, |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1424 {"is_linetouched", (PyCFunction)PyCursesWindow_Is_LineTouched}, |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1425 {"is_wintouched", (PyCFunction)PyCursesWindow_is_wintouched}, |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1426 {"keypad", (PyCFunction)PyCursesWindow_keypad}, |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1427 {"leaveok", (PyCFunction)PyCursesWindow_leaveok}, |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1428 {"move", (PyCFunction)PyCursesWindow_wmove}, |
|
12738
3d26cb3808a7
Changes by AMK: Use HAVE_NCURSES_H to include correct header file
Andrew M. Kuchling <amk@amk.ca>
parents:
12737
diff
changeset
|
1429 {"mvderwin", (PyCFunction)PyCursesWindow_mvderwin}, |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1430 {"mvwin", (PyCFunction)PyCursesWindow_mvwin}, |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1431 {"nodelay", (PyCFunction)PyCursesWindow_nodelay}, |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1432 {"notimeout", (PyCFunction)PyCursesWindow_notimeout}, |
|
12738
3d26cb3808a7
Changes by AMK: Use HAVE_NCURSES_H to include correct header file
Andrew M. Kuchling <amk@amk.ca>
parents:
12737
diff
changeset
|
1433 {"noutrefresh", (PyCFunction)PyCursesWindow_NoOutRefresh}, |
|
14094
606714fae1b5
Add alias for old function name -- removing it broke Alexei Gilchrist's cfm
Andrew M. Kuchling <amk@amk.ca>
parents:
13728
diff
changeset
|
1434 /* Backward compatibility alias -- remove in Python 2.1 */ |
|
15638
7639a9552479
Another patch from Thomas Gellekum: add .overlay() and .overwrite()
Andrew M. Kuchling <amk@amk.ca>
parents:
15574
diff
changeset
|
1435 {"nooutrefresh", (PyCFunction)PyCursesWindow_NoOutRefresh}, |
|
7639a9552479
Another patch from Thomas Gellekum: add .overlay() and .overwrite()
Andrew M. Kuchling <amk@amk.ca>
parents:
15574
diff
changeset
|
1436 {"overlay", (PyCFunction)PyCursesWindow_Overlay, METH_VARARGS}, |
|
7639a9552479
Another patch from Thomas Gellekum: add .overlay() and .overwrite()
Andrew M. Kuchling <amk@amk.ca>
parents:
15574
diff
changeset
|
1437 {"overwrite", (PyCFunction)PyCursesWindow_Overwrite, METH_VARARGS}, |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1438 {"putwin", (PyCFunction)PyCursesWindow_PutWin}, |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1439 {"redrawln", (PyCFunction)PyCursesWindow_RedrawLine}, |
|
12738
3d26cb3808a7
Changes by AMK: Use HAVE_NCURSES_H to include correct header file
Andrew M. Kuchling <amk@amk.ca>
parents:
12737
diff
changeset
|
1440 {"redrawwin", (PyCFunction)PyCursesWindow_redrawwin}, |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1441 {"refresh", (PyCFunction)PyCursesWindow_Refresh}, |
|
13040
12ac2c267b93
Fixes for compiling on Tru64.
Andrew M. Kuchling <amk@amk.ca>
parents:
13039
diff
changeset
|
1442 #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
|
1443 {"resize", (PyCFunction)PyCursesWindow_wresize}, |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1444 #endif |
|
2569
7a3733732901
Added some (method) casts.
Sjoerd Mullender <sjoerd@acm.org>
parents:
2423
diff
changeset
|
1445 {"scroll", (PyCFunction)PyCursesWindow_Scroll}, |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1446 {"scrollok", (PyCFunction)PyCursesWindow_scrollok}, |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1447 {"setscrreg", (PyCFunction)PyCursesWindow_SetScrollRegion}, |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1448 {"standend", (PyCFunction)PyCursesWindow_wstandend}, |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1449 {"standout", (PyCFunction)PyCursesWindow_wstandout}, |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1450 {"subpad", (PyCFunction)PyCursesWindow_SubWin}, |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1451 {"subwin", (PyCFunction)PyCursesWindow_SubWin}, |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1452 {"syncdown", (PyCFunction)PyCursesWindow_wsyncdown}, |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1453 {"syncok", (PyCFunction)PyCursesWindow_syncok}, |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1454 {"syncup", (PyCFunction)PyCursesWindow_wsyncup}, |
|
12974
e7992d0d6808
Added .timeout() method and .typeahead() function
Andrew M. Kuchling <amk@amk.ca>
parents:
12913
diff
changeset
|
1455 {"timeout", (PyCFunction)PyCursesWindow_wtimeout}, |
|
2569
7a3733732901
Added some (method) casts.
Sjoerd Mullender <sjoerd@acm.org>
parents:
2423
diff
changeset
|
1456 {"touchline", (PyCFunction)PyCursesWindow_TouchLine}, |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1457 {"touchwin", (PyCFunction)PyCursesWindow_touchwin}, |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1458 {"untouchwin", (PyCFunction)PyCursesWindow_untouchwin}, |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1459 {"vline", (PyCFunction)PyCursesWindow_Vline}, |
|
2423
73eeff4d43f8
more fixes by Steve Clift
Guido van Rossum <guido@python.org>
parents:
2358
diff
changeset
|
1460 {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
|
1461 }; |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1462 |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1463 static PyObject * |
|
13651
8a063423e0b7
Bunch of minor ANSIfications: 'void initfunc()' -> 'void initfunc(void)',
Thomas Wouters <thomas@python.org>
parents:
13465
diff
changeset
|
1464 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
|
1465 { |
|
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
|
1466 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
|
1467 } |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1468 |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1469 /* -------------------------------------------------------*/ |
| 2357 | 1470 |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1471 PyTypeObject PyCursesWindow_Type = { |
|
16007
32352e120c37
Support building this as a DLL under Cygwin.
Guido van Rossum <guido@python.org>
parents:
15661
diff
changeset
|
1472 PyObject_HEAD_INIT(NULL) |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1473 0, /*ob_size*/ |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1474 "curses window", /*tp_name*/ |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1475 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
|
1476 0, /*tp_itemsize*/ |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1477 /* methods */ |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1478 (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
|
1479 0, /*tp_print*/ |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1480 (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
|
1481 (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
|
1482 0, /*tp_compare*/ |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1483 0, /*tp_repr*/ |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1484 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
|
1485 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
|
1486 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
|
1487 0, /*tp_hash*/ |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1488 }; |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1489 |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1490 /********************************************************************* |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1491 Global Functions |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1492 **********************************************************************/ |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1493 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1494 NoArgNoReturnFunction(beep) |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1495 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
|
1496 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
|
1497 NoArgNoReturnFunction(doupdate) |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1498 NoArgNoReturnFunction(endwin) |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1499 NoArgNoReturnFunction(flash) |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1500 NoArgNoReturnFunction(nocbreak) |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1501 NoArgNoReturnFunction(noecho) |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1502 NoArgNoReturnFunction(nonl) |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1503 NoArgNoReturnFunction(noraw) |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1504 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
|
1505 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
|
1506 NoArgNoReturnFunction(resetty) |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1507 NoArgNoReturnFunction(savetty) |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1508 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1509 NoArgOrFlagNoReturnFunction(cbreak) |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1510 NoArgOrFlagNoReturnFunction(echo) |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1511 NoArgOrFlagNoReturnFunction(nl) |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1512 NoArgOrFlagNoReturnFunction(raw) |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1513 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1514 NoArgReturnIntFunction(baudrate) |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1515 NoArgReturnIntFunction(termattrs) |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1516 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1517 NoArgReturnStringFunction(termname) |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1518 NoArgReturnStringFunction(longname) |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1519 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1520 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
|
1521 NoArgTrueFalseFunction(has_colors) |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1522 NoArgTrueFalseFunction(has_ic) |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1523 NoArgTrueFalseFunction(has_il) |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1524 NoArgTrueFalseFunction(isendwin) |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1525 NoArgNoReturnVoidFunction(filter) |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1526 NoArgNoReturnVoidFunction(flushinp) |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1527 NoArgNoReturnVoidFunction(noqiflush) |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1528 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1529 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
|
1530 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
|
1531 { |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1532 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
|
1533 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1534 PyCursesInitialised |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1535 PyCursesInitialisedColor |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1536 |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
1537 if (ARG_COUNT(args) != 1) { |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1538 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
|
1539 "color_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
|
1540 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1541 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1542 |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
1543 if (!PyArg_Parse(args, "h;color", &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
|
1544 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1545 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
|
1546 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
|
1547 else { |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1548 PyErr_SetString(PyCursesError, |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1549 "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
|
1550 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1551 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1552 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1553 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1554 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
|
1555 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
|
1556 { |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1557 int n; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1558 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1559 PyCursesInitialised |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1560 PyCursesInitialisedColor |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1561 |
|
13706
2e603bd0c1a9
Bug report and partial patch from Michael Deegan <michael@ucc.gu.uwa.edu.au>:
Andrew M. Kuchling <amk@amk.ca>
parents:
13651
diff
changeset
|
1562 if (ARG_COUNT(args) != 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
|
1563 PyErr_SetString(PyExc_TypeError, "color_pair requires 1 argument"); |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1564 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1565 } |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
1566 if (!PyArg_Parse(args, "i;number", &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
|
1567 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
|
1568 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1569 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1570 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
|
1571 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
|
1572 { |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1573 int vis,erg; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1574 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1575 PyCursesInitialised |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1576 |
|
13706
2e603bd0c1a9
Bug report and partial patch from Michael Deegan <michael@ucc.gu.uwa.edu.au>:
Andrew M. Kuchling <amk@amk.ca>
parents:
13651
diff
changeset
|
1577 if (ARG_COUNT(args)!=1) { |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1578 PyErr_SetString(PyExc_TypeError, "curs_set requires 1 argument"); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1579 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1580 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1581 |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
1582 if (!PyArg_Parse(args, "i;int", &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
|
1583 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1584 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
|
1585 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
|
1586 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1587 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
|
1588 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1589 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1590 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
|
1591 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
|
1592 { |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1593 int ms; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1594 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1595 PyCursesInitialised |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1596 |
|
13706
2e603bd0c1a9
Bug report and partial patch from Michael Deegan <michael@ucc.gu.uwa.edu.au>:
Andrew M. Kuchling <amk@amk.ca>
parents:
13651
diff
changeset
|
1597 if (ARG_COUNT(args) != 1) { |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1598 PyErr_SetString(PyExc_TypeError, "delay_output requires 1 argument"); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1599 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1600 } |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
1601 if (!PyArg_Parse(args, "i;ms", &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
|
1602 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1603 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
|
1604 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1605 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1606 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
|
1607 PyCurses_EraseChar(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
|
1608 { |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1609 char ch; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1610 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1611 PyCursesInitialised |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1612 |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
1613 if (!PyArg_NoArgs(args)) return NULL; |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1614 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1615 ch = erasechar(); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1616 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1617 return PyString_FromString(&ch); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1618 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1619 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1620 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
|
1621 PyCurses_getsyx(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
|
1622 { |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1623 int x,y; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1624 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1625 PyCursesInitialised |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1626 |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
1627 if (!PyArg_NoArgs(args)) return NULL; |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1628 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1629 getsyx(y, x); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1630 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1631 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
|
1632 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1633 |
|
13036
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
1634 #ifdef NCURSES_MOUSE_VERSION |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
1635 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
|
1636 PyCurses_GetMouse(PyObject *self, PyObject *args) |
|
13036
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
1637 { |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
1638 int rtn; |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
1639 MEVENT event; |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
1640 |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
1641 PyCursesInitialised |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
1642 if (!PyArg_NoArgs(args)) return NULL; |
|
13036
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
1643 |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
1644 rtn = getmouse( &event ); |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
1645 if (rtn == ERR) { |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
1646 PyErr_SetString(PyCursesError, "getmouse() returned ERR"); |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
1647 return NULL; |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
1648 } |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
1649 return Py_BuildValue("(hiiil)", |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
1650 (short)event.id, |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
1651 event.x, event.y, event.z, |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
1652 (long) event.bstate); |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
1653 } |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
1654 |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
1655 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
|
1656 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
|
1657 { |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
1658 MEVENT event; |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
1659 |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
1660 PyCursesInitialised |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
1661 if (!PyArg_ParseTuple(args, "(hiiil)", |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
1662 &event.id, |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
1663 &event.x, &event.y, &event.z, |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
1664 (int *) &event.bstate)) |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
1665 return NULL; |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
1666 |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
1667 return PyCursesCheckERR(ungetmouse(&event), "ungetmouse"); |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
1668 } |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
1669 #endif |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
1670 |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1671 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
|
1672 PyCurses_GetWin(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
|
1673 { |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1674 WINDOW *win; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1675 PyObject *temp; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1676 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1677 PyCursesInitialised |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1678 |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
1679 if (!PyArg_Parse(args, "O;fileobj", &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
|
1680 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1681 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
|
1682 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
|
1683 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1684 } |
|
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 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
|
1687 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1688 if (win == NULL) { |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1689 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
|
1690 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1691 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1692 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1693 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
|
1694 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1695 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
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_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
|
1698 { |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1699 unsigned char tenths; |
|
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 |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
1703 switch(ARG_COUNT(args)) { |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1704 case 1: |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
1705 if (!PyArg_Parse(args, "b;tenths", &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
|
1706 break; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1707 default: |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1708 PyErr_SetString(PyExc_TypeError, "halfdelay requires 1 argument"); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1709 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1710 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1711 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1712 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
|
1713 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1714 |
|
13708
fe89ea1c9108
Modified version of patch #100963 from Mark Favas: has_key() is an
Andrew M. Kuchling <amk@amk.ca>
parents:
13706
diff
changeset
|
1715 #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
|
1716 /* 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
|
1717 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
|
1718 { |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1719 int ch; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1720 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1721 PyCursesInitialised |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1722 |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
1723 if (!PyArg_Parse(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
|
1724 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1725 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
|
1726 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
|
1727 return Py_False; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1728 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1729 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
|
1730 return Py_True; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1731 } |
|
13708
fe89ea1c9108
Modified version of patch #100963 from Mark Favas: has_key() is an
Andrew M. Kuchling <amk@amk.ca>
parents:
13706
diff
changeset
|
1732 #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
|
1733 |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1734 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
|
1735 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
|
1736 { |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1737 short color, r, g, b; |
| 2357 | 1738 |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1739 PyCursesInitialised |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1740 PyCursesInitialisedColor |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1741 |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
1742 switch(ARG_COUNT(args)) { |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1743 case 4: |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
1744 if (!PyArg_Parse(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
|
1745 break; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1746 default: |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1747 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
|
1748 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1749 } |
|
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(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
|
1752 } |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1753 |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1754 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
|
1755 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
|
1756 { |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1757 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
|
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 PyCursesInitialisedColor |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1761 |
|
13706
2e603bd0c1a9
Bug report and partial patch from Michael Deegan <michael@ucc.gu.uwa.edu.au>:
Andrew M. Kuchling <amk@amk.ca>
parents:
13651
diff
changeset
|
1762 if (ARG_COUNT(args) != 3) { |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1763 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
|
1764 return NULL; |
|
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 |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
1767 if (!PyArg_Parse(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
|
1768 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1769 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
|
1770 } |
|
1867
758c1374f303
Setup.in: added tkinter; rearranged the definition of PYTHONPATH so
Guido van Rossum <guido@python.org>
parents:
1859
diff
changeset
|
1771 |
|
15646
5b158fc0ed55
Export C API from this module.
Andrew M. Kuchling <amk@amk.ca>
parents:
15638
diff
changeset
|
1772 static PyObject *ModDict; |
|
5b158fc0ed55
Export C API from this module.
Andrew M. Kuchling <amk@amk.ca>
parents:
15638
diff
changeset
|
1773 |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1774 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
|
1775 PyCurses_InitScr(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
|
1776 { |
|
1859
54fdc9a95f48
Lance's release 1.1 -- fixes some problems with 1.0
Guido van Rossum <guido@python.org>
parents:
1858
diff
changeset
|
1777 WINDOW *win; |
|
16350
66d4bf56e32d
Rename 'lines' variable to 'nlines' to avoid conflict with a macro defined
Andrew M. Kuchling <amk@amk.ca>
parents:
16323
diff
changeset
|
1778 PyObject *nlines, *cols; |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1779 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1780 if (!PyArg_NoArgs(args)) return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1781 |
|
2423
73eeff4d43f8
more fixes by Steve Clift
Guido van Rossum <guido@python.org>
parents:
2358
diff
changeset
|
1782 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
|
1783 wrefresh(stdscr); |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1784 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
|
1785 } |
|
1859
54fdc9a95f48
Lance's release 1.1 -- fixes some problems with 1.0
Guido van Rossum <guido@python.org>
parents:
1858
diff
changeset
|
1786 |
|
54fdc9a95f48
Lance's release 1.1 -- fixes some problems with 1.0
Guido van Rossum <guido@python.org>
parents:
1858
diff
changeset
|
1787 win = initscr(); |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1788 |
| 2357 | 1789 if (win == NULL) { |
| 1790 PyErr_SetString(PyCursesError, catchall_NULL); | |
| 1791 return NULL; | |
| 1792 } | |
| 1793 | |
|
15418
06465ed81826
Patch #102412 from mwh: Add support for the setupterm() function, to
Andrew M. Kuchling <amk@amk.ca>
parents:
15384
diff
changeset
|
1794 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
|
1795 |
|
12738
3d26cb3808a7
Changes by AMK: Use HAVE_NCURSES_H to include correct header file
Andrew M. Kuchling <amk@amk.ca>
parents:
12737
diff
changeset
|
1796 /* 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
|
1797 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
|
1798 #define SetDictInt(string,ch) \ |
|
3d26cb3808a7
Changes by AMK: Use HAVE_NCURSES_H to include correct header file
Andrew M. Kuchling <amk@amk.ca>
parents:
12737
diff
changeset
|
1799 PyDict_SetItemString(ModDict,string,PyInt_FromLong((long) (ch))); |
|
3d26cb3808a7
Changes by AMK: Use HAVE_NCURSES_H to include correct header file
Andrew M. Kuchling <amk@amk.ca>
parents:
12737
diff
changeset
|
1800 |
|
3d26cb3808a7
Changes by AMK: Use HAVE_NCURSES_H to include correct header file
Andrew M. Kuchling <amk@amk.ca>
parents:
12737
diff
changeset
|
1801 /* 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
|
1802 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
|
1803 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
|
1804 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
|
1805 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
|
1806 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
|
1807 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
|
1808 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
|
1809 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
|
1810 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
|
1811 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
|
1812 SetDictInt("ACS_PLUS", (ACS_PLUS)); |
|
3d26cb3808a7
Changes by AMK: Use HAVE_NCURSES_H to include correct header file
Andrew M. Kuchling <amk@amk.ca>
parents:
12737
diff
changeset
|
1813 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
|
1814 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
|
1815 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
|
1816 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
|
1817 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
|
1818 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
|
1819 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
|
1820 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
|
1821 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
|
1822 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
|
1823 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
|
1824 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
|
1825 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
|
1826 SetDictInt("ACS_BLOCK", (ACS_BLOCK)); |
|
3d26cb3808a7
Changes by AMK: Use HAVE_NCURSES_H to include correct header file
Andrew M. Kuchling <amk@amk.ca>
parents:
12737
diff
changeset
|
1827 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
|
1828 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
|
1829 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
|
1830 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
|
1831 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
|
1832 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
|
1833 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
|
1834 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
|
1835 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
|
1836 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
|
1837 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
|
1838 |
|
3abcb6966617
Patch from Randall Hopper to fix PR #116172, "curses module fails to
Andrew M. Kuchling <amk@amk.ca>
parents:
14334
diff
changeset
|
1839 /* 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
|
1840 #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
|
1841 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
|
1842 #endif |
|
3abcb6966617
Patch from Randall Hopper to fix PR #116172, "curses module fails to
Andrew M. Kuchling <amk@amk.ca>
parents:
14334
diff
changeset
|
1843 #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
|
1844 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
|
1845 #endif |
|
3abcb6966617
Patch from Randall Hopper to fix PR #116172, "curses module fails to
Andrew M. Kuchling <amk@amk.ca>
parents:
14334
diff
changeset
|
1846 #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
|
1847 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
|
1848 #endif |
|
3abcb6966617
Patch from Randall Hopper to fix PR #116172, "curses module fails to
Andrew M. Kuchling <amk@amk.ca>
parents:
14334
diff
changeset
|
1849 #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
|
1850 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
|
1851 #endif |
|
3abcb6966617
Patch from Randall Hopper to fix PR #116172, "curses module fails to
Andrew M. Kuchling <amk@amk.ca>
parents:
14334
diff
changeset
|
1852 #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
|
1853 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
|
1854 #endif |
|
3abcb6966617
Patch from Randall Hopper to fix PR #116172, "curses module fails to
Andrew M. Kuchling <amk@amk.ca>
parents:
14334
diff
changeset
|
1855 #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
|
1856 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
|
1857 #endif |
|
3abcb6966617
Patch from Randall Hopper to fix PR #116172, "curses module fails to
Andrew M. Kuchling <amk@amk.ca>
parents:
14334
diff
changeset
|
1858 #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
|
1859 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
|
1860 #endif |
|
3d26cb3808a7
Changes by AMK: Use HAVE_NCURSES_H to include correct header file
Andrew M. Kuchling <amk@amk.ca>
parents:
12737
diff
changeset
|
1861 |
|
16350
66d4bf56e32d
Rename 'lines' variable to 'nlines' to avoid conflict with a macro defined
Andrew M. Kuchling <amk@amk.ca>
parents:
16323
diff
changeset
|
1862 nlines = PyInt_FromLong((long) LINES); |
|
66d4bf56e32d
Rename 'lines' variable to 'nlines' to avoid conflict with a macro defined
Andrew M. Kuchling <amk@amk.ca>
parents:
16323
diff
changeset
|
1863 PyDict_SetItemString(ModDict, "LINES", nlines); |
|
66d4bf56e32d
Rename 'lines' variable to 'nlines' to avoid conflict with a macro defined
Andrew M. Kuchling <amk@amk.ca>
parents:
16323
diff
changeset
|
1864 Py_DECREF(nlines); |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1865 cols = PyInt_FromLong((long) COLS); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1866 PyDict_SetItemString(ModDict, "COLS", cols); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1867 Py_DECREF(cols); |
|
1859
54fdc9a95f48
Lance's release 1.1 -- fixes some problems with 1.0
Guido van Rossum <guido@python.org>
parents:
1858
diff
changeset
|
1868 |
|
54fdc9a95f48
Lance's release 1.1 -- fixes some problems with 1.0
Guido van Rossum <guido@python.org>
parents:
1858
diff
changeset
|
1869 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
|
1870 } |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1871 |
|
15418
06465ed81826
Patch #102412 from mwh: Add support for the setupterm() function, to
Andrew M. Kuchling <amk@amk.ca>
parents:
15384
diff
changeset
|
1872 static PyObject * |
|
06465ed81826
Patch #102412 from mwh: Add support for the setupterm() function, to
Andrew M. Kuchling <amk@amk.ca>
parents:
15384
diff
changeset
|
1873 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
|
1874 { |
|
06465ed81826
Patch #102412 from mwh: Add support for the setupterm() function, to
Andrew M. Kuchling <amk@amk.ca>
parents:
15384
diff
changeset
|
1875 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
|
1876 int err; |
|
06465ed81826
Patch #102412 from mwh: Add support for the setupterm() function, to
Andrew M. Kuchling <amk@amk.ca>
parents:
15384
diff
changeset
|
1877 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
|
1878 |
|
06465ed81826
Patch #102412 from mwh: Add support for the setupterm() function, to
Andrew M. Kuchling <amk@amk.ca>
parents:
15384
diff
changeset
|
1879 static char *kwlist[] = {"term", "fd", NULL}; |
|
06465ed81826
Patch #102412 from mwh: Add support for the setupterm() function, to
Andrew M. Kuchling <amk@amk.ca>
parents:
15384
diff
changeset
|
1880 |
|
06465ed81826
Patch #102412 from mwh: Add support for the setupterm() function, to
Andrew M. Kuchling <amk@amk.ca>
parents:
15384
diff
changeset
|
1881 if (!PyArg_ParseTupleAndKeywords( |
|
06465ed81826
Patch #102412 from mwh: Add support for the setupterm() function, to
Andrew M. Kuchling <amk@amk.ca>
parents:
15384
diff
changeset
|
1882 args,keywds,"|zi:setupterm",kwlist,&termstr,&fd)) { |
|
06465ed81826
Patch #102412 from mwh: Add support for the setupterm() function, to
Andrew M. Kuchling <amk@amk.ca>
parents:
15384
diff
changeset
|
1883 return NULL; |
|
06465ed81826
Patch #102412 from mwh: Add support for the setupterm() function, to
Andrew M. Kuchling <amk@amk.ca>
parents:
15384
diff
changeset
|
1884 } |
|
06465ed81826
Patch #102412 from mwh: Add support for the setupterm() function, to
Andrew M. Kuchling <amk@amk.ca>
parents:
15384
diff
changeset
|
1885 |
|
06465ed81826
Patch #102412 from mwh: Add support for the setupterm() function, to
Andrew M. Kuchling <amk@amk.ca>
parents:
15384
diff
changeset
|
1886 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
|
1887 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
|
1888 |
|
06465ed81826
Patch #102412 from mwh: Add support for the setupterm() function, to
Andrew M. Kuchling <amk@amk.ca>
parents:
15384
diff
changeset
|
1889 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
|
1890 |
|
06465ed81826
Patch #102412 from mwh: Add support for the setupterm() function, to
Andrew M. Kuchling <amk@amk.ca>
parents:
15384
diff
changeset
|
1891 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
|
1892 PyErr_SetString( |
|
06465ed81826
Patch #102412 from mwh: Add support for the setupterm() function, to
Andrew M. Kuchling <amk@amk.ca>
parents:
15384
diff
changeset
|
1893 PyCursesError, |
|
06465ed81826
Patch #102412 from mwh: Add support for the setupterm() function, to
Andrew M. Kuchling <amk@amk.ca>
parents:
15384
diff
changeset
|
1894 "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
|
1895 return NULL; |
|
06465ed81826
Patch #102412 from mwh: Add support for the setupterm() function, to
Andrew M. Kuchling <amk@amk.ca>
parents:
15384
diff
changeset
|
1896 } |
|
06465ed81826
Patch #102412 from mwh: Add support for the setupterm() function, to
Andrew M. Kuchling <amk@amk.ca>
parents:
15384
diff
changeset
|
1897 |
|
06465ed81826
Patch #102412 from mwh: Add support for the setupterm() function, to
Andrew M. Kuchling <amk@amk.ca>
parents:
15384
diff
changeset
|
1898 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
|
1899 |
|
06465ed81826
Patch #102412 from mwh: Add support for the setupterm() function, to
Andrew M. Kuchling <amk@amk.ca>
parents:
15384
diff
changeset
|
1900 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
|
1901 return NULL; |
|
06465ed81826
Patch #102412 from mwh: Add support for the setupterm() function, to
Andrew M. Kuchling <amk@amk.ca>
parents:
15384
diff
changeset
|
1902 } |
|
06465ed81826
Patch #102412 from mwh: Add support for the setupterm() function, to
Andrew M. Kuchling <amk@amk.ca>
parents:
15384
diff
changeset
|
1903 } |
|
06465ed81826
Patch #102412 from mwh: Add support for the setupterm() function, to
Andrew M. Kuchling <amk@amk.ca>
parents:
15384
diff
changeset
|
1904 |
|
06465ed81826
Patch #102412 from mwh: Add support for the setupterm() function, to
Andrew M. Kuchling <amk@amk.ca>
parents:
15384
diff
changeset
|
1905 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
|
1906 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
|
1907 |
|
06465ed81826
Patch #102412 from mwh: Add support for the setupterm() function, to
Andrew M. Kuchling <amk@amk.ca>
parents:
15384
diff
changeset
|
1908 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
|
1909 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
|
1910 } 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
|
1911 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
|
1912 } |
|
06465ed81826
Patch #102412 from mwh: Add support for the setupterm() function, to
Andrew M. Kuchling <amk@amk.ca>
parents:
15384
diff
changeset
|
1913 |
|
06465ed81826
Patch #102412 from mwh: Add support for the setupterm() function, to
Andrew M. Kuchling <amk@amk.ca>
parents:
15384
diff
changeset
|
1914 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
|
1915 return NULL; |
|
06465ed81826
Patch #102412 from mwh: Add support for the setupterm() function, to
Andrew M. Kuchling <amk@amk.ca>
parents:
15384
diff
changeset
|
1916 } |
|
06465ed81826
Patch #102412 from mwh: Add support for the setupterm() function, to
Andrew M. Kuchling <amk@amk.ca>
parents:
15384
diff
changeset
|
1917 |
|
06465ed81826
Patch #102412 from mwh: Add support for the setupterm() function, to
Andrew M. Kuchling <amk@amk.ca>
parents:
15384
diff
changeset
|
1918 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
|
1919 |
|
06465ed81826
Patch #102412 from mwh: Add support for the setupterm() function, to
Andrew M. Kuchling <amk@amk.ca>
parents:
15384
diff
changeset
|
1920 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
|
1921 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
|
1922 } |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1923 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1924 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
|
1925 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
|
1926 { |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1927 int ch; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1928 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1929 PyCursesInitialised |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1930 |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
1931 switch(ARG_COUNT(args)) { |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1932 case 1: |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
1933 if (!PyArg_Parse(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
|
1934 break; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1935 default: |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1936 PyErr_SetString(PyExc_TypeError, "intrflush requires 1 argument"); |
| 2357 | 1937 return NULL; |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1938 } |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1939 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1940 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
|
1941 } |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1942 |
|
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
|
1943 #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
|
1944 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
|
1945 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
|
1946 { |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1947 const char *knp; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1948 int ch; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1949 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1950 PyCursesInitialised |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1951 |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
1952 if (!PyArg_Parse(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
|
1953 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1954 knp = keyname(ch); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1955 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1956 return PyString_FromString((knp == NULL) ? "" : (char *)knp); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1957 } |
|
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
|
1958 #endif |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1959 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1960 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
|
1961 PyCurses_KillChar(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
|
1962 { |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1963 char ch; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1964 |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
1965 if (!PyArg_NoArgs(args)) return NULL; |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1966 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1967 ch = killchar(); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1968 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1969 return PyString_FromString(&ch); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1970 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1971 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1972 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
|
1973 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
|
1974 { |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1975 int ch; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1976 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1977 PyCursesInitialised |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1978 |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
1979 switch(ARG_COUNT(args)) { |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1980 case 1: |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
1981 if (!PyArg_Parse(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
|
1982 break; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1983 default: |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1984 PyErr_SetString(PyExc_TypeError, "meta requires 1 argument"); |
| 2357 | 1985 return NULL; |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1986 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1987 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1988 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
|
1989 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1990 |
|
13036
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
1991 #ifdef NCURSES_MOUSE_VERSION |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
1992 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
|
1993 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
|
1994 { |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
1995 int interval; |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
1996 PyCursesInitialised |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
1997 |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
1998 if (!PyArg_Parse(args,"i;interval",&interval)) |
|
13036
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
1999 return NULL; |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
2000 return PyCursesCheckERR(mouseinterval(interval), "mouseinterval"); |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
2001 } |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
2002 |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
2003 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
|
2004 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
|
2005 { |
|
13385
aff1c4146c1c
Removed unused variables.
Andrew M. Kuchling <amk@amk.ca>
parents:
13040
diff
changeset
|
2006 int newmask; |
|
13036
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
2007 mmask_t oldmask, availmask; |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
2008 |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
2009 PyCursesInitialised |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
2010 if (!PyArg_Parse(args,"i;mousemask",&newmask)) |
|
13036
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
2011 return NULL; |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
2012 availmask = mousemask(newmask, &oldmask); |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
2013 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
|
2014 } |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
2015 #endif |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
2016 |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2017 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
|
2018 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
|
2019 { |
|
4a9f1552ba68
Wrapper for napms() function, contributed by Thomas Gellekum <tg@FreeBSD.org>
Andrew M. Kuchling <amk@amk.ca>
parents:
15418
diff
changeset
|
2020 int ms; |
|
4a9f1552ba68
Wrapper for napms() function, contributed by Thomas Gellekum <tg@FreeBSD.org>
Andrew M. Kuchling <amk@amk.ca>
parents:
15418
diff
changeset
|
2021 |
|
4a9f1552ba68
Wrapper for napms() function, contributed by Thomas Gellekum <tg@FreeBSD.org>
Andrew M. Kuchling <amk@amk.ca>
parents:
15418
diff
changeset
|
2022 PyCursesInitialised |
|
4a9f1552ba68
Wrapper for napms() function, contributed by Thomas Gellekum <tg@FreeBSD.org>
Andrew M. Kuchling <amk@amk.ca>
parents:
15418
diff
changeset
|
2023 if (!PyArg_Parse(args, "i;ms", &ms)) return NULL; |
|
4a9f1552ba68
Wrapper for napms() function, contributed by Thomas Gellekum <tg@FreeBSD.org>
Andrew M. Kuchling <amk@amk.ca>
parents:
15418
diff
changeset
|
2024 |
|
4a9f1552ba68
Wrapper for napms() function, contributed by Thomas Gellekum <tg@FreeBSD.org>
Andrew M. Kuchling <amk@amk.ca>
parents:
15418
diff
changeset
|
2025 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
|
2026 } |
|
4a9f1552ba68
Wrapper for napms() function, contributed by Thomas Gellekum <tg@FreeBSD.org>
Andrew M. Kuchling <amk@amk.ca>
parents:
15418
diff
changeset
|
2027 |
|
4a9f1552ba68
Wrapper for napms() function, contributed by Thomas Gellekum <tg@FreeBSD.org>
Andrew M. Kuchling <amk@amk.ca>
parents:
15418
diff
changeset
|
2028 |
|
4a9f1552ba68
Wrapper for napms() function, contributed by Thomas Gellekum <tg@FreeBSD.org>
Andrew M. Kuchling <amk@amk.ca>
parents:
15418
diff
changeset
|
2029 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
|
2030 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
|
2031 { |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2032 WINDOW *win; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2033 int nlines, ncols; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2034 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2035 PyCursesInitialised |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2036 |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
2037 if (!PyArg_Parse(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
|
2038 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2039 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
|
2040 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2041 if (win == NULL) { |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2042 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
|
2043 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2044 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2045 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2046 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
|
2047 } |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2048 |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2049 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
|
2050 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
|
2051 { |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2052 WINDOW *win; |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2053 int nlines, ncols, begin_y, begin_x; |
| 2357 | 2054 |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2055 PyCursesInitialised |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2056 |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
2057 switch (ARG_COUNT(args)) { |
| 2357 | 2058 case 2: |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
2059 if (!PyArg_Parse(args,"(ii);nlines,ncols",&nlines,&ncols)) |
| 2357 | 2060 return NULL; |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2061 win = newpad(nlines, ncols); |
| 2357 | 2062 break; |
| 2063 case 4: | |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
2064 if (!PyArg_Parse(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
|
2065 &nlines,&ncols,&begin_y,&begin_x)) |
| 2357 | 2066 return NULL; |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2067 win = newwin(nlines,ncols,begin_y,begin_x); |
| 2357 | 2068 break; |
| 2069 default: | |
| 2070 PyErr_SetString(PyExc_TypeError, "newwin requires 2 or 4 arguments"); | |
| 2071 return NULL; | |
| 2072 } | |
| 2073 | |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2074 if (win == NULL) { |
| 2357 | 2075 PyErr_SetString(PyCursesError, catchall_NULL); |
| 2076 return NULL; | |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2077 } |
| 2357 | 2078 |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2079 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
|
2080 } |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2081 |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2082 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
|
2083 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
|
2084 { |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2085 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
|
2086 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2087 PyCursesInitialised |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2088 PyCursesInitialisedColor |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2089 |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
2090 switch(ARG_COUNT(args)) { |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2091 case 1: |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
2092 if (!PyArg_Parse(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
|
2093 break; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2094 default: |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2095 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
|
2096 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2097 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2098 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2099 if (!pair_content(pair, &f, &b)) { |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2100 PyErr_SetString(PyCursesError, |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2101 "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
|
2102 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2103 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2104 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2105 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
|
2106 } |
|
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 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
|
2109 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
|
2110 { |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2111 int n; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2112 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2113 PyCursesInitialised |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2114 PyCursesInitialisedColor |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2115 |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
2116 switch(ARG_COUNT(args)) { |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2117 case 1: |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
2118 if (!PyArg_Parse(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
|
2119 break; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2120 default: |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2121 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
|
2122 "pair_number requires 1 argument"); |
| 2357 | 2123 return NULL; |
|
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 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2126 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
|
2127 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2128 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2129 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
|
2130 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
|
2131 { |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2132 char *str; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2133 |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
2134 if (!PyArg_Parse(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
|
2135 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
|
2136 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2137 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2138 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
|
2139 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
|
2140 { |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2141 int flag = 0; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2142 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2143 PyCursesInitialised |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2144 |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
2145 switch(ARG_COUNT(args)) { |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2146 case 0: |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2147 qiflush(); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2148 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
|
2149 return Py_None; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2150 case 1: |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
2151 if (!PyArg_Parse(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
|
2152 if (flag) qiflush(); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2153 else noqiflush(); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2154 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
|
2155 return Py_None; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2156 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
|
2157 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
|
2158 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2159 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2160 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2161 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2162 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
|
2163 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
|
2164 { |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2165 int y,x; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2166 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2167 PyCursesInitialised |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2168 |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
2169 if (ARG_COUNT(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
|
2170 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
|
2171 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2172 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2173 |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
2174 if (!PyArg_Parse(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
|
2175 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2176 setsyx(y,x); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2177 |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2178 Py_INCREF(Py_None); |
| 2357 | 2179 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
|
2180 } |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2181 |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2182 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
|
2183 PyCurses_Start_Color(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
|
2184 { |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2185 int code; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2186 PyObject *c, *cp; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2187 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2188 PyCursesInitialised |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2189 |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
2190 if (!PyArg_NoArgs(args)) return NULL; |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2191 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2192 code = start_color(); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2193 if (code != ERR) { |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2194 initialisedcolors = TRUE; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2195 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
|
2196 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
|
2197 Py_DECREF(c); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2198 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
|
2199 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
|
2200 Py_DECREF(cp); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2201 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
|
2202 return Py_None; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2203 } else { |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2204 PyErr_SetString(PyCursesError, "start_color() returned ERR"); |
| 2357 | 2205 return NULL; |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2206 } |
|
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 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
|
2210 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
|
2211 { |
|
06d4225919d4
Added wrappers for tiget{flag,num,str}, for querying terminfo capabilities
Andrew M. Kuchling <amk@amk.ca>
parents:
13708
diff
changeset
|
2212 char *capname; |
|
06d4225919d4
Added wrappers for tiget{flag,num,str}, for querying terminfo capabilities
Andrew M. Kuchling <amk@amk.ca>
parents:
13708
diff
changeset
|
2213 |
|
15418
06465ed81826
Patch #102412 from mwh: Add support for the setupterm() function, to
Andrew M. Kuchling <amk@amk.ca>
parents:
15384
diff
changeset
|
2214 PyCursesSetupTermCalled; |
|
13715
06d4225919d4
Added wrappers for tiget{flag,num,str}, for querying terminfo capabilities
Andrew M. Kuchling <amk@amk.ca>
parents:
13708
diff
changeset
|
2215 |
|
06d4225919d4
Added wrappers for tiget{flag,num,str}, for querying terminfo capabilities
Andrew M. Kuchling <amk@amk.ca>
parents:
13708
diff
changeset
|
2216 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
|
2217 return NULL; |
|
06d4225919d4
Added wrappers for tiget{flag,num,str}, for querying terminfo capabilities
Andrew M. Kuchling <amk@amk.ca>
parents:
13708
diff
changeset
|
2218 |
|
06d4225919d4
Added wrappers for tiget{flag,num,str}, for querying terminfo capabilities
Andrew M. Kuchling <amk@amk.ca>
parents:
13708
diff
changeset
|
2219 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
|
2220 } |
|
06d4225919d4
Added wrappers for tiget{flag,num,str}, for querying terminfo capabilities
Andrew M. Kuchling <amk@amk.ca>
parents:
13708
diff
changeset
|
2221 |
|
06d4225919d4
Added wrappers for tiget{flag,num,str}, for querying terminfo capabilities
Andrew M. Kuchling <amk@amk.ca>
parents:
13708
diff
changeset
|
2222 static PyObject * |
|
06d4225919d4
Added wrappers for tiget{flag,num,str}, for querying terminfo capabilities
Andrew M. Kuchling <amk@amk.ca>
parents:
13708
diff
changeset
|
2223 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
|
2224 { |
|
06d4225919d4
Added wrappers for tiget{flag,num,str}, for querying terminfo capabilities
Andrew M. Kuchling <amk@amk.ca>
parents:
13708
diff
changeset
|
2225 char *capname; |
|
06d4225919d4
Added wrappers for tiget{flag,num,str}, for querying terminfo capabilities
Andrew M. Kuchling <amk@amk.ca>
parents:
13708
diff
changeset
|
2226 |
|
15418
06465ed81826
Patch #102412 from mwh: Add support for the setupterm() function, to
Andrew M. Kuchling <amk@amk.ca>
parents:
15384
diff
changeset
|
2227 PyCursesSetupTermCalled; |
|
13715
06d4225919d4
Added wrappers for tiget{flag,num,str}, for querying terminfo capabilities
Andrew M. Kuchling <amk@amk.ca>
parents:
13708
diff
changeset
|
2228 |
|
06d4225919d4
Added wrappers for tiget{flag,num,str}, for querying terminfo capabilities
Andrew M. Kuchling <amk@amk.ca>
parents:
13708
diff
changeset
|
2229 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
|
2230 return NULL; |
|
06d4225919d4
Added wrappers for tiget{flag,num,str}, for querying terminfo capabilities
Andrew M. Kuchling <amk@amk.ca>
parents:
13708
diff
changeset
|
2231 |
|
06d4225919d4
Added wrappers for tiget{flag,num,str}, for querying terminfo capabilities
Andrew M. Kuchling <amk@amk.ca>
parents:
13708
diff
changeset
|
2232 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
|
2233 } |
|
06d4225919d4
Added wrappers for tiget{flag,num,str}, for querying terminfo capabilities
Andrew M. Kuchling <amk@amk.ca>
parents:
13708
diff
changeset
|
2234 |
|
06d4225919d4
Added wrappers for tiget{flag,num,str}, for querying terminfo capabilities
Andrew M. Kuchling <amk@amk.ca>
parents:
13708
diff
changeset
|
2235 static PyObject * |
|
06d4225919d4
Added wrappers for tiget{flag,num,str}, for querying terminfo capabilities
Andrew M. Kuchling <amk@amk.ca>
parents:
13708
diff
changeset
|
2236 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
|
2237 { |
|
06d4225919d4
Added wrappers for tiget{flag,num,str}, for querying terminfo capabilities
Andrew M. Kuchling <amk@amk.ca>
parents:
13708
diff
changeset
|
2238 char *capname; |
|
06d4225919d4
Added wrappers for tiget{flag,num,str}, for querying terminfo capabilities
Andrew M. Kuchling <amk@amk.ca>
parents:
13708
diff
changeset
|
2239 |
|
15418
06465ed81826
Patch #102412 from mwh: Add support for the setupterm() function, to
Andrew M. Kuchling <amk@amk.ca>
parents:
15384
diff
changeset
|
2240 PyCursesSetupTermCalled; |
|
13715
06d4225919d4
Added wrappers for tiget{flag,num,str}, for querying terminfo capabilities
Andrew M. Kuchling <amk@amk.ca>
parents:
13708
diff
changeset
|
2241 |
|
06d4225919d4
Added wrappers for tiget{flag,num,str}, for querying terminfo capabilities
Andrew M. Kuchling <amk@amk.ca>
parents:
13708
diff
changeset
|
2242 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
|
2243 return NULL; |
|
06d4225919d4
Added wrappers for tiget{flag,num,str}, for querying terminfo capabilities
Andrew M. Kuchling <amk@amk.ca>
parents:
13708
diff
changeset
|
2244 |
|
06d4225919d4
Added wrappers for tiget{flag,num,str}, for querying terminfo capabilities
Andrew M. Kuchling <amk@amk.ca>
parents:
13708
diff
changeset
|
2245 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
|
2246 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
|
2247 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
|
2248 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
|
2249 } |
|
06d4225919d4
Added wrappers for tiget{flag,num,str}, for querying terminfo capabilities
Andrew M. Kuchling <amk@amk.ca>
parents:
13708
diff
changeset
|
2250 return PyString_FromString( capname ); |
|
06d4225919d4
Added wrappers for tiget{flag,num,str}, for querying terminfo capabilities
Andrew M. Kuchling <amk@amk.ca>
parents:
13708
diff
changeset
|
2251 } |
|
06d4225919d4
Added wrappers for tiget{flag,num,str}, for querying terminfo capabilities
Andrew M. Kuchling <amk@amk.ca>
parents:
13708
diff
changeset
|
2252 |
|
06d4225919d4
Added wrappers for tiget{flag,num,str}, for querying terminfo capabilities
Andrew M. Kuchling <amk@amk.ca>
parents:
13708
diff
changeset
|
2253 static PyObject * |
|
15384
3cb12e0e7acd
Patch #102278: add tparm() function to _curses module
Andrew M. Kuchling <amk@amk.ca>
parents:
15369
diff
changeset
|
2254 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
|
2255 { |
|
3cb12e0e7acd
Patch #102278: add tparm() function to _curses module
Andrew M. Kuchling <amk@amk.ca>
parents:
15369
diff
changeset
|
2256 char* fmt; |
|
3cb12e0e7acd
Patch #102278: add tparm() function to _curses module
Andrew M. Kuchling <amk@amk.ca>
parents:
15369
diff
changeset
|
2257 char* result = NULL; |
|
3cb12e0e7acd
Patch #102278: add tparm() function to _curses module
Andrew M. Kuchling <amk@amk.ca>
parents:
15369
diff
changeset
|
2258 int i1,i2,i3,i4,i5,i6,i7,i8,i9; |
|
3cb12e0e7acd
Patch #102278: add tparm() function to _curses module
Andrew M. Kuchling <amk@amk.ca>
parents:
15369
diff
changeset
|
2259 |
|
15418
06465ed81826
Patch #102412 from mwh: Add support for the setupterm() function, to
Andrew M. Kuchling <amk@amk.ca>
parents:
15384
diff
changeset
|
2260 PyCursesSetupTermCalled; |
|
15384
3cb12e0e7acd
Patch #102278: add tparm() function to _curses module
Andrew M. Kuchling <amk@amk.ca>
parents:
15369
diff
changeset
|
2261 |
|
3cb12e0e7acd
Patch #102278: add tparm() function to _curses module
Andrew M. Kuchling <amk@amk.ca>
parents:
15369
diff
changeset
|
2262 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
|
2263 &fmt, &i1, &i2, &i3, &i4, |
|
3cb12e0e7acd
Patch #102278: add tparm() function to _curses module
Andrew M. Kuchling <amk@amk.ca>
parents:
15369
diff
changeset
|
2264 &i5, &i6, &i7, &i8, &i9)) { |
|
3cb12e0e7acd
Patch #102278: add tparm() function to _curses module
Andrew M. Kuchling <amk@amk.ca>
parents:
15369
diff
changeset
|
2265 return NULL; |
|
3cb12e0e7acd
Patch #102278: add tparm() function to _curses module
Andrew M. Kuchling <amk@amk.ca>
parents:
15369
diff
changeset
|
2266 } |
|
3cb12e0e7acd
Patch #102278: add tparm() function to _curses module
Andrew M. Kuchling <amk@amk.ca>
parents:
15369
diff
changeset
|
2267 |
|
3cb12e0e7acd
Patch #102278: add tparm() function to _curses module
Andrew M. Kuchling <amk@amk.ca>
parents:
15369
diff
changeset
|
2268 switch (PyTuple_GET_SIZE(args)) { |
|
3cb12e0e7acd
Patch #102278: add tparm() function to _curses module
Andrew M. Kuchling <amk@amk.ca>
parents:
15369
diff
changeset
|
2269 case 1: |
|
3cb12e0e7acd
Patch #102278: add tparm() function to _curses module
Andrew M. Kuchling <amk@amk.ca>
parents:
15369
diff
changeset
|
2270 result = tparm(fmt); |
|
3cb12e0e7acd
Patch #102278: add tparm() function to _curses module
Andrew M. Kuchling <amk@amk.ca>
parents:
15369
diff
changeset
|
2271 break; |
|
3cb12e0e7acd
Patch #102278: add tparm() function to _curses module
Andrew M. Kuchling <amk@amk.ca>
parents:
15369
diff
changeset
|
2272 case 2: |
|
3cb12e0e7acd
Patch #102278: add tparm() function to _curses module
Andrew M. Kuchling <amk@amk.ca>
parents:
15369
diff
changeset
|
2273 result = tparm(fmt,i1); |
|
3cb12e0e7acd
Patch #102278: add tparm() function to _curses module
Andrew M. Kuchling <amk@amk.ca>
parents:
15369
diff
changeset
|
2274 break; |
|
3cb12e0e7acd
Patch #102278: add tparm() function to _curses module
Andrew M. Kuchling <amk@amk.ca>
parents:
15369
diff
changeset
|
2275 case 3: |
|
3cb12e0e7acd
Patch #102278: add tparm() function to _curses module
Andrew M. Kuchling <amk@amk.ca>
parents:
15369
diff
changeset
|
2276 result = tparm(fmt,i1,i2); |
|
3cb12e0e7acd
Patch #102278: add tparm() function to _curses module
Andrew M. Kuchling <amk@amk.ca>
parents:
15369
diff
changeset
|
2277 break; |
|
3cb12e0e7acd
Patch #102278: add tparm() function to _curses module
Andrew M. Kuchling <amk@amk.ca>
parents:
15369
diff
changeset
|
2278 case 4: |
|
3cb12e0e7acd
Patch #102278: add tparm() function to _curses module
Andrew M. Kuchling <amk@amk.ca>
parents:
15369
diff
changeset
|
2279 result = tparm(fmt,i1,i2,i3); |
|
3cb12e0e7acd
Patch #102278: add tparm() function to _curses module
Andrew M. Kuchling <amk@amk.ca>
parents:
15369
diff
changeset
|
2280 break; |
|
3cb12e0e7acd
Patch #102278: add tparm() function to _curses module
Andrew M. Kuchling <amk@amk.ca>
parents:
15369
diff
changeset
|
2281 case 5: |
|
3cb12e0e7acd
Patch #102278: add tparm() function to _curses module
Andrew M. Kuchling <amk@amk.ca>
parents:
15369
diff
changeset
|
2282 result = tparm(fmt,i1,i2,i3,i4); |
|
3cb12e0e7acd
Patch #102278: add tparm() function to _curses module
Andrew M. Kuchling <amk@amk.ca>
parents:
15369
diff
changeset
|
2283 break; |
|
3cb12e0e7acd
Patch #102278: add tparm() function to _curses module
Andrew M. Kuchling <amk@amk.ca>
parents:
15369
diff
changeset
|
2284 case 6: |
|
3cb12e0e7acd
Patch #102278: add tparm() function to _curses module
Andrew M. Kuchling <amk@amk.ca>
parents:
15369
diff
changeset
|
2285 result = tparm(fmt,i1,i2,i3,i4,i5); |
|
3cb12e0e7acd
Patch #102278: add tparm() function to _curses module
Andrew M. Kuchling <amk@amk.ca>
parents:
15369
diff
changeset
|
2286 break; |
|
3cb12e0e7acd
Patch #102278: add tparm() function to _curses module
Andrew M. Kuchling <amk@amk.ca>
parents:
15369
diff
changeset
|
2287 case 7: |
|
3cb12e0e7acd
Patch #102278: add tparm() function to _curses module
Andrew M. Kuchling <amk@amk.ca>
parents:
15369
diff
changeset
|
2288 result = tparm(fmt,i1,i2,i3,i4,i5,i6); |
|
3cb12e0e7acd
Patch #102278: add tparm() function to _curses module
Andrew M. Kuchling <amk@amk.ca>
parents:
15369
diff
changeset
|
2289 break; |
|
3cb12e0e7acd
Patch #102278: add tparm() function to _curses module
Andrew M. Kuchling <amk@amk.ca>
parents:
15369
diff
changeset
|
2290 case 8: |
|
3cb12e0e7acd
Patch #102278: add tparm() function to _curses module
Andrew M. Kuchling <amk@amk.ca>
parents:
15369
diff
changeset
|
2291 result = tparm(fmt,i1,i2,i3,i4,i5,i6,i7); |
|
3cb12e0e7acd
Patch #102278: add tparm() function to _curses module
Andrew M. Kuchling <amk@amk.ca>
parents:
15369
diff
changeset
|
2292 break; |
|
3cb12e0e7acd
Patch #102278: add tparm() function to _curses module
Andrew M. Kuchling <amk@amk.ca>
parents:
15369
diff
changeset
|
2293 case 9: |
|
3cb12e0e7acd
Patch #102278: add tparm() function to _curses module
Andrew M. Kuchling <amk@amk.ca>
parents:
15369
diff
changeset
|
2294 result = tparm(fmt,i1,i2,i3,i4,i5,i6,i7,i8); |
|
3cb12e0e7acd
Patch #102278: add tparm() function to _curses module
Andrew M. Kuchling <amk@amk.ca>
parents:
15369
diff
changeset
|
2295 break; |
|
3cb12e0e7acd
Patch #102278: add tparm() function to _curses module
Andrew M. Kuchling <amk@amk.ca>
parents:
15369
diff
changeset
|
2296 case 10: |
|
3cb12e0e7acd
Patch #102278: add tparm() function to _curses module
Andrew M. Kuchling <amk@amk.ca>
parents:
15369
diff
changeset
|
2297 result = tparm(fmt,i1,i2,i3,i4,i5,i6,i7,i8,i9); |
|
3cb12e0e7acd
Patch #102278: add tparm() function to _curses module
Andrew M. Kuchling <amk@amk.ca>
parents:
15369
diff
changeset
|
2298 break; |
|
3cb12e0e7acd
Patch #102278: add tparm() function to _curses module
Andrew M. Kuchling <amk@amk.ca>
parents:
15369
diff
changeset
|
2299 } |
|
3cb12e0e7acd
Patch #102278: add tparm() function to _curses module
Andrew M. Kuchling <amk@amk.ca>
parents:
15369
diff
changeset
|
2300 |
|
3cb12e0e7acd
Patch #102278: add tparm() function to _curses module
Andrew M. Kuchling <amk@amk.ca>
parents:
15369
diff
changeset
|
2301 return PyString_FromString(result); |
|
3cb12e0e7acd
Patch #102278: add tparm() function to _curses module
Andrew M. Kuchling <amk@amk.ca>
parents:
15369
diff
changeset
|
2302 } |
|
3cb12e0e7acd
Patch #102278: add tparm() function to _curses module
Andrew M. Kuchling <amk@amk.ca>
parents:
15369
diff
changeset
|
2303 |
|
3cb12e0e7acd
Patch #102278: add tparm() function to _curses module
Andrew M. Kuchling <amk@amk.ca>
parents:
15369
diff
changeset
|
2304 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
|
2305 PyCurses_TypeAhead(PyObject *self, PyObject *args) |
|
12974
e7992d0d6808
Added .timeout() method and .typeahead() function
Andrew M. Kuchling <amk@amk.ca>
parents:
12913
diff
changeset
|
2306 { |
|
13385
aff1c4146c1c
Removed unused variables.
Andrew M. Kuchling <amk@amk.ca>
parents:
13040
diff
changeset
|
2307 int fd; |
|
12974
e7992d0d6808
Added .timeout() method and .typeahead() function
Andrew M. Kuchling <amk@amk.ca>
parents:
12913
diff
changeset
|
2308 |
|
e7992d0d6808
Added .timeout() method and .typeahead() function
Andrew M. Kuchling <amk@amk.ca>
parents:
12913
diff
changeset
|
2309 PyCursesInitialised |
|
e7992d0d6808
Added .timeout() method and .typeahead() function
Andrew M. Kuchling <amk@amk.ca>
parents:
12913
diff
changeset
|
2310 |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
2311 if (!PyArg_Parse(args,"i;fd",&fd)) return NULL; |
|
12974
e7992d0d6808
Added .timeout() method and .typeahead() function
Andrew M. Kuchling <amk@amk.ca>
parents:
12913
diff
changeset
|
2312 |
|
e7992d0d6808
Added .timeout() method and .typeahead() function
Andrew M. Kuchling <amk@amk.ca>
parents:
12913
diff
changeset
|
2313 PyCursesCheckERR(typeahead( fd ), "typeahead"); |
|
e7992d0d6808
Added .timeout() method and .typeahead() function
Andrew M. Kuchling <amk@amk.ca>
parents:
12913
diff
changeset
|
2314 Py_INCREF(Py_None); |
|
e7992d0d6808
Added .timeout() method and .typeahead() function
Andrew M. Kuchling <amk@amk.ca>
parents:
12913
diff
changeset
|
2315 return Py_None; |
|
e7992d0d6808
Added .timeout() method and .typeahead() function
Andrew M. Kuchling <amk@amk.ca>
parents:
12913
diff
changeset
|
2316 } |
|
e7992d0d6808
Added .timeout() method and .typeahead() function
Andrew M. Kuchling <amk@amk.ca>
parents:
12913
diff
changeset
|
2317 |
|
e7992d0d6808
Added .timeout() method and .typeahead() function
Andrew M. Kuchling <amk@amk.ca>
parents:
12913
diff
changeset
|
2318 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
|
2319 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
|
2320 { |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2321 PyObject *temp; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2322 chtype ch; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2323 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2324 PyCursesInitialised |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2325 |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
2326 if (!PyArg_Parse(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
|
2327 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2328 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
|
2329 ch = (chtype) PyInt_AsLong(temp); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2330 else if (PyString_Check(temp)) |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2331 ch = (chtype) *PyString_AsString(temp); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2332 else { |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2333 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
|
2334 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2335 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2336 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2337 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
|
2338 } |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2339 |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2340 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
|
2341 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
|
2342 { |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2343 PyObject *temp; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2344 chtype ch; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2345 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2346 PyCursesInitialised |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2347 |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
2348 if (!PyArg_Parse(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
|
2349 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2350 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
|
2351 ch = (chtype) PyInt_AsLong(temp); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2352 else if (PyString_Check(temp)) |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2353 ch = (chtype) *PyString_AsString(temp); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2354 else { |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2355 PyErr_SetString(PyExc_TypeError, "argument must be a ch or an int"); |
| 2357 | 2356 return NULL; |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2357 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2358 |
| 2357 | 2359 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
|
2360 } |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2361 |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2362 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
|
2363 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
|
2364 { |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2365 int flag; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2366 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2367 PyCursesInitialised |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2368 |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
2369 switch(ARG_COUNT(args)) { |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2370 case 1: |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
2371 if (!PyArg_Parse(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
|
2372 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2373 break; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2374 default: |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2375 PyErr_SetString(PyExc_TypeError, "use_env requires 1 argument"); |
| 2357 | 2376 return NULL; |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2377 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2378 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
|
2379 Py_INCREF(Py_None); |
| 2357 | 2380 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
|
2381 } |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2382 |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2383 /* 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
|
2384 |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2385 static PyMethodDef PyCurses_methods[] = { |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2386 {"baudrate", (PyCFunction)PyCurses_baudrate}, |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2387 {"beep", (PyCFunction)PyCurses_beep}, |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2388 {"can_change_color", (PyCFunction)PyCurses_can_change_color}, |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2389 {"cbreak", (PyCFunction)PyCurses_cbreak}, |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2390 {"color_content", (PyCFunction)PyCurses_Color_Content}, |
|
12738
3d26cb3808a7
Changes by AMK: Use HAVE_NCURSES_H to include correct header file
Andrew M. Kuchling <amk@amk.ca>
parents:
12737
diff
changeset
|
2391 {"color_pair", (PyCFunction)PyCurses_color_pair}, |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2392 {"curs_set", (PyCFunction)PyCurses_Curs_Set}, |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2393 {"def_prog_mode", (PyCFunction)PyCurses_def_prog_mode}, |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2394 {"def_shell_mode", (PyCFunction)PyCurses_def_shell_mode}, |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2395 {"delay_output", (PyCFunction)PyCurses_Delay_Output}, |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2396 {"doupdate", (PyCFunction)PyCurses_doupdate}, |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2397 {"echo", (PyCFunction)PyCurses_echo}, |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2398 {"endwin", (PyCFunction)PyCurses_endwin}, |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2399 {"erasechar", (PyCFunction)PyCurses_EraseChar}, |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2400 {"filter", (PyCFunction)PyCurses_filter}, |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2401 {"flash", (PyCFunction)PyCurses_flash}, |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2402 {"flushinp", (PyCFunction)PyCurses_flushinp}, |
|
13036
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
2403 #ifdef NCURSES_MOUSE_VERSION |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
2404 {"getmouse", (PyCFunction)PyCurses_GetMouse}, |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
2405 {"ungetmouse", (PyCFunction)PyCurses_UngetMouse, METH_VARARGS}, |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
2406 #endif |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2407 {"getsyx", (PyCFunction)PyCurses_getsyx}, |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2408 {"getwin", (PyCFunction)PyCurses_GetWin}, |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2409 {"has_colors", (PyCFunction)PyCurses_has_colors}, |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2410 {"has_ic", (PyCFunction)PyCurses_has_ic}, |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2411 {"has_il", (PyCFunction)PyCurses_has_il}, |
|
13708
fe89ea1c9108
Modified version of patch #100963 from Mark Favas: has_key() is an
Andrew M. Kuchling <amk@amk.ca>
parents:
13706
diff
changeset
|
2412 #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
|
2413 {"has_key", (PyCFunction)PyCurses_has_key}, |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2414 #endif |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2415 {"halfdelay", (PyCFunction)PyCurses_HalfDelay}, |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2416 {"init_color", (PyCFunction)PyCurses_Init_Color}, |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2417 {"init_pair", (PyCFunction)PyCurses_Init_Pair}, |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2418 {"initscr", (PyCFunction)PyCurses_InitScr}, |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2419 {"intrflush", (PyCFunction)PyCurses_IntrFlush}, |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2420 {"isendwin", (PyCFunction)PyCurses_isendwin}, |
|
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
|
2421 #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
|
2422 {"keyname", (PyCFunction)PyCurses_KeyName}, |
|
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
|
2423 #endif |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2424 {"killchar", (PyCFunction)PyCurses_KillChar}, |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2425 {"longname", (PyCFunction)PyCurses_longname}, |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2426 {"meta", (PyCFunction)PyCurses_Meta}, |
|
13036
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
2427 #ifdef NCURSES_MOUSE_VERSION |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
2428 {"mouseinterval", (PyCFunction)PyCurses_MouseInterval}, |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
2429 {"mousemask", (PyCFunction)PyCurses_MouseMask}, |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
2430 #endif |
|
15574
4a9f1552ba68
Wrapper for napms() function, contributed by Thomas Gellekum <tg@FreeBSD.org>
Andrew M. Kuchling <amk@amk.ca>
parents:
15418
diff
changeset
|
2431 {"napms", (PyCFunction)PyCurses_Napms}, |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2432 {"newpad", (PyCFunction)PyCurses_NewPad}, |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2433 {"newwin", (PyCFunction)PyCurses_NewWindow}, |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2434 {"nl", (PyCFunction)PyCurses_nl}, |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2435 {"nocbreak", (PyCFunction)PyCurses_nocbreak}, |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2436 {"noecho", (PyCFunction)PyCurses_noecho}, |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2437 {"nonl", (PyCFunction)PyCurses_nonl}, |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2438 {"noqiflush", (PyCFunction)PyCurses_noqiflush}, |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2439 {"noraw", (PyCFunction)PyCurses_noraw}, |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2440 {"pair_content", (PyCFunction)PyCurses_Pair_Content}, |
|
12738
3d26cb3808a7
Changes by AMK: Use HAVE_NCURSES_H to include correct header file
Andrew M. Kuchling <amk@amk.ca>
parents:
12737
diff
changeset
|
2441 {"pair_number", (PyCFunction)PyCurses_pair_number}, |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2442 {"putp", (PyCFunction)PyCurses_Putp}, |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2443 {"qiflush", (PyCFunction)PyCurses_QiFlush}, |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2444 {"raw", (PyCFunction)PyCurses_raw}, |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2445 {"reset_prog_mode", (PyCFunction)PyCurses_reset_prog_mode}, |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2446 {"reset_shell_mode", (PyCFunction)PyCurses_reset_shell_mode}, |
|
13385
aff1c4146c1c
Removed unused variables.
Andrew M. Kuchling <amk@amk.ca>
parents:
13040
diff
changeset
|
2447 {"resetty", (PyCFunction)PyCurses_resetty}, |
|
aff1c4146c1c
Removed unused variables.
Andrew M. Kuchling <amk@amk.ca>
parents:
13040
diff
changeset
|
2448 {"savetty", (PyCFunction)PyCurses_savetty}, |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2449 {"setsyx", (PyCFunction)PyCurses_setsyx}, |
|
15418
06465ed81826
Patch #102412 from mwh: Add support for the setupterm() function, to
Andrew M. Kuchling <amk@amk.ca>
parents:
15384
diff
changeset
|
2450 {"setupterm", (PyCFunction)PyCurses_setupterm, METH_VARARGS|METH_KEYWORDS}, |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2451 {"start_color", (PyCFunction)PyCurses_Start_Color}, |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2452 {"termattrs", (PyCFunction)PyCurses_termattrs}, |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2453 {"termname", (PyCFunction)PyCurses_termname}, |
|
13715
06d4225919d4
Added wrappers for tiget{flag,num,str}, for querying terminfo capabilities
Andrew M. Kuchling <amk@amk.ca>
parents:
13708
diff
changeset
|
2454 {"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
|
2455 {"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
|
2456 {"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
|
2457 {"tparm", (PyCFunction)PyCurses_tparm, METH_VARARGS}, |
|
12974
e7992d0d6808
Added .timeout() method and .typeahead() function
Andrew M. Kuchling <amk@amk.ca>
parents:
12913
diff
changeset
|
2458 {"typeahead", (PyCFunction)PyCurses_TypeAhead}, |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2459 {"unctrl", (PyCFunction)PyCurses_UnCtrl}, |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2460 {"ungetch", (PyCFunction)PyCurses_UngetCh}, |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2461 {"use_env", (PyCFunction)PyCurses_Use_Env}, |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2462 {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
|
2463 }; |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2464 |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2465 /* 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
|
2466 |
|
16007
32352e120c37
Support building this as a DLL under Cygwin.
Guido van Rossum <guido@python.org>
parents:
15661
diff
changeset
|
2467 DL_EXPORT(void) |
|
13651
8a063423e0b7
Bunch of minor ANSIfications: 'void initfunc()' -> 'void initfunc(void)',
Thomas Wouters <thomas@python.org>
parents:
13465
diff
changeset
|
2468 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
|
2469 { |
|
15646
5b158fc0ed55
Export C API from this module.
Andrew M. Kuchling <amk@amk.ca>
parents:
15638
diff
changeset
|
2470 PyObject *m, *d, *v, *c_api_object; |
|
5b158fc0ed55
Export C API from this module.
Andrew M. Kuchling <amk@amk.ca>
parents:
15638
diff
changeset
|
2471 static void *PyCurses_API[PyCurses_API_pointers]; |
|
5b158fc0ed55
Export C API from this module.
Andrew M. Kuchling <amk@amk.ca>
parents:
15638
diff
changeset
|
2472 |
|
16007
32352e120c37
Support building this as a DLL under Cygwin.
Guido van Rossum <guido@python.org>
parents:
15661
diff
changeset
|
2473 /* Initialize object type */ |
|
32352e120c37
Support building this as a DLL under Cygwin.
Guido van Rossum <guido@python.org>
parents:
15661
diff
changeset
|
2474 PyCursesWindow_Type.ob_type = &PyType_Type; |
|
32352e120c37
Support building this as a DLL under Cygwin.
Guido van Rossum <guido@python.org>
parents:
15661
diff
changeset
|
2475 |
|
15646
5b158fc0ed55
Export C API from this module.
Andrew M. Kuchling <amk@amk.ca>
parents:
15638
diff
changeset
|
2476 /* Initialize the C API pointer array */ |
|
5b158fc0ed55
Export C API from this module.
Andrew M. Kuchling <amk@amk.ca>
parents:
15638
diff
changeset
|
2477 PyCurses_API[0] = (void *)&PyCursesWindow_Type; |
|
5b158fc0ed55
Export C API from this module.
Andrew M. Kuchling <amk@amk.ca>
parents:
15638
diff
changeset
|
2478 PyCurses_API[1] = (void *)func_PyCursesSetupTermCalled; |
|
5b158fc0ed55
Export C API from this module.
Andrew M. Kuchling <amk@amk.ca>
parents:
15638
diff
changeset
|
2479 PyCurses_API[2] = (void *)func_PyCursesInitialised; |
|
5b158fc0ed55
Export C API from this module.
Andrew M. Kuchling <amk@amk.ca>
parents:
15638
diff
changeset
|
2480 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
|
2481 |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2482 /* 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
|
2483 m = Py_InitModule("_curses", PyCurses_methods); |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2484 |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2485 /* 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
|
2486 d = PyModule_GetDict(m); |
|
15646
5b158fc0ed55
Export C API from this module.
Andrew M. Kuchling <amk@amk.ca>
parents:
15638
diff
changeset
|
2487 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
|
2488 |
|
5b158fc0ed55
Export C API from this module.
Andrew M. Kuchling <amk@amk.ca>
parents:
15638
diff
changeset
|
2489 /* Add a CObject for the C API */ |
|
5b158fc0ed55
Export C API from this module.
Andrew M. Kuchling <amk@amk.ca>
parents:
15638
diff
changeset
|
2490 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
|
2491 PyDict_SetItemString(d, "_C_API", c_api_object); |
| 1858 | 2492 |
| 2357 | 2493 /* 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
|
2494 PyCursesError = PyErr_NewException("_curses.error", NULL, NULL); |
| 2357 | 2495 PyDict_SetItemString(d, "error", PyCursesError); |
| 1858 | 2496 |
| 2357 | 2497 /* Make the version available */ |
|
2358
4c43cbdcd524
bump version, add __version__ back in
Guido van Rossum <guido@python.org>
parents:
2357
diff
changeset
|
2498 v = PyString_FromString(PyCursesVersion); |
|
4c43cbdcd524
bump version, add __version__ back in
Guido van Rossum <guido@python.org>
parents:
2357
diff
changeset
|
2499 PyDict_SetItemString(d, "version", v); |
|
4c43cbdcd524
bump version, add __version__ back in
Guido van Rossum <guido@python.org>
parents:
2357
diff
changeset
|
2500 PyDict_SetItemString(d, "__version__", v); |
|
4c43cbdcd524
bump version, add __version__ back in
Guido van Rossum <guido@python.org>
parents:
2357
diff
changeset
|
2501 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
|
2502 |
|
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
|
2503 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
|
2504 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
|
2505 |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2506 /* 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
|
2507 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2508 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
|
2509 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
|
2510 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
|
2511 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
|
2512 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
|
2513 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
|
2514 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
|
2515 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
|
2516 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
|
2517 #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
|
2518 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
|
2519 #endif |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2520 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
|
2521 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
|
2522 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
|
2523 |
|
3abcb6966617
Patch from Randall Hopper to fix PR #116172, "curses module fails to
Andrew M. Kuchling <amk@amk.ca>
parents:
14334
diff
changeset
|
2524 /* 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
|
2525 #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
|
2526 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
|
2527 #endif |
|
3abcb6966617
Patch from Randall Hopper to fix PR #116172, "curses module fails to
Andrew M. Kuchling <amk@amk.ca>
parents:
14334
diff
changeset
|
2528 #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
|
2529 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
|
2530 #endif |
|
3abcb6966617
Patch from Randall Hopper to fix PR #116172, "curses module fails to
Andrew M. Kuchling <amk@amk.ca>
parents:
14334
diff
changeset
|
2531 #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
|
2532 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
|
2533 #endif |
|
3abcb6966617
Patch from Randall Hopper to fix PR #116172, "curses module fails to
Andrew M. Kuchling <amk@amk.ca>
parents:
14334
diff
changeset
|
2534 #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
|
2535 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
|
2536 #endif |
|
3abcb6966617
Patch from Randall Hopper to fix PR #116172, "curses module fails to
Andrew M. Kuchling <amk@amk.ca>
parents:
14334
diff
changeset
|
2537 #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
|
2538 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
|
2539 #endif |
|
3abcb6966617
Patch from Randall Hopper to fix PR #116172, "curses module fails to
Andrew M. Kuchling <amk@amk.ca>
parents:
14334
diff
changeset
|
2540 #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
|
2541 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
|
2542 #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
|
2543 |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2544 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
|
2545 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
|
2546 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
|
2547 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
|
2548 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
|
2549 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
|
2550 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
|
2551 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
|
2552 |
|
13036
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
2553 #ifdef NCURSES_MOUSE_VERSION |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
2554 /* Mouse-related constants */ |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
2555 SetDictInt("BUTTON1_PRESSED", BUTTON1_PRESSED); |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
2556 SetDictInt("BUTTON1_RELEASED", BUTTON1_RELEASED); |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
2557 SetDictInt("BUTTON1_CLICKED", BUTTON1_CLICKED); |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
2558 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
|
2559 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
|
2560 |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
2561 SetDictInt("BUTTON2_PRESSED", BUTTON2_PRESSED); |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
2562 SetDictInt("BUTTON2_RELEASED", BUTTON2_RELEASED); |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
2563 SetDictInt("BUTTON2_CLICKED", BUTTON2_CLICKED); |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
2564 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
|
2565 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
|
2566 |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
2567 SetDictInt("BUTTON3_PRESSED", BUTTON3_PRESSED); |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
2568 SetDictInt("BUTTON3_RELEASED", BUTTON3_RELEASED); |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
2569 SetDictInt("BUTTON3_CLICKED", BUTTON3_CLICKED); |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
2570 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
|
2571 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
|
2572 |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
2573 SetDictInt("BUTTON4_PRESSED", BUTTON4_PRESSED); |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
2574 SetDictInt("BUTTON4_RELEASED", BUTTON4_RELEASED); |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
2575 SetDictInt("BUTTON4_CLICKED", BUTTON4_CLICKED); |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
2576 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
|
2577 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
|
2578 |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
2579 SetDictInt("BUTTON_SHIFT", BUTTON_SHIFT); |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
2580 SetDictInt("BUTTON_CTRL", BUTTON_CTRL); |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
2581 SetDictInt("BUTTON_ALT", BUTTON_ALT); |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
2582 |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
2583 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
|
2584 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
|
2585 #endif |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2586 /* 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
|
2587 { |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2588 int key; |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2589 char *key_n; |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2590 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
|
2591 #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
|
2592 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
|
2593 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
|
2594 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
|
2595 continue; |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2596 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
|
2597 char *p1, *p2; |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2598 key_n2 = malloc(strlen(key_n)+1); |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2599 p1 = key_n; |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2600 p2 = key_n2; |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2601 while (*p1) { |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2602 if (*p1 != '(' && *p1 != ')') { |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2603 *p2 = *p1; |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2604 p2++; |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2605 } |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2606 p1++; |
|
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 *p2 = (char)0; |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2609 } else |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2610 key_n2 = key_n; |
| 2357 | 2611 PyDict_SetItemString(d,key_n2,PyInt_FromLong((long) key)); |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2612 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
|
2613 free(key_n2); |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2614 } |
|
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
|
2615 #endif |
| 2357 | 2616 SetDictInt("KEY_MIN", KEY_MIN); |
| 2617 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
|
2618 } |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2619 } |
