jpayne@69: #ifndef Py_CPYTHON_DICTOBJECT_H jpayne@69: # error "this header file must not be included directly" jpayne@69: #endif jpayne@69: jpayne@69: #ifdef __cplusplus jpayne@69: extern "C" { jpayne@69: #endif jpayne@69: jpayne@69: typedef struct _dictkeysobject PyDictKeysObject; jpayne@69: jpayne@69: /* The ma_values pointer is NULL for a combined table jpayne@69: * or points to an array of PyObject* for a split table jpayne@69: */ jpayne@69: typedef struct { jpayne@69: PyObject_HEAD jpayne@69: jpayne@69: /* Number of items in the dictionary */ jpayne@69: Py_ssize_t ma_used; jpayne@69: jpayne@69: /* Dictionary version: globally unique, value change each time jpayne@69: the dictionary is modified */ jpayne@69: uint64_t ma_version_tag; jpayne@69: jpayne@69: PyDictKeysObject *ma_keys; jpayne@69: jpayne@69: /* If ma_values is NULL, the table is "combined": keys and values jpayne@69: are stored in ma_keys. jpayne@69: jpayne@69: If ma_values is not NULL, the table is splitted: jpayne@69: keys are stored in ma_keys and values are stored in ma_values */ jpayne@69: PyObject **ma_values; jpayne@69: } PyDictObject; jpayne@69: jpayne@69: PyAPI_FUNC(PyObject *) _PyDict_GetItem_KnownHash(PyObject *mp, PyObject *key, jpayne@69: Py_hash_t hash); jpayne@69: PyAPI_FUNC(PyObject *) _PyDict_GetItemIdWithError(PyObject *dp, jpayne@69: struct _Py_Identifier *key); jpayne@69: PyAPI_FUNC(PyObject *) _PyDict_GetItemStringWithError(PyObject *, const char *); jpayne@69: PyAPI_FUNC(PyObject *) PyDict_SetDefault( jpayne@69: PyObject *mp, PyObject *key, PyObject *defaultobj); jpayne@69: PyAPI_FUNC(int) _PyDict_SetItem_KnownHash(PyObject *mp, PyObject *key, jpayne@69: PyObject *item, Py_hash_t hash); jpayne@69: PyAPI_FUNC(int) _PyDict_DelItem_KnownHash(PyObject *mp, PyObject *key, jpayne@69: Py_hash_t hash); jpayne@69: PyAPI_FUNC(int) _PyDict_DelItemIf(PyObject *mp, PyObject *key, jpayne@69: int (*predicate)(PyObject *value)); jpayne@69: PyDictKeysObject *_PyDict_NewKeysForClass(void); jpayne@69: PyAPI_FUNC(PyObject *) PyObject_GenericGetDict(PyObject *, void *); jpayne@69: PyAPI_FUNC(int) _PyDict_Next( jpayne@69: PyObject *mp, Py_ssize_t *pos, PyObject **key, PyObject **value, Py_hash_t *hash); jpayne@69: jpayne@69: /* Get the number of items of a dictionary. */ jpayne@69: #define PyDict_GET_SIZE(mp) (assert(PyDict_Check(mp)),((PyDictObject *)mp)->ma_used) jpayne@69: PyAPI_FUNC(int) _PyDict_Contains(PyObject *mp, PyObject *key, Py_hash_t hash); jpayne@69: PyAPI_FUNC(PyObject *) _PyDict_NewPresized(Py_ssize_t minused); jpayne@69: PyAPI_FUNC(void) _PyDict_MaybeUntrack(PyObject *mp); jpayne@69: PyAPI_FUNC(int) _PyDict_HasOnlyStringKeys(PyObject *mp); jpayne@69: Py_ssize_t _PyDict_KeysSize(PyDictKeysObject *keys); jpayne@69: PyAPI_FUNC(Py_ssize_t) _PyDict_SizeOf(PyDictObject *); jpayne@69: PyAPI_FUNC(PyObject *) _PyDict_Pop(PyObject *, PyObject *, PyObject *); jpayne@69: PyObject *_PyDict_Pop_KnownHash(PyObject *, PyObject *, Py_hash_t, PyObject *); jpayne@69: PyObject *_PyDict_FromKeys(PyObject *, PyObject *, PyObject *); jpayne@69: #define _PyDict_HasSplitTable(d) ((d)->ma_values != NULL) jpayne@69: jpayne@69: PyAPI_FUNC(int) PyDict_ClearFreeList(void); jpayne@69: jpayne@69: /* Like PyDict_Merge, but override can be 0, 1 or 2. If override is 0, jpayne@69: the first occurrence of a key wins, if override is 1, the last occurrence jpayne@69: of a key wins, if override is 2, a KeyError with conflicting key as jpayne@69: argument is raised. jpayne@69: */ jpayne@69: PyAPI_FUNC(int) _PyDict_MergeEx(PyObject *mp, PyObject *other, int override); jpayne@69: PyAPI_FUNC(PyObject *) _PyDict_GetItemId(PyObject *dp, struct _Py_Identifier *key); jpayne@69: PyAPI_FUNC(int) _PyDict_SetItemId(PyObject *dp, struct _Py_Identifier *key, PyObject *item); jpayne@69: jpayne@69: PyAPI_FUNC(int) _PyDict_DelItemId(PyObject *mp, struct _Py_Identifier *key); jpayne@69: PyAPI_FUNC(void) _PyDict_DebugMallocStats(FILE *out); jpayne@69: jpayne@69: int _PyObjectDict_SetItem(PyTypeObject *tp, PyObject **dictptr, PyObject *name, PyObject *value); jpayne@69: PyObject *_PyDict_LoadGlobal(PyDictObject *, PyDictObject *, PyObject *); jpayne@69: jpayne@69: /* _PyDictView */ jpayne@69: jpayne@69: typedef struct { jpayne@69: PyObject_HEAD jpayne@69: PyDictObject *dv_dict; jpayne@69: } _PyDictViewObject; jpayne@69: jpayne@69: PyAPI_FUNC(PyObject *) _PyDictView_New(PyObject *, PyTypeObject *); jpayne@69: PyAPI_FUNC(PyObject *) _PyDictView_Intersect(PyObject* self, PyObject *other); jpayne@69: jpayne@69: #ifdef __cplusplus jpayne@69: } jpayne@69: #endif