Mercurial > octave
comparison src/symtab.cc @ 9639:8d79f36ebdde
store scope->function pointer
author | Jaroslav Hajek <highegg@gmail.com> |
---|---|
date | Mon, 14 Sep 2009 11:23:54 +0200 |
parents | a9b37bae1802 |
children | 633f9d837982 |
comparison
equal
deleted
inserted
replaced
9638:5d49ff601e9b | 9639:8d79f36ebdde |
---|---|
39 #include "ov-fcn.h" | 39 #include "ov-fcn.h" |
40 #include "ov-usr-fcn.h" | 40 #include "ov-usr-fcn.h" |
41 #include "pager.h" | 41 #include "pager.h" |
42 #include "parse.h" | 42 #include "parse.h" |
43 #include "pt-arg-list.h" | 43 #include "pt-arg-list.h" |
44 #include "toplev.h" | |
45 #include "unwind-prot.h" | 44 #include "unwind-prot.h" |
46 #include "utils.h" | 45 #include "utils.h" |
47 #include "debug.h" | 46 #include "debug.h" |
48 | 47 |
49 symbol_table *symbol_table::instance = 0; | 48 symbol_table *symbol_table::instance = 0; |
533 // subfunctions if we are currently executing a function defined | 532 // subfunctions if we are currently executing a function defined |
534 // from a .m file. | 533 // from a .m file. |
535 | 534 |
536 scope_val_iterator r = subfunctions.find (xcurrent_scope); | 535 scope_val_iterator r = subfunctions.find (xcurrent_scope); |
537 | 536 |
538 octave_function *curr_fcn = 0; | 537 octave_user_function *curr_fcn = symbol_table::get_curr_fcn (); |
539 | 538 |
540 if (r != subfunctions.end ()) | 539 if (r != subfunctions.end ()) |
541 { | 540 { |
542 // FIXME -- out-of-date check here. | 541 // FIXME -- out-of-date check here. |
543 | 542 |
544 return r->second; | 543 return r->second; |
545 } | 544 } |
546 else | 545 else |
547 { | 546 { |
548 curr_fcn = octave_call_stack::current (); | |
549 | |
550 if (curr_fcn) | 547 if (curr_fcn) |
551 { | 548 { |
552 scope_id pscope = curr_fcn->parent_fcn_scope (); | 549 scope_id pscope = curr_fcn->parent_fcn_scope (); |
553 | 550 |
554 if (pscope > 0) | 551 if (pscope > 0) |
564 } | 561 } |
565 } | 562 } |
566 } | 563 } |
567 | 564 |
568 // Private function. | 565 // Private function. |
569 | |
570 if (! curr_fcn) | |
571 curr_fcn = octave_call_stack::current (); | |
572 | 566 |
573 if (curr_fcn) | 567 if (curr_fcn) |
574 { | 568 { |
575 std::string dir_name = curr_fcn->dir_name (); | 569 std::string dir_name = curr_fcn->dir_name (); |
576 | 570 |
763 if (cmdline_function.is_defined ()) | 757 if (cmdline_function.is_defined ()) |
764 return cmdline_function; | 758 return cmdline_function; |
765 | 759 |
766 // Private function. | 760 // Private function. |
767 | 761 |
768 octave_function *curr_fcn = octave_call_stack::current (); | 762 octave_user_function *curr_fcn = symbol_table::get_curr_fcn (); |
769 | 763 |
770 if (curr_fcn) | 764 if (curr_fcn) |
771 { | 765 { |
772 std::string dir_name = curr_fcn->dir_name (); | 766 std::string dir_name = curr_fcn->dir_name (); |
773 | 767 |