Whitespace normalization.
[python/dscho.git] / Include / weakrefobject.h
blob3503892e0e67d65e00280f1c312b879ef4d3c2b5
1 /* Weak references objects for Python. */
3 #ifndef Py_WEAKREFOBJECT_H
4 #define Py_WEAKREFOBJECT_H
5 #ifdef __cplusplus
6 extern "C" {
7 #endif
10 typedef struct _PyWeakReference PyWeakReference;
12 struct _PyWeakReference {
13 PyObject_HEAD
14 PyObject *wr_object;
15 PyObject *wr_callback;
16 long hash;
17 PyWeakReference *wr_prev;
18 PyWeakReference *wr_next;
21 PyAPI_DATA(PyTypeObject) _PyWeakref_RefType;
22 PyAPI_DATA(PyTypeObject) _PyWeakref_ProxyType;
23 PyAPI_DATA(PyTypeObject) _PyWeakref_CallableProxyType;
25 #define PyWeakref_CheckRef(op) PyObject_TypeCheck(op, &_PyWeakref_RefType)
26 #define PyWeakref_CheckRefExact(op) \
27 ((op)->ob_type == &_PyWeakref_RefType)
28 #define PyWeakref_CheckProxy(op) \
29 (((op)->ob_type == &_PyWeakref_ProxyType) || \
30 ((op)->ob_type == &_PyWeakref_CallableProxyType))
32 /* This macro calls PyWeakref_CheckRef() last since that can involve a
33 function call; this makes it more likely that the function call
34 will be avoided. */
35 #define PyWeakref_Check(op) \
36 (PyWeakref_CheckRef(op) || PyWeakref_CheckProxy(op))
39 PyAPI_FUNC(PyObject *) PyWeakref_NewRef(PyObject *ob,
40 PyObject *callback);
41 PyAPI_FUNC(PyObject *) PyWeakref_NewProxy(PyObject *ob,
42 PyObject *callback);
43 PyAPI_FUNC(PyObject *) PyWeakref_GetObject(PyObject *ref);
45 PyAPI_FUNC(long) _PyWeakref_GetWeakrefCount(PyWeakReference *head);
47 PyAPI_FUNC(void) _PyWeakref_ClearRef(PyWeakReference *self);
49 #define PyWeakref_GET_OBJECT(ref) (((PyWeakReference *)(ref))->wr_object)
52 #ifdef __cplusplus
54 #endif
55 #endif /* !Py_WEAKREFOBJECT_H */