-
-
Notifications
You must be signed in to change notification settings - Fork 51
/
Copy pathhpy.h
33 lines (24 loc) · 970 Bytes
/
hpy.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#ifndef HPY_UNIVERSAL_H
#define HPY_UNIVERSAL_H
#include <stdlib.h>
#include <stdint.h>
#include <stdarg.h>
typedef intptr_t HPy_ssize_t;
typedef struct { HPy_ssize_t _i; } HPy;
typedef struct _HPyContext_s *HPyContext;
struct _object; /* that's PyObject inside CPython */
typedef struct _object *(*_HPy_CPyCFunction)(struct _object *self,
struct _object *args);
#define _HPy_HIDDEN __attribute__((visibility("hidden")))
#define HPy_NULL ((HPy){0})
#define HPy_IsNull(x) ((x)._i == 0)
// XXX: we need to decide whether these are part of the official API or not,
// and maybe introduce a better naming convetion. For now, they are needed for
// ujson
static inline HPy HPy_FromVoidP(void *p) { return (HPy){(HPy_ssize_t)p}; }
static inline void* HPy_AsVoidP(HPy h) { return (void*)h._i; }
#include "meth.h"
#include "module.h"
#include "autogen_ctx.h"
#include "autogen_trampolines.h"
#endif /* HPY_UNIVERSAL_H */