comparison src/toplev.cc @ 7923:c3d21b9b94b6

eliminate octave_call_stack member functions caller_user_script and caller_user_function, and unused difference_type args
author John W. Eaton <jwe@octave.org>
date Fri, 11 Jul 2008 15:43:10 -0400
parents f46e73bcb85b
children d74f996e005d
comparison
equal deleted inserted replaced
7922:935be827eaf8 7923:c3d21b9b94b6
110 110
111 return stmt ? stmt->column () : -1; 111 return stmt ? stmt->column () : -1;
112 } 112 }
113 113
114 int 114 int
115 octave_call_stack::do_caller_user_code_line (difference_type q) const 115 octave_call_stack::do_caller_user_code_line (void) const
116 { 116 {
117 int retval = -1; 117 int retval = -1;
118 118
119 const_iterator p = cs.end (); 119 const_iterator p = cs.end ();
120 120
138 138
139 return retval; 139 return retval;
140 } 140 }
141 141
142 int 142 int
143 octave_call_stack::do_caller_user_code_column (difference_type q) const 143 octave_call_stack::do_caller_user_code_column (void) const
144 { 144 {
145 int retval = -1; 145 int retval = -1;
146 146
147 const_iterator p = cs.end (); 147 const_iterator p = cs.end ();
148 148
202 curr_user_frame = retval - curr_user_frame - 1; 202 curr_user_frame = retval - curr_user_frame - 1;
203 203
204 return retval; 204 return retval;
205 } 205 }
206 206
207 octave_user_script * 207 octave_user_code *
208 octave_call_stack::do_caller_user_script (difference_type q) const 208 octave_call_stack::do_caller_user_code (size_t nskip) const
209 { 209 {
210 octave_user_script *retval = 0; 210 octave_user_code *retval = 0;
211 211
212 const_iterator p = cs.end (); 212 const_iterator p = cs.end ();
213 213
214 while (p != cs.begin ()) 214 while (p != cs.begin ())
215 { 215 {
216 const call_stack_elt& elt = *(--p); 216 const call_stack_elt& elt = *(--p);
217 217
218 octave_function *f = elt.fcn; 218 octave_function *f = elt.fcn;
219 219
220 if (f && f->is_user_script ())
221 {
222 retval = dynamic_cast<octave_user_script *> (f);
223 break;
224 }
225 }
226
227 return retval;
228 }
229
230 octave_user_function *
231 octave_call_stack::do_caller_user_function (difference_type q) const
232 {
233 octave_user_function *retval = 0;
234
235 const_iterator p = cs.end ();
236
237 while (p != cs.begin ())
238 {
239 const call_stack_elt& elt = *(--p);
240
241 octave_function *f = elt.fcn;
242
243 if (f && f->is_user_function ())
244 {
245 retval = dynamic_cast<octave_user_function *> (f);
246 break;
247 }
248 }
249
250 return retval;
251 }
252
253 octave_user_code *
254 octave_call_stack::do_caller_user_code (difference_type q) const
255 {
256 octave_user_code *retval = 0;
257
258 const_iterator p = cs.end ();
259
260 while (p != cs.begin ())
261 {
262 const call_stack_elt& elt = *(--p);
263
264 octave_function *f = elt.fcn;
265
266 if (f && f->is_user_code ()) 220 if (f && f->is_user_code ())
267 { 221 {
268 retval = dynamic_cast<octave_user_code *> (f); 222 if (nskip > 0)
269 break; 223 nskip--;
224 else
225 {
226 retval = dynamic_cast<octave_user_code *> (f);
227 break;
228 }
270 } 229 }
271 } 230 }
272 231
273 return retval; 232 return retval;
274 } 233 }