GNU Octave  8.1.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
symtab.cc
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 //
3 // Copyright (C) 1993-2023 The Octave Project Developers
4 //
5 // See the file COPYRIGHT.md in the top-level directory of this
6 // distribution or <https://octave.org/copyright/>.
7 //
8 // This file is part of Octave.
9 //
10 // Octave is free software: you can redistribute it and/or modify it
11 // under the terms of the GNU General Public License as published by
12 // the Free Software Foundation, either version 3 of the License, or
13 // (at your option) any later version.
14 //
15 // Octave is distributed in the hope that it will be useful, but
16 // WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 // GNU General Public License for more details.
19 //
20 // You should have received a copy of the GNU General Public License
21 // along with Octave; see the file COPYING. If not, see
22 // <https://www.gnu.org/licenses/>.
23 //
24 ////////////////////////////////////////////////////////////////////////
25 
26 #if defined (HAVE_CONFIG_H)
27 # include "config.h"
28 #endif
29 
30 #include <iostream>
31 
32 #include <sstream>
33 
34 #include "oct-time.h"
35 
36 #include "bp-table.h"
37 #include "defun.h"
38 #include "fcn-info.h"
39 #include "interpreter-private.h"
40 #include "interpreter.h"
41 #include "load-path.h"
42 #include "ov-classdef.h"
43 #include "ov-fcn.h"
44 #include "ov-usr-fcn.h"
45 #include "pager.h"
46 #include "parse.h"
47 #include "pt-pr-code.h"
48 #include "symscope.h"
49 #include "symtab.h"
50 
52 
54  : m_interpreter (interp), m_fcn_table (), m_class_precedence_table (),
55  m_parent_map ()
56 {
57  install_builtins ();
58 }
59 
61 {
63 
64  return tw.get_current_scope ();
65 }
66 
67 bool symbol_table::is_built_in_function_name (const std::string& name)
68 {
70 
71  return val.is_defined ();
72 }
73 
75 symbol_table::find_scoped_function (const std::string& name,
76  const symbol_scope& search_scope)
77 {
78  if (name.empty ())
79  return octave_value ();
80 
81  fcn_table_const_iterator p = m_fcn_table.find (name);
82 
83  if (p != m_fcn_table.end ())
84  return p->second.find_scoped_function (search_scope);
85  else
86  {
87  fcn_info finfo (name);
88 
89  octave_value fcn = finfo.find_scoped_function (search_scope);
90 
91  if (fcn.is_defined ())
92  m_fcn_table[name] = finfo;
93 
94  return fcn;
95  }
96 }
97 
99 symbol_table::find_private_function (const std::string& dir_name,
100  const std::string& name)
101 {
102  if (name.empty ())
103  return octave_value ();
104 
105  fcn_table_const_iterator p = m_fcn_table.find (name);
106 
107  if (p != m_fcn_table.end ())
108  return p->second.find_private_function (dir_name);
109  else
110  {
111  fcn_info finfo (name);
112 
113  octave_value fcn = finfo.find_private_function (dir_name);
114 
115  if (fcn.is_defined ())
116  m_fcn_table[name] = finfo;
117 
118  return fcn;
119  }
120 }
121 
122 // FIXME: this function only finds legacy class methods, not
123 // classdef methods.
124 
125 octave_value symbol_table::find_method (const std::string& name,
126  const std::string& dispatch_type)
127 {
128  if (name.empty ())
129  return octave_value ();
130 
131  fcn_table_const_iterator p = m_fcn_table.find (name);
132 
133  if (p != m_fcn_table.end ())
134  return p->second.find_method (dispatch_type);
135  else
136  {
137  fcn_info finfo (name);
138 
139  octave_value fcn = finfo.find_method (dispatch_type);
140 
141  if (fcn.is_defined ())
142  m_fcn_table[name] = finfo;
143 
144  return fcn;
145  }
146 }
147 
149 {
150  fcn_table_const_iterator p = m_fcn_table.find (name);
151 
152  if (p != m_fcn_table.end ())
153  return p->second.find_built_in_function ();
154  else
155  {
156  fcn_info finfo (name);
157 
158  octave_value fcn = finfo.find_built_in_function ();
159 
160  if (fcn.is_defined ())
161  m_fcn_table[name] = finfo;
162 
163  return fcn;
164  }
165 }
166 
167 octave_value symbol_table::find_autoload (const std::string& name)
168 {
169  if (name.empty ())
170  return octave_value ();
171 
172  auto p = m_fcn_table.find (name);
173 
174  if (p != m_fcn_table.end ())
175  return p->second.find_autoload ();
176  else
177  {
178  fcn_info finfo (name);
179 
180  octave_value fcn = finfo.find_autoload ();
181 
182  if (fcn.is_defined ())
183  m_fcn_table[name] = finfo;
184 
185  return fcn;
186  }
187 }
188 
190 symbol_table::builtin_find (const std::string& name,
191  const symbol_scope& search_scope_arg)
192 {
193  if (name.empty ())
194  return octave_value ();
195 
196  fcn_table_iterator p = m_fcn_table.find (name);
197 
198  symbol_scope search_scope
199  = (search_scope_arg ? search_scope_arg : current_scope ());
200 
201  if (p != m_fcn_table.end ())
202  return p->second.builtin_find (search_scope);
203  else
204  {
205  fcn_info finfo (name);
206 
207  octave_value fcn = finfo.builtin_find (search_scope);
208 
209  if (fcn.is_defined ())
210  m_fcn_table[name] = finfo;
211 
212  return fcn;
213  }
214 
215  return octave_value ();
216 }
217 
219 symbol_table::fcn_table_find (const std::string& name,
220  const octave_value_list& args,
221  const symbol_scope& search_scope_arg)
222 {
223  if (name.empty ())
224  return octave_value ();
225 
226  fcn_table_iterator p = m_fcn_table.find (name);
227 
228  symbol_scope search_scope
229  = (search_scope_arg ? search_scope_arg : current_scope ());
230 
231  if (p != m_fcn_table.end ())
232  return p->second.find (search_scope, args);
233  else
234  {
235  fcn_info finfo (name);
236 
237  octave_value fcn = finfo.find (search_scope, args);
238 
239  if (fcn.is_defined ())
240  m_fcn_table[name] = finfo;
241 
242  return fcn;
243  }
244 
245  return octave_value ();
246 }
247 
249 symbol_table::find_function (const std::string& name,
250  const symbol_scope& search_scope_arg)
251 {
252  if (name.empty ())
253  return octave_value ();
254 
255  if (name[0] == '@')
256  {
257  std::size_t pos = name.find_first_of ('/');
258 
259  if (pos == std::string::npos)
260  return octave_value ();
261 
262  std::string method = name.substr (pos+1);
263  std::string dispatch_type = name.substr (1, pos-1);
264 
265  return find_method (method, dispatch_type);
266  }
267  else
268  {
269  symbol_scope search_scope
270  = (search_scope_arg ? search_scope_arg : current_scope ());
271 
272  return find_function (name, ovl (), search_scope);
273  }
274 }
275 
277 symbol_table::find_function (const std::string& name,
278  const octave_value_list& args,
279  const symbol_scope& search_scope)
280 {
281  if (name.empty ())
282  return octave_value ();
283 
284  return fcn_table_find (name, args, search_scope);
285 }
286 
288 symbol_table::find_user_function (const std::string& name)
289 {
290  if (name.empty ())
291  return octave_value ();
292 
293  auto p = m_fcn_table.find (name);
294 
295  if (p != m_fcn_table.end ())
296  return p->second.find_user_function ();
297  else
298  {
299  fcn_info finfo (name);
300 
301  octave_value fcn = finfo.find_user_function ();
302 
303  if (fcn.is_defined ())
304  m_fcn_table[name] = finfo;
305 
306  return fcn;
307  }
308 }
309 
311 {
312  if (name.empty ())
313  return octave_value ();
314 
315  auto p = m_fcn_table.find (name);
316 
317  if (p != m_fcn_table.end ())
318  return p->second.find_cmdline_function ();
319  else
320  {
321  fcn_info finfo (name);
322 
323  octave_value fcn = finfo.find_cmdline_function ();
324 
325  if (fcn.is_defined ())
326  m_fcn_table[name] = finfo;
327 
328  return fcn;
329  }
330 }
331 
332 void symbol_table::install_cmdline_function (const std::string& name,
333  const octave_value& fcn)
334 {
335  auto p = m_fcn_table.find (name);
336 
337  if (p != m_fcn_table.end ())
338  {
339  fcn_info& finfo = p->second;
340 
341  finfo.install_cmdline_function (fcn);
342  }
343  else
344  {
345  fcn_info finfo (name);
346 
347  finfo.install_cmdline_function (fcn);
348 
349  m_fcn_table[name] = finfo;
350  }
351 }
352 
353 // Install local function FCN named NAME. FILE_NAME is the name of
354 // the file containing the local function.
355 
356 void symbol_table::install_local_function (const std::string& name,
357  const octave_value& fcn,
358  const std::string& file_name)
359 {
360  auto p = m_fcn_table.find (name);
361 
362  if (p != m_fcn_table.end ())
363  {
364  fcn_info& finfo = p->second;
365 
366  finfo.install_local_function (fcn, file_name);
367  }
368  else
369  {
370  fcn_info finfo (name);
371 
372  finfo.install_local_function (fcn, file_name);
373 
374  m_fcn_table[name] = finfo;
375  }
376 }
377 
378 void symbol_table::install_user_function (const std::string& name,
379  const octave_value& fcn)
380 {
381  auto p = m_fcn_table.find (name);
382 
383  if (p != m_fcn_table.end ())
384  {
385  fcn_info& finfo = p->second;
386 
387  finfo.install_user_function (fcn);
388  }
389  else
390  {
391  fcn_info finfo (name);
392 
393  finfo.install_user_function (fcn);
394 
395  m_fcn_table[name] = finfo;
396  }
397 }
398 
399 // FIXME: should we ensure that FCN really is a built-in function
400 // object?
401 void symbol_table::install_built_in_function (const std::string& name,
402  const octave_value& fcn)
403 {
404  auto p = m_fcn_table.find (name);
405 
406  if (p != m_fcn_table.end ())
407  {
408  fcn_info& finfo = p->second;
409 
410  finfo.install_built_in_function (fcn);
411  }
412  else
413  {
414  fcn_info finfo (name);
415 
416  finfo.install_built_in_function (fcn);
417 
418  m_fcn_table[name] = finfo;
419  }
420 }
421 
422 // This is written as two separate functions instead of a single
423 // function with default values so that it will work properly with
424 // unwind_protect.
425 
427 {
428  auto p = m_fcn_table.begin ();
429 
430  while (p != m_fcn_table.end ())
431  (p++)->second.clear (force);
432 }
433 
434 void symbol_table::clear_function (const std::string& name)
435 {
436  clear_user_function (name);
437 }
438 
439 void symbol_table::clear_function_pattern (const std::string& pat)
440 {
441  glob_match pattern (pat);
442 
443  auto p = m_fcn_table.begin ();
444 
445  while (p != m_fcn_table.end ())
446  {
447  if (pattern.match (p->first))
448  (p++)->second.clear_user_function ();
449  else
450  p++;
451  }
452 }
453 
454 void symbol_table::clear_function_regexp (const std::string& pat)
455 {
456  regexp pattern (pat);
457 
458  auto p = m_fcn_table.begin ();
459 
460  while (p != m_fcn_table.end ())
461  {
462  if (pattern.is_match (p->first))
463  (p++)->second.clear_user_function ();
464  else
465  p++;
466  }
467 }
468 
469 void symbol_table::clear_user_function (const std::string& name)
470 {
471  auto p = m_fcn_table.find (name);
472 
473  if (p != m_fcn_table.end ())
474  {
475  fcn_info& finfo = p->second;
476 
477  finfo.clear_user_function ();
478  }
479  // FIXME: is this necessary, or even useful?
480  // else
481  // error ("clear: no such function '%s'", name.c_str ());
482 }
483 
484 // This clears oct and mex files, including autoloads.
485 void symbol_table::clear_dld_function (const std::string& name)
486 {
487  auto p = m_fcn_table.find (name);
488 
489  if (p != m_fcn_table.end ())
490  {
491  fcn_info& finfo = p->second;
492 
493  finfo.clear_autoload_function ();
494  finfo.clear_user_function ();
495  }
496 }
497 
499 {
500  auto p = m_fcn_table.begin ();
501 
502  while (p != m_fcn_table.end ())
503  (p++)->second.clear_mex_function ();
504 }
505 
506 // Insert INF_CLASS in the set of class names that are considered
507 // inferior to SUP_CLASS. Return FALSE if INF_CLASS is currently
508 // marked as superior to SUP_CLASS.
509 
510 bool symbol_table::set_class_relationship (const std::string& sup_class,
511  const std::string& inf_class)
512 {
513  if (is_superiorto (inf_class, sup_class))
514  return false;
515 
516  // If sup_class doesn't have an entry in the precedence table,
517  // this will automatically create it, and associate to it a
518  // singleton set {inf_class} of inferior classes.
519  m_class_precedence_table[sup_class].insert (inf_class);
520 
521  return true;
522 }
523 
524 // Has class A been marked as superior to class B? Also returns
525 // TRUE if B has been marked as inferior to A, since we only keep
526 // one table, and convert inferiorto information to a superiorto
527 // relationship. Two calls are required to determine whether there
528 // is no relationship between two classes:
529 //
530 // if (symbol_table::is_superiorto (a, b))
531 // // A is superior to B, or B has been marked inferior to A.
532 // else if (symbol_table::is_superiorto (b, a))
533 // // B is superior to A, or A has been marked inferior to B.
534 // else
535 // // No relation.
536 
537 bool symbol_table::is_superiorto (const std::string& a, const std::string& b)
538 {
540  // If a has no entry in the precedence table, return false
541  if (p == m_class_precedence_table.end ())
542  return false;
543 
544  const std::set<std::string>& inferior_classes = p->second;
545  std::set<std::string>::const_iterator q = inferior_classes.find (b);
546  return (q != inferior_classes.end ());
547 }
548 
549 void symbol_table::alias_built_in_function (const std::string& alias,
550  const std::string& name)
551 {
553 
554  if (fcn.is_defined ())
555  {
556  fcn_info finfo (alias);
557 
558  finfo.install_built_in_function (fcn);
559 
560  m_fcn_table[alias] = finfo;
561  }
562  else
563  panic ("alias: '%s' is undefined", name.c_str ());
564 }
565 
566 void symbol_table::install_built_in_dispatch (const std::string& name,
567  const std::string& klass)
568 {
569  auto p = m_fcn_table.find (name);
570 
571  if (p != m_fcn_table.end ())
572  {
573  fcn_info& finfo = p->second;
574 
575  finfo.install_built_in_dispatch (klass);
576  }
577  else
578  error ("install_built_in_dispatch: '%s' is undefined", name.c_str ());
579 }
580 
581 std::list<std::string> symbol_table::user_function_names (void)
582 {
583  std::list<std::string> retval;
584 
585  for (const auto& nm_finfo : m_fcn_table)
586  {
587  if (nm_finfo.second.is_user_function_defined ())
588  retval.push_back (nm_finfo.first);
589  }
590 
591  if (! retval.empty ())
592  retval.sort ();
593 
594  return retval;
595 }
596 
597 std::list<std::string> symbol_table::built_in_function_names (void)
598 {
599  std::list<std::string> retval;
600 
601  for (const auto& nm_finfo : m_fcn_table)
602  {
603  octave_value fcn = nm_finfo.second.find_built_in_function ();
604 
605  if (fcn.is_defined ())
606  retval.push_back (nm_finfo.first);
607  }
608 
609  if (! retval.empty ())
610  retval.sort ();
611 
612  return retval;
613 }
614 
615 std::list<std::string> symbol_table::cmdline_function_names (void)
616 {
617  std::list<std::string> retval;
618 
619  for (const auto& nm_finfo : m_fcn_table)
620  {
621  octave_value fcn = nm_finfo.second.find_cmdline_function ();
622 
623  if (fcn.is_defined ())
624  retval.push_back (nm_finfo.first);
625  }
626 
627  if (! retval.empty ())
628  retval.sort ();
629 
630  return retval;
631 }
632 
633 template <template <typename, typename...> class C, typename V,
634  typename... A>
635 static octave_value
636 dump_container_map (const std::map<std::string, C<V, A...>>& container_map)
637 {
638  if (container_map.empty ())
639  return octave_value (Matrix ());
640 
641  std::map<std::string, octave_value> info_map;
642 
643  for (const auto& nm_container : container_map)
644  {
645  std::string nm = nm_container.first;
646  const C<V, A...>& container = nm_container.second;
647  info_map[nm] = Cell (container);
648  }
649 
650  return octave_value (info_map);
651 }
652 
654 {
655  std::map<std::string, octave_value> m
656  = {{ "function_info", dump_fcn_table_map () },
657  { "precedence_table", dump_container_map (m_class_precedence_table) },
658  { "parent_classes", dump_container_map (m_parent_map) }
659  };
660 
661  return octave_value (m);
662 }
663 
664 void symbol_table::add_to_parent_map (const std::string& classname,
665  const std::list<std::string>& parent_list)
666 {
667  m_parent_map[classname] = parent_list;
668 }
669 
670 std::list<std::string> symbol_table::parent_classes (const std::string& dispatch_type)
671 {
672  std::list<std::string> retval;
673 
674  const_parent_map_iterator it = m_parent_map.find (dispatch_type);
675 
676  if (it != m_parent_map.end ())
677  retval = it->second;
678 
679  for (const auto& nm : retval)
680  {
681  // Search for parents of parents and append them to the list.
682 
683  // FIXME: should we worry about a circular inheritance graph?
684 
685  std::list<std::string> parents = parent_classes (nm);
686 
687  if (! parents.empty ())
688  retval.insert (retval.end (), parents.begin (), parents.end ());
689  }
690 
691  return retval;
692 }
693 
695 {
696  clear_functions ();
697 
698  m_fcn_table.clear ();
699  m_class_precedence_table.clear ();
700  m_parent_map.clear ();
701 }
702 
703 fcn_info *symbol_table::get_fcn_info (const std::string& name)
704 {
705  auto p = m_fcn_table.find (name);
706  return p != m_fcn_table.end () ? &p->second : nullptr;
707 }
708 
710 {
711  if (m_fcn_table.empty ())
712  return octave_value (Matrix ());
713 
714  std::map<std::string, octave_value> info_map;
715 
716  for (const auto& nm_finfo : m_fcn_table)
717  {
718  std::string nm = nm_finfo.first;
719  const fcn_info& finfo = nm_finfo.second;
720  info_map[nm] = finfo.dump ();
721  }
722 
723  return octave_value (info_map);
724 }
725 
726 DEFMETHOD (__dump_symtab_info__, interp, args, ,
727  doc: /* -*- texinfo -*-
728 @deftypefn {} {@var{S} =} __dump_symtab_info__ ()
729 @deftypefnx {} {@var{S} =} __dump_symtab_info__ (@var{function})
730 Return a structure with information from the symbol table.
731 @end deftypefn */)
732 {
733  int nargin = args.length ();
734 
735  if (nargin > 1)
736  print_usage ();
737 
738  symbol_table& symtab = interp.get_symbol_table ();
739 
740  if (nargin == 0)
741  return symtab.dump ();
742  else
743  {
744  std::string fname = args(
745  0).xstring_value ("__dump_symtab_info__: argument must be a function name");
746 
747  fcn_info *finfo = symtab.get_fcn_info (fname);
748 
749  if (finfo)
750  return finfo->dump ();
751  }
752 
753  return ovl ();
754 }
755 
756 DEFMETHOD (__get_cmdline_fcn_txt__, interp, args, ,
757  doc: /* -*- texinfo -*-
758 @deftypefn {} {@var{str} =} __get_cmdline_fcn_txt__ (@var{name})
759 Undocumented internal function.
760 @end deftypefn */)
761 {
762  if (args.length () != 1)
763  print_usage ();
764 
765  std::string name = args(
766  0).xstring_value ("__get_cmdline_fcn_txt__: first argument must be function name");
767 
768  symbol_table& symtab = interp.get_symbol_table ();
769 
770  octave_value ov = symtab.find_cmdline_function (name);
771 
773 
774  octave_value_list retval;
775 
776  if (f)
777  {
778  std::ostringstream buf;
779 
780  tree_print_code tpc (buf);
781 
782  f->accept (tpc);
783 
784  retval = ovl (buf.str ());
785  }
786 
787  return retval;
788 }
789 
790 // FIXME: should we have functions like this in Octave?
791 //
792 // DEFMETHOD (set_variable, interp, args, , "set_variable (NAME, VALUE)")
793 // {
794 // if (args.length () != 2)
795 // print_usage ();
796 //
797 // std::string name = args(0).xstring_value ("set_variable: variable NAME must be a string");
798 //
799 // symbol_table& symtab = interp.get_symbol_table ();
800 //
801 // symtab.assign (name, args(1));
802 //
803 // return ovl ();
804 // }
805 //
806 // DEFMETHOD (variable_value, interp, args, , "VALUE = variable_value (NAME)")
807 // {
808 // if (args.length () != 1)
809 // print_usage ();
810 //
811 // octave_value retval;
812 //
813 // std::string name = args(0).xstring_value ("variable_value: variable NAME must be a string");
814 //
815 // symbol_table& symtab = interp.get_symbol_table ();
816 //
817 // retval = symtab.varval (name);
818 //
819 // if (retval.is_undefined ())
820 // error ("variable_value: '%s' is not a variable in the current scope",
821 // name.c_str ());
822 //
823 // return retval;
824 // }
825 
826 /*
827 bug #34497: 'clear -f' does not work for command line functions
828 
829 This test relies on bar being a core function that is implemented in an m-file.
830 If the first assert fails, this is no longer the case and the tests need to be
831 updated to use some other function.
832 
833 %!assert <34497> (! strcmp (which ("bar"), ""))
834 
835 %!function x = bar ()
836 %! x = 5;
837 %!endfunction
838 %!test
839 %! assert (bar == 5);
840 %! assert (strcmp (which ("bar"), "command-line function"));
841 %! clear -f bar;
842 %! assert (! strcmp (which ("bar"), ""));
843 
844 %!function x = bar ()
845 %! x = 5;
846 %!endfunction
847 %!test
848 %! assert (bar == 5);
849 %! assert (strcmp (which ("bar"), "command-line function"));
850 %! clear bar;
851 %! assert (! strcmp (which ("bar"), ""));
852 */
853 
855 
OCTAVE_END_NAMESPACE(octave)
#define C(a, b)
Definition: Faddeeva.cc:259
Definition: Cell.h:43
Definition: dMatrix.h:42
octave_value find_method(const std::string &dispatch_type) const
Definition: fcn-info.h:274
octave_value find_scoped_function(const symbol_scope &search_scope) const
Definition: fcn-info.h:264
void install_built_in_dispatch(const std::string &klass)
Definition: fcn-info.h:333
octave_value builtin_find(const symbol_scope &search_scope)
Definition: fcn-info.h:259
octave_value find_built_in_function(void) const
Definition: fcn-info.h:279
void clear_autoload_function(bool force=false)
Definition: fcn-info.h:345
void install_user_function(const octave_value &f)
Definition: fcn-info.h:323
void install_local_function(const octave_value &f, const std::string &file_name)
Definition: fcn-info.h:317
void install_cmdline_function(const octave_value &f)
Definition: fcn-info.h:312
octave_value find_autoload(void)
Definition: fcn-info.h:289
octave_value find(const symbol_scope &search_scope, const octave_value_list &args=octave_value_list())
Definition: fcn-info.h:252
void clear_user_function(bool force=false)
Definition: fcn-info.h:340
octave_value find_private_function(const std::string &dir_name) const
Definition: fcn-info.h:269
octave_value find_cmdline_function(void) const
Definition: fcn-info.h:284
octave_value dump(void) const
Definition: fcn-info.h:352
octave_value find_user_function(void)
Definition: fcn-info.h:295
void install_built_in_function(const octave_value &f)
Definition: fcn-info.h:328
bool match(const std::string &str) const
Definition: glob-match.cc:35
tree_evaluator & get_evaluator(void)
OCTINTERP_API std::string xstring_value(const char *fmt,...) const
octave_value sort(octave_idx_type dim=0, sortmode mode=ASCENDING) const
Definition: ov.h:1540
bool is_defined(void) const
Definition: ov.h:637
OCTINTERP_API octave_user_function * user_function_value(bool silent=false) const
bool is_match(const std::string &buffer) const
Definition: lo-regexp.cc:580
octave_value find_scoped_function(const std::string &name, const symbol_scope &search_scope)
Definition: symtab.cc:75
octave_value find_method(const std::string &name, const std::string &dispatch_type)
Definition: symtab.cc:125
octave_value builtin_find(const std::string &name, const symbol_scope &search_scope=symbol_scope())
Definition: symtab.cc:190
void clear_mex_functions(void)
Definition: symtab.cc:498
bool is_built_in_function_name(const std::string &name)
Definition: symtab.cc:67
octave_value find_private_function(const std::string &dir_name, const std::string &name)
Definition: symtab.cc:99
void clear_function(const std::string &name)
Definition: symtab.cc:434
void clear_function_pattern(const std::string &pat)
Definition: symtab.cc:439
void clear_functions(bool force=false)
Definition: symtab.cc:426
void alias_built_in_function(const std::string &alias, const std::string &name)
Definition: symtab.cc:549
void add_to_parent_map(const std::string &classname, const std::list< std::string > &parent_list)
Definition: symtab.cc:664
std::map< std::string, std::list< std::string > > m_parent_map
Definition: symtab.h:218
fcn_info * get_fcn_info(const std::string &name)
Definition: symtab.cc:703
octave_value dump(void) const
Definition: symtab.cc:653
void install_cmdline_function(const std::string &name, const octave_value &fcn)
Definition: symtab.cc:332
void clear_user_function(const std::string &name)
Definition: symtab.cc:469
std::list< std::string > cmdline_function_names(void)
Definition: symtab.cc:615
std::map< std::string, std::list< std::string > >::const_iterator const_parent_map_iterator
Definition: symtab.h:221
void cleanup(void)
Definition: symtab.cc:694
void install_user_function(const std::string &name, const octave_value &fcn)
Definition: symtab.cc:378
interpreter & m_interpreter
Definition: symtab.h:190
void clear_dld_function(const std::string &name)
Definition: symtab.cc:485
octave_value find_function(const std::string &name, const symbol_scope &search_scope=symbol_scope())
Definition: symtab.cc:249
octave_value find_cmdline_function(const std::string &name)
Definition: symtab.cc:310
void install_built_in_function(const std::string &name, const octave_value &fcn)
Definition: symtab.cc:401
void install_built_in_dispatch(const std::string &name, const std::string &klass)
Definition: symtab.cc:566
octave_value find_built_in_function(const std::string &name)
Definition: symtab.cc:148
symbol_scope current_scope(void) const
Definition: symtab.cc:60
std::map< std::string, fcn_info >::iterator fcn_table_iterator
Definition: symtab.h:200
std::list< std::string > built_in_function_names(void)
Definition: symtab.cc:597
bool is_superiorto(const std::string &a, const std::string &b)
Definition: symtab.cc:537
std::map< std::string, fcn_info > m_fcn_table
Definition: symtab.h:206
octave_value dump_fcn_table_map(void) const
Definition: symtab.cc:709
octave_value find_autoload(const std::string &name)
Definition: symtab.cc:167
octave_value find_user_function(const std::string &name)
Definition: symtab.cc:288
std::list< std::string > user_function_names(void)
Definition: symtab.cc:581
void clear_function_regexp(const std::string &pat)
Definition: symtab.cc:454
void install_local_function(const std::string &name, const octave_value &fcn, const std::string &file_name)
Definition: symtab.cc:356
std::map< std::string, std::set< std::string > >::const_iterator class_precedence_table_const_iterator
Definition: symtab.h:213
std::map< std::string, std::set< std::string > > m_class_precedence_table
Definition: symtab.h:210
octave_value fcn_table_find(const std::string &name, const octave_value_list &args=ovl(), const symbol_scope &search_scope=symbol_scope())
Definition: symtab.cc:219
bool set_class_relationship(const std::string &sup_class, const std::string &inf_class)
Definition: symtab.cc:510
std::map< std::string, fcn_info >::const_iterator fcn_table_const_iterator
Definition: symtab.h:198
std::list< std::string > parent_classes(const std::string &dispatch_type)
Definition: symtab.cc:670
symbol_scope get_current_scope(void) const
Definition: pt-eval.cc:2657
OCTAVE_BEGIN_NAMESPACE(octave) static octave_value daspk_fcn
OCTINTERP_API void print_usage(void)
Definition: defun-int.h:72
#define DEFMETHOD(name, interp_name, args_name, nargout_name, doc)
Macro to define a builtin method.
Definition: defun.h:111
OCTAVE_NORETURN void panic(const char *fmt,...)
Definition: error.cc:1118
void error(const char *fmt,...)
Definition: error.cc:979
F77_RET_T const F77_INT const F77_INT const F77_INT const F77_DBLE const F77_DBLE F77_INT F77_DBLE * V
F77_RET_T const F77_INT F77_CMPLX * A
F77_RET_T const F77_DBLE const F77_DBLE * f
T octave_idx_type m
Definition: mx-inlines.cc:773
return octave_value(v1.char_array_value() . concat(v2.char_array_value(), ra_idx),((a1.is_sq_string()||a2.is_sq_string()) ? '\'' :'"'))
octave_value_list ovl(const OV_Args &... args)
Construct an octave_value_list with less typing.
Definition: ovl.h:211
static octave_value dump_container_map(const std::map< std::string, C< V, A... >> &container_map)
Definition: symtab.cc:636