24 #if defined (HAVE_CONFIG_H)
70 =
" %a:4; %ln:6; %cs:16:6:1; %rb:12; %lc:-1;\n";
106 if (! fcn_name.empty ())
116 error (
"%s: the symbol '%s' is not valid as a function",
117 warn_for.c_str (), fcn_name.c_str ());
138 error (
"%s: argument must be a string containing function name",
160 cmd.append (trailer);
166 if (parse_status != 0)
167 error (
"%s: '%s' is not valid as a function",
168 warn_for.c_str (), fname.c_str ());
173 error (
"%s: '%s' is not valid as a function",
174 warn_for.c_str (), fname.c_str ());
176 warning (
"%s: passing function body as a string is obsolete; please use anonymous functions",
190 size_t len = text.
length ();
192 while ((pos = text.find (
'.', pos)) != std::string::npos)
204 for (
int i = 0;
i < n;
i++)
206 len = text.find (
'.', pos);
208 if (len != std::string::npos)
211 retval[
i] = text.substr (pos, len);
213 if (len != std::string::npos)
241 size_t pos = text.rfind (
'.');
244 if (pos != std::string::npos)
246 if (pos == text.length ())
249 hint = text.substr (pos+1);
251 prefix = text.substr (0, pos);
261 pos = base_name.find_first_of (
"{(. ");
263 if (pos != std::string::npos)
264 base_name = base_name.substr (0, pos);
288 catch (
const octave::execution_exception&)
307 bool retval = (! text.empty ()
308 && (text !=
"." || prev_char ==
')' || prev_char ==
'}')
310 && text.find (
"..") == std::string::npos
311 && text.rfind (
'.') != std::string::npos);
314 symbol_record *sr = curr_sym_tab->lookup (text);
316 if (sr && ! sr->is_function ())
343 if (!
args(0).is_string ())
344 error (
"isglobal: NAME must be a string");
387 bool search_any = type ==
"any";
388 bool search_var = type ==
"var";
389 bool search_dir = type ==
"dir";
390 bool search_file = type ==
"file";
391 bool search_builtin = type ==
"builtin";
392 bool search_class = type ==
"class";
394 if (! (search_any || search_var || search_dir || search_file ||
395 search_builtin || search_class))
396 error (
"exist: unrecognized type argument \"%s\"", type.c_str ());
398 if (search_any || search_var)
424 if (search_any || search_file || search_dir)
428 if (file_name.empty ())
431 size_t len = file_name.length ();
435 if (search_any || search_file)
437 if (len > 4 && (file_name.substr (len-4) ==
".oct"
438 || file_name.substr (len-4) ==
".mex"))
447 if (file_name.empty ())
454 if (search_any || search_file)
459 len = file_name.length ();
461 if (len > 4 && (file_name.substr (len-4) ==
".oct"
462 || file_name.substr (len-4) ==
".mex"))
467 else if (search_dir && fs.
is_dir ())
471 if (search_file || search_dir)
475 if (search_any || search_builtin)
487 #define GET_IDX(LEN) \
488 static_cast<int> ((LEN-1) * static_cast<double> (rand ()) / RAND_MAX)
494 =
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
496 static size_t len = alpha.length ();
500 size_t pos = nm.
length ();
502 if (nm.substr (0, 2) ==
"__")
506 nm.insert (pos++, 1, alpha[
GET_IDX (len)]);
586 if (nargin < 1 || nargin > 2)
596 warning (
"exist: \"class\" type argument is not implemented");
688 error (
"get_global_value: undefined symbol '%s'", nm.c_str ());
705 error (
"get_top_level_value: undefined symbol '%s'", nm.c_str ());
725 if (!
args(1).is_string () ||
args(1).string_value () !=
"local")
735 template <
typename T>
736 bool try_local_protect (T&
var)
741 curr_usr_fcn = dynamic_cast<octave_user_function *> (curr_usr_code);
755 int nargin = args.
length ();
757 if (nargout > 0 || nargin == 0)
760 if (wants_local_change (args, nargin))
762 if (! try_local_protect (var))
763 warning (
"\"local\" has no effect outside a function");
771 bool bval =
args(0).xbool_value (
"%s: argument must be a logical value", nm);
781 int nargout,
const char *nm)
785 int nargin = args.
length ();
787 if (nargout > 0 || nargin == 0)
790 if (wants_local_change (args, nargin))
792 if (! try_local_protect (var))
793 warning (
"\"local\" has no effect outside a function");
801 std::string sval =
args(0).xstring_value (
"%s: argument must be a single character", nm);
803 switch (sval.length ())
814 error (
"%s: argument must be a single character", nm);
824 int nargout,
const char *nm,
825 int minval,
int maxval)
829 int nargin = args.
length ();
831 if (nargout > 0 || nargin == 0)
834 if (wants_local_change (args, nargin))
836 if (! try_local_protect (var))
837 warning (
"\"local\" has no effect outside a function");
845 int ival =
args(0).xint_value (
"%s: argument must be an integer value", nm);
848 error (
"%s: arg must be greater than %d", nm, minval);
850 error (
"%s: arg must be less than or equal to %d", nm, maxval);
860 int nargout,
const char *nm,
861 double minval,
double maxval)
865 int nargin = args.
length ();
867 if (nargout > 0 || nargin == 0)
870 if (wants_local_change (args, nargin))
872 if (! try_local_protect (var))
873 warning (
"\"local\" has no effect outside a function");
881 double dval =
args(0).xscalar_value (
"%s: argument must be a scalar value", nm);
884 error (
"%s: argument must be greater than %g", minval);
886 error (
"%s: argument must be less than or equal to %g", maxval);
896 int nargout,
const char *nm,
bool empty_ok)
900 int nargin = args.
length ();
902 if (nargout > 0 || nargin == 0)
905 if (wants_local_change (args, nargin))
907 if (! try_local_protect (var))
908 warning (
"\"local\" has no effect outside a function");
916 std::string sval =
args(0).xstring_value (
"%s: first argument must be a string", nm);
918 if (! empty_ok && sval.empty ())
919 error (
"%s: value must not be empty", nm);
929 int nargout,
const char *nm,
const char **choices)
933 while (choices[nchoices] != 0)
936 int nargin = args.
length ();
938 assert (var < nchoices);
940 if (nargout > 0 || nargin == 0)
941 retval = choices[
var];
943 if (wants_local_change (args, nargin))
945 if (! try_local_protect (var))
946 warning (
"\"local\" has no effect outside a function");
954 std::string sval =
args(0).xstring_value (
"%s: first argument must be a string", nm);
957 for (; i < nchoices; i++)
959 if (sval == choices[i])
966 error (
"%s: value not allowed (\"%s\")", nm, sval.c_str ());
974 int nargout,
const char *nm,
const char **choices)
978 while (choices[nchoices] != 0)
981 int nargin = args.
length ();
983 if (nargout > 0 || nargin == 0)
986 if (wants_local_change (args, nargin))
988 if (! try_local_protect (var))
989 warning (
"\"local\" has no effect outside a function");
997 std::string sval =
args(0).xstring_value (
"%s: first argument must be a string", nm);
1000 for (; i < nchoices; i++)
1002 if (sval == choices[i])
1009 error (
"%s: value not allowed (\"%s\")", nm, sval.c_str ());
1020 int parameter_length;
1021 int first_parameter_length;
1031 std::list<whos_parameter>::iterator i = params.begin ();
1032 std::ostringstream param_buf;
1036 while (i != params.end ())
1038 whos_parameter
param = *
i;
1040 if (param.command !=
'\0')
1043 switch (param.modifier)
1047 << std::setw (param.parameter_length);
1049 << std::setw (param.parameter_length);
1054 << std::setw (param.parameter_length);
1056 << std::setw (param.parameter_length);
1060 if (param.command !=
's')
1063 << std::setw (param.parameter_length);
1065 << std::setw (param.parameter_length);
1071 << std::setw (param.parameter_length);
1073 << std::setw (param.parameter_length);
1076 if (param.command ==
's' && param.modifier ==
'c')
1080 if (param.modifier ==
'c')
1082 a = param.first_parameter_length - param.balance;
1083 a = (a < 0 ? 0 :
a);
1084 b = param.parameter_length - a - param.text.length ();
1085 b = (b < 0 ? 0 :
b);
1089 << std::setw (b) <<
""
1096 << std::setw (b) <<
""
1103 param_buf << param.line;
1114 param_buf << param.line;
1119 os << param_buf.str ();
1153 varval (expr_val.is_undefined () ? sr.varval () : expr_val),
1154 is_automatic (sr.is_automatic ()),
1155 is_complex (varval.is_complex_type ()),
1156 is_formal (sr.is_formal ()),
1157 is_global (sr.is_global ()),
1158 is_persistent (sr.is_persistent ())
1162 const std::list<whos_parameter>& params)
const
1166 std::list<whos_parameter>::const_iterator i = params.begin ();
1170 while (i != params.end ())
1172 whos_parameter
param = *
i;
1174 if (param.command !=
'\0')
1178 switch (param.modifier)
1182 << std::setw (param.parameter_length);
1187 << std::setw (param.parameter_length);
1191 if (param.command ==
's')
1193 int front = param.first_parameter_length
1194 - dims_str.find (
'x');
1195 int back = param.parameter_length
1196 - dims_str.length ()
1198 front = (front > 0) ? front : 0;
1199 back = (back > 0) ? back : 0;
1202 << std::setw (front)
1214 << std::setw (param.parameter_length);
1219 error (
"whos_line_format: modifier '%c' unknown",
1223 << std::setw (param.parameter_length);
1226 switch (param.command)
1232 tmp[0] = (is_automatic ?
'a' :
' ');
1233 tmp[1] = (is_complex ?
'c' :
' ');
1234 tmp[2] = (is_formal ?
'f' :
' ');
1235 tmp[3] = (is_global ?
'g' :
' ');
1236 tmp[4] = (is_persistent ?
'p' :
' ');
1244 os << varval.byte_size ();
1248 os << varval.class_name ();
1252 os << varval.numel ();
1260 if (param.modifier !=
'c')
1265 os << varval.type_name ();
1269 error (
"whos_line_format: command '%c' unknown",
1318 lst.push_back (
symbol_info (sr, expr_str, expr_val));
1321 size_t size (
void)
const {
return lst.size (); }
1323 bool empty (
void)
const {
return lst.empty (); }
1328 size_t len = lst.size ();
1330 Cell name_info (len, 1);
1331 Cell size_info (len, 1);
1332 Cell bytes_info (len, 1);
1333 Cell class_info (len, 1);
1334 Cell global_info (len, 1);
1335 Cell sparse_info (len, 1);
1336 Cell complex_info (len, 1);
1337 Cell nesting_info (len, 1);
1338 Cell persistent_info (len, 1);
1340 std::list<symbol_info>::const_iterator
p = lst.begin ();
1342 for (
size_t j = 0; j < len; j++)
1348 ni.
assign (
"function", caller_function_name);
1349 ni.
assign (
"level", nesting_level);
1351 name_info(j) = si.
name;
1357 size_info(j) = val.
size ();
1362 nesting_info(j) = ni;
1367 info.
assign (
"name", name_info);
1368 info.
assign (
"size", size_info);
1369 info.
assign (
"bytes", bytes_info);
1370 info.
assign (
"class", class_info);
1371 info.
assign (
"global", global_info);
1372 info.
assign (
"sparse", sparse_info);
1373 info.
assign (
"complex", complex_info);
1374 info.
assign (
"nesting", nesting_info);
1375 info.
assign (
"persistent", persistent_info);
1385 size_t elements = 0;
1387 std::list<whos_parameter> params = parse_whos_line_format ();
1393 for (std::list<symbol_info>::const_iterator
p = lst.begin ();
1394 p != lst.end ();
p++)
1396 p->display_line (os, params);
1400 elements += val.
numel ();
1404 os <<
"\nTotal is " << elements
1405 << (elements == 1 ?
" element" :
" elements")
1406 <<
" using " << bytes << (bytes == 1 ?
" byte" :
" bytes")
1419 std::list<whos_parameter> params;
1427 size_t pos_a, pos_b, pos_c, pos_e, pos_n, pos_s, pos_t;
1429 pos_a = param_string.find (
'a');
1430 pos_b = param_string.find (
'b');
1431 pos_c = param_string.find (
'c');
1432 pos_e = param_string.find (
'e');
1433 pos_n = param_string.find (
'n');
1434 pos_s = param_string.find (
's');
1435 pos_t = param_string.find (
't');
1437 param_names(pos_a) =
"Attr";
1438 param_names(pos_b) =
"Bytes";
1439 param_names(pos_c) =
"Class";
1440 param_names(pos_e) =
"Elements";
1441 param_names(pos_n) =
"Name";
1442 param_names(pos_s) =
"Size";
1443 param_names(pos_t) =
"Type";
1445 for (
size_t i = 0; i < param_string.length (); i++)
1446 param_length(i) = param_names(i).
length ();
1449 param_length(pos_a) = 5;
1454 for (std::list<symbol_info>::const_iterator
p = lst.begin ();
1455 p != lst.end ();
p++)
1457 std::stringstream ss1, ss2;
1461 param_length(pos_n) = ((str.length ()
1462 >
static_cast<size_t> (param_length(pos_n)))
1463 ? str.length () : param_length(pos_n));
1468 param_length(pos_t) = ((str.length ()
1469 >
static_cast<size_t> (param_length(pos_t)))
1470 ? str.length () : param_length(pos_t));
1472 elements1 = val.
numel ();
1475 param_length(pos_e) = ((str.length ()
1476 >
static_cast<size_t> (param_length(pos_e)))
1477 ? str.length () : param_length(pos_e));
1482 param_length(pos_b) = ((str.length ()
1483 >
static_cast<size_t> (param_length(pos_b)))
1484 ? str.length () : param_length (pos_b));
1488 while (static_cast<size_t> (idx) < format_len)
1490 whos_parameter
param;
1491 param.command =
'\0';
1495 bool error_encountered =
false;
1496 param.modifier =
'r';
1497 param.parameter_length = 0;
1508 pos = cmd.find (
';');
1509 if (pos == std::string::npos)
1510 error (
"parameter without ; in whos_line_format");
1512 cmd = cmd.substr (0, pos+1);
1514 idx += cmd.length ();
1518 if (cmd.find_first_of (
"crl") != 1)
1519 items = sscanf (cmd.c_str (),
"%c%c:%d:%d:%d;",
1520 &garbage, ¶m.command, &
a, &
b, &balance);
1522 items = sscanf (cmd.c_str (),
"%c%c%c:%d:%d:%d;",
1523 &garbage, ¶m.modifier, ¶m.command,
1524 &
a, &
b, &balance) - 1;
1527 error (
"whos_line_format: parameter structure without command in whos_line_format");
1530 param.first_parameter_length = 0;
1531 pos = param_string.find (param.command);
1532 if (pos == std::string::npos)
1533 error (
"whos_line_format: '%c' is not a command", param.command);
1535 param.parameter_length = param_length(pos);
1536 param.text = param_names(pos);
1537 param.line.assign (param_names(pos).
length (),
'=');
1539 param.parameter_length = (a > param.parameter_length
1540 ? a : param.parameter_length);
1541 if (param.command ==
's' && param.modifier ==
'c' && b > 0)
1542 param.first_parameter_length =
b;
1544 if (param.command ==
's')
1553 int first = param.first_parameter_length;
1554 int total = param.parameter_length;
1556 for (std::list<symbol_info>::const_iterator
p = lst.begin ();
1557 p != lst.end ();
p++)
1561 int first1 = dims_str.find (
'x');
1562 int total1 = dims_str.length ();
1563 int rest1 = total1 - first1;
1564 rest = (rest1 > rest ? rest1 : rest);
1565 first = (first1 > first ? first1 :
first);
1566 total = (total1 > total ? total1 : total);
1569 if (param.modifier ==
'c')
1571 if (first < balance)
1572 first += balance -
first;
1573 if (rest + balance < param.parameter_length)
1574 rest += param.parameter_length - rest - balance;
1576 param.parameter_length = first + rest;
1577 param.first_parameter_length =
first;
1578 param.balance = balance;
1582 param.parameter_length = total;
1583 param.first_parameter_length = 0;
1586 else if (param.modifier ==
'c')
1587 error (
"whos_line_format: modifier 'c' not available for command '%c'",
1592 param.balance = (b < 0 ? 0 : param.balance);
1593 param.first_parameter_length = (b < 0 ? 0 :
1594 param.first_parameter_length);
1595 param.parameter_length = (a < 0
1597 : (param.parameter_length
1598 < param_length(pos_s)
1599 ? param_length(pos_s)
1600 : param.parameter_length));
1603 if (! error_encountered)
1604 params.push_back (param);
1612 pos = text.find (
'%');
1613 if (pos != std::string::npos)
1614 text = text.substr (0, pos);
1617 idx += text.length ();
1619 param.line.assign (text.length (),
' ');
1620 params.push_back (param);
1640 bool global_only =
false;
1641 bool have_regexp =
false;
1644 for (i = 1; i <
argc; i++)
1646 if (argv[i] ==
"-file")
1655 error (
"whos: -file argument must be followed by a filename");
1682 else if (argv[i] ==
"-regexp")
1684 else if (argv[i] ==
"global")
1686 else if (argv[i][0] ==
'-')
1687 warning (
"%s: unrecognized option '%s'", my_name.c_str (),
1693 int npats = argc -
i;
1698 for (
int j = 0; j < npats; j++)
1699 pats[j] = argv[i+j];
1708 std::list<std::string> symbol_names;
1710 for (
int j = 0; j < npats; j++)
1716 std::list<symbol_table::symbol_record>
tmp = global_only
1720 for (std::list<symbol_table::symbol_record>::const_iterator
1721 p = tmp.begin ();
p != tmp.end ();
p++)
1723 if (
p->is_variable ())
1728 symbol_names.push_back (
p->name ());
1734 size_t pos = pat.find_first_of (
".({");
1736 if (pos != std::string::npos && pos > 0)
1761 symbol_stats.
append (sr, pat, expr_val);
1768 std::list<symbol_table::symbol_record>
tmp = global_only
1772 for (std::list<symbol_table::symbol_record>::const_iterator
1773 p = tmp.begin ();
p != tmp.end ();
p++)
1775 if (
p->is_variable ())
1780 symbol_names.push_back (
p->name ());
1794 caller_function_name = caller->
name ();
1796 retval = symbol_stats.
map_value (caller_function_name, 1);
1801 else if (! (symbol_stats.
empty () && symbol_names.empty ()))
1826 DEFUN (who, args, nargout,
1865 return do_who (argc, argv, nargout == 1);
1868 DEFUN (whos, args, nargout,
1936 return do_who (argc, argv, nargout == 1,
true);
1972 feval (fname, args, 0);
1981 error (
"mlock: invalid use outside a function");
2003 bool retval =
false;
2031 error (
"mlock: invalid use outside a function");
2048 int nargin = args.
length ();
2064 error (
"munlock: invalid use outside a function");
2082 int nargin = args.
length ();
2091 std::string name =
args(0).xstring_value (
"mislocked: FCN must be a string");
2100 error (
"mislocked: invalid use outside a function");
2112 int argc,
int idx,
bool have_regexp =
false)
2114 bool retval =
false;
2116 for (
int k = idx;
k <
argc;
k++)
2119 if (! patstr.empty ())
2146 maybe_warn_exclusive (
bool exclusive)
2149 warning (
"clear: ignoring --exclusive option");
2153 do_clear_functions (
const string_vector& argv,
int argc,
int idx,
2154 bool exclusive =
false)
2164 int fcount = fcns.
numel ();
2166 for (
int i = 0; i < fcount; i++)
2170 if (! name_matches_any_pattern (nm, argv, argc, idx))
2183 do_clear_globals (
const string_vector& argv,
int argc,
int idx,
2184 bool exclusive =
false)
2190 int gcount = gvars.
numel ();
2192 for (
int i = 0; i < gcount; i++)
2201 int gcount = gvars.
numel ();
2203 for (
int i = 0; i < gcount; i++)
2207 if (! name_matches_any_pattern (nm, argv, argc, idx))
2220 do_clear_variables (
const string_vector& argv,
int argc,
int idx,
2221 bool exclusive =
false,
bool have_regexp =
false)
2231 int lcount = lvars.
numel ();
2233 for (
int i = 0; i < lcount; i++)
2237 if (! name_matches_any_pattern (nm, argv, argc, idx, have_regexp))
2254 do_clear_symbols (
const string_vector& argv,
int argc,
int idx,
2255 bool exclusive =
false)
2268 do_clear_variables (argv, argc, idx, exclusive);
2269 do_clear_functions (argv, argc, idx, exclusive);
2280 do_matlab_compatible_clear (
const string_vector& argv,
int argc,
int idx)
2284 for (; idx <
argc; idx++)
2286 if (argv[idx] ==
"all"
2291 else if (argv[idx] ==
"functions"
2294 do_clear_functions (argv, argc, ++idx);
2296 else if (argv[idx] ==
"global"
2299 do_clear_globals (argv, argc, ++idx);
2301 else if (argv[idx] ==
"variables"
2306 else if (argv[idx] ==
"classes"
2320 #define CLEAR_OPTION_ERROR(cond) \
2402 int argc = args.
length () + 1;
2408 do_clear_globals (argv, argc,
true);
2409 do_clear_variables (argv, argc,
true);
2417 bool clear_all =
false;
2418 bool clear_functions =
false;
2419 bool clear_globals =
false;
2420 bool clear_variables =
false;
2421 bool clear_objects =
false;
2422 bool exclusive =
false;
2423 bool have_regexp =
false;
2424 bool have_dash_option =
false;
2426 while (++idx < argc)
2428 if (argv[idx] ==
"-all" || argv[idx] ==
"-a")
2430 CLEAR_OPTION_ERROR (have_dash_option && ! exclusive);
2432 have_dash_option =
true;
2435 else if (argv[idx] ==
"-exclusive" || argv[idx] ==
"-x")
2437 have_dash_option =
true;
2440 else if (argv[idx] ==
"-functions" || argv[idx] ==
"-f")
2442 CLEAR_OPTION_ERROR (have_dash_option && ! exclusive);
2444 have_dash_option =
true;
2445 clear_functions =
true;
2447 else if (argv[idx] ==
"-global" || argv[idx] ==
"-g")
2449 CLEAR_OPTION_ERROR (have_dash_option && ! exclusive);
2451 have_dash_option =
true;
2452 clear_globals =
true;
2454 else if (argv[idx] ==
"-variables" || argv[idx] ==
"-v")
2456 CLEAR_OPTION_ERROR (have_dash_option && ! exclusive);
2458 have_dash_option =
true;
2459 clear_variables =
true;
2461 else if (argv[idx] ==
"-classes" || argv[idx] ==
"-c")
2463 CLEAR_OPTION_ERROR (have_dash_option && ! exclusive);
2465 have_dash_option =
true;
2466 clear_objects =
true;
2468 else if (argv[idx] ==
"-regexp" || argv[idx] ==
"-r")
2470 CLEAR_OPTION_ERROR (have_dash_option && ! exclusive);
2472 have_dash_option =
true;
2481 if (! have_dash_option)
2482 do_matlab_compatible_clear (argv, argc, idx);
2487 maybe_warn_exclusive (exclusive);
2490 warning (
"clear: ignoring extra arguments after -all");
2494 else if (have_regexp)
2496 do_clear_variables (argv, argc, idx, exclusive,
true);
2498 else if (clear_functions)
2500 do_clear_functions (argv, argc, idx, exclusive);
2502 else if (clear_globals)
2504 do_clear_globals (argv, argc, idx, exclusive);
2506 else if (clear_variables)
2508 do_clear_variables (argv, argc, idx, exclusive);
2510 else if (clear_objects)
2518 do_clear_symbols (argv, argc, idx, exclusive);
2529 DEFUN (whos_line_format, args, nargout,
2606 static std::string Vmissing_function_hook =
"__unimplemented__";
2608 DEFUN (missing_function_hook, args, nargout,
2639 const std::string func_name = Vmissing_function_hook;
2640 Vmissing_function_hook.clear ();
2648 DEFUN (__varval__, args, ,
2657 std::string name =
args(0).xstring_value (
"__varval__: first argument must be a variable name");
2664 DEFUN (missing_component_hook, args, nargout,
static void clear_objects(scope_id scope=xcurrent_scope)
bool is_object(void) const
OCTINTERP_API void set_top_level_value(const std::string &nm, const octave_value &val)
void display_line(std::ostream &os, const std::list< whos_parameter > ¶ms) const
static void clear_workspace(void)
std::string str(char sep= 'x') const
static void clear_functions(bool force=false)
std::string get_dims_str(const octave_value &val)
void assign(const std::string &k, const Cell &val)
static void clear_variable_pattern(const std::string &pat, scope_id scope=xcurrent_scope)
OCTAVE_EXPORT octave_value_list isa nd deftypefn *return ovl(args(0).is_integer_type())
OCTINTERP_API void print_usage(void)
octave_idx_type numel(void) const
Number of elements in the array.
static std::string dir_sep_chars(void)
in that an updated permutation matrix is returned Note that if var
identity matrix If supplied two scalar respectively For allows like xample val
octave_idx_type length(void) const
bool is_defined(void) const
static void set_scope(scope_id scope)
bool local_protect(T &variable)
OCTAVE_EXPORT octave_value_list return the value of the option it must match the dimension of the state and the relative tolerance must also be a vector of the same length tem it must match the dimension of the state and the absolute tolerance must also be a vector of the same length The local error test applied at each integration step is xample roup so it is best to provide a consistent set and leave this option set to zero tem it may help to set this parameter to a nonzero value it is probably best to try leaving this option set to zero first
bool looks_like_struct(const std::string &text, char prev_char)
tem check only for symbols of the specified type Valid types are table asis item and there are multiple possible matches for name
static std::list< symbol_record > regexp_variables(const std::string &pattern, scope_id scope=xcurrent_scope)
#define DEFUN(name, args_name, nargout_name, doc)
void error(const char *fmt,...)
static void print_descriptor(std::ostream &os, std::list< whos_parameter > params)
std::string name(void) const
#define SET_INTERNAL_VARIABLE(NM)
nd deftypefn *void maybe_missing_function_hook(const std::string &name)
static octave_function * current(void)
static scope_id alloc_scope(void)
OCTINTERP_API std::string file_in_path(const std::string &, const std::string &)
static std::list< std::string > variable_names(scope_id scope=xcurrent_scope)
static void clear_mex_functions(void)
static std::string Vwhos_line_format
static bool is_variable(const std::string &name)
static octave_value do_who(int argc, const string_vector &argv, bool return_list, bool verbose=false, std::string msg="")
to define functions rather than attempting to enter them directly on the command line The block of commands is executed as soon as you exit the editor To avoid executing any simply delete all the lines from the buffer before leaving the editor When invoked with no edit the previously executed command
std::string xstring_value(const char *fmt,...) const
static bool is_local_variable(const std::string &name, scope_id scope=xcurrent_scope)
in this the arguments are accumulated from left to right
static octave_value find_function(const std::string &name, const octave_value_list &args=octave_value_list(), bool local_funcs=true)
void resize(octave_idx_type n, const std::string &rfv="")
static octave_value varval(const std::string &name, scope_id scope=xcurrent_scope, context_id context=xdefault_context)
static void clear_variables(void)
bool is_function_handle(void) const
static octave_value find_cmdline_function(const std::string &name)
static std::string find_fcn(const std::string &fcn, std::string &dir_name, const std::string &pack_name="")
std::string unique_symbol_name(const std::string &basename)
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
static symbol_record find_symbol(const std::string &name, scope_id scope=xcurrent_scope)
void clear_function(const std::string &nm)
OCTINTERP_API octave_value get_top_level_value(const std::string &nm, bool silent=false)
static octave_value global_varval(const std::string &name)
static std::list< std::string > global_variable_names(void)
static void clear_symbol(const std::string &name)
int buffer_error_messages
create a structure array and initialize its values The dimensions of each cell array of values must match Singleton cells and non cell values are repeated so that they fill the entire array If the cells are empty
static std::list< symbol_record > glob_variables(const std::string &pattern, scope_id scope=xcurrent_scope)
static octave_user_code * caller_user_code(size_t nskip=0)
OCTAVE_EXPORT octave_value_list isdir nd deftypefn *std::string nm
static std::string basename(const std::string &s, bool strip_path=false)
std::list< symbol_info > lst
static octave_function * caller(void)
OCTAVE_EXPORT octave_value_list return the number of command line arguments passed to Octave If called with the optional argument the function xample nargout(@histc)
void add_fcn(void(*fcn)(void))
void clear_variable(const std::string &nm)
string_vector make_argv(const std::string &="") const
bool is_sparse_type(void) const
octave_idx_type numel(const octave_value_list &idx)
static std::list< symbol_record > regexp_global_variables(const std::string &pattern)
OCTINTERP_API bool mislocked(const std::string &)
std::string string_value(bool force=false) const
bool is_global(void) const
void error_with_cfn(const char *fmt,...)
then the function must return scalars which will be concatenated into the return array(s).If code
static void set_workspace(void)
bool is_string(void) const
static void clear_variable_regexp(const std::string &pat, scope_id scope=xcurrent_scope)
string_vector get_struct_elts(const std::string &text)
static void force_assign(const std::string &name, const octave_value &value=octave_value(), scope_id scope=xcurrent_scope, context_id context=xdefault_context)
string_vector generate_struct_completions(const std::string &text, std::string &prefix, std::string &hint)
static void global_assign(const std::string &name, const octave_value &value=octave_value())
bool is_inline_function(void) const
OCTINTERP_API octave_value set_internal_variable(bool &var, const octave_value_list &args, int nargout, const char *nm)
bool is_complex_type(void) const
static void clear_global(const std::string &name, scope_id scope=xcurrent_scope)
OCTINTERP_API octave_value lookup_function_handle(const std::string &nm)
OCTINTERP_API void munlock(const std::string &)
static void push(octave_function *f, symbol_table::scope_id scope=symbol_table::current_scope(), symbol_table::context_id context=symbol_table::current_context())
symbol_info(const symbol_table::symbol_record &sr, const std::string &expr_str="", const octave_value &expr_val=octave_value())
string_vector map_keys(void) const
OCTINTERP_API void bind_ans(const octave_value &val, bool print)
Array< std::string > param
virtual bool is_user_function(void) const
std::ostream & list_in_columns(std::ostream &, int width=0, const std::string &prefix="") const
bool is_match(const std::string &buffer)
bool is_keyword(const std::string &s)
std::list< whos_parameter > parse_whos_line_format(void)
static dim_vector alloc(int n)
bool is_classdef_object(void) const
OCTINTERP_API void set_global_value(const std::string &nm, const octave_value &val)
octave_map map_value(const std::string &caller_function_name, int nesting_level) const
static std::string Vmissing_component_hook
octave_function * function_value(bool silent=false) const
static bool is_variable(const std::string &name, scope_id scope=xcurrent_scope)
void warning(const char *fmt,...)
static void clear_all(bool force=false)
octave::unwind_protect frame
void recover_from_exception(void)
static std::list< std::string > user_function_names(void)
std::string type_name(void) const
octave_idx_type length(void) const
Number of elements in the array.
OCTAVE_EXPORT octave_value_list the first data row corresponds to an index of zero The a spreadsheet style form such as the file is read until end of file is reached The such as text
static void clear_variable(const std::string &name, scope_id scope=xcurrent_scope)
static void clear_exemplar_map(void)
static bool is_global(const std::string &name, scope_id scope=xcurrent_scope)
OCTINTERP_API octave_value get_global_value(const std::string &nm, bool silent=false)
=val(i)}if ode{val(i)}occurs in table i
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
void assign(const std::string &k, const octave_value &val)
bool is_cs_list(void) const
static std::list< symbol_record > glob_global_variables(const std::string &pattern)
symbol_info_list(const symbol_info_list &sil)
octave_function * extract_function(const octave_value &arg, const std::string &warn_for, const std::string &fname, const std::string &header, const std::string &trailer)
void print_with_name(std::ostream &os, const std::string &name) const
bool is_anonymous_function(void) const
OCTINTERP_API void bind_internal_variable(const std::string &fname, const octave_value &val)
octave_idx_type ndims(void) const
Number of dimensions.
std::string class_name(void) const
bool is_constant(void) const
bool is_undefined(void) const
static void clear_global_pattern(const std::string &pat, scope_id scope=xcurrent_scope)
octave::sys::file_stat fs(filename)
void append(const symbol_table::symbol_record &sr)
void clear_symbol(const std::string &nm)
void display(std::ostream &os)
octave_value_list list_value(void) const
static bool is_built_in_function_name(const std::string &name)
static void clear_symbol_pattern(const std::string &pat)
OCTINTERP_API octave_value_list eval_string(const std::string &, bool silent, int &parse_status, int nargout)
static octave_value do_isglobal(const octave_value_list &args)
std::string lookup_autoload(const std::string &nm)
void clear_mex_functions(void)
octave_function * is_valid_function(const std::string &fcn_name, const std::string &warn_for, bool warn)
bool discard_warning_messages
Vector representing the dimensions (size) of an Array.
bool discard_error_messages
static void clear(octave::dynamic_library &oct_file)
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
static void clear_function(const std::string &name)
static void clear_function_pattern(const std::string &pat)
void append(const symbol_table::symbol_record &sr, const std::string &expr_str, const octave_value &expr_val)
bool islocked(void) const
return octave_value(v1.char_array_value().concat(v2.char_array_value(), ra_idx),((a1.is_sq_string()||a2.is_sq_string())? '\'': '"'))
int symbol_exist(const std::string &name, const std::string &type)
static void erase_scope(scope_id scope)
static void top_level_assign(const std::string &name, const octave_value &value=octave_value())
size_t byte_size(void) const
OCTINTERP_API void mlock(void)
static octave_value top_level_varval(const std::string &name)