1
/* Copyright (C) 2009 Canonical Ltd
3
* This program is free software; you can redistribute it and/or modify
4
* it under the terms of the GNU General Public License as published by
5
* the Free Software Foundation; either version 2 of the License, or
6
* (at your option) any later version.
8
* This program is distributed in the hope that it will be useful,
9
* but WITHOUT ANY WARRANTY; without even the implied warranty of
10
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
* GNU General Public License for more details.
13
* You should have received a copy of the GNU General Public License
14
* along with this program; if not, write to the Free Software
15
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18
/* The core of parsing is split into a pure C module, so that we can guarantee
19
* that we won't be creating objects in the internal loops.
22
#ifndef _SCANNER_CORE_H_
23
#define _SCANNER_CORE_H_
29
* Compute the size of the data directly addressed by this object.
31
* For example, for a list, this is the number of bytes allocated plus the
32
* number of bytes for the basic list object. Note that lists over-allocate, so
33
* this is not strictly sizeof(pointer) * num_items.
35
extern Py_ssize_t _size_of(PyObject *c_obj);
38
* This callback will be used to dump more info to the user.
40
typedef void (*write_callback)(void *data, const char *bytes, size_t len);
43
* Write the information about this object to the file.
45
extern void _dump_object_info(write_callback write, void *callee_data,
46
PyObject *c_obj, PyObject *nodump, int recurse);
49
* Clear out what the last object we dumped was.
51
extern void _clear_last_dumped();
54
* Return a PyList of all objects referenced via tp_traverse.
56
extern PyObject *_get_referents(PyObject *c_obj);
59
#endif // _SCANNER_CORE_H_