_curses_cffi_check.c 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545
  1. #define _CFFI_
  2. /* We try to define Py_LIMITED_API before including Python.h.
  3. Mess: we can only define it if Py_DEBUG, Py_TRACE_REFS and
  4. Py_REF_DEBUG are not defined. This is a best-effort approximation:
  5. we can learn about Py_DEBUG from pyconfig.h, but it is unclear if
  6. the same works for the other two macros. Py_DEBUG implies them,
  7. but not the other way around.
  8. */
  9. #if !defined(_CFFI_USE_EMBEDDING) && !defined(Py_LIMITED_API)
  10. # include <pyconfig.h>
  11. # if !defined(Py_DEBUG) && !defined(Py_TRACE_REFS) && !defined(Py_REF_DEBUG)
  12. # define Py_LIMITED_API
  13. # endif
  14. #endif
  15. #include <Python.h>
  16. #ifdef __cplusplus
  17. extern "C" {
  18. #endif
  19. #include <stddef.h>
  20. /* This part is from file 'cffi/parse_c_type.h'. It is copied at the
  21. beginning of C sources generated by CFFI's ffi.set_source(). */
  22. typedef void *_cffi_opcode_t;
  23. #define _CFFI_OP(opcode, arg) (_cffi_opcode_t)(opcode | (((uintptr_t)(arg)) << 8))
  24. #define _CFFI_GETOP(cffi_opcode) ((unsigned char)(uintptr_t)cffi_opcode)
  25. #define _CFFI_GETARG(cffi_opcode) (((intptr_t)cffi_opcode) >> 8)
  26. #define _CFFI_OP_PRIMITIVE 1
  27. #define _CFFI_OP_POINTER 3
  28. #define _CFFI_OP_ARRAY 5
  29. #define _CFFI_OP_OPEN_ARRAY 7
  30. #define _CFFI_OP_STRUCT_UNION 9
  31. #define _CFFI_OP_ENUM 11
  32. #define _CFFI_OP_FUNCTION 13
  33. #define _CFFI_OP_FUNCTION_END 15
  34. #define _CFFI_OP_NOOP 17
  35. #define _CFFI_OP_BITFIELD 19
  36. #define _CFFI_OP_TYPENAME 21
  37. #define _CFFI_OP_CPYTHON_BLTN_V 23 // varargs
  38. #define _CFFI_OP_CPYTHON_BLTN_N 25 // noargs
  39. #define _CFFI_OP_CPYTHON_BLTN_O 27 // O (i.e. a single arg)
  40. #define _CFFI_OP_CONSTANT 29
  41. #define _CFFI_OP_CONSTANT_INT 31
  42. #define _CFFI_OP_GLOBAL_VAR 33
  43. #define _CFFI_OP_DLOPEN_FUNC 35
  44. #define _CFFI_OP_DLOPEN_CONST 37
  45. #define _CFFI_OP_GLOBAL_VAR_F 39
  46. #define _CFFI_OP_EXTERN_PYTHON 41
  47. #define _CFFI_PRIM_VOID 0
  48. #define _CFFI_PRIM_BOOL 1
  49. #define _CFFI_PRIM_CHAR 2
  50. #define _CFFI_PRIM_SCHAR 3
  51. #define _CFFI_PRIM_UCHAR 4
  52. #define _CFFI_PRIM_SHORT 5
  53. #define _CFFI_PRIM_USHORT 6
  54. #define _CFFI_PRIM_INT 7
  55. #define _CFFI_PRIM_UINT 8
  56. #define _CFFI_PRIM_LONG 9
  57. #define _CFFI_PRIM_ULONG 10
  58. #define _CFFI_PRIM_LONGLONG 11
  59. #define _CFFI_PRIM_ULONGLONG 12
  60. #define _CFFI_PRIM_FLOAT 13
  61. #define _CFFI_PRIM_DOUBLE 14
  62. #define _CFFI_PRIM_LONGDOUBLE 15
  63. #define _CFFI_PRIM_WCHAR 16
  64. #define _CFFI_PRIM_INT8 17
  65. #define _CFFI_PRIM_UINT8 18
  66. #define _CFFI_PRIM_INT16 19
  67. #define _CFFI_PRIM_UINT16 20
  68. #define _CFFI_PRIM_INT32 21
  69. #define _CFFI_PRIM_UINT32 22
  70. #define _CFFI_PRIM_INT64 23
  71. #define _CFFI_PRIM_UINT64 24
  72. #define _CFFI_PRIM_INTPTR 25
  73. #define _CFFI_PRIM_UINTPTR 26
  74. #define _CFFI_PRIM_PTRDIFF 27
  75. #define _CFFI_PRIM_SIZE 28
  76. #define _CFFI_PRIM_SSIZE 29
  77. #define _CFFI_PRIM_INT_LEAST8 30
  78. #define _CFFI_PRIM_UINT_LEAST8 31
  79. #define _CFFI_PRIM_INT_LEAST16 32
  80. #define _CFFI_PRIM_UINT_LEAST16 33
  81. #define _CFFI_PRIM_INT_LEAST32 34
  82. #define _CFFI_PRIM_UINT_LEAST32 35
  83. #define _CFFI_PRIM_INT_LEAST64 36
  84. #define _CFFI_PRIM_UINT_LEAST64 37
  85. #define _CFFI_PRIM_INT_FAST8 38
  86. #define _CFFI_PRIM_UINT_FAST8 39
  87. #define _CFFI_PRIM_INT_FAST16 40
  88. #define _CFFI_PRIM_UINT_FAST16 41
  89. #define _CFFI_PRIM_INT_FAST32 42
  90. #define _CFFI_PRIM_UINT_FAST32 43
  91. #define _CFFI_PRIM_INT_FAST64 44
  92. #define _CFFI_PRIM_UINT_FAST64 45
  93. #define _CFFI_PRIM_INTMAX 46
  94. #define _CFFI_PRIM_UINTMAX 47
  95. #define _CFFI_PRIM_FLOATCOMPLEX 48
  96. #define _CFFI_PRIM_DOUBLECOMPLEX 49
  97. #define _CFFI_PRIM_CHAR16 50
  98. #define _CFFI_PRIM_CHAR32 51
  99. #define _CFFI__NUM_PRIM 52
  100. #define _CFFI__UNKNOWN_PRIM (-1)
  101. #define _CFFI__UNKNOWN_FLOAT_PRIM (-2)
  102. #define _CFFI__UNKNOWN_LONG_DOUBLE (-3)
  103. #define _CFFI__IO_FILE_STRUCT (-1)
  104. struct _cffi_global_s {
  105. const char *name;
  106. void *address;
  107. _cffi_opcode_t type_op;
  108. void *size_or_direct_fn; // OP_GLOBAL_VAR: size, or 0 if unknown
  109. // OP_CPYTHON_BLTN_*: addr of direct function
  110. };
  111. struct _cffi_getconst_s {
  112. unsigned long long value;
  113. const struct _cffi_type_context_s *ctx;
  114. int gindex;
  115. };
  116. struct _cffi_struct_union_s {
  117. const char *name;
  118. int type_index; // -> _cffi_types, on a OP_STRUCT_UNION
  119. int flags; // _CFFI_F_* flags below
  120. size_t size;
  121. int alignment;
  122. int first_field_index; // -> _cffi_fields array
  123. int num_fields;
  124. };
  125. #define _CFFI_F_UNION 0x01 // is a union, not a struct
  126. #define _CFFI_F_CHECK_FIELDS 0x02 // complain if fields are not in the
  127. // "standard layout" or if some are missing
  128. #define _CFFI_F_PACKED 0x04 // for CHECK_FIELDS, assume a packed struct
  129. #define _CFFI_F_EXTERNAL 0x08 // in some other ffi.include()
  130. #define _CFFI_F_OPAQUE 0x10 // opaque
  131. struct _cffi_field_s {
  132. const char *name;
  133. size_t field_offset;
  134. size_t field_size;
  135. _cffi_opcode_t field_type_op;
  136. };
  137. struct _cffi_enum_s {
  138. const char *name;
  139. int type_index; // -> _cffi_types, on a OP_ENUM
  140. int type_prim; // _CFFI_PRIM_xxx
  141. const char *enumerators; // comma-delimited string
  142. };
  143. struct _cffi_typename_s {
  144. const char *name;
  145. int type_index; /* if opaque, points to a possibly artificial
  146. OP_STRUCT which is itself opaque */
  147. };
  148. struct _cffi_type_context_s {
  149. _cffi_opcode_t *types;
  150. const struct _cffi_global_s *globals;
  151. const struct _cffi_field_s *fields;
  152. const struct _cffi_struct_union_s *struct_unions;
  153. const struct _cffi_enum_s *enums;
  154. const struct _cffi_typename_s *typenames;
  155. int num_globals;
  156. int num_struct_unions;
  157. int num_enums;
  158. int num_typenames;
  159. const char *const *includes;
  160. int num_types;
  161. int flags; /* future extension */
  162. };
  163. struct _cffi_parse_info_s {
  164. const struct _cffi_type_context_s *ctx;
  165. _cffi_opcode_t *output;
  166. unsigned int output_size;
  167. size_t error_location;
  168. const char *error_message;
  169. };
  170. struct _cffi_externpy_s {
  171. const char *name;
  172. size_t size_of_result;
  173. void *reserved1, *reserved2;
  174. };
  175. #ifdef _CFFI_INTERNAL
  176. static int parse_c_type(struct _cffi_parse_info_s *info, const char *input);
  177. static int search_in_globals(const struct _cffi_type_context_s *ctx,
  178. const char *search, size_t search_len);
  179. static int search_in_struct_unions(const struct _cffi_type_context_s *ctx,
  180. const char *search, size_t search_len);
  181. #endif
  182. /* this block of #ifs should be kept exactly identical between
  183. c/_cffi_backend.c, cffi/vengine_cpy.py, cffi/vengine_gen.py
  184. and cffi/_cffi_include.h */
  185. #if defined(_MSC_VER)
  186. # include <malloc.h> /* for alloca() */
  187. # if _MSC_VER < 1600 /* MSVC < 2010 */
  188. typedef __int8 int8_t;
  189. typedef __int16 int16_t;
  190. typedef __int32 int32_t;
  191. typedef __int64 int64_t;
  192. typedef unsigned __int8 uint8_t;
  193. typedef unsigned __int16 uint16_t;
  194. typedef unsigned __int32 uint32_t;
  195. typedef unsigned __int64 uint64_t;
  196. typedef __int8 int_least8_t;
  197. typedef __int16 int_least16_t;
  198. typedef __int32 int_least32_t;
  199. typedef __int64 int_least64_t;
  200. typedef unsigned __int8 uint_least8_t;
  201. typedef unsigned __int16 uint_least16_t;
  202. typedef unsigned __int32 uint_least32_t;
  203. typedef unsigned __int64 uint_least64_t;
  204. typedef __int8 int_fast8_t;
  205. typedef __int16 int_fast16_t;
  206. typedef __int32 int_fast32_t;
  207. typedef __int64 int_fast64_t;
  208. typedef unsigned __int8 uint_fast8_t;
  209. typedef unsigned __int16 uint_fast16_t;
  210. typedef unsigned __int32 uint_fast32_t;
  211. typedef unsigned __int64 uint_fast64_t;
  212. typedef __int64 intmax_t;
  213. typedef unsigned __int64 uintmax_t;
  214. # else
  215. # include <stdint.h>
  216. # endif
  217. # if _MSC_VER < 1800 /* MSVC < 2013 */
  218. # ifndef __cplusplus
  219. typedef unsigned char _Bool;
  220. # endif
  221. # endif
  222. #else
  223. # include <stdint.h>
  224. # if (defined (__SVR4) && defined (__sun)) || defined(_AIX) || defined(__hpux)
  225. # include <alloca.h>
  226. # endif
  227. #endif
  228. #ifdef __GNUC__
  229. # define _CFFI_UNUSED_FN __attribute__((unused))
  230. #else
  231. # define _CFFI_UNUSED_FN /* nothing */
  232. #endif
  233. #ifdef __cplusplus
  234. # ifndef _Bool
  235. typedef bool _Bool; /* semi-hackish: C++ has no _Bool; bool is builtin */
  236. # endif
  237. #endif
  238. /********** CPython-specific section **********/
  239. #ifndef PYPY_VERSION
  240. #if PY_MAJOR_VERSION >= 3
  241. # define PyInt_FromLong PyLong_FromLong
  242. #endif
  243. #define _cffi_from_c_double PyFloat_FromDouble
  244. #define _cffi_from_c_float PyFloat_FromDouble
  245. #define _cffi_from_c_long PyInt_FromLong
  246. #define _cffi_from_c_ulong PyLong_FromUnsignedLong
  247. #define _cffi_from_c_longlong PyLong_FromLongLong
  248. #define _cffi_from_c_ulonglong PyLong_FromUnsignedLongLong
  249. #define _cffi_from_c__Bool PyBool_FromLong
  250. #define _cffi_to_c_double PyFloat_AsDouble
  251. #define _cffi_to_c_float PyFloat_AsDouble
  252. #define _cffi_from_c_int(x, type) \
  253. (((type)-1) > 0 ? /* unsigned */ \
  254. (sizeof(type) < sizeof(long) ? \
  255. PyInt_FromLong((long)x) : \
  256. sizeof(type) == sizeof(long) ? \
  257. PyLong_FromUnsignedLong((unsigned long)x) : \
  258. PyLong_FromUnsignedLongLong((unsigned long long)x)) : \
  259. (sizeof(type) <= sizeof(long) ? \
  260. PyInt_FromLong((long)x) : \
  261. PyLong_FromLongLong((long long)x)))
  262. #define _cffi_to_c_int(o, type) \
  263. ((type)( \
  264. sizeof(type) == 1 ? (((type)-1) > 0 ? (type)_cffi_to_c_u8(o) \
  265. : (type)_cffi_to_c_i8(o)) : \
  266. sizeof(type) == 2 ? (((type)-1) > 0 ? (type)_cffi_to_c_u16(o) \
  267. : (type)_cffi_to_c_i16(o)) : \
  268. sizeof(type) == 4 ? (((type)-1) > 0 ? (type)_cffi_to_c_u32(o) \
  269. : (type)_cffi_to_c_i32(o)) : \
  270. sizeof(type) == 8 ? (((type)-1) > 0 ? (type)_cffi_to_c_u64(o) \
  271. : (type)_cffi_to_c_i64(o)) : \
  272. (Py_FatalError("unsupported size for type " #type), (type)0)))
  273. #define _cffi_to_c_i8 \
  274. ((int(*)(PyObject *))_cffi_exports[1])
  275. #define _cffi_to_c_u8 \
  276. ((int(*)(PyObject *))_cffi_exports[2])
  277. #define _cffi_to_c_i16 \
  278. ((int(*)(PyObject *))_cffi_exports[3])
  279. #define _cffi_to_c_u16 \
  280. ((int(*)(PyObject *))_cffi_exports[4])
  281. #define _cffi_to_c_i32 \
  282. ((int(*)(PyObject *))_cffi_exports[5])
  283. #define _cffi_to_c_u32 \
  284. ((unsigned int(*)(PyObject *))_cffi_exports[6])
  285. #define _cffi_to_c_i64 \
  286. ((long long(*)(PyObject *))_cffi_exports[7])
  287. #define _cffi_to_c_u64 \
  288. ((unsigned long long(*)(PyObject *))_cffi_exports[8])
  289. #define _cffi_to_c_char \
  290. ((int(*)(PyObject *))_cffi_exports[9])
  291. #define _cffi_from_c_pointer \
  292. ((PyObject *(*)(char *, struct _cffi_ctypedescr *))_cffi_exports[10])
  293. #define _cffi_to_c_pointer \
  294. ((char *(*)(PyObject *, struct _cffi_ctypedescr *))_cffi_exports[11])
  295. #define _cffi_get_struct_layout \
  296. not used any more
  297. #define _cffi_restore_errno \
  298. ((void(*)(void))_cffi_exports[13])
  299. #define _cffi_save_errno \
  300. ((void(*)(void))_cffi_exports[14])
  301. #define _cffi_from_c_char \
  302. ((PyObject *(*)(char))_cffi_exports[15])
  303. #define _cffi_from_c_deref \
  304. ((PyObject *(*)(char *, struct _cffi_ctypedescr *))_cffi_exports[16])
  305. #define _cffi_to_c \
  306. ((int(*)(char *, struct _cffi_ctypedescr *, PyObject *))_cffi_exports[17])
  307. #define _cffi_from_c_struct \
  308. ((PyObject *(*)(char *, struct _cffi_ctypedescr *))_cffi_exports[18])
  309. #define _cffi_to_c_wchar_t \
  310. ((_cffi_wchar_t(*)(PyObject *))_cffi_exports[19])
  311. #define _cffi_from_c_wchar_t \
  312. ((PyObject *(*)(_cffi_wchar_t))_cffi_exports[20])
  313. #define _cffi_to_c_long_double \
  314. ((long double(*)(PyObject *))_cffi_exports[21])
  315. #define _cffi_to_c__Bool \
  316. ((_Bool(*)(PyObject *))_cffi_exports[22])
  317. #define _cffi_prepare_pointer_call_argument \
  318. ((Py_ssize_t(*)(struct _cffi_ctypedescr *, \
  319. PyObject *, char **))_cffi_exports[23])
  320. #define _cffi_convert_array_from_object \
  321. ((int(*)(char *, struct _cffi_ctypedescr *, PyObject *))_cffi_exports[24])
  322. #define _CFFI_CPIDX 25
  323. #define _cffi_call_python \
  324. ((void(*)(struct _cffi_externpy_s *, char *))_cffi_exports[_CFFI_CPIDX])
  325. #define _cffi_to_c_wchar3216_t \
  326. ((int(*)(PyObject *))_cffi_exports[26])
  327. #define _cffi_from_c_wchar3216_t \
  328. ((PyObject *(*)(int))_cffi_exports[27])
  329. #define _CFFI_NUM_EXPORTS 28
  330. struct _cffi_ctypedescr;
  331. static void *_cffi_exports[_CFFI_NUM_EXPORTS];
  332. #define _cffi_type(index) ( \
  333. assert((((uintptr_t)_cffi_types[index]) & 1) == 0), \
  334. (struct _cffi_ctypedescr *)_cffi_types[index])
  335. static PyObject *_cffi_init(const char *module_name, Py_ssize_t version,
  336. const struct _cffi_type_context_s *ctx)
  337. {
  338. PyObject *module, *o_arg, *new_module;
  339. void *raw[] = {
  340. (void *)module_name,
  341. (void *)version,
  342. (void *)_cffi_exports,
  343. (void *)ctx,
  344. };
  345. module = PyImport_ImportModule("_cffi_backend");
  346. if (module == NULL)
  347. goto failure;
  348. o_arg = PyLong_FromVoidPtr((void *)raw);
  349. if (o_arg == NULL)
  350. goto failure;
  351. new_module = PyObject_CallMethod(
  352. module, (char *)"_init_cffi_1_0_external_module", (char *)"O", o_arg);
  353. Py_DECREF(o_arg);
  354. Py_DECREF(module);
  355. return new_module;
  356. failure:
  357. Py_XDECREF(module);
  358. return NULL;
  359. }
  360. #ifdef HAVE_WCHAR_H
  361. typedef wchar_t _cffi_wchar_t;
  362. #else
  363. typedef uint16_t _cffi_wchar_t; /* same random pick as _cffi_backend.c */
  364. #endif
  365. _CFFI_UNUSED_FN static uint16_t _cffi_to_c_char16_t(PyObject *o)
  366. {
  367. if (sizeof(_cffi_wchar_t) == 2)
  368. return (uint16_t)_cffi_to_c_wchar_t(o);
  369. else
  370. return (uint16_t)_cffi_to_c_wchar3216_t(o);
  371. }
  372. _CFFI_UNUSED_FN static PyObject *_cffi_from_c_char16_t(uint16_t x)
  373. {
  374. if (sizeof(_cffi_wchar_t) == 2)
  375. return _cffi_from_c_wchar_t((_cffi_wchar_t)x);
  376. else
  377. return _cffi_from_c_wchar3216_t((int)x);
  378. }
  379. _CFFI_UNUSED_FN static int _cffi_to_c_char32_t(PyObject *o)
  380. {
  381. if (sizeof(_cffi_wchar_t) == 4)
  382. return (int)_cffi_to_c_wchar_t(o);
  383. else
  384. return (int)_cffi_to_c_wchar3216_t(o);
  385. }
  386. _CFFI_UNUSED_FN static PyObject *_cffi_from_c_char32_t(int x)
  387. {
  388. if (sizeof(_cffi_wchar_t) == 4)
  389. return _cffi_from_c_wchar_t((_cffi_wchar_t)x);
  390. else
  391. return _cffi_from_c_wchar3216_t(x);
  392. }
  393. /********** end CPython-specific section **********/
  394. #else
  395. _CFFI_UNUSED_FN
  396. static void (*_cffi_call_python_org)(struct _cffi_externpy_s *, char *);
  397. # define _cffi_call_python _cffi_call_python_org
  398. #endif
  399. #define _cffi_array_len(array) (sizeof(array) / sizeof((array)[0]))
  400. #define _cffi_prim_int(size, sign) \
  401. ((size) == 1 ? ((sign) ? _CFFI_PRIM_INT8 : _CFFI_PRIM_UINT8) : \
  402. (size) == 2 ? ((sign) ? _CFFI_PRIM_INT16 : _CFFI_PRIM_UINT16) : \
  403. (size) == 4 ? ((sign) ? _CFFI_PRIM_INT32 : _CFFI_PRIM_UINT32) : \
  404. (size) == 8 ? ((sign) ? _CFFI_PRIM_INT64 : _CFFI_PRIM_UINT64) : \
  405. _CFFI__UNKNOWN_PRIM)
  406. #define _cffi_prim_float(size) \
  407. ((size) == sizeof(float) ? _CFFI_PRIM_FLOAT : \
  408. (size) == sizeof(double) ? _CFFI_PRIM_DOUBLE : \
  409. (size) == sizeof(long double) ? _CFFI__UNKNOWN_LONG_DOUBLE : \
  410. _CFFI__UNKNOWN_FLOAT_PRIM)
  411. #define _cffi_check_int(got, got_nonpos, expected) \
  412. ((got_nonpos) == (expected <= 0) && \
  413. (got) == (unsigned long long)expected)
  414. #ifdef MS_WIN32
  415. # define _cffi_stdcall __stdcall
  416. #else
  417. # define _cffi_stdcall /* nothing */
  418. #endif
  419. #ifdef __cplusplus
  420. }
  421. #endif
  422. /************************************************************/
  423. /************************************************************/
  424. static void *_cffi_types[] = {
  425. 0
  426. };
  427. static const struct _cffi_type_context_s _cffi_type_context = {
  428. _cffi_types,
  429. NULL, /* no globals */
  430. NULL, /* no fields */
  431. NULL, /* no struct_unions */
  432. NULL, /* no enums */
  433. NULL, /* no typenames */
  434. 0, /* num_globals */
  435. 0, /* num_struct_unions */
  436. 0, /* num_enums */
  437. 0, /* num_typenames */
  438. NULL, /* no includes */
  439. 0, /* num_types */
  440. 0, /* flags */
  441. };
  442. #ifdef __GNUC__
  443. # pragma GCC visibility push(default) /* for -fvisibility= */
  444. #endif
  445. #ifdef PYPY_VERSION
  446. PyMODINIT_FUNC
  447. _cffi_pypyinit__curses_cffi_check(const void *p[])
  448. {
  449. p[0] = (const void *)0x2601;
  450. p[1] = &_cffi_type_context;
  451. #if PY_MAJOR_VERSION >= 3
  452. return NULL;
  453. #endif
  454. }
  455. # ifdef _MSC_VER
  456. PyMODINIT_FUNC
  457. # if PY_MAJOR_VERSION >= 3
  458. PyInit__curses_cffi_check(void) { return NULL; }
  459. # else
  460. init_curses_cffi_check(void) { }
  461. # endif
  462. # endif
  463. #elif PY_MAJOR_VERSION >= 3
  464. PyMODINIT_FUNC
  465. PyInit__curses_cffi_check(void)
  466. {
  467. return _cffi_init("_curses_cffi_check", 0x2601, &_cffi_type_context);
  468. }
  469. #else
  470. PyMODINIT_FUNC
  471. init_curses_cffi_check(void)
  472. {
  473. _cffi_init("_curses_cffi_check", 0x2601, &_cffi_type_context);
  474. }
  475. #endif
  476. #ifdef __GNUC__
  477. # pragma GCC visibility pop
  478. #endif