jpayne@69: jpayne@69: #ifndef Py_CURSES_H jpayne@69: #define Py_CURSES_H jpayne@69: jpayne@69: #ifdef __APPLE__ jpayne@69: /* jpayne@69: ** On Mac OS X 10.2 [n]curses.h and stdlib.h use different guards jpayne@69: ** against multiple definition of wchar_t. jpayne@69: */ jpayne@69: #ifdef _BSD_WCHAR_T_DEFINED_ jpayne@69: #define _WCHAR_T jpayne@69: #endif jpayne@69: #endif /* __APPLE__ */ jpayne@69: jpayne@69: /* On FreeBSD, [n]curses.h and stdlib.h/wchar.h use different guards jpayne@69: against multiple definition of wchar_t and wint_t. */ jpayne@69: #if defined(__FreeBSD__) && defined(_XOPEN_SOURCE_EXTENDED) jpayne@69: # ifndef __wchar_t jpayne@69: # define __wchar_t jpayne@69: # endif jpayne@69: # ifndef __wint_t jpayne@69: # define __wint_t jpayne@69: # endif jpayne@69: #endif jpayne@69: jpayne@69: #if !defined(HAVE_CURSES_IS_PAD) && defined(WINDOW_HAS_FLAGS) jpayne@69: /* The following definition is necessary for ncurses 5.7; without it, jpayne@69: some of [n]curses.h set NCURSES_OPAQUE to 1, and then Python jpayne@69: can't get at the WINDOW flags field. */ jpayne@69: #define NCURSES_OPAQUE 0 jpayne@69: #endif jpayne@69: jpayne@69: #ifdef HAVE_NCURSES_H jpayne@69: #include jpayne@69: #else jpayne@69: #include jpayne@69: #endif jpayne@69: jpayne@69: #ifdef HAVE_NCURSES_H jpayne@69: /* configure was checking , but we will jpayne@69: use , which has some or all these features. */ jpayne@69: #if !defined(WINDOW_HAS_FLAGS) && !(NCURSES_OPAQUE+0) jpayne@69: #define WINDOW_HAS_FLAGS 1 jpayne@69: #endif jpayne@69: #if !defined(HAVE_CURSES_IS_PAD) && NCURSES_VERSION_PATCH+0 >= 20090906 jpayne@69: #define HAVE_CURSES_IS_PAD 1 jpayne@69: #endif jpayne@69: #ifndef MVWDELCH_IS_EXPRESSION jpayne@69: #define MVWDELCH_IS_EXPRESSION 1 jpayne@69: #endif jpayne@69: #endif jpayne@69: jpayne@69: #ifdef __cplusplus jpayne@69: extern "C" { jpayne@69: #endif jpayne@69: jpayne@69: #define PyCurses_API_pointers 4 jpayne@69: jpayne@69: /* Type declarations */ jpayne@69: jpayne@69: typedef struct { jpayne@69: PyObject_HEAD jpayne@69: WINDOW *win; jpayne@69: char *encoding; jpayne@69: } PyCursesWindowObject; jpayne@69: jpayne@69: #define PyCursesWindow_Check(v) (Py_TYPE(v) == &PyCursesWindow_Type) jpayne@69: jpayne@69: #define PyCurses_CAPSULE_NAME "_curses._C_API" jpayne@69: jpayne@69: jpayne@69: #ifdef CURSES_MODULE jpayne@69: /* This section is used when compiling _cursesmodule.c */ jpayne@69: jpayne@69: #else jpayne@69: /* This section is used in modules that use the _cursesmodule API */ jpayne@69: jpayne@69: static void **PyCurses_API; jpayne@69: jpayne@69: #define PyCursesWindow_Type (*(PyTypeObject *) PyCurses_API[0]) jpayne@69: #define PyCursesSetupTermCalled {if (! ((int (*)(void))PyCurses_API[1]) () ) return NULL;} jpayne@69: #define PyCursesInitialised {if (! ((int (*)(void))PyCurses_API[2]) () ) return NULL;} jpayne@69: #define PyCursesInitialisedColor {if (! ((int (*)(void))PyCurses_API[3]) () ) return NULL;} jpayne@69: jpayne@69: #define import_curses() \ jpayne@69: PyCurses_API = (void **)PyCapsule_Import(PyCurses_CAPSULE_NAME, 1); jpayne@69: jpayne@69: #endif jpayne@69: jpayne@69: /* general error messages */ jpayne@69: static const char catchall_ERR[] = "curses function returned ERR"; jpayne@69: static const char catchall_NULL[] = "curses function returned NULL"; jpayne@69: jpayne@69: #ifdef __cplusplus jpayne@69: } jpayne@69: #endif jpayne@69: jpayne@69: #endif /* !defined(Py_CURSES_H) */ jpayne@69: jpayne@69: