Mercurial > cpython-lru_cache-weakref
annotate Modules/_cursesmodule.c @ 14541:561c0b1d514b legacy-trunk
Include a link to Francois's po-utils.
| author | Barry Warsaw <barry@python.org> |
|---|---|
| date | Wed, 13 Sep 2000 12:04:47 +0000 |
| parents | bea8f14e7d61 |
| children | 3abcb6966617 |
| rev | line source |
|---|---|
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1 /* |
|
12738
3d26cb3808a7
Changes by AMK: Use HAVE_NCURSES_H to include correct header file
Andrew M. Kuchling <amk@amk.ca>
parents:
12737
diff
changeset
|
2 * This is a curses module for Python. |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
3 * |
|
12738
3d26cb3808a7
Changes by AMK: Use HAVE_NCURSES_H to include correct header file
Andrew M. Kuchling <amk@amk.ca>
parents:
12737
diff
changeset
|
4 * Based on prior work by Lance Ellinghaus and Oliver Andrich |
|
3d26cb3808a7
Changes by AMK: Use HAVE_NCURSES_H to include correct header file
Andrew M. Kuchling <amk@amk.ca>
parents:
12737
diff
changeset
|
5 * Version 1.2 of this module: Copyright 1994 by Lance Ellinghouse, |
|
3d26cb3808a7
Changes by AMK: Use HAVE_NCURSES_H to include correct header file
Andrew M. Kuchling <amk@amk.ca>
parents:
12737
diff
changeset
|
6 * Cathedral City, California Republic, United States of America. |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
7 * |
|
12738
3d26cb3808a7
Changes by AMK: Use HAVE_NCURSES_H to include correct header file
Andrew M. Kuchling <amk@amk.ca>
parents:
12737
diff
changeset
|
8 * Version 1.5b1, heavily extended for ncurses by Oliver Andrich: |
|
3d26cb3808a7
Changes by AMK: Use HAVE_NCURSES_H to include correct header file
Andrew M. Kuchling <amk@amk.ca>
parents:
12737
diff
changeset
|
9 * Copyright 1996,1997 by Oliver Andrich, Koblenz, Germany. |
|
3d26cb3808a7
Changes by AMK: Use HAVE_NCURSES_H to include correct header file
Andrew M. Kuchling <amk@amk.ca>
parents:
12737
diff
changeset
|
10 * |
|
3d26cb3808a7
Changes by AMK: Use HAVE_NCURSES_H to include correct header file
Andrew M. Kuchling <amk@amk.ca>
parents:
12737
diff
changeset
|
11 * Tidied for Python 1.6, and currently maintained by AMK (amk1@bigfoot.com) |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
12 * |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
13 * Permission is hereby granted, free of charge, to any person obtaining |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
14 * a copy of this source file to use, copy, modify, merge, or publish it |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
15 * subject to the following conditions: |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
16 * |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
17 * The above copyright notice and this permission notice shall be included |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
18 * in all copies or in any new file that contains a substantial portion of |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
19 * this file. |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
20 * |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
21 * THE AUTHOR MAKES NO REPRESENTATIONS ABOUT THE SUITABILITY OF |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
22 * THE SOFTWARE FOR ANY PURPOSE. IT IS PROVIDED "AS IS" WITHOUT |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
23 * EXPRESS OR IMPLIED WARRANTY. THE AUTHOR DISCLAIMS ALL WARRANTIES |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
24 * WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
25 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
26 * NON-INFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
27 * AUTHOR BE LIABLE TO YOU OR ANY OTHER PARTY FOR ANY SPECIAL, |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
28 * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
29 * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE, STRICT LIABILITY OR |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
30 * ANY OTHER ACTION ARISING OUT OF OR IN CONNECTION WITH THE USE OR |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
31 * PERFORMANCE OF THIS SOFTWARE. |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
32 */ |
| 1858 | 33 |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
34 /* CVS: $Id$ */ |
| 1858 | 35 |
|
13728
b769e2dd6a51
Added list of missing functions as a comment
Andrew M. Kuchling <amk@amk.ca>
parents:
13721
diff
changeset
|
36 /* |
|
b769e2dd6a51
Added list of missing functions as a comment
Andrew M. Kuchling <amk@amk.ca>
parents:
13721
diff
changeset
|
37 |
|
b769e2dd6a51
Added list of missing functions as a comment
Andrew M. Kuchling <amk@amk.ca>
parents:
13721
diff
changeset
|
38 A number of SysV or ncurses functions don't have wrappers yet; if you need |
|
b769e2dd6a51
Added list of missing functions as a comment
Andrew M. Kuchling <amk@amk.ca>
parents:
13721
diff
changeset
|
39 a given function, add it and send a patch. Here's a list of currently |
|
b769e2dd6a51
Added list of missing functions as a comment
Andrew M. Kuchling <amk@amk.ca>
parents:
13721
diff
changeset
|
40 unsupported functions: |
|
b769e2dd6a51
Added list of missing functions as a comment
Andrew M. Kuchling <amk@amk.ca>
parents:
13721
diff
changeset
|
41 |
|
b769e2dd6a51
Added list of missing functions as a comment
Andrew M. Kuchling <amk@amk.ca>
parents:
13721
diff
changeset
|
42 addchnstr addchstr chgat color_set copywin define_key |
|
b769e2dd6a51
Added list of missing functions as a comment
Andrew M. Kuchling <amk@amk.ca>
parents:
13721
diff
changeset
|
43 del_curterm delscreen dupwin inchnstr inchstr innstr keyok |
|
b769e2dd6a51
Added list of missing functions as a comment
Andrew M. Kuchling <amk@amk.ca>
parents:
13721
diff
changeset
|
44 mcprint mvaddchnstr mvaddchstr mvchgat mvcur mvinchnstr |
|
b769e2dd6a51
Added list of missing functions as a comment
Andrew M. Kuchling <amk@amk.ca>
parents:
13721
diff
changeset
|
45 mvinchstr mvinnstr mmvwaddchnstr mvwaddchstr mvwchgat |
|
b769e2dd6a51
Added list of missing functions as a comment
Andrew M. Kuchling <amk@amk.ca>
parents:
13721
diff
changeset
|
46 mvwgetnstr mvwinchnstr mvwinchstr mvwinnstr napms newterm |
|
b769e2dd6a51
Added list of missing functions as a comment
Andrew M. Kuchling <amk@amk.ca>
parents:
13721
diff
changeset
|
47 overlay overwrite resetty resizeterm restartterm ripoffline |
|
b769e2dd6a51
Added list of missing functions as a comment
Andrew M. Kuchling <amk@amk.ca>
parents:
13721
diff
changeset
|
48 savetty scr_dump scr_init scr_restore scr_set scrl set_curterm |
|
b769e2dd6a51
Added list of missing functions as a comment
Andrew M. Kuchling <amk@amk.ca>
parents:
13721
diff
changeset
|
49 set_term setterm setupterm tgetent tgetflag tgetnum tgetstr |
|
b769e2dd6a51
Added list of missing functions as a comment
Andrew M. Kuchling <amk@amk.ca>
parents:
13721
diff
changeset
|
50 tgoto timeout tparm tputs tputs typeahead use_default_colors |
|
b769e2dd6a51
Added list of missing functions as a comment
Andrew M. Kuchling <amk@amk.ca>
parents:
13721
diff
changeset
|
51 vidattr vidputs waddchnstr waddchstr wchgat wcolor_set |
|
b769e2dd6a51
Added list of missing functions as a comment
Andrew M. Kuchling <amk@amk.ca>
parents:
13721
diff
changeset
|
52 winchnstr winchstr winnstr wmouse_trafo wredrawln wscrl |
|
b769e2dd6a51
Added list of missing functions as a comment
Andrew M. Kuchling <amk@amk.ca>
parents:
13721
diff
changeset
|
53 wtimeout |
|
b769e2dd6a51
Added list of missing functions as a comment
Andrew M. Kuchling <amk@amk.ca>
parents:
13721
diff
changeset
|
54 |
|
b769e2dd6a51
Added list of missing functions as a comment
Andrew M. Kuchling <amk@amk.ca>
parents:
13721
diff
changeset
|
55 Low-priority: |
|
b769e2dd6a51
Added list of missing functions as a comment
Andrew M. Kuchling <amk@amk.ca>
parents:
13721
diff
changeset
|
56 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
|
57 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
|
58 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
|
59 |
|
b769e2dd6a51
Added list of missing functions as a comment
Andrew M. Kuchling <amk@amk.ca>
parents:
13721
diff
changeset
|
60 */ |
|
b769e2dd6a51
Added list of missing functions as a comment
Andrew M. Kuchling <amk@amk.ca>
parents:
13721
diff
changeset
|
61 |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
62 /* Release Number */ |
| 1858 | 63 |
|
12738
3d26cb3808a7
Changes by AMK: Use HAVE_NCURSES_H to include correct header file
Andrew M. Kuchling <amk@amk.ca>
parents:
12737
diff
changeset
|
64 char *PyCursesVersion = "1.6"; |
| 1858 | 65 |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
66 /* Includes */ |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
67 |
|
1888
be956b1efb97
* various modules: #include "Python.h" and remove most remporary
Guido van Rossum <guido@python.org>
parents:
1867
diff
changeset
|
68 #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
|
69 |
|
13040
12ac2c267b93
Fixes for compiling on Tru64.
Andrew M. Kuchling <amk@amk.ca>
parents:
13039
diff
changeset
|
70 #ifdef __osf__ |
|
12ac2c267b93
Fixes for compiling on Tru64.
Andrew M. Kuchling <amk@amk.ca>
parents:
13039
diff
changeset
|
71 #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
|
72 #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
|
73 #endif |
|
12ac2c267b93
Fixes for compiling on Tru64.
Andrew M. Kuchling <amk@amk.ca>
parents:
13039
diff
changeset
|
74 |
|
12738
3d26cb3808a7
Changes by AMK: Use HAVE_NCURSES_H to include correct header file
Andrew M. Kuchling <amk@amk.ca>
parents:
12737
diff
changeset
|
75 #ifdef HAVE_NCURSES_H |
|
3d26cb3808a7
Changes by AMK: Use HAVE_NCURSES_H to include correct header file
Andrew M. Kuchling <amk@amk.ca>
parents:
12737
diff
changeset
|
76 #include <ncurses.h> |
|
3d26cb3808a7
Changes by AMK: Use HAVE_NCURSES_H to include correct header file
Andrew M. Kuchling <amk@amk.ca>
parents:
12737
diff
changeset
|
77 #else |
|
3d26cb3808a7
Changes by AMK: Use HAVE_NCURSES_H to include correct header file
Andrew M. Kuchling <amk@amk.ca>
parents:
12737
diff
changeset
|
78 #include <curses.h> |
|
3d26cb3808a7
Changes by AMK: Use HAVE_NCURSES_H to include correct header file
Andrew M. Kuchling <amk@amk.ca>
parents:
12737
diff
changeset
|
79 #endif |
|
3d26cb3808a7
Changes by AMK: Use HAVE_NCURSES_H to include correct header file
Andrew M. Kuchling <amk@amk.ca>
parents:
12737
diff
changeset
|
80 |
|
3d26cb3808a7
Changes by AMK: Use HAVE_NCURSES_H to include correct header file
Andrew M. Kuchling <amk@amk.ca>
parents:
12737
diff
changeset
|
81 #if defined(__sgi__) || defined(__sun__) |
|
13708
fe89ea1c9108
Modified version of patch #100963 from Mark Favas: has_key() is an
Andrew M. Kuchling <amk@amk.ca>
parents:
13706
diff
changeset
|
82 #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
|
83 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
|
84 #endif |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
85 |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
86 /* 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
|
87 |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
88 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
|
89 |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
90 /* general error messages */ |
| 2357 | 91 static char *catchall_ERR = "curses function returned ERR"; |
| 92 static char *catchall_NULL = "curses function returned NULL"; | |
| 93 | |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
94 /* 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
|
95 static int initialised = FALSE; |
|
73eeff4d43f8
more fixes by Steve Clift
Guido van Rossum <guido@python.org>
parents:
2358
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 /* Tells whether start_color() has been called to initialise colorusage. */ |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
98 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
|
99 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
100 /* Utility Macros */ |
| 2357 | 101 #define ARG_COUNT(X) \ |
| 102 (((X) == NULL) ? 0 : (PyTuple_Check(X) ? PyTuple_Size(X) : 1)) | |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
103 |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
104 #define PyCursesInitialised \ |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
105 if (initialised != TRUE) { \ |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
106 PyErr_SetString(PyCursesError, \ |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
107 "must call initscr() first"); \ |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
108 return NULL; } |
| 2357 | 109 |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
110 #define PyCursesInitialisedColor \ |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
111 if (initialisedcolors != TRUE) { \ |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
112 PyErr_SetString(PyCursesError, \ |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
113 "must call start_color() first"); \ |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
114 return NULL; } |
| 2357 | 115 |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
116 /* Utility Functions */ |
| 1858 | 117 |
| 2357 | 118 /* |
| 119 * Check the return code from a curses function and return None | |
| 120 * or raise an exception as appropriate. | |
| 121 */ | |
| 122 | |
| 123 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
|
124 PyCursesCheckERR(int code, char *fname) |
| 2357 | 125 { |
| 126 if (code != ERR) { | |
| 127 Py_INCREF(Py_None); | |
| 128 return Py_None; | |
| 129 } else { | |
| 130 if (fname == NULL) { | |
| 131 PyErr_SetString(PyCursesError, catchall_ERR); | |
| 132 } 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
|
133 PyErr_Format(PyCursesError, "%s() returned ERR", fname); |
| 2357 | 134 } |
| 135 return NULL; | |
| 136 } | |
| 137 } | |
| 138 | |
|
12738
3d26cb3808a7
Changes by AMK: Use HAVE_NCURSES_H to include correct header file
Andrew M. Kuchling <amk@amk.ca>
parents:
12737
diff
changeset
|
139 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
|
140 PyCurses_ConvertToChtype(PyObject *obj, chtype *ch) |
|
2423
73eeff4d43f8
more fixes by Steve Clift
Guido van Rossum <guido@python.org>
parents:
2358
diff
changeset
|
141 { |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
142 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
|
143 *ch = (chtype) PyInt_AsLong(obj); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
144 } else if(PyString_Check(obj) & |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
145 (PyString_Size(obj) == 1)) { |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
146 *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
|
147 } else { |
|
2423
73eeff4d43f8
more fixes by Steve Clift
Guido van Rossum <guido@python.org>
parents:
2358
diff
changeset
|
148 return 0; |
|
73eeff4d43f8
more fixes by Steve Clift
Guido van Rossum <guido@python.org>
parents:
2358
diff
changeset
|
149 } |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
150 return 1; |
|
2423
73eeff4d43f8
more fixes by Steve Clift
Guido van Rossum <guido@python.org>
parents:
2358
diff
changeset
|
151 } |
|
73eeff4d43f8
more fixes by Steve Clift
Guido van Rossum <guido@python.org>
parents:
2358
diff
changeset
|
152 |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
153 /***************************************************************************** |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
154 The Window Object |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
155 ******************************************************************************/ |
|
2423
73eeff4d43f8
more fixes by Steve Clift
Guido van Rossum <guido@python.org>
parents:
2358
diff
changeset
|
156 |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
157 /* Definition of the window object and window type */ |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
158 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
159 typedef struct { |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
160 PyObject_HEAD |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
161 WINDOW *win; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
162 } PyCursesWindowObject; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
163 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
164 PyTypeObject PyCursesWindow_Type; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
165 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
166 #define PyCursesWindow_Check(v) ((v)->ob_type == &PyCursesWindow_Type) |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
167 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
168 /* Function Prototype Macros - They are ugly but very, very useful. ;-) |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
169 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
170 X - function name |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
171 TYPE - parameter Type |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
172 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
|
173 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
|
174 */ |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
175 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
176 #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
|
177 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
|
178 { 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
|
179 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
|
180 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
181 #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
|
182 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
|
183 { \ |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
184 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
|
185 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
|
186 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
|
187 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
188 #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
|
189 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
|
190 { \ |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
191 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
|
192 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
|
193 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
194 #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
|
195 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
|
196 { \ |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
197 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
|
198 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
|
199 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
|
200 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
201 #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
|
202 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
|
203 { \ |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
204 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
|
205 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
|
206 X(self->win,arg1); Py_INCREF(Py_None); return Py_None; } |
| 2357 | 207 |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
208 #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
|
209 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
|
210 { \ |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
211 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
|
212 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
|
213 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
|
214 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
215 #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
|
216 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
|
217 { \ |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
218 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
|
219 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
|
220 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
|
221 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
222 /* ------------- WINDOW routines --------------- */ |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
223 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
224 Window_NoArgNoReturnFunction(untouchwin) |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
225 Window_NoArgNoReturnFunction(touchwin) |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
226 Window_NoArgNoReturnFunction(redrawwin) |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
227 Window_NoArgNoReturnFunction(winsertln) |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
228 Window_NoArgNoReturnFunction(werase) |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
229 Window_NoArgNoReturnFunction(wdeleteln) |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
230 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
231 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
|
232 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
233 Window_NoArgNoReturnVoidFunction(wsyncup) |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
234 Window_NoArgNoReturnVoidFunction(wsyncdown) |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
235 Window_NoArgNoReturnVoidFunction(wstandend) |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
236 Window_NoArgNoReturnVoidFunction(wstandout) |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
237 Window_NoArgNoReturnVoidFunction(wcursyncup) |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
238 Window_NoArgNoReturnVoidFunction(wclrtoeol) |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
239 Window_NoArgNoReturnVoidFunction(wclrtobot) |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
240 Window_NoArgNoReturnVoidFunction(wclear) |
|
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 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
|
243 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
|
244 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
|
245 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
246 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
|
247 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
|
248 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
|
249 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
|
250 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
251 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
|
252 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
|
253 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
|
254 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
|
255 Window_OneArgNoReturnFunction(idlok, 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
|
256 Window_OneArgNoReturnFunction(keypad, 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
|
257 Window_OneArgNoReturnFunction(leaveok, 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
|
258 Window_OneArgNoReturnFunction(nodelay, 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
|
259 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
|
260 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
|
261 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
|
262 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
|
263 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
264 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
|
265 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
|
266 Window_TwoArgNoReturnFunction(wmove, int, "(ii);y,x") |
|
13040
12ac2c267b93
Fixes for compiling on Tru64.
Andrew M. Kuchling <amk@amk.ca>
parents:
13039
diff
changeset
|
267 #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
|
268 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
|
269 #endif |
| 2357 | 270 |
|
12738
3d26cb3808a7
Changes by AMK: Use HAVE_NCURSES_H to include correct header file
Andrew M. Kuchling <amk@amk.ca>
parents:
12737
diff
changeset
|
271 /* Allocation and deallocation of Window Objects */ |
| 2357 | 272 |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
273 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
|
274 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
|
275 { |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
276 PyCursesWindowObject *wo; |
| 2357 | 277 |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
278 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
|
279 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
|
280 wo->win = win; |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
281 return (PyObject *)wo; |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
282 } |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
283 |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
284 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
|
285 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
|
286 { |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
287 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
|
288 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
|
289 } |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
290 |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
291 /* 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
|
292 |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
293 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
|
294 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
|
295 { |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
296 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
|
297 PyObject *temp; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
298 chtype ch = 0; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
299 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
|
300 |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
301 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
|
302 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
|
303 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
|
304 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
305 break; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
306 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
|
307 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
|
308 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
309 break; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
310 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
|
311 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
|
312 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
313 use_xy = TRUE; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
314 break; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
315 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
|
316 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
|
317 &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
|
318 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
319 use_xy = TRUE; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
320 break; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
321 default: |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
322 PyErr_SetString(PyExc_TypeError, "addch requires 1 or 4 arguments"); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
323 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
324 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
325 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
326 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
|
327 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
|
328 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
329 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
330 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
331 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
|
332 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
|
333 else { |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
334 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
|
335 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
336 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
|
337 } |
|
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 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
|
340 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
|
341 { |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
342 int rtn; |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
343 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
|
344 char *str; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
345 attr_t attr = A_NORMAL , attr_old = A_NORMAL; |
| 2357 | 346 int use_xy = FALSE, use_attr = FALSE; |
| 347 | |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
348 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
|
349 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
|
350 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
|
351 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
352 break; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
353 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
|
354 if (!PyArg_Parse(args,"(sl);str,attr", &str, &attr)) |
| 2357 | 355 return NULL; |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
356 use_attr = TRUE; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
357 break; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
358 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
|
359 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
|
360 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
361 use_xy = TRUE; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
362 break; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
363 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
|
364 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
|
365 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
366 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
|
367 break; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
368 default: |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
369 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
|
370 return NULL; |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
371 } |
| 2357 | 372 |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
373 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
|
374 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
|
375 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
|
376 } |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
377 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
|
378 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
|
379 else |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
380 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
|
381 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
|
382 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
|
383 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
|
384 } |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
385 |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
386 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
|
387 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
|
388 { |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
389 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
|
390 char *str; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
391 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
|
392 int use_xy = FALSE, use_attr = FALSE; |
| 2357 | 393 |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
394 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
|
395 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
|
396 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
|
397 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
398 break; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
399 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
|
400 if (!PyArg_Parse(args,"(sil);str,n,attr", &str, &n, &attr)) |
| 2357 | 401 return NULL; |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
402 use_attr = TRUE; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
403 break; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
404 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
|
405 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
|
406 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
407 use_xy = TRUE; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
408 break; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
409 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
|
410 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
|
411 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
412 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
|
413 break; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
414 default: |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
415 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
|
416 return NULL; |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
417 } |
| 2357 | 418 |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
419 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
|
420 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
|
421 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
|
422 } |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
423 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
|
424 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
|
425 else |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
426 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
|
427 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
|
428 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
|
429 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
|
430 } |
| 2357 | 431 |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
432 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
|
433 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
|
434 { |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
435 PyObject *temp; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
436 chtype bkgd; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
437 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
|
438 |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
439 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
|
440 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
|
441 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
|
442 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
443 break; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
444 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
|
445 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
|
446 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
447 break; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
448 default: |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
449 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
|
450 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
451 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
452 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
453 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
|
454 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
|
455 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
456 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
457 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
458 return PyCursesCheckERR(wbkgd(self->win, bkgd | A_NORMAL), "bkgd"); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
459 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
460 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
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_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
|
463 { |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
464 PyObject *temp; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
465 chtype bkgd; |
|
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; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
467 |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
468 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
|
469 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
|
470 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
|
471 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
472 break; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
473 case 2: |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
474 if (!PyArg_Parse(args,"(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
|
475 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
476 break; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
477 default: |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
478 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
|
479 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
480 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
481 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
482 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
|
483 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
|
484 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
485 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
486 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
487 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
|
488 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
|
489 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
490 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
491 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
|
492 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
|
493 { |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
494 chtype ls, rs, ts, bs, tl, tr, bl, br; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
495 ls = rs = ts = bs = tl = tr = bl = br = 0; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
496 if (!PyArg_Parse(args,"|llllllll;ls,rs,ts,bs,tl,tr,bl,br", |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
497 &ls, &rs, &ts, &bs, &tl, &tr, &bl, &br)) |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
498 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
499 wborder(self->win, ls, rs, ts, bs, tl, tr, bl, br); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
500 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
|
501 return Py_None; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
502 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
503 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
504 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
|
505 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
|
506 { |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
507 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
|
508 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
|
509 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
|
510 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
|
511 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
512 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
513 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
|
514 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
|
515 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
|
516 } |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
517 |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
518 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
|
519 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
|
520 { |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
521 int rtn; |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
522 int x, y; |
| 2357 | 523 |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
524 switch (ARG_COUNT(args)) { |
| 2357 | 525 case 0: |
| 526 rtn = wdelch(self->win); | |
| 527 break; | |
| 528 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
|
529 if (!PyArg_Parse(args,"(ii);y,x", &y, &x)) |
| 2357 | 530 return NULL; |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
531 rtn = mvwdelch(self->win,y,x); |
| 2357 | 532 break; |
| 533 default: | |
| 534 PyErr_SetString(PyExc_TypeError, "delch requires 0 or 2 arguments"); | |
| 535 return NULL; | |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
536 } |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
537 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
|
538 } |
| 2357 | 539 |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
540 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
|
541 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
|
542 { |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
543 WINDOW *win; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
544 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
|
545 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
546 nlines = 0; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
547 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
|
548 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
|
549 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
|
550 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
|
551 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
552 break; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
553 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
|
554 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
|
555 &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
|
556 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
557 break; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
558 default: |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
559 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
|
560 return NULL; |
|
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 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
563 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
|
564 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
565 if (win == NULL) { |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
566 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
|
567 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
568 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
569 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
570 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
|
571 } |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
572 |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
573 static PyObject * |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
574 PyCursesWindow_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
|
575 { |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
576 PyObject *temp; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
577 chtype ch; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
578 attr_t attr = A_NORMAL; |
| 2357 | 579 |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
580 switch (ARG_COUNT(args)) { |
| 2357 | 581 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
|
582 if (!PyArg_Parse(args,"O;ch or int", &temp)) |
| 2357 | 583 return NULL; |
| 584 break; | |
| 585 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
|
586 if (!PyArg_Parse(args,"(Ol);ch or int,attr", &temp, &attr)) |
| 2357 | 587 return NULL; |
| 588 break; | |
| 589 default: | |
| 590 PyErr_SetString(PyExc_TypeError, "echochar requires 1 or 2 arguments"); | |
| 591 | |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
592 |
| 2357 | 593 return NULL; |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
594 } |
| 2357 | 595 |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
596 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
|
597 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
|
598 return NULL; |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
599 } |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
600 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
601 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
|
602 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
|
603 "echochar"); |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
604 else |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
605 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
|
606 "echochar"); |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
607 } |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
608 |
|
13036
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
609 #ifdef NCURSES_MOUSE_VERSION |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
610 static PyObject * |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
611 PyCursesWindow_Enclose(PyCursesWindowObject *self, PyObject *args) |
|
13036
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
612 { |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
613 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
|
614 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
|
615 return NULL; |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
616 |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
617 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
|
618 } |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
619 #endif |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
620 |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
621 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
|
622 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
|
623 { |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
624 if (!PyArg_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
|
625 return NULL; |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
626 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
|
627 } |
|
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 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
|
630 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
|
631 { |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
632 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
|
633 chtype rtn; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
634 |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
635 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
|
636 case 0: |
|
12988
0eb531ce08d1
Release the global interpreter lock around the most important
Andrew M. Kuchling <amk@amk.ca>
parents:
12974
diff
changeset
|
637 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
|
638 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
|
639 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
|
640 break; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
641 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
|
642 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
|
643 return NULL; |
|
12988
0eb531ce08d1
Release the global interpreter lock around the most important
Andrew M. Kuchling <amk@amk.ca>
parents:
12974
diff
changeset
|
644 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
|
645 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
|
646 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
|
647 break; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
648 default: |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
649 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
|
650 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
651 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
652 return PyInt_FromLong(rtn); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
653 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
654 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
655 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
|
656 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
|
657 { |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
658 int x, y; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
659 chtype rtn; |
| 2357 | 660 |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
661 switch (ARG_COUNT(args)) { |
| 2357 | 662 case 0: |
|
12988
0eb531ce08d1
Release the global interpreter lock around the most important
Andrew M. Kuchling <amk@amk.ca>
parents:
12974
diff
changeset
|
663 Py_BEGIN_ALLOW_THREADS |
| 2357 | 664 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
|
665 Py_END_ALLOW_THREADS |
| 2357 | 666 break; |
| 667 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
|
668 if (!PyArg_Parse(args,"(ii);y,x",&y,&x)) |
| 2357 | 669 return NULL; |
|
12988
0eb531ce08d1
Release the global interpreter lock around the most important
Andrew M. Kuchling <amk@amk.ca>
parents:
12974
diff
changeset
|
670 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
|
671 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
|
672 Py_END_ALLOW_THREADS |
| 2357 | 673 break; |
| 674 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
|
675 PyErr_SetString(PyExc_TypeError, "getkey requires 0 or 2 arguments"); |
| 2357 | 676 return NULL; |
| 677 } | |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
678 if (rtn<=255) |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
679 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
|
680 else |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
681 return PyString_FromString((char *)keyname(rtn)); |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
682 } |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
683 |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
684 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
|
685 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
|
686 { |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
687 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
|
688 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
|
689 int rtn2; |
| 2357 | 690 |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
691 switch (ARG_COUNT(args)) { |
| 2357 | 692 case 0: |
|
12988
0eb531ce08d1
Release the global interpreter lock around the most important
Andrew M. Kuchling <amk@amk.ca>
parents:
12974
diff
changeset
|
693 Py_BEGIN_ALLOW_THREADS |
| 2357 | 694 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
|
695 Py_END_ALLOW_THREADS |
| 2357 | 696 break; |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
697 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
|
698 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
|
699 return NULL; |
|
12988
0eb531ce08d1
Release the global interpreter lock around the most important
Andrew M. Kuchling <amk@amk.ca>
parents:
12974
diff
changeset
|
700 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
|
701 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
|
702 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
|
703 break; |
| 2357 | 704 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
|
705 if (!PyArg_Parse(args,"(ii);y,x",&y,&x)) |
| 2357 | 706 return NULL; |
|
12988
0eb531ce08d1
Release the global interpreter lock around the most important
Andrew M. Kuchling <amk@amk.ca>
parents:
12974
diff
changeset
|
707 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
|
708 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
|
709 Py_END_ALLOW_THREADS |
| 2357 | 710 break; |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
711 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
|
712 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
|
713 return NULL; |
|
13040
12ac2c267b93
Fixes for compiling on Tru64.
Andrew M. Kuchling <amk@amk.ca>
parents:
13039
diff
changeset
|
714 #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
|
715 /* Untested */ |
|
12988
0eb531ce08d1
Release the global interpreter lock around the most important
Andrew M. Kuchling <amk@amk.ca>
parents:
12974
diff
changeset
|
716 Py_BEGIN_ALLOW_THREADS |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
717 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
|
718 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
|
719 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
|
720 #else |
|
12988
0eb531ce08d1
Release the global interpreter lock around the most important
Andrew M. Kuchling <amk@amk.ca>
parents:
12974
diff
changeset
|
721 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
|
722 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
|
723 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
|
724 #endif |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
725 break; |
| 2357 | 726 default: |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
727 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
|
728 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
729 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
730 if (rtn2 == ERR) |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
731 rtn[0] = 0; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
732 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
|
733 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
734 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
735 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
|
736 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
|
737 { |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
738 PyObject *temp; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
739 chtype ch; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
740 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
|
741 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
|
742 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
743 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
|
744 case 2: |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
745 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
|
746 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
747 break; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
748 case 3: |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
749 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
|
750 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
751 break; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
752 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
|
753 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
|
754 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
755 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
|
756 break; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
757 case 5: |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
758 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
|
759 &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
|
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 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
|
762 default: |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
763 PyErr_SetString(PyExc_TypeError, "hline requires 2 or 5 arguments"); |
| 2357 | 764 return NULL; |
| 765 } | |
| 766 | |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
767 if (code != ERR) { |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
768 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
|
769 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
|
770 "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
|
771 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
772 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
773 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
|
774 } else |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
775 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
|
776 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
777 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
778 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
|
779 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
|
780 { |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
781 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
|
782 PyObject *temp; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
783 chtype ch = 0; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
784 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
|
785 |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
786 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
|
787 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
|
788 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
|
789 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
790 break; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
791 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
|
792 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
|
793 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
794 break; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
795 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
|
796 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
|
797 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
798 use_xy = TRUE; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
799 break; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
800 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
|
801 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
|
802 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
803 use_xy = TRUE; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
804 break; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
805 default: |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
806 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
|
807 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
808 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
809 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
810 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
|
811 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
|
812 "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
|
813 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
814 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
815 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
816 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
|
817 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
|
818 else { |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
819 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
|
820 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
821 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
|
822 } |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
823 |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
824 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
|
825 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
|
826 { |
| 2357 | 827 int x, y, rtn; |
| 828 | |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
829 switch (ARG_COUNT(args)) { |
| 2357 | 830 case 0: |
| 831 rtn = winch(self->win); | |
| 832 break; | |
| 833 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
|
834 if (!PyArg_Parse(args,"(ii);y,x",&y,&x)) |
| 2357 | 835 return NULL; |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
836 rtn = mvwinch(self->win,y,x); |
| 2357 | 837 break; |
| 838 default: | |
| 839 PyErr_SetString(PyExc_TypeError, "inch requires 0 or 2 arguments"); | |
| 840 return NULL; | |
| 841 } | |
| 842 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
|
843 } |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
844 |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
845 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
|
846 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
|
847 { |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
848 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
|
849 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
|
850 int rtn2; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
851 |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
852 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
|
853 case 0: |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
854 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
|
855 break; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
856 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
|
857 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
|
858 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
859 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
|
860 break; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
861 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
|
862 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
|
863 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
864 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
|
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 3: |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
867 if (!PyArg_Parse(args, "(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
|
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 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
|
870 break; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
871 default: |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
872 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
|
873 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
874 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
875 if (rtn2 == ERR) |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
876 rtn[0] = 0; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
877 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
|
878 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
879 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
880 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
|
881 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
|
882 { |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
883 int rtn; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
884 int x, y; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
885 char *str; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
886 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
|
887 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
|
888 |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
889 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
|
890 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
|
891 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
|
892 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
893 break; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
894 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
|
895 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
|
896 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
897 use_attr = TRUE; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
898 break; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
899 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
|
900 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
|
901 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
902 use_xy = TRUE; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
903 break; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
904 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
|
905 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
|
906 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
907 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
|
908 break; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
909 default: |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
910 PyErr_SetString(PyExc_TypeError, "insstr requires 1 to 4 arguments"); |
| 2357 | 911 return NULL; |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
912 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
913 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
914 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
|
915 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
|
916 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
|
917 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
918 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
|
919 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
|
920 else |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
921 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
|
922 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
|
923 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
|
924 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
|
925 } |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
926 |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
927 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
|
928 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
|
929 { |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
930 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
|
931 char *str; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
932 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
|
933 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
|
934 |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
935 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
|
936 case 2: |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
937 if (!PyArg_Parse(args,"(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
|
938 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
939 break; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
940 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
|
941 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
|
942 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
943 use_attr = TRUE; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
944 break; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
945 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
|
946 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
|
947 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
948 use_xy = TRUE; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
949 break; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
950 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
|
951 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
|
952 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
953 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
|
954 break; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
955 default: |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
956 PyErr_SetString(PyExc_TypeError, "insnstr requires 2 to 5 arguments"); |
| 2357 | 957 return NULL; |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
958 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
959 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
960 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
|
961 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
|
962 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
|
963 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
964 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
|
965 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
|
966 else |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
967 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
|
968 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
|
969 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
|
970 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
|
971 } |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
972 |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
973 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
|
974 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
|
975 { |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
976 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
|
977 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
|
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 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
|
980 if (erg == ERR) { |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
981 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
|
982 "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
|
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 } else |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
985 if (erg == FALSE) { |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
986 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
|
987 return Py_False; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
988 } else { |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
989 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
|
990 return Py_True; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
991 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
992 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
993 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
994 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
|
995 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
|
996 { |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
997 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
|
998 int rtn; |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
999 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1000 if (self->win->_flags & _ISPAD) { |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
1001 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
|
1002 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
|
1003 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
|
1004 "(iiiiii);" \ |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1005 "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
|
1006 &pminrow, &pmincol, &sminrow, |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1007 &smincol, &smaxrow, &smaxcol)) |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1008 return NULL; |
|
12988
0eb531ce08d1
Release the global interpreter lock around the most important
Andrew M. Kuchling <amk@amk.ca>
parents:
12974
diff
changeset
|
1009 Py_BEGIN_ALLOW_THREADS |
|
0eb531ce08d1
Release the global interpreter lock around the most important
Andrew M. Kuchling <amk@amk.ca>
parents:
12974
diff
changeset
|
1010 rtn = pnoutrefresh(self->win, |
|
0eb531ce08d1
Release the global interpreter lock around the most important
Andrew M. Kuchling <amk@amk.ca>
parents:
12974
diff
changeset
|
1011 pminrow, pmincol, sminrow, |
|
13039
1c8c101f2be1
Fix two typos (, instead of ;)
Andrew M. Kuchling <amk@amk.ca>
parents:
13036
diff
changeset
|
1012 smincol, smaxrow, smaxcol); |
|
12988
0eb531ce08d1
Release the global interpreter lock around the most important
Andrew M. Kuchling <amk@amk.ca>
parents:
12974
diff
changeset
|
1013 Py_END_ALLOW_THREADS |
|
0eb531ce08d1
Release the global interpreter lock around the most important
Andrew M. Kuchling <amk@amk.ca>
parents:
12974
diff
changeset
|
1014 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
|
1015 default: |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1016 PyErr_SetString(PyCursesError, |
|
12988
0eb531ce08d1
Release the global interpreter lock around the most important
Andrew M. Kuchling <amk@amk.ca>
parents:
12974
diff
changeset
|
1017 "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
|
1018 "requires 6 arguments"); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1019 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1020 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1021 } else { |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
1022 if (!PyArg_NoArgs(args)) |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1023 return NULL; |
|
12988
0eb531ce08d1
Release the global interpreter lock around the most important
Andrew M. Kuchling <amk@amk.ca>
parents:
12974
diff
changeset
|
1024 |
|
0eb531ce08d1
Release the global interpreter lock around the most important
Andrew M. Kuchling <amk@amk.ca>
parents:
12974
diff
changeset
|
1025 Py_BEGIN_ALLOW_THREADS |
|
0eb531ce08d1
Release the global interpreter lock around the most important
Andrew M. Kuchling <amk@amk.ca>
parents:
12974
diff
changeset
|
1026 rtn = wnoutrefresh(self->win); |
|
0eb531ce08d1
Release the global interpreter lock around the most important
Andrew M. Kuchling <amk@amk.ca>
parents:
12974
diff
changeset
|
1027 Py_END_ALLOW_THREADS |
|
0eb531ce08d1
Release the global interpreter lock around the most important
Andrew M. Kuchling <amk@amk.ca>
parents:
12974
diff
changeset
|
1028 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
|
1029 } |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1030 } |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1031 |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1032 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
|
1033 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
|
1034 { |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1035 PyObject *temp; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1036 |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
1037 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
|
1038 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1039 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
|
1040 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
|
1041 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1042 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1043 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
|
1044 "putwin"); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1045 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1046 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1047 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
|
1048 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
|
1049 { |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1050 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
|
1051 if (!PyArg_Parse(args,"(ii);beg,num", &beg, &num)) |
| 2357 | 1052 return NULL; |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1053 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
|
1054 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1055 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1056 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
|
1057 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
|
1058 { |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1059 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
|
1060 int rtn; |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1061 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1062 if (self->win->_flags & _ISPAD) { |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
1063 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
|
1064 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
|
1065 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
|
1066 "(iiiiii);" \ |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1067 "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
|
1068 &pminrow, &pmincol, &sminrow, |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1069 &smincol, &smaxrow, &smaxcol)) |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1070 return NULL; |
|
12988
0eb531ce08d1
Release the global interpreter lock around the most important
Andrew M. Kuchling <amk@amk.ca>
parents:
12974
diff
changeset
|
1071 |
|
0eb531ce08d1
Release the global interpreter lock around the most important
Andrew M. Kuchling <amk@amk.ca>
parents:
12974
diff
changeset
|
1072 Py_BEGIN_ALLOW_THREADS |
|
0eb531ce08d1
Release the global interpreter lock around the most important
Andrew M. Kuchling <amk@amk.ca>
parents:
12974
diff
changeset
|
1073 rtn = prefresh(self->win, |
|
0eb531ce08d1
Release the global interpreter lock around the most important
Andrew M. Kuchling <amk@amk.ca>
parents:
12974
diff
changeset
|
1074 pminrow, pmincol, sminrow, |
|
13039
1c8c101f2be1
Fix two typos (, instead of ;)
Andrew M. Kuchling <amk@amk.ca>
parents:
13036
diff
changeset
|
1075 smincol, smaxrow, smaxcol); |
|
12988
0eb531ce08d1
Release the global interpreter lock around the most important
Andrew M. Kuchling <amk@amk.ca>
parents:
12974
diff
changeset
|
1076 Py_END_ALLOW_THREADS |
|
0eb531ce08d1
Release the global interpreter lock around the most important
Andrew M. Kuchling <amk@amk.ca>
parents:
12974
diff
changeset
|
1077 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
|
1078 default: |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1079 PyErr_SetString(PyCursesError, |
|
12988
0eb531ce08d1
Release the global interpreter lock around the most important
Andrew M. Kuchling <amk@amk.ca>
parents:
12974
diff
changeset
|
1080 "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
|
1081 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1082 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1083 } else { |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
1084 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
|
1085 return NULL; |
|
12988
0eb531ce08d1
Release the global interpreter lock around the most important
Andrew M. Kuchling <amk@amk.ca>
parents:
12974
diff
changeset
|
1086 Py_BEGIN_ALLOW_THREADS |
|
0eb531ce08d1
Release the global interpreter lock around the most important
Andrew M. Kuchling <amk@amk.ca>
parents:
12974
diff
changeset
|
1087 rtn = wrefresh(self->win); |
|
0eb531ce08d1
Release the global interpreter lock around the most important
Andrew M. Kuchling <amk@amk.ca>
parents:
12974
diff
changeset
|
1088 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
|
1089 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
|
1090 } |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1091 } |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1092 |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1093 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
|
1094 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
|
1095 { |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1096 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
|
1097 if (!PyArg_Parse(args,"(ii);top, bottom",&y,&x)) |
| 2357 | 1098 return NULL; |
| 1099 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
|
1100 } |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1101 |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1102 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
|
1103 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
|
1104 { |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1105 WINDOW *win; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1106 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
|
1107 |
|
12738
3d26cb3808a7
Changes by AMK: Use HAVE_NCURSES_H to include correct header file
Andrew M. Kuchling <amk@amk.ca>
parents:
12737
diff
changeset
|
1108 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
|
1109 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
|
1110 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
|
1111 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
|
1112 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
|
1113 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
|
1114 break; |
|
3d26cb3808a7
Changes by AMK: Use HAVE_NCURSES_H to include correct header file
Andrew M. Kuchling <amk@amk.ca>
parents:
12737
diff
changeset
|
1115 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
|
1116 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
|
1117 &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
|
1118 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
|
1119 break; |
|
3d26cb3808a7
Changes by AMK: Use HAVE_NCURSES_H to include correct header file
Andrew M. Kuchling <amk@amk.ca>
parents:
12737
diff
changeset
|
1120 default: |
|
3d26cb3808a7
Changes by AMK: Use HAVE_NCURSES_H to include correct header file
Andrew M. Kuchling <amk@amk.ca>
parents:
12737
diff
changeset
|
1121 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
|
1122 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
|
1123 } |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1124 |
|
13721
05d59f4476ad
Comment out a debugging print (spotted by Michael Deegan)
Andrew M. Kuchling <amk@amk.ca>
parents:
13715
diff
changeset
|
1125 /* printf("Subwin: %i %i %i %i \n", 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
|
1126 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
|
1127 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
|
1128 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
|
1129 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
|
1130 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1131 if (win == NULL) { |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1132 PyErr_SetString(PyCursesError, catchall_NULL); |
| 2357 | 1133 return NULL; |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1134 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1135 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1136 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
|
1137 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1138 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1139 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
|
1140 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
|
1141 { |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1142 int lines; |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
1143 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
|
1144 case 0: |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1145 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
|
1146 break; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1147 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
|
1148 if (!PyArg_Parse(args, "i;lines", &lines)) |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1149 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1150 return PyCursesCheckERR(wscrl(self->win, lines), "scroll"); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1151 default: |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1152 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
|
1153 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1154 } |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1155 } |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1156 |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1157 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
|
1158 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
|
1159 { |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1160 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
|
1161 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
|
1162 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
|
1163 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
|
1164 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1165 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
|
1166 break; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1167 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
|
1168 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
|
1169 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1170 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
|
1171 default: |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1172 PyErr_SetString(PyExc_TypeError, "touchline requires 2 or 3 arguments"); |
| 2357 | 1173 return NULL; |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1174 } |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1175 } |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1176 |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1177 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
|
1178 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
|
1179 { |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1180 PyObject *temp; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1181 chtype ch; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1182 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
|
1183 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
|
1184 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1185 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
|
1186 case 2: |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1187 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
|
1188 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1189 break; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1190 case 3: |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1191 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
|
1192 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1193 break; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1194 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
|
1195 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
|
1196 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1197 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
|
1198 break; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1199 case 5: |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1200 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
|
1201 &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
|
1202 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1203 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
|
1204 default: |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1205 PyErr_SetString(PyExc_TypeError, "vline requires 2 or 5 arguments"); |
| 2357 | 1206 return NULL; |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1207 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1208 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1209 if (code != ERR) { |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1210 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
|
1211 PyErr_SetString(PyExc_TypeError, |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1212 "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
|
1213 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1214 } |
|
12738
3d26cb3808a7
Changes by AMK: Use HAVE_NCURSES_H to include correct header file
Andrew M. Kuchling <amk@amk.ca>
parents:
12737
diff
changeset
|
1215 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
|
1216 } else |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1217 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
|
1218 } |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1219 |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1220 static PyMethodDef PyCursesWindow_Methods[] = { |
|
2569
7a3733732901
Added some (method) casts.
Sjoerd Mullender <sjoerd@acm.org>
parents:
2423
diff
changeset
|
1221 {"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
|
1222 {"addnstr", (PyCFunction)PyCursesWindow_AddNStr}, |
|
2569
7a3733732901
Added some (method) casts.
Sjoerd Mullender <sjoerd@acm.org>
parents:
2423
diff
changeset
|
1223 {"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
|
1224 {"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
|
1225 {"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
|
1226 {"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
|
1227 {"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
|
1228 {"bkgdset", (PyCFunction)PyCursesWindow_BkgdSet}, |
|
2569
7a3733732901
Added some (method) casts.
Sjoerd Mullender <sjoerd@acm.org>
parents:
2423
diff
changeset
|
1229 {"border", (PyCFunction)PyCursesWindow_Border, METH_VARARGS}, |
|
7a3733732901
Added some (method) casts.
Sjoerd Mullender <sjoerd@acm.org>
parents:
2423
diff
changeset
|
1230 {"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
|
1231 {"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
|
1232 {"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
|
1233 {"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
|
1234 {"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
|
1235 {"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
|
1236 {"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
|
1237 {"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
|
1238 {"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
|
1239 {"echochar", (PyCFunction)PyCursesWindow_EchoChar}, |
|
13036
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
1240 #ifdef NCURSES_MOUSE_VERSION |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
1241 {"enclose", (PyCFunction)PyCursesWindow_Enclose}, |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
1242 #endif |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1243 {"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
|
1244 {"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
|
1245 {"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
|
1246 {"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
|
1247 {"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
|
1248 {"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
|
1249 {"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
|
1250 {"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
|
1251 {"getyx", (PyCFunction)PyCursesWindow_getyx}, |
|
2569
7a3733732901
Added some (method) casts.
Sjoerd Mullender <sjoerd@acm.org>
parents:
2423
diff
changeset
|
1252 {"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
|
1253 {"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
|
1254 {"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
|
1255 {"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
|
1256 {"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
|
1257 {"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
|
1258 {"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
|
1259 {"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
|
1260 {"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
|
1261 {"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
|
1262 {"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
|
1263 {"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
|
1264 {"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
|
1265 {"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
|
1266 {"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
|
1267 {"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
|
1268 {"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
|
1269 {"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
|
1270 {"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
|
1271 {"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
|
1272 {"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
|
1273 /* Backward compatibility alias -- remove in Python 2.1 */ |
|
606714fae1b5
Add alias for old function name -- removing it broke Alexei Gilchrist's cfm
Andrew M. Kuchling <amk@amk.ca>
parents:
13728
diff
changeset
|
1274 {"nooutrefresh", (PyCFunction)PyCursesWindow_NoOutRefresh}, |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1275 {"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
|
1276 {"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
|
1277 {"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
|
1278 {"refresh", (PyCFunction)PyCursesWindow_Refresh}, |
|
13040
12ac2c267b93
Fixes for compiling on Tru64.
Andrew M. Kuchling <amk@amk.ca>
parents:
13039
diff
changeset
|
1279 #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
|
1280 {"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
|
1281 #endif |
|
2569
7a3733732901
Added some (method) casts.
Sjoerd Mullender <sjoerd@acm.org>
parents:
2423
diff
changeset
|
1282 {"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
|
1283 {"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
|
1284 {"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
|
1285 {"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
|
1286 {"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
|
1287 {"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
|
1288 {"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
|
1289 {"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
|
1290 {"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
|
1291 {"syncup", (PyCFunction)PyCursesWindow_wsyncup}, |
|
12974
e7992d0d6808
Added .timeout() method and .typeahead() function
Andrew M. Kuchling <amk@amk.ca>
parents:
12913
diff
changeset
|
1292 {"timeout", (PyCFunction)PyCursesWindow_wtimeout}, |
|
2569
7a3733732901
Added some (method) casts.
Sjoerd Mullender <sjoerd@acm.org>
parents:
2423
diff
changeset
|
1293 {"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
|
1294 {"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
|
1295 {"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
|
1296 {"vline", (PyCFunction)PyCursesWindow_Vline}, |
|
2423
73eeff4d43f8
more fixes by Steve Clift
Guido van Rossum <guido@python.org>
parents:
2358
diff
changeset
|
1297 {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
|
1298 }; |
|
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 static PyObject * |
|
13651
8a063423e0b7
Bunch of minor ANSIfications: 'void initfunc()' -> 'void initfunc(void)',
Thomas Wouters <thomas@python.org>
parents:
13465
diff
changeset
|
1301 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
|
1302 { |
|
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
|
1303 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
|
1304 } |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1305 |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1306 /* -------------------------------------------------------*/ |
| 2357 | 1307 |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1308 PyTypeObject PyCursesWindow_Type = { |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1309 PyObject_HEAD_INIT(&PyType_Type) |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1310 0, /*ob_size*/ |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1311 "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
|
1312 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
|
1313 0, /*tp_itemsize*/ |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1314 /* methods */ |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1315 (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
|
1316 0, /*tp_print*/ |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1317 (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
|
1318 (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
|
1319 0, /*tp_compare*/ |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1320 0, /*tp_repr*/ |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1321 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
|
1322 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
|
1323 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
|
1324 0, /*tp_hash*/ |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1325 }; |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1326 |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1327 /********************************************************************* |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1328 Global Functions |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1329 **********************************************************************/ |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1330 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1331 static PyObject *ModDict; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1332 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1333 /* Function Prototype Macros - They are ugly but very, very useful. ;-) |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1334 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1335 X - function name |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1336 TYPE - parameter Type |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1337 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
|
1338 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
|
1339 */ |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1340 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1341 #define 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
|
1342 static PyObject *PyCurses_ ## X (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
|
1343 { \ |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1344 PyCursesInitialised \ |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
1345 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
|
1346 return PyCursesCheckERR(X(), # X); } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1347 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1348 #define NoArgOrFlagNoReturnFunction(X) \ |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
1349 static PyObject *PyCurses_ ## X (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
|
1350 { \ |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1351 int flag = 0; \ |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1352 PyCursesInitialised \ |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
1353 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
|
1354 case 0: \ |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1355 return PyCursesCheckERR(X(), # X); \ |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1356 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
|
1357 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
|
1358 if (flag) return PyCursesCheckERR(X(), # X); \ |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1359 else return PyCursesCheckERR(no ## X (), # X); \ |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1360 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
|
1361 PyErr_SetString(PyExc_TypeError, # X " 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
|
1362 return NULL; } } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1363 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1364 #define NoArgReturnIntFunction(X) \ |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
1365 static PyObject *PyCurses_ ## X (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
|
1366 { \ |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1367 PyCursesInitialised \ |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
1368 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
|
1369 return PyInt_FromLong((long) X()); } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1370 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1371 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1372 #define NoArgReturnStringFunction(X) \ |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
1373 static PyObject *PyCurses_ ## X (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
|
1374 { \ |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1375 PyCursesInitialised \ |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
1376 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
|
1377 return PyString_FromString(X()); } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1378 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1379 #define 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
|
1380 static PyObject *PyCurses_ ## X (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
|
1381 { \ |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1382 PyCursesInitialised \ |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
1383 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
|
1384 if (X () == FALSE) { \ |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1385 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
|
1386 return Py_False; \ |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1387 } \ |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1388 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
|
1389 return Py_True; } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1390 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1391 #define 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
|
1392 static PyObject *PyCurses_ ## X (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
|
1393 { \ |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1394 PyCursesInitialised \ |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
1395 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
|
1396 X(); \ |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1397 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
|
1398 return Py_None; } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1399 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1400 NoArgNoReturnFunction(beep) |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1401 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
|
1402 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
|
1403 NoArgNoReturnFunction(doupdate) |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1404 NoArgNoReturnFunction(endwin) |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1405 NoArgNoReturnFunction(flash) |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1406 NoArgNoReturnFunction(nocbreak) |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1407 NoArgNoReturnFunction(noecho) |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1408 NoArgNoReturnFunction(nonl) |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1409 NoArgNoReturnFunction(noraw) |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1410 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
|
1411 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
|
1412 NoArgNoReturnFunction(resetty) |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1413 NoArgNoReturnFunction(savetty) |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1414 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1415 NoArgOrFlagNoReturnFunction(cbreak) |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1416 NoArgOrFlagNoReturnFunction(echo) |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1417 NoArgOrFlagNoReturnFunction(nl) |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1418 NoArgOrFlagNoReturnFunction(raw) |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1419 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1420 NoArgReturnIntFunction(baudrate) |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1421 NoArgReturnIntFunction(termattrs) |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1422 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1423 NoArgReturnStringFunction(termname) |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1424 NoArgReturnStringFunction(longname) |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1425 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1426 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
|
1427 NoArgTrueFalseFunction(has_colors) |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1428 NoArgTrueFalseFunction(has_ic) |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1429 NoArgTrueFalseFunction(has_il) |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1430 NoArgTrueFalseFunction(isendwin) |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1431 NoArgNoReturnVoidFunction(filter) |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1432 NoArgNoReturnVoidFunction(flushinp) |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1433 NoArgNoReturnVoidFunction(noqiflush) |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1434 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1435 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
|
1436 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
|
1437 { |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1438 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
|
1439 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1440 PyCursesInitialised |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1441 PyCursesInitialisedColor |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1442 |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
1443 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
|
1444 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
|
1445 "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
|
1446 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1447 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1448 |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
1449 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
|
1450 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1451 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
|
1452 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
|
1453 else { |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1454 PyErr_SetString(PyCursesError, |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1455 "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
|
1456 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1457 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1458 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1459 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1460 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
|
1461 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
|
1462 { |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1463 int n; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1464 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1465 PyCursesInitialised |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1466 PyCursesInitialisedColor |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1467 |
|
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
|
1468 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
|
1469 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
|
1470 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1471 } |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
1472 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
|
1473 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
|
1474 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1475 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1476 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
|
1477 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
|
1478 { |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1479 int vis,erg; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1480 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1481 PyCursesInitialised |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1482 |
|
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
|
1483 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
|
1484 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
|
1485 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1486 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1487 |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
1488 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
|
1489 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1490 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
|
1491 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
|
1492 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1493 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
|
1494 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1495 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1496 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
|
1497 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
|
1498 { |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1499 int ms; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1500 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1501 PyCursesInitialised |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1502 |
|
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
|
1503 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
|
1504 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
|
1505 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1506 } |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
1507 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
|
1508 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1509 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
|
1510 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1511 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1512 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
|
1513 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
|
1514 { |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1515 char ch; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1516 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1517 PyCursesInitialised |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1518 |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
1519 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
|
1520 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1521 ch = erasechar(); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1522 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1523 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
|
1524 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1525 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1526 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
|
1527 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
|
1528 { |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1529 int x,y; |
|
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 PyCursesInitialised |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1532 |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
1533 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
|
1534 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1535 getsyx(y, x); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1536 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1537 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
|
1538 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1539 |
|
13036
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
1540 #ifdef NCURSES_MOUSE_VERSION |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
1541 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
|
1542 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
|
1543 { |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
1544 int rtn; |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
1545 MEVENT event; |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
1546 |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
1547 PyCursesInitialised |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
1548 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
|
1549 |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
1550 rtn = getmouse( &event ); |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
1551 if (rtn == ERR) { |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
1552 PyErr_SetString(PyCursesError, "getmouse() returned ERR"); |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
1553 return NULL; |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
1554 } |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
1555 return Py_BuildValue("(hiiil)", |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
1556 (short)event.id, |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
1557 event.x, event.y, event.z, |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
1558 (long) event.bstate); |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
1559 } |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
1560 |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
1561 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
|
1562 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
|
1563 { |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
1564 MEVENT event; |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
1565 |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
1566 PyCursesInitialised |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
1567 if (!PyArg_ParseTuple(args, "(hiiil)", |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
1568 &event.id, |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
1569 &event.x, &event.y, &event.z, |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
1570 (int *) &event.bstate)) |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
1571 return NULL; |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
1572 |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
1573 return PyCursesCheckERR(ungetmouse(&event), "ungetmouse"); |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
1574 } |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
1575 #endif |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
1576 |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1577 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
|
1578 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
|
1579 { |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1580 WINDOW *win; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1581 PyObject *temp; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1582 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1583 PyCursesInitialised |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1584 |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
1585 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
|
1586 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1587 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
|
1588 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
|
1589 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1590 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1591 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1592 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
|
1593 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1594 if (win == NULL) { |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1595 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
|
1596 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1597 } |
|
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 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
|
1600 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1601 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1602 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
|
1603 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
|
1604 { |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1605 unsigned char tenths; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1606 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1607 PyCursesInitialised |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1608 |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
1609 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
|
1610 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
|
1611 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
|
1612 break; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1613 default: |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1614 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
|
1615 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1616 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1617 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1618 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
|
1619 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1620 |
|
13708
fe89ea1c9108
Modified version of patch #100963 from Mark Favas: has_key() is an
Andrew M. Kuchling <amk@amk.ca>
parents:
13706
diff
changeset
|
1621 #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
|
1622 /* 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
|
1623 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
|
1624 { |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1625 int ch; |
|
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 PyCursesInitialised |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1628 |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
1629 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
|
1630 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1631 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
|
1632 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
|
1633 return Py_False; |
|
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 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
|
1636 return Py_True; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1637 } |
|
13708
fe89ea1c9108
Modified version of patch #100963 from Mark Favas: has_key() is an
Andrew M. Kuchling <amk@amk.ca>
parents:
13706
diff
changeset
|
1638 #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
|
1639 |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1640 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
|
1641 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
|
1642 { |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1643 short color, r, g, b; |
| 2357 | 1644 |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1645 PyCursesInitialised |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1646 PyCursesInitialisedColor |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1647 |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
1648 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
|
1649 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
|
1650 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
|
1651 break; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1652 default: |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1653 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
|
1654 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1655 } |
|
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 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
|
1658 } |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1659 |
|
12737
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_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
|
1662 { |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1663 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
|
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 PyCursesInitialisedColor |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1667 |
|
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
|
1668 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
|
1669 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
|
1670 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1671 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1672 |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
1673 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
|
1674 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1675 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
|
1676 } |
|
1867
758c1374f303
Setup.in: added tkinter; rearranged the definition of PYTHONPATH so
Guido van Rossum <guido@python.org>
parents:
1859
diff
changeset
|
1677 |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1678 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
|
1679 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
|
1680 { |
|
1859
54fdc9a95f48
Lance's release 1.1 -- fixes some problems with 1.0
Guido van Rossum <guido@python.org>
parents:
1858
diff
changeset
|
1681 WINDOW *win; |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1682 PyObject *lines, *cols; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1683 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1684 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
|
1685 |
|
2423
73eeff4d43f8
more fixes by Steve Clift
Guido van Rossum <guido@python.org>
parents:
2358
diff
changeset
|
1686 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
|
1687 wrefresh(stdscr); |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1688 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
|
1689 } |
|
1859
54fdc9a95f48
Lance's release 1.1 -- fixes some problems with 1.0
Guido van Rossum <guido@python.org>
parents:
1858
diff
changeset
|
1690 |
|
54fdc9a95f48
Lance's release 1.1 -- fixes some problems with 1.0
Guido van Rossum <guido@python.org>
parents:
1858
diff
changeset
|
1691 win = initscr(); |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1692 |
| 2357 | 1693 if (win == NULL) { |
| 1694 PyErr_SetString(PyCursesError, catchall_NULL); | |
| 1695 return NULL; | |
| 1696 } | |
| 1697 | |
|
2423
73eeff4d43f8
more fixes by Steve Clift
Guido van Rossum <guido@python.org>
parents:
2358
diff
changeset
|
1698 initialised = TRUE; |
|
1859
54fdc9a95f48
Lance's release 1.1 -- fixes some problems with 1.0
Guido van Rossum <guido@python.org>
parents:
1858
diff
changeset
|
1699 |
|
12738
3d26cb3808a7
Changes by AMK: Use HAVE_NCURSES_H to include correct header file
Andrew M. Kuchling <amk@amk.ca>
parents:
12737
diff
changeset
|
1700 /* 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
|
1701 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
|
1702 #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
|
1703 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
|
1704 |
|
3d26cb3808a7
Changes by AMK: Use HAVE_NCURSES_H to include correct header file
Andrew M. Kuchling <amk@amk.ca>
parents:
12737
diff
changeset
|
1705 /* 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
|
1706 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
|
1707 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
|
1708 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
|
1709 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
|
1710 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
|
1711 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
|
1712 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
|
1713 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
|
1714 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
|
1715 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
|
1716 SetDictInt("ACS_PLUS", (ACS_PLUS)); |
|
3d26cb3808a7
Changes by AMK: Use HAVE_NCURSES_H to include correct header file
Andrew M. Kuchling <amk@amk.ca>
parents:
12737
diff
changeset
|
1717 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
|
1718 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
|
1719 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
|
1720 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
|
1721 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
|
1722 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
|
1723 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
|
1724 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
|
1725 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
|
1726 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
|
1727 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
|
1728 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
|
1729 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
|
1730 SetDictInt("ACS_BLOCK", (ACS_BLOCK)); |
|
3d26cb3808a7
Changes by AMK: Use HAVE_NCURSES_H to include correct header file
Andrew M. Kuchling <amk@amk.ca>
parents:
12737
diff
changeset
|
1731 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
|
1732 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
|
1733 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
|
1734 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
|
1735 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
|
1736 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
|
1737 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
|
1738 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
|
1739 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
|
1740 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
|
1741 SetDictInt("ACS_SSSS", (ACS_PLUS)); |
|
13040
12ac2c267b93
Fixes for compiling on Tru64.
Andrew M. Kuchling <amk@amk.ca>
parents:
13039
diff
changeset
|
1742 #ifndef STRICT_SYSV_CURSES |
|
12ac2c267b93
Fixes for compiling on Tru64.
Andrew M. Kuchling <amk@amk.ca>
parents:
13039
diff
changeset
|
1743 /* The following are never available with strict SYSV curses */ |
|
12738
3d26cb3808a7
Changes by AMK: Use HAVE_NCURSES_H to include correct header file
Andrew M. Kuchling <amk@amk.ca>
parents:
12737
diff
changeset
|
1744 SetDictInt("ACS_S3", (ACS_S3)); |
|
3d26cb3808a7
Changes by AMK: Use HAVE_NCURSES_H to include correct header file
Andrew M. Kuchling <amk@amk.ca>
parents:
12737
diff
changeset
|
1745 SetDictInt("ACS_LEQUAL", (ACS_LEQUAL)); |
|
3d26cb3808a7
Changes by AMK: Use HAVE_NCURSES_H to include correct header file
Andrew M. Kuchling <amk@amk.ca>
parents:
12737
diff
changeset
|
1746 SetDictInt("ACS_GEQUAL", (ACS_GEQUAL)); |
|
3d26cb3808a7
Changes by AMK: Use HAVE_NCURSES_H to include correct header file
Andrew M. Kuchling <amk@amk.ca>
parents:
12737
diff
changeset
|
1747 SetDictInt("ACS_PI", (ACS_PI)); |
|
3d26cb3808a7
Changes by AMK: Use HAVE_NCURSES_H to include correct header file
Andrew M. Kuchling <amk@amk.ca>
parents:
12737
diff
changeset
|
1748 SetDictInt("ACS_NEQUAL", (ACS_NEQUAL)); |
|
3d26cb3808a7
Changes by AMK: Use HAVE_NCURSES_H to include correct header file
Andrew M. Kuchling <amk@amk.ca>
parents:
12737
diff
changeset
|
1749 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
|
1750 #endif |
|
3d26cb3808a7
Changes by AMK: Use HAVE_NCURSES_H to include correct header file
Andrew M. Kuchling <amk@amk.ca>
parents:
12737
diff
changeset
|
1751 |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1752 lines = PyInt_FromLong((long) LINES); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1753 PyDict_SetItemString(ModDict, "LINES", lines); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1754 Py_DECREF(lines); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1755 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
|
1756 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
|
1757 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
|
1758 |
|
54fdc9a95f48
Lance's release 1.1 -- fixes some problems with 1.0
Guido van Rossum <guido@python.org>
parents:
1858
diff
changeset
|
1759 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
|
1760 } |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1761 |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1762 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1763 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
|
1764 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
|
1765 { |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1766 int ch; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1767 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1768 PyCursesInitialised |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1769 |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
1770 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
|
1771 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
|
1772 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
|
1773 break; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1774 default: |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1775 PyErr_SetString(PyExc_TypeError, "intrflush requires 1 argument"); |
| 2357 | 1776 return NULL; |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1777 } |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1778 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1779 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
|
1780 } |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1781 |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1782 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
|
1783 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
|
1784 { |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1785 const char *knp; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1786 int ch; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1787 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1788 PyCursesInitialised |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1789 |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
1790 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
|
1791 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1792 knp = keyname(ch); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1793 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1794 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
|
1795 } |
|
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 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
|
1798 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
|
1799 { |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1800 char ch; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1801 |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
1802 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
|
1803 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1804 ch = killchar(); |
|
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 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
|
1807 } |
|
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 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
|
1810 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
|
1811 { |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1812 int ch; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1813 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1814 PyCursesInitialised |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1815 |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
1816 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
|
1817 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
|
1818 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
|
1819 break; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1820 default: |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1821 PyErr_SetString(PyExc_TypeError, "meta requires 1 argument"); |
| 2357 | 1822 return NULL; |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1823 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1824 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1825 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
|
1826 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1827 |
|
13036
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
1828 #ifdef NCURSES_MOUSE_VERSION |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
1829 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
|
1830 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
|
1831 { |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
1832 int interval; |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
1833 PyCursesInitialised |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
1834 |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
1835 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
|
1836 return NULL; |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
1837 return PyCursesCheckERR(mouseinterval(interval), "mouseinterval"); |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
1838 } |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
1839 |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
1840 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
|
1841 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
|
1842 { |
|
13385
aff1c4146c1c
Removed unused variables.
Andrew M. Kuchling <amk@amk.ca>
parents:
13040
diff
changeset
|
1843 int newmask; |
|
13036
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
1844 mmask_t oldmask, availmask; |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
1845 |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
1846 PyCursesInitialised |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
1847 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
|
1848 return NULL; |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
1849 availmask = mousemask(newmask, &oldmask); |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
1850 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
|
1851 } |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
1852 #endif |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
1853 |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1854 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
|
1855 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
|
1856 { |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1857 WINDOW *win; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1858 int nlines, ncols; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1859 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1860 PyCursesInitialised |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1861 |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
1862 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
|
1863 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1864 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
|
1865 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1866 if (win == NULL) { |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1867 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
|
1868 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1869 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1870 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1871 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
|
1872 } |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1873 |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1874 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
|
1875 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
|
1876 { |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1877 WINDOW *win; |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1878 int nlines, ncols, begin_y, begin_x; |
| 2357 | 1879 |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1880 PyCursesInitialised |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1881 |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
1882 switch (ARG_COUNT(args)) { |
| 2357 | 1883 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
|
1884 if (!PyArg_Parse(args,"(ii);nlines,ncols",&nlines,&ncols)) |
| 2357 | 1885 return NULL; |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1886 win = newpad(nlines, ncols); |
| 2357 | 1887 break; |
| 1888 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
|
1889 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
|
1890 &nlines,&ncols,&begin_y,&begin_x)) |
| 2357 | 1891 return NULL; |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1892 win = newwin(nlines,ncols,begin_y,begin_x); |
| 2357 | 1893 break; |
| 1894 default: | |
| 1895 PyErr_SetString(PyExc_TypeError, "newwin requires 2 or 4 arguments"); | |
| 1896 return NULL; | |
| 1897 } | |
| 1898 | |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1899 if (win == NULL) { |
| 2357 | 1900 PyErr_SetString(PyCursesError, catchall_NULL); |
| 1901 return NULL; | |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1902 } |
| 2357 | 1903 |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1904 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
|
1905 } |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1906 |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1907 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
|
1908 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
|
1909 { |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1910 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
|
1911 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1912 PyCursesInitialised |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1913 PyCursesInitialisedColor |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1914 |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
1915 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
|
1916 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
|
1917 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
|
1918 break; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1919 default: |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1920 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
|
1921 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1922 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1923 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1924 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
|
1925 PyErr_SetString(PyCursesError, |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1926 "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
|
1927 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1928 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1929 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1930 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
|
1931 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1932 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1933 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
|
1934 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
|
1935 { |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1936 int n; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1937 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1938 PyCursesInitialised |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1939 PyCursesInitialisedColor |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1940 |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
1941 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
|
1942 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
|
1943 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
|
1944 break; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1945 default: |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1946 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
|
1947 "pair_number requires 1 argument"); |
| 2357 | 1948 return NULL; |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1949 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1950 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1951 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
|
1952 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1953 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1954 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
|
1955 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
|
1956 { |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1957 char *str; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1958 |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
1959 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
|
1960 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
|
1961 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1962 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1963 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
|
1964 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
|
1965 { |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1966 int flag = 0; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1967 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1968 PyCursesInitialised |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1969 |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
1970 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
|
1971 case 0: |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1972 qiflush(); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1973 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
|
1974 return Py_None; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1975 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
|
1976 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
|
1977 if (flag) qiflush(); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1978 else noqiflush(); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1979 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
|
1980 return Py_None; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1981 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
|
1982 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
|
1983 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1984 } |
|
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 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1987 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
|
1988 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
|
1989 { |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1990 int y,x; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1991 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1992 PyCursesInitialised |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1993 |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
1994 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
|
1995 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
|
1996 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1997 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
1998 |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
1999 if (!PyArg_Parse(args, "(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
|
2000 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2001 setsyx(y,x); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2002 |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2003 Py_INCREF(Py_None); |
| 2357 | 2004 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
|
2005 } |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2006 |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2007 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
|
2008 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
|
2009 { |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2010 int code; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2011 PyObject *c, *cp; |
|
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 PyCursesInitialised |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2014 |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
2015 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
|
2016 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2017 code = start_color(); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2018 if (code != ERR) { |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2019 initialisedcolors = TRUE; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2020 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
|
2021 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
|
2022 Py_DECREF(c); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2023 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
|
2024 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
|
2025 Py_DECREF(cp); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2026 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
|
2027 return Py_None; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2028 } else { |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2029 PyErr_SetString(PyCursesError, "start_color() returned ERR"); |
| 2357 | 2030 return NULL; |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2031 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2032 } |
|
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 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
|
2035 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
|
2036 { |
|
06d4225919d4
Added wrappers for tiget{flag,num,str}, for querying terminfo capabilities
Andrew M. Kuchling <amk@amk.ca>
parents:
13708
diff
changeset
|
2037 char *capname; |
|
06d4225919d4
Added wrappers for tiget{flag,num,str}, for querying terminfo capabilities
Andrew M. Kuchling <amk@amk.ca>
parents:
13708
diff
changeset
|
2038 |
|
06d4225919d4
Added wrappers for tiget{flag,num,str}, for querying terminfo capabilities
Andrew M. Kuchling <amk@amk.ca>
parents:
13708
diff
changeset
|
2039 PyCursesInitialised; |
|
06d4225919d4
Added wrappers for tiget{flag,num,str}, for querying terminfo capabilities
Andrew M. Kuchling <amk@amk.ca>
parents:
13708
diff
changeset
|
2040 |
|
06d4225919d4
Added wrappers for tiget{flag,num,str}, for querying terminfo capabilities
Andrew M. Kuchling <amk@amk.ca>
parents:
13708
diff
changeset
|
2041 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
|
2042 return NULL; |
|
06d4225919d4
Added wrappers for tiget{flag,num,str}, for querying terminfo capabilities
Andrew M. Kuchling <amk@amk.ca>
parents:
13708
diff
changeset
|
2043 |
|
06d4225919d4
Added wrappers for tiget{flag,num,str}, for querying terminfo capabilities
Andrew M. Kuchling <amk@amk.ca>
parents:
13708
diff
changeset
|
2044 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
|
2045 } |
|
06d4225919d4
Added wrappers for tiget{flag,num,str}, for querying terminfo capabilities
Andrew M. Kuchling <amk@amk.ca>
parents:
13708
diff
changeset
|
2046 |
|
06d4225919d4
Added wrappers for tiget{flag,num,str}, for querying terminfo capabilities
Andrew M. Kuchling <amk@amk.ca>
parents:
13708
diff
changeset
|
2047 static PyObject * |
|
06d4225919d4
Added wrappers for tiget{flag,num,str}, for querying terminfo capabilities
Andrew M. Kuchling <amk@amk.ca>
parents:
13708
diff
changeset
|
2048 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
|
2049 { |
|
06d4225919d4
Added wrappers for tiget{flag,num,str}, for querying terminfo capabilities
Andrew M. Kuchling <amk@amk.ca>
parents:
13708
diff
changeset
|
2050 char *capname; |
|
06d4225919d4
Added wrappers for tiget{flag,num,str}, for querying terminfo capabilities
Andrew M. Kuchling <amk@amk.ca>
parents:
13708
diff
changeset
|
2051 |
|
06d4225919d4
Added wrappers for tiget{flag,num,str}, for querying terminfo capabilities
Andrew M. Kuchling <amk@amk.ca>
parents:
13708
diff
changeset
|
2052 PyCursesInitialised; |
|
06d4225919d4
Added wrappers for tiget{flag,num,str}, for querying terminfo capabilities
Andrew M. Kuchling <amk@amk.ca>
parents:
13708
diff
changeset
|
2053 |
|
06d4225919d4
Added wrappers for tiget{flag,num,str}, for querying terminfo capabilities
Andrew M. Kuchling <amk@amk.ca>
parents:
13708
diff
changeset
|
2054 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
|
2055 return NULL; |
|
06d4225919d4
Added wrappers for tiget{flag,num,str}, for querying terminfo capabilities
Andrew M. Kuchling <amk@amk.ca>
parents:
13708
diff
changeset
|
2056 |
|
06d4225919d4
Added wrappers for tiget{flag,num,str}, for querying terminfo capabilities
Andrew M. Kuchling <amk@amk.ca>
parents:
13708
diff
changeset
|
2057 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
|
2058 } |
|
06d4225919d4
Added wrappers for tiget{flag,num,str}, for querying terminfo capabilities
Andrew M. Kuchling <amk@amk.ca>
parents:
13708
diff
changeset
|
2059 |
|
06d4225919d4
Added wrappers for tiget{flag,num,str}, for querying terminfo capabilities
Andrew M. Kuchling <amk@amk.ca>
parents:
13708
diff
changeset
|
2060 static PyObject * |
|
06d4225919d4
Added wrappers for tiget{flag,num,str}, for querying terminfo capabilities
Andrew M. Kuchling <amk@amk.ca>
parents:
13708
diff
changeset
|
2061 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
|
2062 { |
|
06d4225919d4
Added wrappers for tiget{flag,num,str}, for querying terminfo capabilities
Andrew M. Kuchling <amk@amk.ca>
parents:
13708
diff
changeset
|
2063 char *capname; |
|
06d4225919d4
Added wrappers for tiget{flag,num,str}, for querying terminfo capabilities
Andrew M. Kuchling <amk@amk.ca>
parents:
13708
diff
changeset
|
2064 |
|
06d4225919d4
Added wrappers for tiget{flag,num,str}, for querying terminfo capabilities
Andrew M. Kuchling <amk@amk.ca>
parents:
13708
diff
changeset
|
2065 PyCursesInitialised; |
|
06d4225919d4
Added wrappers for tiget{flag,num,str}, for querying terminfo capabilities
Andrew M. Kuchling <amk@amk.ca>
parents:
13708
diff
changeset
|
2066 |
|
06d4225919d4
Added wrappers for tiget{flag,num,str}, for querying terminfo capabilities
Andrew M. Kuchling <amk@amk.ca>
parents:
13708
diff
changeset
|
2067 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
|
2068 return NULL; |
|
06d4225919d4
Added wrappers for tiget{flag,num,str}, for querying terminfo capabilities
Andrew M. Kuchling <amk@amk.ca>
parents:
13708
diff
changeset
|
2069 |
|
06d4225919d4
Added wrappers for tiget{flag,num,str}, for querying terminfo capabilities
Andrew M. Kuchling <amk@amk.ca>
parents:
13708
diff
changeset
|
2070 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
|
2071 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
|
2072 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
|
2073 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
|
2074 } |
|
06d4225919d4
Added wrappers for tiget{flag,num,str}, for querying terminfo capabilities
Andrew M. Kuchling <amk@amk.ca>
parents:
13708
diff
changeset
|
2075 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
|
2076 } |
|
06d4225919d4
Added wrappers for tiget{flag,num,str}, for querying terminfo capabilities
Andrew M. Kuchling <amk@amk.ca>
parents:
13708
diff
changeset
|
2077 |
|
06d4225919d4
Added wrappers for tiget{flag,num,str}, for querying terminfo capabilities
Andrew M. Kuchling <amk@amk.ca>
parents:
13708
diff
changeset
|
2078 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
|
2079 PyCurses_TypeAhead(PyObject *self, PyObject *args) |
|
12974
e7992d0d6808
Added .timeout() method and .typeahead() function
Andrew M. Kuchling <amk@amk.ca>
parents:
12913
diff
changeset
|
2080 { |
|
13385
aff1c4146c1c
Removed unused variables.
Andrew M. Kuchling <amk@amk.ca>
parents:
13040
diff
changeset
|
2081 int fd; |
|
12974
e7992d0d6808
Added .timeout() method and .typeahead() function
Andrew M. Kuchling <amk@amk.ca>
parents:
12913
diff
changeset
|
2082 |
|
e7992d0d6808
Added .timeout() method and .typeahead() function
Andrew M. Kuchling <amk@amk.ca>
parents:
12913
diff
changeset
|
2083 PyCursesInitialised |
|
e7992d0d6808
Added .timeout() method and .typeahead() function
Andrew M. Kuchling <amk@amk.ca>
parents:
12913
diff
changeset
|
2084 |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
2085 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
|
2086 |
|
e7992d0d6808
Added .timeout() method and .typeahead() function
Andrew M. Kuchling <amk@amk.ca>
parents:
12913
diff
changeset
|
2087 PyCursesCheckERR(typeahead( fd ), "typeahead"); |
|
e7992d0d6808
Added .timeout() method and .typeahead() function
Andrew M. Kuchling <amk@amk.ca>
parents:
12913
diff
changeset
|
2088 Py_INCREF(Py_None); |
|
e7992d0d6808
Added .timeout() method and .typeahead() function
Andrew M. Kuchling <amk@amk.ca>
parents:
12913
diff
changeset
|
2089 return Py_None; |
|
e7992d0d6808
Added .timeout() method and .typeahead() function
Andrew M. Kuchling <amk@amk.ca>
parents:
12913
diff
changeset
|
2090 } |
|
e7992d0d6808
Added .timeout() method and .typeahead() function
Andrew M. Kuchling <amk@amk.ca>
parents:
12913
diff
changeset
|
2091 |
|
e7992d0d6808
Added .timeout() method and .typeahead() function
Andrew M. Kuchling <amk@amk.ca>
parents:
12913
diff
changeset
|
2092 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
|
2093 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
|
2094 { |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2095 PyObject *temp; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2096 chtype ch; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2097 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2098 PyCursesInitialised |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2099 |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
2100 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
|
2101 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2102 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
|
2103 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
|
2104 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
|
2105 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
|
2106 else { |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2107 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
|
2108 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2109 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2110 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2111 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
|
2112 } |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2113 |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2114 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
|
2115 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
|
2116 { |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2117 PyObject *temp; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2118 chtype ch; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2119 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2120 PyCursesInitialised |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2121 |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
2122 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
|
2123 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2124 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
|
2125 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
|
2126 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
|
2127 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
|
2128 else { |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2129 PyErr_SetString(PyExc_TypeError, "argument must be a ch or an int"); |
| 2357 | 2130 return NULL; |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2131 } |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2132 |
| 2357 | 2133 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
|
2134 } |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2135 |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2136 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
|
2137 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
|
2138 { |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2139 int flag; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2140 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2141 PyCursesInitialised |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2142 |
|
13465
8e92d941e07f
Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
Andrew M. Kuchling <amk@amk.ca>
parents:
13388
diff
changeset
|
2143 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
|
2144 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
|
2145 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
|
2146 return NULL; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2147 break; |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2148 default: |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2149 PyErr_SetString(PyExc_TypeError, "use_env requires 1 argument"); |
| 2357 | 2150 return NULL; |
|
12737
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 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
|
2153 Py_INCREF(Py_None); |
| 2357 | 2154 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
|
2155 } |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2156 |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2157 /* 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
|
2158 |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2159 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
|
2160 {"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
|
2161 {"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
|
2162 {"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
|
2163 {"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
|
2164 {"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
|
2165 {"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
|
2166 {"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
|
2167 {"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
|
2168 {"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
|
2169 {"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
|
2170 {"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
|
2171 {"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
|
2172 {"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
|
2173 {"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
|
2174 {"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
|
2175 {"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
|
2176 {"flushinp", (PyCFunction)PyCurses_flushinp}, |
|
13036
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
2177 #ifdef NCURSES_MOUSE_VERSION |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
2178 {"getmouse", (PyCFunction)PyCurses_GetMouse}, |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
2179 {"ungetmouse", (PyCFunction)PyCurses_UngetMouse, METH_VARARGS}, |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
2180 #endif |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2181 {"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
|
2182 {"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
|
2183 {"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
|
2184 {"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
|
2185 {"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
|
2186 #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
|
2187 {"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
|
2188 #endif |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2189 {"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
|
2190 {"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
|
2191 {"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
|
2192 {"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
|
2193 {"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
|
2194 {"isendwin", (PyCFunction)PyCurses_isendwin}, |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2195 {"keyname", (PyCFunction)PyCurses_KeyName}, |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2196 {"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
|
2197 {"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
|
2198 {"meta", (PyCFunction)PyCurses_Meta}, |
|
13036
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
2199 #ifdef NCURSES_MOUSE_VERSION |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
2200 {"mouseinterval", (PyCFunction)PyCurses_MouseInterval}, |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
2201 {"mousemask", (PyCFunction)PyCurses_MouseMask}, |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
2202 #endif |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2203 {"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
|
2204 {"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
|
2205 {"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
|
2206 {"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
|
2207 {"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
|
2208 {"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
|
2209 {"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
|
2210 {"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
|
2211 {"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
|
2212 {"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
|
2213 {"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
|
2214 {"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
|
2215 {"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
|
2216 {"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
|
2217 {"reset_shell_mode", (PyCFunction)PyCurses_reset_shell_mode}, |
|
13385
aff1c4146c1c
Removed unused variables.
Andrew M. Kuchling <amk@amk.ca>
parents:
13040
diff
changeset
|
2218 {"resetty", (PyCFunction)PyCurses_resetty}, |
|
aff1c4146c1c
Removed unused variables.
Andrew M. Kuchling <amk@amk.ca>
parents:
13040
diff
changeset
|
2219 {"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
|
2220 {"setsyx", (PyCFunction)PyCurses_setsyx}, |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2221 {"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
|
2222 {"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
|
2223 {"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
|
2224 {"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
|
2225 {"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
|
2226 {"tigetstr", (PyCFunction)PyCurses_tigetstr, METH_VARARGS}, |
|
12974
e7992d0d6808
Added .timeout() method and .typeahead() function
Andrew M. Kuchling <amk@amk.ca>
parents:
12913
diff
changeset
|
2227 {"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
|
2228 {"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
|
2229 {"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
|
2230 {"use_env", (PyCFunction)PyCurses_Use_Env}, |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2231 {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
|
2232 }; |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2233 |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2234 /* 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
|
2235 |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2236 void |
|
13651
8a063423e0b7
Bunch of minor ANSIfications: 'void initfunc()' -> 'void initfunc(void)',
Thomas Wouters <thomas@python.org>
parents:
13465
diff
changeset
|
2237 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
|
2238 { |
|
2358
4c43cbdcd524
bump version, add __version__ back in
Guido van Rossum <guido@python.org>
parents:
2357
diff
changeset
|
2239 PyObject *m, *d, *v; |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2240 |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2241 /* 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
|
2242 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
|
2243 |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2244 /* 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
|
2245 d = PyModule_GetDict(m); |
|
1867
758c1374f303
Setup.in: added tkinter; rearranged the definition of PYTHONPATH so
Guido van Rossum <guido@python.org>
parents:
1859
diff
changeset
|
2246 ModDict = d; /* For PyCurses_InitScr */ |
| 1858 | 2247 |
| 2357 | 2248 /* 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
|
2249 PyCursesError = PyErr_NewException("_curses.error", NULL, NULL); |
| 2357 | 2250 PyDict_SetItemString(d, "error", PyCursesError); |
| 1858 | 2251 |
| 2357 | 2252 /* Make the version available */ |
|
2358
4c43cbdcd524
bump version, add __version__ back in
Guido van Rossum <guido@python.org>
parents:
2357
diff
changeset
|
2253 v = PyString_FromString(PyCursesVersion); |
|
4c43cbdcd524
bump version, add __version__ back in
Guido van Rossum <guido@python.org>
parents:
2357
diff
changeset
|
2254 PyDict_SetItemString(d, "version", v); |
|
4c43cbdcd524
bump version, add __version__ back in
Guido van Rossum <guido@python.org>
parents:
2357
diff
changeset
|
2255 PyDict_SetItemString(d, "__version__", v); |
|
4c43cbdcd524
bump version, add __version__ back in
Guido van Rossum <guido@python.org>
parents:
2357
diff
changeset
|
2256 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
|
2257 |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2258 /* 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
|
2259 |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2260 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
|
2261 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
|
2262 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
|
2263 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
|
2264 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
|
2265 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
|
2266 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
|
2267 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
|
2268 SetDictInt("A_ALTCHARSET", A_ALTCHARSET); |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2269 SetDictInt("A_INVIS", A_INVIS); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2270 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
|
2271 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
|
2272 SetDictInt("A_COLOR", A_COLOR); |
|
13040
12ac2c267b93
Fixes for compiling on Tru64.
Andrew M. Kuchling <amk@amk.ca>
parents:
13039
diff
changeset
|
2273 #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
|
2274 SetDictInt("A_HORIZONTAL", A_HORIZONTAL); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2275 SetDictInt("A_LEFT", A_LEFT); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2276 SetDictInt("A_LOW", A_LOW); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2277 SetDictInt("A_RIGHT", A_RIGHT); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2278 SetDictInt("A_TOP", A_TOP); |
|
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2279 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
|
2280 #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
|
2281 |
|
12737
77a5a14695b3
Oliver Andrich's ncurses-specific curses module, version 1.5b1
Andrew M. Kuchling <amk@amk.ca>
parents:
12576
diff
changeset
|
2282 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
|
2283 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
|
2284 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
|
2285 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
|
2286 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
|
2287 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
|
2288 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
|
2289 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
|
2290 |
|
13036
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
2291 #ifdef NCURSES_MOUSE_VERSION |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
2292 /* Mouse-related constants */ |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
2293 SetDictInt("BUTTON1_PRESSED", BUTTON1_PRESSED); |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
2294 SetDictInt("BUTTON1_RELEASED", BUTTON1_RELEASED); |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
2295 SetDictInt("BUTTON1_CLICKED", BUTTON1_CLICKED); |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
2296 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
|
2297 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
|
2298 |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
2299 SetDictInt("BUTTON2_PRESSED", BUTTON2_PRESSED); |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
2300 SetDictInt("BUTTON2_RELEASED", BUTTON2_RELEASED); |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
2301 SetDictInt("BUTTON2_CLICKED", BUTTON2_CLICKED); |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
2302 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
|
2303 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
|
2304 |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
2305 SetDictInt("BUTTON3_PRESSED", BUTTON3_PRESSED); |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
2306 SetDictInt("BUTTON3_RELEASED", BUTTON3_RELEASED); |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
2307 SetDictInt("BUTTON3_CLICKED", BUTTON3_CLICKED); |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
2308 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
|
2309 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
|
2310 |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
2311 SetDictInt("BUTTON4_PRESSED", BUTTON4_PRESSED); |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
2312 SetDictInt("BUTTON4_RELEASED", BUTTON4_RELEASED); |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
2313 SetDictInt("BUTTON4_CLICKED", BUTTON4_CLICKED); |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
2314 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
|
2315 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
|
2316 |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
2317 SetDictInt("BUTTON_SHIFT", BUTTON_SHIFT); |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
2318 SetDictInt("BUTTON_CTRL", BUTTON_CTRL); |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
2319 SetDictInt("BUTTON_ALT", BUTTON_ALT); |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
2320 |
|
c09a570eb6eb
Added support for mouse functions: mousemask(), mouseinterval(),
Andrew M. Kuchling <amk@amk.ca>
parents:
12988
diff
changeset
|
2321 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
|
2322 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
|
2323 #endif |
|
1855
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2324 /* 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
|
2325 { |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2326 int key; |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2327 char *key_n; |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2328 char *key_n2; |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2329 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
|
2330 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
|
2331 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
|
2332 continue; |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2333 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
|
2334 char *p1, *p2; |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2335 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
|
2336 p1 = key_n; |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2337 p2 = key_n2; |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2338 while (*p1) { |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2339 if (*p1 != '(' && *p1 != ')') { |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2340 *p2 = *p1; |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2341 p2++; |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2342 } |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2343 p1++; |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2344 } |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2345 *p2 = (char)0; |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2346 } else |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2347 key_n2 = key_n; |
| 2357 | 2348 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
|
2349 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
|
2350 free(key_n2); |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2351 } |
| 2357 | 2352 SetDictInt("KEY_MIN", KEY_MIN); |
| 2353 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
|
2354 } |
|
9dbdb83d4178
Lance has converted his modules to the new naming conventions, and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2355 } |
