@@ -22,6 +22,120 @@ WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
2222
2323******************************************************************/
2424
25+ /******************************************************************
26+ This is a curses implimentation. I have tried to be as complete
27+ as possible. If there are functions you need that are not included,
28+ please let me know and/or send me some diffs.
29+
30+ There are 3 basic types exported by this module:
31+ 1) Screen - This is not currently used
32+ 2) Window - This is the basic type. This is equivalent to "WINDOW *".
33+ 3) Pad - This is similar to Window, but works with Pads as defined
34+ in curses.
35+
36+ Most of the routines can be looked up using the curses man page.
37+
38+ Here is a list of the currently supported methods and attributes
39+ in the curses module:
40+
41+ Return Value Func/Attr Description
42+ --------------------------------------------------------------------------
43+ StringObject __version__ This returns a string representing
44+ the current version of this module
45+ WindowObject initscr() This initializes the screen for use
46+ None endwin() Closes down the screen and returns
47+ things as they were before calling
48+ initscr()
49+ True/FalseObject isendwin() Has endwin() been called?
50+ IntObject doupdate() Updates screen and returns number
51+ of bytes written to screen
52+ WindowObject newwin(nlines,ncols,begin_y,begin_x)
53+ newwin(begin_y,begin_x)
54+ newwin() creates and returns
55+ a new window.
56+ None beep() Beep the screen if possible
57+ None flash() Flash the screen if possible
58+ None ungetch(int) Push the int back so next getch()
59+ will return it.
60+ Note: argument is an INT, not a CHAR
61+ None flushinp() Flush all input buffers
62+ None cbreak() Enter cbreak mode
63+ None nocbreak() Leave cbreak mode
64+ None echo() Enter echo mode
65+ None noecho() Leave echo mode
66+ None nl() Enter nl mode
67+ None nonl() Leave nl mode
68+ None raw() Enter raw mode
69+ None noraw() Leave raw mode
70+ None intrflush(int) Set or reset interruptable flush
71+ mode, int=1 if set, 0 if notset.
72+ None meta(int) Allow 8 bit or 7 bit chars.
73+ int=1 is 8 bit, int=0 is 7 bit
74+ StringObject keyname(int) return the text representation
75+ of a KEY_ value. (see below)
76+
77+ Here is a list of the currently supported methods and attributes
78+ in the WindowObject:
79+
80+ Return Value Func/Attr Description
81+ --------------------------------------------------------------------------
82+ IntObject refresh() Do refresh
83+ IntObject nooutrefresh() Mark for refresh but wait
84+ True/False mvwin(new_y,new_x) Move Window
85+ True/False move(new_y,new_x) Move Cursor
86+ WindowObject subwin(nlines,ncols,begin_y,begin_x)
87+ subwin(begin_y,begin_x)
88+ True/False addch(y,x,ch,attr)
89+ addch(y,x,ch)
90+ addch(ch,attr)
91+ addch(ch)
92+ True/False insch(y,x,ch,attr)
93+ insch(y,x,ch)
94+ insch(ch,attr)
95+ insch(ch)
96+ True/False delch(y,x)
97+ delch()
98+ True/False echochar(ch,attr)
99+ echochar(ch)
100+ True/False addstr(y,x,str,attr)
101+ addstr(y,x,str)
102+ addstr(str,attr)
103+ addstr(str)
104+ True/False attron(attr)
105+ True/False attroff(attr)
106+ True/False attrset(sttr)
107+ True/False standend()
108+ True/False standout()
109+ True/False box(vertch,horch) vertch and horch are INTS
110+ box()
111+ None erase()
112+ None deleteln()
113+ None insertln()
114+ (y,x) getyx()
115+ (y,x) getbegyx()
116+ (y,x) getmaxyx()
117+ None clear()
118+ None clrtobot()
119+ None clrtoeol()
120+ None scroll()
121+ None touchwin()
122+ None touchline(start,count)
123+ IntObject getch(y,x)
124+ getch()
125+ StringObject getstr(y,x)
126+ getstr()
127+ IntObject inch(y,x)
128+ inch()
129+ None clearok(int) int=0 or int=1
130+ None idlok(int) int=0 or int=1
131+ None leaveok(int) int=0 or int=1
132+ None scrollok(int) int=0 or int=1
133+ None setscrreg(top,bottom)
134+ None nodelay(int) int=0 or int=1
135+ None notimeout(int) int=0 or int=1
136+ ******************************************************************/
137+
138+
25139/* curses module */
26140
27141#include "allobjects.h"
@@ -60,6 +174,17 @@ staticforward PyTypeObject PyCursesPad_Type;
60174PyObject * PyCurses_OK ;
61175PyObject * PyCurses_ERR ;
62176
177+ /******************************************************************
178+
179+ Change Log:
180+
181+ Version 1.0: 94/08/30:
182+ This is the first release of this software.
183+ Released to the Internet via [email protected] 184+
185+ ******************************************************************/
186+ char * PyCursesVersion = "1.0 first release"
187+
63188/* ------------- SCREEN routines --------------- */
64189#ifdef NOT_YET
65190static PyObject *
@@ -1203,7 +1328,7 @@ static PyMethodDef PyCurses_methods[] = {
12031328/* Initialization function for the module */
12041329
12051330void
1206- initcurses ()
1331+ initncurses ()
12071332{
12081333 PyObject * m , * d , * x ;
12091334
@@ -1216,6 +1341,11 @@ initcurses()
12161341 Py_INCREF (PyCurses_ERR );
12171342 /* Add some symbolic constants to the module */
12181343 d = PyModule_GetDict (m );
1344+
1345+ /* Make the version available */
1346+ PyDict_SetItemString (d ,"__version__" ,
1347+ PyString_FromString (PyCursesVersion ));
1348+
12191349 /* Here are some defines */
12201350 PyDict_SetItemString (d ,"OK" , PyCurses_OK );
12211351 PyDict_SetItemString (d ,"ERR" ,PyCurses_ERR );
0 commit comments