Kaydet (Commit) c22fd671 authored tarafından Victor Stinner's avatar Victor Stinner

Recorded merge of revisions 81215 via svnmerge from

svn+ssh://pythondev@svn.python.org/python/branches/py3k

................
  r81215 | victor.stinner | 2010-05-16 00:23:53 +0200 (dim., 16 mai 2010) | 12 lines

  Recorded merge of revisions 81213 via svnmerge from
  svn+ssh://pythondev@svn.python.org/python/trunk

  ........
    r81213 | victor.stinner | 2010-05-16 00:19:27 +0200 (dim., 16 mai 2010) | 5 lines

    reindent _cursesmodule.c

    Use untabify.py + emacs (python3 mode) + manual editions for
    Py_BEGIN_ALLOW_THREADS / Py_END_ALLOW_THREADS
  ........
................
üst f4ee588e
......@@ -35,12 +35,12 @@
/*
A number of SysV or ncurses functions don't have wrappers yet; if you
need a given function, add it and send a patch. See
http://www.python.org/dev/patches/ for instructions on how to submit
patches to Python.
A number of SysV or ncurses functions don't have wrappers yet; if you
need a given function, add it and send a patch. See
http://www.python.org/dev/patches/ for instructions on how to submit
patches to Python.
Here's a list of currently unsupported functions:
Here's a list of currently unsupported functions:
addchnstr addchstr color_set define_key
del_curterm delscreen dupwin inchnstr inchstr innstr keyok
......@@ -53,12 +53,12 @@ Here's a list of currently unsupported functions:
vidattr vidputs waddchnstr waddchstr
wcolor_set winchnstr winchstr winnstr wmouse_trafo wscrl
Low-priority:
Low-priority:
slk_attr slk_attr_off slk_attr_on slk_attr_set slk_attroff
slk_attron slk_attrset slk_clear slk_color slk_init slk_label
slk_noutrefresh slk_refresh slk_restore slk_set slk_touch
Menu extension (ncurses and probably SYSV):
Menu extension (ncurses and probably SYSV):
current_item free_item free_menu item_count item_description
item_index item_init item_name item_opts item_opts_off
item_opts_on item_term item_userptr item_value item_visible
......@@ -74,7 +74,7 @@ Menu extension (ncurses and probably SYSV):
set_menu_pattern set_menu_spacing set_menu_sub set_menu_term
set_menu_userptr set_menu_win set_top_row top_row unpost_menu
Form extension (ncurses and probably SYSV):
Form extension (ncurses and probably SYSV):
current_field data_ahead data_behind dup_field
dynamic_fieldinfo field_arg field_back field_buffer
field_count field_fore field_index field_info field_init
......@@ -94,7 +94,7 @@ Form extension (ncurses and probably SYSV):
set_max_field set_new_page unpost_form
*/
*/
/* Release Number */
......@@ -250,46 +250,46 @@ PyTypeObject PyCursesWindow_Type;
TYPE - parameter Type
ERGSTR - format string for construction of the return value
PARSESTR - format string for argument parsing
*/
*/
#define Window_NoArgNoReturnFunction(X) \
static PyObject *PyCursesWindow_ ## X (PyCursesWindowObject *self, PyObject *args) \
{ return PyCursesCheckERR(X(self->win), # X); }
static PyObject *PyCursesWindow_ ## X (PyCursesWindowObject *self, PyObject *args) \
{ return PyCursesCheckERR(X(self->win), # X); }
#define Window_NoArgTrueFalseFunction(X) \
static PyObject * PyCursesWindow_ ## X (PyCursesWindowObject *self) \
{ \
static PyObject * PyCursesWindow_ ## X (PyCursesWindowObject *self) \
{ \
if (X (self->win) == FALSE) { Py_INCREF(Py_False); return Py_False; } \
else { Py_INCREF(Py_True); return Py_True; } }
#define Window_NoArgNoReturnVoidFunction(X) \
static PyObject * PyCursesWindow_ ## X (PyCursesWindowObject *self) \
{ \
static PyObject * PyCursesWindow_ ## X (PyCursesWindowObject *self) \
{ \
X(self->win); Py_INCREF(Py_None); return Py_None; }
#define Window_NoArg2TupleReturnFunction(X, TYPE, ERGSTR) \
static PyObject * PyCursesWindow_ ## X (PyCursesWindowObject *self) \
{ \
static PyObject * PyCursesWindow_ ## X (PyCursesWindowObject *self) \
{ \
TYPE arg1, arg2; \
X(self->win,arg1,arg2); return Py_BuildValue(ERGSTR, arg1, arg2); }
#define Window_OneArgNoReturnVoidFunction(X, TYPE, PARSESTR) \
static PyObject * PyCursesWindow_ ## X (PyCursesWindowObject *self, PyObject *args) \
{ \
static PyObject * PyCursesWindow_ ## X (PyCursesWindowObject *self, PyObject *args) \
{ \
TYPE arg1; \
if (!PyArg_ParseTuple(args, PARSESTR, &arg1)) return NULL; \
X(self->win,arg1); Py_INCREF(Py_None); return Py_None; }
#define Window_OneArgNoReturnFunction(X, TYPE, PARSESTR) \
static PyObject * PyCursesWindow_ ## X (PyCursesWindowObject *self, PyObject *args) \
{ \
static PyObject * PyCursesWindow_ ## X (PyCursesWindowObject *self, PyObject *args) \
{ \
TYPE arg1; \
if (!PyArg_ParseTuple(args,PARSESTR, &arg1)) return NULL; \
return PyCursesCheckERR(X(self->win, arg1), # X); }
#define Window_TwoArgNoReturnFunction(X, TYPE, PARSESTR) \
static PyObject * PyCursesWindow_ ## X (PyCursesWindowObject *self, PyObject *args) \
{ \
static PyObject * PyCursesWindow_ ## X (PyCursesWindowObject *self, PyObject *args) \
{ \
TYPE arg1, arg2; \
if (!PyArg_ParseTuple(args,PARSESTR, &arg1, &arg2)) return NULL; \
return PyCursesCheckERR(X(self->win, arg1, arg2), # X); }
......@@ -1269,11 +1269,11 @@ PyCursesWindow_NoOutRefresh(PyCursesWindowObject *self, PyObject *args)
Py_END_ALLOW_THREADS
return PyCursesCheckERR(rtn, "wnoutrefresh");
}
}
}
static PyObject *
PyCursesWindow_Overlay(PyCursesWindowObject *self, PyObject *args)
{
static PyObject *
PyCursesWindow_Overlay(PyCursesWindowObject *self, PyObject *args)
{
PyCursesWindowObject *temp;
int use_copywin = FALSE;
int sminrow, smincol, dminrow, dmincol, dmaxrow, dmaxcol;
......@@ -1307,11 +1307,11 @@ PyCursesWindow_Overlay(PyCursesWindowObject *self, PyObject *args)
rtn = overlay(self->win, temp->win);
return PyCursesCheckERR(rtn, "overlay");
}
}
}
static PyObject *
PyCursesWindow_Overwrite(PyCursesWindowObject *self, PyObject *args)
{
static PyObject *
PyCursesWindow_Overwrite(PyCursesWindowObject *self, PyObject *args)
{
PyCursesWindowObject *temp;
int use_copywin = FALSE;
int sminrow, smincol, dminrow, dmincol, dmaxrow, dmaxcol;
......@@ -1345,11 +1345,11 @@ PyCursesWindow_Overwrite(PyCursesWindowObject *self, PyObject *args)
rtn = overwrite(self->win, temp->win);
return PyCursesCheckERR(rtn, "overwrite");
}
}
}
static PyObject *
PyCursesWindow_PutWin(PyCursesWindowObject *self, PyObject *stream)
{
static PyObject *
PyCursesWindow_PutWin(PyCursesWindowObject *self, PyObject *stream)
{
/* We have to simulate this by writing to a temporary FILE*,
then reading back, then writing to the argument stream. */
char fn[100];
......@@ -1387,20 +1387,20 @@ PyCursesWindow_PutWin(PyCursesWindowObject *self, PyObject *stream)
fclose(fp);
remove(fn);
return res;
}
}
static PyObject *
PyCursesWindow_RedrawLine(PyCursesWindowObject *self, PyObject *args)
{
static PyObject *
PyCursesWindow_RedrawLine(PyCursesWindowObject *self, PyObject *args)
{
int beg, num;
if (!PyArg_ParseTuple(args, "ii;beg,num", &beg, &num))
return NULL;
return PyCursesCheckERR(wredrawln(self->win,beg,num), "redrawln");
}
}
static PyObject *
PyCursesWindow_Refresh(PyCursesWindowObject *self, PyObject *args)
{
static PyObject *
PyCursesWindow_Refresh(PyCursesWindowObject *self, PyObject *args)
{
int pminrow,pmincol,sminrow,smincol,smaxrow,smaxcol;
int rtn;
......@@ -1437,20 +1437,20 @@ PyCursesWindow_Refresh(PyCursesWindowObject *self, PyObject *args)
Py_END_ALLOW_THREADS
return PyCursesCheckERR(rtn, "prefresh");
}
}
}
static PyObject *
PyCursesWindow_SetScrollRegion(PyCursesWindowObject *self, PyObject *args)
{
static PyObject *
PyCursesWindow_SetScrollRegion(PyCursesWindowObject *self, PyObject *args)
{
int x, y;
if (!PyArg_ParseTuple(args,"ii;top, bottom",&y,&x))
return NULL;
return PyCursesCheckERR(wsetscrreg(self->win,y,x), "wsetscrreg");
}
}
static PyObject *
PyCursesWindow_SubWin(PyCursesWindowObject *self, PyObject *args)
{
static PyObject *
PyCursesWindow_SubWin(PyCursesWindowObject *self, PyObject *args)
{
WINDOW *win;
int nlines, ncols, begin_y, begin_x;
......@@ -1485,11 +1485,11 @@ PyCursesWindow_SubWin(PyCursesWindowObject *self, PyObject *args)
}
return (PyObject *)PyCursesWindow_New(win);
}
}
static PyObject *
PyCursesWindow_Scroll(PyCursesWindowObject *self, PyObject *args)
{
static PyObject *
PyCursesWindow_Scroll(PyCursesWindowObject *self, PyObject *args)
{
int nlines;
switch(PyTuple_Size(args)) {
case 0:
......@@ -1502,11 +1502,11 @@ PyCursesWindow_Scroll(PyCursesWindowObject *self, PyObject *args)
PyErr_SetString(PyExc_TypeError, "scroll requires 0 or 1 arguments");
return NULL;
}
}
}
static PyObject *
PyCursesWindow_TouchLine(PyCursesWindowObject *self, PyObject *args)
{
static PyObject *
PyCursesWindow_TouchLine(PyCursesWindowObject *self, PyObject *args)
{
int st, cnt, val;
switch (PyTuple_Size(args)) {
case 2:
......@@ -1521,11 +1521,11 @@ PyCursesWindow_TouchLine(PyCursesWindowObject *self, PyObject *args)
PyErr_SetString(PyExc_TypeError, "touchline requires 2 or 3 arguments");
return NULL;
}
}
}
static PyObject *
PyCursesWindow_Vline(PyCursesWindowObject *self, PyObject *args)
{
static PyObject *
PyCursesWindow_Vline(PyCursesWindowObject *self, PyObject *args)
{
PyObject *temp;
chtype ch;
int n, x, y, code = OK;
......@@ -1568,9 +1568,9 @@ PyCursesWindow_Vline(PyCursesWindowObject *self, PyObject *args)
return PyCursesCheckERR(wvline(self->win, ch | attr, n), "vline");
} else
return PyCursesCheckERR(code, "wmove");
}
}
static PyMethodDef PyCursesWindow_Methods[] = {
static PyMethodDef PyCursesWindow_Methods[] = {
{"addch", (PyCFunction)PyCursesWindow_AddCh, METH_VARARGS},
{"addnstr", (PyCFunction)PyCursesWindow_AddNStr, METH_VARARGS},
{"addstr", (PyCFunction)PyCursesWindow_AddStr, METH_VARARGS},
......@@ -1652,11 +1652,11 @@ static PyMethodDef PyCursesWindow_Methods[] = {
{"untouchwin", (PyCFunction)PyCursesWindow_untouchwin, METH_NOARGS},
{"vline", (PyCFunction)PyCursesWindow_Vline, METH_VARARGS},
{NULL, NULL} /* sentinel */
};
};
/* -------------------------------------------------------*/
PyTypeObject PyCursesWindow_Type = {
PyTypeObject PyCursesWindow_Type = {
PyVarObject_HEAD_INIT(NULL, 0)
"_curses.curses window", /*tp_name*/
sizeof(PyCursesWindowObject), /*tp_basicsize*/
......@@ -1686,59 +1686,59 @@ PyTypeObject PyCursesWindow_Type = {
0, /*tp_iter*/
0, /*tp_iternext*/
PyCursesWindow_Methods, /*tp_methods*/
};
};
/*********************************************************************
Global Functions
**********************************************************************/
NoArgNoReturnFunction(beep)
NoArgNoReturnFunction(def_prog_mode)
NoArgNoReturnFunction(def_shell_mode)
NoArgNoReturnFunction(doupdate)
NoArgNoReturnFunction(endwin)
NoArgNoReturnFunction(flash)
NoArgNoReturnFunction(nocbreak)
NoArgNoReturnFunction(noecho)
NoArgNoReturnFunction(nonl)
NoArgNoReturnFunction(noraw)
NoArgNoReturnFunction(reset_prog_mode)
NoArgNoReturnFunction(reset_shell_mode)
NoArgNoReturnFunction(resetty)
NoArgNoReturnFunction(savetty)
NoArgOrFlagNoReturnFunction(cbreak)
NoArgOrFlagNoReturnFunction(echo)
NoArgOrFlagNoReturnFunction(nl)
NoArgOrFlagNoReturnFunction(raw)
NoArgReturnIntFunction(baudrate)
NoArgReturnIntFunction(termattrs)
NoArgReturnStringFunction(termname)
NoArgReturnStringFunction(longname)
NoArgTrueFalseFunction(can_change_color)
NoArgTrueFalseFunction(has_colors)
NoArgTrueFalseFunction(has_ic)
NoArgTrueFalseFunction(has_il)
NoArgTrueFalseFunction(isendwin)
NoArgNoReturnVoidFunction(flushinp)
NoArgNoReturnVoidFunction(noqiflush)
static PyObject *
PyCurses_filter(PyObject *self)
{
NoArgNoReturnFunction(beep)
NoArgNoReturnFunction(def_prog_mode)
NoArgNoReturnFunction(def_shell_mode)
NoArgNoReturnFunction(doupdate)
NoArgNoReturnFunction(endwin)
NoArgNoReturnFunction(flash)
NoArgNoReturnFunction(nocbreak)
NoArgNoReturnFunction(noecho)
NoArgNoReturnFunction(nonl)
NoArgNoReturnFunction(noraw)
NoArgNoReturnFunction(reset_prog_mode)
NoArgNoReturnFunction(reset_shell_mode)
NoArgNoReturnFunction(resetty)
NoArgNoReturnFunction(savetty)
NoArgOrFlagNoReturnFunction(cbreak)
NoArgOrFlagNoReturnFunction(echo)
NoArgOrFlagNoReturnFunction(nl)
NoArgOrFlagNoReturnFunction(raw)
NoArgReturnIntFunction(baudrate)
NoArgReturnIntFunction(termattrs)
NoArgReturnStringFunction(termname)
NoArgReturnStringFunction(longname)
NoArgTrueFalseFunction(can_change_color)
NoArgTrueFalseFunction(has_colors)
NoArgTrueFalseFunction(has_ic)
NoArgTrueFalseFunction(has_il)
NoArgTrueFalseFunction(isendwin)
NoArgNoReturnVoidFunction(flushinp)
NoArgNoReturnVoidFunction(noqiflush)
static PyObject *
PyCurses_filter(PyObject *self)
{
/* not checking for PyCursesInitialised here since filter() must
be called before initscr() */
filter();
Py_INCREF(Py_None);
return Py_None;
}
}
static PyObject *
PyCurses_Color_Content(PyObject *self, PyObject *args)
{
static PyObject *
PyCurses_Color_Content(PyObject *self, PyObject *args)
{
short color,r,g,b;
PyCursesInitialised
......@@ -1753,11 +1753,11 @@ PyCurses_Color_Content(PyObject *self, PyObject *args)
"Argument 1 was out of range. Check value of COLORS.");
return NULL;
}
}
}
static PyObject *
PyCurses_color_pair(PyObject *self, PyObject *args)
{
static PyObject *
PyCurses_color_pair(PyObject *self, PyObject *args)
{
int n;
PyCursesInitialised
......@@ -1765,11 +1765,11 @@ PyCurses_color_pair(PyObject *self, PyObject *args)
if (!PyArg_ParseTuple(args, "i:color_pair", &n)) return NULL;
return PyLong_FromLong((long) (n << 8));
}
}
static PyObject *
PyCurses_Curs_Set(PyObject *self, PyObject *args)
{
static PyObject *
PyCurses_Curs_Set(PyObject *self, PyObject *args)
{
int vis,erg;
PyCursesInitialised
......@@ -1780,11 +1780,11 @@ PyCurses_Curs_Set(PyObject *self, PyObject *args)
if (erg == ERR) return PyCursesCheckERR(erg, "curs_set");
return PyLong_FromLong((long) erg);
}
}
static PyObject *
PyCurses_Delay_Output(PyObject *self, PyObject *args)
{
static PyObject *
PyCurses_Delay_Output(PyObject *self, PyObject *args)
{
int ms;
PyCursesInitialised
......@@ -1792,11 +1792,11 @@ PyCurses_Delay_Output(PyObject *self, PyObject *args)
if (!PyArg_ParseTuple(args, "i:delay_output", &ms)) return NULL;
return PyCursesCheckERR(delay_output(ms), "delay_output");
}
}
static PyObject *
PyCurses_EraseChar(PyObject *self)
{
static PyObject *
PyCurses_EraseChar(PyObject *self)
{
char ch;
PyCursesInitialised
......@@ -1804,11 +1804,11 @@ PyCurses_EraseChar(PyObject *self)
ch = erasechar();
return PyBytes_FromStringAndSize(&ch, 1);
}
}
static PyObject *
PyCurses_getsyx(PyObject *self)
{
static PyObject *
PyCurses_getsyx(PyObject *self)
{
int x = 0;
int y = 0;
......@@ -1817,12 +1817,12 @@ PyCurses_getsyx(PyObject *self)
getsyx(y, x);
return Py_BuildValue("(ii)", y, x);
}
}
#ifdef NCURSES_MOUSE_VERSION
static PyObject *
PyCurses_GetMouse(PyObject *self)
{
static PyObject *
PyCurses_GetMouse(PyObject *self)
{
int rtn;
MEVENT event;
......@@ -1837,11 +1837,11 @@ PyCurses_GetMouse(PyObject *self)
(short)event.id,
event.x, event.y, event.z,
(long) event.bstate);
}
}
static PyObject *
PyCurses_UngetMouse(PyObject *self, PyObject *args)
{
static PyObject *
PyCurses_UngetMouse(PyObject *self, PyObject *args)
{
MEVENT event;
PyCursesInitialised
......@@ -1852,12 +1852,12 @@ PyCurses_UngetMouse(PyObject *self, PyObject *args)
return NULL;
return PyCursesCheckERR(ungetmouse(&event), "ungetmouse");
}
}
#endif
static PyObject *
PyCurses_GetWin(PyCursesWindowObject *self, PyObject *stream)
{
static PyObject *
PyCurses_GetWin(PyCursesWindowObject *self, PyObject *stream)
{
char fn[100];
int fd;
FILE *fp;
......@@ -1909,11 +1909,11 @@ PyCurses_GetWin(PyCursesWindowObject *self, PyObject *stream)
return NULL;
}
return PyCursesWindow_New(win);
}
}
static PyObject *
PyCurses_HalfDelay(PyObject *self, PyObject *args)
{
static PyObject *
PyCurses_HalfDelay(PyObject *self, PyObject *args)
{
unsigned char tenths;
PyCursesInitialised
......@@ -1921,12 +1921,12 @@ PyCurses_HalfDelay(PyObject *self, PyObject *args)
if (!PyArg_ParseTuple(args, "b:halfdelay", &tenths)) return NULL;
return PyCursesCheckERR(halfdelay(tenths), "halfdelay");
}
}
#ifndef STRICT_SYSV_CURSES
/* No has_key! */
static PyObject * PyCurses_has_key(PyObject *self, PyObject *args)
{
static PyObject * PyCurses_has_key(PyObject *self, PyObject *args)
{
int ch;
PyCursesInitialised
......@@ -1939,12 +1939,12 @@ static PyObject * PyCurses_has_key(PyObject *self, PyObject *args)
}
Py_INCREF(Py_True);
return Py_True;
}
}
#endif /* STRICT_SYSV_CURSES */
static PyObject *
PyCurses_Init_Color(PyObject *self, PyObject *args)
{
static PyObject *
PyCurses_Init_Color(PyObject *self, PyObject *args)
{
short color, r, g, b;
PyCursesInitialised
......@@ -1960,11 +1960,11 @@ PyCurses_Init_Color(PyObject *self, PyObject *args)
}
return PyCursesCheckERR(init_color(color, r, g, b), "init_color");
}
}
static PyObject *
PyCurses_Init_Pair(PyObject *self, PyObject *args)
{
static PyObject *
PyCurses_Init_Pair(PyObject *self, PyObject *args)
{
short pair, f, b;
PyCursesInitialised
......@@ -1978,13 +1978,13 @@ PyCurses_Init_Pair(PyObject *self, PyObject *args)
if (!PyArg_ParseTuple(args, "hhh;pair, f, b", &pair, &f, &b)) return NULL;
return PyCursesCheckERR(init_pair(pair, f, b), "init_pair");
}
}
static PyObject *ModDict;
static PyObject *ModDict;
static PyObject *
PyCurses_InitScr(PyObject *self)
{
static PyObject *
PyCurses_InitScr(PyObject *self)
{
WINDOW *win;
if (initialised == TRUE) {
......@@ -2082,11 +2082,11 @@ PyCurses_InitScr(PyObject *self)
SetDictInt("COLS", COLS);
return (PyObject *)PyCursesWindow_New(win);
}
}
static PyObject *
PyCurses_setupterm(PyObject* self, PyObject *args, PyObject* keywds)
{
static PyObject *
PyCurses_setupterm(PyObject* self, PyObject *args, PyObject* keywds)
{
int fd = -1;
int err;
char* termstr = NULL;
......@@ -2134,11 +2134,11 @@ PyCurses_setupterm(PyObject* self, PyObject *args, PyObject* keywds)
Py_INCREF(Py_None);
return Py_None;
}
}
static PyObject *
PyCurses_IntrFlush(PyObject *self, PyObject *args)
{
static PyObject *
PyCurses_IntrFlush(PyObject *self, PyObject *args)
{
int ch;
PyCursesInitialised
......@@ -2153,12 +2153,12 @@ PyCurses_IntrFlush(PyObject *self, PyObject *args)
}
return PyCursesCheckERR(intrflush(NULL,ch), "intrflush");
}
}
#ifdef HAVE_CURSES_IS_TERM_RESIZED
static PyObject *
PyCurses_Is_Term_Resized(PyObject *self, PyObject *args)
{
static PyObject *
PyCurses_Is_Term_Resized(PyObject *self, PyObject *args)
{
int lines;
int columns;
int result;
......@@ -2175,13 +2175,13 @@ PyCurses_Is_Term_Resized(PyObject *self, PyObject *args)
Py_INCREF(Py_False);
return Py_False;
}
}
}
#endif /* HAVE_CURSES_IS_TERM_RESIZED */
#if !defined(__NetBSD__)
static PyObject *
PyCurses_KeyName(PyObject *self, PyObject *args)
{
static PyObject *
PyCurses_KeyName(PyObject *self, PyObject *args)
{
const char *knp;
int ch;
......@@ -2196,22 +2196,22 @@ PyCurses_KeyName(PyObject *self, PyObject *args)
knp = keyname(ch);
return PyBytes_FromString((knp == NULL) ? "" : (char *)knp);
}
}
#endif
static PyObject *
PyCurses_KillChar(PyObject *self)
{
static PyObject *
PyCurses_KillChar(PyObject *self)
{
char ch;
ch = killchar();
return PyBytes_FromStringAndSize(&ch, 1);
}
}
static PyObject *
PyCurses_Meta(PyObject *self, PyObject *args)
{
static PyObject *
PyCurses_Meta(PyObject *self, PyObject *args)
{
int ch;
PyCursesInitialised
......@@ -2226,23 +2226,23 @@ PyCurses_Meta(PyObject *self, PyObject *args)
}
return PyCursesCheckERR(meta(stdscr, ch), "meta");
}
}
#ifdef NCURSES_MOUSE_VERSION
static PyObject *
PyCurses_MouseInterval(PyObject *self, PyObject *args)
{
static PyObject *
PyCurses_MouseInterval(PyObject *self, PyObject *args)
{
int interval;
PyCursesInitialised
if (!PyArg_ParseTuple(args,"i;interval",&interval))
return NULL;
return PyCursesCheckERR(mouseinterval(interval), "mouseinterval");
}
}
static PyObject *
PyCurses_MouseMask(PyObject *self, PyObject *args)
{
static PyObject *
PyCurses_MouseMask(PyObject *self, PyObject *args)
{
int newmask;
mmask_t oldmask, availmask;
......@@ -2251,24 +2251,24 @@ PyCurses_MouseMask(PyObject *self, PyObject *args)
return NULL;
availmask = mousemask(newmask, &oldmask);
return Py_BuildValue("(ll)", (long)availmask, (long)oldmask);
}
}
#endif
static PyObject *
PyCurses_Napms(PyObject *self, PyObject *args)
{
static PyObject *
PyCurses_Napms(PyObject *self, PyObject *args)
{
int ms;
PyCursesInitialised
if (!PyArg_ParseTuple(args, "i;ms", &ms)) return NULL;
return Py_BuildValue("i", napms(ms));
}
}
static PyObject *
PyCurses_NewPad(PyObject *self, PyObject *args)
{
static PyObject *
PyCurses_NewPad(PyObject *self, PyObject *args)
{
WINDOW *win;
int nlines, ncols;
......@@ -2284,11 +2284,11 @@ PyCurses_NewPad(PyObject *self, PyObject *args)
}
return (PyObject *)PyCursesWindow_New(win);
}
}
static PyObject *
PyCurses_NewWindow(PyObject *self, PyObject *args)
{
static PyObject *
PyCurses_NewWindow(PyObject *self, PyObject *args)
{
WINDOW *win;
int nlines, ncols, begin_y=0, begin_x=0;
......@@ -2316,11 +2316,11 @@ PyCurses_NewWindow(PyObject *self, PyObject *args)
}
return (PyObject *)PyCursesWindow_New(win);
}
}
static PyObject *
PyCurses_Pair_Content(PyObject *self, PyObject *args)
{
static PyObject *
PyCurses_Pair_Content(PyObject *self, PyObject *args)
{
short pair,f,b;
PyCursesInitialised
......@@ -2342,11 +2342,11 @@ PyCurses_Pair_Content(PyObject *self, PyObject *args)
}
return Py_BuildValue("(ii)", f, b);
}
}
static PyObject *
PyCurses_pair_number(PyObject *self, PyObject *args)
{
static PyObject *
PyCurses_pair_number(PyObject *self, PyObject *args)
{
int n;
PyCursesInitialised
......@@ -2363,20 +2363,20 @@ PyCurses_pair_number(PyObject *self, PyObject *args)
}
return PyLong_FromLong((long) ((n & A_COLOR) >> 8));
}
}
static PyObject *
PyCurses_Putp(PyObject *self, PyObject *args)
{
static PyObject *
PyCurses_Putp(PyObject *self, PyObject *args)
{
char *str;
if (!PyArg_ParseTuple(args,"s;str", &str)) return NULL;
return PyCursesCheckERR(putp(str), "putp");
}
}
static PyObject *
PyCurses_QiFlush(PyObject *self, PyObject *args)
{
static PyObject *
PyCurses_QiFlush(PyObject *self, PyObject *args)
{
int flag = 0;
PyCursesInitialised
......@@ -2396,14 +2396,14 @@ PyCurses_QiFlush(PyObject *self, PyObject *args)
PyErr_SetString(PyExc_TypeError, "qiflush requires 0 or 1 arguments");
return NULL;
}
}
}
/* Internal helper used for updating curses.LINES, curses.COLS, _curses.LINES
* and _curses.COLS */
#if defined(HAVE_CURSES_RESIZETERM) || defined(HAVE_CURSES_RESIZE_TERM)
static int
update_lines_cols(void)
{
static int
update_lines_cols(void)
{
PyObject *o;
PyObject *m = PyImport_ImportModuleNoBlock("curses");
......@@ -2444,13 +2444,13 @@ update_lines_cols(void)
Py_DECREF(o);
Py_DECREF(m);
return 1;
}
}
#endif
#ifdef HAVE_CURSES_RESIZETERM
static PyObject *
PyCurses_ResizeTerm(PyObject *self, PyObject *args)
{
static PyObject *
PyCurses_ResizeTerm(PyObject *self, PyObject *args)
{
int lines;
int columns;
PyObject *result;
......@@ -2466,14 +2466,14 @@ PyCurses_ResizeTerm(PyObject *self, PyObject *args)
if (!update_lines_cols())
return NULL;
return result;
}
}
#endif
#ifdef HAVE_CURSES_RESIZE_TERM
static PyObject *
PyCurses_Resize_Term(PyObject *self, PyObject *args)
{
static PyObject *
PyCurses_Resize_Term(PyObject *self, PyObject *args)
{
int lines;
int columns;
......@@ -2490,12 +2490,12 @@ PyCurses_Resize_Term(PyObject *self, PyObject *args)
if (!update_lines_cols())
return NULL;
return result;
}
}
#endif /* HAVE_CURSES_RESIZE_TERM */
static PyObject *
PyCurses_setsyx(PyObject *self, PyObject *args)
{
static PyObject *
PyCurses_setsyx(PyObject *self, PyObject *args)
{
int y,x;
PyCursesInitialised
......@@ -2511,11 +2511,11 @@ PyCurses_setsyx(PyObject *self, PyObject *args)
Py_INCREF(Py_None);
return Py_None;
}
}
static PyObject *
PyCurses_Start_Color(PyObject *self)
{
static PyObject *
PyCurses_Start_Color(PyObject *self)
{
int code;
PyObject *c, *cp;
......@@ -2536,11 +2536,11 @@ PyCurses_Start_Color(PyObject *self)
PyErr_SetString(PyCursesError, "start_color() returned ERR");
return NULL;
}
}
}
static PyObject *
PyCurses_tigetflag(PyObject *self, PyObject *args)
{
static PyObject *
PyCurses_tigetflag(PyObject *self, PyObject *args)
{
char *capname;
PyCursesSetupTermCalled;
......@@ -2549,11 +2549,11 @@ PyCurses_tigetflag(PyObject *self, PyObject *args)
return NULL;
return PyLong_FromLong( (long) tigetflag( capname ) );
}
}
static PyObject *
PyCurses_tigetnum(PyObject *self, PyObject *args)
{
static PyObject *
PyCurses_tigetnum(PyObject *self, PyObject *args)
{
char *capname;
PyCursesSetupTermCalled;
......@@ -2562,11 +2562,11 @@ PyCurses_tigetnum(PyObject *self, PyObject *args)
return NULL;
return PyLong_FromLong( (long) tigetnum( capname ) );
}
}
static PyObject *
PyCurses_tigetstr(PyObject *self, PyObject *args)
{
static PyObject *
PyCurses_tigetstr(PyObject *self, PyObject *args)
{
char *capname;
PyCursesSetupTermCalled;
......@@ -2580,11 +2580,11 @@ PyCurses_tigetstr(PyObject *self, PyObject *args)
return Py_None;
}
return PyBytes_FromString( capname );
}
}
static PyObject *
PyCurses_tparm(PyObject *self, PyObject *args)
{
static PyObject *
PyCurses_tparm(PyObject *self, PyObject *args)
{
char* fmt;
char* result = NULL;
int i1=0,i2=0,i3=0,i4=0,i5=0,i6=0,i7=0,i8=0,i9=0;
......@@ -2604,11 +2604,11 @@ PyCurses_tparm(PyObject *self, PyObject *args)
}
return PyBytes_FromString(result);
}
}
static PyObject *
PyCurses_TypeAhead(PyObject *self, PyObject *args)
{
static PyObject *
PyCurses_TypeAhead(PyObject *self, PyObject *args)
{
int fd;
PyCursesInitialised
......@@ -2616,11 +2616,11 @@ PyCurses_TypeAhead(PyObject *self, PyObject *args)
if (!PyArg_ParseTuple(args,"i;fd",&fd)) return NULL;
return PyCursesCheckERR(typeahead( fd ), "typeahead");
}
}
static PyObject *
PyCurses_UnCtrl(PyObject *self, PyObject *args)
{
static PyObject *
PyCurses_UnCtrl(PyObject *self, PyObject *args)
{
PyObject *temp;
chtype ch;
......@@ -2634,11 +2634,11 @@ PyCurses_UnCtrl(PyObject *self, PyObject *args)
}
return PyBytes_FromString(unctrl(ch));
}
}
static PyObject *
PyCurses_UngetCh(PyObject *self, PyObject *args)
{
static PyObject *
PyCurses_UngetCh(PyObject *self, PyObject *args)
{
PyObject *temp;
chtype ch;
......@@ -2652,11 +2652,11 @@ PyCurses_UngetCh(PyObject *self, PyObject *args)
}
return PyCursesCheckERR(ungetch(ch), "ungetch");
}
}
static PyObject *
PyCurses_Use_Env(PyObject *self, PyObject *args)
{
static PyObject *
PyCurses_Use_Env(PyObject *self, PyObject *args)
{
int flag;
switch(PyTuple_Size(args)) {
......@@ -2671,12 +2671,12 @@ PyCurses_Use_Env(PyObject *self, PyObject *args)
use_env(flag);
Py_INCREF(Py_None);
return Py_None;
}
}
#ifndef STRICT_SYSV_CURSES
static PyObject *
PyCurses_Use_Default_Colors(PyObject *self)
{
static PyObject *
PyCurses_Use_Default_Colors(PyObject *self)
{
int code;
PyCursesInitialised
......@@ -2690,12 +2690,12 @@ PyCurses_Use_Default_Colors(PyObject *self)
PyErr_SetString(PyCursesError, "use_default_colors() returned ERR");
return NULL;
}
}
}
#endif /* STRICT_SYSV_CURSES */
/* List of functions defined in the module */
static PyMethodDef PyCurses_methods[] = {
static PyMethodDef PyCurses_methods[] = {
{"baudrate", (PyCFunction)PyCurses_baudrate, METH_NOARGS},
{"beep", (PyCFunction)PyCurses_beep, METH_NOARGS},
{"can_change_color", (PyCFunction)PyCurses_can_change_color, METH_NOARGS},
......@@ -2786,12 +2786,12 @@ static PyMethodDef PyCurses_methods[] = {
{"use_default_colors", (PyCFunction)PyCurses_Use_Default_Colors, METH_NOARGS},
#endif
{NULL, NULL} /* sentinel */
};
};
/* Initialization function for the module */
static struct PyModuleDef _cursesmodule = {
static struct PyModuleDef _cursesmodule = {
PyModuleDef_HEAD_INIT,
"_curses",
NULL,
......@@ -2801,11 +2801,11 @@ static struct PyModuleDef _cursesmodule = {
NULL,
NULL,
NULL
};
};
PyMODINIT_FUNC
PyInit__curses(void)
{
PyMODINIT_FUNC
PyInit__curses(void)
{
PyObject *m, *d, *v, *c_api_object;
static void *PyCurses_API[PyCurses_API_pointers];
......@@ -2966,4 +2966,4 @@ PyInit__curses(void)
SetDictInt("KEY_MAX", KEY_MAX);
}
return m;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment