Mercurial > cpython-lru_cache-weakref
annotate Include/structmember.h @ 70817:dd775b1561ba
Fix markup.
| author | Georg Brandl <georg@python.org> |
|---|---|
| date | Tue, 14 Jun 2011 21:09:55 +0200 |
| parents | fefaa0e66fdd |
| children | 6322bf1647de |
| rev | line source |
|---|---|
|
1329
519c25039c6a
* Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents:
1257
diff
changeset
|
1 #ifndef Py_STRUCTMEMBER_H |
|
519c25039c6a
* Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents:
1257
diff
changeset
|
2 #define Py_STRUCTMEMBER_H |
|
519c25039c6a
* Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents:
1257
diff
changeset
|
3 #ifdef __cplusplus |
|
519c25039c6a
* Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents:
1257
diff
changeset
|
4 extern "C" { |
|
519c25039c6a
* Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents:
1257
diff
changeset
|
5 #endif |
|
519c25039c6a
* Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents:
1257
diff
changeset
|
6 |
| 145 | 7 |
| 86 | 8 /* Interface to map C struct members to Python object attributes */ |
| 9 | |
| 1991 | 10 #include <stddef.h> /* For offsetof */ |
| 11 | |
| 86 | 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 | |
|
42537
74a3c6826683
Remove support for __members__ and __methods__. There still might be
Neal Norwitz <nnorwitz@gmail.com>
parents:
42466
diff
changeset
|
22 /* An array of PyMemberDef structures defines the name, type and offset |
| 86 | 23 of selected members of a C structure. These can be read by |
|
42537
74a3c6826683
Remove support for __members__ and __methods__. There still might be
Neal Norwitz <nnorwitz@gmail.com>
parents:
42466
diff
changeset
|
24 PyMember_GetOne() and set by PyMember_SetOne() (except if their READONLY |
|
74a3c6826683
Remove support for __members__ and __methods__. There still might be
Neal Norwitz <nnorwitz@gmail.com>
parents:
42466
diff
changeset
|
25 flag is set). The array must be terminated with an entry whose name |
| 86 | 26 pointer is NULL. */ |
| 27 | |
|
20012
3faabf54b8b8
Add optional docstrings to member descriptors. For backwards
Guido van Rossum <guido@python.org>
parents:
19942
diff
changeset
|
28 typedef struct PyMemberDef { |
|
3faabf54b8b8
Add optional docstrings to member descriptors. For backwards
Guido van Rossum <guido@python.org>
parents:
19942
diff
changeset
|
29 /* Current version, use this */ |
|
3faabf54b8b8
Add optional docstrings to member descriptors. For backwards
Guido van Rossum <guido@python.org>
parents:
19942
diff
changeset
|
30 char *name; |
|
3faabf54b8b8
Add optional docstrings to member descriptors. For backwards
Guido van Rossum <guido@python.org>
parents:
19942
diff
changeset
|
31 int type; |
|
36516
7dc1fe77713f
Allow for ssize_t field offsets.
Martin v. Löwis <martin@v.loewis.de>
parents:
36114
diff
changeset
|
32 Py_ssize_t offset; |
|
20012
3faabf54b8b8
Add optional docstrings to member descriptors. For backwards
Guido van Rossum <guido@python.org>
parents:
19942
diff
changeset
|
33 int flags; |
|
3faabf54b8b8
Add optional docstrings to member descriptors. For backwards
Guido van Rossum <guido@python.org>
parents:
19942
diff
changeset
|
34 char *doc; |
|
3faabf54b8b8
Add optional docstrings to member descriptors. For backwards
Guido van Rossum <guido@python.org>
parents:
19942
diff
changeset
|
35 } PyMemberDef; |
|
3faabf54b8b8
Add optional docstrings to member descriptors. For backwards
Guido van Rossum <guido@python.org>
parents:
19942
diff
changeset
|
36 |
| 86 | 37 /* Types */ |
| 38 #define T_SHORT 0 | |
| 39 #define T_INT 1 | |
| 40 #define T_LONG 2 | |
| 41 #define T_FLOAT 3 | |
| 42 #define T_DOUBLE 4 | |
| 43 #define T_STRING 5 | |
| 44 #define T_OBJECT 6 | |
|
889
181409141a18
added BYTE, CHAR and unsigned variants
Guido van Rossum <guido@python.org>
parents:
790
diff
changeset
|
45 /* XXX the ordering here is weird for binary compatibility */ |
|
181409141a18
added BYTE, CHAR and unsigned variants
Guido van Rossum <guido@python.org>
parents:
790
diff
changeset
|
46 #define T_CHAR 7 /* 1-character string */ |
|
181409141a18
added BYTE, CHAR and unsigned variants
Guido van Rossum <guido@python.org>
parents:
790
diff
changeset
|
47 #define T_BYTE 8 /* 8-bit signed int */ |
|
181409141a18
added BYTE, CHAR and unsigned variants
Guido van Rossum <guido@python.org>
parents:
790
diff
changeset
|
48 /* unsigned variants: */ |
|
181409141a18
added BYTE, CHAR and unsigned variants
Guido van Rossum <guido@python.org>
parents:
790
diff
changeset
|
49 #define T_UBYTE 9 |
|
181409141a18
added BYTE, CHAR and unsigned variants
Guido van Rossum <guido@python.org>
parents:
790
diff
changeset
|
50 #define T_USHORT 10 |
|
181409141a18
added BYTE, CHAR and unsigned variants
Guido van Rossum <guido@python.org>
parents:
790
diff
changeset
|
51 #define T_UINT 11 |
|
181409141a18
added BYTE, CHAR and unsigned variants
Guido van Rossum <guido@python.org>
parents:
790
diff
changeset
|
52 #define T_ULONG 12 |
| 86 | 53 |
|
2023
3d431a521132
- Added ability to get at strings embedded in the struct
Jack Jansen <jack.jansen@cwi.nl>
parents:
1991
diff
changeset
|
54 /* Added by Jack: strings contained in the structure */ |
|
3d431a521132
- Added ability to get at strings embedded in the struct
Jack Jansen <jack.jansen@cwi.nl>
parents:
1991
diff
changeset
|
55 #define T_STRING_INPLACE 13 |
|
3d431a521132
- Added ability to get at strings embedded in the struct
Jack Jansen <jack.jansen@cwi.nl>
parents:
1991
diff
changeset
|
56 |
|
44885
fefaa0e66fdd
Merged revisions 60176-60209 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
43893
diff
changeset
|
57 /* Added by Lillo: bools contained in the structure (assumed char) */ |
|
fefaa0e66fdd
Merged revisions 60176-60209 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
43893
diff
changeset
|
58 #define T_BOOL 14 |
|
fefaa0e66fdd
Merged revisions 60176-60209 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
43893
diff
changeset
|
59 |
|
21187
ef6f692c76e2
Fix SF bug #486144: Uninitialized __slot__ vrbl is None.
Guido van Rossum <guido@python.org>
parents:
20012
diff
changeset
|
60 #define T_OBJECT_EX 16 /* Like T_OBJECT, but raises AttributeError |
|
ef6f692c76e2
Fix SF bug #486144: Uninitialized __slot__ vrbl is None.
Guido van Rossum <guido@python.org>
parents:
20012
diff
changeset
|
61 when the value is NULL, instead of |
|
ef6f692c76e2
Fix SF bug #486144: Uninitialized __slot__ vrbl is None.
Guido van Rossum <guido@python.org>
parents:
20012
diff
changeset
|
62 converting to None. */ |
|
34677
e9ffad6d8822
Patch #1115086: support PY_LONGLONG in structmember.
Martin v. Löwis <martin@v.loewis.de>
parents:
31504
diff
changeset
|
63 #ifdef HAVE_LONG_LONG |
|
e9ffad6d8822
Patch #1115086: support PY_LONGLONG in structmember.
Martin v. Löwis <martin@v.loewis.de>
parents:
31504
diff
changeset
|
64 #define T_LONGLONG 17 |
|
39536
8f5b9982beba
Completely get rid of PyClass and PyInstance.
Guido van Rossum <guido@python.org>
parents:
36516
diff
changeset
|
65 #define T_ULONGLONG 18 |
|
34677
e9ffad6d8822
Patch #1115086: support PY_LONGLONG in structmember.
Martin v. Löwis <martin@v.loewis.de>
parents:
31504
diff
changeset
|
66 #endif /* HAVE_LONG_LONG */ |
|
21187
ef6f692c76e2
Fix SF bug #486144: Uninitialized __slot__ vrbl is None.
Guido van Rossum <guido@python.org>
parents:
20012
diff
changeset
|
67 |
|
42466
3fc3cedc49ca
Merged revisions 56753-56781 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
42110
diff
changeset
|
68 #define T_PYSSIZET 19 /* Py_ssize_t */ |
|
42110
e4f649c4f457
Merged revisions 55962-56019 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
39536
diff
changeset
|
69 #define T_NONE 20 /* Value is always None */ |
|
39536
8f5b9982beba
Completely get rid of PyClass and PyInstance.
Guido van Rossum <guido@python.org>
parents:
36516
diff
changeset
|
70 |
|
42466
3fc3cedc49ca
Merged revisions 56753-56781 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
42110
diff
changeset
|
71 |
|
19942
8522b022f80a
Add support for restricting access based on restricted execution mode.
Guido van Rossum <guido@python.org>
parents:
14375
diff
changeset
|
72 /* Flags */ |
| 86 | 73 #define READONLY 1 |
|
19942
8522b022f80a
Add support for restricting access based on restricted execution mode.
Guido van Rossum <guido@python.org>
parents:
14375
diff
changeset
|
74 #define READ_RESTRICTED 2 |
|
43893
483e958d13c7
Fixed some build issues and updated docs.
Christian Heimes <christian@cheimes.de>
parents:
42537
diff
changeset
|
75 #define PY_WRITE_RESTRICTED 4 |
|
483e958d13c7
Fixed some build issues and updated docs.
Christian Heimes <christian@cheimes.de>
parents:
42537
diff
changeset
|
76 #define RESTRICTED (READ_RESTRICTED | PY_WRITE_RESTRICTED) |
|
19942
8522b022f80a
Add support for restricting access based on restricted execution mode.
Guido van Rossum <guido@python.org>
parents:
14375
diff
changeset
|
77 |
| 86 | 78 |
|
20012
3faabf54b8b8
Add optional docstrings to member descriptors. For backwards
Guido van Rossum <guido@python.org>
parents:
19942
diff
changeset
|
79 /* Current API, use this */ |
|
36114
e9a10f74cf88
const poisoning, spreading to fix new const warnings
Tim Peters <tim.peters@gmail.com>
parents:
34677
diff
changeset
|
80 PyAPI_FUNC(PyObject *) PyMember_GetOne(const char *, struct PyMemberDef *); |
|
24752
c1eb668525e1
Excise DL_EXPORT from Include.
Mark Hammond <mhammond@skippinet.com.au>
parents:
21187
diff
changeset
|
81 PyAPI_FUNC(int) PyMember_SetOne(char *, struct PyMemberDef *, PyObject *); |
|
20012
3faabf54b8b8
Add optional docstrings to member descriptors. For backwards
Guido van Rossum <guido@python.org>
parents:
19942
diff
changeset
|
82 |
|
3faabf54b8b8
Add optional docstrings to member descriptors. For backwards
Guido van Rossum <guido@python.org>
parents:
19942
diff
changeset
|
83 |
|
1329
519c25039c6a
* Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents:
1257
diff
changeset
|
84 #ifdef __cplusplus |
|
519c25039c6a
* Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents:
1257
diff
changeset
|
85 } |
|
519c25039c6a
* Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents:
1257
diff
changeset
|
86 #endif |
|
519c25039c6a
* Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents:
1257
diff
changeset
|
87 #endif /* !Py_STRUCTMEMBER_H */ |
