annotate DEPENDENCIES/mingw32/Python27/include/structmember.h @ 118:770eb830ec19 emscripten

Typo fix
author Chris Cannam
date Wed, 18 May 2016 16:14:08 +0100
parents 2a2c65a20a8b
children
rev   line source
Chris@87 1 #ifndef Py_STRUCTMEMBER_H
Chris@87 2 #define Py_STRUCTMEMBER_H
Chris@87 3 #ifdef __cplusplus
Chris@87 4 extern "C" {
Chris@87 5 #endif
Chris@87 6
Chris@87 7
Chris@87 8 /* Interface to map C struct members to Python object attributes */
Chris@87 9
Chris@87 10 #include <stddef.h> /* For offsetof */
Chris@87 11
Chris@87 12 /* The offsetof() macro calculates the offset of a structure member
Chris@87 13 in its structure. Unfortunately this cannot be written down
Chris@87 14 portably, hence it is provided by a Standard C header file.
Chris@87 15 For pre-Standard C compilers, here is a version that usually works
Chris@87 16 (but watch out!): */
Chris@87 17
Chris@87 18 #ifndef offsetof
Chris@87 19 #define offsetof(type, member) ( (int) & ((type*)0) -> member )
Chris@87 20 #endif
Chris@87 21
Chris@87 22 /* An array of memberlist structures defines the name, type and offset
Chris@87 23 of selected members of a C structure. These can be read by
Chris@87 24 PyMember_Get() and set by PyMember_Set() (except if their READONLY flag
Chris@87 25 is set). The array must be terminated with an entry whose name
Chris@87 26 pointer is NULL. */
Chris@87 27
Chris@87 28 struct memberlist {
Chris@87 29 /* Obsolete version, for binary backwards compatibility */
Chris@87 30 char *name;
Chris@87 31 int type;
Chris@87 32 int offset;
Chris@87 33 int flags;
Chris@87 34 };
Chris@87 35
Chris@87 36 typedef struct PyMemberDef {
Chris@87 37 /* Current version, use this */
Chris@87 38 char *name;
Chris@87 39 int type;
Chris@87 40 Py_ssize_t offset;
Chris@87 41 int flags;
Chris@87 42 char *doc;
Chris@87 43 } PyMemberDef;
Chris@87 44
Chris@87 45 /* Types */
Chris@87 46 #define T_SHORT 0
Chris@87 47 #define T_INT 1
Chris@87 48 #define T_LONG 2
Chris@87 49 #define T_FLOAT 3
Chris@87 50 #define T_DOUBLE 4
Chris@87 51 #define T_STRING 5
Chris@87 52 #define T_OBJECT 6
Chris@87 53 /* XXX the ordering here is weird for binary compatibility */
Chris@87 54 #define T_CHAR 7 /* 1-character string */
Chris@87 55 #define T_BYTE 8 /* 8-bit signed int */
Chris@87 56 /* unsigned variants: */
Chris@87 57 #define T_UBYTE 9
Chris@87 58 #define T_USHORT 10
Chris@87 59 #define T_UINT 11
Chris@87 60 #define T_ULONG 12
Chris@87 61
Chris@87 62 /* Added by Jack: strings contained in the structure */
Chris@87 63 #define T_STRING_INPLACE 13
Chris@87 64
Chris@87 65 /* Added by Lillo: bools contained in the structure (assumed char) */
Chris@87 66 #define T_BOOL 14
Chris@87 67
Chris@87 68 #define T_OBJECT_EX 16 /* Like T_OBJECT, but raises AttributeError
Chris@87 69 when the value is NULL, instead of
Chris@87 70 converting to None. */
Chris@87 71 #ifdef HAVE_LONG_LONG
Chris@87 72 #define T_LONGLONG 17
Chris@87 73 #define T_ULONGLONG 18
Chris@87 74 #endif /* HAVE_LONG_LONG */
Chris@87 75
Chris@87 76 #define T_PYSSIZET 19 /* Py_ssize_t */
Chris@87 77
Chris@87 78
Chris@87 79 /* Flags */
Chris@87 80 #define READONLY 1
Chris@87 81 #define RO READONLY /* Shorthand */
Chris@87 82 #define READ_RESTRICTED 2
Chris@87 83 #define PY_WRITE_RESTRICTED 4
Chris@87 84 #define RESTRICTED (READ_RESTRICTED | PY_WRITE_RESTRICTED)
Chris@87 85
Chris@87 86
Chris@87 87 /* Obsolete API, for binary backwards compatibility */
Chris@87 88 PyAPI_FUNC(PyObject *) PyMember_Get(const char *, struct memberlist *, const char *);
Chris@87 89 PyAPI_FUNC(int) PyMember_Set(char *, struct memberlist *, const char *, PyObject *);
Chris@87 90
Chris@87 91 /* Current API, use this */
Chris@87 92 PyAPI_FUNC(PyObject *) PyMember_GetOne(const char *, struct PyMemberDef *);
Chris@87 93 PyAPI_FUNC(int) PyMember_SetOne(char *, struct PyMemberDef *, PyObject *);
Chris@87 94
Chris@87 95
Chris@87 96 #ifdef __cplusplus
Chris@87 97 }
Chris@87 98 #endif
Chris@87 99 #endif /* !Py_STRUCTMEMBER_H */