GNU Octave  6.2.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-2021 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 
51 namespace octave
52 {
54  : m_interpreter (interp), m_fcn_table (), m_class_precedence_table (),
55  m_parent_map ()
56  {
58  }
59 
61  {
63 
64  return tw.get_current_scope ();
65  }
66 
68  {
70 
71  return val.is_defined ();
72  }
73 
76  const symbol_scope& search_scope)
77  {
78  if (name.empty ())
79  return octave_value ();
80 
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 
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 
126  const std::string& dispatch_type)
127  {
128  if (name.empty ())
129  return octave_value ();
130 
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  {
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 
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 
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 
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  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 
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 
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?
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  {
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 
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  return octave_value (m);
661  }
662 
663  void symbol_table::add_to_parent_map (const std::string& classname,
664  const std::list<std::string>& parent_list)
665  {
666  m_parent_map[classname] = parent_list;
667  }
668 
669  std::list<std::string> symbol_table::parent_classes (const std::string& dispatch_type)
670  {
671  std::list<std::string> retval;
672 
673  const_parent_map_iterator it = m_parent_map.find (dispatch_type);
674 
675  if (it != m_parent_map.end ())
676  retval = it->second;
677 
678  for (const auto& nm : retval)
679  {
680  // Search for parents of parents and append them to the list.
681 
682  // FIXME: should we worry about a circular inheritance graph?
683 
684  std::list<std::string> parents = parent_classes (nm);
685 
686  if (! parents.empty ())
687  retval.insert (retval.end (), parents.begin (), parents.end ());
688  }
689 
690  return retval;
691  }
692 
694  {
695  clear_functions ();
696 
697  m_fcn_table.clear ();
698  m_class_precedence_table.clear ();
699  m_parent_map.clear ();
700  }
701 
702  fcn_info * symbol_table::get_fcn_info (const std::string& name)
703  {
704  auto p = m_fcn_table.find (name);
705  return p != m_fcn_table.end () ? &p->second : nullptr;
706  }
707 
709  {
710  if (m_fcn_table.empty ())
711  return octave_value (Matrix ());
712 
713  std::map<std::string, octave_value> info_map;
714 
715  for (const auto& nm_finfo : m_fcn_table)
716  {
717  std::string nm = nm_finfo.first;
718  const fcn_info& finfo = nm_finfo.second;
719  info_map[nm] = finfo.dump ();
720  }
721 
722  return octave_value (info_map);
723  }
724 
725  // DEPRECATED
727  {
728  return m_interpreter.at_top_level ();
729  }
730 
731  // DEPRECATED
732  octave_value symbol_table::varval (const std::string& name) const
733  {
734  return m_interpreter.varval (name);
735  }
736 
737  // DEPRECATED
738  octave_value symbol_table::global_varval (const std::string& name) const
739  {
741  }
742 
743  // DEPRECATED
745  {
747  }
748 
749  // DEPRECATED
750  std::list<std::string> symbol_table::global_variable_names (void)
751  {
753  }
754 
755  // DEPRECATED
756  std::list<std::string> symbol_table::top_level_variable_names (void)
757  {
759  }
760 
761  // DEPRECATED
762  std::list<std::string> symbol_table::variable_names (void)
763  {
764  return m_interpreter.variable_names ();
765  }
766 
767  // DEPRECATED
768  void symbol_table::assign (const std::string& name, const octave_value& value)
769  {
770  return m_interpreter.assign (name, value);
771  }
772 
773  // DEPRECATED
774  void symbol_table::clear_all (bool force)
775  {
776  return m_interpreter.clear_all (force);
777  }
778 
779  // DEPRECATED
780  void symbol_table::clear_global (const std::string& name)
781  {
783  }
784 
785  // DEPRECATED
786  void symbol_table::clear_global_pattern (const std::string& pattern)
787  {
789  }
790 
791  // DEPRECATED
792  void symbol_table::clear_symbol (const std::string& name)
793  {
795  }
796 
797  // DEPRECATED
798  void symbol_table::clear_symbol_pattern (const std::string& pattern)
799  {
800  return m_interpreter.clear_symbol_pattern (pattern);
801  }
802 
803  // DEPRECATED
804  void symbol_table::global_assign (const std::string& name,
805  const octave_value& value)
806  {
807  return m_interpreter.global_assign (name, value);
808  }
809 
810  // DEPRECATED
811  void symbol_table::top_level_assign (const std::string& name,
812  const octave_value& value)
813  {
814  return m_interpreter.top_level_assign (name, value);
815  }
816 }
817 
818 DEFMETHOD (__dump_symtab_info__, interp, args, ,
819  doc: /* -*- texinfo -*-
820 @deftypefn {} {} __dump_symtab_info__ ()
821 @deftypefnx {} {} __dump_symtab_info__ (@var{function})
822 Undocumented internal function.
823 @end deftypefn */)
824 {
825  int nargin = args.length ();
826 
827  if (nargin > 1)
828  print_usage ();
829 
830  octave::symbol_table& symtab = interp.get_symbol_table ();
831 
832  if (nargin == 0)
833  return symtab.dump ();
834  else
835  {
836  std::string fname = args(0).xstring_value ("__dump_symtab_info__: argument must be a function name");
837 
838  octave::fcn_info *finfo = symtab.get_fcn_info (fname);
839 
840  if (finfo)
841  return finfo->dump ();
842  }
843 
844  return ovl ();
845 }
846 
847 DEFMETHOD (__get_cmdline_fcn_txt__, interp, args, ,
848  doc: /* -*- texinfo -*-
849 @deftypefn {} {} __get_cmdline_fcn_txt__ (@var{name})
850 Undocumented internal function.
851 @end deftypefn */)
852 {
853  if (args.length () != 1)
854  print_usage ();
855 
856  std::string name = args(0).xstring_value ("__get_cmdline_fcn_txt__: first argument must be function name");
857 
858  octave::symbol_table& symtab = interp.get_symbol_table ();
859 
861 
863 
865 
866  if (f)
867  {
868  std::ostringstream buf;
869 
870  octave::tree_print_code tpc (buf);
871 
872  f->accept (tpc);
873 
874  retval = ovl (buf.str ());
875  }
876 
877  return retval;
878 }
879 
880 // FIXME: should we have functions like this in Octave?
881 //
882 // DEFMETHOD (set_variable, interp, args, , "set_variable (NAME, VALUE)")
883 // {
884 // if (args.length () != 2)
885 // print_usage ();
886 //
887 // std::string name = args(0).xstring_value ("set_variable: variable NAME must be a string");
888 //
889 // octave::symbol_table& symtab = interp.get_symbol_table ();
890 //
891 // symtab.assign (name, args(1));
892 //
893 // return ovl ();
894 // }
895 //
896 // DEFMETHOD (variable_value, interp, args, , "VALUE = variable_value (NAME)")
897 // {
898 // if (args.length () != 1)
899 // print_usage ();
900 //
901 // octave_value retval;
902 //
903 // std::string name = args(0).xstring_value ("variable_value: variable NAME must be a string");
904 //
905 // octave::symbol_table& symtab = interp.get_symbol_table ();
906 //
907 // retval = symtab.varval (name);
908 //
909 // if (retval.is_undefined ())
910 // error ("variable_value: '%s' is not a variable in the current scope",
911 // name.c_str ());
912 //
913 // return retval;
914 // }
915 
916 /*
917 bug #34497: 'clear -f' does not work for command line functions
918 
919 This test relies on bar being a core function that is implemented in an m-file.
920 If the first assert fails, this is no longer the case and the tests need to be
921 updated to use some other function.
922 
923 %!assert <34497> (! strcmp (which ("bar"), ""))
924 
925 %!function x = bar ()
926 %! x = 5;
927 %!endfunction
928 %!test
929 %! assert (bar == 5);
930 %! assert (strcmp (which ("bar"), "command-line function"));
931 %! clear -f bar;
932 %! assert (! strcmp (which ("bar"), ""));
933 
934 %!function x = bar ()
935 %! x = 5;
936 %!endfunction
937 %!test
938 %! assert (bar == 5);
939 %! assert (strcmp (which ("bar"), "command-line function"));
940 %! clear bar;
941 %! assert (! strcmp (which ("bar"), ""));
942 */
#define C(a, b)
Definition: Faddeeva.cc:246
Array< T > & insert(const Array< T > &a, const Array< octave_idx_type > &idx)
Insert an array into another at a specified position.
Definition: Array.cc:1584
Array< T > sort(int dim=0, sortmode mode=ASCENDING) const
Size of the specified dimension.
Definition: Array.cc:1757
Definition: Cell.h:43
Definition: dMatrix.h:42
bool match(const std::string &str) const
Definition: glob-match.cc:35
void install_local_function(const octave_value &f, const std::string &file_name)
Definition: fcn-info.h:317
void clear_user_function(bool force=false)
Definition: fcn-info.h:340
octave_value dump(void) const
Definition: fcn-info.h:352
void clear_autoload_function(bool force=false)
Definition: fcn-info.h:345
octave_value find(const symbol_scope &search_scope, const octave_value_list &args=octave_value_list())
Definition: fcn-info.h:252
octave_value find_built_in_function(void) const
Definition: fcn-info.h:279
octave_value builtin_find(const symbol_scope &search_scope)
Definition: fcn-info.h:259
octave_value find_user_function(void)
Definition: fcn-info.h:295
void install_built_in_dispatch(const std::string &klass)
Definition: fcn-info.h:333
octave_value find_private_function(const std::string &dir_name) const
Definition: fcn-info.h:269
void install_user_function(const octave_value &f)
Definition: fcn-info.h:323
void install_built_in_function(const octave_value &f)
Definition: fcn-info.h:328
octave_value find_cmdline_function(void) const
Definition: fcn-info.h:284
octave_value find_autoload(void)
Definition: fcn-info.h:289
octave_value find_scoped_function(const symbol_scope &search_scope) const
Definition: fcn-info.h:264
octave_value find_method(const std::string &dispatch_type) const
Definition: fcn-info.h:274
void install_cmdline_function(const octave_value &f)
Definition: fcn-info.h:312
void clear_symbol(const std::string &name)
void assign(const std::string &name, const octave_value &val=octave_value())
void global_assign(const std::string &name, const octave_value &val=octave_value())
octave_value varval(const std::string &name) const
octave_value global_varval(const std::string &name) const
std::list< std::string > variable_names(void)
std::list< std::string > top_level_variable_names(void)
void top_level_assign(const std::string &name, const octave_value &val=octave_value())
void clear_global_variable(const std::string &name)
void clear_global_variable_pattern(const std::string &pattern)
octave_value top_level_varval(const std::string &name) const
bool at_top_level(void) const
void clear_all(bool force=false)
void clear_symbol_pattern(const std::string &pat)
std::list< std::string > global_variable_names(void)
tree_evaluator & get_evaluator(void)
bool is_match(const std::string &buffer)
Definition: lo-regexp.cc:440
octave_value find_user_function(const std::string &name)
Definition: symtab.cc:288
std::map< std::string, std::list< std::string > >::const_iterator const_parent_map_iterator
Definition: symtab.h:278
octave_value varval(const std::string &name) const
Definition: symtab.cc:732
bool at_top_level(void)
Definition: symtab.cc:726
octave_value find_cmdline_function(const std::string &name)
Definition: symtab.cc:310
octave_value builtin_find(const std::string &name, const symbol_scope &search_scope=symbol_scope())
Definition: symtab.cc:190
void clear_all(bool force=false)
Definition: symtab.cc:774
std::map< std::string, fcn_info > m_fcn_table
Definition: symtab.h:263
octave_value top_level_varval(const std::string &name) const
Definition: symtab.cc:744
octave_value dump_fcn_table_map(void) const
Definition: symtab.cc:708
bool is_built_in_function_name(const std::string &name)
Definition: symtab.cc:67
void clear_global_pattern(const std::string &pattern)
Definition: symtab.cc:786
void install_built_in_function(const std::string &name, const octave_value &fcn)
Definition: symtab.cc:401
fcn_info * get_fcn_info(const std::string &name)
Definition: symtab.cc:702
symbol_table(interpreter &interp)
Definition: symtab.cc:53
octave_value find_function(const std::string &name, const symbol_scope &search_scope=symbol_scope())
Definition: symtab.cc:249
void install_user_function(const std::string &name, const octave_value &fcn)
Definition: symtab.cc:378
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:255
bool is_superiorto(const std::string &a, const std::string &b)
Definition: symtab.cc:537
void clear_function(const std::string &name)
Definition: symtab.cc:434
void install_local_function(const std::string &name, const octave_value &fcn, const std::string &file_name)
Definition: symtab.cc:356
std::list< std::string > user_function_names(void)
Definition: symtab.cc:581
std::list< std::string > parent_classes(const std::string &dispatch_type)
Definition: symtab.cc:669
void install_cmdline_function(const std::string &name, const octave_value &fcn)
Definition: symtab.cc:332
void add_to_parent_map(const std::string &classname, const std::list< std::string > &parent_list)
Definition: symtab.cc:663
std::list< std::string > top_level_variable_names(void)
Definition: symtab.cc:756
std::map< std::string, std::set< std::string > >::const_iterator class_precedence_table_const_iterator
Definition: symtab.h:270
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
void clear_function_pattern(const std::string &pat)
Definition: symtab.cc:439
void clear_dld_function(const std::string &name)
Definition: symtab.cc:485
void clear_symbol_pattern(const std::string &pattern)
Definition: symtab.cc:798
void cleanup(void)
Definition: symtab.cc:693
std::map< std::string, std::set< std::string > > m_class_precedence_table
Definition: symtab.h:267
void clear_functions(bool force=false)
Definition: symtab.cc:426
void assign(const std::string &name, const octave_value &value=octave_value())
Definition: symtab.cc:768
symbol_scope current_scope(void) const
Definition: symtab.cc:60
void clear_symbol(const std::string &name)
Definition: symtab.cc:792
octave_value dump(void) const
Definition: symtab.cc:653
void alias_built_in_function(const std::string &alias, const std::string &name)
Definition: symtab.cc:549
octave_value find_method(const std::string &name, const std::string &dispatch_type)
Definition: symtab.cc:125
void clear_function_regexp(const std::string &pat)
Definition: symtab.cc:454
octave_value find_scoped_function(const std::string &name, const symbol_scope &search_scope)
Definition: symtab.cc:75
interpreter & m_interpreter
Definition: symtab.h:247
octave_value find_private_function(const std::string &dir_name, const std::string &name)
Definition: symtab.cc:99
void top_level_assign(const std::string &name, const octave_value &value=octave_value())
Definition: symtab.cc:811
void clear_mex_functions(void)
Definition: symtab.cc:498
void clear_global(const std::string &name)
Definition: symtab.cc:780
void install_built_in_dispatch(const std::string &name, const std::string &klass)
Definition: symtab.cc:566
octave_value global_varval(const std::string &name) const
Definition: symtab.cc:738
octave_value find_autoload(const std::string &name)
Definition: symtab.cc:167
void clear_user_function(const std::string &name)
Definition: symtab.cc:469
void global_assign(const std::string &name, const octave_value &value=octave_value())
Definition: symtab.cc:804
std::map< std::string, std::list< std::string > > m_parent_map
Definition: symtab.h:275
octave_value find_built_in_function(const std::string &name)
Definition: symtab.cc:148
std::list< std::string > global_variable_names(void)
Definition: symtab.cc:750
std::list< std::string > built_in_function_names(void)
Definition: symtab.cc:597
std::map< std::string, fcn_info >::iterator fcn_table_iterator
Definition: symtab.h:257
std::list< std::string > variable_names(void)
Definition: symtab.cc:762
std::list< std::string > cmdline_function_names(void)
Definition: symtab.cc:615
void install_builtins(void)
symbol_scope get_current_scope(void) const
Definition: pt-eval.cc:2045
octave_user_function * user_function_value(bool silent=false) const
bool is_defined(void) const
Definition: ov.h:551
std::string xstring_value(const char *fmt,...) const
OCTINTERP_API void print_usage(void)
Definition: defun.cc:53
#define DEFMETHOD(name, interp_name, args_name, nargout_name, doc)
Macro to define a builtin method.
Definition: defun.h:138
OCTAVE_NORETURN void panic(const char *fmt,...)
Definition: error.cc:1114
void error(const char *fmt,...)
Definition: error.cc:968
QString name
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
static octave_value dump_container_map(const std::map< std::string, C< V, A... >> &container_map)
Definition: symtab.cc:636
return octave_value(v1.char_array_value() . concat(v2.char_array_value(), ra_idx),((a1.is_sq_string()||a2.is_sq_string()) ? '\'' :'"'))
octave_value::octave_value(const Array< char > &chm, char type) return retval
Definition: ov.cc:811
octave_value_list ovl(const OV_Args &... args)
Construct an octave_value_list with less typing.
Definition: ovl.h:211