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