24 #if ! defined (octave_symtab_h)
25 #define octave_symtab_h 1
27 #include "octave-config.h"
76 return instance_ok () ? instance->do_alloc () : -1;
82 return instance->do_free (scope);
85 static std::list<scope_id>
scopes (
void)
87 return instance_ok () ? instance->do_scopes () : std::list<scope_id> ();
90 static void create_instance (
void);
100 error (
"unable to create scope_id_cache object!");
130 set_iterator
p = free_list.begin ();
132 if (p != free_list.end ())
138 retval = next_available++;
140 in_use.insert (retval);
147 set_iterator
p = in_use.find (scope);
149 if (p == in_use.end ())
150 error (
"free_scope: scope %d not found!", scope);
153 free_list.insert (scope);
158 std::list<scope_id>
retval;
160 for (set_const_iterator
p = in_use.begin ();
p != in_use.end ();
p++)
161 retval.push_back (*
p);
177 static const unsigned int local = 1;
181 static const unsigned int automatic = 2;
184 static const unsigned int formal = 4;
187 static const unsigned int hidden = 8;
190 static const unsigned int inherited = 16;
193 static const unsigned int global = 32;
196 static const unsigned int persistent = 64;
200 static const unsigned int added_static = 128;
211 : decl_scope (s), curr_fcn (0),
name (nm), value_stack (),
212 storage_class (sc), finfo (), valid (true), count (1)
214 value_stack.push_back (v);
218 context_id
context = xdefault_context)
225 const std::list<octave_value_list>& idx,
227 context_id
context = xdefault_context)
229 varref(
context).assign (op, type, idx, value);
233 context_id
context = xdefault_context)
235 varref(
context).assign (op, value);
239 context_id
context = xdefault_context)
241 varref(
context).do_non_const_unary_op (op);
246 const std::list<octave_value_list>& idx,
247 context_id
context = xdefault_context)
249 varref(
context).do_non_const_unary_op (op, type, idx);
265 else if (is_persistent ())
274 if (
context == xdefault_context)
277 context_id n = value_stack.size ();
289 else if (is_persistent ())
293 if (
context == xdefault_context)
296 if (
context < value_stack.size ())
305 if (! (is_persistent () || is_global ())
328 if (! (is_persistent () || is_global ())
331 value_stack.pop_back ();
332 retval = value_stack.size ();
342 if (! (is_hidden () || is_inherited ())
348 if (is_persistent ())
352 unmark_persistent ();
361 if (
context == xdefault_context)
364 return varval (
context).is_defined ();
374 if (context == xdefault_context)
375 context = active_context ();
377 return (! is_local () || is_defined (context));
380 bool is_local (
void)
const {
return storage_class & local; }
382 bool is_formal (
void)
const {
return storage_class & formal; }
383 bool is_hidden (
void)
const {
return storage_class & hidden; }
385 bool is_global (
void)
const {
return storage_class & global; }
396 if (is_persistent ())
397 error (
"can't make persistent variable %s global",
name.c_str ());
399 storage_class |= global;
404 error (
"can't make global variable %s persistent",
name.c_str ());
406 storage_class |= persistent;
439 unmark_persistent ();
445 scope_id
scope (
void)
const {
return decl_scope; }
458 void dump (std::ostream& os,
const std::string& prefix)
const;
490 unsigned int sc = local)
503 if (--rep->count == 0)
515 if (--rep->count == 0)
532 context_id
context = xdefault_context)
539 const std::list<octave_value_list>& idx,
541 context_id
context = xdefault_context)
543 rep->assign (op, type, idx, value,
context);
547 context_id
context = xdefault_context)
549 rep->assign (op, value,
context);
554 rep->do_non_const_unary_op (op);
559 const std::list<octave_value_list>& idx)
561 rep->do_non_const_unary_op (op, type, idx);
579 void clear (
void) { rep->clear (); }
581 void clear (scope_id
s) { rep->clear (s); }
585 return rep->is_defined (
context);
590 return ! rep->is_defined (
context);
595 return rep->is_valid ();
600 return rep->is_variable (
context);
603 bool is_local (
void)
const {
return rep->is_local (); }
605 bool is_formal (
void)
const {
return rep->is_formal (); }
606 bool is_global (
void)
const {
return rep->is_global (); }
607 bool is_hidden (
void)
const {
return rep->is_hidden (); }
638 scope_id
scope (
void)
const {
return rep->scope (); }
647 rep->dump (os, prefix);
670 : scope (curr_scope), sym (record)
674 : scope (ref.scope), sym (ref.sym)
720 if (scope != curr_scope || ! sym.is_valid ())
738 typedef std::map<scope_id, octave_value>::const_iterator
742 typedef std::map<std::string, octave_value>::const_iterator
757 :
name (nm), package_name (), subfunctions (), private_functions (),
758 class_constructors (), class_methods (), dispatch_map (),
759 cmdline_function (), autoload_function (), function_on_path (),
760 built_in_function (), count (1)
762 size_t pos =
name.rfind (
'.');
764 if (pos != std::string::npos)
766 package_name =
name.substr (0, pos);
791 return function_on_path.is_defined ();
797 return find (args, local_funcs);
802 scope_val_iterator
p = subfunctions.find (scope);
804 if (p != subfunctions.end ())
810 scope_val_iterator
p = subfunctions.find (scope);
812 if (p != subfunctions.end ())
816 std::pair<std::string, octave_value>
821 return p == subfunctions.end ()
822 ? std::pair<std::string, octave_value> ()
823 : std::pair<std::string, octave_value> (
name, p->second);
828 scope_val_iterator
p = subfunctions.find (scope);
830 if (p != subfunctions.end ())
831 subfunctions.erase (p);
834 void mark_subfunction_in_scope_as_private (scope_id scope,
839 cmdline_function =
f;
844 subfunctions[scope] =
f;
849 function_on_path =
f;
854 built_in_function =
f;
857 template <
typename T>
861 typename std::map<T, octave_value>::iterator
p = map.begin ();
863 while (p != map.end ())
865 if (force || ! p->second.islocked ())
874 if (force || ! autoload_function.islocked ())
882 clear_autoload_function (force);
884 if (force || ! function_on_path.islocked ())
887 if (force || ! cmdline_function.islocked ())
893 if (function_on_path.is_mex_function ())
894 clear_user_function ();
899 package = octave_value ();
904 clear_map (subfunctions, force);
905 clear_map (private_functions, force);
906 clear_map (class_constructors, force);
907 clear_map (class_methods, force);
909 clear_autoload_function (force);
910 clear_user_function (force);
921 dispatch_map_iterator
p = dispatch_map.find (type);
923 if (p != dispatch_map.end ())
924 dispatch_map.erase (p);
927 void print_dispatch (std::ostream& os)
const;
933 void dump (std::ostream& os,
const std::string& prefix)
const;
937 if (package_name.empty ())
940 return package_name +
"." +
name;
1001 if (--rep->count == 0)
1013 if (--rep->count == 0)
1018 bool local_funcs =
true)
1020 return rep->find (
args, local_funcs);
1025 return rep->builtin_find ();
1030 return rep->find_method (dispatch_type);
1035 return rep->built_in_function;
1040 return rep->cmdline_function;
1045 return rep->find_autoload ();
1050 return rep->find_user_function ();
1055 return rep->is_user_function_defined ();
1060 bool local_funcs =
true)
1062 return rep->find_function (
args, local_funcs);
1067 rep->lock_subfunction (scope);
1072 rep->unlock_subfunction (scope);
1075 std::pair<std::string, octave_value>
1078 return rep->subfunction_defined_in_scope (scope);
1083 rep->erase_subfunction (scope);
1089 rep->mark_subfunction_in_scope_as_private (scope, class_name);
1094 rep->install_cmdline_function (f);
1099 rep->install_subfunction (f, scope);
1104 rep->install_user_function (f);
1109 rep->install_built_in_function (f);
1112 void clear (
bool force =
false) { rep->clear (force); }
1116 rep->clear_user_function (force);
1121 rep->clear_autoload_function (force);
1128 rep->add_dispatch (type, fname);
1133 rep->clear_dispatch (type);
1138 rep->print_dispatch (os);
1142 {
return rep->help_for_dispatch (); }
1146 return rep->get_dispatch ();
1152 rep->dump (os, prefix);
1167 static scope_id
alloc_scope (
void) {
return scope_id_cache::alloc (); }
1171 if (scope == xglobal_scope)
1172 error (
"can't set scope to global");
1174 if (scope != xcurrent_scope)
1178 if (p == all_instances.end ())
1183 all_instances[scope] = instance = inst;
1186 instance = p->second;
1188 xcurrent_scope = scope;
1189 xcurrent_context = 0;
1195 if (scope == xglobal_scope)
1196 error (
"can't set scope to global");
1198 if (scope != xcurrent_scope)
1202 if (p == all_instances.end ())
1203 error (
"scope not found!");
1205 instance = p->second;
1207 xcurrent_scope = scope;
1217 assert (scope != xglobal_scope);
1219 erase_subfunctions_in_scope (scope);
1223 if (p != all_instances.end ())
1227 all_instances.erase (p);
1236 q->second.erase_subfunction (scope);
1244 q->second.mark_subfunction_in_scope_as_private (scope, class_name);
1255 scope_id new_scope = alloc_scope ();
1259 if (new_symbol_table)
1261 all_instances[new_scope] = new_symbol_table;
1274 return scope_id_cache::scopes ();
1277 static symbol_record
1287 inherit (scope_id scope, scope_id donor_scope, context_id donor_context)
1293 symbol_table *donor_symbol_table = get_instance (donor_scope);
1295 if (donor_symbol_table)
1296 inst->
do_inherit (*donor_symbol_table, donor_context);
1306 bool skip_variables =
false,
1307 bool local_funcs =
true);
1313 scope_id scope = xcurrent_scope)
1322 scope_id scope = xcurrent_scope)
1332 scope_id scope = xcurrent_scope,
1333 context_id
context = xdefault_context,
1334 bool force_add =
false)
1342 OCTAVE_DEPRECATED (
"use 'assign' instead")
1344 varref (const
std::
string& name, scope_id scope = xcurrent_scope,
1345 context_id
context = xdefault_context,
bool force_add =
false)
1349 return inst ? inst->
do_varref (name,
context, force_add) : dummy_octave_value;
1357 scope_id scope = xcurrent_scope,
1358 context_id
context = xdefault_context)
1363 OCTAVE_DEPRECATED (
"use 'force_assign' instead")
1365 force_varref (const
std::
string& name, scope_id scope = xcurrent_scope,
1366 context_id
context = xdefault_context)
1374 scope_id scope = xcurrent_scope,
1375 context_id
context = xdefault_context)
1389 if (p == global_table.end ())
1390 global_table[name] =
value;
1395 OCTAVE_DEPRECATED (
"use 'global_assign' instead")
1397 global_varref (const
std::
string& name)
1402 return (p == global_table.end ()) ? global_table[name] : p->second;
1410 return (p != global_table.end ()) ? p->second :
octave_value ();
1417 assign (name,
value, top_scope (), 0);
1420 OCTAVE_DEPRECATED (
"use 'top_level_assign' instead")
1422 top_level_varref (const
std::
string& name)
1426 return inst ? inst->
do_varref (name, 0,
true) : dummy_octave_value;
1432 return varval (name, top_scope (), 0);
1449 persistent_assign (name, xcurrent_scope,
value);
1452 OCTAVE_DEPRECATED (
"use 'persistent_assign' instead")
1454 persistent_varref (const
std::
string& name)
1462 scope_id scope = xcurrent_scope)
1470 scope_id scope = xcurrent_scope)
1479 scope_id scope = xcurrent_scope)
1499 if (p != fcn_table.end ())
1504 fcn = find_submethod (name, dispatch_type);
1515 fcn = find_submethod (name, dispatch_type);
1518 fcn_table[name] = finfo;
1532 return (p != fcn_table.end ())
1533 ? p->second.find_built_in_function () :
octave_value ();
1541 return (p != fcn_table.end ())
1548 bool local_funcs =
true);
1554 return (p != fcn_table.end ())
1562 return (p != fcn_table.end ())
1563 ? p->second.find_cmdline_function () :
octave_value ();
1571 if (p != fcn_table.end ())
1583 fcn_table[
name] = finfo;
1596 if (p != fcn_table.end ())
1608 fcn_table[
name] = finfo;
1612 static void install_nestfunction (
const std::string& name,
1614 scope_id parent_scope);
1628 if (p != fcn_table.end ())
1640 fcn_table[
name] = finfo;
1649 if (p != fcn_table.end ())
1661 fcn_table[
name] = finfo;
1674 clear_global_pattern (
"*");
1676 clear_functions (force);
1693 clear_variables (xcurrent_scope);
1707 p->second.clear (force);
1712 clear_user_function (name);
1716 scope_id scope = xcurrent_scope)
1725 scope_id scope = xcurrent_scope)
1747 if (pattern.
match (
p->first))
1748 p->second.clear_user_function ();
1753 scope_id scope = xcurrent_scope)
1762 scope_id scope = xcurrent_scope)
1771 scope_id scope = xcurrent_scope)
1783 clear_variable_pattern (pat);
1784 clear_function_pattern (pat);
1791 if (p != fcn_table.end ())
1807 if (p != fcn_table.end ())
1826 static bool set_class_relationship (
const std::string& sup_class,
1842 fcn_table[alias] = finfo;
1845 panic (
"alias: '%s' is undefined", name.c_str ());
1853 if (p != fcn_table.end ())
1865 fcn_table[
name] = finfo;
1873 if (p != fcn_table.end ())
1885 if (p != fcn_table.end ())
1899 if (p != fcn_table.end ())
1915 if (p != fcn_table.end ())
1927 if (scope == xglobal_scope || scope == xtop_scope)
1928 error (
"invalid call to symtab::push_context");
1942 if (scope == xglobal_scope || scope == xtop_scope)
1943 error (
"invalid call to symtab::pop_context");
1958 scope_id scope = xcurrent_scope)
1967 scope_id scope = xcurrent_scope)
1976 scope_id scope = xcurrent_scope)
1985 static std::list<symbol_record>
1987 context_id
context = xdefault_context,
1988 bool defined_only =
true,
1989 unsigned int exclude = symbol_record::hidden)
1995 : std::list<symbol_record> ();
1999 scope_id scope = xcurrent_scope)
2003 return inst ? inst->
do_glob (pattern) : std::list<symbol_record> ();
2007 scope_id scope = xcurrent_scope)
2011 return inst ? inst->
do_regexp (pattern) : std::list<symbol_record> ();
2015 scope_id scope = xcurrent_scope)
2019 return inst ? inst->
do_glob (pattern,
true) : std::list<symbol_record> ();
2023 scope_id scope = xcurrent_scope)
2027 return inst ? inst->
do_regexp (pattern,
true) : std::list<symbol_record> ();
2030 static std::list<symbol_record>
2033 std::list<symbol_record>
retval;
2038 p != global_table.end ();
p++)
2044 if (pat.
match (
p->first))
2046 p->first,
p->second,
2047 symbol_record::global));
2053 static std::list<symbol_record>
2056 std::list<symbol_record>
retval;
2061 p != global_table.end ();
p++)
2069 p->first,
p->second,
2070 symbol_record::global));
2078 std::list<symbol_record>
retval;
2080 size_t len = patterns.
numel ();
2082 for (
size_t i = 0;
i < len;
i++)
2084 std::list<symbol_record>
tmp = glob_variables (patterns[
i]);
2086 retval.insert (retval.begin (), tmp.begin (), tmp.end ());
2092 static std::list<symbol_record> regexp_variables
2095 std::list<symbol_record>
retval;
2097 size_t len = patterns.
numel ();
2099 for (
size_t i = 0;
i < len;
i++)
2101 std::list<symbol_record>
tmp = regexp_variables (patterns[
i]);
2103 retval.insert (retval.begin (), tmp.begin (), tmp.end ());
2111 std::list<std::string>
retval;
2114 p != fcn_table.end ();
p++)
2116 if (
p->second.is_user_function_defined ())
2117 retval.push_back (
p->first);
2120 if (! retval.empty ())
2128 std::list<std::string>
retval;
2131 p != global_table.end ();
p++)
2132 retval.push_back (
p->first);
2155 std::list<std::string>
retval;
2158 p != fcn_table.end ();
p++)
2163 retval.push_back (
p->first);
2166 if (! retval.empty ())
2174 std::list<std::string>
retval;
2177 p != fcn_table.end ();
p++)
2182 retval.push_back (
p->first);
2185 if (! retval.empty ())
2192 scope_id scope = xcurrent_scope)
2194 if (scope == xglobal_scope)
2205 scope_id scope = xcurrent_scope)
2207 if (scope == xglobal_scope)
2225 static void dump (std::ostream& os, scope_id scope = xcurrent_scope);
2227 static void dump_global (std::ostream& os);
2229 static void dump_functions (std::ostream& os);
2242 p != fcn_table.end ();
p++)
2243 p->second.lock_subfunction (scope);
2249 p != fcn_table.end ();
p++)
2250 p->second.unlock_subfunction (scope);
2253 static std::map<std::string, octave_value>
2256 std::map<std::string, octave_value>
retval;
2259 p != fcn_table.end ();
p++)
2261 std::pair<std::string, octave_value>
tmp
2262 =
p->second.subfunction_defined_in_scope (scope);
2267 retval[nm] = tmp.second;
2275 if (scope == xglobal_scope || scope == xtop_scope)
2276 error (
"can't free global or top-level scopes!");
2281 static void stash_dir_name_for_subfunctions (scope_id scope,
2285 const std::list<std::string>& parent_list)
2287 parent_map[classname] = parent_list;
2290 static std::list<std::string>
2293 std::list<std::string>
retval;
2297 if (it != parent_map.end ())
2298 retval = it->second;
2300 for (std::list<std::string>::const_iterator lit = retval.begin ();
2301 lit != retval.end (); lit++)
2307 std::list<std::string> parents = parent_classes (*lit);
2309 if (! parents.empty ())
2310 retval.insert (retval.end (), parents.begin (), parents.end ());
2323 scope_id scope = xcurrent_scope)
2325 assert (scope != xtop_scope && scope != xglobal_scope);
2331 assert (inst->
curr_fcn == 0 || curr_fcn == 0);
2335 static void cleanup (
void);
2345 typedef std::map<std::string, symbol_record>::const_iterator
2347 typedef std::map<std::string, symbol_record>::iterator
2350 typedef std::map<std::string, octave_value>::const_iterator
2352 typedef std::map<std::string, octave_value>::iterator
2355 typedef std::map<std::string, octave_value>::const_iterator
2357 typedef std::map<std::string, octave_value>::iterator
2360 typedef std::map<scope_id, symbol_table*>::const_iterator
2362 typedef std::map<scope_id, symbol_table*>::iterator
2365 typedef std::map<std::string, fcn_info>::const_iterator
2367 typedef std::map<std::string, fcn_info>::iterator
2378 std::map<std::string, symbol_record>
table;
2412 typedef std::map<std::string, std::set<std::string> >::const_iterator
2414 typedef std::map<std::string, std::set<std::string> >::iterator
2418 static std::map<std::string, std::list<std::string> >
parent_map;
2420 typedef std::map<std::string, std::list<std::string> >::const_iterator
2422 typedef std::map<std::string, std::list<std::string> >::iterator
2432 static const context_id xdefault_context =
static_cast<context_id
> (-1);
2435 : my_scope (scope), table_name (), table (), nest_children (),
2436 nest_parent (0), curr_fcn (0), static_workspace (
false),
2437 persistent_table () { }
2447 if (scope != xglobal_scope)
2449 if (scope == xcurrent_scope)
2451 if (! instance && create)
2457 all_instances[scope] = instance = inst;
2459 if (scope == xtop_scope)
2473 if (p == all_instances.end ())
2480 all_instances[scope] =
retval;
2493 error (
"unable to %s symbol_table object for scope %d!",
2494 create ?
"create" :
"find", scope);
2502 nest_children.push_back (&st);
2508 table[sr.
name ()] = sr;
2523 if (p == table.end ())
2524 return do_insert (name);
2539 if (nm !=
"__retval__")
2557 return p != fcn_table.end () ? &p->second : 0;
2562 bool skip_variables,
bool local_funcs);
2570 if (p == table.end ())
2575 return table[name] = ret;
2578 if (static_workspace && ! force_add)
2581 return table[
name] = ret;
2592 if (p != table.end ())
2600 table[new_name] = sr;
2605 context_id
context,
bool force_add)
2609 if (p == table.end ())
2613 sr.
assign (value, context);
2616 p->second.assign (value, context);
2626 if (p == table.end ())
2630 return sr.
varref (context);
2633 return p->second.varref (context);
2640 return (p != table.end ()) ? p->second.varval (context) :
octave_value ();
2647 if (p == persistent_table.end ())
2648 persistent_table[name] = value;
2659 return (p == persistent_table.end ())
2660 ? persistent_table[name] : p->second;
2667 return (p != persistent_table.end ()) ? p->second :
octave_value ();
2674 if (p != persistent_table.end ())
2675 persistent_table.erase (p);
2684 if (p != table.end ())
2697 p->second.push_context (my_scope);
2704 while (p != table.end ())
2706 if (p->second.pop_context (my_scope) == 0)
2716 p->second.clear (my_scope);
2726 p->second.clear (my_scope);
2734 if (p != table.end ())
2744 if (q != global_table.end ())
2745 global_table.erase (q);
2753 if (p != table.end ())
2754 p->second.clear (my_scope);
2771 while (q != global_table.end ())
2773 if (pattern.
match (q->first))
2774 global_table.erase (q++);
2791 sr.
clear (my_scope);
2807 sr.
clear (my_scope);
2814 do_insert (name).mark_automatic ();
2819 do_insert (name).mark_hidden ();
2824 do_insert (name).mark_global ();
2827 std::list<symbol_record>
2829 unsigned int exclude)
const
2831 std::list<symbol_record>
retval;
2837 if ((defined_only && ! sr.
is_defined (context))
2841 retval.push_back (sr);
2848 bool vars_only =
false)
const
2850 std::list<symbol_record>
retval;
2856 if (pat.
match (
p->first))
2863 retval.push_back (sr);
2871 bool vars_only =
false)
const
2873 std::list<symbol_record>
retval;
2886 retval.push_back (sr);
2895 std::list<std::string>
retval;
2899 if (
p->second.is_variable ())
2900 retval.push_back (
p->first);
2912 return (p != table.end ()
2913 && ! p->second.is_global ()
2914 && p->second.is_defined ());
2921 return p != table.end () && p->second.is_global ();
2924 std::list<workspace_element> do_workspace_info (
void)
const;
2926 void do_dump (std::ostream& os);
2930 void do_update_nest (
void);
2935 if (p == table.end ())
2940 else if (! p->second.is_automatic ())
2952 bool check_relative =
true);
void unlock_subfunction(scope_id scope)
static std::list< symbol_record > glob_variables(const string_vector &patterns)
std::list< symbol_record > do_all_variables(context_id context, bool defined_only, unsigned int exclude) const
octave_value find_function(const octave_value_list &args, bool local_funcs)
dispatch_map_type::iterator dispatch_map_iterator
static void clear_objects(scope_id scope=xcurrent_scope)
void panic(const char *fmt,...)
bool is_object(void) const
static void install_built_in_function(const std::string &name, const octave_value &fcn)
static void pop_context(void *)
octave_value built_in_function
void do_clear_variable(const std::string &name)
std::map< std::string, std::set< std::string > >::iterator class_precedence_table_iterator
static void free_scope(scope_id scope)
void do_dup_scope(symbol_table &new_symbol_table) const
void dump(std::ostream &os, const std::string &prefix="") const
void mark_added_static(void)
static scope_id dup_scope(scope_id scope)
static void install_subfunction(const std::string &name, const octave_value &fcn, scope_id scope)
For example cd octave end example noindent changes the current working directory to an error message is printed and the working directory is not changed sc
for(octave_idx_type n=0;n< hcv.numel();n++)
const std::string & name(void) const
void set_curr_fcn(octave_user_function *fcn)
octave_user_function * curr_fcn
static void clear_functions(bool force=false)
static void rename(const std::string &old_name, const std::string &new_name, scope_id scope=xcurrent_scope)
static bool at_top_level(void)
octave_value varval(context_id context=xdefault_context) const
static scope_id alloc(void)
std::list< workspace_element > do_workspace_info(void) const
void clear_user_function(bool force=false)
bool is_formal(void) const
symbol_record & do_insert(const std::string &name, bool force_add=false)
void push_context(scope_id s)
static std::list< std::string > cmdline_function_names(void)
scope_id scope(void) const
std::set< scope_id > in_use
void clear_dispatch(const std::string &type)
octave_value find_function(const octave_value_list &args=octave_value_list(), bool local_funcs=true)
octave_value cmdline_function
octave_refcount< size_t > count
octave_value find_cmdline_function(void) const
void mark_subfunction_in_scope_as_private(scope_id scope, const std::string &class_name)
void do_pop_context(void)
octave_value & varref(context_id context=xdefault_context)
symbol_table * nest_parent
std::map< std::string, octave_value > class_methods
std::map< std::string, octave_value >::const_iterator global_table_const_iterator
static std::list< symbol_record > regexp(const std::string &pattern, scope_id scope=xcurrent_scope)
static void clear_variable_pattern(const std::string &pat, scope_id scope=xcurrent_scope)
static octave_value find_method(const std::string &name, const std::string &dispatch_type)
static void install_user_function(const std::string &name, const octave_value &fcn)
static void clear_dispatch(const std::string &name, const std::string &type)
void do_update_nest(void)
octave_idx_type numel(void) const
Number of elements in the array.
void install_subfunction(const octave_value &f, scope_id scope)
identity matrix If supplied two scalar respectively For allows like xample val
F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T const F77_REAL const F77_REAL F77_REAL &F77_RET_T const F77_DBLE const F77_DBLE F77_DBLE &F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T F77_DBLE &F77_RET_T F77_REAL &F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T const F77_DBLE F77_DBLE &F77_RET_T const F77_REAL F77_REAL &F77_RET_T F77_REAL F77_REAL &F77_RET_T F77_DBLE F77_DBLE &F77_RET_T const F77_DBLE const F77_DBLE * f
symbol_table(scope_id scope)
octave_value autoload_function
static symbol_table * get_instance(scope_id scope, bool create=true)
static std::list< symbol_record > all_variables(scope_id scope=xcurrent_scope, context_id context=xdefault_context, bool defined_only=true, unsigned int exclude=symbol_record::hidden)
void push_context(scope_id s)
dispatch_map_type get_dispatch(void) const
bool is_defined(void) const
bool is_automatic(void) const
static void set_scope(scope_id scope)
static std::map< std::string, fcn_info > fcn_table
std::map< std::string, std::list< std::string > >::const_iterator const_parent_map_iterator
bool look_nonlocal(const std::string &name, symbol_record &result)
void install_built_in_function(const octave_value &f)
bool is_variable(context_id context=xdefault_context) const
static void clear_variables(scope_id scope)
std::set< scope_id >::iterator set_iterator
static std::list< symbol_record > regexp_variables(const std::string &pattern, scope_id scope=xcurrent_scope)
static void add_to_parent_map(const std::string &classname, const std::list< std::string > &parent_list)
void error(const char *fmt,...)
symbol_table::scope_id scope(void)
bool is_automatic(void) const
symbol_reference(const symbol_reference &ref)
octave_value varval(context_id context=xdefault_context) const
static std::list< scope_id > scopes(void)
void erase_subfunction(scope_id scope)
static octave_value find_built_in_function(const std::string &name)
static void pop_context(scope_id scope)
bool out_of_date_check(octave_value &function, const std::string &dispatch_type="", bool check_relative=true)
void assign(octave_value::assign_op op, const std::string &type, const std::list< octave_value_list > &idx, const octave_value &value, context_id context=xdefault_context)
static void cleanup_instance(void)
static scope_id alloc_scope(void)
bool is_user_function_defined(void) const
OCTINTERP_API std::string get_dispatch_type(const octave_value_list &args)
unsigned int storage_class
static std::list< std::string > variable_names(scope_id scope=xcurrent_scope)
void clear_mex_function(void)
static symbol_record & insert(const std::string &name, scope_id scope=xcurrent_scope)
static void clear_mex_functions(void)
std::map< std::string, octave_value > class_constructors
bool do_is_global(const std::string &name) const
static void clear_dld_function(const std::string &name)
static void lock_subfunctions(scope_id scope=xcurrent_scope)
static std::map< std::string, octave_value > global_table
static void mark_automatic(const std::string &name, scope_id scope=xcurrent_scope)
static void clear(const std::string &name)
void do_clear_global(const std::string &name)
bool is_valid(void) const
std::set< scope_id > free_list
std::map< scope_id, octave_value >::iterator scope_val_iterator
static bool is_local_variable(const std::string &name, scope_id scope=xcurrent_scope)
static octave_value dummy_octave_value
bool is_local(void) const
void clear_dispatch(const std::string &type)
bool is_added_static(void) const
std::map< std::string, octave_value >::iterator persistent_table_iterator
void mark_inherited(void)
bool is_formal(void) const
static octave_value varval(const std::string &name, scope_id scope=xcurrent_scope, context_id context=xdefault_context)
static void clear_variables(void)
static octave_value find_cmdline_function(const std::string &name)
void do_non_const_unary_op(octave_value::unary_op op, const std::string &type, const std::list< octave_value_list > &idx, context_id context=xdefault_context)
octave_user_function & operator=(const octave_user_function &fn)
static void cache_name(scope_id scope, const std::string &name)
void do_persistent_assign(const std::string &name, const octave_value &value)
void install_user_function(const octave_value &f)
static scope_id global_scope(void)
std::string help_for_dispatch(void) const
std::map< std::string, symbol_record >::iterator table_iterator
calling an anonymous function involves an overhead quite comparable to the overhead of an m file function Passing a handle to a built in function is because the interpreter is not involved in the internal loop For a
octave_value find_user_function(void)
static void set_curr_fcn(octave_user_function *curr_fcn, scope_id scope=xcurrent_scope)
static scope_id top_scope(void)
static symbol_record find_symbol(const std::string &name, scope_id scope=xcurrent_scope)
void clear_function(const std::string &nm)
static context_id current_context(void)
symbol_record(symbol_record_rep *new_rep)
static void push_context(scope_id scope=xcurrent_scope)
dispatch_map_type::const_iterator dispatch_map_const_iterator
static void clear_user_function(const std::string &name)
static octave_value global_varval(const std::string &name)
void clear(bool force=false)
static void mark_subfunctions_in_scope_as_private(scope_id scope, const std::string &class_name)
static std::list< std::string > global_variable_names(void)
static void persistent_assign(const std::string &name, const octave_value &value=octave_value())
void unlock_subfunction(scope_id scope)
std::map< std::string, fcn_info >::iterator fcn_table_iterator
std::map< std::string, octave_value > private_functions
bool do_is_local_variable(const std::string &name) const
static scope_id_cache * instance
static context_id xcurrent_context
static std::map< std::string, std::list< std::string > > parent_map
static void clear_symbol(const std::string &name)
static std::list< symbol_record > glob_variables(const std::string &pattern, scope_id scope=xcurrent_scope)
symbol_record_rep(scope_id s, const std::string &nm, const octave_value &v, unsigned int sc)
OCTAVE_EXPORT octave_value_list isdir nd deftypefn *std::string nm
void do_assign(const std::string &name, const octave_value &value, context_id context, bool force_add)
std::map< std::string, octave_value >::iterator global_table_iterator
std::pair< std::string, octave_value > subfunction_defined_in_scope(scope_id scope=xcurrent_scope) const
void do_clear_objects(void)
dispatch_map_type dispatch_map
fcn_info(const fcn_info &fi)
std::map< std::string, octave_value >::const_iterator str_val_const_iterator
bool is_persistent(void) const
void init_persistent(void)
void clear_variable(const std::string &nm)
void unmark_persistent(void)
bool is_hidden(void) const
void do_clear_variables(void)
void install_cmdline_function(const octave_value &f)
std::map< std::string, octave_value >::const_iterator persistent_table_const_iterator
static std::list< symbol_record > regexp_global_variables(const std::string &pattern)
static llvm::LLVMContext & context
octave_value do_varval(const std::string &name, context_id context) const
bool is_global(void) const
std::set< scope_id >::const_iterator set_const_iterator
static octave_value persistent_varval(const std::string &name, scope_id scope=xcurrent_scope)
void unmark_automatic(void)
bool is_variable(context_id context) const
void unmark_inherited(void)
static void clear_variable_regexp(const std::string &pat, scope_id scope=xcurrent_scope)
bool is_defined(context_id context=xdefault_context) const
void print_dispatch(std::ostream &os) const
void lock_subfunction(scope_id scope)
static void erase_subfunctions_in_scope(scope_id scope)
static void force_assign(const std::string &name, const octave_value &value=octave_value(), scope_id scope=xcurrent_scope, context_id context=xdefault_context)
static void global_assign(const std::string &name, const octave_value &value=octave_value())
octave_user_function * curr_fcn
static void pop_context(void)
octave_value find_autoload(void)
void do_non_const_unary_op(octave_value::unary_op op, context_id context=xdefault_context)
static void add_dispatch(const std::string &name, const std::string &type, const std::string &fname)
static void install_cmdline_function(const std::string &name, const octave_value &fcn)
std::map< std::string, symbol_record > table
void install_built_in_function(const octave_value &f)
bool is_black_hole(void) const
void clear_user_function(bool force=false)
bool match(const std::string &str) const
static void clear_global(const std::string &name, scope_id scope=xcurrent_scope)
void assign(const octave_value &value, context_id context=xdefault_context)
void do_push_context(void)
fcn_info(const std::string &nm="")
static fcn_info::dispatch_map_type get_dispatch(const std::string &name)
static void assign(const std::string &name, const octave_value &value=octave_value(), scope_id scope=xcurrent_scope, context_id context=xdefault_context, bool force_add=false)
void add_dispatch(const std::string &type, const std::string &fname)
void do_non_const_unary_op(octave_value::unary_op op)
std::map< std::string, std::list< std::string > >::iterator parent_map_iterator
octave_value builtin_find(void)
void mark_added_static(void)
void unmark_added_static(void)
static std::list< std::string > parent_classes(const std::string &dispatch_type)
std::list< scope_id > do_scopes(void) const
std::deque< octave_value > value_stack
symbol_record_rep * dup(scope_id new_scope) const
bool is_match(const std::string &buffer)
static symbol_record dummy_symbol_record
unsigned int xstorage_class(void) const
void clear_map(std::map< T, octave_value > &map, bool force=false)
void install_user_function(const octave_value &f)
octave_value find_method(const std::string &dispatch_type) const
static scope_id xcurrent_scope
void assign(octave_value::assign_op op, const std::string &type, const std::list< octave_value_list > &idx, const octave_value &value, context_id context=xdefault_context)
static octave_value find_autoload(const std::string &name)
void erase_persistent(void)
static octave_user_function * get_curr_fcn(scope_id scope=xcurrent_scope)
std::map< std::string, std::string > dispatch_map_type
octave_value do_persistent_varval(const std::string &name)
std::list< symbol_record > do_glob(const std::string &pattern, bool vars_only=false) const
With real return the complex result
octave_value find_built_in_function(void) const
void mark_automatic(void)
void assign(const octave_value &value, context_id context=xdefault_context)
static std::map< scope_id, symbol_table * > all_instances
void insert_symbol_record(const symbol_record &sr)
static std::map< std::string, std::set< std::string > > class_precedence_table
static octave_idx_type find(octave_idx_type i, octave_idx_type *pp)
std::map< scope_id, symbol_table * >::const_iterator all_instances_const_iterator
void unmark_automatic(void)
static bool is_variable(const std::string &name, scope_id scope=xcurrent_scope)
static void persistent_assign(const std::string &name, scope_id scope, const octave_value &value=octave_value())
std::map< scope_id, symbol_table * >::iterator all_instances_iterator
context_id active_context(void) const
static void clear_all(bool force=false)
octave_refcount< size_t > count
void erase_persistent(void)
static std::list< std::string > user_function_names(void)
static std::string help_for_dispatch(const std::string &name)
void do_clear_variable_regexp(const std::string &pat)
void erase_subfunction(scope_id scope)
void rename(const std::string &new_name)
static void clear_variable(const std::string &name, scope_id scope=xcurrent_scope)
static void alias_built_in_function(const std::string &alias, const std::string &name)
void do_non_const_unary_op(octave_value::unary_op op, const std::string &type, const std::list< octave_value_list > &idx)
void do_cache_name(const std::string &name)
std::map< std::string, symbol_record >::const_iterator table_const_iterator
void init_persistent(void)
static void mark_hidden(const std::string &name, scope_id scope=xcurrent_scope)
void do_clear_global_pattern(const std::string &pat)
dispatch_map_type get_dispatch(void) const
std::map< std::string, octave_value >::iterator str_val_iterator
static std::list< symbol_record > glob(const std::string &pattern, scope_id scope=xcurrent_scope)
fcn_info_rep(const std::string &nm)
static bool is_global(const std::string &name, scope_id scope=xcurrent_scope)
static symbol_table * instance
std::list< std::string > do_variable_names(void)
static const scope_id xtop_scope
static std::list< scope_id > scopes(void)
bool is_valid(void) const
bool is_local(void) const
void do_mark_hidden(const std::string &name)
void mark_automatic(void)
bool is_user_function_defined(void) const
void unmark_inherited(void)
bool is_defined(context_id context=xdefault_context) const
=val(i)}if ode{val(i)}occurs in table i
static void free(scope_id scope)
void clear_mex_function(void)
is longer than or if then or only for unique occurrences of the complete pattern(false).The default is true.If a cell array of strings ar
OCTAVE_EXPORT octave_value_list or N dimensional array whose elements are all equal to the IEEE symbol zero divided by nd tex zero divided by nd ifnottex and any operation involving another NaN value(5+NaN).Note that NaN always compares not equal to NaN(NaN!
symbol_reference(const symbol_record &record, scope_id curr_scope=symbol_table::current_scope())
void do_free(scope_id scope)
static std::list< std::string > top_level_variable_names(void)
void install_cmdline_function(const octave_value &f)
std::map< std::string, octave_value > persistent_table
static std::list< symbol_record > glob_global_variables(const std::string &pattern)
void clear(bool force=false)
void add_nest_child(symbol_table &st)
void do_rename(const std::string &old_name, const std::string &new_name)
bool is_persistent(void) const
std::pair< std::string, octave_value > subfunction_defined_in_scope(scope_id scope) const
void dump(std::ostream &os, const std::string &prefix="") const
static const scope_id xglobal_scope
bool is_added_static(void) const
void lock_subfunction(scope_id scope)
octave_value & varref(context_id context=xdefault_context)
std::list< symbol_record > do_regexp(const std::string &pattern, bool vars_only=false) const
bool is_undefined(context_id context=xdefault_context) const
octave_value & do_persistent_varref(const std::string &name)
static void inherit(scope_id scope, scope_id donor_scope, context_id donor_context)
void clear_autoload_function(bool force=false)
static void clear_global_pattern(const std::string &pat, scope_id scope=xcurrent_scope)
size_t pop_context(scope_id s)
std::map< std::string, std::set< std::string > >::const_iterator class_precedence_table_const_iterator
bool is_inherited(void) const
void set_curr_fcn(octave_user_function *fcn)
void do_erase_persistent(const std::string &name)
void assign(octave_value::assign_op op, const octave_value &value, context_id context=xdefault_context)
void do_inherit(symbol_table &donor_table, context_id donor_context)
static bool instance_ok(void)
void mark_inherited(void)
static fcn_info * get_fcn_info(const std::string &name)
symbol_record dup(scope_id new_scope) const
static bool is_built_in_function_name(const std::string &name)
scope_id scope(void) const
static void unlock_subfunctions(scope_id scope=xcurrent_scope)
static void clear_symbol_pattern(const std::string &pat)
octave_value function_on_path
void mark_persistent(void)
static void erase_persistent(const std::string &name, scope_id scope=xcurrent_scope)
static void update_nest(scope_id scope)
bool is_inherited(void) const
void do_mark_global(const std::string &name)
std::vector< symbol_table * > nest_children
std::string full_name(void) const
std::map< std::string, fcn_info >::const_iterator fcn_table_const_iterator
void install_subfunction(const octave_value &f, scope_id scope)
void mark_persistent(void)
bool do_is_variable(const std::string &name) const
static std::list< workspace_element > workspace_info(scope_id scope=xcurrent_scope)
static octave_value find_user_function(const std::string &name)
static std::map< std::string, octave_value > subfunctions_defined_in_scope(scope_id scope=xcurrent_scope)
void assign(octave_value::assign_op op, const octave_value &value, context_id context=xdefault_context)
static void print_dispatch(std::ostream &os, const std::string &name)
If this string is the system will ring the terminal sometimes it is useful to be able to print the original representation of the string
bool is_global(void) const
symbol_record(const symbol_record &sr)
static std::list< std::string > built_in_function_names(void)
static void clear_function(const std::string &name)
std::map< scope_id, octave_value > subfunctions
static void clear_function_pattern(const std::string &pat)
octave_value find(const octave_value_list &args=octave_value_list(), bool local_funcs=true)
static void set_scope_and_context(scope_id scope, context_id context)
symbol_record(scope_id s=xcurrent_scope, const std::string &nm="", const octave_value &v=octave_value(), unsigned int sc=local)
size_t pop_context(scope_id s)
static void mark_global(const std::string &name, scope_id scope=xcurrent_scope)
return octave_value(v1.char_array_value().concat(v2.char_array_value(), ra_idx),((a1.is_sq_string()||a2.is_sq_string())? '\'': '"'))
void unmark_persistent(void)
static void erase_scope(scope_id scope)
std::map< scope_id, octave_value >::const_iterator scope_val_const_iterator
static void top_level_assign(const std::string &name, const octave_value &value=octave_value())
bool is_hidden(void) const
void do_clear_variable_pattern(const std::string &pat)
static scope_id current_scope(void)
octave_value & do_varref(const std::string &name, context_id context, bool force_add)
void clear_autoload_function(bool force=false)
static octave_value top_level_varval(const std::string &name)
symbol_record do_find_symbol(const std::string &name)
void do_mark_automatic(const std::string &name)
void add_dispatch(const std::string &type, const std::string &fname)
const std::string & name(void) const
void unmark_added_static(void)