~ubuntu-branches/ubuntu/karmic/pypy/karmic

« back to all changes in this revision

Viewing changes to pypy/translator/c/src/debuginfo.h

  • Committer: Bazaar Package Importer
  • Author(s): Alexandre Fayolle
  • Date: 2007-04-13 09:33:09 UTC
  • Revision ID: james.westby@ubuntu.com-20070413093309-yoojh4jcoocu2krz
Tags: upstream-1.0.0
ImportĀ upstreamĀ versionĀ 1.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
 
2
/************************************************************/
 
3
 /***  C header subsection: debugging info                 ***/
 
4
 
 
5
/* NOTE: this is not included by <g_include.h>.
 
6
   The #include is generated manually if needed. */
 
7
 
 
8
#undef METHODDEF_DEBUGINFO
 
9
#define METHODDEF_DEBUGINFO                                             \
 
10
                { "debuginfo_offset", debuginfo_offset, METH_VARARGS }, \
 
11
                { "debuginfo_global", debuginfo_global, METH_VARARGS }, \
 
12
                { "debuginfo_peek",   debuginfo_peek,   METH_VARARGS },
 
13
 
 
14
/* prototypes */
 
15
 
 
16
PyObject *debuginfo_offset(PyObject *self, PyObject *args);
 
17
PyObject *debuginfo_global(PyObject *self, PyObject *args);
 
18
PyObject *debuginfo_peek(PyObject *self, PyObject *args);
 
19
 
 
20
 
 
21
/* implementations */
 
22
 
 
23
#ifndef PYPY_NOT_MAIN_FILE
 
24
 
 
25
PyObject *debuginfo_offset(PyObject *self, PyObject *args)
 
26
{
 
27
        int index;
 
28
        if (!PyArg_ParseTuple(args, "i", &index))
 
29
                return NULL;
 
30
        return PyInt_FromLong(debuginfo_offsets[index]);
 
31
}
 
32
 
 
33
PyObject *debuginfo_global(PyObject *self, PyObject *args)
 
34
{
 
35
        int index;
 
36
        if (!PyArg_ParseTuple(args, "i", &index))
 
37
                return NULL;
 
38
        return PyLong_FromVoidPtr(debuginfo_globals[index]);
 
39
}
 
40
 
 
41
PyObject *debuginfo_peek(PyObject *self, PyObject *args)
 
42
{
 
43
        PyObject *o;
 
44
        int size;
 
45
        void *start;
 
46
        if (!PyArg_ParseTuple(args, "Oi", &o, &size))
 
47
                return NULL;
 
48
        start = PyLong_AsVoidPtr(o);
 
49
        if (PyErr_Occurred())
 
50
                return NULL;
 
51
        return PyString_FromStringAndSize((char *)start, size);
 
52
}
 
53
 
 
54
#endif /* PYPY_NOT_MAIN_FILE */