24 #if defined (HAVE_CONFIG_H) 71 =
" %a:4; %ln:6; %cs:16:6:1; %rb:12; %lc:-1;\n";
83 if (! fcn_name.empty ())
90 if (
val.is_defined ())
91 ans =
val.function_value (
true);
96 error (
"%s: the symbol '%s' is not valid as a function",
97 warn_for.c_str (), fcn_name.c_str ());
118 error (
"%s: argument must be a string containing function name",
140 cmd.append (trailer);
146 if (parse_status != 0)
147 error (
"%s: '%s' is not valid as a function",
148 warn_for.c_str (),
fname.c_str ());
153 error (
"%s: '%s' is not valid as a function",
154 warn_for.c_str (),
fname.c_str ());
156 warning (
"%s: passing function body as a string is obsolete; please use anonymous functions",
170 size_t len =
text.length ();
172 while ((pos =
text.find (
'.', pos)) != std::string::npos)
184 for (
int i = 0;
i < n;
i++)
186 len =
text.find (
'.', pos);
188 if (len != std::string::npos)
193 if (len != std::string::npos)
223 size_t pos =
text.rfind (
'.');
226 if (pos != std::string::npos)
228 if (pos ==
text.length ())
231 hint =
text.substr (pos+1);
233 prefix =
text.substr (0, pos);
243 pos = base_name.find_first_of (
"{(. ");
245 if (pos != std::string::npos)
246 base_name = base_name.substr (0, pos);
269 if (
tmp.is_defined ()
270 && (
tmp.isstruct () ||
tmp.isjava () ||
tmp.is_classdef_object ()))
271 names =
tmp.map_keys ();
273 catch (
const octave::execution_exception&)
293 && (
text !=
"." || prev_char ==
')' || prev_char ==
'}')
295 &&
text.find (
"..") == std::string::npos
296 &&
text.rfind (
'.') != std::string::npos);
299 symbol_record *sr = curr_sym_tab->lookup (
text);
301 if (sr && ! sr->is_function ())
328 if (! args(0).is_string ())
329 error (
"isglobal: NAME must be a string");
377 bool search_any =
type ==
"any";
378 bool search_var =
type ==
"var";
379 bool search_dir =
type ==
"dir";
380 bool search_file =
type ==
"file";
381 bool search_builtin =
type ==
"builtin";
382 bool search_class =
type ==
"class";
384 if (! (search_any || search_var || search_dir || search_file ||
385 search_builtin || search_class))
386 error (R
"(exist: unrecognized type argument "%s")", type.c_str ()); 390 if (search_any || search_var)
396 if (
val.is_constant () ||
val.isobject ()
397 ||
val.is_function_handle ()
398 ||
val.is_anonymous_function ()
399 ||
val.is_inline_function ())
414 if (
val.is_defined ())
418 if (search_any || search_file || search_dir)
422 if (file_name.empty ())
429 size_t len = file_name.length ();
433 if (search_any || search_file)
435 if (len > 4 && (file_name.substr (len-4) ==
".oct" 436 || file_name.substr (len-4) ==
".mex"))
445 if (file_name.empty ())
452 if (search_any || search_file)
457 len = file_name.length ();
459 if (len > 4 && (file_name.substr (len-4) ==
".oct" 460 || file_name.substr (len-4) ==
".mex"))
465 else if (search_dir &&
fs.
is_dir ())
469 if (search_file || search_dir)
473 if (search_any || search_builtin)
475 if (symtab.is_built_in_function_name (
name))
494 #define GET_IDX(LEN) \ 495 static_cast<int> ((LEN-1) * static_cast<double> (rand ()) / RAND_MAX) 501 =
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
503 static size_t len = alpha.length ();
509 if (
nm.substr (0, 2) ==
"__")
516 nm.insert (pos++, 1, alpha[
GET_IDX (len)]);
595 int nargin = args.length ();
600 std::string name = args(0).xstring_value (
"exist: NAME must be a string");
604 std::string type = args(1).xstring_value (
"exist: TYPE must be a string");
607 warning (R
"(exist: "class" type argument is not implemented)"); 694 if (! args(1).is_string () || args(1).string_value () !=
"local")
705 curr_fcn_unwind_protect_frame (
void)
719 template <
typename T>
721 try_local_protect (T&
var)
745 if (wants_local_change (args,
nargin))
747 if (! try_local_protect (
var))
748 warning (R
"("local" has no effect outside a function)"); 756 bool bval = args(0).xbool_value (
"%s: argument must be a logical value",
nm);
775 if (wants_local_change (args,
nargin))
777 if (! try_local_protect (
var))
778 warning (R
"("local" has no effect outside a function)"); 786 std::string sval = args(0).xstring_value (
"%s: argument must be a single character",
nm);
788 switch (sval.length ())
799 error (
"%s: argument must be a single character",
nm);
810 int minval,
int maxval)
819 if (wants_local_change (args,
nargin))
821 if (! try_local_protect (
var))
822 warning (R
"("local" has no effect outside a function)"); 830 int ival = args(0).xint_value (
"%s: argument must be an integer value",
nm);
833 error (
"%s: arg must be greater than %d",
nm, minval);
835 error (
"%s: arg must be less than or equal to %d",
nm, maxval);
846 double minval,
double maxval)
855 if (wants_local_change (args,
nargin))
857 if (! try_local_protect (
var))
858 warning (R
"("local" has no effect outside a function)"); 866 double dval = args(0).xscalar_value (
"%s: argument must be a scalar value",
nm);
869 error (
"%s: argument must be greater than %g", minval);
871 error (
"%s: argument must be less than or equal to %g", maxval);
881 int nargout,
const char *
nm,
bool empty_ok)
890 if (wants_local_change (args,
nargin))
892 if (! try_local_protect (
var))
893 warning (R
"("local" has no effect outside a function)"); 901 std::string sval = args(0).xstring_value (
"%s: first argument must be a string",
nm);
903 if (! empty_ok && sval.empty ())
904 error (
"%s: value must not be empty",
nm);
914 int nargout,
const char *
nm,
const char **choices)
918 while (choices[nchoices] !=
nullptr)
923 assert (
var < nchoices);
928 if (wants_local_change (args,
nargin))
930 if (! try_local_protect (
var))
931 warning (R
"("local" has no effect outside a function)"); 939 std::string sval = args(0).xstring_value (
"%s: first argument must be a string",
nm);
942 for (;
i < nchoices;
i++)
944 if (sval == choices[
i])
951 error (R
"(%s: value not allowed ("%s"))", nm, sval.c_str ()); 959 int nargout,
const char *
nm,
const char **choices)
963 while (choices[nchoices] !=
nullptr)
971 if (wants_local_change (args,
nargin))
973 if (! try_local_protect (
var))
974 warning (R
"("local" has no effect outside a function)"); 982 std::string sval = args(0).xstring_value (
"%s: first argument must be a string",
nm);
985 for (;
i < nchoices;
i++)
987 if (sval == choices[
i])
994 error (R
"(%s: value not allowed ("%s"))", nm, sval.c_str ()); 1005 int parameter_length;
1006 int first_parameter_length;
1016 std::list<whos_parameter>::iterator
i = params.begin ();
1017 std::ostringstream param_buf;
1021 while (
i != params.end ())
1023 whos_parameter
param = *
i;
1025 if (
param.command !=
'\0')
1028 switch (
param.modifier)
1032 << std::setw (
param.parameter_length);
1034 << std::setw (
param.parameter_length);
1039 << std::setw (
param.parameter_length);
1041 << std::setw (
param.parameter_length);
1045 if (
param.command !=
's')
1048 << std::setw (
param.parameter_length);
1050 << std::setw (
param.parameter_length);
1056 << std::setw (
param.parameter_length);
1058 << std::setw (
param.parameter_length);
1061 if (
param.command ==
's' &&
param.modifier ==
'c')
1065 if (
param.modifier ==
'c')
1068 a = (
a < 0 ? 0 :
a);
1070 b = (
b < 0 ? 0 :
b);
1074 << std::setw (
b) <<
"" 1081 << std::setw (
b) <<
"" 1088 param_buf <<
param.line;
1099 param_buf <<
param.line;
1104 os << param_buf.str ();
1140 is_automatic (sr.is_automatic ()),
1141 is_complex (varval.iscomplex ()),
1142 is_formal (sr.is_formal ()),
1143 is_global (sr.is_global ()),
1144 is_persistent (sr.is_persistent ())
1146 varval = (expr_val.is_undefined ()
1149 is_complex = varval.iscomplex ();
1153 const std::list<whos_parameter>& params)
const 1157 std::list<whos_parameter>::const_iterator
i = params.begin ();
1161 while (
i != params.end ())
1163 whos_parameter
param = *
i;
1165 if (
param.command !=
'\0')
1169 switch (
param.modifier)
1173 << std::setw (
param.parameter_length);
1178 << std::setw (
param.parameter_length);
1182 if (
param.command ==
's')
1184 int front =
param.first_parameter_length
1185 - dims_str.
find (
'x');
1186 int back =
param.parameter_length
1189 front = (front > 0) ? front : 0;
1190 back = (back > 0) ? back : 0;
1193 << std::setw (front)
1205 << std::setw (
param.parameter_length);
1210 error (
"whos_line_format: modifier '%c' unknown",
1214 << std::setw (
param.parameter_length);
1217 switch (
param.command)
1223 tmp[0] = (is_automatic ?
'a' :
' ');
1224 tmp[1] = (is_complex ?
'c' :
' ');
1225 tmp[2] = (is_formal ?
'f' :
' ');
1226 tmp[3] = (is_global ?
'g' :
' ');
1227 tmp[4] = (is_persistent ?
'p' :
' ');
1235 os << varval.byte_size ();
1239 os << varval.class_name ();
1243 os << varval.numel ();
1251 if (
param.modifier !=
'c')
1256 os << varval.type_name ();
1260 error (
"whos_line_format: command '%c' unknown",
1314 size_t size (
void)
const {
return lst.size (); }
1316 bool empty (
void)
const {
return lst.empty (); }
1321 size_t len = lst.size ();
1323 Cell name_info (len, 1);
1324 Cell size_info (len, 1);
1325 Cell bytes_info (len, 1);
1326 Cell class_info (len, 1);
1327 Cell global_info (len, 1);
1328 Cell sparse_info (len, 1);
1329 Cell complex_info (len, 1);
1330 Cell nesting_info (len, 1);
1331 Cell persistent_info (len, 1);
1333 std::list<symbol_info>::const_iterator
p = lst.begin ();
1335 for (
size_t j = 0; j < len; j++)
1341 ni.
assign (
"function", caller_function_name);
1342 ni.
assign (
"level", nesting_level);
1344 name_info(j) = si.
name;
1350 size_info(j) =
val.size ();
1351 bytes_info(j) =
val.byte_size ();
1352 class_info(j) =
val.class_name ();
1353 sparse_info(j) =
val.issparse ();
1354 complex_info(j) =
val.iscomplex ();
1355 nesting_info(j) = ni;
1360 info.
assign (
"name", name_info);
1361 info.
assign (
"size", size_info);
1362 info.
assign (
"bytes", bytes_info);
1363 info.
assign (
"class", class_info);
1364 info.
assign (
"global", global_info);
1365 info.
assign (
"sparse", sparse_info);
1366 info.
assign (
"complex", complex_info);
1367 info.
assign (
"nesting", nesting_info);
1368 info.
assign (
"persistent", persistent_info);
1378 size_t elements = 0;
1380 std::list<whos_parameter> params = parse_whos_line_format ();
1386 for (
const auto& syminfo : lst)
1388 syminfo.display_line (
os, params);
1392 elements +=
val.numel ();
1393 bytes +=
val.byte_size ();
1396 os <<
"\nTotal is " << elements
1397 << (elements == 1 ?
" element" :
" elements")
1398 <<
" using " << bytes << (bytes == 1 ?
" byte" :
" bytes")
1411 std::list<whos_parameter> params;
1419 size_t pos_a, pos_b, pos_c, pos_e, pos_n, pos_s, pos_t;
1421 pos_a = param_string.find (
'a');
1422 pos_b = param_string.find (
'b');
1423 pos_c = param_string.find (
'c');
1424 pos_e = param_string.find (
'e');
1425 pos_n = param_string.find (
'n');
1426 pos_s = param_string.find (
's');
1427 pos_t = param_string.find (
't');
1429 param_names(pos_a) =
"Attr";
1430 param_names(pos_b) =
"Bytes";
1431 param_names(pos_c) =
"Class";
1432 param_names(pos_e) =
"Elements";
1433 param_names(pos_n) =
"Name";
1434 param_names(pos_s) =
"Size";
1435 param_names(pos_t) =
"Type";
1437 for (
size_t i = 0;
i < param_string.length ();
i++)
1438 param_length(
i) = param_names(
i).
length ();
1441 param_length(pos_a) = 5;
1446 for (
const auto& syminfo : lst)
1448 std::stringstream ss1, ss2;
1452 param_length(pos_n) = ((
str.length ()
1453 >
static_cast<size_t> (param_length(pos_n)))
1454 ?
str.length () : param_length(pos_n));
1459 param_length(pos_t) = ((
str.length ()
1460 >
static_cast<size_t> (param_length(pos_t)))
1461 ?
str.length () : param_length(pos_t));
1463 elements1 =
val.numel ();
1466 param_length(pos_e) = ((
str.length ()
1467 >
static_cast<size_t> (param_length(pos_e)))
1468 ?
str.length () : param_length(pos_e));
1470 bytes1 =
val.byte_size ();
1473 param_length(pos_b) = ((
str.length ()
1474 >
static_cast<size_t> (param_length(pos_b)))
1475 ?
str.length () : param_length (pos_b));
1479 while (static_cast<size_t> (idx) < format_len)
1481 whos_parameter
param;
1482 param.command =
'\0';
1486 bool error_encountered =
false;
1487 param.modifier =
'r';
1488 param.parameter_length = 0;
1499 pos = cmd.find (
';');
1500 if (pos == std::string::npos)
1501 error (
"parameter without ; in whos_line_format");
1503 cmd = cmd.substr (0, pos+1);
1505 idx += cmd.length ();
1509 if (cmd.find_first_of (
"crl") != 1)
1510 items = sscanf (cmd.c_str (),
"%c%c:%d:%d:%d;",
1511 &garbage, &
param.command, &
a, &
b, &balance);
1513 items = sscanf (cmd.c_str (),
"%c%c%c:%d:%d:%d;",
1515 &
a, &
b, &balance) - 1;
1518 error (
"whos_line_format: parameter structure without command in whos_line_format");
1521 if (
param.modifier ==
'c' 1522 && param_string.
find (
param.command) == std::string::npos)
1524 param.modifier =
'r';
1525 param.command =
'c';
1529 param.first_parameter_length = 0;
1530 pos = param_string.find (
param.command);
1531 if (pos == std::string::npos)
1532 error (
"whos_line_format: '%c' is not a command",
param.command);
1534 param.parameter_length = param_length(pos);
1535 param.text = param_names(pos);
1538 param.parameter_length = (
a >
param.parameter_length
1539 ?
a :
param.parameter_length);
1540 if (
param.command ==
's' &&
param.modifier ==
'c' &&
b > 0)
1541 param.first_parameter_length =
b;
1543 if (
param.command ==
's')
1553 int total =
param.parameter_length;
1555 for (
const auto& syminfo : lst)
1559 int first1 = dims_str.find (
'x');
1560 int total1 = dims_str.length ();
1561 int rest1 = total1 - first1;
1562 rest = (rest1 > rest ? rest1 : rest);
1564 total = (total1 > total ? total1 : total);
1567 if (
param.modifier ==
'c')
1569 if (
first < balance)
1571 if (rest + balance <
param.parameter_length)
1572 rest +=
param.parameter_length - rest - balance;
1576 param.balance = balance;
1580 param.parameter_length = total;
1581 param.first_parameter_length = 0;
1584 else if (
param.modifier ==
'c')
1585 error (
"whos_line_format: modifier 'c' not available for command '%c'",
1591 param.first_parameter_length = (
b < 0
1593 :
param.first_parameter_length);
1594 param.parameter_length = (
a < 0
1596 : (
param.parameter_length
1597 < param_length(pos_s)
1598 ? param_length(pos_s)
1599 :
param.parameter_length));
1602 if (! error_encountered)
1603 params.push_back (
param);
1611 pos =
text.find (
'%');
1612 if (pos != std::string::npos)
1616 idx +=
text.length ();
1619 params.push_back (
param);
1642 bool global_only =
false;
1643 bool have_regexp =
false;
1648 if (
argv[
i] ==
"-file")
1657 error (
"%s: -file argument must be followed by a filename",
1675 std::string newmsg =
"Variables in the file " +
nm +
":\n\n";
1681 else if (
argv[
i] ==
"-regexp")
1683 else if (
argv[
i] ==
"global")
1685 else if (
argv[
i][0] ==
'-')
1686 warning (
"%s: unrecognized option '%s'", my_name.c_str (),
1692 int npats =
argc -
i;
1697 for (
int j = 0; j < npats; j++)
1698 pats[j] =
argv[
i+j];
1707 std::list<std::string> symbol_names;
1713 for (
int j = 0; j < npats; j++)
1719 std::list<octave::symbol_record>
tmp 1724 for (
const auto& symrec :
tmp)
1726 if (symrec.is_variable (
context))
1731 symbol_names.push_back (symrec.name ());
1737 size_t pos = pat.find_first_of (
".({");
1739 if (pos != std::string::npos && pos > 0)
1771 std::list<octave::symbol_record>
tmp 1776 for (
const auto& symrec :
tmp)
1778 if (symrec.is_variable (
context))
1783 symbol_names.push_back (symrec.name ());
1797 caller_function_name = caller->
name ();
1804 else if (! (symbol_stats.
empty () && symbol_names.empty ()))
1975 error (
"mlock: invalid use outside a function");
1999 std::string name = args(0).xstring_value (
"munlock: FCN must be a string");
2001 interp.munlock (
name);
2010 error (
"munlock: invalid use outside a function");
2037 std::string name = args(0).xstring_value (
"mislocked: FCN must be a string");
2048 error (
"mislocked: invalid use outside a function");
2060 int argc,
int idx,
bool have_regexp =
false)
2064 for (
int k = idx;
k <
argc;
k++)
2067 if (! patstr.empty ())
2094 maybe_warn_exclusive (
bool exclusive)
2097 warning (
"clear: ignoring --exclusive option");
2103 bool exclusive =
false)
2113 int fcount = fcns.
numel ();
2115 for (
int i = 0;
i < fcount;
i++)
2119 if (! name_matches_any_pattern (
nm,
argv,
argc, idx))
2134 bool exclusive =
false)
2145 int gcount = gvars.
numel ();
2147 for (
int i = 0;
i < gcount;
i++)
2161 int gcount = gvars.
numel ();
2163 for (
int i = 0;
i < gcount;
i++)
2167 if (! name_matches_any_pattern (
name,
argv,
argc, idx))
2190 bool exclusive =
false,
bool have_regexp =
false)
2205 int lcount = lvars.
numel ();
2207 for (
int i = 0;
i < lcount;
i++)
2211 if (! name_matches_any_pattern (
nm,
argv,
argc, idx, have_regexp))
2230 bool exclusive =
false)
2248 do_clear_variables (symtab,
argv,
argc, idx, exclusive);
2249 do_clear_functions (symtab,
argv,
argc, idx, exclusive);
2270 for (; idx <
argc; idx++)
2272 if (
argv[idx] ==
"all" 2277 else if (
argv[idx] ==
"functions" 2280 do_clear_functions (symtab,
argv,
argc, ++idx);
2282 else if (
argv[idx] ==
"global" 2285 do_clear_globals (symtab,
argv,
argc, ++idx);
2287 else if (
argv[idx] ==
"variables" 2292 else if (
argv[idx] ==
"classes" 2306 #define CLEAR_OPTION_ERROR(cond) \ 2396 do_clear_globals (symtab,
argv,
argc,
true);
2397 do_clear_variables (symtab,
argv,
argc,
true);
2405 bool clear_all =
false;
2406 bool clear_functions =
false;
2407 bool clear_globals =
false;
2408 bool clear_variables =
false;
2409 bool clear_objects =
false;
2410 bool exclusive =
false;
2411 bool have_regexp =
false;
2412 bool have_dash_option =
false;
2416 while (++idx <
argc)
2418 if (
argv[idx] ==
"-all" ||
argv[idx] ==
"-a")
2420 CLEAR_OPTION_ERROR (have_dash_option && ! exclusive);
2422 have_dash_option =
true;
2425 else if (
argv[idx] ==
"-exclusive" ||
argv[idx] ==
"-x")
2427 have_dash_option =
true;
2430 else if (
argv[idx] ==
"-functions" ||
argv[idx] ==
"-f")
2432 CLEAR_OPTION_ERROR (have_dash_option && ! exclusive);
2434 have_dash_option =
true;
2435 clear_functions =
true;
2437 else if (
argv[idx] ==
"-global" ||
argv[idx] ==
"-g")
2439 CLEAR_OPTION_ERROR (have_dash_option && ! exclusive);
2441 have_dash_option =
true;
2442 clear_globals =
true;
2444 else if (
argv[idx] ==
"-variables" ||
argv[idx] ==
"-v")
2446 CLEAR_OPTION_ERROR (have_dash_option && ! exclusive);
2448 have_dash_option =
true;
2449 clear_variables =
true;
2451 else if (
argv[idx] ==
"-classes" ||
argv[idx] ==
"-c")
2453 CLEAR_OPTION_ERROR (have_dash_option && ! exclusive);
2455 have_dash_option =
true;
2456 clear_objects =
true;
2458 else if (
argv[idx] ==
"-regexp" ||
argv[idx] ==
"-r")
2460 CLEAR_OPTION_ERROR (have_dash_option && ! exclusive);
2462 have_dash_option =
true;
2471 if (! have_dash_option)
2472 do_matlab_compatible_clear (symtab,
argv,
argc, idx);
2477 maybe_warn_exclusive (exclusive);
2480 warning (
"clear: ignoring extra arguments after -all");
2484 else if (have_regexp)
2486 do_clear_variables (symtab,
argv,
argc, idx, exclusive,
true);
2488 else if (clear_functions)
2490 do_clear_functions (symtab,
argv,
argc, idx, exclusive);
2492 else if (clear_globals)
2494 do_clear_globals (symtab,
argv,
argc, idx, exclusive);
2496 else if (clear_variables)
2498 do_clear_variables (symtab,
argv,
argc, idx, exclusive);
2500 else if (clear_objects)
2509 do_clear_symbols (symtab,
argv,
argc, idx, exclusive);
2597 static std::string Vmissing_function_hook =
"__unimplemented__";
2627 if (
val.is_defined ())
2634 const std::string func_name = Vmissing_function_hook;
2635 Vmissing_function_hook.clear ();
2652 std::string name = args(0).xstring_value (
"__varval__: first argument must be a variable name");
2780 if (
val.is_undefined () && ! silent)
2781 error (
"get_global_value: undefined symbol '%s'",
nm.c_str ());
2803 if (
val.is_undefined () && ! silent)
2804 error (
"get_top_level_value: undefined symbol '%s'",
nm.c_str ());
OCTINTERP_API octave_value_list feval(const std::string &name, const octave_value_list &args=octave_value_list(), int nargout=0)
std::string str(char sep='x') const
OCTINTERP_API void clear_function(const std::string &nm)
void append(const octave::symbol_record &sr, octave::symbol_record::context_id context)
OCTINTERP_API void set_top_level_value(const std::string &nm, const octave_value &val)
octave_value find_function(const std::string &name, const octave_value_list &args=octave_value_list(), bool local_funcs=true)
symbol_record find_symbol(const std::string &name, symbol_scope &sid)
virtual bool is_user_function(void) const
OCTINTERP_API void clear_symbol(const std::string &nm)
static void clear_workspace(void)
bool is_global(void) const
#define DEFMETHOD(name, interp_name, args_name, nargout_name, doc)
Macro to define a builtin method.
interpreter & __get_interpreter__(const std::string &who)
std::string get_dims_str(const octave_value &val)
void display_line(std::ostream &os, const std::list< whos_parameter > ¶ms) const
std::string string_value(bool force=false) const
void assign(const std::string &k, const Cell &val)
static void recover_from_exception(void)
OCTINTERP_API void print_usage(void)
std::string dir_sep_chars(void)
identity matrix If supplied two scalar respectively For allows like xample val
OCTINTERP_API void clear_variable(const std::string &nm)
symbol_scope current_scope(void)
std::string xstring_value(const char *fmt,...) const
octave_value_list & append(const octave_value &val)
bool islocked(void) const
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
#define DEFUN(name, args_name, nargout_name, doc)
Macro to define a builtin function.
void error(const char *fmt,...)
void clear_all(bool force=false)
std::list< symbol_record > regexp_variables(const string_vector &patterns)
static void print_descriptor(std::ostream &os, std::list< whos_parameter > params)
#define SET_INTERNAL_VARIABLE(NM)
std::ostream & list_in_columns(std::ostream &, int width=0, const std::string &prefix="") const
nd deftypefn *void maybe_missing_function_hook(const std::string &name)
void clear_variable(const std::string &name)
octave_user_code * caller_user_code(size_t nskip=0) const
OCTINTERP_API std::string file_in_path(const std::string &, const std::string &)
static llvm::LLVMContext & context
OCTINTERP_API std::string lookup_autoload(const std::string &nm)
static std::string Vwhos_line_format
symbol_scope __get_current_scope__(const std::string &who)
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
static std::string basename(const std::string &s, bool strip_path=false)
void clear_variable_regexp(const std::string &pat)
in this the arguments are accumulated from left to right
void append(const octave::symbol_record &sr, octave::symbol_record::context_id context, const std::string &expr_str, const octave_value &expr_val)
void clear_global_pattern(const std::string &pattern)
void resize(octave_idx_type n, const std::string &rfv="")
void push(octave_function *fcn)
void bind_ans(const octave_value &val, bool print)
std::list< symbol_record > glob_variables(const string_vector &patterns)
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
OCTINTERP_API octave_value get_top_level_value(const std::string &nm, bool silent=false)
symbol_info(const octave::symbol_record &sr, octave::symbol_record::context_id context, const std::string &expr_str="", const octave_value &expr_val=octave_value())
then the function must return scalars which will be concatenated into the return array(s). If code
symbol_table & __get_symbol_table__(const std::string &who)
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
std::list< std::string > user_function_names(void)
OCTAVE_EXPORT octave_value_list isdir nd deftypefn *std::string nm
std::list< symbol_info > lst
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)
std::string find_fcn(const std::string &fcn, std::string &dir_name, const std::string &pack_name="")
nd example oindent opens the file binary numeric values will be read assuming they are stored in IEEE format with the least significant bit first
OCTINTERP_API octave_value_list eval_string(const std::string &, bool silent, int &parse_status, int nargout)
load_path & get_load_path(void)
octave_function * caller(void) const
OCTINTERP_API bool mislocked(const std::string &)
void error_with_cfn(const char *fmt,...)
symbol_record::context_id current_context(void) const
static void set_workspace(void)
bool mislocked(const std::string &nm)
string_vector get_struct_elts(const std::string &text)
void munlock(const std::string &nm)
void clear_variables(void)
string_vector generate_struct_completions(const std::string &text, std::string &prefix, std::string &hint)
string_vector make_argv(const std::string &="") const
static bool is_variable(octave::symbol_table &symtab, const std::string &name)
std::list< std::string > global_variable_names(void)
OCTINTERP_API octave_value lookup_function_handle(const std::string &nm)
OCTINTERP_API void munlock(const std::string &)
OCTINTERP_API void bind_ans(const octave_value &val, bool print)
Array< std::string > param
bool is_match(const std::string &buffer)
bool is_keyword(const std::string &s)
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
std::list< whos_parameter > parse_whos_line_format(void)
static dim_vector alloc(int n)
end deftypefn *return set_internal_variable(Vsvd_driver, args, nargout, "svd_driver", driver_names)
octave_value varval(const std::string &name) const
OCTINTERP_API void set_global_value(const std::string &nm, const octave_value &val)
symbol_table & get_symbol_table(void)
static std::string Vmissing_component_hook
void clear_mex_functions(void)
octave_map map_value(const std::string &caller_function_name, int nesting_level) const
void warning(const char *fmt,...)
octave::unwind_protect frame
return octave_value(v1.char_array_value() . concat(v2.char_array_value(), ra_idx),((a1.is_sq_string()||a2.is_sq_string()) ? '\'' :'"'))
octave::unwind_protect * unwind_protect_frame(void)
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_exemplar_map(void)
octave_value global_varval(const std::string &name) const
octave_value top_level_varval(const std::string &name) const
OCTAVE_EXPORT octave_value_list isa nd deftypefn *return ovl(args(0).isinteger())
static int symbol_exist(octave::interpreter &interp, const std::string &name, const std::string &type="any")
bool is_variable(const std::string &name) const
OCTINTERP_API octave_value get_global_value(const std::string &nm, bool silent=false)
void assign(const std::string &k, const octave_value &val)
call_stack & __get_call_stack__(const std::string &who)
symbol_info_list(const symbol_info_list &sil)
void clear_functions(bool force=false)
void clear_symbol(const std::string &name)
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)
octave_idx_type length(void) const
call_stack & get_call_stack(void)
Array< octave_idx_type > find(octave_idx_type n=-1, bool backward=false) const
Find indices of (at most n) nonzero elements.
void clear_function_pattern(const std::string &pat)
octave::sys::file_stat fs(filename)
void add_method(T *obj, void(T::*method)(void))
void assign(const idx_vector &i, const Array< T > &rhs, const T &rfv)
Indexed assignment (always with resize & fill).
void display(std::ostream &os)
void clear_function(const std::string &name)
void set_scope(const symbol_scope &sid)
bool is_string(void) const
octave_idx_type ndims(void) const
Number of dimensions.
void clear_symbol_pattern(const std::string &pat)
void clear_global(const std::string &name)
octave_value varval(context_id context) const
octave_idx_type numel(void) const
Number of elements in the array.
bool is_local_variable(const std::string &name) const
octave_function * is_valid_function(const std::string &fcn_name, const std::string &warn_for, bool warn)
bool discard_warning_messages
static octave_value do_who(octave::interpreter &interp, int argc, const string_vector &argv, bool return_list, bool verbose=false, std::string msg="")
Vector representing the dimensions (size) of an Array.
bool discard_error_messages
std::string name(void) const
bool is_global(const std::string &name) const
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
void global_assign(const std::string &name, const octave_value &value=octave_value())
tree_evaluator & __get_evaluator__(const std::string &who)
void top_level_assign(const std::string &name, const octave_value &value=octave_value())
std::list< symbol_record > regexp_global_variables(const std::string &pattern)
OCTINTERP_API void clear_mex_functions(void)
static octave_value do_isglobal(octave::symbol_table &symtab, const octave_value_list &args)
octave_idx_type length(void) const
Number of elements in the array.
std::list< symbol_record > glob_global_variables(const std::string &pattern)
OCTINTERP_API void mlock(void)
std::list< std::string > variable_names(void)
void clear_variable_pattern(const std::string &pat)