24 #if !defined (octave_symtab_h)
25 #define octave_symtab_h 1
72 return instance_ok () ? instance->do_alloc () : -1;
78 return instance->do_free (scope);
81 static std::list<scope_id>
scopes (
void)
83 return instance_ok () ? instance->do_scopes () : std::list<scope_id> ();
86 static void create_instance (
void);
97 ::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 ())
152 free_list.insert (scope);
155 error (
"free_scope: scope %d not found!", scope);
160 std::list<scope_id> retval;
162 for (set_const_iterator p = in_use.begin (); p != in_use.end (); p++)
163 retval.push_back (*p);
179 static const unsigned int local = 1;
183 static const unsigned int automatic = 2;
186 static const unsigned int formal = 4;
189 static const unsigned int hidden = 8;
192 static const unsigned int inherited = 16;
195 static const unsigned int global = 32;
198 static const unsigned int persistent = 64;
202 static const unsigned int added_static = 128;
213 : decl_scope (s), curr_fcn (0), name (nm), value_stack (),
214 storage_class (sc), finfo (), valid (true), count (1)
216 value_stack.push_back (v);
220 context_id
context = xdefault_context)
226 const std::string&
type,
227 const std::list<octave_value_list>& idx,
229 context_id
context = xdefault_context)
231 varref(
context).assign (op, type, idx, value);
235 context_id
context = xdefault_context)
237 varref(
context).assign (op, value);
241 context_id
context = xdefault_context)
243 varref(
context).do_non_const_unary_op (op);
247 const std::string&
type,
248 const std::list<octave_value_list>& idx,
249 context_id
context = xdefault_context)
251 varref(
context).do_non_const_unary_op (op, type, idx);
267 else if (is_persistent ())
278 if (
context == xdefault_context)
281 context_id n = value_stack.size ();
293 else if (is_persistent ())
297 if (
context == xdefault_context)
300 if (
context < value_stack.size ())
309 if (! (is_persistent () || is_global ())
332 if (! (is_persistent () || is_global ())
335 value_stack.pop_back ();
336 retval = value_stack.size ();
346 if (! (is_hidden () || is_inherited ())
352 if (is_persistent ())
356 unmark_persistent ();
365 if (
context == xdefault_context)
368 return varval (
context).is_defined ();
378 if (context == xdefault_context)
379 context = active_context ();
381 return (! is_local () || is_defined (context));
384 bool is_local (
void)
const {
return storage_class & local; }
386 bool is_formal (
void)
const {
return storage_class & formal; }
387 bool is_hidden (
void)
const {
return storage_class & hidden; }
389 bool is_global (
void)
const {
return storage_class & global; }
400 if (is_persistent ())
401 error (
"can't make persistent variable %s global", name.c_str ());
403 storage_class |= global;
408 error (
"can't make global variable %s persistent", name.c_str ());
410 storage_class |= persistent;
443 unmark_persistent ();
449 scope_id
scope (
void)
const {
return decl_scope; }
462 void dump (std::ostream& os,
const std::string& prefix)
const;
492 const std::string& nm = std::string (),
494 unsigned int sc = local)
507 if (--rep->count == 0)
519 if (--rep->count == 0)
528 const std::string&
name (
void)
const {
return rep->name; }
530 void rename (
const std::string& new_name) { rep->name = new_name; }
536 context_id
context = xdefault_context)
542 const std::string&
type,
543 const std::list<octave_value_list>& idx,
545 context_id
context = xdefault_context)
547 rep->assign (op, type, idx, value,
context);
551 context_id
context = xdefault_context)
553 rep->assign (op, value,
context);
558 rep->do_non_const_unary_op (op);
562 const std::string&
type,
563 const std::list<octave_value_list>& idx)
565 rep->do_non_const_unary_op (op, type, idx);
583 void clear (
void) { rep->clear (); }
585 void clear (scope_id s) { rep->clear (s); }
589 return rep->is_defined (
context);
594 return ! rep->is_defined (
context);
599 return rep->is_valid ();
604 return rep->is_variable (
context);
607 bool is_local (
void)
const {
return rep->is_local (); }
609 bool is_formal (
void)
const {
return rep->is_formal (); }
610 bool is_global (
void)
const {
return rep->is_global (); }
611 bool is_hidden (
void)
const {
return rep->is_hidden (); }
642 scope_id
scope (
void)
const {
return rep->scope (); }
649 dump (std::ostream& os,
const std::string& prefix = std::string ())
const
651 rep->dump (os, prefix);
672 : scope (curr_scope), sym (record)
676 : scope (ref.scope), sym (ref.sym)
692 const std::string&
name (
void)
const {
return sym.name (); }
722 if (scope != curr_scope || ! sym.is_valid ())
740 typedef std::map<scope_id, octave_value>::const_iterator
744 typedef std::map<std::string, octave_value>::const_iterator
759 : name (nm), package_name (), subfunctions (), private_functions (),
760 class_constructors (), class_methods (), dispatch_map (),
761 cmdline_function (), autoload_function (), function_on_path (),
762 built_in_function (), count (1)
764 size_t pos = name.rfind (
'.');
766 if (pos != std::string::npos)
768 package_name = name.substr (0, pos);
769 name = name.substr (pos+1);
773 octave_value load_private_function (
const std::string& dir_name);
777 octave_value load_class_method (
const std::string& dispatch_type);
783 octave_value find_method (
const std::string& dispatch_type);
793 return function_on_path.is_defined ();
799 return find (args, local_funcs);
804 scope_val_iterator p = subfunctions.find (scope);
806 if (p != subfunctions.end ())
812 scope_val_iterator p = subfunctions.find (scope);
814 if (p != subfunctions.end ())
818 std::pair<std::string, octave_value>
823 return p == subfunctions.end ()
824 ? std::pair<std::string, octave_value> ()
825 : std::pair<std::string, octave_value> (name, p->second);
830 scope_val_iterator p = subfunctions.find (scope);
832 if (p != subfunctions.end ())
833 subfunctions.erase (p);
836 void mark_subfunction_in_scope_as_private (scope_id scope,
837 const std::string& class_name);
841 cmdline_function =
f;
846 subfunctions[scope] =
f;
851 function_on_path =
f;
856 built_in_function =
f;
861 clear_map (std::map<T, octave_value>& map,
bool force =
false)
863 typename std::map<T, octave_value>::iterator p = map.begin ();
865 while (p != map.end ())
867 if (force || ! p->second.islocked ())
876 if (force || ! autoload_function.islocked ())
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);
916 dispatch_map[
type] = fname;
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;
929 std::string help_for_dispatch (
void)
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);
1087 const std::string& class_name)
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 ();
1150 dump (std::ostream& os,
const std::string& prefix = std::string ())
const
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");
1173 else if (scope != xcurrent_scope)
1177 if (p == all_instances.end ())
1182 all_instances[scope] = instance = inst;
1185 instance = p->second;
1187 xcurrent_scope = scope;
1188 xcurrent_context = 0;
1194 if (scope == xglobal_scope)
1195 error (
"can't set scope to global");
1198 if (scope != xcurrent_scope)
1202 if (p == all_instances.end ())
1203 error (
"scope not found!");
1206 instance = p->second;
1208 xcurrent_scope = scope;
1220 assert (scope != xglobal_scope);
1222 erase_subfunctions_in_scope (scope);
1226 if (p != all_instances.end ())
1230 all_instances.erase (p);
1239 q->second.erase_subfunction (scope);
1244 const std::string& class_name)
1247 q->second.mark_subfunction_in_scope_as_private (scope, class_name);
1252 scope_id retval = -1;
1258 scope_id new_scope = alloc_scope ();
1262 if (new_symbol_table)
1264 all_instances[new_scope] = new_symbol_table;
1277 return scope_id_cache::scopes ();
1280 static symbol_record
1281 find_symbol (
const std::string& name, scope_id scope = xcurrent_scope)
1290 inherit (scope_id scope, scope_id donor_scope, context_id donor_context)
1296 symbol_table *donor_symbol_table = get_instance (donor_scope);
1298 if (donor_symbol_table)
1299 inst->
do_inherit (*donor_symbol_table, donor_context);
1307 find (
const std::string& name,
1309 bool skip_variables =
false,
1310 bool local_funcs =
true);
1312 static octave_value builtin_find (
const std::string& name);
1316 scope_id scope = xcurrent_scope)
1322 return inst ? inst->
do_insert (name) : foobar;
1325 static void rename (
const std::string& old_name,
1326 const std::string& new_name,
1327 scope_id scope = xcurrent_scope)
1337 scope_id scope = xcurrent_scope,
1338 context_id
context = xdefault_context,
1339 bool force_add =
false)
1351 varref (
const std::string& name, scope_id scope = xcurrent_scope,
1352 context_id
context = xdefault_context,
bool force_add =
false)
1367 scope_id scope = xcurrent_scope,
1368 context_id
context = xdefault_context)
1370 assign (name, value, scope,
context,
true);
1376 context_id
context = xdefault_context) GCC_ATTR_DEPRECATED
1386 scope_id scope = xcurrent_scope,
1387 context_id
context = xdefault_context)
1401 if (p == global_table.end ())
1402 global_table[name] = value;
1414 return (p == global_table.end ()) ? global_table[name] : p->second;
1422 return (p != global_table.end ()) ? p->second :
octave_value ();
1429 assign (name, value, top_scope (), 0);
1440 return inst ? inst->
do_varref (name, 0,
true) : foobar;
1446 return varval (name, top_scope (), 0);
1501 find_method (
const std::string& name,
const std::string& dispatch_type)
1505 if (p != fcn_table.end ())
1506 return p->second.find_method (dispatch_type);
1514 fcn_table[name] = finfo;
1525 return (p != fcn_table.end ())
1526 ? p->second.find_built_in_function () :
octave_value ();
1534 return (p != fcn_table.end ())
1539 find_function (
const std::string& name,
1541 bool local_funcs =
true);
1547 return (p != fcn_table.end ())
1556 if (p != fcn_table.end ())
1568 fcn_table[name] = finfo;
1581 if (p != fcn_table.end ())
1593 fcn_table[name] = finfo;
1597 static void install_nestfunction (
const std::string& name,
1599 scope_id parent_scope);
1613 if (p != fcn_table.end ())
1625 fcn_table[name] = finfo;
1634 if (p != fcn_table.end ())
1646 fcn_table[name] = finfo;
1650 static void clear (
const std::string& name)
1659 clear_global_pattern (
"*");
1661 clear_functions (force);
1675 clear_variables (xcurrent_scope);
1689 p->second.clear (force);
1694 clear_user_function (name);
1727 if (pattern.
match (p->first))
1728 p->second.clear_user_function ();
1760 clear_variable_pattern (pat);
1761 clear_function_pattern (pat);
1768 if (p != fcn_table.end ())
1784 if (p != fcn_table.end ())
1803 static bool set_class_relationship (
const std::string& sup_class,
1804 const std::string& inf_class);
1806 static bool is_superiorto (
const std::string& a,
const std::string& b);
1809 const std::string& name)
1819 fcn_table[alias] = finfo;
1822 panic (
"alias: '%s' is undefined", name.c_str ());
1826 const std::string& fname)
1830 if (p != fcn_table.end ())
1842 fcn_table[name] = finfo;
1850 if (p != fcn_table.end ())
1862 if (p != fcn_table.end ())
1876 if (p != fcn_table.end ())
1892 if (p != fcn_table.end ())
1904 if (xcurrent_scope == xglobal_scope || xcurrent_scope == xtop_scope)
1905 error (
"invalid call to xymtab::push_context");
1917 if (xcurrent_scope == xglobal_scope || xcurrent_scope == xtop_scope)
1918 error (
"invalid call to xymtab::pop_context");
1956 static std::list<symbol_record>
1958 context_id
context = xdefault_context,
1959 bool defined_only =
true,
1960 unsigned int exclude = symbol_record::hidden)
1966 : std::list<symbol_record> ();
1969 static std::list<symbol_record>
glob (
const std::string& pattern)
1973 return inst ? inst->
do_glob (pattern) : std::list<symbol_record> ();
1976 static std::list<symbol_record>
regexp (
const std::string& pattern)
1980 return inst ? inst->
do_regexp (pattern) : std::list<symbol_record> ();
1987 return inst ? inst->
do_glob (pattern,
true) : std::list<symbol_record> ();
1994 return inst ? inst->
do_regexp (pattern,
true) : std::list<symbol_record> ();
1997 static std::list<symbol_record>
2000 std::list<symbol_record> retval;
2005 p != global_table.end (); p++)
2011 if (pat.
match (p->first))
2013 p->first, p->second,
2014 symbol_record::global));
2020 static std::list<symbol_record>
2023 std::list<symbol_record> retval;
2028 p != global_table.end (); p++)
2036 p->first, p->second,
2037 symbol_record::global));
2045 std::list<symbol_record> retval;
2047 size_t len = patterns.
length ();
2049 for (
size_t i = 0; i < len; i++)
2051 std::list<symbol_record> tmp = glob_variables (patterns[i]);
2053 retval.insert (retval.begin (), tmp.begin (), tmp.end ());
2059 static std::list<symbol_record> regexp_variables
2062 std::list<symbol_record> retval;
2064 size_t len = patterns.
length ();
2066 for (
size_t i = 0; i < len; i++)
2068 std::list<symbol_record> tmp = regexp_variables (patterns[i]);
2070 retval.insert (retval.begin (), tmp.begin (), tmp.end ());
2078 std::list<std::string> retval;
2081 p != fcn_table.end (); p++)
2083 if (p->second.is_user_function_defined ())
2084 retval.push_back (p->first);
2087 if (! retval.empty ())
2095 std::list<std::string> retval;
2098 p != global_table.end (); p++)
2099 retval.push_back (p->first);
2122 std::list<std::string> retval;
2125 p != fcn_table.end (); p++)
2127 octave_value fcn = p->second.find_built_in_function ();
2130 retval.push_back (p->first);
2133 if (! retval.empty ())
2141 std::list<std::string> retval;
2144 p != fcn_table.end (); p++)
2149 retval.push_back (p->first);
2152 if (! retval.empty ())
2160 if (xcurrent_scope == xglobal_scope)
2172 if (xcurrent_scope == xglobal_scope)
2190 static void dump (std::ostream& os, scope_id scope = xcurrent_scope);
2192 static void dump_global (std::ostream& os);
2194 static void dump_functions (std::ostream& os);
2207 p != fcn_table.end (); p++)
2208 p->second.lock_subfunction (scope);
2214 p != fcn_table.end (); p++)
2215 p->second.unlock_subfunction (scope);
2218 static std::map<std::string, octave_value>
2221 std::map<std::string, octave_value> retval;
2224 p != fcn_table.end (); p++)
2226 std::pair<std::string, octave_value> tmp
2227 = p->second.subfunction_defined_in_scope (scope);
2229 std::string nm = tmp.first;
2232 retval[nm] = tmp.second;
2240 if (scope == xglobal_scope || scope == xtop_scope)
2241 error (
"can't free global or top-level scopes!");
2246 static void stash_dir_name_for_subfunctions (scope_id scope,
2247 const std::string& dir_name);
2250 const std::list<std::string>& parent_list)
2252 parent_map[classname] = parent_list;
2255 static std::list<std::string>
2258 std::list<std::string> retval;
2262 if (it != parent_map.end ())
2263 retval = it->second;
2265 for (std::list<std::string>::const_iterator lit = retval.begin ();
2266 lit != retval.end (); lit++)
2272 std::list<std::string> parents = parent_classes (*lit);
2274 if (! parents.empty ())
2275 retval.insert (retval.end (), parents.begin (), parents.end ());
2288 scope_id scope = xcurrent_scope)
2290 assert (scope != xtop_scope && scope != xglobal_scope);
2296 assert (inst->
curr_fcn == 0 || curr_fcn == 0);
2300 static void cleanup (
void);
2310 typedef std::map<std::string, symbol_record>::const_iterator
2312 typedef std::map<std::string, symbol_record>::iterator
2315 typedef std::map<std::string, octave_value>::const_iterator
2317 typedef std::map<std::string, octave_value>::iterator
2320 typedef std::map<std::string, octave_value>::const_iterator
2322 typedef std::map<std::string, octave_value>::iterator
2325 typedef std::map<scope_id, symbol_table*>::const_iterator
2327 typedef std::map<scope_id, symbol_table*>::iterator
2330 typedef std::map<std::string, fcn_info>::const_iterator
2332 typedef std::map<std::string, fcn_info>::iterator
2343 std::map<std::string, symbol_record>
table;
2377 typedef std::map<std::string, std::set<std::string> >::const_iterator
2379 typedef std::map<std::string, std::set<std::string> >::iterator
2383 static std::map<std::string, std::list<std::string> >
parent_map;
2385 typedef std::map<std::string, std::list<std::string> >::const_iterator
2387 typedef std::map<std::string, std::list<std::string> >::iterator
2397 static const context_id xdefault_context =
static_cast<context_id
> (-1);
2400 : my_scope (scope), table_name (), table (), nest_children (),
2401 nest_parent (0), curr_fcn (0), static_workspace (false),
2402 persistent_table () { }
2412 if (scope != xglobal_scope)
2414 if (scope == xcurrent_scope)
2416 if (! instance && create)
2422 all_instances[scope] = instance = inst;
2424 if (scope == xtop_scope)
2438 if (p == all_instances.end ())
2445 all_instances[scope] = retval;
2458 error (
"unable to %s symbol_table object for scope %d!",
2459 create ?
"create" :
"find", scope);
2467 nest_children.push_back (&st);
2473 table[sr.
name ()] = sr;
2488 if (p == table.end ())
2489 return do_insert (name);
2502 std::string nm = sr.
name ();
2504 if (nm !=
"__retval__")
2522 return p != fcn_table.end () ? &p->second : 0;
2527 bool skip_variables,
bool local_funcs);
2529 octave_value do_builtin_find (
const std::string& name);
2535 if (p == table.end ())
2540 return table[name] = ret;
2543 if (static_workspace && ! force_add)
2546 return table[name] = ret;
2553 void do_rename (
const std::string& old_name,
const std::string& new_name)
2557 if (p != table.end ())
2565 table[new_name] = sr;
2570 context_id
context,
bool force_add)
2574 if (p == table.end ())
2578 sr.
assign (value, context);
2581 p->second.assign (value, context);
2591 if (p == table.end ())
2595 return sr.
varref (context);
2598 return p->second.varref (context);
2605 return (p != table.end ()) ? p->second.varval (context) :
octave_value ();
2612 if (p == persistent_table.end ())
2613 persistent_table[name] = value;
2624 return (p == persistent_table.end ())
2625 ? persistent_table[name] : p->second;
2632 return (p != persistent_table.end ()) ? p->second :
octave_value ();
2639 if (p != persistent_table.end ())
2640 persistent_table.erase (p);
2645 bool retval =
false;
2649 if (p != table.end ())
2662 p->second.push_context (my_scope);
2669 while (p != table.end ())
2671 if (p->second.pop_context (my_scope) == 0)
2681 p->second.clear (my_scope);
2691 p->second.clear (my_scope);
2699 if (p != table.end ())
2709 if (q != global_table.end ())
2710 global_table.erase (q);
2718 if (p != table.end ())
2719 p->second.clear (my_scope);
2736 while (q != global_table.end ())
2738 if (pattern.
match (q->first))
2739 global_table.erase (q++);
2758 sr.
clear (my_scope);
2774 sr.
clear (my_scope);
2781 do_insert (name).mark_automatic ();
2786 do_insert (name).mark_hidden ();
2791 do_insert (name).mark_global ();
2794 std::list<symbol_record>
2796 unsigned int exclude)
const
2798 std::list<symbol_record> retval;
2804 if ((defined_only && ! sr.
is_defined (context))
2808 retval.push_back (sr);
2814 std::list<symbol_record>
do_glob (
const std::string& pattern,
2815 bool vars_only =
false)
const
2817 std::list<symbol_record> retval;
2823 if (pat.
match (p->first))
2830 retval.push_back (sr);
2837 std::list<symbol_record>
do_regexp (
const std::string& pattern,
2838 bool vars_only =
false)
const
2840 std::list<symbol_record> retval;
2853 retval.push_back (sr);
2862 std::list<std::string> retval;
2866 if (p->second.is_variable ())
2867 retval.push_back (p->first);
2879 return (p != table.end ()
2880 && ! p->second.is_global ()
2881 && p->second.is_defined ());
2888 return p != table.end () && p->second.is_global ();
2891 std::list<workspace_element> do_workspace_info (
void)
const;
2893 void do_dump (std::ostream& os);
2897 void do_update_nest (
void);
2902 if (p == table.end ())
2907 else if (! p->second.is_automatic ())
2918 const std::string& dispatch_type = std::string (),
2919 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
fcn_info(const std::string &nm=std::string())
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)
static void clear_global_pattern(const std::string &pat)
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 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)
const std::string & name(void) const
static void mark_hidden(const std::string &name)
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 void clear_variable_pattern(const std::string &pat)
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 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)
static void clear_global(const std::string &name)
void do_update_nest(void)
static void mark_automatic(const std::string &name)
void install_subfunction(const octave_value &f, scope_id scope)
symbol_table(scope_id scope)
octave_value autoload_function
static octave_value persistent_varval(const std::string &name)
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 void clear_variable(const std::string &name)
static std::list< symbol_record > glob_variables(const std::string &pattern)
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)
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
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_global(const std::string &name)
static std::list< symbol_record > regexp(const std::string &pattern)
static std::list< symbol_record > glob(const std::string &pattern)
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
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)
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
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)
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)
symbol_record_rep(scope_id s, const std::string &nm, const octave_value &v, unsigned int sc)
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
bool out_of_date_check(octave_value &function, const std::string &dispatch_type=std::string(), bool check_relative=true)
fcn_info(const fcn_info &fi)
F77_RET_T const double const double * f
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
void dump(std::ostream &os, const std::string &prefix=std::string()) const
std::set< scope_id >::const_iterator set_const_iterator
void unmark_automatic(void)
bool is_variable(context_id context) const
static bool is_global(const std::string &name)
void unmark_inherited(void)
static std::list< symbol_record > regexp_variables(const std::string &pattern)
static void push_context(void)
bool is_defined(context_id context=xdefault_context) const
static std::list< workspace_element > workspace_info(void)
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())
static bool is_variable(const std::string &name)
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
void assign(const octave_value &value, context_id context=xdefault_context)
void do_push_context(void)
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
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
octave_value find_built_in_function(void) const
void mark_automatic(void)
void assign(const octave_value &value, context_id context=xdefault_context)
static void erase_persistent(const std::string &name)
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
static std::list< std::string > variable_names(void)
void unmark_automatic(void)
static octave_value & global_varref(const std::string &name) GCC_ATTR_DEPRECATED
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)
octave_idx_type length(void) const
Number of elements in the array.
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)
void do_clear_global_pattern(const std::string &pat)
dispatch_map_type get_dispatch(void) const
static bool is_local_variable(const std::string &name)
std::map< std::string, octave_value >::iterator str_val_iterator
fcn_info_rep(const std::string &nm)
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
static void free(scope_id scope)
void clear_mex_function(void)
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)
symbol_record(scope_id s=xcurrent_scope, const std::string &nm=std::string(), const octave_value &v=octave_value(), unsigned int sc=local)
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
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)
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)
void dump(std::ostream &os, const std::string &prefix=std::string()) const
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
static void clear_variable_regexp(const std::string &pat)
void mark_persistent(void)
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
static octave_value & force_varref(const std::string &name, scope_id scope=xcurrent_scope, context_id context=xdefault_context) GCC_ATTR_DEPRECATED
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 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)
static octave_value & top_level_varref(const std::string &name) GCC_ATTR_DEPRECATED
bool is_global(void) const
symbol_record(const symbol_record &sr)
static octave_value & varref(const std::string &name, scope_id scope=xcurrent_scope, context_id context=xdefault_context, bool force_add=false) GCC_ATTR_DEPRECATED
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)
bool is_match(const std::string &buffer)
static void set_scope_and_context(scope_id scope, context_id context)
size_t pop_context(scope_id s)
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 octave_value & persistent_varref(const std::string &name) GCC_ATTR_DEPRECATED
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)