GNU Octave 7.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-2022 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
51OCTAVE_NAMESPACE_BEGIN
52
54 : m_interpreter (interp), m_fcn_table (), m_class_precedence_table (),
55 m_parent_map ()
56 {
58 }
59
60 symbol_scope symbol_table::current_scope (void) const
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
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
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
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
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
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
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
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 {
696
697 m_fcn_table.clear ();
699 m_parent_map.clear ();
700 }
701
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 // Remove when corresponding public deprecated function is removed.
727 {
728 return m_interpreter.at_top_level ();
729 }
730
731 // Remove when corresponding public deprecated function is removed.
733 {
734 return m_interpreter.varval (name);
735 }
736
737 // Remove when corresponding public deprecated function is removed.
739 {
741 }
742
743 // Remove when corresponding public deprecated function is removed.
745 {
747 }
748
749 // Remove when corresponding public deprecated function is removed.
751 {
753 }
754
755 // Remove when corresponding public deprecated function is removed.
757 {
759 }
760
761 // Remove when corresponding public deprecated function is removed.
762 std::list<std::string> symbol_table::variable_names_deprecated (void)
763 {
765 }
766
767 // Remove when corresponding public deprecated function is removed.
768 void symbol_table::assign_deprecated (const std::string& name, const octave_value& value)
769 {
770 return m_interpreter.assign (name, value);
771 }
772
773 // Remove when corresponding public deprecated function is removed.
775 {
776 return m_interpreter.clear_all (force);
777 }
778
779 // Remove when corresponding public deprecated function is removed.
781 {
783 }
784
785 // Remove when corresponding public deprecated function is removed.
786 void symbol_table::clear_global_pattern_deprecated (const std::string& pattern)
787 {
789 }
790
791 // Remove when corresponding public deprecated function is removed.
793 {
795 }
796
797 // Remove when corresponding public deprecated function is removed.
798 void symbol_table::clear_symbol_pattern_deprecated (const std::string& pattern)
799 {
800 return m_interpreter.clear_symbol_pattern (pattern);
801 }
802
803 // Remove when corresponding public deprecated function is removed.
805 const octave_value& value)
806 {
807 return m_interpreter.global_assign (name, value);
808 }
809
810 // Remove when corresponding public deprecated function is removed.
812 const octave_value& value)
813 {
814 return m_interpreter.top_level_assign (name, value);
815 }
816
817DEFMETHOD (__dump_symtab_info__, interp, args, ,
818 doc: /* -*- texinfo -*-
819@deftypefn {} {} __dump_symtab_info__ ()
820@deftypefnx {} {} __dump_symtab_info__ (@var{function})
821Undocumented internal function.
822@end deftypefn */)
823{
824 int nargin = args.length ();
825
826 if (nargin > 1)
827 print_usage ();
828
829 symbol_table& symtab = interp.get_symbol_table ();
830
831 if (nargin == 0)
832 return symtab.dump ();
833 else
834 {
835 std::string fname = args(0).xstring_value ("__dump_symtab_info__: argument must be a function name");
836
837 fcn_info *finfo = symtab.get_fcn_info (fname);
838
839 if (finfo)
840 return finfo->dump ();
841 }
842
843 return ovl ();
844}
845
846DEFMETHOD (__get_cmdline_fcn_txt__, interp, args, ,
847 doc: /* -*- texinfo -*-
848@deftypefn {} {} __get_cmdline_fcn_txt__ (@var{name})
849Undocumented internal function.
850@end deftypefn */)
851{
852 if (args.length () != 1)
853 print_usage ();
854
855 std::string name = args(0).xstring_value ("__get_cmdline_fcn_txt__: first argument must be function name");
856
857 symbol_table& symtab = interp.get_symbol_table ();
858
860
862
863 octave_value_list retval;
864
865 if (f)
866 {
867 std::ostringstream buf;
868
869 tree_print_code tpc (buf);
870
871 f->accept (tpc);
872
873 retval = ovl (buf.str ());
874 }
875
876 return retval;
877}
878
879// FIXME: should we have functions like this in Octave?
880//
881// DEFMETHOD (set_variable, interp, args, , "set_variable (NAME, VALUE)")
882// {
883// if (args.length () != 2)
884// print_usage ();
885//
886// std::string name = args(0).xstring_value ("set_variable: variable NAME must be a string");
887//
888// symbol_table& symtab = interp.get_symbol_table ();
889//
890// symtab.assign (name, args(1));
891//
892// return ovl ();
893// }
894//
895// DEFMETHOD (variable_value, interp, args, , "VALUE = variable_value (NAME)")
896// {
897// if (args.length () != 1)
898// print_usage ();
899//
900// octave_value retval;
901//
902// std::string name = args(0).xstring_value ("variable_value: variable NAME must be a string");
903//
904// symbol_table& symtab = interp.get_symbol_table ();
905//
906// retval = symtab.varval (name);
907//
908// if (retval.is_undefined ())
909// error ("variable_value: '%s' is not a variable in the current scope",
910// name.c_str ());
911//
912// return retval;
913// }
914
915/*
916bug #34497: 'clear -f' does not work for command line functions
917
918This test relies on bar being a core function that is implemented in an m-file.
919If the first assert fails, this is no longer the case and the tests need to be
920updated to use some other function.
921
922%!assert <34497> (! strcmp (which ("bar"), ""))
923
924%!function x = bar ()
925%! x = 5;
926%!endfunction
927%!test
928%! assert (bar == 5);
929%! assert (strcmp (which ("bar"), "command-line function"));
930%! clear -f bar;
931%! assert (! strcmp (which ("bar"), ""));
932
933%!function x = bar ()
934%! x = 5;
935%!endfunction
936%!test
937%! assert (bar == 5);
938%! assert (strcmp (which ("bar"), "command-line function"));
939%! clear bar;
940%! assert (! strcmp (which ("bar"), ""));
941*/
942
943OCTAVE_NAMESPACE_END
944
#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
octave_value global_varval(const std::string &name) const
octave_value varval(const std::string &name) const
void global_assign(const std::string &name, const octave_value &val=octave_value())
std::list< std::string > top_level_variable_names(void)
bool at_top_level(void) const
void top_level_assign(const std::string &name, const octave_value &val=octave_value())
tree_evaluator & get_evaluator(void)
void clear_symbol_pattern(const std::string &pat)
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
std::list< std::string > global_variable_names(void)
void assign(const std::string &name, const octave_value &val=octave_value())
void clear_symbol(const std::string &name)
std::list< std::string > variable_names(void)
void clear_all(bool force=false)
OCTINTERP_API std::string xstring_value(const char *fmt,...) const
OCTINTERP_API 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:1537
bool is_defined(void) const
Definition: ov.h:637
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_global_deprecated(const std::string &name)
Definition: symtab.cc:780
void clear_mex_functions(void)
Definition: symtab.cc:498
void clear_global_pattern_deprecated(const std::string &pattern)
Definition: symtab.cc:786
bool is_built_in_function_name(const std::string &name)
Definition: symtab.cc:67
void top_level_assign_deprecated(const std::string &name, const octave_value &value=octave_value())
Definition: symtab.cc:811
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
bool at_top_level_deprecated(void)
Definition: symtab.cc:726
void add_to_parent_map(const std::string &classname, const std::list< std::string > &parent_list)
Definition: symtab.cc:663
std::map< std::string, std::list< std::string > > m_parent_map
Definition: symtab.h:382
fcn_info * get_fcn_info(const std::string &name)
Definition: symtab.cc:702
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
octave_value global_varval_deprecated(const std::string &name) const
Definition: symtab.cc:738
void clear_symbol_pattern_deprecated(const std::string &pattern)
Definition: symtab.cc:798
void clear_user_function(const std::string &name)
Definition: symtab.cc:469
std::list< std::string > cmdline_function_names(void)
Definition: symtab.cc:615
void global_assign_deprecated(const std::string &name, const octave_value &value=octave_value())
Definition: symtab.cc:804
void clear_symbol_deprecated(const std::string &name)
Definition: symtab.cc:792
void cleanup(void)
Definition: symtab.cc:693
void install_user_function(const std::string &name, const octave_value &fcn)
Definition: symtab.cc:378
interpreter & m_interpreter
Definition: symtab.h:354
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
std::list< std::string > top_level_variable_names_deprecated(void)
Definition: symtab.cc:756
void assign_deprecated(const std::string &name, const octave_value &value=octave_value())
Definition: symtab.cc:768
std::list< std::string > global_variable_names_deprecated(void)
Definition: symtab.cc:750
std::map< std::string, std::set< std::string > >::const_iterator class_precedence_table_const_iterator
Definition: symtab.h:377
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 top_level_varval_deprecated(const std::string &name) const
Definition: symtab.cc:744
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::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::list< std::string > variable_names_deprecated(void)
Definition: symtab.cc:762
std::map< std::string, fcn_info > m_fcn_table
Definition: symtab.h:370
octave_value dump_fcn_table_map(void) const
Definition: symtab.cc:708
void clear_all_deprecated(bool force=false)
Definition: symtab.cc:774
std::map< std::string, fcn_info >::const_iterator fcn_table_const_iterator
Definition: symtab.h:362
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::map< std::string, fcn_info >::iterator fcn_table_iterator
Definition: symtab.h:364
std::list< std::string > user_function_names(void)
Definition: symtab.cc:581
void clear_function_regexp(const std::string &pat)
Definition: symtab.cc:454
symbol_table(interpreter &interp)
Definition: symtab.cc:53
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::list< std::string > >::const_iterator const_parent_map_iterator
Definition: symtab.h:385
void install_builtins(void)
std::map< std::string, std::set< std::string > > m_class_precedence_table
Definition: symtab.h:374
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::list< std::string > parent_classes(const std::string &dispatch_type)
Definition: symtab.cc:669
octave_value varval_deprecated(const std::string &name) const
Definition: symtab.cc:732
symbol_scope get_current_scope(void) const
Definition: pt-eval.cc:2656
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:1119
void error(const char *fmt,...)
Definition: error.cc:980
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
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