Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:06:49

0001 
0002 #ifndef Py_CURSES_H
0003 #define Py_CURSES_H
0004 
0005 #ifdef __APPLE__
0006 /*
0007 ** On Mac OS X 10.2 [n]curses.h and stdlib.h use different guards
0008 ** against multiple definition of wchar_t.
0009 */
0010 #ifdef _BSD_WCHAR_T_DEFINED_
0011 #define _WCHAR_T
0012 #endif
0013 #endif /* __APPLE__ */
0014 
0015 /* On FreeBSD, [n]curses.h and stdlib.h/wchar.h use different guards
0016    against multiple definition of wchar_t and wint_t. */
0017 #if defined(__FreeBSD__) && defined(_XOPEN_SOURCE_EXTENDED)
0018 # ifndef __wchar_t
0019 #   define __wchar_t
0020 # endif
0021 # ifndef __wint_t
0022 #   define __wint_t
0023 # endif
0024 #endif
0025 
0026 #if !defined(HAVE_CURSES_IS_PAD) && defined(WINDOW_HAS_FLAGS)
0027 /* The following definition is necessary for ncurses 5.7; without it,
0028    some of [n]curses.h set NCURSES_OPAQUE to 1, and then Python
0029    can't get at the WINDOW flags field. */
0030 #define NCURSES_OPAQUE 0
0031 #endif
0032 
0033 #ifdef HAVE_NCURSES_H
0034 #include <ncurses.h>
0035 #else
0036 #include <curses.h>
0037 #endif
0038 
0039 #ifdef HAVE_NCURSES_H
0040 /* configure was checking <curses.h>, but we will
0041    use <ncurses.h>, which has some or all these features. */
0042 #if !defined(WINDOW_HAS_FLAGS) && !(NCURSES_OPAQUE+0)
0043 #define WINDOW_HAS_FLAGS 1
0044 #endif
0045 #if !defined(HAVE_CURSES_IS_PAD) && NCURSES_VERSION_PATCH+0 >= 20090906
0046 #define HAVE_CURSES_IS_PAD 1
0047 #endif
0048 #ifndef MVWDELCH_IS_EXPRESSION
0049 #define MVWDELCH_IS_EXPRESSION 1
0050 #endif
0051 #endif
0052 
0053 #ifdef __cplusplus
0054 extern "C" {
0055 #endif
0056 
0057 #define PyCurses_API_pointers 4
0058 
0059 /* Type declarations */
0060 
0061 typedef struct {
0062     PyObject_HEAD
0063     WINDOW *win;
0064     char *encoding;
0065 } PyCursesWindowObject;
0066 
0067 #define PyCursesWindow_Check(v) Py_IS_TYPE((v), &PyCursesWindow_Type)
0068 
0069 #define PyCurses_CAPSULE_NAME "_curses._C_API"
0070 
0071 
0072 #ifdef CURSES_MODULE
0073 /* This section is used when compiling _cursesmodule.c */
0074 
0075 #else
0076 /* This section is used in modules that use the _cursesmodule API */
0077 
0078 static void **PyCurses_API;
0079 
0080 #define PyCursesWindow_Type (*_PyType_CAST(PyCurses_API[0]))
0081 #define PyCursesSetupTermCalled  {if (! ((int (*)(void))PyCurses_API[1]) () ) return NULL;}
0082 #define PyCursesInitialised      {if (! ((int (*)(void))PyCurses_API[2]) () ) return NULL;}
0083 #define PyCursesInitialisedColor {if (! ((int (*)(void))PyCurses_API[3]) () ) return NULL;}
0084 
0085 #define import_curses() \
0086     PyCurses_API = (void **)PyCapsule_Import(PyCurses_CAPSULE_NAME, 1);
0087 
0088 #endif
0089 
0090 /* general error messages */
0091 static const char catchall_ERR[]  = "curses function returned ERR";
0092 static const char catchall_NULL[] = "curses function returned NULL";
0093 
0094 #ifdef __cplusplus
0095 }
0096 #endif
0097 
0098 #endif /* !defined(Py_CURSES_H) */
0099