fbfc0bf128814af62e8f6fffe2f061b8a79dff21
[platform/upstream/rpm.git] / python / rpmdebug-py.c
1
2 extern PyTypeObject PyCode_Type;
3 extern PyTypeObject PyDictIter_Type;
4 extern PyTypeObject PyFrame_Type;
5
6 #include "header-py.h"  /* XXX debug only */
7 #include "rpmal-py.h"   /* XXX debug only */
8 #include "rpmds-py.h"   /* XXX debug only */
9 #include "rpmfd-py.h"   /* XXX debug only */
10 #include "rpmfi-py.h"   /* XXX debug only */
11 #include "rpmmi-py.h"   /* XXX debug only */
12 #include "rpmps-py.h"   /* XXX debug only */
13 #include "rpmmacro-py.h"        /* XXX debug only */
14 #include "rpmte-py.h"   /* XXX debug only */
15 #include "rpmts-py.h"   /* XXX debug only */
16
17 /**
18  */
19 static const char * lbl(void * s)
20 {
21     PyObject * o = s;
22
23     if (o == NULL)      return "null";
24
25     if (o == Py_None)   return "None";
26
27
28     if (o->ob_type == &PyType_Type)     return o->ob_type->tp_name;
29
30     if (o->ob_type == &PyBaseObject_Type)       return "BaseObj";
31     if (o->ob_type == &PyBuffer_Type)   return "Buffer";
32     if (o->ob_type == &PyCFunction_Type)        return "CFunction";
33     if (o->ob_type == &PyCObject_Type)  return "CObject";
34     if (o->ob_type == &PyCell_Type)     return "Cell";
35     if (o->ob_type == &PyClass_Type)    return "Class";
36     if (o->ob_type == &PyClassMethod_Type)      return "ClassMethod";
37     if (o->ob_type == &PyStaticMethod_Type)     return "StaticMethod";
38     if (o->ob_type == &PyCode_Type)     return "Code";
39     if (o->ob_type == &PyComplex_Type)  return "Complex";
40     if (o->ob_type == &PyDict_Type)     return "Dict";
41 #if PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION < 4
42     if (o->ob_type == &PyDictIter_Type) return "DictIter";
43 #endif
44     if (o->ob_type == &PyFile_Type)     return "File";
45     if (o->ob_type == &PyFloat_Type)    return "Float";
46     if (o->ob_type == &PyFrame_Type)    return "Frame";
47     if (o->ob_type == &PyFunction_Type) return "Function";
48     if (o->ob_type == &PyInstance_Type) return "Instance";
49     if (o->ob_type == &PyInt_Type)      return "Int";
50     if (o->ob_type == &PyList_Type)     return "List";
51     if (o->ob_type == &PyLong_Type)     return "Long";
52     if (o->ob_type == &PyMethod_Type)   return "Method";
53     if (o->ob_type == &PyWrapperDescr_Type)     return "WrapperDescr";
54     if (o->ob_type == &PyProperty_Type) return "Property";
55     if (o->ob_type == &PyModule_Type)   return "Module";
56     if (o->ob_type == &PyRange_Type)    return "Range";
57     if (o->ob_type == &PySeqIter_Type)  return "SeqIter";
58     if (o->ob_type == &PyCallIter_Type) return "CallIter";
59     if (o->ob_type == &PySlice_Type)    return "Slice";
60     if (o->ob_type == &PyString_Type)   return "String";
61     if (o->ob_type == &PySuper_Type)    return "Super";
62     if (o->ob_type == &PyTuple_Type)    return "Tuple";
63     if (o->ob_type == &PyType_Type)     return "Type";
64     if (o->ob_type == &PyUnicode_Type)  return "Unicode";
65
66     if (o->ob_type == &hdr_Type)        return "hdr";
67     if (o->ob_type == &rpmal_Type)      return "rpmal";
68     if (o->ob_type == &rpmds_Type)      return "rpmds";
69     if (o->ob_type == &rpmfd_Type)      return "rpmfd";
70     if (o->ob_type == &rpmfi_Type)      return "rpmfi";
71     if (o->ob_type == &rpmfts_Type)     return "rpmfts";
72     if (o->ob_type == &rpmmi_Type)      return "rpmmi";
73     if (o->ob_type == &rpmps_Type)      return "rpmps";
74     if (o->ob_type == &rpmte_Type)      return "rpmte";
75     if (o->ob_type == &rpmts_Type)      return "rpmts";
76
77     return "Unknown";
78 }