60 std::map<std::string, std::set<std::string> >
100 (std::ostream& os,
const std::string& prefix)
const
104 os << prefix << name;
109 << (is_local () ?
"l" :
"")
110 << (is_automatic () ?
"a" :
"")
111 << (is_formal () ?
"f" :
"")
112 << (is_hidden () ?
"h" :
"")
113 << (is_inherited () ?
"i" :
"")
115 << (is_persistent () ?
"p" :
"")
138 retval = rep->finfo->find (args);
168 const std::string& dispatch_type = std::string ())
188 const std::string& dispatch_type,
207 bool relative = check_relative && fcn->
is_relative ();
212 bool clear_breakpoints =
false;
213 std::string nm = fcn->
name ();
215 bool is_same_file =
false;
218 std::string dir_name;
222 int nm_len = nm.length ();
225 ((nm_len > 4 && (nm.substr (nm_len-4) ==
".oct"
226 || nm.substr (nm_len-4) ==
".mex"))
227 || (nm_len > 2 && nm.substr (nm_len-2) ==
".m")))
235 if (! dispatch_type.empty ())
242 const std::list<std::string>& plist
244 std::list<std::string>::const_iterator it
247 while (it != plist.end ())
283 clear_breakpoints =
true;
285 else if (is_same_file)
294 if (! (Vignore_function_time_stamp == 2
295 || (Vignore_function_time_stamp
308 clear_breakpoints =
true;
315 clear_breakpoints =
true;
327 clear_breakpoints =
true;
332 if (clear_breakpoints)
344 (
const std::string& dir_name)
350 if (! file_name.empty ())
356 std::string class_name;
360 if (pos != std::string::npos)
362 std::string tmp = dir_name.substr (pos+1);
365 class_name = tmp.substr (1);
372 private_functions[dir_name] = retval;
384 std::string dir_name;
388 if (! file_name.empty ())
396 class_constructors[name] = retval;
405 (
const std::string& dispatch_type)
409 if (name == dispatch_type)
410 retval = load_class_constructor ();
413 std::string dir_name;
418 if (! file_name.empty ())
427 class_methods[dispatch_type] = retval;
435 const std::list<std::string>& plist =
parent_classes (dispatch_type);
437 std::list<std::string>::const_iterator it = plist.begin ();
439 while (it != plist.end ())
445 class_methods[dispatch_type] = retval;
463 if (p != subfunctions.end ())
475 if (dispatch_map.empty ())
476 os <<
"dispatch: " << name <<
" is not overloaded" << std::endl;
479 os <<
"Overloaded function " << name <<
":\n\n";
482 p != dispatch_map.end (); p++)
483 os <<
" " << name <<
" (" << p->first <<
", ...) -> "
484 << p->second <<
" (" << p->first <<
", ...)\n";
495 if (! dispatch_map.empty ())
497 retval =
"Overloaded function:\n\n";
500 p != dispatch_map.end (); p++)
501 retval +=
" " + p->second +
" (" + p->first +
", ...)\n\n";
530 sup_table[i][j] = use_j ? jtyp : ityp;
541 std::string dispatch_type;
548 builtin_type = args(0).builtin_type ();
551 for (i = 1; i < n; i++)
555 builtin_type = sup_table[builtin_type][bti];
567 dispatch_type = args(i).class_name ();
569 for (
int j = i+1; j < n; j++)
581 dispatch_type = cname;
591 return dispatch_type;
632 retval = xfind (args, local_funcs);
653 if (r != subfunctions.end ())
671 std::string dir_name = curr_fcn->
dir_name ();
673 if (! dir_name.empty ())
677 if (q == private_functions.end ())
721 if (q == class_constructors.end ())
748 if (! args.
empty () && ! dispatch_map.empty ())
750 std::string dispatch_type = args(0).type_name ();
756 if (p == dispatch_map.end ())
757 p = dispatch_map.find (
"any");
759 if (p != dispatch_map.end ())
773 if (cmdline_function.is_defined ())
774 return cmdline_function;
792 return built_in_function;
827 retval = x_builtin_find ();
837 if (built_in_function.is_defined ())
838 return built_in_function;
856 if (cmdline_function.is_defined ())
857 return cmdline_function;
865 std::string dir_name = curr_fcn->
dir_name ();
867 if (! dir_name.empty ())
871 if (q == private_functions.end ())
905 if (r != subfunctions.end ())
924 (
const std::string& dispatch_type)
930 if (q == class_methods.end ())
965 if (autoload_function.is_defined ())
968 if (! autoload_function.is_defined ())
972 if (! file_name.empty ())
976 std::string dir_name = file_name.substr (0, pos);
986 return autoload_function;
994 if (function_on_path.is_defined ())
997 if (! (
error_state || function_on_path.is_defined ()))
999 std::string dir_name;
1003 if (! file_name.empty ())
1012 return function_on_path;
1021 const std::string& inf_class)
1055 const std::set<std::string>& inferior_classes = p->second;
1056 std::set<std::string>::const_iterator q = inferior_classes.find (b);
1057 return (q != inferior_classes.end ());
1070 const std::string& prefix)
const
1072 os << prefix << name
1074 << (cmdline_function.is_defined () ?
"c" :
"")
1075 << (built_in_function.is_defined () ?
"b" :
"")
1078 std::string tprefix = prefix +
" ";
1080 if (autoload_function.is_defined ())
1081 os << tprefix <<
"autoload: "
1084 if (function_on_path.is_defined ())
1085 os << tprefix <<
"function from path: "
1088 if (! subfunctions.empty ())
1091 p != subfunctions.end (); p++)
1092 os << tprefix <<
"subfunction: " <<
fcn_file_name (p->second)
1093 <<
" [" << p->first <<
"]\n";
1096 if (! private_functions.empty ())
1099 p != private_functions.end (); p++)
1101 <<
" [" << p->first <<
"]\n";
1104 if (! class_constructors.empty ())
1107 p != class_constructors.end (); p++)
1108 os << tprefix <<
"constructor: " <<
fcn_file_name (p->second)
1109 <<
" [" << p->first <<
"]\n";
1112 if (! class_methods.empty ())
1115 p != class_methods.end (); p++)
1117 <<
" [" << p->first <<
"]\n";
1120 if (! dispatch_map.empty ())
1123 p != dispatch_map.end (); p++)
1125 <<
" [" << p->first <<
"]\n";
1143 parent_table->add_nest_child (*fcn_table_loc);
1149 bool skip_variables,
1155 ? inst->
do_find (name, args, skip_variables, local_funcs)
1174 if (! name.empty () && name[0] ==
'@')
1177 std::string dispatch_type =
1180 std::string method =
1190 if (pos == std::string::npos)
1191 retval =
find (name, args,
true, local_funcs);
1194 std::string fcn_scope = name.substr (0, pos);
1231 os <<
"*** dumping symbol table scope " << scope
1234 std::map<std::string, octave_value> sfuns
1237 if (! sfuns.empty ())
1239 os <<
" subfunctions defined in this scope:\n";
1241 for (std::map<std::string,
1243 p != sfuns.end (); p++)
1244 os <<
" " << p->first <<
"\n";
1259 os <<
"*** dumping global symbol table\n\n";
1264 std::string nm = p->first;
1267 os <<
" " << nm <<
" ";
1279 os <<
"*** dumping globally visible functions from symbol table\n"
1280 <<
" (c=commandline, b=built-in)\n\n";
1284 p->second.dump (os,
" ");
1292 const std::string& dir_name)
1301 std::pair<std::string, octave_value> tmp
1302 = p->second.subfunction_defined_in_scope (scope);
1304 std::string nm = tmp.first;
1321 bool skip_variables,
1328 if (! skip_variables)
1332 if (p !=
table.end ())
1351 return p->second.find (args, local_funcs);
1375 return p->second.builtin_find ();
1391 std::list<workspace_element>
1394 std::list<workspace_element> retval;
1398 std::string nm = p->first;
1423 std::ostringstream buf;
1425 std::string short_disp_str = buf.str ();
1428 short_disp_str, dv.
str (),
1431 retval.push_back (elt);
1444 os <<
" persistent variables in this scope:\n\n";
1449 std::string nm = p->first;
1452 os <<
" " << nm <<
" ";
1460 if (!
table.empty ())
1462 os <<
" other symbols in this scope (l=local; a=auto; f=formal\n"
1463 <<
" h=hidden; i=inherited; g=global; p=persistent)\n\n";
1466 p->second.dump (os,
" ");
1513 ::
error (
"global and persistent may only be used in the topmost level in which a nested variable is used");
1518 ti->second = parents;
1529 ti->second.set_curr_fcn (
curr_fcn);
1532 for (std::vector<symbol_table*>::iterator iter =
nest_children.begin ();
1534 (*iter)->do_update_nest ();
1537 DEFUN (ignore_function_time_stamp, args, nargout,
1539 @deftypefn {Built-in Function} {@var{val} =} ignore_function_time_stamp ()\n\
1540 @deftypefnx {Built-in Function} {@var{old_val} =} ignore_function_time_stamp (@var{new_val})\n\
1541 Query or set the internal variable that controls whether Octave checks\n\
1542 the time stamp on files each time it looks up functions defined in\n\
1543 function files. If the internal variable is set to @qcode{\"system\"},\n\
1544 Octave will not automatically recompile function files in subdirectories of\n\
1545 @file{@var{octave-home}/lib/@var{version}} if they have changed since\n\
1546 they were last compiled, but will recompile other function files in the\n\
1547 search path if they change. If set to @qcode{\"all\"}, Octave will not\n\
1548 recompile any function files unless their definitions are removed with\n\
1549 @code{clear}. If set to @qcode{\"none\"}, Octave will always check time\n\
1550 stamps on files to determine whether functions defined in function files\n\
1551 need to recompiled.\n\
1556 int nargin = args.
length ();
1558 if (nargout > 0 || nargin == 0)
1560 switch (Vignore_function_time_stamp)
1583 Vignore_function_time_stamp = 2;
1584 else if (sval ==
"system")
1585 Vignore_function_time_stamp = 1;
1586 else if (sval ==
"none")
1587 Vignore_function_time_stamp = 0;
1589 error (
"ignore_function_time_stamp: expecting argument to be \"all\", \"system\", or \"none\"");
1592 error (
"ignore_function_time_stamp: expecting argument to be character string");
1594 else if (nargin > 1)
1618 DEFUN (__current_scope__, , ,
1620 @deftypefn {Built-in Function} {[@var{scope}, @var{context}]} __dump_symtab_info__ ()\n\
1621 Undocumented internal function.\n\
1632 DEFUN (__dump_symtab_info__, args, ,
1634 @deftypefn {Built-in Function} {} __dump_symtab_info__ ()\n\
1635 @deftypefnx {Built-in Function} {} __dump_symtab_info__ (@var{scope})\n\
1636 @deftypefnx {Built-in Function} {} __dump_symtab_info__ (\"scopes\")\n\
1637 @deftypefnx {Built-in Function} {} __dump_symtab_info__ (\"functions\")\n\
1638 Undocumented internal function.\n\
1643 int nargin = args.
length ();
1653 for (std::list<symbol_table::scope_id>::const_iterator p = lst.begin ();
1654 p != lst.end (); p++)
1657 else if (nargin == 1)
1665 if (s_arg ==
"scopes")
1673 for (std::list<symbol_table::scope_id>::const_iterator
1674 p = lst.begin (); p != lst.end (); p++)
1679 else if (s_arg ==
"functions")
1684 error (
"__dump_symtab_info__: expecting \"functions\" or \"scopes\"");
1693 error (
"__dump_symtab_info__: expecting string or scope id");
1706 DEFUN (set_variable, args, ,
"set_variable (NAME, VALUE)")
1710 if (args.length () == 2)
1717 error (
"set_variable: expecting variable name as first argument");
1725 DEFUN (variable_value, args, ,
"VALUE = variable_value (NAME)")
1729 if (args.length () == 1)
1738 error (
"variable_value: '%s' is not a variable in the current scope",
1742 error (
"variable_value: expecting variable name as first argument");