comparison Python/traceback.c @ 13658:f79434ee41fa legacy-trunk

Mass ANSIfication of function definitions. Doesn't cover all 'extern' declarations yet, those come later.
author Thomas Wouters <thomas@python.org>
date Sat, 22 Jul 2000 18:47:25 +0000
parents 87ee82e5c56d
children 6f6f965c5e2d
comparison
equal deleted inserted replaced
13657:6a5314a6c2c2 13658:f79434ee41fa
34 {"tb_lineno", T_INT, OFF(tb_lineno)}, 34 {"tb_lineno", T_INT, OFF(tb_lineno)},
35 {NULL} /* Sentinel */ 35 {NULL} /* Sentinel */
36 }; 36 };
37 37
38 static PyObject * 38 static PyObject *
39 tb_getattr(tb, name) 39 tb_getattr(tracebackobject *tb, char *name)
40 tracebackobject *tb;
41 char *name;
42 { 40 {
43 return PyMember_Get((char *)tb, tb_memberlist, name); 41 return PyMember_Get((char *)tb, tb_memberlist, name);
44 } 42 }
45 43
46 static void 44 static void
47 tb_dealloc(tb) 45 tb_dealloc(tracebackobject *tb)
48 tracebackobject *tb;
49 { 46 {
50 Py_TRASHCAN_SAFE_BEGIN(tb) 47 Py_TRASHCAN_SAFE_BEGIN(tb)
51 Py_XDECREF(tb->tb_next); 48 Py_XDECREF(tb->tb_next);
52 Py_XDECREF(tb->tb_frame); 49 Py_XDECREF(tb->tb_frame);
53 PyObject_DEL(tb); 50 PyObject_DEL(tb);
73 0, /*tp_as_sequence*/ 70 0, /*tp_as_sequence*/
74 0, /*tp_as_mapping*/ 71 0, /*tp_as_mapping*/
75 }; 72 };
76 73
77 static tracebackobject * 74 static tracebackobject *
78 newtracebackobject(next, frame, lasti, lineno) 75 newtracebackobject(tracebackobject *next, PyFrameObject *frame, int lasti,
79 tracebackobject *next; 76 int lineno)
80 PyFrameObject *frame;
81 int lasti, lineno;
82 { 77 {
83 tracebackobject *tb; 78 tracebackobject *tb;
84 if ((next != NULL && !is_tracebackobject(next)) || 79 if ((next != NULL && !is_tracebackobject(next)) ||
85 frame == NULL || !PyFrame_Check(frame)) { 80 frame == NULL || !PyFrame_Check(frame)) {
86 PyErr_BadInternalCall(); 81 PyErr_BadInternalCall();
97 } 92 }
98 return tb; 93 return tb;
99 } 94 }
100 95
101 int 96 int
102 PyTraceBack_Here(frame) 97 PyTraceBack_Here(PyFrameObject *frame)
103 PyFrameObject *frame;
104 { 98 {
105 PyThreadState *tstate = frame->f_tstate; 99 PyThreadState *tstate = frame->f_tstate;
106 tracebackobject *oldtb = (tracebackobject *) tstate->curexc_traceback; 100 tracebackobject *oldtb = (tracebackobject *) tstate->curexc_traceback;
107 tracebackobject *tb = newtracebackobject(oldtb, 101 tracebackobject *tb = newtracebackobject(oldtb,
108 frame, frame->f_lasti, frame->f_lineno); 102 frame, frame->f_lasti, frame->f_lineno);
112 Py_XDECREF(oldtb); 106 Py_XDECREF(oldtb);
113 return 0; 107 return 0;
114 } 108 }
115 109
116 static int 110 static int
117 tb_displayline(f, filename, lineno, name) 111 tb_displayline(PyObject *f, char *filename, int lineno, char *name)
118 PyObject *f;
119 char *filename;
120 int lineno;
121 char *name;
122 { 112 {
123 int err = 0; 113 int err = 0;
124 FILE *xfp; 114 FILE *xfp;
125 char linebuf[1000]; 115 char linebuf[1000];
126 int i; 116 int i;
204 fclose(xfp); 194 fclose(xfp);
205 return err; 195 return err;
206 } 196 }
207 197
208 static int 198 static int
209 tb_printinternal(tb, f, limit) 199 tb_printinternal(tracebackobject *tb, PyObject *f, int limit)
210 tracebackobject *tb;
211 PyObject *f;
212 int limit;
213 { 200 {
214 int err = 0; 201 int err = 0;
215 int depth = 0; 202 int depth = 0;
216 tracebackobject *tb1 = tb; 203 tracebackobject *tb1 = tb;
217 while (tb1 != NULL) { 204 while (tb1 != NULL) {
236 } 223 }
237 return err; 224 return err;
238 } 225 }
239 226
240 int 227 int
241 PyTraceBack_Print(v, f) 228 PyTraceBack_Print(PyObject *v, PyObject *f)
242 PyObject *v;
243 PyObject *f;
244 { 229 {
245 int err; 230 int err;
246 PyObject *limitv; 231 PyObject *limitv;
247 int limit = 1000; 232 int limit = 1000;
248 if (v == NULL) 233 if (v == NULL)