~ubuntu-branches/debian/sid/meliae/sid

« back to all changes in this revision

Viewing changes to meliae/_scanner_core.h

  • Committer: Bazaar Package Importer
  • Author(s): Jelmer Vernooij
  • Date: 2009-12-19 18:23:37 UTC
  • Revision ID: james.westby@ubuntu.com-20091219182337-t09txw6ca1yfysn9
Tags: upstream-0.2.0
ImportĀ upstreamĀ versionĀ 0.2.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* Copyright (C) 2009 Canonical Ltd
 
2
 *
 
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.
 
7
 *
 
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.
 
12
 *
 
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
 
16
 */
 
17
 
 
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.
 
20
 */
 
21
 
 
22
#ifndef _SCANNER_CORE_H_
 
23
#define _SCANNER_CORE_H_
 
24
 
 
25
#include <Python.h>
 
26
#include <stdio.h>
 
27
 
 
28
/**
 
29
 * Compute the size of the data directly addressed by this object.
 
30
 *
 
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.
 
34
 */
 
35
extern Py_ssize_t _size_of(PyObject *c_obj);
 
36
 
 
37
/**
 
38
 * This callback will be used to dump more info to the user.
 
39
 */
 
40
typedef void (*write_callback)(void *data, const char *bytes, size_t len);
 
41
 
 
42
/**
 
43
 * Write the information about this object to the file.
 
44
 */
 
45
extern void _dump_object_info(write_callback write, void *callee_data,
 
46
                              PyObject *c_obj, PyObject *nodump, int recurse);
 
47
 
 
48
/**
 
49
 * Clear out what the last object we dumped was.
 
50
 */
 
51
extern void _clear_last_dumped();
 
52
 
 
53
/**
 
54
 * Return a PyList of all objects referenced via tp_traverse.
 
55
 */
 
56
extern PyObject *_get_referents(PyObject *c_obj);
 
57
 
 
58
 
 
59
#endif // _SCANNER_CORE_H_
 
60