Guest User

Python.bi

a guest
Nov 26th, 2016
294
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
FreeBasic 108.83 KB | None | 0 0
  1. #pragma once
  2.  
  3. #include once "crt/long.bi"
  4. #include once "crt/limits.bi"
  5. #include once "crt/stdio.bi"
  6. #include once "crt/string.bi"
  7. #include once "crt/errno.bi"
  8. #include once "crt/stdlib.bi"
  9. #include once "crt/stdint.bi"
  10. #include once "crt/math.bi"
  11. #include once "crt/time.bi"
  12. #include once "crt/stdarg.bi"
  13. #include once "crt/ctype.bi"
  14. #include once "crt/wchar.bi"
  15. #include once "crt/stddef.bi"
  16.  
  17. '' The following symbols have been renamed:
  18. ''     #define _Py_IDENTIFIER => _Py_IDENTIFIER_
  19. ''     typedef destructor => destructor_
  20. ''     #define TYPE => TYPE_
  21. ''     #define STR => STR_
  22.  
  23. extern "C"
  24.  
  25. #define Py_PYTHON_H
  26. const PY_RELEASE_LEVEL_ALPHA = &hA
  27. const PY_RELEASE_LEVEL_BETA = &hB
  28. const PY_RELEASE_LEVEL_GAMMA = &hC
  29. const PY_RELEASE_LEVEL_FINAL = &hF
  30. const PY_MAJOR_VERSION = 3
  31. const PY_MINOR_VERSION = 5
  32. const PY_MICRO_VERSION = 2
  33. const PY_RELEASE_LEVEL = PY_RELEASE_LEVEL_FINAL
  34. const PY_RELEASE_SERIAL = 0
  35. #define PY_VERSION "3.5.2"
  36. const PY_VERSION_HEX = ((((PY_MAJOR_VERSION shl 24) or (PY_MINOR_VERSION shl 16)) or (PY_MICRO_VERSION shl 8)) or (PY_RELEASE_LEVEL shl 4)) or (PY_RELEASE_SERIAL shl 0)
  37. #define Py_PYCONFIG_H
  38. const DOUBLE_IS_LITTLE_ENDIAN_IEEE754 = 1
  39. const ENABLE_IPV6 = 1
  40. const HAVE_ACCEPT4 = 1
  41. const HAVE_ACOSH = 1
  42. const HAVE_ADDRINFO = 1
  43. const HAVE_ALARM = 1
  44. const HAVE_ALLOCA_H = 1
  45. const HAVE_ASINH = 1
  46. const HAVE_ASM_TYPES_H = 1
  47. const HAVE_ATANH = 1
  48. const HAVE_BIND_TEXTDOMAIN_CODESET = 1
  49. const HAVE_BLUETOOTH_BLUETOOTH_H = 1
  50. const HAVE_BUILTIN_ATOMIC = 1
  51. const HAVE_C99_BOOL = 1
  52. const HAVE_CHOWN = 1
  53. const HAVE_CHROOT = 1
  54. const HAVE_CLOCK = 1
  55. const HAVE_CLOCK_GETRES = 1
  56. const HAVE_CLOCK_GETTIME = 1
  57. const HAVE_COMPUTED_GOTOS = 1
  58. const HAVE_CONFSTR = 1
  59. const HAVE_COPYSIGN = 1
  60. const HAVE_CTERMID = 1
  61. const HAVE_CURSES_H = 1
  62. const HAVE_CURSES_IS_TERM_RESIZED = 1
  63. const HAVE_CURSES_RESIZETERM = 1
  64. const HAVE_CURSES_RESIZE_TERM = 1
  65. const HAVE_DECL_ISFINITE = 1
  66. const HAVE_DECL_ISINF = 1
  67. const HAVE_DECL_ISNAN = 1
  68. const HAVE_DEVICE_MACROS = 1
  69. const HAVE_DEV_PTMX = 1
  70. const HAVE_DIRENT_D_TYPE = 1
  71. const HAVE_DIRENT_H = 1
  72. const HAVE_DIRFD = 1
  73. const HAVE_DLFCN_H = 1
  74. const HAVE_DLOPEN = 1
  75. const HAVE_DUP2 = 1
  76. const HAVE_DUP3 = 1
  77. const HAVE_DYNAMIC_LOADING = 1
  78. const HAVE_ENDIAN_H = 1
  79. const HAVE_EPOLL = 1
  80. const HAVE_EPOLL_CREATE1 = 1
  81. const HAVE_ERF = 1
  82. const HAVE_ERFC = 1
  83. const HAVE_ERRNO_H = 1
  84. const HAVE_EXECV = 1
  85. const HAVE_EXPM1 = 1
  86. const HAVE_FACCESSAT = 1
  87. const HAVE_FCHDIR = 1
  88. const HAVE_FCHMOD = 1
  89. const HAVE_FCHMODAT = 1
  90. const HAVE_FCHOWN = 1
  91. const HAVE_FCHOWNAT = 1
  92. const HAVE_FCNTL_H = 1
  93. const HAVE_FDATASYNC = 1
  94. const HAVE_FDOPENDIR = 1
  95. const HAVE_FEXECVE = 1
  96. const HAVE_FINITE = 1
  97. const HAVE_FLOCK = 1
  98. const HAVE_FORK = 1
  99. const HAVE_FORKPTY = 1
  100. const HAVE_FPATHCONF = 1
  101. const HAVE_FSEEKO = 1
  102. const HAVE_FSTATAT = 1
  103. const HAVE_FSTATVFS = 1
  104. const HAVE_FSYNC = 1
  105. const HAVE_FTELLO = 1
  106. const HAVE_FTIME = 1
  107. const HAVE_FTRUNCATE = 1
  108. const HAVE_FUTIMENS = 1
  109. const HAVE_FUTIMES = 1
  110. const HAVE_FUTIMESAT = 1
  111. const HAVE_GAI_STRERROR = 1
  112. const HAVE_GAMMA = 1
  113. const HAVE_GCC_ASM_FOR_X64 = 1
  114. const HAVE_GCC_ASM_FOR_X87 = 1
  115. const HAVE_GCC_UINT128_T = 1
  116. const HAVE_GETADDRINFO = 1
  117. const HAVE_GETC_UNLOCKED = 1
  118. const HAVE_GETGROUPLIST = 1
  119. const HAVE_GETGROUPS = 1
  120. const HAVE_GETHOSTBYNAME_R = 1
  121. const HAVE_GETHOSTBYNAME_R_6_ARG = 1
  122. const HAVE_GETITIMER = 1
  123. const HAVE_GETLOADAVG = 1
  124. const HAVE_GETLOGIN = 1
  125. const HAVE_GETNAMEINFO = 1
  126. const HAVE_GETPAGESIZE = 1
  127. const HAVE_GETPEERNAME = 1
  128. const HAVE_GETPGID = 1
  129. const HAVE_GETPGRP = 1
  130. const HAVE_GETPID = 1
  131. const HAVE_GETPRIORITY = 1
  132. const HAVE_GETPWENT = 1
  133. const HAVE_GETRANDOM_SYSCALL = 1
  134. const HAVE_GETRESGID = 1
  135. const HAVE_GETRESUID = 1
  136. const HAVE_GETSID = 1
  137. const HAVE_GETSPENT = 1
  138. const HAVE_GETSPNAM = 1
  139. const HAVE_GETTIMEOFDAY = 1
  140. const HAVE_GETWD = 1
  141. const HAVE_GRP_H = 1
  142. const HAVE_HSTRERROR = 1
  143. const HAVE_HTOLE64 = 1
  144. const HAVE_HYPOT = 1
  145. const HAVE_IF_NAMEINDEX = 1
  146. const HAVE_INET_ATON = 1
  147. const HAVE_INET_PTON = 1
  148. const HAVE_INITGROUPS = 1
  149. const HAVE_INT32_T = 1
  150. const HAVE_INT64_T = 1
  151. const HAVE_INTTYPES_H = 1
  152. const HAVE_KILL = 1
  153. const HAVE_KILLPG = 1
  154. const HAVE_LANGINFO_H = 1
  155. const HAVE_LCHOWN = 1
  156. const HAVE_LGAMMA = 1
  157. const HAVE_LIBDL = 1
  158. const HAVE_LIBINTL_H = 1
  159. const HAVE_LIBREADLINE = 1
  160. const HAVE_LINK = 1
  161. const HAVE_LINKAT = 1
  162. const HAVE_LINUX_CAN_BCM_H = 1
  163. const HAVE_LINUX_CAN_H = 1
  164. const HAVE_LINUX_CAN_RAW_FD_FRAMES = 1
  165. const HAVE_LINUX_CAN_RAW_H = 1
  166. const HAVE_LINUX_NETLINK_H = 1
  167. const HAVE_LINUX_TIPC_H = 1
  168. const HAVE_LINUX_RANDOM_H = 1
  169. const HAVE_LOCKF = 1
  170. const HAVE_LOG1P = 1
  171. const HAVE_LOG2 = 1
  172. const HAVE_LONG_DOUBLE = 1
  173. const HAVE_LONG_LONG = 1
  174. const HAVE_LSTAT = 1
  175. const HAVE_LUTIMES = 1
  176. const HAVE_MAKEDEV = 1
  177. const HAVE_MBRTOWC = 1
  178. const HAVE_MEMMOVE = 1
  179. const HAVE_MEMORY_H = 1
  180. const HAVE_MEMRCHR = 1
  181. const HAVE_MKDIRAT = 1
  182. const HAVE_MKFIFO = 1
  183. const HAVE_MKFIFOAT = 1
  184. const HAVE_MKNOD = 1
  185. const HAVE_MKNODAT = 1
  186. const HAVE_MKTIME = 1
  187. const HAVE_MMAP = 1
  188. const HAVE_MREMAP = 1
  189. const HAVE_NCURSES_H = 1
  190. const HAVE_NETPACKET_PACKET_H = 1
  191. const HAVE_NET_IF_H = 1
  192. const HAVE_NICE = 1
  193. const HAVE_OPENAT = 1
  194. const HAVE_OPENPTY = 1
  195. const HAVE_PATHCONF = 1
  196. const HAVE_PAUSE = 1
  197. const HAVE_PIPE2 = 1
  198. const HAVE_POLL = 1
  199. const HAVE_POLL_H = 1
  200. const HAVE_POSIX_FADVISE = 1
  201. const HAVE_POSIX_FALLOCATE = 1
  202. const HAVE_PREAD = 1
  203. const HAVE_PRLIMIT = 1
  204. const HAVE_PROTOTYPES = 1
  205. const HAVE_PTHREAD_ATFORK = 1
  206. const HAVE_PTHREAD_H = 1
  207. const HAVE_PTHREAD_KILL = 1
  208. const HAVE_PTHREAD_SIGMASK = 1
  209. const HAVE_PTY_H = 1
  210. const HAVE_PUTENV = 1
  211. const HAVE_PWRITE = 1
  212. const HAVE_RAND_EGD = 1
  213. const HAVE_READLINK = 1
  214. const HAVE_READLINKAT = 1
  215. const HAVE_READV = 1
  216. const HAVE_REALPATH = 1
  217. const HAVE_RENAMEAT = 1
  218. const HAVE_RL_APPEND_HISTORY = 1
  219. const HAVE_RL_CALLBACK = 1
  220. const HAVE_RL_CATCH_SIGNAL = 1
  221. const HAVE_RL_COMPLETION_APPEND_CHARACTER = 1
  222. const HAVE_RL_COMPLETION_DISPLAY_MATCHES_HOOK = 1
  223. const HAVE_RL_COMPLETION_MATCHES = 1
  224. const HAVE_RL_COMPLETION_SUPPRESS_APPEND = 1
  225. const HAVE_RL_PRE_INPUT_HOOK = 1
  226. const HAVE_RL_RESIZE_TERMINAL = 1
  227. const HAVE_ROUND = 1
  228. const HAVE_SCHED_GET_PRIORITY_MAX = 1
  229. const HAVE_SCHED_H = 1
  230. const HAVE_SCHED_RR_GET_INTERVAL = 1
  231. const HAVE_SCHED_SETAFFINITY = 1
  232. const HAVE_SCHED_SETPARAM = 1
  233. const HAVE_SCHED_SETSCHEDULER = 1
  234. const HAVE_SELECT = 1
  235. const HAVE_SEM_GETVALUE = 1
  236. const HAVE_SEM_OPEN = 1
  237. const HAVE_SEM_TIMEDWAIT = 1
  238. const HAVE_SEM_UNLINK = 1
  239. const HAVE_SENDFILE = 1
  240. const HAVE_SETEGID = 1
  241. const HAVE_SETEUID = 1
  242. const HAVE_SETGID = 1
  243. const HAVE_SETGROUPS = 1
  244. const HAVE_SETHOSTNAME = 1
  245. const HAVE_SETITIMER = 1
  246. const HAVE_SETLOCALE = 1
  247. const HAVE_SETPGID = 1
  248. const HAVE_SETPGRP = 1
  249. const HAVE_SETPRIORITY = 1
  250. const HAVE_SETREGID = 1
  251. const HAVE_SETRESGID = 1
  252. const HAVE_SETRESUID = 1
  253. const HAVE_SETREUID = 1
  254. const HAVE_SETSID = 1
  255. const HAVE_SETUID = 1
  256. const HAVE_SETVBUF = 1
  257. const HAVE_SHADOW_H = 1
  258. const HAVE_SIGACTION = 1
  259. const HAVE_SIGALTSTACK = 1
  260. const HAVE_SIGINTERRUPT = 1
  261. const HAVE_SIGNAL_H = 1
  262. const HAVE_SIGPENDING = 1
  263. const HAVE_SIGRELSE = 1
  264. const HAVE_SIGTIMEDWAIT = 1
  265. const HAVE_SIGWAIT = 1
  266. const HAVE_SIGWAITINFO = 1
  267. const HAVE_SNPRINTF = 1
  268. const HAVE_SOCKADDR_STORAGE = 1
  269. const HAVE_SOCKETPAIR = 1
  270. const HAVE_SPAWN_H = 1
  271. const HAVE_SSIZE_T = 1
  272. const HAVE_STATVFS = 1
  273. const HAVE_STAT_TV_NSEC = 1
  274. const HAVE_STDARG_PROTOTYPES = 1
  275. const HAVE_STDINT_H = 1
  276. const HAVE_STDLIB_H = 1
  277. const HAVE_STD_ATOMIC = 1
  278. const HAVE_STRDUP = 1
  279. const HAVE_STRFTIME = 1
  280. const HAVE_STRINGS_H = 1
  281. const HAVE_STRING_H = 1
  282. const HAVE_STROPTS_H = 1
  283. const HAVE_STRUCT_STAT_ST_BLKSIZE = 1
  284. const HAVE_STRUCT_STAT_ST_BLOCKS = 1
  285. const HAVE_STRUCT_STAT_ST_RDEV = 1
  286. const HAVE_STRUCT_TM_TM_ZONE = 1
  287. const HAVE_SYMLINK = 1
  288. const HAVE_SYMLINKAT = 1
  289. const HAVE_SYNC = 1
  290. const HAVE_SYSCONF = 1
  291. const HAVE_SYSEXITS_H = 1
  292. const HAVE_SYS_EPOLL_H = 1
  293. const HAVE_SYS_FILE_H = 1
  294. const HAVE_SYS_IOCTL_H = 1
  295. const HAVE_SYS_PARAM_H = 1
  296. const HAVE_SYS_POLL_H = 1
  297. const HAVE_SYS_RESOURCE_H = 1
  298. const HAVE_SYS_SELECT_H = 1
  299. const HAVE_SYS_SENDFILE_H = 1
  300. const HAVE_SYS_SOCKET_H = 1
  301. const HAVE_SYS_STATVFS_H = 1
  302. const HAVE_SYS_STAT_H = 1
  303. const HAVE_SYS_SYSCALL_H = 1
  304. const HAVE_SYS_TIMES_H = 1
  305. const HAVE_SYS_TIME_H = 1
  306. const HAVE_SYS_TYPES_H = 1
  307. const HAVE_SYS_UIO_H = 1
  308. const HAVE_SYS_UN_H = 1
  309. const HAVE_SYS_UTSNAME_H = 1
  310. const HAVE_SYS_WAIT_H = 1
  311. const HAVE_SYS_XATTR_H = 1
  312. const HAVE_TCGETPGRP = 1
  313. const HAVE_TCSETPGRP = 1
  314. const HAVE_TEMPNAM = 1
  315. const HAVE_TERMIOS_H = 1
  316. const HAVE_TERM_H = 1
  317. const HAVE_TGAMMA = 1
  318. const HAVE_TIMEGM = 1
  319. const HAVE_TIMES = 1
  320. const HAVE_TMPFILE = 1
  321. const HAVE_TMPNAM = 1
  322. const HAVE_TMPNAM_R = 1
  323. const HAVE_TM_ZONE = 1
  324. const HAVE_TRUNCATE = 1
  325. const HAVE_UINT32_T = 1
  326. const HAVE_UINT64_T = 1
  327. const HAVE_UINTPTR_T = 1
  328. const HAVE_UNAME = 1
  329. const HAVE_UNISTD_H = 1
  330. const HAVE_UNLINKAT = 1
  331. const HAVE_UNSETENV = 1
  332. const HAVE_UTIMENSAT = 1
  333. const HAVE_UTIMES = 1
  334. const HAVE_UTIME_H = 1
  335. const HAVE_WAIT3 = 1
  336. const HAVE_WAIT4 = 1
  337. const HAVE_WAITID = 1
  338. const HAVE_WAITPID = 1
  339. const HAVE_WCHAR_H = 1
  340. const HAVE_WCSCOLL = 1
  341. const HAVE_WCSFTIME = 1
  342. const HAVE_WCSXFRM = 1
  343. const HAVE_WMEMCMP = 1
  344. const HAVE_WORKING_TZSET = 1
  345. const HAVE_WRITEV = 1
  346. const HAVE_ZLIB_COPY = 1
  347. const MVWDELCH_IS_EXPRESSION = 1
  348. const PTHREAD_SYSTEM_SCHED_SUPPORTED = 1
  349. #define PY_FORMAT_LONG_LONG "ll"
  350. #define PY_FORMAT_SIZE_T "z"
  351. const Py_ENABLE_SHARED = 1
  352. type RETSIGTYPE as any
  353. const SIZEOF_DOUBLE = 8
  354. const SIZEOF_FLOAT = 4
  355. const SIZEOF_FPOS_T = 16
  356. const SIZEOF_INT = 4
  357. const SIZEOF_LONG = 8
  358. const SIZEOF_LONG_DOUBLE = 16
  359. const SIZEOF_LONG_LONG = 8
  360. const SIZEOF_OFF_T = 8
  361. const SIZEOF_PID_T = 4
  362. const SIZEOF_PTHREAD_T = 8
  363. const SIZEOF_SHORT = 2
  364. const SIZEOF_SIZE_T = 8
  365. const SIZEOF_TIME_T = 8
  366. const SIZEOF_UINTPTR_T = 8
  367. const SIZEOF_VOID_P = 8
  368. const SIZEOF_WCHAR_T = 4
  369. const SIZEOF__BOOL = 1
  370. const STDC_HEADERS = 1
  371. const SYS_SELECT_WITH_SYS_TIME = 1
  372. const TANH_PRESERVES_ZERO_SIGN = 1
  373. const TIME_WITH_SYS_TIME = 1
  374. const USE_INLINE = 1
  375. const _ALL_SOURCE = 1
  376. const _GNU_SOURCE = 1
  377. const _POSIX_PTHREAD_SEMANTICS = 1
  378. const _TANDEM_SOURCE = 1
  379. const __EXTENSIONS__ = 1
  380. const VA_LIST_IS_ARRAY = 1
  381. const WINDOW_HAS_FLAGS = 1
  382. const WITH_DOC_STRINGS = 1
  383. const WITH_PYMALLOC = 1
  384. const WITH_THREAD = 1
  385. const _BSD_TYPES = 1
  386. const _DARWIN_C_SOURCE = 1
  387. const _FILE_OFFSET_BITS = 64
  388. const _GNU_SOURCE = 1
  389. const _LARGEFILE_SOURCE = 1
  390. const _NETBSD_SOURCE = 1
  391. const _POSIX_C_SOURCE = cast(clong, 200809)
  392. const _XOPEN_SOURCE = 700
  393. const _XOPEN_SOURCE_EXTENDED = 1
  394. const __BSD_VISIBLE = 1
  395. #define PYMACCONFIG_H
  396. #define Py_PYPORT_H
  397. type PY_LONG_LONG as longint
  398. #define PY_LLONG_MIN LLONG_MIN
  399. #define PY_LLONG_MAX LLONG_MAX
  400. #define PY_ULLONG_MAX ULLONG_MAX
  401.  
  402. type PY_UINT32_T as ulong
  403. type PY_UINT64_T as ulongint
  404. type PY_INT32_T as long
  405. type PY_INT64_T as longint
  406. const PYLONG_BITS_IN_DIGIT = 30
  407. type Py_uintptr_t as uinteger
  408. type Py_intptr_t as integer
  409. type Py_ssize_t as integer
  410. const SIZEOF_PY_HASH_T = SIZEOF_SIZE_T
  411. type Py_hash_t as Py_ssize_t
  412. const SIZEOF_PY_UHASH_T = SIZEOF_SIZE_T
  413. type Py_uhash_t as uinteger
  414. type Py_ssize_clean_t as long
  415.  
  416. const PY_SIZE_MAX = cuint(-1)
  417. const PY_SSIZE_T_MAX = cast(Py_ssize_t, cuint(-1) shr 1)
  418. const PY_SSIZE_T_MIN = (-PY_SSIZE_T_MAX) - 1
  419. '' TODO: #define Py_LOCAL(type) static type
  420. '' TODO: #define Py_LOCAL_INLINE(type) static inline type
  421. #define Py_MEMCPY memcpy
  422. const S_IFMT = &o170000
  423. const S_IFLNK = &o120000
  424. #define S_ISREG(x) (((x) and S_IFMT) = S_IFREG)
  425. #define S_ISDIR(x) (((x) and S_IFMT) = S_IFDIR)
  426. #define S_ISCHR(x) (((x) and S_IFMT) = S_IFCHR)
  427. #define Py_ARITHMETIC_RIGHT_SHIFT(TYPE_, I, J) ((I) shr (J))
  428. #define Py_FORCE_EXPANSION(X) X
  429. #define Py_SAFE_DOWNCAST(VALUE, WIDE, NARROW) NARROW(VALUE)
  430. '' TODO: #define _Py_SET_EDOM_FOR_NAN(X) ;
  431. #macro Py_SET_ERRNO_ON_MATH_ERROR(X)
  432.     if errno = 0 then
  433.         '' TODO: if ((X) == Py_HUGE_VAL || (X) == -Py_HUGE_VAL) errno = ERANGE;
  434.         '' TODO: else _Py_SET_EDOM_FOR_NAN(X)
  435.     end if
  436. #endmacro
  437. #define Py_SET_ERANGE_IF_OVERFLOW(X) Py_SET_ERRNO_ON_MATH_ERROR(X)
  438. #macro Py_ADJUST_ERANGE1(X)
  439.     if errno = 0 then
  440.         if ((X) = Py_HUGE_VAL) orelse ((X) = (-Py_HUGE_VAL)) then
  441.             errno = ERANGE
  442.         end if
  443.     elseif (errno = ERANGE) andalso ((X) = 0.0) then
  444.         errno = 0
  445.     end if
  446. #endmacro
  447. #macro Py_ADJUST_ERANGE2(X, Y)
  448.     if ((((X) = Py_HUGE_VAL) orelse ((X) = (-Py_HUGE_VAL))) orelse ((Y) = Py_HUGE_VAL)) orelse ((Y) = (-Py_HUGE_VAL)) then
  449.         if errno = 0 then
  450.             errno = ERANGE
  451.         end if
  452.     elseif errno = ERANGE then
  453.         errno = 0
  454.     end if
  455. #endmacro
  456. const HAVE_PY_SET_53BIT_PRECISION = 1
  457. '' TODO: #define _Py_SET_53BIT_PRECISION_HEADER unsigned short old_387controlword, new_387controlword
  458. #macro _Py_SET_53BIT_PRECISION_START
  459.     scope
  460.         old_387controlword = _Py_get_387controlword()
  461.         new_387controlword = (old_387controlword and (not &h0f00)) or &h0200
  462.         if new_387controlword <> old_387controlword then
  463.             _Py_set_387controlword(new_387controlword)
  464.         end if
  465.     end scope
  466. #endmacro
  467. '' TODO: #define _Py_SET_53BIT_PRECISION_END if (new_387controlword != old_387controlword) _Py_set_387controlword(old_387controlword)
  468. #define PyAPI_FUNC(RTYPE) RTYPE
  469. '' TODO: # define PyAPI_DATA(RTYPE) extern RTYPE
  470. type PyObject as PyObject_
  471. type PyMODINIT_FUNC as PyObject ptr
  472. const LONG_BIT = 8 * SIZEOF_LONG
  473. #define Py_LL(x) x##LL
  474. #define Py_ULL(x) Py_LL(x##U)
  475. #define Py_VA_COPY(x, y) Py_MEMCPY((x), (y), sizeof(va_list))
  476. const PY_BIG_ENDIAN = 0
  477. const PY_LITTLE_ENDIAN = 1
  478. #define Py_PYMACRO_H
  479. #define Py_MIN(x, y) iif((x) > (y), (y), (x))
  480. #define Py_MAX(x, y) iif((x) > (y), (x), (y))
  481. #define Py_ABS(x) iif((x) < 0, -(x), (x))
  482. #define _Py_XSTRINGIFY(x) #x
  483. #define Py_STRINGIFY(x) _Py_XSTRINGIFY(x)
  484. #define Py_CHARMASK(c) cubyte((c) and &hff)
  485. '' TODO: #define Py_BUILD_ASSERT_EXPR(cond) (sizeof(char [1 - 2*!(cond)]) - 1)
  486. #define Py_ARRAY_LENGTH(array) ((sizeof(array) / sizeof((array)[0])) + Py_BUILD_ASSERT_EXPR(-(__builtin_types_compatible_p(typeof(array), typeof(@(array)[0])) = 0)))
  487. '' TODO: #define PyDoc_VAR(name) static char name[]
  488. #define PyDoc_STRVAR(name, str) scope : PyDoc_VAR(name) = PyDoc_STR(str) : end scope
  489. #define PyDoc_STR(str) str
  490. #define _Py_SIZE_ROUND_DOWN(n, a) (cuint(n) and (not cuint((a) - 1)))
  491. #define _Py_SIZE_ROUND_UP(n, a) ((cuint(n) + cuint((a) - 1)) and (not cuint((a) - 1)))
  492. #define _Py_ALIGN_DOWN(p, a) cptr(any ptr, cast(Py_uintptr_t, (p)) and (not cast(Py_uintptr_t, (a) - 1)))
  493. #define _Py_ALIGN_UP(p, a) cptr(any ptr, (cast(Py_uintptr_t, (p)) + cast(Py_uintptr_t, (a) - 1)) and (not cast(Py_uintptr_t, (a) - 1)))
  494. #define _Py_IS_ALIGNED(p, a) ((cast(Py_uintptr_t, (p)) and cast(Py_uintptr_t, (a) - 1)) = 0)
  495. '' TODO: #define Py_UNUSED(name) _unused_ ## name __attribute__((unused))
  496. #define Py_ATOMIC_H
  497. #define Py_PYMATH_H
  498. '' TODO: #define Py_MATH_PIl 3.1415926535897932384626433832795029L
  499. const Py_MATH_PI = 3.14159265358979323846
  500. '' TODO: #define Py_MATH_El 2.7182818284590452353602874713526625L
  501. const Py_MATH_E = 2.7182818284590452354
  502. #define Py_IS_NAN(X) isnan(X)
  503. #define Py_IS_INFINITY(X) isinf(X)
  504. #define Py_IS_FINITE(X) isfinite(X)
  505. #define Py_HUGE_VAL HUGE_VAL
  506. #define Py_NAN (Py_HUGE_VAL * 0.)
  507. #define Py_OVERFLOWED(X) (((X) <> 0.0) andalso (((errno = ERANGE) orelse ((X) = Py_HUGE_VAL)) orelse ((X) = (-Py_HUGE_VAL))))
  508. #define Py_PYMEM_H
  509.  
  510. declare function PyMem_Malloc(byval size as uinteger) as any ptr
  511. declare function PyMem_Calloc(byval nelem as uinteger, byval elsize as uinteger) as any ptr
  512. declare function PyMem_Realloc(byval ptr as any ptr, byval new_size as uinteger) as any ptr
  513. declare sub PyMem_Free(byval ptr as any ptr)
  514. #define PyMem_New(type, n) iif(cuint(n) > (PY_SSIZE_T_MAX / sizeof(type)), NULL, cptr(type ptr, PyMem_Malloc((n) * sizeof(type))))
  515. #define PyMem_Resize(p, type, n) scope : (p) = iif(cuint(n) > (PY_SSIZE_T_MAX / sizeof(type)), NULL, cptr(type ptr, PyMem_Realloc((p), (n) * sizeof(type)))) : end scope
  516. declare sub PyMem_Del alias "PyMem_Free"(byval ptr as any ptr)
  517.  
  518. #define Py_OBJECT_H
  519. #define _PyObject_HEAD_EXTRA
  520. #define _PyObject_EXTRA_INIT
  521.  
  522. '' TODO: #define PyObject_HEAD PyObject ob_base;
  523. '' TODO: #define PyObject_HEAD_INIT(type) { _PyObject_EXTRA_INIT 1, type },
  524. '' TODO: #define PyVarObject_HEAD_INIT(type, size) { PyObject_HEAD_INIT(type) size },
  525. '' TODO: #define PyObject_VAR_HEAD PyVarObject ob_base;
  526. const Py_INVALID_SIZE = cast(Py_ssize_t, -1)
  527.  
  528. type _object
  529.     ob_refcnt as Py_ssize_t
  530.     ob_type as PyObject ptr
  531. end type
  532.  
  533. type PyObject_ as _object
  534.  
  535. type PyVarObject
  536.     ob_base as PyObject
  537.     ob_size as Py_ssize_t
  538. end type
  539.  
  540. #define Py_REFCNT(ob) cptr(PyObject ptr, (ob))->ob_refcnt
  541. #define Py_TYPE(ob) cptr(PyObject ptr, (ob))->ob_type
  542. #define Py_SIZE(ob) cptr(PyVarObject ptr, (ob))->ob_size
  543.  
  544. type _Py_Identifier
  545.     next as _Py_Identifier ptr
  546.     string as const zstring ptr
  547.     object as PyObject ptr
  548. end type
  549.  
  550. #define _Py_static_string_init(value) (0, value, 0)
  551. '' TODO: #define _Py_static_string(varname, value) static _Py_Identifier varname = _Py_static_string_init(value)
  552. #define _Py_IDENTIFIER_(varname) _Py_static_string(PyId_##varname, #varname)
  553. type unaryfunc as function(byval as PyObject ptr) as PyObject ptr
  554. type binaryfunc as function(byval as PyObject ptr, byval as PyObject ptr) as PyObject ptr
  555. type ternaryfunc as function(byval as PyObject ptr, byval as PyObject ptr, byval as PyObject ptr) as PyObject ptr
  556. type inquiry as function(byval as PyObject ptr) as long
  557. type lenfunc as function(byval as PyObject ptr) as Py_ssize_t
  558. type ssizeargfunc as function(byval as PyObject ptr, byval as Py_ssize_t) as PyObject ptr
  559. type ssizessizeargfunc as function(byval as PyObject ptr, byval as Py_ssize_t, byval as Py_ssize_t) as PyObject ptr
  560. type ssizeobjargproc as function(byval as PyObject ptr, byval as Py_ssize_t, byval as PyObject ptr) as long
  561. type ssizessizeobjargproc as function(byval as PyObject ptr, byval as Py_ssize_t, byval as Py_ssize_t, byval as PyObject ptr) as long
  562. type objobjargproc as function(byval as PyObject ptr, byval as PyObject ptr, byval as PyObject ptr) as long
  563. type objobjproc as function(byval as PyObject ptr, byval as PyObject ptr) as long
  564. type visitproc as function(byval as PyObject ptr, byval as any ptr) as long
  565. type traverseproc as function(byval as PyObject ptr, byval as visitproc, byval as any ptr) as long
  566. type freefunc as sub(byval as any ptr)
  567. type destructor_ as sub(byval as PyObject ptr)
  568. type getattrfunc as function(byval as PyObject ptr, byval as zstring ptr) as PyObject ptr
  569. type getattrofunc as function(byval as PyObject ptr, byval as PyObject ptr) as PyObject ptr
  570. type setattrfunc as function(byval as PyObject ptr, byval as zstring ptr, byval as PyObject ptr) as long
  571. type setattrofunc as function(byval as PyObject ptr, byval as PyObject ptr, byval as PyObject ptr) as long
  572. type reprfunc as function(byval as PyObject ptr) as PyObject ptr
  573. type hashfunc as function(byval as PyObject ptr) as Py_hash_t
  574. type richcmpfunc as function(byval as PyObject ptr, byval as PyObject ptr, byval as long) as PyObject ptr
  575. type getiterfunc as function(byval as PyObject ptr) as PyObject ptr
  576. type iternextfunc as function(byval as PyObject ptr) as PyObject ptr
  577. type descrgetfunc as function(byval as PyObject ptr, byval as PyObject ptr, byval as PyObject ptr) as PyObject ptr
  578. type descrsetfunc as function(byval as PyObject ptr, byval as PyObject ptr, byval as PyObject ptr) as long
  579. type initproc as function(byval as PyObject ptr, byval as PyObject ptr, byval as PyObject ptr) as long
  580. type newfunc as function(byval as PyObject ptr, byval as PyObject ptr, byval as PyObject ptr) as PyObject ptr
  581. type allocfunc as function(byval as PyObject ptr, byval as Py_ssize_t) as PyObject ptr
  582. type PyTypeObject as PyObject
  583.  
  584. type PyType_Slot
  585.     slot as long
  586.     pfunc as any ptr
  587. end type
  588.  
  589. type PyType_Spec
  590.     name as const zstring ptr
  591.     basicsize as long
  592.     itemsize as long
  593.     flags as ulong
  594.     slots as PyType_Slot ptr
  595. end type
  596.  
  597. declare function PyType_FromSpec(byval as PyType_Spec ptr) as PyObject ptr
  598. declare function PyType_IsSubtype(byval as PyTypeObject ptr, byval as PyTypeObject ptr) as long
  599. #define PyObject_TypeCheck(ob, tp) ((Py_TYPE(ob) = (tp)) orelse PyType_IsSubtype(Py_TYPE(ob), (tp)))
  600. extern PyType_Type as PyTypeObject
  601. extern PyBaseObject_Type as PyTypeObject
  602. extern PySuper_Type as PyTypeObject
  603. declare function PyType_GetFlags(byval as PyTypeObject ptr) as culong
  604. #define PyType_Check(op) PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_TYPE_SUBCLASS)
  605. #define PyType_CheckExact(op) (Py_TYPE(op) = (@PyType_Type))
  606.  
  607. declare function PyType_Ready(byval as PyTypeObject ptr) as long
  608. declare function PyType_GenericAlloc(byval as PyTypeObject ptr, byval as Py_ssize_t) as PyObject ptr
  609. declare function PyType_GenericNew(byval as PyTypeObject ptr, byval as PyObject ptr, byval as PyObject ptr) as PyObject ptr
  610. declare function PyType_ClearCache() as ulong
  611. declare sub PyType_Modified(byval as PyTypeObject ptr)
  612. declare function PyObject_Repr(byval as PyObject ptr) as PyObject ptr
  613. declare function PyObject_Str(byval as PyObject ptr) as PyObject ptr
  614. declare function PyObject_ASCII(byval as PyObject ptr) as PyObject ptr
  615. declare function PyObject_Bytes(byval as PyObject ptr) as PyObject ptr
  616. declare function PyObject_RichCompare(byval as PyObject ptr, byval as PyObject ptr, byval as long) as PyObject ptr
  617. declare function PyObject_RichCompareBool(byval as PyObject ptr, byval as PyObject ptr, byval as long) as long
  618. declare function PyObject_GetAttrString(byval as PyObject ptr, byval as const zstring ptr) as PyObject ptr
  619. declare function PyObject_SetAttrString(byval as PyObject ptr, byval as const zstring ptr, byval as PyObject ptr) as long
  620. declare function PyObject_HasAttrString(byval as PyObject ptr, byval as const zstring ptr) as long
  621. declare function PyObject_GetAttr(byval as PyObject ptr, byval as PyObject ptr) as PyObject ptr
  622. declare function PyObject_SetAttr(byval as PyObject ptr, byval as PyObject ptr, byval as PyObject ptr) as long
  623. declare function PyObject_HasAttr(byval as PyObject ptr, byval as PyObject ptr) as long
  624. declare function _PyObject_IsAbstract(byval as PyObject ptr) as long
  625. declare function _PyObject_GetAttrId(byval as PyObject ptr, byval as _Py_Identifier ptr) as PyObject ptr
  626. declare function _PyObject_SetAttrId(byval as PyObject ptr, byval as _Py_Identifier ptr, byval as PyObject ptr) as long
  627. declare function _PyObject_HasAttrId(byval as PyObject ptr, byval as _Py_Identifier ptr) as long
  628. declare function PyObject_SelfIter(byval as PyObject ptr) as PyObject ptr
  629. declare function PyObject_GenericGetAttr(byval as PyObject ptr, byval as PyObject ptr) as PyObject ptr
  630. declare function PyObject_GenericSetAttr(byval as PyObject ptr, byval as PyObject ptr, byval as PyObject ptr) as long
  631. declare function PyObject_GenericSetDict(byval as PyObject ptr, byval as PyObject ptr, byval as any ptr) as long
  632. declare function PyObject_Hash(byval as PyObject ptr) as Py_hash_t
  633. declare function PyObject_HashNotImplemented(byval as PyObject ptr) as Py_hash_t
  634. declare function PyObject_IsTrue(byval as PyObject ptr) as long
  635. declare function PyObject_Not(byval as PyObject ptr) as long
  636. declare function PyCallable_Check(byval as PyObject ptr) as long
  637. declare sub PyObject_ClearWeakRefs(byval as PyObject ptr)
  638. declare function _PyObject_GenericGetAttrWithDict(byval as PyObject ptr, byval as PyObject ptr, byval as PyObject ptr) as PyObject ptr
  639. declare function _PyObject_GenericSetAttrWithDict(byval as PyObject ptr, byval as PyObject ptr, byval as PyObject ptr, byval as PyObject ptr) as long
  640. declare function PyObject_Dir(byval as PyObject ptr) as PyObject ptr
  641. declare function Py_ReprEnter(byval as PyObject ptr) as long
  642. declare sub Py_ReprLeave(byval as PyObject ptr)
  643.  
  644. const Py_PRINT_RAW = 1
  645. const Py_TPFLAGS_HEAPTYPE = cast(culong, 1) shl 9
  646. const Py_TPFLAGS_BASETYPE = cast(culong, 1) shl 10
  647. const Py_TPFLAGS_READY = cast(culong, 1) shl 12
  648. const Py_TPFLAGS_READYING = cast(culong, 1) shl 13
  649. const Py_TPFLAGS_HAVE_GC = cast(culong, 1) shl 14
  650. const Py_TPFLAGS_HAVE_STACKLESS_EXTENSION = 0
  651. const Py_TPFLAGS_HAVE_VERSION_TAG = cast(culong, 1) shl 18
  652. const Py_TPFLAGS_VALID_VERSION_TAG = cast(culong, 1) shl 19
  653. const Py_TPFLAGS_IS_ABSTRACT = cast(culong, 1) shl 20
  654. const Py_TPFLAGS_LONG_SUBCLASS = cast(culong, 1) shl 24
  655. const Py_TPFLAGS_LIST_SUBCLASS = cast(culong, 1) shl 25
  656. const Py_TPFLAGS_TUPLE_SUBCLASS = cast(culong, 1) shl 26
  657. const Py_TPFLAGS_BYTES_SUBCLASS = cast(culong, 1) shl 27
  658. const Py_TPFLAGS_UNICODE_SUBCLASS = cast(culong, 1) shl 28
  659. const Py_TPFLAGS_DICT_SUBCLASS = cast(culong, 1) shl 29
  660. const Py_TPFLAGS_BASE_EXC_SUBCLASS = cast(culong, 1) shl 30
  661. const Py_TPFLAGS_TYPE_SUBCLASS = cast(culong, 1) shl 31
  662. const Py_TPFLAGS_DEFAULT = (Py_TPFLAGS_HAVE_STACKLESS_EXTENSION or Py_TPFLAGS_HAVE_VERSION_TAG) or 0
  663. const Py_TPFLAGS_HAVE_FINALIZE = cast(culong, 1) shl 0
  664. #define PyType_HasFeature(t, f) ((PyType_GetFlags(t) and (f)) <> 0)
  665. #define PyType_FastSubclass(t, f) PyType_HasFeature(t, f)
  666. #define _Py_INC_REFTOTAL
  667. #define _Py_DEC_REFTOTAL
  668. #define _Py_REF_DEBUG_COMMA
  669. '' TODO: #define _Py_CHECK_REFCNT(OP) ;
  670. #define _PY_DEBUG_PRINT_TOTAL_REFS()
  671. #define _Py_INC_TPALLOCS(OP)
  672. #define _Py_INC_TPFREES(OP)
  673. #define _Py_DEC_TPFREES(OP)
  674. #define _Py_COUNT_ALLOCS_COMMA
  675. '' TODO: #define _Py_NewReference(op) ( _Py_INC_TPALLOCS(op) _Py_COUNT_ALLOCS_COMMA _Py_INC_REFTOTAL _Py_REF_DEBUG_COMMA Py_REFCNT(op) = 1)
  676. #define _Py_ForgetReference(op) _Py_INC_TPFREES(op)
  677. declare sub _Py_Dealloc(byval as PyObject ptr)
  678. '' TODO: #define Py_INCREF(op) ( _Py_INC_REFTOTAL _Py_REF_DEBUG_COMMA ((PyObject *)(op))->ob_refcnt++)
  679. #macro Py_CLEAR(op)
  680.     scope
  681.         dim _py_tmp as PyObject ptr = cptr(PyObject ptr, (op))
  682.         if _py_tmp <> NULL then
  683.             (op) = NULL
  684.             Py_DECREF(_py_tmp)
  685.         end if
  686.     end scope
  687. #endmacro
  688. #macro Py_XINCREF(op)
  689.     scope
  690.         dim _py_xincref_tmp as PyObject ptr = cptr(PyObject ptr, (op))
  691.         if _py_xincref_tmp <> NULL then
  692.             Py_INCREF(_py_xincref_tmp)
  693.         end if
  694.     end scope
  695. #endmacro
  696. #macro Py_XDECREF(op)
  697.     scope
  698.         dim _py_xdecref_tmp as PyObject ptr = cptr(PyObject ptr, (op))
  699.         if _py_xdecref_tmp <> NULL then
  700.             Py_DECREF(_py_xdecref_tmp)
  701.         end if
  702.     end scope
  703. #endmacro
  704. declare sub Py_IncRef(byval as PyObject ptr)
  705. declare sub Py_DecRef(byval as PyObject ptr)
  706.  
  707. extern _PyNone_Type as PyTypeObject
  708. extern _PyNotImplemented_Type as PyTypeObject
  709. extern _Py_NoneStruct as PyObject
  710. #define Py_None (@_Py_NoneStruct)
  711. '' TODO: #define Py_RETURN_NONE return Py_INCREF(Py_None), Py_None
  712. extern _Py_NotImplementedStruct as PyObject
  713. #define Py_NotImplemented (@_Py_NotImplementedStruct)
  714. '' TODO: #define Py_RETURN_NOTIMPLEMENTED return Py_INCREF(Py_NotImplemented), Py_NotImplemented
  715.  
  716. const Py_LT = 0
  717. const Py_LE = 1
  718. const Py_EQ = 2
  719. const Py_NE = 3
  720. const Py_GT = 4
  721. const Py_GE = 5
  722. extern _Py_SwappedOp(0 to 1 - 1) as long
  723. declare sub _PyTrash_deposit_object(byval as PyObject ptr)
  724. declare sub _PyTrash_destroy_chain()
  725. extern _PyTrash_delete_nesting as long
  726. extern _PyTrash_delete_later as PyObject ptr
  727. declare sub _PyTrash_thread_deposit_object(byval as PyObject ptr)
  728. declare sub _PyTrash_thread_destroy_chain()
  729. const PyTrash_UNWIND_LEVEL = 50
  730. '' TODO: #define Py_TRASHCAN_SAFE_BEGIN(op) do { PyThreadState *_tstate = PyThreadState_GET(); if (_tstate->trash_delete_nesting < PyTrash_UNWIND_LEVEL) { ++_tstate->trash_delete_nesting;
  731. '' TODO: #define Py_TRASHCAN_SAFE_END(op) --_tstate->trash_delete_nesting; if (_tstate->trash_delete_later && _tstate->trash_delete_nesting <= 0) _PyTrash_thread_destroy_chain(); } else _PyTrash_thread_deposit_object((PyObject*)op); } while (0);
  732. #define Py_OBJIMPL_H
  733.  
  734. declare function PyObject_Malloc(byval size as uinteger) as any ptr
  735. declare function PyObject_Calloc(byval nelem as uinteger, byval elsize as uinteger) as any ptr
  736. declare function PyObject_Realloc(byval ptr as any ptr, byval new_size as uinteger) as any ptr
  737. declare sub PyObject_Free(byval ptr as any ptr)
  738. declare function _Py_GetAllocatedBlocks() as Py_ssize_t
  739. declare sub PyObject_Del alias "PyObject_Free"(byval ptr as any ptr)
  740. declare function PyObject_Init(byval as PyObject ptr, byval as PyTypeObject ptr) as PyObject ptr
  741. declare function PyObject_InitVar(byval as PyVarObject ptr, byval as PyTypeObject ptr, byval as Py_ssize_t) as PyVarObject ptr
  742. declare function _PyObject_New(byval as PyTypeObject ptr) as PyObject ptr
  743. declare function _PyObject_NewVar(byval as PyTypeObject ptr, byval as Py_ssize_t) as PyVarObject ptr
  744.  
  745. #define PyObject_New(type, typeobj) cptr(type ptr, _PyObject_New(typeobj))
  746. #define PyObject_NewVar(type, typeobj, n) cptr(type ptr, _PyObject_NewVar((typeobj), (n)))
  747. #macro PyObject_INIT_VAR(op, typeobj, size)
  748.     scope
  749.         Py_SIZE(op) = (size)
  750.         PyObject_INIT((op), (typeobj))
  751.     end scope
  752. #endmacro
  753. #define _PyObject_SIZE(typeobj) (typeobj)->tp_basicsize
  754. #define _PyObject_VAR_SIZE(typeobj, nitems) _Py_SIZE_ROUND_UP((typeobj)->tp_basicsize + ((nitems) * (typeobj)->tp_itemsize), SIZEOF_VOID_P)
  755. #define PyObject_NEW_VAR(type, typeobj, n) cptr(type ptr, PyObject_InitVar(cptr(PyVarObject ptr, PyObject_MALLOC(_PyObject_VAR_SIZE((typeobj), (n)))), (typeobj), (n)))
  756. declare function PyGC_Collect() as Py_ssize_t
  757. #define PyType_IS_GC(t) PyType_HasFeature((t), Py_TPFLAGS_HAVE_GC)
  758. #define PyObject_IS_GC(o) (PyType_IS_GC(Py_TYPE(o)) andalso ((Py_TYPE(o)->tp_is_gc = NULL) orelse Py_TYPE(o)->tp_is_gc(o)))
  759. declare function _PyObject_GC_Resize(byval as PyVarObject ptr, byval as Py_ssize_t) as PyVarObject ptr
  760. #define PyObject_GC_Resize(type, op, n) cptr(type ptr, _PyObject_GC_Resize(cptr(PyVarObject ptr, (op)), (n)))
  761.  
  762. declare function _PyObject_GC_Malloc(byval size as uinteger) as PyObject ptr
  763. declare function _PyObject_GC_Calloc(byval size as uinteger) as PyObject ptr
  764. declare function _PyObject_GC_New(byval as PyTypeObject ptr) as PyObject ptr
  765. declare function _PyObject_GC_NewVar(byval as PyTypeObject ptr, byval as Py_ssize_t) as PyVarObject ptr
  766. declare sub PyObject_GC_Track(byval as any ptr)
  767. declare sub PyObject_GC_UnTrack(byval as any ptr)
  768. declare sub PyObject_GC_Del(byval as any ptr)
  769.  
  770. #define PyObject_GC_New(type, typeobj) cptr(type ptr, _PyObject_GC_New(typeobj))
  771. #define PyObject_GC_NewVar(type, typeobj, n) cptr(type ptr, _PyObject_GC_NewVar((typeobj), (n)))
  772. #macro Py_VISIT(op)
  773.     if op then
  774.         dim vret as long = visit(cptr(PyObject ptr, (op)), arg)
  775.         if vret then
  776.             return vret
  777.         end if
  778.     end if
  779. #endmacro
  780. #define PyType_SUPPORTS_WEAKREFS(t) ((t)->tp_weaklistoffset > 0)
  781. #define PyObject_GET_WEAKREFS_LISTPTR(o) cptr(PyObject ptr ptr, cptr(zstring ptr, (o)) + Py_TYPE(o)->tp_weaklistoffset)
  782. #undef Py_bf_getbuffer
  783. #undef Py_bf_releasebuffer
  784. const Py_mp_ass_subscript = 3
  785. const Py_mp_length = 4
  786. const Py_mp_subscript = 5
  787. const Py_nb_absolute = 6
  788. const Py_nb_add = 7
  789. const Py_nb_and = 8
  790. const Py_nb_bool = 9
  791. const Py_nb_divmod = 10
  792. const Py_nb_float = 11
  793. const Py_nb_floor_divide = 12
  794. const Py_nb_index = 13
  795. const Py_nb_inplace_add = 14
  796. const Py_nb_inplace_and = 15
  797. const Py_nb_inplace_floor_divide = 16
  798. const Py_nb_inplace_lshift = 17
  799. const Py_nb_inplace_multiply = 18
  800. const Py_nb_inplace_or = 19
  801. const Py_nb_inplace_power = 20
  802. const Py_nb_inplace_remainder = 21
  803. const Py_nb_inplace_rshift = 22
  804. const Py_nb_inplace_subtract = 23
  805. const Py_nb_inplace_true_divide = 24
  806. const Py_nb_inplace_xor = 25
  807. const Py_nb_int = 26
  808. const Py_nb_invert = 27
  809. const Py_nb_lshift = 28
  810. const Py_nb_multiply = 29
  811. const Py_nb_negative = 30
  812. const Py_nb_or = 31
  813. const Py_nb_positive = 32
  814. const Py_nb_power = 33
  815. const Py_nb_remainder = 34
  816. const Py_nb_rshift = 35
  817. const Py_nb_subtract = 36
  818. const Py_nb_true_divide = 37
  819. const Py_nb_xor = 38
  820. const Py_sq_ass_item = 39
  821. const Py_sq_concat = 40
  822. const Py_sq_contains = 41
  823. const Py_sq_inplace_concat = 42
  824. const Py_sq_inplace_repeat = 43
  825. const Py_sq_item = 44
  826. const Py_sq_length = 45
  827. const Py_sq_repeat = 46
  828. const Py_tp_alloc = 47
  829. const Py_tp_base = 48
  830. const Py_tp_bases = 49
  831. const Py_tp_call = 50
  832. const Py_tp_clear = 51
  833. const Py_tp_dealloc = 52
  834. const Py_tp_del = 53
  835. const Py_tp_descr_get = 54
  836. const Py_tp_descr_set = 55
  837. const Py_tp_doc = 56
  838. const Py_tp_getattr = 57
  839. const Py_tp_getattro = 58
  840. const Py_tp_hash = 59
  841. const Py_tp_init = 60
  842. const Py_tp_is_gc = 61
  843. const Py_tp_iter = 62
  844. const Py_tp_iternext = 63
  845. const Py_tp_methods = 64
  846. const Py_tp_new = 65
  847. const Py_tp_repr = 66
  848. const Py_tp_richcompare = 67
  849. const Py_tp_setattr = 68
  850. const Py_tp_setattro = 69
  851. const Py_tp_str = 70
  852. const Py_tp_traverse = 71
  853. const Py_tp_members = 72
  854. const Py_tp_getset = 73
  855. const Py_tp_free = 74
  856. const Py_nb_matrix_multiply = 75
  857. const Py_nb_inplace_matrix_multiply = 76
  858. const Py_am_await = 77
  859. const Py_am_aiter = 78
  860. const Py_am_anext = 79
  861. #define Py_HASH_H
  862. const _PyHASH_MULTIPLIER = cast(culong, 1000003)
  863. const _PyHASH_BITS = 61
  864. const _PyHASH_MODULUS = (cuint(1) shl _PyHASH_BITS) - 1
  865. const _PyHASH_INF = 314159
  866. const _PyHASH_NAN = 0
  867. const _PyHASH_IMAG = _PyHASH_MULTIPLIER
  868. const Py_HASH_CUTOFF = 0
  869. const Py_HASH_EXTERNAL = 0
  870. const Py_HASH_SIPHASH24 = 1
  871. const Py_HASH_FNV = 2
  872. const Py_HASH_ALGORITHM = Py_HASH_SIPHASH24
  873. #define Py_BYTEARRAYOBJECT_H
  874. extern PyByteArray_Type as PyTypeObject
  875. extern PyByteArrayIter_Type as PyTypeObject
  876. #define PyByteArray_Check(self) PyObject_TypeCheck(self, @PyByteArray_Type)
  877. #define PyByteArray_CheckExact(self) (Py_TYPE(self) = (@PyByteArray_Type))
  878.  
  879. declare function PyByteArray_FromObject(byval as PyObject ptr) as PyObject ptr
  880. declare function PyByteArray_Concat(byval as PyObject ptr, byval as PyObject ptr) as PyObject ptr
  881. declare function PyByteArray_FromStringAndSize(byval as const zstring ptr, byval as Py_ssize_t) as PyObject ptr
  882. declare function PyByteArray_Size(byval as PyObject ptr) as Py_ssize_t
  883. declare function PyByteArray_AsString(byval as PyObject ptr) as zstring ptr
  884. declare function PyByteArray_Resize(byval as PyObject ptr, byval as Py_ssize_t) as long
  885. #define Py_BYTESOBJECT_H
  886. extern PyBytes_Type as PyTypeObject
  887. extern PyBytesIter_Type as PyTypeObject
  888. #define PyBytes_Check(op) PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_BYTES_SUBCLASS)
  889. #define PyBytes_CheckExact(op) (Py_TYPE(op) = (@PyBytes_Type))
  890. declare function PyBytes_FromStringAndSize(byval as const zstring ptr, byval as Py_ssize_t) as PyObject ptr
  891. declare function PyBytes_FromString(byval as const zstring ptr) as PyObject ptr
  892. declare function PyBytes_FromObject(byval as PyObject ptr) as PyObject ptr
  893. declare function PyBytes_FromFormatV(byval as const zstring ptr, byval as va_list) as PyObject ptr
  894. declare function PyBytes_FromFormat(byval as const zstring ptr, ...) as PyObject ptr
  895. declare function PyBytes_Size(byval as PyObject ptr) as Py_ssize_t
  896. declare function PyBytes_AsString(byval as PyObject ptr) as zstring ptr
  897. declare function PyBytes_Repr(byval as PyObject ptr, byval as long) as PyObject ptr
  898. declare sub PyBytes_Concat(byval as PyObject ptr ptr, byval as PyObject ptr)
  899. declare sub PyBytes_ConcatAndDel(byval as PyObject ptr ptr, byval as PyObject ptr)
  900. declare function PyBytes_DecodeEscape(byval as const zstring ptr, byval as Py_ssize_t, byval as const zstring ptr, byval as Py_ssize_t, byval as const zstring ptr) as PyObject ptr
  901. declare function PyBytes_AsStringAndSize(byval obj as PyObject ptr, byval s as zstring ptr ptr, byval len as Py_ssize_t ptr) as long
  902.  
  903. const F_LJUST = 1 shl 0
  904. const F_SIGN = 1 shl 1
  905. const F_BLANK = 1 shl 2
  906. const F_ALT = 1 shl 3
  907. const F_ZERO = 1 shl 4
  908. #define Py_UNICODEOBJECT_H
  909. #define Py_USING_UNICODE
  910. const Py_UNICODE_SIZE = SIZEOF_WCHAR_T
  911. #define Py_UNICODE_WIDE
  912.  
  913. type Py_UCS4 as ulong
  914. type Py_UCS2 as ushort
  915. type Py_UCS1 as ubyte
  916. extern PyUnicode_Type as PyTypeObject
  917. extern PyUnicodeIter_Type as PyTypeObject
  918.  
  919. #define PyUnicode_Check(op) PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_UNICODE_SUBCLASS)
  920. #define PyUnicode_CheckExact(op) (Py_TYPE(op) = (@PyUnicode_Type))
  921. const Py_UNICODE_REPLACEMENT_CHARACTER = cast(Py_UCS4, &hFFFD)
  922.  
  923. declare function PyUnicode_FromStringAndSize(byval u as const zstring ptr, byval size as Py_ssize_t) as PyObject ptr
  924. declare function PyUnicode_FromString(byval u as const zstring ptr) as PyObject ptr
  925. declare function PyUnicode_Substring(byval str as PyObject ptr, byval start as Py_ssize_t, byval end as Py_ssize_t) as PyObject ptr
  926. declare function PyUnicode_AsUCS4(byval unicode as PyObject ptr, byval buffer as Py_UCS4 ptr, byval buflen as Py_ssize_t, byval copy_null as long) as Py_UCS4 ptr
  927. declare function PyUnicode_AsUCS4Copy(byval unicode as PyObject ptr) as Py_UCS4 ptr
  928. declare function PyUnicode_GetLength(byval unicode as PyObject ptr) as Py_ssize_t
  929. declare function PyUnicode_GetSize(byval unicode as PyObject ptr) as Py_ssize_t
  930. declare function PyUnicode_ReadChar(byval unicode as PyObject ptr, byval index as Py_ssize_t) as Py_UCS4
  931. declare function PyUnicode_WriteChar(byval unicode as PyObject ptr, byval index as Py_ssize_t, byval character as Py_UCS4) as long
  932. declare function PyUnicode_Resize(byval unicode as PyObject ptr ptr, byval length as Py_ssize_t) as long
  933. declare function PyUnicode_FromEncodedObject(byval obj as PyObject ptr, byval encoding as const zstring ptr, byval errors as const zstring ptr) as PyObject ptr
  934. declare function PyUnicode_FromObject(byval obj as PyObject ptr) as PyObject ptr
  935. declare function PyUnicode_FromFormatV(byval format as const zstring ptr, byval vargs as va_list) as PyObject ptr
  936. declare function PyUnicode_FromFormat(byval format as const zstring ptr, ...) as PyObject ptr
  937. declare sub PyUnicode_InternInPlace(byval as PyObject ptr ptr)
  938. declare sub PyUnicode_InternImmortal(byval as PyObject ptr ptr)
  939. declare function PyUnicode_InternFromString(byval u as const zstring ptr) as PyObject ptr
  940. #define PyUnicode_CHECK_INTERNED(op) cptr(PyASCIIObject ptr, (op))->state.interned
  941. declare function PyUnicode_FromWideChar(byval w as const wstring ptr, byval size as Py_ssize_t) as PyObject ptr
  942. declare function PyUnicode_AsWideChar(byval unicode as PyObject ptr, byval w as wstring ptr, byval size as Py_ssize_t) as Py_ssize_t
  943. declare function PyUnicode_AsWideCharString(byval unicode as PyObject ptr, byval size as Py_ssize_t ptr) as wstring ptr
  944. declare function PyUnicode_FromOrdinal(byval ordinal as long) as PyObject ptr
  945. declare function PyUnicode_ClearFreeList() as long
  946. declare function PyUnicode_GetDefaultEncoding() as const zstring ptr
  947. declare function PyUnicode_Decode(byval s as const zstring ptr, byval size as Py_ssize_t, byval encoding as const zstring ptr, byval errors as const zstring ptr) as PyObject ptr
  948. declare function PyUnicode_AsDecodedObject(byval unicode as PyObject ptr, byval encoding as const zstring ptr, byval errors as const zstring ptr) as PyObject ptr
  949. declare function PyUnicode_AsDecodedUnicode(byval unicode as PyObject ptr, byval encoding as const zstring ptr, byval errors as const zstring ptr) as PyObject ptr
  950. declare function PyUnicode_AsEncodedObject(byval unicode as PyObject ptr, byval encoding as const zstring ptr, byval errors as const zstring ptr) as PyObject ptr
  951. declare function PyUnicode_AsEncodedString(byval unicode as PyObject ptr, byval encoding as const zstring ptr, byval errors as const zstring ptr) as PyObject ptr
  952. declare function PyUnicode_AsEncodedUnicode(byval unicode as PyObject ptr, byval encoding as const zstring ptr, byval errors as const zstring ptr) as PyObject ptr
  953. declare function PyUnicode_BuildEncodingMap(byval string as PyObject ptr) as PyObject ptr
  954. declare function PyUnicode_DecodeUTF7(byval string as const zstring ptr, byval length as Py_ssize_t, byval errors as const zstring ptr) as PyObject ptr
  955. declare function PyUnicode_DecodeUTF7Stateful(byval string as const zstring ptr, byval length as Py_ssize_t, byval errors as const zstring ptr, byval consumed as Py_ssize_t ptr) as PyObject ptr
  956. declare function PyUnicode_DecodeUTF8(byval string as const zstring ptr, byval length as Py_ssize_t, byval errors as const zstring ptr) as PyObject ptr
  957. declare function PyUnicode_DecodeUTF8Stateful(byval string as const zstring ptr, byval length as Py_ssize_t, byval errors as const zstring ptr, byval consumed as Py_ssize_t ptr) as PyObject ptr
  958. declare function PyUnicode_AsUTF8String(byval unicode as PyObject ptr) as PyObject ptr
  959. declare function PyUnicode_DecodeUTF32(byval string as const zstring ptr, byval length as Py_ssize_t, byval errors as const zstring ptr, byval byteorder as long ptr) as PyObject ptr
  960. declare function PyUnicode_DecodeUTF32Stateful(byval string as const zstring ptr, byval length as Py_ssize_t, byval errors as const zstring ptr, byval byteorder as long ptr, byval consumed as Py_ssize_t ptr) as PyObject ptr
  961. declare function PyUnicode_AsUTF32String(byval unicode as PyObject ptr) as PyObject ptr
  962. declare function PyUnicode_DecodeUTF16(byval string as const zstring ptr, byval length as Py_ssize_t, byval errors as const zstring ptr, byval byteorder as long ptr) as PyObject ptr
  963. declare function PyUnicode_DecodeUTF16Stateful(byval string as const zstring ptr, byval length as Py_ssize_t, byval errors as const zstring ptr, byval byteorder as long ptr, byval consumed as Py_ssize_t ptr) as PyObject ptr
  964. declare function PyUnicode_AsUTF16String(byval unicode as PyObject ptr) as PyObject ptr
  965. declare function PyUnicode_DecodeUnicodeEscape(byval string as const zstring ptr, byval length as Py_ssize_t, byval errors as const zstring ptr) as PyObject ptr
  966. declare function PyUnicode_AsUnicodeEscapeString(byval unicode as PyObject ptr) as PyObject ptr
  967. declare function PyUnicode_DecodeRawUnicodeEscape(byval string as const zstring ptr, byval length as Py_ssize_t, byval errors as const zstring ptr) as PyObject ptr
  968. declare function PyUnicode_AsRawUnicodeEscapeString(byval unicode as PyObject ptr) as PyObject ptr
  969. declare function PyUnicode_DecodeLatin1(byval string as const zstring ptr, byval length as Py_ssize_t, byval errors as const zstring ptr) as PyObject ptr
  970. declare function PyUnicode_AsLatin1String(byval unicode as PyObject ptr) as PyObject ptr
  971. declare function PyUnicode_DecodeASCII(byval string as const zstring ptr, byval length as Py_ssize_t, byval errors as const zstring ptr) as PyObject ptr
  972. declare function PyUnicode_AsASCIIString(byval unicode as PyObject ptr) as PyObject ptr
  973. declare function PyUnicode_DecodeCharmap(byval string as const zstring ptr, byval length as Py_ssize_t, byval mapping as PyObject ptr, byval errors as const zstring ptr) as PyObject ptr
  974. declare function PyUnicode_AsCharmapString(byval unicode as PyObject ptr, byval mapping as PyObject ptr) as PyObject ptr
  975. declare function PyUnicode_DecodeLocaleAndSize(byval str as const zstring ptr, byval len as Py_ssize_t, byval errors as const zstring ptr) as PyObject ptr
  976. declare function PyUnicode_DecodeLocale(byval str as const zstring ptr, byval errors as const zstring ptr) as PyObject ptr
  977. declare function PyUnicode_EncodeLocale(byval unicode as PyObject ptr, byval errors as const zstring ptr) as PyObject ptr
  978. declare function PyUnicode_FSConverter(byval as PyObject ptr, byval as any ptr) as long
  979. declare function PyUnicode_FSDecoder(byval as PyObject ptr, byval as any ptr) as long
  980. declare function PyUnicode_DecodeFSDefault(byval s as const zstring ptr) as PyObject ptr
  981. declare function PyUnicode_DecodeFSDefaultAndSize(byval s as const zstring ptr, byval size as Py_ssize_t) as PyObject ptr
  982. declare function PyUnicode_EncodeFSDefault(byval unicode as PyObject ptr) as PyObject ptr
  983. declare function PyUnicode_Concat(byval left as PyObject ptr, byval right as PyObject ptr) as PyObject ptr
  984. declare sub PyUnicode_Append(byval pleft as PyObject ptr ptr, byval right as PyObject ptr)
  985. declare sub PyUnicode_AppendAndDel(byval pleft as PyObject ptr ptr, byval right as PyObject ptr)
  986. declare function PyUnicode_Split(byval s as PyObject ptr, byval sep as PyObject ptr, byval maxsplit as Py_ssize_t) as PyObject ptr
  987. declare function PyUnicode_Splitlines(byval s as PyObject ptr, byval keepends as long) as PyObject ptr
  988. declare function PyUnicode_Partition(byval s as PyObject ptr, byval sep as PyObject ptr) as PyObject ptr
  989. declare function PyUnicode_RPartition(byval s as PyObject ptr, byval sep as PyObject ptr) as PyObject ptr
  990. declare function PyUnicode_RSplit(byval s as PyObject ptr, byval sep as PyObject ptr, byval maxsplit as Py_ssize_t) as PyObject ptr
  991. declare function PyUnicode_Translate(byval str as PyObject ptr, byval table as PyObject ptr, byval errors as const zstring ptr) as PyObject ptr
  992. declare function PyUnicode_Join(byval separator as PyObject ptr, byval seq as PyObject ptr) as PyObject ptr
  993. declare function PyUnicode_Tailmatch(byval str as PyObject ptr, byval substr as PyObject ptr, byval start as Py_ssize_t, byval end as Py_ssize_t, byval direction as long) as Py_ssize_t
  994. declare function PyUnicode_Find(byval str as PyObject ptr, byval substr as PyObject ptr, byval start as Py_ssize_t, byval end as Py_ssize_t, byval direction as long) as Py_ssize_t
  995. declare function PyUnicode_FindChar(byval str as PyObject ptr, byval ch as Py_UCS4, byval start as Py_ssize_t, byval end as Py_ssize_t, byval direction as long) as Py_ssize_t
  996. declare function PyUnicode_Count(byval str as PyObject ptr, byval substr as PyObject ptr, byval start as Py_ssize_t, byval end as Py_ssize_t) as Py_ssize_t
  997. declare function PyUnicode_Replace(byval str as PyObject ptr, byval substr as PyObject ptr, byval replstr as PyObject ptr, byval maxcount as Py_ssize_t) as PyObject ptr
  998. declare function PyUnicode_Compare(byval left as PyObject ptr, byval right as PyObject ptr) as long
  999. declare function PyUnicode_CompareWithASCIIString(byval left as PyObject ptr, byval right as const zstring ptr) as long
  1000. declare function PyUnicode_RichCompare(byval left as PyObject ptr, byval right as PyObject ptr, byval op as long) as PyObject ptr
  1001. declare function PyUnicode_Format(byval format as PyObject ptr, byval args as PyObject ptr) as PyObject ptr
  1002. declare function PyUnicode_Contains(byval container as PyObject ptr, byval element as PyObject ptr) as long
  1003. declare function PyUnicode_IsIdentifier(byval s as PyObject ptr) as long
  1004. declare function _PyUnicode_FromId(byval as _Py_Identifier ptr) as PyObject ptr
  1005. declare sub _PyUnicode_ClearStaticStrings()
  1006. #define Py_LONGOBJECT_H
  1007. type PyLongObject as PyObject
  1008. extern PyLong_Type as PyTypeObject
  1009. #define PyLong_Check(op) PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_LONG_SUBCLASS)
  1010. #define PyLong_CheckExact(op) (Py_TYPE(op) = (@PyLong_Type))
  1011. declare function PyLong_FromLong(byval as clong) as PyObject ptr
  1012. declare function PyLong_FromUnsignedLong(byval as culong) as PyObject ptr
  1013. declare function PyLong_FromSize_t(byval as uinteger) as PyObject ptr
  1014. declare function PyLong_FromSsize_t(byval as Py_ssize_t) as PyObject ptr
  1015. declare function PyLong_FromDouble(byval as double) as PyObject ptr
  1016. declare function PyLong_AsLong(byval as PyObject ptr) as clong
  1017. declare function PyLong_AsLongAndOverflow(byval as PyObject ptr, byval as long ptr) as clong
  1018. declare function PyLong_AsSsize_t(byval as PyObject ptr) as Py_ssize_t
  1019. declare function PyLong_AsSize_t(byval as PyObject ptr) as uinteger
  1020. declare function PyLong_AsUnsignedLong(byval as PyObject ptr) as culong
  1021. declare function PyLong_AsUnsignedLongMask(byval as PyObject ptr) as culong
  1022. declare function PyLong_GetInfo() as PyObject ptr
  1023. #define PyLong_AS_LONG(op) PyLong_AsLong(op)
  1024. #define _Py_PARSE_PID "i"
  1025. declare function PyLong_FromPid alias "PyLong_FromLong"(byval as clong) as PyObject ptr
  1026. declare function PyLong_AsPid alias "PyLong_AsLong"(byval as PyObject ptr) as clong
  1027. #define _Py_PARSE_INTPTR "l"
  1028. #define _Py_PARSE_UINTPTR "k"
  1029. declare function PyLong_AsDouble(byval as PyObject ptr) as double
  1030. declare function PyLong_FromVoidPtr(byval as any ptr) as PyObject ptr
  1031. declare function PyLong_AsVoidPtr(byval as PyObject ptr) as any ptr
  1032. declare function PyLong_FromLongLong(byval as longint) as PyObject ptr
  1033. declare function PyLong_FromUnsignedLongLong(byval as ulongint) as PyObject ptr
  1034. declare function PyLong_AsLongLong(byval as PyObject ptr) as longint
  1035. declare function PyLong_AsUnsignedLongLong(byval as PyObject ptr) as ulongint
  1036. declare function PyLong_AsUnsignedLongLongMask(byval as PyObject ptr) as ulongint
  1037. declare function PyLong_AsLongLongAndOverflow(byval as PyObject ptr, byval as long ptr) as longint
  1038. declare function PyLong_FromString(byval as const zstring ptr, byval as zstring ptr ptr, byval as long) as PyObject ptr
  1039. declare function PyOS_strtoul(byval as const zstring ptr, byval as zstring ptr ptr, byval as long) as culong
  1040. declare function PyOS_strtol(byval as const zstring ptr, byval as zstring ptr ptr, byval as long) as clong
  1041. declare function _PyLong_GCD(byval as PyObject ptr, byval as PyObject ptr) as PyObject ptr
  1042. #define Py_BOOLOBJECT_H
  1043. extern PyBool_Type as PyTypeObject
  1044. #define PyBool_Check(x) (Py_TYPE(x) = (@PyBool_Type))
  1045. extern _Py_FalseStruct as PyObject
  1046. extern _Py_TrueStruct as PyObject
  1047. #define Py_False cptr(PyObject ptr, @_Py_FalseStruct)
  1048. #define Py_True cptr(PyObject ptr, @_Py_TrueStruct)
  1049. '' TODO: #define Py_RETURN_TRUE return Py_INCREF(Py_True), Py_True
  1050. '' TODO: #define Py_RETURN_FALSE return Py_INCREF(Py_False), Py_False
  1051. declare function PyBool_FromLong(byval as clong) as PyObject ptr
  1052. #define Py_FLOATOBJECT_H
  1053. extern PyFloat_Type as PyTypeObject
  1054. #define PyFloat_Check(op) PyObject_TypeCheck(op, @PyFloat_Type)
  1055. #define PyFloat_CheckExact(op) (Py_TYPE(op) = (@PyFloat_Type))
  1056. '' TODO: #define Py_RETURN_NAN return PyFloat_FromDouble(Py_NAN)
  1057. #macro Py_RETURN_INF(sign)
  1058.     if copysign(1., sign) = 1. then
  1059.         return PyFloat_FromDouble(Py_HUGE_VAL)
  1060.     else
  1061.         return PyFloat_FromDouble(-Py_HUGE_VAL)
  1062.     end if
  1063. #endmacro
  1064. declare function PyFloat_GetMax() as double
  1065. declare function PyFloat_GetMin() as double
  1066. declare function PyFloat_GetInfo() as PyObject ptr
  1067. declare function PyFloat_FromString(byval as PyObject ptr) as PyObject ptr
  1068. declare function PyFloat_FromDouble(byval as double) as PyObject ptr
  1069. declare function PyFloat_AsDouble(byval as PyObject ptr) as double
  1070. #define Py_COMPLEXOBJECT_H
  1071. extern PyComplex_Type as PyTypeObject
  1072. #define PyComplex_Check(op) PyObject_TypeCheck(op, @PyComplex_Type)
  1073. #define PyComplex_CheckExact(op) (Py_TYPE(op) = (@PyComplex_Type))
  1074. declare function PyComplex_FromDoubles(byval real as double, byval imag as double) as PyObject ptr
  1075. declare function PyComplex_RealAsDouble(byval op as PyObject ptr) as double
  1076. declare function PyComplex_ImagAsDouble(byval op as PyObject ptr) as double
  1077. #define Py_RANGEOBJECT_H
  1078.  
  1079. extern PyRange_Type as PyTypeObject
  1080. extern PyRangeIter_Type as PyTypeObject
  1081. extern PyLongRangeIter_Type as PyTypeObject
  1082. #define PyRange_Check(op) (Py_TYPE(op) = (@PyRange_Type))
  1083. #define Py_MEMORYOBJECT_H
  1084. extern PyMemoryView_Type as PyTypeObject
  1085. #define PyMemoryView_Check(op) (Py_TYPE(op) = (@PyMemoryView_Type))
  1086.  
  1087. declare function PyMemoryView_FromObject(byval base as PyObject ptr) as PyObject ptr
  1088. declare function PyMemoryView_FromMemory(byval mem as zstring ptr, byval size as Py_ssize_t, byval flags as long) as PyObject ptr
  1089. declare function PyMemoryView_GetContiguous(byval base as PyObject ptr, byval buffertype as long, byval order as byte) as PyObject ptr
  1090. #define Py_TUPLEOBJECT_H
  1091. extern PyTuple_Type as PyTypeObject
  1092. extern PyTupleIter_Type as PyTypeObject
  1093. #define PyTuple_Check(op) PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_TUPLE_SUBCLASS)
  1094. #define PyTuple_CheckExact(op) (Py_TYPE(op) = (@PyTuple_Type))
  1095. declare function PyTuple_New(byval size as Py_ssize_t) as PyObject ptr
  1096. declare function PyTuple_Size(byval as PyObject ptr) as Py_ssize_t
  1097. declare function PyTuple_GetItem(byval as PyObject ptr, byval as Py_ssize_t) as PyObject ptr
  1098. declare function PyTuple_SetItem(byval as PyObject ptr, byval as Py_ssize_t, byval as PyObject ptr) as long
  1099. declare function PyTuple_GetSlice(byval as PyObject ptr, byval as Py_ssize_t, byval as Py_ssize_t) as PyObject ptr
  1100. declare function PyTuple_Pack(byval as Py_ssize_t, ...) as PyObject ptr
  1101. declare function PyTuple_ClearFreeList() as long
  1102. #define Py_LISTOBJECT_H
  1103.  
  1104. extern PyList_Type as PyTypeObject
  1105. extern PyListIter_Type as PyTypeObject
  1106. extern PyListRevIter_Type as PyTypeObject
  1107. extern PySortWrapper_Type as PyTypeObject
  1108. #define PyList_Check(op) PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_LIST_SUBCLASS)
  1109. #define PyList_CheckExact(op) (Py_TYPE(op) = (@PyList_Type))
  1110.  
  1111. declare function PyList_New(byval size as Py_ssize_t) as PyObject ptr
  1112. declare function PyList_Size(byval as PyObject ptr) as Py_ssize_t
  1113. declare function PyList_GetItem(byval as PyObject ptr, byval as Py_ssize_t) as PyObject ptr
  1114. declare function PyList_SetItem(byval as PyObject ptr, byval as Py_ssize_t, byval as PyObject ptr) as long
  1115. declare function PyList_Insert(byval as PyObject ptr, byval as Py_ssize_t, byval as PyObject ptr) as long
  1116. declare function PyList_Append(byval as PyObject ptr, byval as PyObject ptr) as long
  1117. declare function PyList_GetSlice(byval as PyObject ptr, byval as Py_ssize_t, byval as Py_ssize_t) as PyObject ptr
  1118. declare function PyList_SetSlice(byval as PyObject ptr, byval as Py_ssize_t, byval as Py_ssize_t, byval as PyObject ptr) as long
  1119. declare function PyList_Sort(byval as PyObject ptr) as long
  1120. declare function PyList_Reverse(byval as PyObject ptr) as long
  1121. declare function PyList_AsTuple(byval as PyObject ptr) as PyObject ptr
  1122. #define Py_DICTOBJECT_H
  1123.  
  1124. extern PyDict_Type as PyTypeObject
  1125. extern PyDictIterKey_Type as PyTypeObject
  1126. extern PyDictIterValue_Type as PyTypeObject
  1127. extern PyDictIterItem_Type as PyTypeObject
  1128. extern PyDictKeys_Type as PyTypeObject
  1129. extern PyDictItems_Type as PyTypeObject
  1130. extern PyDictValues_Type as PyTypeObject
  1131.  
  1132. #define PyDict_Check(op) PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_DICT_SUBCLASS)
  1133. #define PyDict_CheckExact(op) (Py_TYPE(op) = (@PyDict_Type))
  1134. #define PyDictKeys_Check(op) PyObject_TypeCheck(op, @PyDictKeys_Type)
  1135. #define PyDictItems_Check(op) PyObject_TypeCheck(op, @PyDictItems_Type)
  1136. #define PyDictValues_Check(op) PyObject_TypeCheck(op, @PyDictValues_Type)
  1137. #define PyDictViewSet_Check(op) (PyDictKeys_Check(op) orelse PyDictItems_Check(op))
  1138.  
  1139. declare function PyDict_New() as PyObject ptr
  1140. declare function PyDict_GetItem(byval mp as PyObject ptr, byval key as PyObject ptr) as PyObject ptr
  1141. declare function PyDict_GetItemWithError(byval mp as PyObject ptr, byval key as PyObject ptr) as PyObject ptr
  1142. declare function _PyDict_GetItemIdWithError(byval dp as PyObject ptr, byval key as _Py_Identifier ptr) as PyObject ptr
  1143. declare function PyDict_SetItem(byval mp as PyObject ptr, byval key as PyObject ptr, byval item as PyObject ptr) as long
  1144. declare function PyDict_DelItem(byval mp as PyObject ptr, byval key as PyObject ptr) as long
  1145. declare sub PyDict_Clear(byval mp as PyObject ptr)
  1146. declare function PyDict_Next(byval mp as PyObject ptr, byval pos as Py_ssize_t ptr, byval key as PyObject ptr ptr, byval value as PyObject ptr ptr) as long
  1147. declare function PyDict_Keys(byval mp as PyObject ptr) as PyObject ptr
  1148. declare function PyDict_Values(byval mp as PyObject ptr) as PyObject ptr
  1149. declare function PyDict_Items(byval mp as PyObject ptr) as PyObject ptr
  1150. declare function PyDict_Size(byval mp as PyObject ptr) as Py_ssize_t
  1151. declare function PyDict_Copy(byval mp as PyObject ptr) as PyObject ptr
  1152. declare function PyDict_Contains(byval mp as PyObject ptr, byval key as PyObject ptr) as long
  1153. declare function PyDict_Update(byval mp as PyObject ptr, byval other as PyObject ptr) as long
  1154. declare function PyDict_Merge(byval mp as PyObject ptr, byval other as PyObject ptr, byval override as long) as long
  1155. declare function PyDict_MergeFromSeq2(byval d as PyObject ptr, byval seq2 as PyObject ptr, byval override as long) as long
  1156. declare function PyDict_GetItemString(byval dp as PyObject ptr, byval key as const zstring ptr) as PyObject ptr
  1157. declare function _PyDict_GetItemId(byval dp as PyObject ptr, byval key as _Py_Identifier ptr) as PyObject ptr
  1158. declare function PyDict_SetItemString(byval dp as PyObject ptr, byval key as const zstring ptr, byval item as PyObject ptr) as long
  1159. declare function _PyDict_SetItemId(byval dp as PyObject ptr, byval key as _Py_Identifier ptr, byval item as PyObject ptr) as long
  1160. declare function PyDict_DelItemString(byval dp as PyObject ptr, byval key as const zstring ptr) as long
  1161.  
  1162. #define Py_ODICTOBJECT_H
  1163. #define PyODict_Check(op) PyObject_TypeCheck(op, @PyODict_Type)
  1164. #define PyODict_CheckExact(op) (Py_TYPE(op) = (@PyODict_Type))
  1165. '' TODO: #define PyODict_HasKey(od, key) (PyMapping_HasKey(PyObject *)od, key)
  1166.  
  1167. declare function PyODict_New() as PyObject ptr
  1168. declare function PyODict_SetItem(byval od as PyObject ptr, byval key as PyObject ptr, byval item as PyObject ptr) as long
  1169. declare function PyODict_DelItem(byval od as PyObject ptr, byval key as PyObject ptr) as long
  1170.  
  1171. #define PyODict_GetItem(od, key) PyDict_GetItem(cptr(PyObject ptr, od), key)
  1172. #define PyODict_GetItemWithError(od, key) PyDict_GetItemWithError(cptr(PyObject ptr, od), key)
  1173. #define PyODict_Contains(od, key) PyDict_Contains(cptr(PyObject ptr, od), key)
  1174. #define PyODict_Size(od) PyDict_Size(cptr(PyObject ptr, od))
  1175. #define PyODict_GetItemString(od, key) PyDict_GetItemString(cptr(PyObject ptr, od), key)
  1176. #define Py_ENUMOBJECT_H
  1177. extern PyEnum_Type as PyTypeObject
  1178. extern PyReversed_Type as PyTypeObject
  1179. #define Py_SETOBJECT_H
  1180.  
  1181. extern PySet_Type as PyTypeObject
  1182. extern PyFrozenSet_Type as PyTypeObject
  1183. extern PySetIter_Type as PyTypeObject
  1184.  
  1185. declare function PySet_New(byval as PyObject ptr) as PyObject ptr
  1186. declare function PyFrozenSet_New(byval as PyObject ptr) as PyObject ptr
  1187. declare function PySet_Add(byval set as PyObject ptr, byval key as PyObject ptr) as long
  1188. declare function PySet_Clear(byval set as PyObject ptr) as long
  1189. declare function PySet_Contains(byval anyset as PyObject ptr, byval key as PyObject ptr) as long
  1190. declare function PySet_Discard(byval set as PyObject ptr, byval key as PyObject ptr) as long
  1191. declare function PySet_Pop(byval set as PyObject ptr) as PyObject ptr
  1192. declare function PySet_Size(byval anyset as PyObject ptr) as Py_ssize_t
  1193.  
  1194. #define PyFrozenSet_CheckExact(ob) (Py_TYPE(ob) = (@PyFrozenSet_Type))
  1195. #define PyAnySet_CheckExact(ob) ((Py_TYPE(ob) = (@PySet_Type)) orelse (Py_TYPE(ob) = (@PyFrozenSet_Type)))
  1196. #define PyAnySet_Check(ob) ((((Py_TYPE(ob) = (@PySet_Type)) orelse (Py_TYPE(ob) = (@PyFrozenSet_Type))) orelse PyType_IsSubtype(Py_TYPE(ob), @PySet_Type)) orelse PyType_IsSubtype(Py_TYPE(ob), @PyFrozenSet_Type))
  1197. #define PySet_Check(ob) ((Py_TYPE(ob) = (@PySet_Type)) orelse PyType_IsSubtype(Py_TYPE(ob), @PySet_Type))
  1198. #define PyFrozenSet_Check(ob) ((Py_TYPE(ob) = (@PyFrozenSet_Type)) orelse PyType_IsSubtype(Py_TYPE(ob), @PyFrozenSet_Type))
  1199. #define Py_METHODOBJECT_H
  1200. extern PyCFunction_Type as PyTypeObject
  1201. #define PyCFunction_Check(op) (Py_TYPE(op) = (@PyCFunction_Type))
  1202.  
  1203. type PyCFunction as function(byval as PyObject ptr, byval as PyObject ptr) as PyObject ptr
  1204. type PyCFunctionWithKeywords as function(byval as PyObject ptr, byval as PyObject ptr, byval as PyObject ptr) as PyObject ptr
  1205. type PyNoArgsFunction as function(byval as PyObject ptr) as PyObject ptr
  1206.  
  1207. declare function PyCFunction_GetFunction(byval as PyObject ptr) as PyCFunction
  1208. declare function PyCFunction_GetSelf(byval as PyObject ptr) as PyObject ptr
  1209. declare function PyCFunction_GetFlags(byval as PyObject ptr) as long
  1210. declare function PyCFunction_Call(byval as PyObject ptr, byval as PyObject ptr, byval as PyObject ptr) as PyObject ptr
  1211.  
  1212. type PyMethodDef
  1213.     ml_name as const zstring ptr
  1214.     ml_meth as PyCFunction
  1215.     ml_flags as long
  1216.     ml_doc as const zstring ptr
  1217. end type
  1218.  
  1219. #define PyCFunction_New(ML, SELF) PyCFunction_NewEx((ML), (SELF), NULL)
  1220. declare function PyCFunction_NewEx(byval as PyMethodDef ptr, byval as PyObject ptr, byval as PyObject ptr) as PyObject ptr
  1221. const METH_VARARGS = &h0001
  1222. const METH_KEYWORDS = &h0002
  1223. const METH_NOARGS = &h0004
  1224. const METH_O = &h0008
  1225. const METH_CLASS = &h0010
  1226. const METH_STATIC = &h0020
  1227. const METH_COEXIST = &h0040
  1228. declare function PyCFunction_ClearFreeList() as long
  1229. #define Py_MODULEOBJECT_H
  1230. extern PyModule_Type as PyTypeObject
  1231. #define PyModule_Check(op) PyObject_TypeCheck(op, @PyModule_Type)
  1232. #define PyModule_CheckExact(op) (Py_TYPE(op) = (@PyModule_Type))
  1233.  
  1234. declare function PyModule_NewObject(byval name as PyObject ptr) as PyObject ptr
  1235. declare function PyModule_New(byval name as const zstring ptr) as PyObject ptr
  1236. declare function PyModule_GetDict(byval as PyObject ptr) as PyObject ptr
  1237. declare function PyModule_GetNameObject(byval as PyObject ptr) as PyObject ptr
  1238. declare function PyModule_GetName(byval as PyObject ptr) as const zstring ptr
  1239. declare function PyModule_GetFilename(byval as PyObject ptr) as const zstring ptr
  1240. declare function PyModule_GetFilenameObject(byval as PyObject ptr) as PyObject ptr
  1241. type PyModuleDef as PyModuleDef_
  1242. declare function PyModule_GetDef(byval as PyObject ptr) as PyModuleDef ptr
  1243. declare function PyModule_GetState(byval as PyObject ptr) as any ptr
  1244.  
  1245. type PyModuleDef_Base
  1246.     ob_base as PyObject
  1247.     m_init as function() as PyObject ptr
  1248.     m_index as Py_ssize_t
  1249.     m_copy as PyObject ptr
  1250. end type
  1251.  
  1252. '' TODO: #define PyModuleDef_HEAD_INIT { PyObject_HEAD_INIT(NULL) NULL, 0, NULL, }
  1253. type PyModuleDef_Slot as PyModuleDef_Slot_
  1254.  
  1255. type PyModuleDef_
  1256.     m_base as PyModuleDef_Base
  1257.     m_name as const zstring ptr
  1258.     m_doc as const zstring ptr
  1259.     m_size as Py_ssize_t
  1260.     m_methods as PyMethodDef ptr
  1261.     m_slots as PyModuleDef_Slot ptr
  1262.     m_traverse as traverseproc
  1263.     m_clear as inquiry
  1264.     m_free as freefunc
  1265. end type
  1266.  
  1267. #define Py_FILEOBJECT_H
  1268. #define PY_STDIOTEXTMODE "b"
  1269. declare function PyFile_FromFd(byval as long, byval as const zstring ptr, byval as const zstring ptr, byval as long, byval as const zstring ptr, byval as const zstring ptr, byval as const zstring ptr, byval as long) as PyObject ptr
  1270. declare function PyFile_GetLine(byval as PyObject ptr, byval as long) as PyObject ptr
  1271. declare function PyFile_WriteObject(byval as PyObject ptr, byval as PyObject ptr, byval as long) as long
  1272. declare function PyFile_WriteString(byval as const zstring ptr, byval as PyObject ptr) as long
  1273. declare function PyObject_AsFileDescriptor(byval as PyObject ptr) as long
  1274. extern Py_FileSystemDefaultEncoding as const zstring ptr
  1275. extern Py_HasFileSystemDefaultEncoding as long
  1276. #define _PyIsSelectable_fd(FD) (((FD) >= 0) andalso ((FD) < FD_SETSIZE))
  1277. #define Py_CAPSULE_H
  1278. extern PyCapsule_Type as PyTypeObject
  1279. type PyCapsule_Destructor as sub(byval as PyObject ptr)
  1280. #define PyCapsule_CheckExact(op) (Py_TYPE(op) = (@PyCapsule_Type))
  1281. declare function PyCapsule_New(byval pointer as any ptr, byval name as const zstring ptr, byval destructor_ as PyCapsule_Destructor) as PyObject ptr
  1282. declare function PyCapsule_GetPointer(byval capsule as PyObject ptr, byval name as const zstring ptr) as any ptr
  1283. declare function PyCapsule_GetDestructor(byval capsule as PyObject ptr) as PyCapsule_Destructor
  1284. declare function PyCapsule_GetName(byval capsule as PyObject ptr) as const zstring ptr
  1285. declare function PyCapsule_GetContext(byval capsule as PyObject ptr) as any ptr
  1286. declare function PyCapsule_IsValid(byval capsule as PyObject ptr, byval name as const zstring ptr) as long
  1287. declare function PyCapsule_SetPointer(byval capsule as PyObject ptr, byval pointer as any ptr) as long
  1288. declare function PyCapsule_SetDestructor(byval capsule as PyObject ptr, byval destructor_ as PyCapsule_Destructor) as long
  1289. declare function PyCapsule_SetName(byval capsule as PyObject ptr, byval name as const zstring ptr) as long
  1290. declare function PyCapsule_SetContext(byval capsule as PyObject ptr, byval context as any ptr) as long
  1291. declare function PyCapsule_Import(byval name as const zstring ptr, byval no_block as long) as any ptr
  1292. #define Py_TRACEBACK_H
  1293. #define Py_PYSTATE_H
  1294. type PyInterpreterState as _is
  1295. type PyThreadState as _ts
  1296. declare function PyInterpreterState_New() as PyInterpreterState ptr
  1297. declare sub PyInterpreterState_Clear(byval as PyInterpreterState ptr)
  1298. declare sub PyInterpreterState_Delete(byval as PyInterpreterState ptr)
  1299. declare function _PyState_AddModule(byval as PyObject ptr, byval as PyModuleDef ptr) as long
  1300. declare function PyState_FindModule(byval as PyModuleDef ptr) as PyObject ptr
  1301. declare function PyThreadState_New(byval as PyInterpreterState ptr) as PyThreadState ptr
  1302. declare function _PyThreadState_Prealloc(byval as PyInterpreterState ptr) as PyThreadState ptr
  1303. declare sub _PyThreadState_Init(byval as PyThreadState ptr)
  1304. declare sub PyThreadState_Clear(byval as PyThreadState ptr)
  1305. declare sub PyThreadState_Delete(byval as PyThreadState ptr)
  1306. declare sub _PyThreadState_DeleteExcept(byval tstate as PyThreadState ptr)
  1307. declare sub PyThreadState_DeleteCurrent()
  1308. declare sub _PyGILState_Reinit()
  1309. declare function PyThreadState_Get() as PyThreadState ptr
  1310. declare function _PyThreadState_UncheckedGet() as PyThreadState ptr
  1311. declare function PyThreadState_Swap(byval as PyThreadState ptr) as PyThreadState ptr
  1312. declare function PyThreadState_GetDict() as PyObject ptr
  1313. declare function PyThreadState_SetAsyncExc(byval as clong, byval as PyObject ptr) as long
  1314.  
  1315. type PyGILState_STATE as long
  1316. enum
  1317.     PyGILState_LOCKED
  1318.     PyGILState_UNLOCKED
  1319. end enum
  1320.  
  1321. declare function PyGILState_Ensure() as PyGILState_STATE
  1322. declare sub PyGILState_Release(byval as PyGILState_STATE)
  1323. declare function PyGILState_GetThisThreadState() as PyThreadState ptr
  1324. declare function PyTraceBack_Here(byval as PyObject ptr) as long
  1325. declare function PyTraceBack_Print(byval as PyObject ptr, byval as PyObject ptr) as long
  1326. extern PyTraceBack_Type as PyTypeObject
  1327. #define PyTraceBack_Check(v) (Py_TYPE(v) = (@PyTraceBack_Type))
  1328. declare sub _Py_DumpTraceback(byval fd as long, byval tstate as PyThreadState ptr)
  1329. declare function _Py_DumpTracebackThreads(byval fd as long, byval interp as PyInterpreterState ptr, byval current_thread as PyThreadState ptr) as const zstring ptr
  1330. #define Py_SLICEOBJECT_H
  1331. extern _Py_EllipsisObject as PyObject
  1332. #define Py_Ellipsis (@_Py_EllipsisObject)
  1333. extern PySlice_Type as PyTypeObject
  1334. extern PyEllipsis_Type as PyTypeObject
  1335. #define PySlice_Check(op) (Py_TYPE(op) = (@PySlice_Type))
  1336. declare function PySlice_New(byval start as PyObject ptr, byval stop as PyObject ptr, byval step as PyObject ptr) as PyObject ptr
  1337. declare function PySlice_GetIndices(byval r as PyObject ptr, byval length as Py_ssize_t, byval start as Py_ssize_t ptr, byval stop as Py_ssize_t ptr, byval step as Py_ssize_t ptr) as long
  1338. declare function PySlice_GetIndicesEx(byval r as PyObject ptr, byval length as Py_ssize_t, byval start as Py_ssize_t ptr, byval stop as Py_ssize_t ptr, byval step as Py_ssize_t ptr, byval slicelength as Py_ssize_t ptr) as long
  1339. #define Py_ITEROBJECT_H
  1340.  
  1341. extern PySeqIter_Type as PyTypeObject
  1342. extern PyCallIter_Type as PyTypeObject
  1343. extern PyCmpWrapper_Type as PyTypeObject
  1344. #define PySeqIter_Check(op) (Py_TYPE(op) = (@PySeqIter_Type))
  1345. declare function PySeqIter_New(byval as PyObject ptr) as PyObject ptr
  1346. #define PyCallIter_Check(op) (Py_TYPE(op) = (@PyCallIter_Type))
  1347. declare function PyCallIter_New(byval as PyObject ptr, byval as PyObject ptr) as PyObject ptr
  1348. #define Py_DESCROBJECT_H
  1349. type getter as function(byval as PyObject ptr, byval as any ptr) as PyObject ptr
  1350. type setter as function(byval as PyObject ptr, byval as PyObject ptr, byval as any ptr) as long
  1351.  
  1352. type PyGetSetDef
  1353.     name as zstring ptr
  1354.     get as getter
  1355.     set as setter
  1356.     doc as zstring ptr
  1357.     closure as any ptr
  1358. end type
  1359.  
  1360. extern PyClassMethodDescr_Type as PyTypeObject
  1361. extern PyGetSetDescr_Type as PyTypeObject
  1362. extern PyMemberDescr_Type as PyTypeObject
  1363. extern PyMethodDescr_Type as PyTypeObject
  1364. extern PyWrapperDescr_Type as PyTypeObject
  1365. extern PyDictProxy_Type as PyTypeObject
  1366. extern _PyMethodWrapper_Type as PyTypeObject
  1367. declare function PyDescr_NewMethod(byval as PyTypeObject ptr, byval as PyMethodDef ptr) as PyObject ptr
  1368. declare function PyDescr_NewClassMethod(byval as PyTypeObject ptr, byval as PyMethodDef ptr) as PyObject ptr
  1369. type PyMemberDef as PyMemberDef_
  1370.  
  1371. declare function PyDescr_NewMember(byval as PyTypeObject ptr, byval as PyMemberDef ptr) as PyObject ptr
  1372. declare function PyDescr_NewGetSet(byval as PyTypeObject ptr, byval as PyGetSetDef ptr) as PyObject ptr
  1373. declare function PyDictProxy_New(byval as PyObject ptr) as PyObject ptr
  1374. declare function PyWrapper_New(byval as PyObject ptr, byval as PyObject ptr) as PyObject ptr
  1375. extern PyProperty_Type as PyTypeObject
  1376. #define Py_WARNINGS_H
  1377. declare function PyErr_WarnEx(byval category as PyObject ptr, byval message as const zstring ptr, byval stack_level as Py_ssize_t) as long
  1378. declare function PyErr_WarnFormat(byval category as PyObject ptr, byval stack_level as Py_ssize_t, byval format as const zstring ptr, ...) as long
  1379. declare function PyErr_WarnExplicit(byval category as PyObject ptr, byval message as const zstring ptr, byval filename as const zstring ptr, byval lineno as long, byval module as const zstring ptr, byval registry as PyObject ptr) as long
  1380. #define Py_WEAKREFOBJECT_H
  1381. type PyWeakReference as _PyWeakReference
  1382.  
  1383. extern _PyWeakref_RefType as PyTypeObject
  1384. extern _PyWeakref_ProxyType as PyTypeObject
  1385. extern _PyWeakref_CallableProxyType as PyTypeObject
  1386.  
  1387. #define PyWeakref_CheckRef(op) PyObject_TypeCheck(op, @_PyWeakref_RefType)
  1388. #define PyWeakref_CheckRefExact(op) (Py_TYPE(op) = (@_PyWeakref_RefType))
  1389. #define PyWeakref_CheckProxy(op) ((Py_TYPE(op) = (@_PyWeakref_ProxyType)) orelse (Py_TYPE(op) = (@_PyWeakref_CallableProxyType)))
  1390. #define PyWeakref_Check(op) (PyWeakref_CheckRef(op) orelse PyWeakref_CheckProxy(op))
  1391.  
  1392. declare function PyWeakref_NewRef(byval ob as PyObject ptr, byval callback as PyObject ptr) as PyObject ptr
  1393. declare function PyWeakref_NewProxy(byval ob as PyObject ptr, byval callback as PyObject ptr) as PyObject ptr
  1394. declare function PyWeakref_GetObject(byval ref as PyObject ptr) as PyObject ptr
  1395. #define PyWeakref_GET_OBJECT(ref) iif(Py_REFCNT(cptr(PyWeakReference ptr, (ref))->wr_object) > 0, cptr(PyWeakReference ptr, (ref))->wr_object, Py_None)
  1396. #define Py_STRUCTSEQ_H
  1397.  
  1398. type PyStructSequence_Field
  1399.     name as zstring ptr
  1400.     doc as zstring ptr
  1401. end type
  1402.  
  1403. type PyStructSequence_Desc
  1404.     name as zstring ptr
  1405.     doc as zstring ptr
  1406.     fields as PyStructSequence_Field ptr
  1407.     n_in_sequence as long
  1408. end type
  1409.  
  1410. extern PyStructSequence_UnnamedField as zstring ptr
  1411. declare function PyStructSequence_NewType(byval desc as PyStructSequence_Desc ptr) as PyTypeObject ptr
  1412. declare function PyStructSequence_New(byval type as PyTypeObject ptr) as PyObject ptr
  1413. declare sub PyStructSequence_SetItem(byval as PyObject ptr, byval as Py_ssize_t, byval as PyObject ptr)
  1414. declare function PyStructSequence_GetItem(byval as PyObject ptr, byval as Py_ssize_t) as PyObject ptr
  1415. #define NAMESPACEOBJECT_H
  1416. extern _PyNamespace_Type as PyTypeObject
  1417. declare function _PyNamespace_New(byval kwds as PyObject ptr) as PyObject ptr
  1418. #define Py_CODECREGISTRY_H
  1419. declare function PyCodec_Register(byval search_function as PyObject ptr) as long
  1420. declare function PyCodec_KnownEncoding(byval encoding as const zstring ptr) as long
  1421. declare function PyCodec_Encode(byval object as PyObject ptr, byval encoding as const zstring ptr, byval errors as const zstring ptr) as PyObject ptr
  1422. declare function PyCodec_Decode(byval object as PyObject ptr, byval encoding as const zstring ptr, byval errors as const zstring ptr) as PyObject ptr
  1423. declare function PyCodec_Encoder(byval encoding as const zstring ptr) as PyObject ptr
  1424. declare function PyCodec_Decoder(byval encoding as const zstring ptr) as PyObject ptr
  1425. declare function PyCodec_IncrementalEncoder(byval encoding as const zstring ptr, byval errors as const zstring ptr) as PyObject ptr
  1426. declare function PyCodec_IncrementalDecoder(byval encoding as const zstring ptr, byval errors as const zstring ptr) as PyObject ptr
  1427. declare function PyCodec_StreamReader(byval encoding as const zstring ptr, byval stream as PyObject ptr, byval errors as const zstring ptr) as PyObject ptr
  1428. declare function PyCodec_StreamWriter(byval encoding as const zstring ptr, byval stream as PyObject ptr, byval errors as const zstring ptr) as PyObject ptr
  1429. declare function PyCodec_RegisterError(byval name as const zstring ptr, byval error as PyObject ptr) as long
  1430. declare function PyCodec_LookupError(byval name as const zstring ptr) as PyObject ptr
  1431. declare function PyCodec_StrictErrors(byval exc as PyObject ptr) as PyObject ptr
  1432. declare function PyCodec_IgnoreErrors(byval exc as PyObject ptr) as PyObject ptr
  1433. declare function PyCodec_ReplaceErrors(byval exc as PyObject ptr) as PyObject ptr
  1434. declare function PyCodec_XMLCharRefReplaceErrors(byval exc as PyObject ptr) as PyObject ptr
  1435. declare function PyCodec_BackslashReplaceErrors(byval exc as PyObject ptr) as PyObject ptr
  1436. declare function PyCodec_NameReplaceErrors(byval exc as PyObject ptr) as PyObject ptr
  1437. extern Py_hexdigits as const zstring ptr
  1438. #define Py_ERRORS_H
  1439. declare sub PyErr_SetNone(byval as PyObject ptr)
  1440. declare sub PyErr_SetObject(byval as PyObject ptr, byval as PyObject ptr)
  1441. declare sub PyErr_SetString(byval exception as PyObject ptr, byval string as const zstring ptr)
  1442. declare function PyErr_Occurred() as PyObject ptr
  1443. declare sub PyErr_Clear()
  1444. declare sub PyErr_Fetch(byval as PyObject ptr ptr, byval as PyObject ptr ptr, byval as PyObject ptr ptr)
  1445. declare sub PyErr_Restore(byval as PyObject ptr, byval as PyObject ptr, byval as PyObject ptr)
  1446. declare sub PyErr_GetExcInfo(byval as PyObject ptr ptr, byval as PyObject ptr ptr, byval as PyObject ptr ptr)
  1447. declare sub PyErr_SetExcInfo(byval as PyObject ptr, byval as PyObject ptr, byval as PyObject ptr)
  1448. declare sub Py_FatalError(byval message as const zstring ptr)
  1449. #define _PyErr_OCCURRED() PyErr_Occurred()
  1450. declare function PyErr_GivenExceptionMatches(byval as PyObject ptr, byval as PyObject ptr) as long
  1451. declare function PyErr_ExceptionMatches(byval as PyObject ptr) as long
  1452. declare sub PyErr_NormalizeException(byval as PyObject ptr ptr, byval as PyObject ptr ptr, byval as PyObject ptr ptr)
  1453. declare function PyException_SetTraceback(byval as PyObject ptr, byval as PyObject ptr) as long
  1454. declare function PyException_GetTraceback(byval as PyObject ptr) as PyObject ptr
  1455. declare function PyException_GetCause(byval as PyObject ptr) as PyObject ptr
  1456. declare sub PyException_SetCause(byval as PyObject ptr, byval as PyObject ptr)
  1457. declare function PyException_GetContext(byval as PyObject ptr) as PyObject ptr
  1458. declare sub PyException_SetContext(byval as PyObject ptr, byval as PyObject ptr)
  1459.  
  1460. #define PyExceptionClass_Check(x) (PyType_Check((x)) andalso PyType_FastSubclass(cptr(PyTypeObject ptr, (x)), Py_TPFLAGS_BASE_EXC_SUBCLASS))
  1461. #define PyExceptionInstance_Check(x) PyType_FastSubclass((x)->ob_type, Py_TPFLAGS_BASE_EXC_SUBCLASS)
  1462. #define PyExceptionClass_Name(x) cptr(zstring ptr, cptr(PyTypeObject ptr, (x))->tp_name)
  1463. #define PyExceptionInstance_Class(x) cptr(PyObject ptr, (x)->ob_type)
  1464.  
  1465. extern PyExc_BaseException as PyObject ptr
  1466. extern PyExc_Exception as PyObject ptr
  1467. extern PyExc_StopAsyncIteration as PyObject ptr
  1468. extern PyExc_StopIteration as PyObject ptr
  1469. extern PyExc_GeneratorExit as PyObject ptr
  1470. extern PyExc_ArithmeticError as PyObject ptr
  1471. extern PyExc_LookupError as PyObject ptr
  1472. extern PyExc_AssertionError as PyObject ptr
  1473. extern PyExc_AttributeError as PyObject ptr
  1474. extern PyExc_BufferError as PyObject ptr
  1475. extern PyExc_EOFError as PyObject ptr
  1476. extern PyExc_FloatingPointError as PyObject ptr
  1477. extern PyExc_OSError as PyObject ptr
  1478. extern PyExc_ImportError as PyObject ptr
  1479. extern PyExc_IndexError as PyObject ptr
  1480. extern PyExc_KeyError as PyObject ptr
  1481. extern PyExc_KeyboardInterrupt as PyObject ptr
  1482. extern PyExc_MemoryError as PyObject ptr
  1483. extern PyExc_NameError as PyObject ptr
  1484. extern PyExc_OverflowError as PyObject ptr
  1485. extern PyExc_RuntimeError as PyObject ptr
  1486. extern PyExc_RecursionError as PyObject ptr
  1487. extern PyExc_NotImplementedError as PyObject ptr
  1488. extern PyExc_SyntaxError as PyObject ptr
  1489. extern PyExc_IndentationError as PyObject ptr
  1490. extern PyExc_TabError as PyObject ptr
  1491. extern PyExc_ReferenceError as PyObject ptr
  1492. extern PyExc_SystemError as PyObject ptr
  1493. extern PyExc_SystemExit as PyObject ptr
  1494. extern PyExc_TypeError as PyObject ptr
  1495. extern PyExc_UnboundLocalError as PyObject ptr
  1496. extern PyExc_UnicodeError as PyObject ptr
  1497. extern PyExc_UnicodeEncodeError as PyObject ptr
  1498. extern PyExc_UnicodeDecodeError as PyObject ptr
  1499. extern PyExc_UnicodeTranslateError as PyObject ptr
  1500. extern PyExc_ValueError as PyObject ptr
  1501. extern PyExc_ZeroDivisionError as PyObject ptr
  1502. extern PyExc_BlockingIOError as PyObject ptr
  1503. extern PyExc_BrokenPipeError as PyObject ptr
  1504. extern PyExc_ChildProcessError as PyObject ptr
  1505. extern PyExc_ConnectionError as PyObject ptr
  1506. extern PyExc_ConnectionAbortedError as PyObject ptr
  1507. extern PyExc_ConnectionRefusedError as PyObject ptr
  1508. extern PyExc_ConnectionResetError as PyObject ptr
  1509. extern PyExc_FileExistsError as PyObject ptr
  1510. extern PyExc_FileNotFoundError as PyObject ptr
  1511. extern PyExc_InterruptedError as PyObject ptr
  1512. extern PyExc_IsADirectoryError as PyObject ptr
  1513. extern PyExc_NotADirectoryError as PyObject ptr
  1514. extern PyExc_PermissionError as PyObject ptr
  1515. extern PyExc_ProcessLookupError as PyObject ptr
  1516. extern PyExc_TimeoutError as PyObject ptr
  1517. extern PyExc_EnvironmentError as PyObject ptr
  1518. extern PyExc_IOError as PyObject ptr
  1519. extern PyExc_RecursionErrorInst as PyObject ptr
  1520. extern PyExc_Warning as PyObject ptr
  1521. extern PyExc_UserWarning as PyObject ptr
  1522. extern PyExc_DeprecationWarning as PyObject ptr
  1523. extern PyExc_PendingDeprecationWarning as PyObject ptr
  1524. extern PyExc_SyntaxWarning as PyObject ptr
  1525. extern PyExc_RuntimeWarning as PyObject ptr
  1526. extern PyExc_FutureWarning as PyObject ptr
  1527. extern PyExc_ImportWarning as PyObject ptr
  1528. extern PyExc_UnicodeWarning as PyObject ptr
  1529. extern PyExc_BytesWarning as PyObject ptr
  1530. extern PyExc_ResourceWarning as PyObject ptr
  1531.  
  1532. declare function PyErr_BadArgument() as long
  1533. declare function PyErr_NoMemory() as PyObject ptr
  1534. declare function PyErr_SetFromErrno(byval as PyObject ptr) as PyObject ptr
  1535. declare function PyErr_SetFromErrnoWithFilenameObject(byval as PyObject ptr, byval as PyObject ptr) as PyObject ptr
  1536. declare function PyErr_SetFromErrnoWithFilenameObjects(byval as PyObject ptr, byval as PyObject ptr, byval as PyObject ptr) as PyObject ptr
  1537. declare function PyErr_SetFromErrnoWithFilename(byval exc as PyObject ptr, byval filename as const zstring ptr) as PyObject ptr
  1538. declare function PyErr_Format(byval exception as PyObject ptr, byval format as const zstring ptr, ...) as PyObject ptr
  1539. declare function PyErr_SetExcWithArgsKwargs(byval as PyObject ptr, byval as PyObject ptr, byval as PyObject ptr) as PyObject ptr
  1540. declare function PyErr_SetImportError(byval as PyObject ptr, byval as PyObject ptr, byval as PyObject ptr) as PyObject ptr
  1541. #undef PyErr_BadInternalCall
  1542. declare sub PyErr_BadInternalCall()
  1543. declare sub _PyErr_BadInternalCall(byval filename as const zstring ptr, byval lineno as long)
  1544. #undef PyErr_BadInternalCall
  1545. #define PyErr_BadInternalCall() _PyErr_BadInternalCall(__FILE__, __LINE__)
  1546. declare function PyErr_NewException(byval name as const zstring ptr, byval base as PyObject ptr, byval dict as PyObject ptr) as PyObject ptr
  1547. declare function PyErr_NewExceptionWithDoc(byval name as const zstring ptr, byval doc as const zstring ptr, byval base as PyObject ptr, byval dict as PyObject ptr) as PyObject ptr
  1548. declare sub PyErr_WriteUnraisable(byval as PyObject ptr)
  1549. declare function PyErr_CheckSignals() as long
  1550. declare sub PyErr_SetInterrupt()
  1551. declare sub PyErr_SyntaxLocation(byval filename as const zstring ptr, byval lineno as long)
  1552. declare sub PyErr_SyntaxLocationEx(byval filename as const zstring ptr, byval lineno as long, byval col_offset as long)
  1553. declare function PyErr_ProgramText(byval filename as const zstring ptr, byval lineno as long) as PyObject ptr
  1554. declare function PyUnicodeDecodeError_Create(byval encoding as const zstring ptr, byval object as const zstring ptr, byval length as Py_ssize_t, byval start as Py_ssize_t, byval end as Py_ssize_t, byval reason as const zstring ptr) as PyObject ptr
  1555. declare function PyUnicodeEncodeError_GetEncoding(byval as PyObject ptr) as PyObject ptr
  1556. declare function PyUnicodeDecodeError_GetEncoding(byval as PyObject ptr) as PyObject ptr
  1557. declare function PyUnicodeEncodeError_GetObject(byval as PyObject ptr) as PyObject ptr
  1558. declare function PyUnicodeDecodeError_GetObject(byval as PyObject ptr) as PyObject ptr
  1559. declare function PyUnicodeTranslateError_GetObject(byval as PyObject ptr) as PyObject ptr
  1560. declare function PyUnicodeEncodeError_GetStart(byval as PyObject ptr, byval as Py_ssize_t ptr) as long
  1561. declare function PyUnicodeDecodeError_GetStart(byval as PyObject ptr, byval as Py_ssize_t ptr) as long
  1562. declare function PyUnicodeTranslateError_GetStart(byval as PyObject ptr, byval as Py_ssize_t ptr) as long
  1563. declare function PyUnicodeEncodeError_SetStart(byval as PyObject ptr, byval as Py_ssize_t) as long
  1564. declare function PyUnicodeDecodeError_SetStart(byval as PyObject ptr, byval as Py_ssize_t) as long
  1565. declare function PyUnicodeTranslateError_SetStart(byval as PyObject ptr, byval as Py_ssize_t) as long
  1566. declare function PyUnicodeEncodeError_GetEnd(byval as PyObject ptr, byval as Py_ssize_t ptr) as long
  1567. declare function PyUnicodeDecodeError_GetEnd(byval as PyObject ptr, byval as Py_ssize_t ptr) as long
  1568. declare function PyUnicodeTranslateError_GetEnd(byval as PyObject ptr, byval as Py_ssize_t ptr) as long
  1569. declare function PyUnicodeEncodeError_SetEnd(byval as PyObject ptr, byval as Py_ssize_t) as long
  1570. declare function PyUnicodeDecodeError_SetEnd(byval as PyObject ptr, byval as Py_ssize_t) as long
  1571. declare function PyUnicodeTranslateError_SetEnd(byval as PyObject ptr, byval as Py_ssize_t) as long
  1572. declare function PyUnicodeEncodeError_GetReason(byval as PyObject ptr) as PyObject ptr
  1573. declare function PyUnicodeDecodeError_GetReason(byval as PyObject ptr) as PyObject ptr
  1574. declare function PyUnicodeTranslateError_GetReason(byval as PyObject ptr) as PyObject ptr
  1575. declare function PyUnicodeEncodeError_SetReason(byval exc as PyObject ptr, byval reason as const zstring ptr) as long
  1576. declare function PyUnicodeDecodeError_SetReason(byval exc as PyObject ptr, byval reason as const zstring ptr) as long
  1577. declare function PyUnicodeTranslateError_SetReason(byval exc as PyObject ptr, byval reason as const zstring ptr) as long
  1578. declare function PyOS_snprintf(byval str as zstring ptr, byval size as uinteger, byval format as const zstring ptr, ...) as long
  1579. declare function PyOS_vsnprintf(byval str as zstring ptr, byval size as uinteger, byval format as const zstring ptr, byval va as va_list) as long
  1580. #define Py_MODSUPPORT_H
  1581. declare function _Py_VaBuildValue_SizeT(byval as const zstring ptr, byval as va_list) as PyObject ptr
  1582. declare function PyArg_Parse(byval as PyObject ptr, byval as const zstring ptr, ...) as long
  1583. declare function PyArg_ParseTuple(byval as PyObject ptr, byval as const zstring ptr, ...) as long
  1584. declare function PyArg_ParseTupleAndKeywords(byval as PyObject ptr, byval as PyObject ptr, byval as const zstring ptr, byval as zstring ptr ptr, ...) as long
  1585. declare function PyArg_ValidateKeywordArguments(byval as PyObject ptr) as long
  1586. declare function PyArg_UnpackTuple(byval as PyObject ptr, byval as const zstring ptr, byval as Py_ssize_t, byval as Py_ssize_t, ...) as long
  1587. declare function Py_BuildValue(byval as const zstring ptr, ...) as PyObject ptr
  1588. declare function _Py_BuildValue_SizeT(byval as const zstring ptr, ...) as PyObject ptr
  1589. declare function Py_VaBuildValue(byval as const zstring ptr, byval as va_list) as PyObject ptr
  1590. declare function PyModule_AddObject(byval as PyObject ptr, byval as const zstring ptr, byval as PyObject ptr) as long
  1591. declare function PyModule_AddIntConstant(byval as PyObject ptr, byval as const zstring ptr, byval as clong) as long
  1592. declare function PyModule_AddStringConstant(byval as PyObject ptr, byval as const zstring ptr, byval as const zstring ptr) as long
  1593.  
  1594. #define PyModule_AddIntMacro(m, c) PyModule_AddIntConstant(m, #c, c)
  1595. #define PyModule_AddStringMacro(m, c) PyModule_AddStringConstant(m, #c, c)
  1596. const Py_CLEANUP_SUPPORTED = &h20000
  1597. const PYTHON_API_VERSION = 1013
  1598. #define PYTHON_API_STRING "1013"
  1599. const PYTHON_ABI_VERSION = 3
  1600. #define PYTHON_ABI_STRING "3"
  1601. declare function PyModule_Create2(byval as PyModuleDef ptr, byval apiver as long) as PyObject ptr
  1602. #define PyModule_Create(module) PyModule_Create2(module, PYTHON_ABI_VERSION)
  1603. #define Py_PYTHONRUN_H
  1604. #define PyCF_MASK ((((((CO_FUTURE_DIVISION or CO_FUTURE_ABSOLUTE_IMPORT) or CO_FUTURE_WITH_STATEMENT) or CO_FUTURE_PRINT_FUNCTION) or CO_FUTURE_UNICODE_LITERALS) or CO_FUTURE_BARRY_AS_BDFL) or CO_FUTURE_GENERATOR_STOP)
  1605. #define PyCF_MASK_OBSOLETE CO_NESTED
  1606. const PyCF_SOURCE_IS_UTF8 = &h0100
  1607. const PyCF_DONT_IMPLY_DEDENT = &h0200
  1608. const PyCF_ONLY_AST = &h0400
  1609. const PyCF_IGNORE_COOKIE = &h0800
  1610. #define PyParser_SimpleParseString(S, B) PyParser_SimpleParseStringFlags(S, B, 0)
  1611. #define PyParser_SimpleParseFile(FP, S, B) PyParser_SimpleParseFileFlags(FP, S, B, 0)
  1612. type _node as _node_
  1613.  
  1614. declare function PyParser_SimpleParseStringFlags(byval as const zstring ptr, byval as long, byval as long) as _node ptr
  1615. declare function PyParser_SimpleParseStringFlagsFilename(byval as const zstring ptr, byval as const zstring ptr, byval as long, byval as long) as _node ptr
  1616. declare function PyParser_SimpleParseFileFlags(byval as FILE ptr, byval as const zstring ptr, byval as long, byval as long) as _node ptr
  1617. declare function Py_CompileString(byval as const zstring ptr, byval as const zstring ptr, byval as long) as PyObject ptr
  1618. type symtable as symtable_
  1619. declare function Py_SymtableString(byval str as const zstring ptr, byval filename as const zstring ptr, byval start as long) as symtable ptr
  1620. declare sub PyErr_Print()
  1621. declare sub PyErr_PrintEx(byval as long)
  1622. declare sub PyErr_Display(byval as PyObject ptr, byval as PyObject ptr, byval as PyObject ptr)
  1623. extern PyOS_InputHook as function() as long
  1624. extern PyOS_ReadlineFunctionPointer as function(byval as FILE ptr, byval as FILE ptr, byval as const zstring ptr) as zstring ptr
  1625. const PYOS_STACK_MARGIN = 2048
  1626. #define Py_PYLIFECYCLE_H
  1627. declare sub Py_SetProgramName(byval as wstring ptr)
  1628. declare function Py_GetProgramName() as wstring ptr
  1629. declare sub Py_SetPythonHome(byval as wstring ptr)
  1630. declare function Py_GetPythonHome() as wstring ptr
  1631. declare sub Py_Initialize()
  1632. declare sub Py_InitializeEx(byval as long)
  1633. declare sub Py_Finalize()
  1634. declare function Py_IsInitialized() as long
  1635. declare function Py_NewInterpreter() as PyThreadState ptr
  1636. declare sub Py_EndInterpreter(byval as PyThreadState ptr)
  1637. declare function Py_AtExit(byval func as sub()) as long
  1638. declare sub Py_Exit(byval as long)
  1639. declare function Py_Main(byval argc as long, byval argv as wstring ptr ptr) as long
  1640. declare function Py_GetProgramFullPath() as wstring ptr
  1641. declare function Py_GetPrefix() as wstring ptr
  1642. declare function Py_GetExecPrefix() as wstring ptr
  1643. declare function Py_GetPath() as wstring ptr
  1644. declare sub Py_SetPath(byval as const wstring ptr)
  1645. declare function Py_GetVersion() as const zstring ptr
  1646. declare function Py_GetPlatform() as const zstring ptr
  1647. declare function Py_GetCopyright() as const zstring ptr
  1648. declare function Py_GetCompiler() as const zstring ptr
  1649. declare function Py_GetBuildInfo() as const zstring ptr
  1650. type PyOS_sighandler_t as sub(byval as long)
  1651. declare function PyOS_getsig(byval as long) as PyOS_sighandler_t
  1652. declare function PyOS_setsig(byval as long, byval as PyOS_sighandler_t) as PyOS_sighandler_t
  1653. declare function _PyOS_URandom(byval buffer as any ptr, byval size as Py_ssize_t) as long
  1654. #define Py_CEVAL_H
  1655. declare function PyEval_CallObjectWithKeywords(byval as PyObject ptr, byval as PyObject ptr, byval as PyObject ptr) as PyObject ptr
  1656. #define PyEval_CallObject(func, arg) PyEval_CallObjectWithKeywords(func, arg, cptr(PyObject ptr, NULL))
  1657. declare function PyEval_CallFunction(byval obj as PyObject ptr, byval format as const zstring ptr, ...) as PyObject ptr
  1658. declare function PyEval_CallMethod(byval obj as PyObject ptr, byval methodname as const zstring ptr, byval format as const zstring ptr, ...) as PyObject ptr
  1659. declare function PyEval_GetBuiltins() as PyObject ptr
  1660. declare function PyEval_GetGlobals() as PyObject ptr
  1661. declare function PyEval_GetLocals() as PyObject ptr
  1662. declare function PyEval_GetFrame() as PyObject ptr
  1663. declare function Py_AddPendingCall(byval func as function(byval as any ptr) as long, byval arg as any ptr) as long
  1664. declare function Py_MakePendingCalls() as long
  1665. declare sub Py_SetRecursionLimit(byval as long)
  1666. declare function Py_GetRecursionLimit() as long
  1667. #define Py_EnterRecursiveCall(where) (_Py_MakeRecCheck(PyThreadState_GET()->recursion_depth) andalso _Py_CheckRecursiveCall(where))
  1668. #macro Py_LeaveRecursiveCall()
  1669.     if _Py_MakeEndRecCheck(PyThreadState_GET()->recursion_depth) then
  1670.         PyThreadState_GET()->overflowed = 0
  1671.     end if
  1672. #endmacro
  1673. declare function _Py_CheckRecursiveCall(byval where as const zstring ptr) as long
  1674. extern _Py_CheckRecursionLimit as long
  1675. '' TODO: # define _Py_MakeRecCheck(x) (++(x) > _Py_CheckRecursionLimit)
  1676. #define _Py_RecursionLimitLowerWaterMark(limit) iif((limit) > 200, (limit) - 50, 3 * ((limit) shr 2))
  1677.  
  1678. '' TODO: #define _Py_MakeEndRecCheck(x) (--(x) < _Py_RecursionLimitLowerWaterMark(_Py_CheckRecursionLimit))
  1679. '' TODO: #define Py_ALLOW_RECURSION do { unsigned char _old = PyThreadState_GET()->recursion_critical; PyThreadState_GET()->recursion_critical = 1;
  1680. '' TODO: #define Py_END_ALLOW_RECURSION PyThreadState_GET()->recursion_critical = _old; } while(0);
  1681.  
  1682. declare function PyEval_GetFuncName(byval as PyObject ptr) as const zstring ptr
  1683. declare function PyEval_GetFuncDesc(byval as PyObject ptr) as const zstring ptr
  1684. declare function PyEval_GetCallStats(byval as PyObject ptr) as PyObject ptr
  1685. declare function PyEval_EvalFrame(byval as PyObject ptr) as PyObject ptr
  1686. declare function PyEval_EvalFrameEx(byval f as PyObject ptr, byval exc as long) as PyObject ptr
  1687. declare function PyEval_SaveThread() as PyThreadState ptr
  1688. declare sub PyEval_RestoreThread(byval as PyThreadState ptr)
  1689. declare function PyEval_ThreadsInitialized() as long
  1690. declare sub PyEval_InitThreads()
  1691. declare sub _PyEval_FiniThreads()
  1692. declare sub PyEval_AcquireLock()
  1693. declare sub PyEval_ReleaseLock()
  1694. declare sub PyEval_AcquireThread(byval tstate as PyThreadState ptr)
  1695. declare sub PyEval_ReleaseThread(byval tstate as PyThreadState ptr)
  1696. declare sub PyEval_ReInitThreads()
  1697.  
  1698. '' TODO: #define Py_BEGIN_ALLOW_THREADS { PyThreadState *_save; _save = PyEval_SaveThread();
  1699. '' TODO: #define Py_BLOCK_THREADS PyEval_RestoreThread(_save);
  1700. '' TODO: #define Py_UNBLOCK_THREADS _save = PyEval_SaveThread();
  1701. '' TODO: #define Py_END_ALLOW_THREADS PyEval_RestoreThread(_save); }
  1702. #define Py_SYSMODULE_H
  1703.  
  1704. declare function PySys_GetObject(byval as const zstring ptr) as PyObject ptr
  1705. declare function PySys_SetObject(byval as const zstring ptr, byval as PyObject ptr) as long
  1706. declare function _PySys_SetObjectId(byval key as _Py_Identifier ptr, byval as PyObject ptr) as long
  1707. declare sub PySys_SetArgv(byval as long, byval as wstring ptr ptr)
  1708. declare sub PySys_SetArgvEx(byval as long, byval as wstring ptr ptr, byval as long)
  1709. declare sub PySys_SetPath(byval as const wstring ptr)
  1710. declare sub PySys_WriteStdout(byval format as const zstring ptr, ...)
  1711. declare sub PySys_WriteStderr(byval format as const zstring ptr, ...)
  1712. declare sub PySys_FormatStdout(byval format as const zstring ptr, ...)
  1713. declare sub PySys_FormatStderr(byval format as const zstring ptr, ...)
  1714. declare sub PySys_ResetWarnOptions()
  1715. declare sub PySys_AddWarnOption(byval as const wstring ptr)
  1716. declare sub PySys_AddWarnOptionUnicode(byval as PyObject ptr)
  1717. declare function PySys_HasWarnOptions() as long
  1718. declare sub PySys_AddXOption(byval as const wstring ptr)
  1719. declare function PySys_GetXOptions() as PyObject ptr
  1720. #define Py_INTRCHECK_H
  1721. declare function PyOS_InterruptOccurred() as long
  1722. declare sub PyOS_InitInterrupts()
  1723. declare sub PyOS_AfterFork()
  1724. declare function _PyOS_IsMainThread() as long
  1725. #define Py_IMPORT_H
  1726. declare sub _PyImportZip_Init()
  1727. declare function PyInit_imp() as PyObject ptr
  1728. declare function PyImport_GetMagicNumber() as clong
  1729. declare function PyImport_GetMagicTag() as const zstring ptr
  1730. declare function PyImport_ExecCodeModule(byval name as const zstring ptr, byval co as PyObject ptr) as PyObject ptr
  1731. declare function PyImport_ExecCodeModuleEx(byval name as const zstring ptr, byval co as PyObject ptr, byval pathname as const zstring ptr) as PyObject ptr
  1732. declare function PyImport_ExecCodeModuleWithPathnames(byval name as const zstring ptr, byval co as PyObject ptr, byval pathname as const zstring ptr, byval cpathname as const zstring ptr) as PyObject ptr
  1733. declare function PyImport_ExecCodeModuleObject(byval name as PyObject ptr, byval co as PyObject ptr, byval pathname as PyObject ptr, byval cpathname as PyObject ptr) as PyObject ptr
  1734. declare function PyImport_GetModuleDict() as PyObject ptr
  1735. declare function PyImport_AddModuleObject(byval name as PyObject ptr) as PyObject ptr
  1736. declare function PyImport_AddModule(byval name as const zstring ptr) as PyObject ptr
  1737. declare function PyImport_ImportModule(byval name as const zstring ptr) as PyObject ptr
  1738. declare function PyImport_ImportModuleNoBlock(byval name as const zstring ptr) as PyObject ptr
  1739. declare function PyImport_ImportModuleLevel(byval name as const zstring ptr, byval globals as PyObject ptr, byval locals as PyObject ptr, byval fromlist as PyObject ptr, byval level as long) as PyObject ptr
  1740. declare function PyImport_ImportModuleLevelObject(byval name as PyObject ptr, byval globals as PyObject ptr, byval locals as PyObject ptr, byval fromlist as PyObject ptr, byval level as long) as PyObject ptr
  1741. #define PyImport_ImportModuleEx(n, g, l, f) PyImport_ImportModuleLevel(n, g, l, f, 0)
  1742. declare function PyImport_GetImporter(byval path as PyObject ptr) as PyObject ptr
  1743. declare function PyImport_Import(byval name as PyObject ptr) as PyObject ptr
  1744. declare function PyImport_ReloadModule(byval m as PyObject ptr) as PyObject ptr
  1745. declare sub PyImport_Cleanup()
  1746. declare function PyImport_ImportFrozenModuleObject(byval name as PyObject ptr) as long
  1747. declare function PyImport_ImportFrozenModule(byval name as const zstring ptr) as long
  1748. extern PyNullImporter_Type as PyTypeObject
  1749. declare function PyImport_AppendInittab(byval name as const zstring ptr, byval initfunc as function() as PyObject ptr) as long
  1750.  
  1751. #define Py_ABSTRACTOBJECT_H
  1752. #define PyObject_DelAttrString(O, A) PyObject_SetAttrString((O), (A), NULL)
  1753. #define PyObject_DelAttr(O, A) PyObject_SetAttr((O), (A), NULL)
  1754.  
  1755. declare function PyObject_Call(byval callable_object as PyObject ptr, byval args as PyObject ptr, byval kw as PyObject ptr) as PyObject ptr
  1756. declare function PyObject_CallObject(byval callable_object as PyObject ptr, byval args as PyObject ptr) as PyObject ptr
  1757. declare function PyObject_CallFunction(byval callable_object as PyObject ptr, byval format as const zstring ptr, ...) as PyObject ptr
  1758. declare function PyObject_CallMethod(byval o as PyObject ptr, byval method as const zstring ptr, byval format as const zstring ptr, ...) as PyObject ptr
  1759. declare function _PyObject_CallMethodId(byval o as PyObject ptr, byval method as _Py_Identifier ptr, byval format as const zstring ptr, ...) as PyObject ptr
  1760. declare function _PyObject_CallFunction_SizeT(byval callable as PyObject ptr, byval format as const zstring ptr, ...) as PyObject ptr
  1761. declare function _PyObject_CallMethod_SizeT(byval o as PyObject ptr, byval name as const zstring ptr, byval format as const zstring ptr, ...) as PyObject ptr
  1762. declare function _PyObject_CallMethodId_SizeT(byval o as PyObject ptr, byval name as _Py_Identifier ptr, byval format as const zstring ptr, ...) as PyObject ptr
  1763. declare function PyObject_CallFunctionObjArgs(byval callable as PyObject ptr, ...) as PyObject ptr
  1764. declare function PyObject_CallMethodObjArgs(byval o as PyObject ptr, byval method as PyObject ptr, ...) as PyObject ptr
  1765. declare function _PyObject_CallMethodIdObjArgs(byval o as PyObject ptr, byval method as _Py_Identifier ptr, ...) as PyObject ptr
  1766. declare function PyObject_Type(byval o as PyObject ptr) as PyObject ptr
  1767. declare function PyObject_Size(byval o as PyObject ptr) as Py_ssize_t
  1768. #undef PyObject_Length
  1769. #undef PyObject_Length
  1770. declare function PyObject_Length(byval o as PyObject ptr) as Py_ssize_t
  1771. #undef PyObject_Length
  1772. declare function PyObject_Length alias "PyObject_Size"(byval o as PyObject ptr) as Py_ssize_t
  1773. declare function PyObject_GetItem(byval o as PyObject ptr, byval key as PyObject ptr) as PyObject ptr
  1774. declare function PyObject_SetItem(byval o as PyObject ptr, byval key as PyObject ptr, byval v as PyObject ptr) as long
  1775. declare function PyObject_DelItemString(byval o as PyObject ptr, byval key as const zstring ptr) as long
  1776. declare function PyObject_DelItem(byval o as PyObject ptr, byval key as PyObject ptr) as long
  1777. declare function PyObject_AsCharBuffer(byval obj as PyObject ptr, byval buffer as const zstring ptr ptr, byval buffer_len as Py_ssize_t ptr) as long
  1778. declare function PyObject_CheckReadBuffer(byval obj as PyObject ptr) as long
  1779. declare function PyObject_AsReadBuffer(byval obj as PyObject ptr, byval buffer as const any ptr ptr, byval buffer_len as Py_ssize_t ptr) as long
  1780. declare function PyObject_AsWriteBuffer(byval obj as PyObject ptr, byval buffer as any ptr ptr, byval buffer_len as Py_ssize_t ptr) as long
  1781. declare function PyObject_Format(byval obj as PyObject ptr, byval format_spec as PyObject ptr) as PyObject ptr
  1782. declare function PyObject_GetIter(byval as PyObject ptr) as PyObject ptr
  1783. #define PyIter_Check(obj) (((obj)->ob_type->tp_iternext <> NULL) andalso ((obj)->ob_type->tp_iternext <> (@_PyObject_NextNotImplemented)))
  1784. declare function PyIter_Next(byval as PyObject ptr) as PyObject ptr
  1785. declare function PyNumber_Check(byval o as PyObject ptr) as long
  1786. declare function PyNumber_Add(byval o1 as PyObject ptr, byval o2 as PyObject ptr) as PyObject ptr
  1787. declare function PyNumber_Subtract(byval o1 as PyObject ptr, byval o2 as PyObject ptr) as PyObject ptr
  1788. declare function PyNumber_Multiply(byval o1 as PyObject ptr, byval o2 as PyObject ptr) as PyObject ptr
  1789. declare function PyNumber_MatrixMultiply(byval o1 as PyObject ptr, byval o2 as PyObject ptr) as PyObject ptr
  1790. declare function PyNumber_FloorDivide(byval o1 as PyObject ptr, byval o2 as PyObject ptr) as PyObject ptr
  1791. declare function PyNumber_TrueDivide(byval o1 as PyObject ptr, byval o2 as PyObject ptr) as PyObject ptr
  1792. declare function PyNumber_Remainder(byval o1 as PyObject ptr, byval o2 as PyObject ptr) as PyObject ptr
  1793. declare function PyNumber_Divmod(byval o1 as PyObject ptr, byval o2 as PyObject ptr) as PyObject ptr
  1794. declare function PyNumber_Power(byval o1 as PyObject ptr, byval o2 as PyObject ptr, byval o3 as PyObject ptr) as PyObject ptr
  1795. declare function PyNumber_Negative(byval o as PyObject ptr) as PyObject ptr
  1796. declare function PyNumber_Positive(byval o as PyObject ptr) as PyObject ptr
  1797. declare function PyNumber_Absolute(byval o as PyObject ptr) as PyObject ptr
  1798. declare function PyNumber_Invert(byval o as PyObject ptr) as PyObject ptr
  1799. declare function PyNumber_Lshift(byval o1 as PyObject ptr, byval o2 as PyObject ptr) as PyObject ptr
  1800. declare function PyNumber_Rshift(byval o1 as PyObject ptr, byval o2 as PyObject ptr) as PyObject ptr
  1801. declare function PyNumber_And(byval o1 as PyObject ptr, byval o2 as PyObject ptr) as PyObject ptr
  1802. declare function PyNumber_Xor(byval o1 as PyObject ptr, byval o2 as PyObject ptr) as PyObject ptr
  1803. declare function PyNumber_Or(byval o1 as PyObject ptr, byval o2 as PyObject ptr) as PyObject ptr
  1804. #define PyIndex_Check(obj) (((obj)->ob_type->tp_as_number <> NULL) andalso ((obj)->ob_type->tp_as_number->nb_index <> NULL))
  1805. declare function PyNumber_Index(byval o as PyObject ptr) as PyObject ptr
  1806. declare function PyNumber_AsSsize_t(byval o as PyObject ptr, byval exc as PyObject ptr) as Py_ssize_t
  1807. declare function PyNumber_Long(byval o as PyObject ptr) as PyObject ptr
  1808. declare function PyNumber_Float(byval o as PyObject ptr) as PyObject ptr
  1809. declare function PyNumber_InPlaceAdd(byval o1 as PyObject ptr, byval o2 as PyObject ptr) as PyObject ptr
  1810. declare function PyNumber_InPlaceSubtract(byval o1 as PyObject ptr, byval o2 as PyObject ptr) as PyObject ptr
  1811. declare function PyNumber_InPlaceMultiply(byval o1 as PyObject ptr, byval o2 as PyObject ptr) as PyObject ptr
  1812. declare function PyNumber_InPlaceMatrixMultiply(byval o1 as PyObject ptr, byval o2 as PyObject ptr) as PyObject ptr
  1813. declare function PyNumber_InPlaceFloorDivide(byval o1 as PyObject ptr, byval o2 as PyObject ptr) as PyObject ptr
  1814. declare function PyNumber_InPlaceTrueDivide(byval o1 as PyObject ptr, byval o2 as PyObject ptr) as PyObject ptr
  1815. declare function PyNumber_InPlaceRemainder(byval o1 as PyObject ptr, byval o2 as PyObject ptr) as PyObject ptr
  1816. declare function PyNumber_InPlacePower(byval o1 as PyObject ptr, byval o2 as PyObject ptr, byval o3 as PyObject ptr) as PyObject ptr
  1817. declare function PyNumber_InPlaceLshift(byval o1 as PyObject ptr, byval o2 as PyObject ptr) as PyObject ptr
  1818. declare function PyNumber_InPlaceRshift(byval o1 as PyObject ptr, byval o2 as PyObject ptr) as PyObject ptr
  1819. declare function PyNumber_InPlaceAnd(byval o1 as PyObject ptr, byval o2 as PyObject ptr) as PyObject ptr
  1820. declare function PyNumber_InPlaceXor(byval o1 as PyObject ptr, byval o2 as PyObject ptr) as PyObject ptr
  1821. declare function PyNumber_InPlaceOr(byval o1 as PyObject ptr, byval o2 as PyObject ptr) as PyObject ptr
  1822. declare function PyNumber_ToBase(byval n as PyObject ptr, byval base as long) as PyObject ptr
  1823. declare function PySequence_Check(byval o as PyObject ptr) as long
  1824. declare function PySequence_Size(byval o as PyObject ptr) as Py_ssize_t
  1825. #undef PySequence_Length
  1826. #undef PySequence_Length
  1827. declare function PySequence_Length(byval o as PyObject ptr) as Py_ssize_t
  1828. #undef PySequence_Length
  1829. declare function PySequence_Length alias "PySequence_Size"(byval o as PyObject ptr) as Py_ssize_t
  1830. declare function PySequence_Concat(byval o1 as PyObject ptr, byval o2 as PyObject ptr) as PyObject ptr
  1831. declare function PySequence_Repeat(byval o as PyObject ptr, byval count as Py_ssize_t) as PyObject ptr
  1832. declare function PySequence_GetItem(byval o as PyObject ptr, byval i as Py_ssize_t) as PyObject ptr
  1833. declare function PySequence_GetSlice(byval o as PyObject ptr, byval i1 as Py_ssize_t, byval i2 as Py_ssize_t) as PyObject ptr
  1834. declare function PySequence_SetItem(byval o as PyObject ptr, byval i as Py_ssize_t, byval v as PyObject ptr) as long
  1835. declare function PySequence_DelItem(byval o as PyObject ptr, byval i as Py_ssize_t) as long
  1836. declare function PySequence_SetSlice(byval o as PyObject ptr, byval i1 as Py_ssize_t, byval i2 as Py_ssize_t, byval v as PyObject ptr) as long
  1837. declare function PySequence_DelSlice(byval o as PyObject ptr, byval i1 as Py_ssize_t, byval i2 as Py_ssize_t) as long
  1838. declare function PySequence_Tuple(byval o as PyObject ptr) as PyObject ptr
  1839. declare function PySequence_List(byval o as PyObject ptr) as PyObject ptr
  1840. declare function PySequence_Fast(byval o as PyObject ptr, byval m as const zstring ptr) as PyObject ptr
  1841.  
  1842. #define PySequence_Fast_GET_SIZE(o) iif(PyList_Check(o), PyList_GET_SIZE(o), PyTuple_GET_SIZE(o))
  1843. #define PySequence_Fast_GET_ITEM(o, i) iif(PyList_Check(o), PyList_GET_ITEM(o, i), PyTuple_GET_ITEM(o, i))
  1844. #define PySequence_ITEM(o, i) Py_TYPE(o)->tp_as_sequence->sq_item(o, i)
  1845. #define PySequence_Fast_ITEMS(sf) iif(PyList_Check(sf), cptr(PyListObject ptr, (sf))->ob_item, cptr(PyTupleObject ptr, (sf))->ob_item)
  1846. declare function PySequence_Count(byval o as PyObject ptr, byval value as PyObject ptr) as Py_ssize_t
  1847. declare function PySequence_Contains(byval seq as PyObject ptr, byval ob as PyObject ptr) as long
  1848. #undef PySequence_In
  1849. #undef PySequence_In
  1850. declare function PySequence_In(byval o as PyObject ptr, byval value as PyObject ptr) as long
  1851. #undef PySequence_In
  1852.  
  1853. declare function PySequence_In alias "PySequence_Contains"(byval seq as PyObject ptr, byval ob as PyObject ptr) as long
  1854. declare function PySequence_Index(byval o as PyObject ptr, byval value as PyObject ptr) as Py_ssize_t
  1855. declare function PySequence_InPlaceConcat(byval o1 as PyObject ptr, byval o2 as PyObject ptr) as PyObject ptr
  1856. declare function PySequence_InPlaceRepeat(byval o as PyObject ptr, byval count as Py_ssize_t) as PyObject ptr
  1857. declare function PyMapping_Check(byval o as PyObject ptr) as long
  1858. declare function PyMapping_Size(byval o as PyObject ptr) as Py_ssize_t
  1859. #undef PyMapping_Length
  1860. #undef PyMapping_Length
  1861. declare function PyMapping_Length(byval o as PyObject ptr) as Py_ssize_t
  1862. #undef PyMapping_Length
  1863. declare function PyMapping_Length alias "PyMapping_Size"(byval o as PyObject ptr) as Py_ssize_t
  1864. #define PyMapping_DelItemString(O, K) PyObject_DelItemString((O), (K))
  1865. #define PyMapping_DelItem(O, K) PyObject_DelItem((O), (K))
  1866. declare function PyMapping_HasKeyString(byval o as PyObject ptr, byval key as const zstring ptr) as long
  1867. declare function PyMapping_HasKey(byval o as PyObject ptr, byval key as PyObject ptr) as long
  1868. declare function PyMapping_Keys(byval o as PyObject ptr) as PyObject ptr
  1869. declare function PyMapping_Values(byval o as PyObject ptr) as PyObject ptr
  1870. declare function PyMapping_Items(byval o as PyObject ptr) as PyObject ptr
  1871. declare function PyMapping_GetItemString(byval o as PyObject ptr, byval key as const zstring ptr) as PyObject ptr
  1872. declare function PyMapping_SetItemString(byval o as PyObject ptr, byval key as const zstring ptr, byval value as PyObject ptr) as long
  1873. declare function PyObject_IsInstance(byval object as PyObject ptr, byval typeorclass as PyObject ptr) as long
  1874. declare function PyObject_IsSubclass(byval object as PyObject ptr, byval typeorclass as PyObject ptr) as long
  1875. declare sub _Py_add_one_to_index_F(byval nd as long, byval index as Py_ssize_t ptr, byval shape as const Py_ssize_t ptr)
  1876. declare sub _Py_add_one_to_index_C(byval nd as long, byval index as Py_ssize_t ptr, byval shape as const Py_ssize_t ptr)
  1877. #define Py_BLTINMODULE_H
  1878.  
  1879. extern PyFilter_Type as PyTypeObject
  1880. extern PyMap_Type as PyTypeObject
  1881. extern PyZip_Type as PyTypeObject
  1882.  
  1883. #define Py_COMPILE_H
  1884. const Py_single_input = 256
  1885. const Py_file_input = 257
  1886. const Py_eval_input = 258
  1887. #define Py_EVAL_H
  1888. declare function PyEval_EvalCode(byval as PyObject ptr, byval as PyObject ptr, byval as PyObject ptr) as PyObject ptr
  1889. declare function PyEval_EvalCodeEx(byval co as PyObject ptr, byval globals as PyObject ptr, byval locals as PyObject ptr, byval args as PyObject ptr ptr, byval argc as long, byval kwds as PyObject ptr ptr, byval kwdc as long, byval defs as PyObject ptr ptr, byval defc as long, byval kwdefs as PyObject ptr, byval closure as PyObject ptr) as PyObject ptr
  1890. #define Py_STRTOD_H
  1891. declare function PyOS_string_to_double(byval str as const zstring ptr, byval endptr as zstring ptr ptr, byval overflow_exception as PyObject ptr) as double
  1892. declare function PyOS_double_to_string(byval val as double, byval format_code as byte, byval precision as long, byval flags as long, byval type as long ptr) as zstring ptr
  1893. const Py_DTSF_SIGN = &h01
  1894. const Py_DTSF_ADD_DOT_0 = &h02
  1895. const Py_DTSF_ALT = &h04
  1896. const Py_DTST_FINITE = 0
  1897. const Py_DTST_INFINITE = 1
  1898. const Py_DTST_NAN = 2
  1899. #define Py_STRCMP_H
  1900.  
  1901. declare function PyOS_mystrnicmp(byval as const zstring ptr, byval as const zstring ptr, byval as Py_ssize_t) as long
  1902. declare function PyOS_mystricmp(byval as const zstring ptr, byval as const zstring ptr) as long
  1903. declare function PyOS_strnicmp alias "PyOS_mystrnicmp"(byval as const zstring ptr, byval as const zstring ptr, byval as Py_ssize_t) as long
  1904. declare function PyOS_stricmp alias "PyOS_mystricmp"(byval as const zstring ptr, byval as const zstring ptr) as long
  1905. #define Py_FILEUTILS_H
  1906. declare function _Py_device_encoding(byval as long) as PyObject ptr
  1907. declare function Py_DecodeLocale(byval arg as const zstring ptr, byval size as uinteger ptr) as wstring ptr
  1908. declare function Py_EncodeLocale(byval text as const wstring ptr, byval error_pos as uinteger ptr) as zstring ptr
  1909. declare function _Py_wfopen(byval path as const wstring ptr, byval mode as const wstring ptr) as FILE ptr
  1910. declare function _Py_fopen(byval pathname as const zstring ptr, byval mode as const zstring ptr) as FILE ptr
  1911. declare function _Py_fopen_obj(byval path as PyObject ptr, byval mode as const zstring ptr) as FILE ptr
  1912. declare function _Py_read(byval fd as long, byval buf as any ptr, byval count as uinteger) as Py_ssize_t
  1913. declare function _Py_write(byval fd as long, byval buf as const any ptr, byval count as uinteger) as Py_ssize_t
  1914. declare function _Py_write_noraise(byval fd as long, byval buf as const any ptr, byval count as uinteger) as Py_ssize_t
  1915. declare function _Py_wreadlink(byval path as const wstring ptr, byval buf as wstring ptr, byval bufsiz_ as uinteger) as long
  1916. declare function _Py_wrealpath(byval path as const wstring ptr, byval resolved_path as wstring ptr, byval resolved_path_size as uinteger) as wstring ptr
  1917. declare function _Py_wgetcwd(byval buf as wstring ptr, byval size as uinteger) as wstring ptr
  1918.  
  1919. #define Py_PYFPE_H
  1920. #define PyFPE_START_PROTECT(err_string, leave_stmt)
  1921. #define PyFPE_END_PROTECT(v)
  1922. #define Py_STRUCTMEMBER_H
  1923.  
  1924. type PyMemberDef_
  1925.     name as zstring ptr
  1926.     as long type
  1927.     offset as Py_ssize_t
  1928.     flags as long
  1929.     doc as zstring ptr
  1930. end type
  1931.  
  1932. const T_SHORT = 0
  1933. const T_INT = 1
  1934. const T_LONG = 2
  1935. const T_FLOAT = 3
  1936. const T_DOUBLE = 4
  1937. const T_STRING = 5
  1938. const T_OBJECT = 6
  1939. const T_CHAR = 7
  1940. const T_BYTE = 8
  1941. const T_UBYTE = 9
  1942. const T_USHORT = 10
  1943. const T_UINT = 11
  1944. const T_ULONG = 12
  1945. const T_STRING_INPLACE = 13
  1946. const T_BOOL = 14
  1947. const T_OBJECT_EX = 16
  1948. const T_LONGLONG = 17
  1949. const T_ULONGLONG = 18
  1950. const T_PYSSIZET = 19
  1951. const T_NONE = 20
  1952. const READONLY = 1
  1953. const READ_RESTRICTED = 2
  1954. const PY_WRITE_RESTRICTED = 4
  1955. const RESTRICTED = READ_RESTRICTED or PY_WRITE_RESTRICTED
  1956. declare function PyMember_GetOne(byval as const zstring ptr, byval as PyMemberDef ptr) as PyObject ptr
  1957. declare function PyMember_SetOne(byval as zstring ptr, byval as PyMemberDef ptr, byval as PyObject ptr) as long
  1958. #define Py_NODE_H
  1959.  
  1960. type _node_
  1961.     n_type as short
  1962.     n_str as zstring ptr
  1963.     n_lineno as long
  1964.     n_col_offset as long
  1965.     n_nchildren as long
  1966.     n_child as _node ptr
  1967. end type
  1968.  
  1969. type node as _node
  1970. declare function PyNode_New(byval type as long) as node ptr
  1971. declare function PyNode_AddChild(byval n as node ptr, byval type as long, byval str as zstring ptr, byval lineno as long, byval col_offset as long) as long
  1972. declare sub PyNode_Free(byval n as node ptr)
  1973.  
  1974. #define NCH(n) (n)->n_nchildren
  1975. #define CHILD(n, i) (@(n)->n_child[i])
  1976. #define RCHILD(n, i) CHILD(n, NCH(n) + i)
  1977. #define TYPE_(n) (n)->n_type
  1978. #define STR_(n) (n)->n_str
  1979. #define LINENO(n) (n)->n_lineno
  1980. #define REQ(n, type) assert(-(TYPE_(n) = (type)))
  1981. declare sub PyNode_ListTree(byval as node ptr)
  1982.  
  1983. end extern
Advertisement
Add Comment
Please, Sign In to add comment