Mercurial > hg > octave-lyh
comparison src/toplev.h @ 7890:73ef513855e7
dbstack fixes
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Tue, 17 Jun 2008 13:58:21 -0400 |
parents | 59031cfe331b |
children | 3e4c9b69069d |
comparison
equal
deleted
inserted
replaced
7889:76142609e8d2 | 7890:73ef513855e7 |
---|---|
152 static size_t current_frame (void) | 152 static size_t current_frame (void) |
153 { | 153 { |
154 return instance_ok () ? instance->do_current_frame () : 0; | 154 return instance_ok () ? instance->do_current_frame () : 0; |
155 } | 155 } |
156 | 156 |
157 static size_t size (void) | |
158 { | |
159 return instance_ok () ? instance->do_size () : 0; | |
160 } | |
161 | |
157 // Function at location N on the call stack (N == 0 is current), may | 162 // Function at location N on the call stack (N == 0 is current), may |
158 // be built-in. | 163 // be built-in. |
159 static octave_function *element (size_t n) | 164 static octave_function *element (size_t n) |
160 { | 165 { |
161 return instance_ok () ? instance->do_element (n) : 0; | 166 return instance_ok () ? instance->do_element (n) : 0; |
253 | 258 |
254 int do_caller_user_code_column (difference_type q = 0) const; | 259 int do_caller_user_code_column (difference_type q = 0) const; |
255 | 260 |
256 size_t do_current_frame (void) { return curr_frame; } | 261 size_t do_current_frame (void) { return curr_frame; } |
257 | 262 |
263 size_t do_size (void) { return cs.size (); } | |
264 | |
258 octave_function *do_element (size_t n) | 265 octave_function *do_element (size_t n) |
259 { | 266 { |
260 octave_function *retval = 0; | 267 octave_function *retval = 0; |
261 | 268 |
262 if (cs.size () > n) | 269 if (cs.size () > n) |
275 octave_user_code *do_caller_user_code (difference_type q = 0) const; | 282 octave_user_code *do_caller_user_code (difference_type q = 0) const; |
276 | 283 |
277 void do_push (octave_function *f, symbol_table::scope_id scope, | 284 void do_push (octave_function *f, symbol_table::scope_id scope, |
278 symbol_table::context_id context) | 285 symbol_table::context_id context) |
279 { | 286 { |
280 if (Vdebugging) | 287 curr_frame++; |
281 curr_frame++; | 288 |
282 | 289 cs.push_back (call_stack_elt (f, scope, context)); |
283 cs.push_front (call_stack_elt (f, scope, context)); | |
284 } | 290 } |
285 | 291 |
286 octave_function *do_top (void) const | 292 octave_function *do_top (void) const |
287 { | 293 { |
288 octave_function *retval = 0; | 294 octave_function *retval = 0; |
289 | 295 |
290 if (! cs.empty ()) | 296 if (! cs.empty ()) |
291 { | 297 { |
292 const call_stack_elt& elt = cs.front (); | 298 const call_stack_elt& elt = cs.back (); |
293 retval = elt.fcn; | 299 retval = elt.fcn; |
294 } | 300 } |
295 | 301 |
296 return retval; | 302 return retval; |
297 } | 303 } |
300 { | 306 { |
301 tree_statement *retval = 0; | 307 tree_statement *retval = 0; |
302 | 308 |
303 if (! cs.empty ()) | 309 if (! cs.empty ()) |
304 { | 310 { |
305 const call_stack_elt& elt = cs.front (); | 311 const call_stack_elt& elt = cs.back (); |
306 retval = elt.stmt; | 312 retval = elt.stmt; |
307 } | 313 } |
308 | 314 |
309 return retval; | 315 return retval; |
310 } | 316 } |
311 | 317 |
312 void do_set_statement (tree_statement *s) | 318 void do_set_statement (tree_statement *s) |
313 { | 319 { |
314 if (! cs.empty ()) | 320 if (! cs.empty ()) |
315 { | 321 { |
316 call_stack_elt& elt = cs.front (); | 322 call_stack_elt& elt = cs.back (); |
323 | |
317 elt.stmt = s; | 324 elt.stmt = s; |
318 } | 325 } |
319 } | 326 } |
320 | 327 |
321 Octave_map do_backtrace (int n) const; | 328 Octave_map do_backtrace (int n) const; |
326 | 333 |
327 void do_pop (void) | 334 void do_pop (void) |
328 { | 335 { |
329 if (! cs.empty ()) | 336 if (! cs.empty ()) |
330 { | 337 { |
331 if (Vdebugging) | 338 curr_frame--; |
332 curr_frame--; | 339 |
333 | 340 cs.pop_back (); |
334 cs.pop_front (); | |
335 } | 341 } |
336 } | 342 } |
337 | 343 |
338 void do_clear (void) { cs.clear (); } | 344 void do_clear (void) { cs.clear (); } |
339 }; | 345 }; |