Debian Codegraph @

pypy/module/cpyext/include/structmember.h

raw symbols SCIP
1 #ifndef Py_STRUCTMEMBER_H
2 #define Py_STRUCTMEMBER_H
3 #ifdef __cplusplus
4 extern "C" {
5 #endif
6
7
8 /* Interface to map C struct members to Python object attributes */
9
10 #include <stddef.h> /* For offsetof */
11
12 /* The offsetof() macro calculates the offset of a structure member
13 in its structure. Unfortunately this cannot be written down
14 portably, hence it is provided by a Standard C header file.
15 For pre-Standard C compilers, here is a version that usually works
16 (but watch out!): */
17
18 #ifndef offsetof
19 #define offsetof(type, member) ( (int) & ((type*)0) -> member )
20 #endif
21
22
23 /* Types */
24 #define T_SHORT 0
25 #define T_INT 1
26 #define T_LONG 2
27 #define T_FLOAT 3
28 #define T_DOUBLE 4
29 #define T_STRING 5
30 #define T_OBJECT 6
31 /* XXX the ordering here is weird for binary compatibility */
32 #define T_CHAR 7 /* 1-character string */
33 #define T_BYTE 8 /* 8-bit signed int */
34 /* unsigned variants: */
35 #define T_UBYTE 9
36 #define T_USHORT 10
37 #define T_UINT 11
38 #define T_ULONG 12
39
40 /* Added by Jack: strings contained in the structure */
41 #define T_STRING_INPLACE 13
42
43 /* Added by Lillo: bools contained in the structure (assumed char) */
44 #define T_BOOL 14
45
46 #define T_OBJECT_EX 16 /* Like T_OBJECT, but raises AttributeError
47 when the value is NULL, instead of
48 converting to None. */
49 #ifdef HAVE_LONG_LONG
50 #define T_LONGLONG 17
51 #define T_ULONGLONG 18
52 #endif /* HAVE_LONG_LONG */
53
54 #define T_PYSSIZET 19 /* Py_ssize_t */
55
56 /* Flags. These constants are also in structmemberdefs.py. */
57 #define READONLY 1
58 #define RO READONLY /* Shorthand */
59 #define READ_RESTRICTED 2
60 #define PY_WRITE_RESTRICTED 4
61 #define RESTRICTED (READ_RESTRICTED | PY_WRITE_RESTRICTED)
62
63
64 /* API functions. */
65 /* Don't include them while building PyPy, RPython also generated signatures
66 * which are similar but not identical. */
67 #ifndef PYPY_STANDALONE
68 #include "pypy_structmember_decl.h"
69 #endif
70
71
72 #ifdef __cplusplus
73 }
74 #endif
75 #endif /* !Py_STRUCTMEMBER_H */
76