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