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
0008
0009
0010 #ifdef _BSD_WCHAR_T_DEFINED_
0011 #define _WCHAR_T
0012 #endif
0013 #endif
0014
0015
0016
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
0028
0029
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
0041
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
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
0074
0075 #else
0076
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
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
0099