File indexing completed on 2025-11-19 09:50:54
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(WINDOW_HAS_FLAGS) && defined(__APPLE__)
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036 #define NCURSES_OPAQUE 0
0037 #endif
0038
0039 #if defined(HAVE_NCURSESW_NCURSES_H)
0040 # include <ncursesw/ncurses.h>
0041 #elif defined(HAVE_NCURSESW_CURSES_H)
0042 # include <ncursesw/curses.h>
0043 #elif defined(HAVE_NCURSES_NCURSES_H)
0044 # include <ncurses/ncurses.h>
0045 #elif defined(HAVE_NCURSES_CURSES_H)
0046 # include <ncurses/curses.h>
0047 #elif defined(HAVE_NCURSES_H)
0048 # include <ncurses.h>
0049 #elif defined(HAVE_CURSES_H)
0050 # include <curses.h>
0051 #endif
0052
0053 #ifdef NCURSES_VERSION
0054
0055
0056 #if !defined(WINDOW_HAS_FLAGS) && \
0057 (NCURSES_VERSION_PATCH+0 < 20070303 || !(NCURSES_OPAQUE+0))
0058
0059
0060 #define WINDOW_HAS_FLAGS 1
0061 #endif
0062 #if !defined(HAVE_CURSES_IS_PAD) && NCURSES_VERSION_PATCH+0 >= 20090906
0063 #define HAVE_CURSES_IS_PAD 1
0064 #endif
0065 #ifndef MVWDELCH_IS_EXPRESSION
0066 #define MVWDELCH_IS_EXPRESSION 1
0067 #endif
0068 #endif
0069
0070 #ifdef __cplusplus
0071 extern "C" {
0072 #endif
0073
0074 #define PyCurses_API_pointers 4
0075
0076
0077
0078 typedef struct PyCursesWindowObject {
0079 PyObject_HEAD
0080 WINDOW *win;
0081 char *encoding;
0082 struct PyCursesWindowObject *orig;
0083 } PyCursesWindowObject;
0084
0085 #define PyCursesWindow_Check(v) Py_IS_TYPE((v), &PyCursesWindow_Type)
0086
0087 #define PyCurses_CAPSULE_NAME "_curses._C_API"
0088
0089
0090 #ifdef CURSES_MODULE
0091
0092
0093 #else
0094
0095
0096 static void **PyCurses_API;
0097
0098 #define PyCursesWindow_Type (*_PyType_CAST(PyCurses_API[0]))
0099 #define PyCursesSetupTermCalled {if (! ((int (*)(void))PyCurses_API[1]) () ) return NULL;}
0100 #define PyCursesInitialised {if (! ((int (*)(void))PyCurses_API[2]) () ) return NULL;}
0101 #define PyCursesInitialisedColor {if (! ((int (*)(void))PyCurses_API[3]) () ) return NULL;}
0102
0103 #define import_curses() \
0104 PyCurses_API = (void **)PyCapsule_Import(PyCurses_CAPSULE_NAME, 1);
0105
0106 #endif
0107
0108
0109 static const char catchall_ERR[] = "curses function returned ERR";
0110 static const char catchall_NULL[] = "curses function returned NULL";
0111
0112 #ifdef __cplusplus
0113 }
0114 #endif
0115
0116 #endif
0117