Back to index

python3.2  3.2.2
Defines | Functions | Variables
_cursesmodule.c File Reference
#include "Python.h"
#include "py_curses.h"

Go to the source code of this file.

Defines

#define PY_SSIZE_T_CLEAN
#define CURSES_MODULE
#define PyCursesSetupTermCalled
#define PyCursesInitialised
#define PyCursesInitialisedColor
#define MIN(x, y)   ((x) < (y) ? (x) : (y))
#define Window_NoArgNoReturnFunction(X)
#define Window_NoArgTrueFalseFunction(X)
#define Window_NoArgNoReturnVoidFunction(X)
#define Window_NoArg2TupleReturnFunction(X, TYPE, ERGSTR)
#define Window_OneArgNoReturnVoidFunction(X, TYPE, PARSESTR)
#define Window_OneArgNoReturnFunction(X, TYPE, PARSESTR)
#define Window_TwoArgNoReturnFunction(X, TYPE, PARSESTR)
#define SetDictInt(string, ch)

Functions

int setupterm (char *, int, int *)
static PyObjectPyCursesCheckERR (int code, char *fname)
static int PyCurses_ConvertToChtype (PyObject *obj, chtype *ch)
static int func_PyCursesSetupTermCalled (void)
static int func_PyCursesInitialised (void)
static int func_PyCursesInitialisedColor (void)
 Window_NoArgNoReturnFunction (untouchwin)
static void PyCursesWindow_Dealloc (PyCursesWindowObject *wo)
static PyObjectPyCursesWindow_AddCh (PyCursesWindowObject *self, PyObject *args)
static PyObjectPyCursesWindow_AddStr (PyCursesWindowObject *self, PyObject *args)
static PyObjectPyCursesWindow_AddNStr (PyCursesWindowObject *self, PyObject *args)
static PyObjectPyCursesWindow_Bkgd (PyCursesWindowObject *self, PyObject *args)
static PyObjectPyCursesWindow_AttrOff (PyCursesWindowObject *self, PyObject *args)
static PyObjectPyCursesWindow_AttrOn (PyCursesWindowObject *self, PyObject *args)
static PyObjectPyCursesWindow_AttrSet (PyCursesWindowObject *self, PyObject *args)
static PyObjectPyCursesWindow_BkgdSet (PyCursesWindowObject *self, PyObject *args)
static PyObjectPyCursesWindow_Border (PyCursesWindowObject *self, PyObject *args)
static PyObjectPyCursesWindow_Box (PyCursesWindowObject *self, PyObject *args)
int py_mvwdelch (WINDOW *w, int y, int x)
static PyObjectPyCursesWindow_ChgAt (PyCursesWindowObject *self, PyObject *args)
static PyObjectPyCursesWindow_DelCh (PyCursesWindowObject *self, PyObject *args)
static PyObjectPyCursesWindow_DerWin (PyCursesWindowObject *self, PyObject *args)
static PyObjectPyCursesWindow_EchoChar (PyCursesWindowObject *self, PyObject *args)
static PyObjectPyCursesWindow_GetBkgd (PyCursesWindowObject *self)
static PyObjectPyCursesWindow_GetCh (PyCursesWindowObject *self, PyObject *args)
static PyObjectPyCursesWindow_GetKey (PyCursesWindowObject *self, PyObject *args)
static PyObjectPyCursesWindow_GetStr (PyCursesWindowObject *self, PyObject *args)
static PyObjectPyCursesWindow_Hline (PyCursesWindowObject *self, PyObject *args)
static PyObjectPyCursesWindow_InsCh (PyCursesWindowObject *self, PyObject *args)
static PyObjectPyCursesWindow_InCh (PyCursesWindowObject *self, PyObject *args)
static PyObjectPyCursesWindow_InStr (PyCursesWindowObject *self, PyObject *args)
static PyObjectPyCursesWindow_InsStr (PyCursesWindowObject *self, PyObject *args)
static PyObjectPyCursesWindow_InsNStr (PyCursesWindowObject *self, PyObject *args)
static PyObjectPyCursesWindow_Is_LineTouched (PyCursesWindowObject *self, PyObject *args)
static PyObjectPyCursesWindow_NoOutRefresh (PyCursesWindowObject *self, PyObject *args)
static PyObjectPyCursesWindow_Overlay (PyCursesWindowObject *self, PyObject *args)
static PyObjectPyCursesWindow_Overwrite (PyCursesWindowObject *self, PyObject *args)
static PyObjectPyCursesWindow_PutWin (PyCursesWindowObject *self, PyObject *stream)
static PyObjectPyCursesWindow_RedrawLine (PyCursesWindowObject *self, PyObject *args)
static PyObjectPyCursesWindow_Refresh (PyCursesWindowObject *self, PyObject *args)
static PyObjectPyCursesWindow_SetScrollRegion (PyCursesWindowObject *self, PyObject *args)
static PyObjectPyCursesWindow_SubWin (PyCursesWindowObject *self, PyObject *args)
static PyObjectPyCursesWindow_Scroll (PyCursesWindowObject *self, PyObject *args)
static PyObjectPyCursesWindow_TouchLine (PyCursesWindowObject *self, PyObject *args)
static PyObjectPyCursesWindow_Vline (PyCursesWindowObject *self, PyObject *args)
 NoArgNoReturnFunction (beep)
static PyObjectPyCurses_Color_Content (PyObject *self, PyObject *args)
static PyObjectPyCurses_color_pair (PyObject *self, PyObject *args)
static PyObjectPyCurses_Curs_Set (PyObject *self, PyObject *args)
static PyObjectPyCurses_Delay_Output (PyObject *self, PyObject *args)
static PyObjectPyCurses_EraseChar (PyObject *self)
static PyObjectPyCurses_getsyx (PyObject *self)
static PyObjectPyCurses_GetWin (PyCursesWindowObject *self, PyObject *stream)
static PyObjectPyCurses_HalfDelay (PyObject *self, PyObject *args)
static PyObjectPyCurses_has_key (PyObject *self, PyObject *args)
static PyObjectPyCurses_Init_Color (PyObject *self, PyObject *args)
static PyObjectPyCurses_Init_Pair (PyObject *self, PyObject *args)
static PyObjectPyCurses_InitScr (PyObject *self)
static PyObjectPyCurses_setupterm (PyObject *self, PyObject *args, PyObject *keywds)
static PyObjectPyCurses_IntrFlush (PyObject *self, PyObject *args)
static PyObjectPyCurses_KeyName (PyObject *self, PyObject *args)
static PyObjectPyCurses_KillChar (PyObject *self)
static PyObjectPyCurses_Meta (PyObject *self, PyObject *args)
static PyObjectPyCurses_Napms (PyObject *self, PyObject *args)
static PyObjectPyCurses_NewPad (PyObject *self, PyObject *args)
static PyObjectPyCurses_NewWindow (PyObject *self, PyObject *args)
static PyObjectPyCurses_Pair_Content (PyObject *self, PyObject *args)
static PyObjectPyCurses_pair_number (PyObject *self, PyObject *args)
static PyObjectPyCurses_Putp (PyObject *self, PyObject *args)
static PyObjectPyCurses_QiFlush (PyObject *self, PyObject *args)
static PyObjectPyCurses_setsyx (PyObject *self, PyObject *args)
static PyObjectPyCurses_Start_Color (PyObject *self)
static PyObjectPyCurses_tigetflag (PyObject *self, PyObject *args)
static PyObjectPyCurses_tigetnum (PyObject *self, PyObject *args)
static PyObjectPyCurses_tigetstr (PyObject *self, PyObject *args)
static PyObjectPyCurses_tparm (PyObject *self, PyObject *args)
static PyObjectPyCurses_TypeAhead (PyObject *self, PyObject *args)
static PyObjectPyCurses_UnCtrl (PyObject *self, PyObject *args)
static PyObjectPyCurses_UngetCh (PyObject *self, PyObject *args)
static PyObjectPyCurses_Use_Env (PyObject *self, PyObject *args)
static PyObjectPyCurses_Use_Default_Colors (PyObject *self)
PyMODINIT_FUNC PyInit__curses (void)

Variables

char * PyCursesVersion = "2.2"
static PyObjectPyCursesError
static int initialised_setupterm = FALSE
static int initialised = FALSE
static int initialisedcolors = FALSE
PyTypeObject PyCursesWindow_Type
static PyMethodDef PyCursesWindow_Methods []
static PyObjectModDict
static PyMethodDef PyCurses_methods []
static struct PyModuleDef

Define Documentation

#define CURSES_MODULE

Definition at line 116 of file _cursesmodule.c.

#define MIN (   x,
 
)    ((x) < (y) ? (x) : (y))

Definition at line 170 of file _cursesmodule.c.

Definition at line 103 of file _cursesmodule.c.

Value:
if (initialised != TRUE) {                          \
        PyErr_SetString(PyCursesError,                  \
                        "must call initscr() first");   \
        return 0; }

Definition at line 157 of file _cursesmodule.c.

Value:
if (initialisedcolors != TRUE) {                            \
        PyErr_SetString(PyCursesError,                          \
                        "must call start_color() first");       \
        return 0; }

Definition at line 163 of file _cursesmodule.c.

Value:
if (initialised_setupterm != TRUE) {                                \
        PyErr_SetString(PyCursesError,                                  \
                        "must call (at least) setupterm() first");      \
        return 0; }

Definition at line 151 of file _cursesmodule.c.

#define SetDictInt (   string,
  ch 
)
Value:
do {                                                                \
        PyObject *o = PyLong_FromLong((long) (ch));                     \
        if (o && PyDict_SetItemString(ModDict, string, o) == 0)     {   \
            Py_DECREF(o);                                               \
        }                                                               \
    } while (0)
#define Window_NoArg2TupleReturnFunction (   X,
  TYPE,
  ERGSTR 
)
Value:
static PyObject * PyCursesWindow_ ## X                              \
    (PyCursesWindowObject *self)                                        \
    {                                                                   \
        TYPE arg1, arg2;                                                \
        X(self->win,arg1,arg2); return Py_BuildValue(ERGSTR, arg1, arg2); }

Definition at line 273 of file _cursesmodule.c.

Value:
static PyObject *PyCursesWindow_ ## X               \
    (PyCursesWindowObject *self, PyObject *args)        \
    { return PyCursesCheckERR(X(self->win), # X); }

Definition at line 255 of file _cursesmodule.c.

Value:
static PyObject * PyCursesWindow_ ## X                      \
    (PyCursesWindowObject *self)                                \
    {                                                           \
        X(self->win); Py_INCREF(Py_None); return Py_None; }

Definition at line 267 of file _cursesmodule.c.

Value:
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; } }

Definition at line 260 of file _cursesmodule.c.

#define Window_OneArgNoReturnFunction (   X,
  TYPE,
  PARSESTR 
)
Value:
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); }

Definition at line 288 of file _cursesmodule.c.

#define Window_OneArgNoReturnVoidFunction (   X,
  TYPE,
  PARSESTR 
)
Value:
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; }

Definition at line 280 of file _cursesmodule.c.

#define Window_TwoArgNoReturnFunction (   X,
  TYPE,
  PARSESTR 
)
Value:
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); }

Definition at line 296 of file _cursesmodule.c.


Function Documentation

static int func_PyCursesInitialised ( void  ) [static]

Definition at line 227 of file _cursesmodule.c.

{
    PyCursesInitialised;
    return 1;
}

Here is the caller graph for this function:

static int func_PyCursesInitialisedColor ( void  ) [static]

Definition at line 233 of file _cursesmodule.c.

{
    PyCursesInitialisedColor;
    return 1;
}

Here is the caller graph for this function:

static int func_PyCursesSetupTermCalled ( void  ) [static]

Definition at line 221 of file _cursesmodule.c.

{
    PyCursesSetupTermCalled;
    return 1;
}

Here is the caller graph for this function:

Definition at line 1704 of file _cursesmodule.c.

{
    /* not checking for PyCursesInitialised here since filter() must
       be called before initscr() */
    filter();
    Py_INCREF(Py_None);
    return Py_None;
}

Here is the call graph for this function:

int py_mvwdelch ( WINDOW *  w,
int  y,
int  x 
)

Definition at line 669 of file _cursesmodule.c.

{
    mvwdelch(w,y,x);
    /* On HP/UX, mvwdelch already returns. On other systems,
       we may well run into this return statement. */
    return 0;
}

Here is the caller graph for this function:

static PyObject* PyCurses_Color_Content ( PyObject self,
PyObject args 
) [static]

Definition at line 1749 of file _cursesmodule.c.

{
    short color,r,g,b;

    PyCursesInitialised;
    PyCursesInitialisedColor;

    if (!PyArg_ParseTuple(args, "h:color_content", &color)) return NULL;

    if (color_content(color, &r, &g, &b) != ERR)
        return Py_BuildValue("(iii)", r, g, b);
    else {
        PyErr_SetString(PyCursesError,
                        "Argument 1 was out of range. Check value of COLORS.");
        return NULL;
    }
}

Here is the call graph for this function:

static PyObject* PyCurses_color_pair ( PyObject self,
PyObject args 
) [static]

Definition at line 1768 of file _cursesmodule.c.

{
    int n;

    PyCursesInitialised;
    PyCursesInitialisedColor;

    if (!PyArg_ParseTuple(args, "i:color_pair", &n)) return NULL;
    return PyLong_FromLong((long) (n << 8));
}

Here is the call graph for this function:

static int PyCurses_ConvertToChtype ( PyObject obj,
chtype *  ch 
) [static]

Definition at line 198 of file _cursesmodule.c.

{
    if (PyLong_CheckExact(obj)) {
        int overflow;
        /* XXX should the truncation by the cast also be reported
           as an error? */
        *ch = (chtype) PyLong_AsLongAndOverflow(obj, &overflow);
        if (overflow)
            return 0;
    } else if(PyBytes_Check(obj)
              && (PyBytes_Size(obj) == 1)) {
        *ch = (chtype) *PyBytes_AsString(obj);
    } else if (PyUnicode_Check(obj) && PyUnicode_GetSize(obj) == 1) {
        *ch = (chtype) *PyUnicode_AS_UNICODE(obj);
    } else {
        return 0;
    }
    return 1;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static PyObject* PyCurses_Curs_Set ( PyObject self,
PyObject args 
) [static]

Definition at line 1780 of file _cursesmodule.c.

{
    int vis,erg;

    PyCursesInitialised;

    if (!PyArg_ParseTuple(args, "i:curs_set", &vis)) return NULL;

    erg = curs_set(vis);
    if (erg == ERR) return PyCursesCheckERR(erg, "curs_set");

    return PyLong_FromLong((long) erg);
}

Here is the call graph for this function:

static PyObject* PyCurses_Delay_Output ( PyObject self,
PyObject args 
) [static]

Definition at line 1795 of file _cursesmodule.c.

{
    int ms;

    PyCursesInitialised;

    if (!PyArg_ParseTuple(args, "i:delay_output", &ms)) return NULL;

    return PyCursesCheckERR(delay_output(ms), "delay_output");
}

Here is the call graph for this function:

static PyObject* PyCurses_EraseChar ( PyObject self) [static]

Definition at line 1807 of file _cursesmodule.c.

{
    char ch;

    PyCursesInitialised;

    ch = erasechar();

    return PyBytes_FromStringAndSize(&ch, 1);
}

Here is the call graph for this function:

static PyObject* PyCurses_getsyx ( PyObject self) [static]

Definition at line 1819 of file _cursesmodule.c.

{
    int x = 0;
    int y = 0;

    PyCursesInitialised;

    getsyx(y, x);

    return Py_BuildValue("(ii)", y, x);
}

Here is the call graph for this function:

static PyObject* PyCurses_GetWin ( PyCursesWindowObject self,
PyObject stream 
) [static]

Definition at line 1868 of file _cursesmodule.c.

{
    char fn[100];
    int fd;
    FILE *fp;
    PyObject *data;
    size_t datalen;
    WINDOW *win;

    PyCursesInitialised;

    strcpy(fn, "/tmp/py.curses.getwin.XXXXXX");
    fd = mkstemp(fn);
    if (fd < 0)
        return PyErr_SetFromErrnoWithFilename(PyExc_IOError, fn);
    fp = fdopen(fd, "wb+");
    if (fp == NULL) {
        close(fd);
        remove(fn);
        return PyErr_SetFromErrnoWithFilename(PyExc_IOError, fn);
    }
    data = PyObject_CallMethod(stream, "read", "");
    if (data == NULL) {
        fclose(fp);
        remove(fn);
        return NULL;
    }
    if (!PyBytes_Check(data)) {
        PyErr_Format(PyExc_TypeError,
                     "f.read() returned %.100s instead of bytes",
                     data->ob_type->tp_name);
        Py_DECREF(data);
        fclose(fp);
        remove(fn);
        return NULL;
    }
    datalen = PyBytes_GET_SIZE(data);
    if (fwrite(PyBytes_AS_STRING(data), 1, datalen, fp) != datalen) {
        Py_DECREF(data);
        fclose(fp);
        remove(fn);
        return PyErr_SetFromErrnoWithFilename(PyExc_IOError, fn);
    }
    Py_DECREF(data);
    fseek(fp, 0, 0);
    win = getwin(fp);
    fclose(fp);
    remove(fn);
    if (win == NULL) {
        PyErr_SetString(PyCursesError, catchall_NULL);
        return NULL;
    }
    return PyCursesWindow_New(win);
}

Here is the call graph for this function:

static PyObject* PyCurses_HalfDelay ( PyObject self,
PyObject args 
) [static]

Definition at line 1924 of file _cursesmodule.c.

{
    unsigned char tenths;

    PyCursesInitialised;

    if (!PyArg_ParseTuple(args, "b:halfdelay", &tenths)) return NULL;

    return PyCursesCheckERR(halfdelay(tenths), "halfdelay");
}

Here is the call graph for this function:

static PyObject* PyCurses_has_key ( PyObject self,
PyObject args 
) [static]

Definition at line 1937 of file _cursesmodule.c.

{
    int ch;

    PyCursesInitialised;

    if (!PyArg_ParseTuple(args,"i",&ch)) return NULL;

    if (has_key(ch) == FALSE) {
        Py_INCREF(Py_False);
        return Py_False;
    }
    Py_INCREF(Py_True);
    return Py_True;
}

Here is the call graph for this function:

static PyObject* PyCurses_Init_Color ( PyObject self,
PyObject args 
) [static]

Definition at line 1955 of file _cursesmodule.c.

{
    short color, r, g, b;

    PyCursesInitialised;
    PyCursesInitialisedColor;

    switch(PyTuple_Size(args)) {
    case 4:
        if (!PyArg_ParseTuple(args, "hhhh;color,r,g,b", &color, &r, &g, &b)) return NULL;
        break;
    default:
        PyErr_SetString(PyExc_TypeError, "init_color requires 4 arguments");
        return NULL;
    }

    return PyCursesCheckERR(init_color(color, r, g, b), "init_color");
}

Here is the call graph for this function:

static PyObject* PyCurses_Init_Pair ( PyObject self,
PyObject args 
) [static]

Definition at line 1975 of file _cursesmodule.c.

{
    short pair, f, b;

    PyCursesInitialised;
    PyCursesInitialisedColor;

    if (PyTuple_Size(args) != 3) {
        PyErr_SetString(PyExc_TypeError, "init_pair requires 3 arguments");
        return NULL;
    }

    if (!PyArg_ParseTuple(args, "hhh;pair, f, b", &pair, &f, &b)) return NULL;

    return PyCursesCheckERR(init_pair(pair, f, b), "init_pair");
}

Here is the call graph for this function:

static PyObject* PyCurses_InitScr ( PyObject self) [static]

Definition at line 1995 of file _cursesmodule.c.

{
    WINDOW *win;

    if (initialised == TRUE) {
        wrefresh(stdscr);
        return (PyObject *)PyCursesWindow_New(stdscr);
    }

    win = initscr();

    if (win == NULL) {
        PyErr_SetString(PyCursesError, catchall_NULL);
        return NULL;
    }

    initialised = initialised_setupterm = TRUE;

/* This was moved from initcurses() because it core dumped on SGI,
   where they're not defined until you've called initscr() */
#define SetDictInt(string,ch)                                           \
    do {                                                                \
        PyObject *o = PyLong_FromLong((long) (ch));                     \
        if (o && PyDict_SetItemString(ModDict, string, o) == 0)     {   \
            Py_DECREF(o);                                               \
        }                                                               \
    } while (0)

    /* Here are some graphic symbols you can use */
    SetDictInt("ACS_ULCORNER",      (ACS_ULCORNER));
    SetDictInt("ACS_LLCORNER",      (ACS_LLCORNER));
    SetDictInt("ACS_URCORNER",      (ACS_URCORNER));
    SetDictInt("ACS_LRCORNER",      (ACS_LRCORNER));
    SetDictInt("ACS_LTEE",          (ACS_LTEE));
    SetDictInt("ACS_RTEE",          (ACS_RTEE));
    SetDictInt("ACS_BTEE",          (ACS_BTEE));
    SetDictInt("ACS_TTEE",          (ACS_TTEE));
    SetDictInt("ACS_HLINE",         (ACS_HLINE));
    SetDictInt("ACS_VLINE",         (ACS_VLINE));
    SetDictInt("ACS_PLUS",          (ACS_PLUS));
#if !defined(__hpux) || defined(HAVE_NCURSES_H)
    /* On HP/UX 11, these are of type cchar_t, which is not an
       integral type. If this is a problem on more platforms, a
       configure test should be added to determine whether ACS_S1
       is of integral type. */
    SetDictInt("ACS_S1",            (ACS_S1));
    SetDictInt("ACS_S9",            (ACS_S9));
    SetDictInt("ACS_DIAMOND",       (ACS_DIAMOND));
    SetDictInt("ACS_CKBOARD",       (ACS_CKBOARD));
    SetDictInt("ACS_DEGREE",        (ACS_DEGREE));
    SetDictInt("ACS_PLMINUS",       (ACS_PLMINUS));
    SetDictInt("ACS_BULLET",        (ACS_BULLET));
    SetDictInt("ACS_LARROW",        (ACS_LARROW));
    SetDictInt("ACS_RARROW",        (ACS_RARROW));
    SetDictInt("ACS_DARROW",        (ACS_DARROW));
    SetDictInt("ACS_UARROW",        (ACS_UARROW));
    SetDictInt("ACS_BOARD",         (ACS_BOARD));
    SetDictInt("ACS_LANTERN",       (ACS_LANTERN));
    SetDictInt("ACS_BLOCK",         (ACS_BLOCK));
#endif
    SetDictInt("ACS_BSSB",          (ACS_ULCORNER));
    SetDictInt("ACS_SSBB",          (ACS_LLCORNER));
    SetDictInt("ACS_BBSS",          (ACS_URCORNER));
    SetDictInt("ACS_SBBS",          (ACS_LRCORNER));
    SetDictInt("ACS_SBSS",          (ACS_RTEE));
    SetDictInt("ACS_SSSB",          (ACS_LTEE));
    SetDictInt("ACS_SSBS",          (ACS_BTEE));
    SetDictInt("ACS_BSSS",          (ACS_TTEE));
    SetDictInt("ACS_BSBS",          (ACS_HLINE));
    SetDictInt("ACS_SBSB",          (ACS_VLINE));
    SetDictInt("ACS_SSSS",          (ACS_PLUS));

    /* The following are never available with strict SYSV curses */
#ifdef ACS_S3
    SetDictInt("ACS_S3",            (ACS_S3));
#endif
#ifdef ACS_S7
    SetDictInt("ACS_S7",            (ACS_S7));
#endif
#ifdef ACS_LEQUAL
    SetDictInt("ACS_LEQUAL",        (ACS_LEQUAL));
#endif
#ifdef ACS_GEQUAL
    SetDictInt("ACS_GEQUAL",        (ACS_GEQUAL));
#endif
#ifdef ACS_PI
    SetDictInt("ACS_PI",            (ACS_PI));
#endif
#ifdef ACS_NEQUAL
    SetDictInt("ACS_NEQUAL",        (ACS_NEQUAL));
#endif
#ifdef ACS_STERLING
    SetDictInt("ACS_STERLING",      (ACS_STERLING));
#endif

    SetDictInt("LINES", LINES);
    SetDictInt("COLS", COLS);

    return (PyObject *)PyCursesWindow_New(win);
}

Here is the call graph for this function:

static PyObject* PyCurses_IntrFlush ( PyObject self,
PyObject args 
) [static]

Definition at line 2149 of file _cursesmodule.c.

{
    int ch;

    PyCursesInitialised;

    switch(PyTuple_Size(args)) {
    case 1:
        if (!PyArg_ParseTuple(args,"i;True(1), False(0)",&ch)) return NULL;
        break;
    default:
        PyErr_SetString(PyExc_TypeError, "intrflush requires 1 argument");
        return NULL;
    }

    return PyCursesCheckERR(intrflush(NULL,ch), "intrflush");
}

Here is the call graph for this function:

static PyObject* PyCurses_KeyName ( PyObject self,
PyObject args 
) [static]

Definition at line 2192 of file _cursesmodule.c.

{
    const char *knp;
    int ch;

    PyCursesInitialised;

    if (!PyArg_ParseTuple(args,"i",&ch)) return NULL;

    if (ch < 0) {
        PyErr_SetString(PyExc_ValueError, "invalid key number");
        return NULL;
    }
    knp = keyname(ch);

    return PyBytes_FromString((knp == NULL) ? "" : (char *)knp);
}

Here is the call graph for this function:

static PyObject* PyCurses_KillChar ( PyObject self) [static]

Definition at line 2212 of file _cursesmodule.c.

{
    char ch;

    ch = killchar();

    return PyBytes_FromStringAndSize(&ch, 1);
}

Here is the call graph for this function:

static PyObject* PyCurses_Meta ( PyObject self,
PyObject args 
) [static]

Definition at line 2222 of file _cursesmodule.c.

{
    int ch;

    PyCursesInitialised;

    switch(PyTuple_Size(args)) {
    case 1:
        if (!PyArg_ParseTuple(args,"i;True(1), False(0)",&ch)) return NULL;
        break;
    default:
        PyErr_SetString(PyExc_TypeError, "meta requires 1 argument");
        return NULL;
    }

    return PyCursesCheckERR(meta(stdscr, ch), "meta");
}

Here is the call graph for this function:

static PyObject* PyCurses_Napms ( PyObject self,
PyObject args 
) [static]

Definition at line 2267 of file _cursesmodule.c.

{
    int ms;

    PyCursesInitialised;
    if (!PyArg_ParseTuple(args, "i;ms", &ms)) return NULL;

    return Py_BuildValue("i", napms(ms));
}

Here is the call graph for this function:

static PyObject* PyCurses_NewPad ( PyObject self,
PyObject args 
) [static]

Definition at line 2279 of file _cursesmodule.c.

{
    WINDOW *win;
    int nlines, ncols;

    PyCursesInitialised;

    if (!PyArg_ParseTuple(args,"ii;nlines,ncols",&nlines,&ncols)) return NULL;

    win = newpad(nlines, ncols);

    if (win == NULL) {
        PyErr_SetString(PyCursesError, catchall_NULL);
        return NULL;
    }

    return (PyObject *)PyCursesWindow_New(win);
}

Here is the call graph for this function:

static PyObject* PyCurses_NewWindow ( PyObject self,
PyObject args 
) [static]

Definition at line 2299 of file _cursesmodule.c.

{
    WINDOW *win;
    int nlines, ncols, begin_y=0, begin_x=0;

    PyCursesInitialised;

    switch (PyTuple_Size(args)) {
    case 2:
        if (!PyArg_ParseTuple(args,"ii;nlines,ncols",&nlines,&ncols))
            return NULL;
        break;
    case 4:
        if (!PyArg_ParseTuple(args, "iiii;nlines,ncols,begin_y,begin_x",
                              &nlines,&ncols,&begin_y,&begin_x))
            return NULL;
        break;
    default:
        PyErr_SetString(PyExc_TypeError, "newwin requires 2 or 4 arguments");
        return NULL;
    }

    win = newwin(nlines,ncols,begin_y,begin_x);
    if (win == NULL) {
        PyErr_SetString(PyCursesError, catchall_NULL);
        return NULL;
    }

    return (PyObject *)PyCursesWindow_New(win);
}

Here is the call graph for this function:

static PyObject* PyCurses_Pair_Content ( PyObject self,
PyObject args 
) [static]

Definition at line 2331 of file _cursesmodule.c.

{
    short pair,f,b;

    PyCursesInitialised;
    PyCursesInitialisedColor;

    switch(PyTuple_Size(args)) {
    case 1:
        if (!PyArg_ParseTuple(args, "h;pair", &pair)) return NULL;
        break;
    default:
        PyErr_SetString(PyExc_TypeError, "pair_content requires 1 argument");
        return NULL;
    }

    if (pair_content(pair, &f, &b)==ERR) {
        PyErr_SetString(PyCursesError,
                        "Argument 1 was out of range. (1..COLOR_PAIRS-1)");
        return NULL;
    }

    return Py_BuildValue("(ii)", f, b);
}

Here is the call graph for this function:

static PyObject* PyCurses_pair_number ( PyObject self,
PyObject args 
) [static]

Definition at line 2357 of file _cursesmodule.c.

{
    int n;

    PyCursesInitialised;
    PyCursesInitialisedColor;

    switch(PyTuple_Size(args)) {
    case 1:
        if (!PyArg_ParseTuple(args, "i;pairvalue", &n)) return NULL;
        break;
    default:
        PyErr_SetString(PyExc_TypeError,
                        "pair_number requires 1 argument");
        return NULL;
    }

    return PyLong_FromLong((long) ((n & A_COLOR) >> 8));
}

Here is the call graph for this function:

static PyObject* PyCurses_Putp ( PyObject self,
PyObject args 
) [static]

Definition at line 2378 of file _cursesmodule.c.

{
    char *str;

    if (!PyArg_ParseTuple(args,"s;str", &str)) return NULL;
    return PyCursesCheckERR(putp(str), "putp");
}

Here is the call graph for this function:

static PyObject* PyCurses_QiFlush ( PyObject self,
PyObject args 
) [static]

Definition at line 2387 of file _cursesmodule.c.

{
    int flag = 0;

    PyCursesInitialised;

    switch(PyTuple_Size(args)) {
    case 0:
        qiflush();
        Py_INCREF(Py_None);
        return Py_None;
    case 1:
        if (!PyArg_ParseTuple(args, "i;True(1) or False(0)", &flag)) return NULL;
        if (flag) qiflush();
        else noqiflush();
        Py_INCREF(Py_None);
        return Py_None;
    default:
        PyErr_SetString(PyExc_TypeError, "qiflush requires 0 or 1 arguments");
        return NULL;
    }
}

Here is the call graph for this function:

static PyObject* PyCurses_setsyx ( PyObject self,
PyObject args 
) [static]

Definition at line 2506 of file _cursesmodule.c.

{
    int y,x;

    PyCursesInitialised;

    if (PyTuple_Size(args)!=2) {
        PyErr_SetString(PyExc_TypeError, "setsyx requires 2 arguments");
        return NULL;
    }

    if (!PyArg_ParseTuple(args, "ii;y, x", &y, &x)) return NULL;

    setsyx(y,x);

    Py_INCREF(Py_None);
    return Py_None;
}

Here is the call graph for this function:

static PyObject* PyCurses_setupterm ( PyObject self,
PyObject args,
PyObject keywds 
) [static]

Definition at line 2097 of file _cursesmodule.c.

{
    int fd = -1;
    int err;
    char* termstr = NULL;

    static char *kwlist[] = {"term", "fd", NULL};

    if (!PyArg_ParseTupleAndKeywords(
            args, keywds, "|zi:setupterm", kwlist, &termstr, &fd)) {
        return NULL;
    }

    if (fd == -1) {
        PyObject* sys_stdout;

        sys_stdout = PySys_GetObject("stdout");

        if (sys_stdout == NULL || sys_stdout == Py_None) {
            PyErr_SetString(
                PyCursesError,
                "lost sys.stdout");
            return NULL;
        }

        fd = PyObject_AsFileDescriptor(sys_stdout);

        if (fd == -1) {
            return NULL;
        }
    }

    if (!initialised_setupterm && setupterm(termstr,fd,&err) == ERR) {
        char* s = "setupterm: unknown error";

        if (err == 0) {
            s = "setupterm: could not find terminal";
        } else if (err == -1) {
            s = "setupterm: could not find terminfo database";
        }

        PyErr_SetString(PyCursesError,s);
        return NULL;
    }

    initialised_setupterm = TRUE;

    Py_INCREF(Py_None);
    return Py_None;
}

Here is the call graph for this function:

static PyObject* PyCurses_Start_Color ( PyObject self) [static]

Definition at line 2526 of file _cursesmodule.c.

{
    int code;
    PyObject *c, *cp;

    PyCursesInitialised;

    code = start_color();
    if (code != ERR) {
        initialisedcolors = TRUE;
        c = PyLong_FromLong((long) COLORS);
        PyDict_SetItemString(ModDict, "COLORS", c);
        Py_DECREF(c);
        cp = PyLong_FromLong((long) COLOR_PAIRS);
        PyDict_SetItemString(ModDict, "COLOR_PAIRS", cp);
        Py_DECREF(cp);
        Py_INCREF(Py_None);
        return Py_None;
    } else {
        PyErr_SetString(PyCursesError, "start_color() returned ERR");
        return NULL;
    }
}

Here is the call graph for this function:

static PyObject* PyCurses_tigetflag ( PyObject self,
PyObject args 
) [static]

Definition at line 2551 of file _cursesmodule.c.

{
    char *capname;

    PyCursesSetupTermCalled;

    if (!PyArg_ParseTuple(args, "s", &capname))
        return NULL;

    return PyLong_FromLong( (long) tigetflag( capname ) );
}

Here is the call graph for this function:

static PyObject* PyCurses_tigetnum ( PyObject self,
PyObject args 
) [static]

Definition at line 2564 of file _cursesmodule.c.

{
    char *capname;

    PyCursesSetupTermCalled;

    if (!PyArg_ParseTuple(args, "s", &capname))
        return NULL;

    return PyLong_FromLong( (long) tigetnum( capname ) );
}

Here is the call graph for this function:

static PyObject* PyCurses_tigetstr ( PyObject self,
PyObject args 
) [static]

Definition at line 2577 of file _cursesmodule.c.

{
    char *capname;

    PyCursesSetupTermCalled;

    if (!PyArg_ParseTuple(args, "s", &capname))
        return NULL;

    capname = tigetstr( capname );
    if (capname == 0 || capname == (char*) -1) {
        Py_INCREF(Py_None);
        return Py_None;
    }
    return PyBytes_FromString( capname );
}

Here is the call graph for this function:

static PyObject* PyCurses_tparm ( PyObject self,
PyObject args 
) [static]

Definition at line 2595 of file _cursesmodule.c.

{
    char* fmt;
    char* result = NULL;
    int i1=0,i2=0,i3=0,i4=0,i5=0,i6=0,i7=0,i8=0,i9=0;

    PyCursesSetupTermCalled;

    if (!PyArg_ParseTuple(args, "s|iiiiiiiii:tparm",
                          &fmt, &i1, &i2, &i3, &i4,
                          &i5, &i6, &i7, &i8, &i9)) {
        return NULL;
    }

    result = tparm(fmt,i1,i2,i3,i4,i5,i6,i7,i8,i9);
    if (!result) {
        PyErr_SetString(PyCursesError, "tparm() returned NULL");
        return NULL;
    }

    return PyBytes_FromString(result);
}

Here is the call graph for this function:

static PyObject* PyCurses_TypeAhead ( PyObject self,
PyObject args 
) [static]

Definition at line 2619 of file _cursesmodule.c.

{
    int fd;

    PyCursesInitialised;

    if (!PyArg_ParseTuple(args,"i;fd",&fd)) return NULL;

    return PyCursesCheckERR(typeahead( fd ), "typeahead");
}

Here is the call graph for this function:

static PyObject* PyCurses_UnCtrl ( PyObject self,
PyObject args 
) [static]

Definition at line 2631 of file _cursesmodule.c.

{
    PyObject *temp;
    chtype ch;

    PyCursesInitialised;

    if (!PyArg_ParseTuple(args,"O;ch or int",&temp)) return NULL;

    if (!PyCurses_ConvertToChtype(temp, &ch)) {
        PyErr_SetString(PyExc_TypeError, "argument must be a ch or an int");
        return NULL;
    }

    return PyBytes_FromString(unctrl(ch));
}

Here is the call graph for this function:

static PyObject* PyCurses_UngetCh ( PyObject self,
PyObject args 
) [static]

Definition at line 2649 of file _cursesmodule.c.

{
    PyObject *temp;
    chtype ch;

    PyCursesInitialised;

    if (!PyArg_ParseTuple(args,"O;ch or int",&temp)) return NULL;

    if (!PyCurses_ConvertToChtype(temp, &ch)) {
        PyErr_SetString(PyExc_TypeError, "argument must be a ch or an int");
        return NULL;
    }

    return PyCursesCheckERR(ungetch(ch), "ungetch");
}

Here is the call graph for this function:

static PyObject* PyCurses_Use_Default_Colors ( PyObject self) [static]

Definition at line 2687 of file _cursesmodule.c.

{
    int code;

    PyCursesInitialised;
    PyCursesInitialisedColor;

    code = use_default_colors();
    if (code != ERR) {
        Py_INCREF(Py_None);
        return Py_None;
    } else {
        PyErr_SetString(PyCursesError, "use_default_colors() returned ERR");
        return NULL;
    }
}

Here is the call graph for this function:

static PyObject* PyCurses_Use_Env ( PyObject self,
PyObject args 
) [static]

Definition at line 2667 of file _cursesmodule.c.

{
    int flag;

    switch(PyTuple_Size(args)) {
    case 1:
        if (!PyArg_ParseTuple(args,"i;True(1), False(0)",&flag))
            return NULL;
        break;
    default:
        PyErr_SetString(PyExc_TypeError, "use_env requires 1 argument");
        return NULL;
    }
    use_env(flag);
    Py_INCREF(Py_None);
    return Py_None;
}

Here is the call graph for this function:

static PyObject* PyCursesCheckERR ( int  code,
char *  fname 
) [static]

Definition at line 182 of file _cursesmodule.c.

{
    if (code != ERR) {
        Py_INCREF(Py_None);
        return Py_None;
    } else {
        if (fname == NULL) {
            PyErr_SetString(PyCursesError, catchall_ERR);
        } else {
            PyErr_Format(PyCursesError, "%s() returned ERR", fname);
        }
        return NULL;
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

static PyObject* PyCursesWindow_AddCh ( PyCursesWindowObject self,
PyObject args 
) [static]

Definition at line 381 of file _cursesmodule.c.

{
    int rtn, x, y, use_xy = FALSE;
    PyObject *temp;
    chtype ch = 0;
    attr_t attr = A_NORMAL;
    long lattr;

    switch (PyTuple_Size(args)) {
    case 1:
        if (!PyArg_ParseTuple(args, "O;ch or int", &temp))
            return NULL;
        break;
    case 2:
        if (!PyArg_ParseTuple(args, "Ol;ch or int,attr", &temp, &lattr))
            return NULL;
        attr = lattr;
        break;
    case 3:
        if (!PyArg_ParseTuple(args,"iiO;y,x,ch or int", &y, &x, &temp))
            return NULL;
        use_xy = TRUE;
        break;
    case 4:
        if (!PyArg_ParseTuple(args,"iiOl;y,x,ch or int, attr",
                              &y, &x, &temp, &lattr))
            return NULL;
        attr = lattr;
        use_xy = TRUE;
        break;
    default:
        PyErr_SetString(PyExc_TypeError, "addch requires 1 to 4 arguments");
        return NULL;
    }

    if (!PyCurses_ConvertToChtype(temp, &ch)) {
        PyErr_SetString(PyExc_TypeError, "argument 1 or 3 must be a ch or an int");
        return NULL;
    }

    if (use_xy == TRUE)
        rtn = mvwaddch(self->win,y,x, ch | attr);
    else {
        rtn = waddch(self->win, ch | attr);
    }
    return PyCursesCheckERR(rtn, "addch");
}

Here is the call graph for this function:

static PyObject* PyCursesWindow_AddNStr ( PyCursesWindowObject self,
PyObject args 
) [static]

Definition at line 480 of file _cursesmodule.c.

{
    int rtn, x, y, n;
    char *str;
    attr_t attr = A_NORMAL , attr_old = A_NORMAL;
    long lattr;
    int use_xy = FALSE, use_attr = FALSE;

    switch (PyTuple_Size(args)) {
    case 2:
        if (!PyArg_ParseTuple(args,"si;str,n", &str, &n))
            return NULL;
        break;
    case 3:
        if (!PyArg_ParseTuple(args,"sil;str,n,attr", &str, &n, &lattr))
            return NULL;
        attr = lattr;
        use_attr = TRUE;
        break;
    case 4:
        if (!PyArg_ParseTuple(args,"iisi;y,x,str,n", &y, &x, &str, &n))
            return NULL;
        use_xy = TRUE;
        break;
    case 5:
        if (!PyArg_ParseTuple(args,"iisil;y,x,str,n,attr", &y, &x, &str, &n, &lattr))
            return NULL;
        attr = lattr;
        use_xy = use_attr = TRUE;
        break;
    default:
        PyErr_SetString(PyExc_TypeError, "addnstr requires 2 to 5 arguments");
        return NULL;
    }

    if (use_attr == TRUE) {
        attr_old = getattrs(self->win);
        (void)wattrset(self->win,attr);
    }
    if (use_xy == TRUE)
        rtn = mvwaddnstr(self->win,y,x,str,n);
    else
        rtn = waddnstr(self->win,str,n);
    if (use_attr == TRUE)
        (void)wattrset(self->win,attr_old);
    return PyCursesCheckERR(rtn, "addnstr");
}

Here is the call graph for this function:

static PyObject* PyCursesWindow_AddStr ( PyCursesWindowObject self,
PyObject args 
) [static]

Definition at line 430 of file _cursesmodule.c.

{
    int rtn;
    int x, y;
    char *str;
    attr_t attr = A_NORMAL , attr_old = A_NORMAL;
    long lattr;
    int use_xy = FALSE, use_attr = FALSE;

    switch (PyTuple_Size(args)) {
    case 1:
        if (!PyArg_ParseTuple(args,"s;str", &str))
            return NULL;
        break;
    case 2:
        if (!PyArg_ParseTuple(args,"sl;str,attr", &str, &lattr))
            return NULL;
        attr = lattr;
        use_attr = TRUE;
        break;
    case 3:
        if (!PyArg_ParseTuple(args,"iis;int,int,str", &y, &x, &str))
            return NULL;
        use_xy = TRUE;
        break;
    case 4:
        if (!PyArg_ParseTuple(args,"iisl;int,int,str,attr", &y, &x, &str, &lattr))
            return NULL;
        attr = lattr;
        use_xy = use_attr = TRUE;
        break;
    default:
        PyErr_SetString(PyExc_TypeError, "addstr requires 1 to 4 arguments");
        return NULL;
    }

    if (use_attr == TRUE) {
        attr_old = getattrs(self->win);
        (void)wattrset(self->win,attr);
    }
    if (use_xy == TRUE)
        rtn = mvwaddstr(self->win,y,x,str);
    else
        rtn = waddstr(self->win,str);
    if (use_attr == TRUE)
        (void)wattrset(self->win,attr_old);
    return PyCursesCheckERR(rtn, "addstr");
}

Here is the call graph for this function:

static PyObject* PyCursesWindow_AttrOff ( PyCursesWindowObject self,
PyObject args 
) [static]

Definition at line 560 of file _cursesmodule.c.

{
    long lattr;
    if (!PyArg_ParseTuple(args,"l;attr", &lattr))
        return NULL;
    return PyCursesCheckERR(wattroff(self->win, (attr_t)lattr), "attroff");
}

Here is the call graph for this function:

static PyObject* PyCursesWindow_AttrOn ( PyCursesWindowObject self,
PyObject args 
) [static]

Definition at line 569 of file _cursesmodule.c.

{
    long lattr;
    if (!PyArg_ParseTuple(args,"l;attr", &lattr))
        return NULL;
    return PyCursesCheckERR(wattron(self->win, (attr_t)lattr), "attron");
}

Here is the call graph for this function:

static PyObject* PyCursesWindow_AttrSet ( PyCursesWindowObject self,
PyObject args 
) [static]

Definition at line 578 of file _cursesmodule.c.

{
    long lattr;
    if (!PyArg_ParseTuple(args,"l;attr", &lattr))
        return NULL;
    return PyCursesCheckERR(wattrset(self->win, (attr_t)lattr), "attrset");
}

Here is the call graph for this function:

static PyObject* PyCursesWindow_Bkgd ( PyCursesWindowObject self,
PyObject args 
) [static]

Definition at line 529 of file _cursesmodule.c.

{
    PyObject *temp;
    chtype bkgd;
    attr_t attr = A_NORMAL;
    long lattr;

    switch (PyTuple_Size(args)) {
    case 1:
        if (!PyArg_ParseTuple(args, "O;ch or int", &temp))
            return NULL;
        break;
    case 2:
        if (!PyArg_ParseTuple(args,"Ol;ch or int,attr", &temp, &lattr))
            return NULL;
        attr = lattr;
        break;
    default:
        PyErr_SetString(PyExc_TypeError, "bkgd requires 1 or 2 arguments");
        return NULL;
    }

    if (!PyCurses_ConvertToChtype(temp, &bkgd)) {
        PyErr_SetString(PyExc_TypeError, "argument 1 or 3 must be a ch or an int");
        return NULL;
    }

    return PyCursesCheckERR(wbkgd(self->win, bkgd | attr), "bkgd");
}

Here is the call graph for this function:

static PyObject* PyCursesWindow_BkgdSet ( PyCursesWindowObject self,
PyObject args 
) [static]

Definition at line 587 of file _cursesmodule.c.

{
    PyObject *temp;
    chtype bkgd;
    attr_t attr = A_NORMAL;
    long lattr;

    switch (PyTuple_Size(args)) {
    case 1:
        if (!PyArg_ParseTuple(args, "O;ch or int", &temp))
            return NULL;
        break;
    case 2:
        if (!PyArg_ParseTuple(args,"Ol;ch or int,attr", &temp, &lattr))
            return NULL;
        attr = lattr;
        break;
    default:
        PyErr_SetString(PyExc_TypeError, "bkgdset requires 1 or 2 arguments");
        return NULL;
    }

    if (!PyCurses_ConvertToChtype(temp, &bkgd)) {
        PyErr_SetString(PyExc_TypeError, "argument 1 must be a ch or an int");
        return NULL;
    }

    wbkgdset(self->win, bkgd | attr);
    return PyCursesCheckERR(0, "bkgdset");
}

Here is the call graph for this function:

static PyObject* PyCursesWindow_Border ( PyCursesWindowObject self,
PyObject args 
) [static]

Definition at line 619 of file _cursesmodule.c.

{
    PyObject *temp[8];
    chtype ch[8];
    int i;

    /* Clear the array of parameters */
    for(i=0; i<8; i++) {
        temp[i] = NULL;
        ch[i] = 0;
    }

    if (!PyArg_ParseTuple(args,"|OOOOOOOO;ls,rs,ts,bs,tl,tr,bl,br",
                          &temp[0], &temp[1], &temp[2], &temp[3],
                          &temp[4], &temp[5], &temp[6], &temp[7]))
        return NULL;

    for(i=0; i<8; i++) {
        if (temp[i] != NULL && !PyCurses_ConvertToChtype(temp[i], &ch[i])) {
            PyErr_Format(PyExc_TypeError,
                         "argument %i must be a ch or an int", i+1);
            return NULL;
        }
    }

    wborder(self->win,
            ch[0], ch[1], ch[2], ch[3],
            ch[4], ch[5], ch[6], ch[7]);
    Py_INCREF(Py_None);
    return Py_None;
}

Here is the call graph for this function:

static PyObject* PyCursesWindow_Box ( PyCursesWindowObject self,
PyObject args 
) [static]

Definition at line 652 of file _cursesmodule.c.

{
    chtype ch1=0,ch2=0;
    switch(PyTuple_Size(args)){
    case 0: break;
    default:
        if (!PyArg_ParseTuple(args,"ll;vertint,horint", &ch1, &ch2))
            return NULL;
    }
    box(self->win,ch1,ch2);
    Py_INCREF(Py_None);
    return Py_None;
}

Here is the call graph for this function:

static PyObject* PyCursesWindow_ChgAt ( PyCursesWindowObject self,
PyObject args 
) [static]

Definition at line 681 of file _cursesmodule.c.

{
    int rtn;
    int x, y;
    int num = -1;
    short color;
    attr_t attr = A_NORMAL;
    long lattr;
    int use_xy = FALSE;

    switch (PyTuple_Size(args)) {
    case 1:
        if (!PyArg_ParseTuple(args,"l;attr", &lattr))
            return NULL;
        attr = lattr;
        break;
    case 2:
        if (!PyArg_ParseTuple(args,"il;n,attr", &num, &lattr))
            return NULL;
        attr = lattr;
        break;
    case 3:
        if (!PyArg_ParseTuple(args,"iil;int,int,attr", &y, &x, &lattr))
            return NULL;
        attr = lattr;
        use_xy = TRUE;
        break;
    case 4:
        if (!PyArg_ParseTuple(args,"iiil;int,int,n,attr", &y, &x, &num, &lattr))
            return NULL;
        attr = lattr;
        use_xy = TRUE;
        break;
    default:
        PyErr_SetString(PyExc_TypeError, "chgat requires 1 to 4 arguments");
        return NULL;
    }

    color = (short)((attr >> 8) & 0xff);
    attr = attr - (color << 8);

    if (use_xy == TRUE) {
        rtn = mvwchgat(self->win,y,x,num,attr,color,NULL);
        touchline(self->win,y,1);
    } else {
        getyx(self->win,y,x);
        rtn = wchgat(self->win,num,attr,color,NULL);
        touchline(self->win,y,1);
    }
    return PyCursesCheckERR(rtn, "chgat");
}

Here is the call graph for this function:

Definition at line 372 of file _cursesmodule.c.

{
    if (wo->win != stdscr) delwin(wo->win);
    PyObject_DEL(wo);
}
static PyObject* PyCursesWindow_DelCh ( PyCursesWindowObject self,
PyObject args 
) [static]

Definition at line 735 of file _cursesmodule.c.

{
    int rtn;
    int x, y;

    switch (PyTuple_Size(args)) {
    case 0:
        rtn = wdelch(self->win);
        break;
    case 2:
        if (!PyArg_ParseTuple(args,"ii;y,x", &y, &x))
            return NULL;
        rtn = py_mvwdelch(self->win,y,x);
        break;
    default:
        PyErr_SetString(PyExc_TypeError, "delch requires 0 or 2 arguments");
        return NULL;
    }
    return PyCursesCheckERR(rtn, "[mv]wdelch");
}

Here is the call graph for this function:

static PyObject* PyCursesWindow_DerWin ( PyCursesWindowObject self,
PyObject args 
) [static]

Definition at line 757 of file _cursesmodule.c.

{
    WINDOW *win;
    int nlines, ncols, begin_y, begin_x;

    nlines = 0;
    ncols  = 0;
    switch (PyTuple_Size(args)) {
    case 2:
        if (!PyArg_ParseTuple(args,"ii;begin_y,begin_x",&begin_y,&begin_x))
            return NULL;
        break;
    case 4:
        if (!PyArg_ParseTuple(args, "iiii;nlines,ncols,begin_y,begin_x",
                              &nlines,&ncols,&begin_y,&begin_x))
            return NULL;
        break;
    default:
        PyErr_SetString(PyExc_TypeError, "derwin requires 2 or 4 arguments");
        return NULL;
    }

    win = derwin(self->win,nlines,ncols,begin_y,begin_x);

    if (win == NULL) {
        PyErr_SetString(PyCursesError, catchall_NULL);
        return NULL;
    }

    return (PyObject *)PyCursesWindow_New(win);
}

Here is the call graph for this function:

static PyObject* PyCursesWindow_EchoChar ( PyCursesWindowObject self,
PyObject args 
) [static]

Definition at line 790 of file _cursesmodule.c.

{
    PyObject *temp;
    chtype ch;
    attr_t attr = A_NORMAL;
    long lattr;

    switch (PyTuple_Size(args)) {
    case 1:
        if (!PyArg_ParseTuple(args,"O;ch or int", &temp))
            return NULL;
        break;
    case 2:
        if (!PyArg_ParseTuple(args,"Ol;ch or int,attr", &temp, &lattr))
            return NULL;
        attr = lattr;
        break;
    default:
        PyErr_SetString(PyExc_TypeError, "echochar requires 1 or 2 arguments");


        return NULL;
    }

    if (!PyCurses_ConvertToChtype(temp, &ch)) {
        PyErr_SetString(PyExc_TypeError, "argument 1 must be a ch or an int");
        return NULL;
    }

#ifdef WINDOW_HAS_FLAGS
    if (self->win->_flags & _ISPAD)
        return PyCursesCheckERR(pechochar(self->win, ch | attr),
                                "echochar");
    else
#endif
        return PyCursesCheckERR(wechochar(self->win, ch | attr),
                                "echochar");
}

Here is the call graph for this function:

Definition at line 842 of file _cursesmodule.c.

{
    return PyLong_FromLong((long) getbkgd(self->win));
}

Here is the call graph for this function:

static PyObject* PyCursesWindow_GetCh ( PyCursesWindowObject self,
PyObject args 
) [static]

Definition at line 848 of file _cursesmodule.c.

{
    int x, y;
    int rtn;

    switch (PyTuple_Size(args)) {
    case 0:
        Py_BEGIN_ALLOW_THREADS
        rtn = wgetch(self->win);
        Py_END_ALLOW_THREADS
        break;
    case 2:
        if (!PyArg_ParseTuple(args,"ii;y,x",&y,&x))
            return NULL;
        Py_BEGIN_ALLOW_THREADS
        rtn = mvwgetch(self->win,y,x);
        Py_END_ALLOW_THREADS
        break;
    default:
        PyErr_SetString(PyExc_TypeError, "getch requires 0 or 2 arguments");
        return NULL;
    }
    return PyLong_FromLong((long)rtn);
}

Here is the call graph for this function:

static PyObject* PyCursesWindow_GetKey ( PyCursesWindowObject self,
PyObject args 
) [static]

Definition at line 874 of file _cursesmodule.c.

{
    int x, y;
    int rtn;

    switch (PyTuple_Size(args)) {
    case 0:
        Py_BEGIN_ALLOW_THREADS
        rtn = wgetch(self->win);
        Py_END_ALLOW_THREADS
        break;
    case 2:
        if (!PyArg_ParseTuple(args,"ii;y,x",&y,&x))
            return NULL;
        Py_BEGIN_ALLOW_THREADS
        rtn = mvwgetch(self->win,y,x);
        Py_END_ALLOW_THREADS
        break;
    default:
        PyErr_SetString(PyExc_TypeError, "getkey requires 0 or 2 arguments");
        return NULL;
    }
    if (rtn == ERR) {
        /* getch() returns ERR in nodelay mode */
        PyErr_SetString(PyCursesError, "no input");
        return NULL;
    } else if (rtn<=255) {
        return Py_BuildValue("C", rtn);
    } else {
        const char *knp;
#if defined(__NetBSD__)
        knp = unctrl(rtn);
#else
        knp = keyname(rtn);
#endif
        return PyUnicode_FromString((knp == NULL) ? "" : knp);
    }
}

Here is the call graph for this function:

static PyObject* PyCursesWindow_GetStr ( PyCursesWindowObject self,
PyObject args 
) [static]

Definition at line 914 of file _cursesmodule.c.

{
    int x, y, n;
    char rtn[1024]; /* This should be big enough.. I hope */
    int rtn2;

    switch (PyTuple_Size(args)) {
    case 0:
        Py_BEGIN_ALLOW_THREADS
        rtn2 = wgetnstr(self->win,rtn, 1023);
        Py_END_ALLOW_THREADS
        break;
    case 1:
        if (!PyArg_ParseTuple(args,"i;n", &n))
            return NULL;
        Py_BEGIN_ALLOW_THREADS
        rtn2 = wgetnstr(self->win,rtn,MIN(n, 1023));
        Py_END_ALLOW_THREADS
        break;
    case 2:
        if (!PyArg_ParseTuple(args,"ii;y,x",&y,&x))
            return NULL;
        Py_BEGIN_ALLOW_THREADS
#ifdef STRICT_SYSV_CURSES
        rtn2 = wmove(self->win,y,x)==ERR ? ERR : wgetnstr(self->win, rtn, 1023);
#else
        rtn2 = mvwgetnstr(self->win,y,x,rtn, 1023);
#endif
        Py_END_ALLOW_THREADS
        break;
    case 3:
        if (!PyArg_ParseTuple(args,"iii;y,x,n", &y, &x, &n))
            return NULL;
#ifdef STRICT_SYSV_CURSES
        Py_BEGIN_ALLOW_THREADS
        rtn2 = wmove(self->win,y,x)==ERR ? ERR :
        wgetnstr(self->win, rtn, MIN(n, 1023));
        Py_END_ALLOW_THREADS
#else
        Py_BEGIN_ALLOW_THREADS
        rtn2 = mvwgetnstr(self->win, y, x, rtn, MIN(n, 1023));
        Py_END_ALLOW_THREADS
#endif
        break;
    default:
        PyErr_SetString(PyExc_TypeError, "getstr requires 0 to 3 arguments");
        return NULL;
    }
    if (rtn2 == ERR)
        rtn[0] = 0;
    return PyBytes_FromString(rtn);
}

Here is the call graph for this function:

static PyObject* PyCursesWindow_Hline ( PyCursesWindowObject self,
PyObject args 
) [static]

Definition at line 968 of file _cursesmodule.c.

{
    PyObject *temp;
    chtype ch;
    int n, x, y, code = OK;
    attr_t attr = A_NORMAL;
    long lattr;

    switch (PyTuple_Size(args)) {
    case 2:
        if (!PyArg_ParseTuple(args, "Oi;ch or int,n", &temp, &n))
            return NULL;
        break;
    case 3:
        if (!PyArg_ParseTuple(args, "Oil;ch or int,n,attr", &temp, &n, &lattr))
            return NULL;
        attr = lattr;
        break;
    case 4:
        if (!PyArg_ParseTuple(args, "iiOi;y,x,ch or int,n", &y, &x, &temp, &n))
            return NULL;
        code = wmove(self->win, y, x);
        break;
    case 5:
        if (!PyArg_ParseTuple(args, "iiOil; y,x,ch or int,n,attr",
                              &y, &x, &temp, &n, &lattr))
            return NULL;
        attr = lattr;
        code = wmove(self->win, y, x);
        break;
    default:
        PyErr_SetString(PyExc_TypeError, "hline requires 2 to 5 arguments");
        return NULL;
    }

    if (code != ERR) {
        if (!PyCurses_ConvertToChtype(temp, &ch)) {
            PyErr_SetString(PyExc_TypeError,
                            "argument 1 or 3 must be a ch or an int");
            return NULL;
        }
        return PyCursesCheckERR(whline(self->win, ch | attr, n), "hline");
    } else
        return PyCursesCheckERR(code, "wmove");
}

Here is the call graph for this function:

static PyObject* PyCursesWindow_InCh ( PyCursesWindowObject self,
PyObject args 
) [static]

Definition at line 1064 of file _cursesmodule.c.

{
    int x, y, rtn;

    switch (PyTuple_Size(args)) {
    case 0:
        rtn = winch(self->win);
        break;
    case 2:
        if (!PyArg_ParseTuple(args,"ii;y,x",&y,&x))
            return NULL;
        rtn = mvwinch(self->win,y,x);
        break;
    default:
        PyErr_SetString(PyExc_TypeError, "inch requires 0 or 2 arguments");
        return NULL;
    }
    return PyLong_FromLong((long) rtn);
}

Here is the call graph for this function:

static PyObject* PyCursesWindow_InsCh ( PyCursesWindowObject self,
PyObject args 
) [static]

Definition at line 1015 of file _cursesmodule.c.

{
    int rtn, x, y, use_xy = FALSE;
    PyObject *temp;
    chtype ch = 0;
    attr_t attr = A_NORMAL;
    long lattr;

    switch (PyTuple_Size(args)) {
    case 1:
        if (!PyArg_ParseTuple(args, "O;ch or int", &temp))
            return NULL;
        break;
    case 2:
        if (!PyArg_ParseTuple(args, "Ol;ch or int,attr", &temp, &lattr))
            return NULL;
        attr = lattr;
        break;
    case 3:
        if (!PyArg_ParseTuple(args,"iiO;y,x,ch or int", &y, &x, &temp))
            return NULL;
        use_xy = TRUE;
        break;
    case 4:
        if (!PyArg_ParseTuple(args,"iiOl;y,x,ch or int, attr", &y, &x, &temp, &lattr))
            return NULL;
        attr = lattr;
        use_xy = TRUE;
        break;
    default:
        PyErr_SetString(PyExc_TypeError, "insch requires 1 or 4 arguments");
        return NULL;
    }

    if (!PyCurses_ConvertToChtype(temp, &ch)) {
        PyErr_SetString(PyExc_TypeError,
                        "argument 1 or 3 must be a ch or an int");
        return NULL;
    }

    if (use_xy == TRUE)
        rtn = mvwinsch(self->win,y,x, ch | attr);
    else {
        rtn = winsch(self->win, ch | attr);
    }
    return PyCursesCheckERR(rtn, "insch");
}

Here is the call graph for this function:

static PyObject* PyCursesWindow_InsNStr ( PyCursesWindowObject self,
PyObject args 
) [static]

Definition at line 1170 of file _cursesmodule.c.

{
    int rtn, x, y, n;
    char *str;
    attr_t attr = A_NORMAL , attr_old = A_NORMAL;
    long lattr;
    int use_xy = FALSE, use_attr = FALSE;

    switch (PyTuple_Size(args)) {
    case 2:
        if (!PyArg_ParseTuple(args,"si;str,n", &str, &n))
            return NULL;
        break;
    case 3:
        if (!PyArg_ParseTuple(args,"sil;str,n,attr", &str, &n, &lattr))
            return NULL;
        attr = lattr;
        use_attr = TRUE;
        break;
    case 4:
        if (!PyArg_ParseTuple(args,"iisi;y,x,str,n", &y, &x, &str, &n))
            return NULL;
        use_xy = TRUE;
        break;
    case 5:
        if (!PyArg_ParseTuple(args,"iisil;y,x,str,n,attr", &y, &x, &str, &n, &lattr))
            return NULL;
        attr = lattr;
        use_xy = use_attr = TRUE;
        break;
    default:
        PyErr_SetString(PyExc_TypeError, "insnstr requires 2 to 5 arguments");
        return NULL;
    }

    if (use_attr == TRUE) {
        attr_old = getattrs(self->win);
        (void)wattrset(self->win,attr);
    }
    if (use_xy == TRUE)
        rtn = mvwinsnstr(self->win,y,x,str,n);
    else
        rtn = winsnstr(self->win,str,n);
    if (use_attr == TRUE)
        (void)wattrset(self->win,attr_old);
    return PyCursesCheckERR(rtn, "insnstr");
}

Here is the call graph for this function:

static PyObject* PyCursesWindow_InsStr ( PyCursesWindowObject self,
PyObject args 
) [static]

Definition at line 1120 of file _cursesmodule.c.

{
    int rtn;
    int x, y;
    char *str;
    attr_t attr = A_NORMAL , attr_old = A_NORMAL;
    long lattr;
    int use_xy = FALSE, use_attr = FALSE;

    switch (PyTuple_Size(args)) {
    case 1:
        if (!PyArg_ParseTuple(args,"s;str", &str))
            return NULL;
        break;
    case 2:
        if (!PyArg_ParseTuple(args,"sl;str,attr", &str, &lattr))
            return NULL;
        attr = lattr;
        use_attr = TRUE;
        break;
    case 3:
        if (!PyArg_ParseTuple(args,"iis;y,x,str", &y, &x, &str))
            return NULL;
        use_xy = TRUE;
        break;
    case 4:
        if (!PyArg_ParseTuple(args,"iisl;y,x,str,attr", &y, &x, &str, &lattr))
            return NULL;
        attr = lattr;
        use_xy = use_attr = TRUE;
        break;
    default:
        PyErr_SetString(PyExc_TypeError, "insstr requires 1 to 4 arguments");
        return NULL;
    }

    if (use_attr == TRUE) {
        attr_old = getattrs(self->win);
        (void)wattrset(self->win,attr);
    }
    if (use_xy == TRUE)
        rtn = mvwinsstr(self->win,y,x,str);
    else
        rtn = winsstr(self->win,str);
    if (use_attr == TRUE)
        (void)wattrset(self->win,attr_old);
    return PyCursesCheckERR(rtn, "insstr");
}

Here is the call graph for this function:

static PyObject* PyCursesWindow_InStr ( PyCursesWindowObject self,
PyObject args 
) [static]

Definition at line 1085 of file _cursesmodule.c.

{
    int x, y, n;
    char rtn[1024]; /* This should be big enough.. I hope */
    int rtn2;

    switch (PyTuple_Size(args)) {
    case 0:
        rtn2 = winnstr(self->win,rtn, 1023);
        break;
    case 1:
        if (!PyArg_ParseTuple(args,"i;n", &n))
            return NULL;
        rtn2 = winnstr(self->win,rtn,MIN(n,1023));
        break;
    case 2:
        if (!PyArg_ParseTuple(args,"ii;y,x",&y,&x))
            return NULL;
        rtn2 = mvwinnstr(self->win,y,x,rtn,1023);
        break;
    case 3:
        if (!PyArg_ParseTuple(args, "iii;y,x,n", &y, &x, &n))
            return NULL;
        rtn2 = mvwinnstr(self->win, y, x, rtn, MIN(n,1023));
        break;
    default:
        PyErr_SetString(PyExc_TypeError, "instr requires 0 or 3 arguments");
        return NULL;
    }
    if (rtn2 == ERR)
        rtn[0] = 0;
    return PyBytes_FromString(rtn);
}

Here is the call graph for this function:

static PyObject* PyCursesWindow_Is_LineTouched ( PyCursesWindowObject self,
PyObject args 
) [static]

Definition at line 1219 of file _cursesmodule.c.

{
    int line, erg;
    if (!PyArg_ParseTuple(args,"i;line", &line))
        return NULL;
    erg = is_linetouched(self->win, line);
    if (erg == ERR) {
        PyErr_SetString(PyExc_TypeError,
                        "is_linetouched: line number outside of boundaries");
        return NULL;
    } else
        if (erg == FALSE) {
            Py_INCREF(Py_False);
            return Py_False;
        } else {
            Py_INCREF(Py_True);
            return Py_True;
        }
}

Here is the call graph for this function:

static PyObject* PyCursesWindow_NoOutRefresh ( PyCursesWindowObject self,
PyObject args 
) [static]

Definition at line 1240 of file _cursesmodule.c.

{
    int pminrow,pmincol,sminrow,smincol,smaxrow,smaxcol;
    int rtn;

#ifndef WINDOW_HAS_FLAGS
    if (0)
#else
        if (self->win->_flags & _ISPAD)
#endif
        {
            switch(PyTuple_Size(args)) {
            case 6:
                if (!PyArg_ParseTuple(args,
                                      "iiiiii;" \
                                      "pminrow,pmincol,sminrow,smincol,smaxrow,smaxcol",
                                      &pminrow, &pmincol, &sminrow,
                                      &smincol, &smaxrow, &smaxcol))
                    return NULL;
                Py_BEGIN_ALLOW_THREADS
                rtn = pnoutrefresh(self->win,
                                   pminrow, pmincol, sminrow,
                                   smincol, smaxrow, smaxcol);
                Py_END_ALLOW_THREADS
                return PyCursesCheckERR(rtn, "pnoutrefresh");
            default:
                PyErr_SetString(PyCursesError,
                                "noutrefresh() called for a pad "
                                "requires 6 arguments");
                return NULL;
            }
        } else {
            if (!PyArg_ParseTuple(args, ":noutrefresh"))
                return NULL;

            Py_BEGIN_ALLOW_THREADS
            rtn = wnoutrefresh(self->win);
            Py_END_ALLOW_THREADS
            return PyCursesCheckERR(rtn, "wnoutrefresh");
        }
}

Here is the call graph for this function:

static PyObject* PyCursesWindow_Overlay ( PyCursesWindowObject self,
PyObject args 
) [static]

Definition at line 1283 of file _cursesmodule.c.

{
    PyCursesWindowObject *temp;
    int use_copywin = FALSE;
    int sminrow, smincol, dminrow, dmincol, dmaxrow, dmaxcol;
    int rtn;

    switch (PyTuple_Size(args)) {
    case 1:
        if (!PyArg_ParseTuple(args, "O!;window object",
                              &PyCursesWindow_Type, &temp))
            return NULL;
        break;
    case 7:
        if (!PyArg_ParseTuple(args, "O!iiiiii;window object, int, int, int, int, int, int",
                              &PyCursesWindow_Type, &temp, &sminrow, &smincol,
                              &dminrow, &dmincol, &dmaxrow, &dmaxcol))
            return NULL;
        use_copywin = TRUE;
        break;
    default:
        PyErr_SetString(PyExc_TypeError,
                        "overlay requires one or seven arguments");
        return NULL;
    }

    if (use_copywin == TRUE) {
        rtn = copywin(self->win, temp->win, sminrow, smincol,
                      dminrow, dmincol, dmaxrow, dmaxcol, TRUE);
        return PyCursesCheckERR(rtn, "copywin");
    }
    else {
        rtn = overlay(self->win, temp->win);
        return PyCursesCheckERR(rtn, "overlay");
    }
}

Here is the call graph for this function:

static PyObject* PyCursesWindow_Overwrite ( PyCursesWindowObject self,
PyObject args 
) [static]

Definition at line 1321 of file _cursesmodule.c.

{
    PyCursesWindowObject *temp;
    int use_copywin = FALSE;
    int sminrow, smincol, dminrow, dmincol, dmaxrow, dmaxcol;
    int rtn;

    switch (PyTuple_Size(args)) {
    case 1:
        if (!PyArg_ParseTuple(args, "O!;window object",
                              &PyCursesWindow_Type, &temp))
            return NULL;
        break;
    case 7:
        if (!PyArg_ParseTuple(args, "O!iiiiii;window object, int, int, int, int, int, int",
                              &PyCursesWindow_Type, &temp, &sminrow, &smincol,
                              &dminrow, &dmincol, &dmaxrow, &dmaxcol))
            return NULL;
        use_copywin = TRUE;
        break;
    default:
        PyErr_SetString(PyExc_TypeError,
                        "overwrite requires one or seven arguments");
        return NULL;
    }

    if (use_copywin == TRUE) {
        rtn = copywin(self->win, temp->win, sminrow, smincol,
                      dminrow, dmincol, dmaxrow, dmaxcol, FALSE);
        return PyCursesCheckERR(rtn, "copywin");
    }
    else {
        rtn = overwrite(self->win, temp->win);
        return PyCursesCheckERR(rtn, "overwrite");
    }
}

Here is the call graph for this function:

static PyObject* PyCursesWindow_PutWin ( PyCursesWindowObject self,
PyObject stream 
) [static]

Definition at line 1359 of file _cursesmodule.c.

{
    /* We have to simulate this by writing to a temporary FILE*,
       then reading back, then writing to the argument stream. */
    char fn[100];
    int fd;
    FILE *fp;
    PyObject *res;

    strcpy(fn, "/tmp/py.curses.putwin.XXXXXX");
    fd = mkstemp(fn);
    if (fd < 0)
        return PyErr_SetFromErrnoWithFilename(PyExc_IOError, fn);
    fp = fdopen(fd, "wb+");
    if (fp == NULL) {
        close(fd);
        remove(fn);
        return PyErr_SetFromErrnoWithFilename(PyExc_IOError, fn);
    }
    res = PyCursesCheckERR(putwin(self->win, fp), "putwin");
    if (res == NULL) {
        fclose(fp);
        remove(fn);
        return res;
    }
    fseek(fp, 0, 0);
    while (1) {
        char buf[BUFSIZ];
        Py_ssize_t n = fread(buf, 1, BUFSIZ, fp);
        if (n <= 0)
            break;
        Py_DECREF(res);
        res = PyObject_CallMethod(stream, "write", "y#", buf, n);
        if (res == NULL)
            break;
    }
    fclose(fp);
    remove(fn);
    return res;
}

Here is the call graph for this function:

static PyObject* PyCursesWindow_RedrawLine ( PyCursesWindowObject self,
PyObject args 
) [static]

Definition at line 1401 of file _cursesmodule.c.

{
    int beg, num;
    if (!PyArg_ParseTuple(args, "ii;beg,num", &beg, &num))
        return NULL;
    return PyCursesCheckERR(wredrawln(self->win,beg,num), "redrawln");
}

Here is the call graph for this function:

static PyObject* PyCursesWindow_Refresh ( PyCursesWindowObject self,
PyObject args 
) [static]

Definition at line 1410 of file _cursesmodule.c.

{
    int pminrow,pmincol,sminrow,smincol,smaxrow,smaxcol;
    int rtn;

#ifndef WINDOW_HAS_FLAGS
    if (0)
#else
        if (self->win->_flags & _ISPAD)
#endif
        {
            switch(PyTuple_Size(args)) {
            case 6:
                if (!PyArg_ParseTuple(args,
                                      "iiiiii;" \
                                      "pminrow,pmincol,sminrow,smincol,smaxrow,smaxcol",
                                      &pminrow, &pmincol, &sminrow,
                                      &smincol, &smaxrow, &smaxcol))
                    return NULL;

                Py_BEGIN_ALLOW_THREADS
                rtn = prefresh(self->win,
                               pminrow, pmincol, sminrow,
                               smincol, smaxrow, smaxcol);
                Py_END_ALLOW_THREADS
                return PyCursesCheckERR(rtn, "prefresh");
            default:
                PyErr_SetString(PyCursesError,
                                "refresh() for a pad requires 6 arguments");
                return NULL;
            }
        } else {
            if (!PyArg_ParseTuple(args, ":refresh"))
                return NULL;
            Py_BEGIN_ALLOW_THREADS
            rtn = wrefresh(self->win);
            Py_END_ALLOW_THREADS
            return PyCursesCheckERR(rtn, "prefresh");
        }
}

Here is the call graph for this function:

static PyObject* PyCursesWindow_Scroll ( PyCursesWindowObject self,
PyObject args 
) [static]

Definition at line 1500 of file _cursesmodule.c.

{
    int nlines;
    switch(PyTuple_Size(args)) {
    case 0:
        return PyCursesCheckERR(scroll(self->win), "scroll");
    case 1:
        if (!PyArg_ParseTuple(args, "i;nlines", &nlines))
            return NULL;
        return PyCursesCheckERR(wscrl(self->win, nlines), "scroll");
    default:
        PyErr_SetString(PyExc_TypeError, "scroll requires 0 or 1 arguments");
        return NULL;
    }
}

Here is the call graph for this function:

static PyObject* PyCursesWindow_SetScrollRegion ( PyCursesWindowObject self,
PyObject args 
) [static]

Definition at line 1452 of file _cursesmodule.c.

{
    int x, y;
    if (!PyArg_ParseTuple(args,"ii;top, bottom",&y,&x))
        return NULL;
    return PyCursesCheckERR(wsetscrreg(self->win,y,x), "wsetscrreg");
}

Here is the call graph for this function:

static PyObject* PyCursesWindow_SubWin ( PyCursesWindowObject self,
PyObject args 
) [static]

Definition at line 1461 of file _cursesmodule.c.

{
    WINDOW *win;
    int nlines, ncols, begin_y, begin_x;

    nlines = 0;
    ncols  = 0;
    switch (PyTuple_Size(args)) {
    case 2:
        if (!PyArg_ParseTuple(args,"ii;begin_y,begin_x",&begin_y,&begin_x))
            return NULL;
        break;
    case 4:
        if (!PyArg_ParseTuple(args, "iiii;nlines,ncols,begin_y,begin_x",
                              &nlines,&ncols,&begin_y,&begin_x))
            return NULL;
        break;
    default:
        PyErr_SetString(PyExc_TypeError, "subwin requires 2 or 4 arguments");
        return NULL;
    }

    /* printf("Subwin: %i %i %i %i   \n", nlines, ncols, begin_y, begin_x); */
#ifdef WINDOW_HAS_FLAGS
    if (self->win->_flags & _ISPAD)
        win = subpad(self->win, nlines, ncols, begin_y, begin_x);
    else
#endif
        win = subwin(self->win, nlines, ncols, begin_y, begin_x);

    if (win == NULL) {
        PyErr_SetString(PyCursesError, catchall_NULL);
        return NULL;
    }

    return (PyObject *)PyCursesWindow_New(win);
}

Here is the call graph for this function:

static PyObject* PyCursesWindow_TouchLine ( PyCursesWindowObject self,
PyObject args 
) [static]

Definition at line 1517 of file _cursesmodule.c.

{
    int st, cnt, val;
    switch (PyTuple_Size(args)) {
    case 2:
        if (!PyArg_ParseTuple(args,"ii;start,count",&st,&cnt))
            return NULL;
        return PyCursesCheckERR(touchline(self->win,st,cnt), "touchline");
    case 3:
        if (!PyArg_ParseTuple(args, "iii;start,count,val", &st, &cnt, &val))
            return NULL;
        return PyCursesCheckERR(wtouchln(self->win, st, cnt, val), "touchline");
    default:
        PyErr_SetString(PyExc_TypeError, "touchline requires 2 or 3 arguments");
        return NULL;
    }
}

Here is the call graph for this function:

static PyObject* PyCursesWindow_Vline ( PyCursesWindowObject self,
PyObject args 
) [static]

Definition at line 1536 of file _cursesmodule.c.

{
    PyObject *temp;
    chtype ch;
    int n, x, y, code = OK;
    attr_t attr = A_NORMAL;
    long lattr;

    switch (PyTuple_Size(args)) {
    case 2:
        if (!PyArg_ParseTuple(args, "Oi;ch or int,n", &temp, &n))
            return NULL;
        break;
    case 3:
        if (!PyArg_ParseTuple(args, "Oil;ch or int,n,attr", &temp, &n, &lattr))
            return NULL;
        attr = lattr;
        break;
    case 4:
        if (!PyArg_ParseTuple(args, "iiOi;y,x,ch or int,n", &y, &x, &temp, &n))
            return NULL;
        code = wmove(self->win, y, x);
        break;
    case 5:
        if (!PyArg_ParseTuple(args, "iiOil; y,x,ch or int,n,attr",
                              &y, &x, &temp, &n, &lattr))
            return NULL;
        attr = lattr;
        code = wmove(self->win, y, x);
        break;
    default:
        PyErr_SetString(PyExc_TypeError, "vline requires 2 to 5 arguments");
        return NULL;
    }

    if (code != ERR) {
        if (!PyCurses_ConvertToChtype(temp, &ch)) {
            PyErr_SetString(PyExc_TypeError,
                            "argument 1 or 3 must be a ch or an int");
            return NULL;
        }
        return PyCursesCheckERR(wvline(self->win, ch | attr, n), "vline");
    } else
        return PyCursesCheckERR(code, "wmove");
}

Here is the call graph for this function:

Definition at line 2816 of file _cursesmodule.c.

{
    PyObject *m, *d, *v, *c_api_object;
    static void *PyCurses_API[PyCurses_API_pointers];

    /* Initialize object type */
    if (PyType_Ready(&PyCursesWindow_Type) < 0)
        return NULL;

    /* Initialize the C API pointer array */
    PyCurses_API[0] = (void *)&PyCursesWindow_Type;
    PyCurses_API[1] = (void *)func_PyCursesSetupTermCalled;
    PyCurses_API[2] = (void *)func_PyCursesInitialised;
    PyCurses_API[3] = (void *)func_PyCursesInitialisedColor;

    /* Create the module and add the functions */
    m = PyModule_Create(&_cursesmodule);
    if (m == NULL)
        return NULL;

    /* Add some symbolic constants to the module */
    d = PyModule_GetDict(m);
    if (d == NULL)
        return NULL;
    ModDict = d; /* For PyCurses_InitScr to use later */

    /* Add a capsule for the C API */
    c_api_object = PyCapsule_New(PyCurses_API, PyCurses_CAPSULE_NAME, NULL);
    PyDict_SetItemString(d, "_C_API", c_api_object);
    Py_DECREF(c_api_object);

    /* For exception curses.error */
    PyCursesError = PyErr_NewException("_curses.error", NULL, NULL);
    PyDict_SetItemString(d, "error", PyCursesError);

    /* Make the version available */
    v = PyBytes_FromString(PyCursesVersion);
    PyDict_SetItemString(d, "version", v);
    PyDict_SetItemString(d, "__version__", v);
    Py_DECREF(v);

    SetDictInt("ERR", ERR);
    SetDictInt("OK", OK);

    /* Here are some attributes you can add to chars to print */

    SetDictInt("A_ATTRIBUTES",      A_ATTRIBUTES);
    SetDictInt("A_NORMAL",              A_NORMAL);
    SetDictInt("A_STANDOUT",            A_STANDOUT);
    SetDictInt("A_UNDERLINE",           A_UNDERLINE);
    SetDictInt("A_REVERSE",             A_REVERSE);
    SetDictInt("A_BLINK",               A_BLINK);
    SetDictInt("A_DIM",                 A_DIM);
    SetDictInt("A_BOLD",                A_BOLD);
    SetDictInt("A_ALTCHARSET",          A_ALTCHARSET);
#if !defined(__NetBSD__)
    SetDictInt("A_INVIS",           A_INVIS);
#endif
    SetDictInt("A_PROTECT",         A_PROTECT);
    SetDictInt("A_CHARTEXT",        A_CHARTEXT);
    SetDictInt("A_COLOR",           A_COLOR);

    /* The following are never available with strict SYSV curses */
#ifdef A_HORIZONTAL
    SetDictInt("A_HORIZONTAL",      A_HORIZONTAL);
#endif
#ifdef A_LEFT
    SetDictInt("A_LEFT",            A_LEFT);
#endif
#ifdef A_LOW
    SetDictInt("A_LOW",             A_LOW);
#endif
#ifdef A_RIGHT
    SetDictInt("A_RIGHT",           A_RIGHT);
#endif
#ifdef A_TOP
    SetDictInt("A_TOP",             A_TOP);
#endif
#ifdef A_VERTICAL
    SetDictInt("A_VERTICAL",        A_VERTICAL);
#endif

    SetDictInt("COLOR_BLACK",       COLOR_BLACK);
    SetDictInt("COLOR_RED",         COLOR_RED);
    SetDictInt("COLOR_GREEN",       COLOR_GREEN);
    SetDictInt("COLOR_YELLOW",      COLOR_YELLOW);
    SetDictInt("COLOR_BLUE",        COLOR_BLUE);
    SetDictInt("COLOR_MAGENTA",     COLOR_MAGENTA);
    SetDictInt("COLOR_CYAN",        COLOR_CYAN);
    SetDictInt("COLOR_WHITE",       COLOR_WHITE);

#ifdef NCURSES_MOUSE_VERSION
    /* Mouse-related constants */
    SetDictInt("BUTTON1_PRESSED",          BUTTON1_PRESSED);
    SetDictInt("BUTTON1_RELEASED",         BUTTON1_RELEASED);
    SetDictInt("BUTTON1_CLICKED",          BUTTON1_CLICKED);
    SetDictInt("BUTTON1_DOUBLE_CLICKED",   BUTTON1_DOUBLE_CLICKED);
    SetDictInt("BUTTON1_TRIPLE_CLICKED",   BUTTON1_TRIPLE_CLICKED);

    SetDictInt("BUTTON2_PRESSED",          BUTTON2_PRESSED);
    SetDictInt("BUTTON2_RELEASED",         BUTTON2_RELEASED);
    SetDictInt("BUTTON2_CLICKED",          BUTTON2_CLICKED);
    SetDictInt("BUTTON2_DOUBLE_CLICKED",   BUTTON2_DOUBLE_CLICKED);
    SetDictInt("BUTTON2_TRIPLE_CLICKED",   BUTTON2_TRIPLE_CLICKED);

    SetDictInt("BUTTON3_PRESSED",          BUTTON3_PRESSED);
    SetDictInt("BUTTON3_RELEASED",         BUTTON3_RELEASED);
    SetDictInt("BUTTON3_CLICKED",          BUTTON3_CLICKED);
    SetDictInt("BUTTON3_DOUBLE_CLICKED",   BUTTON3_DOUBLE_CLICKED);
    SetDictInt("BUTTON3_TRIPLE_CLICKED",   BUTTON3_TRIPLE_CLICKED);

    SetDictInt("BUTTON4_PRESSED",          BUTTON4_PRESSED);
    SetDictInt("BUTTON4_RELEASED",         BUTTON4_RELEASED);
    SetDictInt("BUTTON4_CLICKED",          BUTTON4_CLICKED);
    SetDictInt("BUTTON4_DOUBLE_CLICKED",   BUTTON4_DOUBLE_CLICKED);
    SetDictInt("BUTTON4_TRIPLE_CLICKED",   BUTTON4_TRIPLE_CLICKED);

    SetDictInt("BUTTON_SHIFT",             BUTTON_SHIFT);
    SetDictInt("BUTTON_CTRL",              BUTTON_CTRL);
    SetDictInt("BUTTON_ALT",               BUTTON_ALT);

    SetDictInt("ALL_MOUSE_EVENTS",         ALL_MOUSE_EVENTS);
    SetDictInt("REPORT_MOUSE_POSITION",    REPORT_MOUSE_POSITION);
#endif
    /* Now set everything up for KEY_ variables */
    {
        int key;
        char *key_n;
        char *key_n2;
#if !defined(__NetBSD__)
        for (key=KEY_MIN;key < KEY_MAX; key++) {
            key_n = (char *)keyname(key);
            if (key_n == NULL || strcmp(key_n,"UNKNOWN KEY")==0)
                continue;
            if (strncmp(key_n,"KEY_F(",6)==0) {
                char *p1, *p2;
                key_n2 = malloc(strlen(key_n)+1);
                if (!key_n2) {
                    PyErr_NoMemory();
                    break;
                }
                p1 = key_n;
                p2 = key_n2;
                while (*p1) {
                    if (*p1 != '(' && *p1 != ')') {
                        *p2 = *p1;
                        p2++;
                    }
                    p1++;
                }
                *p2 = (char)0;
            } else
                key_n2 = key_n;
            SetDictInt(key_n2,key);
            if (key_n2 != key_n)
                free(key_n2);
        }
#endif
        SetDictInt("KEY_MIN", KEY_MIN);
        SetDictInt("KEY_MAX", KEY_MAX);
    }
    return m;
}

Here is the call graph for this function:

int setupterm ( char *  ,
int  ,
int  
)

Here is the caller graph for this function:

Window_NoArgNoReturnFunction ( untouchwin  )

Definition at line 306 of file _cursesmodule.c.

{
    PyCursesWindowObject *wo;

    wo = PyObject_NEW(PyCursesWindowObject, &PyCursesWindow_Type);
    if (wo == NULL) return NULL;
    wo->win = win;
    return (PyObject *)wo;
}

Variable Documentation

int initialised = FALSE [static]

Definition at line 145 of file _cursesmodule.c.

Definition at line 142 of file _cursesmodule.c.

Definition at line 148 of file _cursesmodule.c.

PyObject* ModDict [static]

Definition at line 1992 of file _cursesmodule.c.

Definition at line 2707 of file _cursesmodule.c.

Definition at line 139 of file _cursesmodule.c.

char* PyCursesVersion = "2.2"

Definition at line 99 of file _cursesmodule.c.

Definition at line 1582 of file _cursesmodule.c.

Definition at line 245 of file _cursesmodule.c.

struct PyModuleDef [static]
Initial value:
 {
    PyModuleDef_HEAD_INIT,
    "_curses",
    NULL,
    -1,
    PyCurses_methods,
    NULL,
    NULL,
    NULL,
    NULL
}

Definition at line 2803 of file _cursesmodule.c.