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