26 #if defined (HAVE_CONFIG_H)
104 std::string
type (
void)
const {
return "<invalid>"; }
130 std::string
type (
void)
const {
return "<internal>"; }
169 const std::string&
file =
"",
170 const std::string& =
"")
195 std::string
type (
void)
const {
return "simple"; }
216 bool save_binary (std::ostream& os,
bool save_as_floats);
225 void print_raw (std::ostream& os,
bool pr_as_read_syntax,
226 int current_print_indent_level)
const;
244 const std::string&
file =
"",
245 const std::string& =
"")
250 const std::list<std::string>& parentage);
261 std::string
type (
void)
const {
return "scopedfunction"; }
288 bool save_binary (std::ostream& os,
bool save_as_floats);
297 void print_raw (std::ostream&,
bool pr_as_read_syntax,
298 int current_print_indent_level)
const;
323 const std::string&
file =
"",
324 const std::string& =
"")
329 const std::shared_ptr<stack_frame>& closure_frames);
340 std::string
type (
void)
const {
return "nested"; }
369 bool save_binary (std::ostream& os,
bool save_as_floats);
378 void print_raw (std::ostream&,
bool pr_as_read_syntax,
379 int current_print_indent_level)
const;
401 const std::string&
file,
410 const std::string& meth_nm);
413 const std::string& class_nm,
414 const std::string& meth_nm);
417 const std::string& class_nm,
418 const std::string& meth_nm);
429 std::string
type (
void)
const {
return "classsimple"; }
477 bool save_binary (std::ostream& os,
bool save_as_floats);
486 void print_raw (std::ostream&,
bool pr_as_read_syntax,
487 int current_print_indent_level)
const;
531 std::string
type (
void)
const {
return "anonymous"; }
560 bool save_binary (std::ostream& os,
bool save_as_floats);
569 void print_raw (std::ostream&,
bool pr_as_read_syntax,
570 int current_print_indent_level)
const;
575 bool parse (
const std::string& fcn_text);
596 error (
"invalid function handle, unable to find function for @%s",
602 const std::list<octave_value_list>& idx,
611 int tmp_nargout = (
type.length () > 1 && nargout == 0) ? 1 : nargout;
619 error (
"function handle cannot be indexed with %c",
type[0]);
639 std::ostringstream buf;
694 std::string obj_type =
type ();
697 (
"Octave:load-save-unavailable",
698 "%s: loading %s files not available in this version of Octave",
699 obj_type.c_str (), file_type);
704 std::string obj_type =
type ();
707 (
"Octave:load-save-unavailable",
708 "%s: saving %s files not available in this version of Octave",
709 obj_type.c_str (), file_type);
714 std::string htype =
type ();
716 warning (
"%s for %s handles with %s format is not implemented",
717 op, htype.c_str (), fmt);
723 error (
"invalid call to invalid function handle");
739 m.setfield (
"type",
type ());
740 m.setfield (
"file",
"");
772 size_t pos =
m_name.find (
'.');
774 if (pos != std::string::npos)
797 std::vector<std::string> idx_elts;
801 end =
m_name.find (
'.', beg);
803 idx_elts.push_back (
m_name.substr (beg, end-beg));
805 if (end == std::string::npos)
811 size_t n_elts = idx_elts.size ();
813 bool have_object =
false;
820 partial_expr_val = interp.
varval (idx_elts[0]);
833 std::list<octave_value_list> arg_list;
835 for (
size_t i = 1; i < n_elts; i++)
843 arg_list.push_back (
ovl (idx_elts[i]));
877 arg_list.push_back (
ovl (idx_elts[i]));
878 arg_list.push_back (args);
880 return partial_expr_val.
subsref (
type, arg_list, nargout);
891 fcn_to_call = partial_expr_val;
922 fcn_to_call = ov_fcn;
931 fcn_to_call = ov_fcn;
938 return interp.
feval (fcn_to_call, args, nargout);
1003 m.setfield (
"type",
type ());
1005 m.setfield (
"file",
file ());
1014 std::string fnm =
file ();
1016 os <<
"# path: " << fnm <<
"\n";
1018 os <<
"# subtype: " <<
type () <<
"\n";
1036 std::ostringstream nmbuf;
1044 std::string buf_str = nmbuf.str ();
1045 int32_t tmp = buf_str.length ();
1046 os.write (
reinterpret_cast<char *
> (&tmp), 4);
1047 os.write (buf_str.c_str (), buf_str.length ());
1061 #if defined (HAVE_HDF5)
1066 #if defined (HAVE_HDF5_18)
1070 group_hid = H5Gcreate (loc_id,
name, 0);
1076 space_hid = data_hid = type_hid = -1;
1079 type_hid = H5Tcopy (H5T_C_S1);
1080 H5Tset_size (type_hid,
m_name.length () + 1);
1083 H5Gclose (group_hid);
1090 space_hid = H5Screate_simple (0, hdims,
nullptr);
1093 H5Tclose (type_hid);
1094 H5Gclose (group_hid);
1097 #if defined (HAVE_HDF5_18)
1098 data_hid = H5Dcreate (group_hid,
"nm", type_hid, space_hid,
1102 data_hid = H5Dcreate (group_hid,
"nm", type_hid, space_hid,
1109 H5Sclose (space_hid);
1110 H5Tclose (type_hid);
1111 H5Gclose (group_hid);
1114 H5Dclose (data_hid);
1121 H5Sclose (space_hid);
1123 hdims[1] = octaveroot.length ();
1124 space_hid = H5Screate_simple (0, hdims,
nullptr);
1127 H5Tclose (type_hid);
1128 H5Gclose (group_hid);
1132 H5Tclose (type_hid);
1133 type_hid = H5Tcopy (H5T_C_S1);
1134 H5Tset_size (type_hid, octaveroot.length () + 1);
1136 #if defined (HAVE_HDF5_18)
1137 a_id = H5Acreate (group_hid,
"OCTAVEROOT", type_hid, space_hid,
1140 a_id = H5Acreate (group_hid,
"OCTAVEROOT", type_hid, space_hid,
1146 retval = (H5Awrite (a_id, type_hid, octaveroot.c_str ()) >= 0);
1152 H5Sclose (space_hid);
1153 H5Tclose (type_hid);
1154 H5Gclose (group_hid);
1158 H5Sclose (space_hid);
1160 hdims[1] = fpath.length ();
1161 space_hid = H5Screate_simple (0, hdims,
nullptr);
1164 H5Tclose (type_hid);
1165 H5Gclose (group_hid);
1169 H5Tclose (type_hid);
1170 type_hid = H5Tcopy (H5T_C_S1);
1171 H5Tset_size (type_hid, fpath.length () + 1);
1173 #if defined (HAVE_HDF5_18)
1174 a_id = H5Acreate (group_hid,
"FILE", type_hid, space_hid,
1182 retval = (H5Awrite (a_id, type_hid, fpath.c_str ()) >= 0);
1189 H5Sclose (space_hid);
1190 H5Tclose (type_hid);
1191 H5Gclose (group_hid);
1197 octave_unused_parameter (loc_id);
1198 octave_unused_parameter (
name);
1211 #if defined (HAVE_HDF5)
1215 octave_unused_parameter (group_hid);
1216 octave_unused_parameter (space_hid);
1217 octave_unused_parameter (type_hid);
1223 octave_unused_parameter (group_hid);
1224 octave_unused_parameter (space_hid);
1225 octave_unused_parameter (type_hid);
1233 int current_print_indent_level)
const
1236 current_print_indent_level);
1254 const std::string&
name,
1255 const std::list<std::string>& parentage)
1296 m.setfield (
"type",
type ());
1297 m.setfield (
"file",
file ());
1308 std::string fnm =
file ();
1310 os <<
"# path: " << fnm <<
"\n";
1312 os <<
"# subtype: " <<
type () <<
"\n";
1340 std::ostringstream nmbuf;
1342 std::string fnm =
file ();
1347 std::string buf_str = nmbuf.str ();
1348 int32_t
len = buf_str.length ();
1349 os.write (
reinterpret_cast<char *
> (&
len), 4);
1350 os.write (buf_str.c_str (), buf_str.length ());
1378 #if defined (HAVE_HDF5)
1384 octave_unused_parameter (loc_id);
1385 octave_unused_parameter (
name);
1391 octave_unused_parameter (loc_id);
1392 octave_unused_parameter (
name);
1405 #if defined (HAVE_HDF5)
1411 octave_unused_parameter (group_hid);
1412 octave_unused_parameter (space_hid);
1413 octave_unused_parameter (type_hid);
1419 octave_unused_parameter (group_hid);
1420 octave_unused_parameter (space_hid);
1421 octave_unused_parameter (type_hid);
1429 bool pr_as_read_syntax,
1430 int current_print_indent_level)
const
1433 current_print_indent_level);
1462 if (pos != std::string::npos)
1463 dir_name = dir_name.substr (0, pos);
1464 else if (dir_name ==
"private")
1477 std::string primary_parent_name =
m_parentage.back ();
1492 if (file_name.substr (0, oct_home.size ()) == oct_home)
1493 file_name = file_name.substr (oct_home.size ());
1505 const std::string&
name,
1506 const std::shared_ptr<stack_frame>& closure_frames)
1521 return oct_usr_fcn->
execute (tw, nargout, args);
1534 m.setfield (
"type",
type ());
1535 m.setfield (
"file",
"");
1554 octave_unused_parameter (os);
1563 octave_unused_parameter (is);
1572 octave_unused_parameter (os);
1573 octave_unused_parameter (save_as_floats);
1583 octave_unused_parameter (is);
1584 octave_unused_parameter (swap);
1585 octave_unused_parameter (fmt);
1593 #if defined (HAVE_HDF5)
1597 octave_unused_parameter (loc_id);
1598 octave_unused_parameter (
name);
1604 octave_unused_parameter (loc_id);
1605 octave_unused_parameter (
name);
1618 #if defined (HAVE_HDF5)
1622 octave_unused_parameter (group_hid);
1623 octave_unused_parameter (space_hid);
1624 octave_unused_parameter (type_hid);
1630 octave_unused_parameter (group_hid);
1631 octave_unused_parameter (space_hid);
1632 octave_unused_parameter (type_hid);
1640 bool pr_as_read_syntax,
1641 int current_print_indent_level)
const
1644 current_print_indent_level);
1657 const std::string& meth_nm)
1659 m_dispatch_class (class_nm)
1663 const std::string& class_nm,
1664 const std::string& meth_nm)
1666 m_dispatch_class (class_nm)
1671 const std::string& class_nm,
1672 const std::string& meth_nm)
1674 m_dispatch_class (class_nm)
1687 return interp.
feval (
m_fcn, tmp_args, nargout);
1712 m.setfield (
"type",
type ());
1713 m.setfield (
"file",
"");
1728 octave_unused_parameter (os);
1737 octave_unused_parameter (is);
1743 bool save_as_floats)
1747 octave_unused_parameter (os);
1748 octave_unused_parameter (save_as_floats);
1758 octave_unused_parameter (is);
1759 octave_unused_parameter (swap);
1760 octave_unused_parameter (fmt);
1766 const char *
name,
bool)
1768 #if defined (HAVE_HDF5)
1772 octave_unused_parameter (loc_id);
1773 octave_unused_parameter (
name);
1779 octave_unused_parameter (loc_id);
1780 octave_unused_parameter (
name);
1793 #if defined (HAVE_HDF5)
1797 octave_unused_parameter (group_hid);
1798 octave_unused_parameter (space_hid);
1799 octave_unused_parameter (type_hid);
1805 octave_unused_parameter (group_hid);
1806 octave_unused_parameter (space_hid);
1807 octave_unused_parameter (type_hid);
1815 bool pr_as_read_syntax,
1816 int current_print_indent_level)
const
1819 current_print_indent_level);
1850 return oct_usr_fcn->
execute (tw, nargout, args);
1858 ws.
assign (nm_val.first, nm_val.second);
1867 std::ostringstream buf;
1869 m.setfield (
"function", buf.str ());
1871 m.setfield (
"type",
type ());
1872 m.setfield (
"file",
"");
1874 m.setfield (
"within_file_path",
"");
1895 os <<
"# length: " << varlen <<
"\n";
1899 if (!
save_text_data (os, nm_val.second, nm_val.first,
false, 0))
1900 return ! os.fail ();
1921 std::streampos pos = is.tellg ();
1950 error (
"load: failed to load anonymous function handle");
1975 std::ostringstream nmbuf;
1981 nmbuf <<
' ' << varlen;
1983 std::string buf_str = nmbuf.str ();
1984 int32_t tmp = buf_str.length ();
1985 os.write (
reinterpret_cast<char *
> (&tmp), 4);
1986 os.write (buf_str.c_str (), buf_str.length ());
1988 std::ostringstream buf;
1990 std::string stmp = buf.str ();
1991 tmp = stmp.length ();
1992 os.write (
reinterpret_cast<char *
> (&tmp), 4);
1993 os.write (stmp.c_str (), stmp.length ());
2000 "", 0, save_as_floats))
2001 return ! os.fail ();
2016 if (
m_name.length () > anl)
2018 std::istringstream nm_is (
m_name.substr (anl));
2030 if (! is.read (
reinterpret_cast<char *
> (&tmp), 4))
2038 is.read (ctmp2, tmp);
2066 error (
"load: failed to load anonymous function handle");
2073 return parse (ctmp2);
2079 const char *
name,
bool save_as_floats)
2081 #if defined (HAVE_HDF5)
2086 #if defined (HAVE_HDF5_18)
2090 group_hid = H5Gcreate (loc_id,
name, 0);
2096 space_hid = data_hid = type_hid = -1;
2099 type_hid = H5Tcopy (H5T_C_S1);
2100 H5Tset_size (type_hid,
m_name.length () + 1);
2103 H5Gclose (group_hid);
2110 space_hid = H5Screate_simple (0, hdims,
nullptr);
2113 H5Tclose (type_hid);
2114 H5Gclose (group_hid);
2117 #if defined (HAVE_HDF5_18)
2118 data_hid = H5Dcreate (group_hid,
"nm", type_hid, space_hid,
2122 data_hid = H5Dcreate (group_hid,
"nm", type_hid, space_hid,
2129 H5Sclose (space_hid);
2130 H5Tclose (type_hid);
2131 H5Gclose (group_hid);
2134 H5Dclose (data_hid);
2136 std::ostringstream buf;
2138 std::string stmp = buf.str ();
2141 H5Tset_size (type_hid, stmp.length () + 1);
2144 H5Sclose (space_hid);
2145 H5Gclose (group_hid);
2149 #if defined (HAVE_HDF5_18)
2150 data_hid = H5Dcreate (group_hid,
"fcn", type_hid, space_hid,
2154 data_hid = H5Dcreate (group_hid,
"fcn", type_hid, space_hid,
2161 H5Sclose (space_hid);
2162 H5Tclose (type_hid);
2163 H5Gclose (group_hid);
2167 H5Dclose (data_hid);
2178 #if defined (HAVE_HDF5_18)
2179 a_id = H5Acreate (group_hid,
"SYMBOL_TABLE",
H5T_NATIVE_IDX, as_id,
2183 a_id = H5Acreate (group_hid,
"SYMBOL_TABLE",
H5T_NATIVE_IDX, as_id,
2200 #if defined (HAVE_HDF5_18)
2201 data_hid = H5Gcreate (group_hid,
"symbol table",
2204 data_hid = H5Gcreate (group_hid,
"symbol table", 0);
2208 H5Sclose (space_hid);
2209 H5Tclose (type_hid);
2210 H5Gclose (group_hid);
2217 "",
false, save_as_floats))
2221 H5Gclose (data_hid);
2224 H5Sclose (space_hid);
2225 H5Tclose (type_hid);
2226 H5Gclose (group_hid);
2232 octave_unused_parameter (loc_id);
2233 octave_unused_parameter (
name);
2234 octave_unused_parameter (save_as_floats);
2247 #if defined (HAVE_HDF5)
2249 bool success =
true;
2251 #if defined (HAVE_HDF5_18)
2259 H5Sclose (space_hid);
2260 H5Tclose (type_hid);
2261 H5Gclose (group_hid);
2265 H5Tclose (type_hid);
2266 type_hid = H5Dget_type (data_hid);
2269 if (type_class_hid != H5T_STRING)
2271 H5Sclose (space_hid);
2272 H5Tclose (type_hid);
2273 H5Dclose (data_hid);
2274 H5Gclose (group_hid);
2278 H5Sclose (space_hid);
2279 space_hid = H5Dget_space (data_hid);
2280 hsize_t rank = H5Sget_simple_extent_ndims (space_hid);
2284 H5Sclose (space_hid);
2285 H5Tclose (type_hid);
2286 H5Dclose (data_hid);
2287 H5Gclose (group_hid);
2291 int slen = H5Tget_size (type_hid);
2294 H5Sclose (space_hid);
2295 H5Tclose (type_hid);
2296 H5Dclose (data_hid);
2297 H5Gclose (group_hid);
2305 H5Tset_size (st_id, slen);
2312 H5Sclose (space_hid);
2313 H5Tclose (type_hid);
2314 H5Dclose (data_hid);
2315 H5Gclose (group_hid);
2319 H5Dclose (data_hid);
2327 H5E_auto_t err_func;
2328 void *err_func_data;
2332 #if defined (HAVE_HDF5_18)
2336 H5Eget_auto (&err_func, &err_func_data);
2337 H5Eset_auto (
nullptr,
nullptr);
2340 octave_hdf5_id attr_id = H5Aopen_name (group_hid,
"SYMBOL_TABLE");
2351 #if defined (HAVE_HDF5_18)
2354 H5Eset_auto (err_func, err_func_data);
2370 if (
len > 0 && success)
2372 hsize_t num_obj = 0;
2373 #if defined (HAVE_HDF5_18)
2376 data_hid = H5Gopen (group_hid,
"symbol table");
2378 H5Gget_num_objs (data_hid, &num_obj);
2379 H5Gclose (data_hid);
2381 if (num_obj !=
static_cast<hsize_t
> (
len))
2382 error (
"load: failed to load anonymous function handle");
2385 int current_item = 0;
2390 error (
"load: failed to load anonymous function handle");
2397 return parse (fcn_tmp);
2403 octave_unused_parameter (group_hid);
2404 octave_unused_parameter (space_hid);
2405 octave_unused_parameter (type_hid);
2419 error (
"invalid anonymous function handle");
2436 assert (b->
length () == 1);
2441 error (
"invalid anonymous function handle");
2448 error (
"invalid anonymous function handle");
2475 = interp.
eval_string (fcn_text,
true, parse_status);
2477 if (parse_status != 0)
2523 const std::string&
name)
2528 const std::string& meth_nm)
2530 m_rep (new
octave::class_simple_fcn_handle (class_nm, meth_nm))
2534 const std::string& class_nm,
2535 const std::string& meth_nm)
2537 m_rep (new
octave::class_simple_fcn_handle (fcn, class_nm, meth_nm))
2542 const std::string& class_nm,
2543 const std::string& meth_nm)
2545 m_rep (new
octave::class_simple_fcn_handle (obj, fcn, class_nm, meth_nm))
2549 const std::string&
name,
2550 const std::list<std::string>& parentage)
2552 m_rep (new
octave::scoped_fcn_handle (fcn,
name, parentage))
2556 const std::string&
name,
2557 const std::shared_ptr<octave::stack_frame>& closure_frames)
2559 m_rep (new
octave::nested_fcn_handle (fcn,
name, closure_frames))
2565 m_rep (new
octave::anonymous_fcn_handle (fcn, local_vars))
2588 return m_rep->save_ascii (os);
2594 std::shared_ptr<octave::base_fcn_handle> new_rep;
2599 std::streampos pos = is.tellg ();
2602 if (octaveroot.empty ())
2617 if (! (octaveroot.empty () || fpath.empty ()))
2619 size_t len = octaveroot.size ();
2620 if (octaveroot == fpath.substr (0,
len))
2627 if (subtype.empty ())
2647 if (subtype ==
"simple")
2654 else if (subtype ==
"scopedfunction")
2661 else if (subtype ==
"anonymous")
2663 else if (subtype ==
"nested")
2670 else if (subtype ==
"classsimple")
2682 if (! new_rep->load_ascii (is))
2693 return m_rep->save_binary (os, save_as_floats);
2704 if (! is.read (
reinterpret_cast<char *
> (&tmp), 4))
2712 is.read (ctmp1, tmp);
2714 std::string
name (ctmp1);
2719 std::shared_ptr<octave::base_fcn_handle> new_rep;
2738 std::string octaveroot;
2740 std::string subtype =
"simple";
2742 if (
name.find_first_of (
'\n') != std::string::npos)
2744 size_t pos1 =
name.find_first_of (
'\n');
2745 size_t pos2 =
name.find_first_of (
'\n', pos1 + 1);
2746 octaveroot =
name.substr (pos1 + 1, pos2 - pos1 - 1);
2747 fpath =
name.substr (pos2 + 1);
2751 size_t pos1 =
name.find (
'@');
2752 if (pos1 != std::string::npos)
2754 if (
name[pos1+1] ==
'<')
2756 size_t pos2 =
name.find (
'>', pos1 + 2);
2758 if (pos2 != std::string::npos)
2759 subtype =
name.substr (pos1 + 2, pos2 - pos1 - 2);
2768 if (subtype ==
"simple")
2770 else if (subtype ==
"scopedfunction")
2772 else if (subtype ==
"nested")
2774 else if (subtype ==
"classsimple")
2781 if (! new_rep->load_binary (is, swap, fmt))
2791 bool save_as_floats)
2793 return m_rep->save_hdf5 (loc_id,
name, save_as_floats);
2799 #if defined (HAVE_HDF5)
2801 #if defined (HAVE_HDF5_18)
2809 #if defined (HAVE_HDF5_18)
2817 H5Gclose (group_hid);
2824 if (type_class_hid != H5T_STRING)
2826 H5Tclose (type_hid);
2827 H5Dclose (data_hid);
2828 H5Gclose (group_hid);
2833 hsize_t rank = H5Sget_simple_extent_ndims (space_hid);
2837 H5Sclose (space_hid);
2838 H5Tclose (type_hid);
2839 H5Dclose (data_hid);
2840 H5Gclose (group_hid);
2844 int slen = H5Tget_size (type_hid);
2847 H5Sclose (space_hid);
2848 H5Tclose (type_hid);
2849 H5Dclose (data_hid);
2850 H5Gclose (group_hid);
2858 H5Tset_size (st_id, slen);
2865 H5Sclose (space_hid);
2866 H5Tclose (type_hid);
2867 H5Dclose (data_hid);
2868 H5Gclose (group_hid);
2872 H5Dclose (data_hid);
2874 std::string
name (nm_tmp);
2876 std::shared_ptr<octave::base_fcn_handle> new_rep;
2891 std::string octaveroot;
2893 std::string subtype =
"simple";
2895 if (
name.find_first_of (
'\n') != std::string::npos)
2897 size_t pos1 =
name.find_first_of (
'\n');
2898 size_t pos2 =
name.find_first_of (
'\n', pos1 + 1);
2899 octaveroot =
name.substr (pos1 + 1, pos2 - pos1 - 1);
2900 fpath =
name.substr (pos2 + 1);
2904 size_t pos1 =
name.find (
'@');
2905 if (pos1 != std::string::npos)
2907 if (
name[pos1+1] ==
'<')
2909 size_t pos2 =
name.find (
'>', pos1 + 2);
2911 if (pos2 != std::string::npos)
2912 subtype =
name.substr (pos1 + 2, pos2 - pos1 - 2);
2921 if (subtype ==
"simple")
2923 else if (subtype ==
"scopedfunction")
2925 else if (subtype ==
"nested")
2927 else if (subtype ==
"classsimple")
2931 bool status =
false;
2933 if (new_rep && new_rep->load_hdf5 (group_hid, space_hid, type_hid))
2941 H5Tclose (type_hid);
2942 H5Sclose (space_hid);
2943 H5Gclose (group_hid);
2949 octave_unused_parameter (loc_id);
2950 octave_unused_parameter (name_arg);
3106 DEFUN (functions, args, ,
3157 if (args.length () != 1)
3160 octave_fcn_handle *fh = args(0).xfcn_handle_value (
"functions: FCN_HANDLE argument must be a function handle object");
3165 DEFUN (func2str, args, ,
3173 if (args.length () != 1)
3176 octave_fcn_handle *fh = args(0).xfcn_handle_value (
"func2str: FCN_HANDLE argument must be a function handle object");
3179 error (
"func2str: FCN_HANDLE must be a valid function handle");
3183 std::string fh_nm = fh->
fcn_name ();
3187 std::ostringstream buf;
3210 int nargin = args.length ();
3212 if (nargin < 1 || nargin > 2)
3216 = args(0).xstring_value (
"str2func: FCN_NAME must be a string");
3219 error (
"str2func: invalid function name");
3236 octave_value afh = interp.eval_string (nm,
true, parse_status);
3238 if (parse_status == 0)
3245 "str2func: second argument ignored");
3287 DEFUN (is_function_handle, args, ,
3294 if (args.length () != 1)
3297 return ovl (args(0).is_function_handle ());
void swap_bytes< 4 >(void *ptr)
octave_idx_type numel(void) const
Number of elements in the array.
Vector representing the dimensions (size) of an Array.
void add_method(T *obj, void(T::*method)(Params...), Args &&... args)
octave_value_list call(int nargout, const octave_value_list &args)
bool save_binary(std::ostream &os, bool save_as_floats)
void print_raw(std::ostream &, bool pr_as_read_syntax, int current_print_indent_level) const
octave_value fcn_val(void)
octave_user_function * user_function_value(bool=false)
bool save_ascii(std::ostream &os)
bool save_hdf5(octave_hdf5_id loc_id, const char *name, bool save_as_floats)
bool print_as_scalar(void) const
octave_function * function_value(bool=false)
static const std::string anonymous
anonymous_fcn_handle(const std::string &name="")
bool is_anonymous(void) const
std::string type(void) const
anonymous_fcn_handle * clone(void) const
bool parse(const std::string &fcn_text)
friend bool is_equal_to(const anonymous_fcn_handle &fh1, const anonymous_fcn_handle &fh2)
anonymous_fcn_handle(const anonymous_fcn_handle &)=default
octave_scalar_map info(void)
bool load_binary(std::istream &is, bool swap, mach_info::float_format fmt)
bool load_hdf5(octave_hdf5_id &group_hid, octave_hdf5_id &space_hid, octave_hdf5_id &type_hid)
stack_frame::local_vars_map m_local_vars
octave_value workspace(void) const
~anonymous_fcn_handle(void)=default
bool load_ascii(std::istream &is)
octave_value convert_to_str_internal(bool pad, bool force, char type) const
void warn_save(const char *file_type) const
octave_value_list subsref(const std::string &type, const std::list< octave_value_list > &idx, int nargout)
virtual octave_value_list call(int nargout, const octave_value_list &args)=0
std::string fcn_name(void) const
virtual bool save_binary(std::ostream &os, bool save_as_floats)
base_fcn_handle(const std::string &name="", const std::string &file="")
std::string file(void) const
virtual bool load_hdf5(octave_hdf5_id &group_hid, octave_hdf5_id &space_hid, octave_hdf5_id &type_hid)
virtual void print_raw(std::ostream &, bool, int) const
virtual std::string type(void) const =0
virtual bool save_hdf5(octave_hdf5_id loc_id, const char *name, bool save_as_floats)
virtual bool load_binary(std::istream &is, bool swap, mach_info::float_format fmt)
void unimplemented(const char *op, const char *fmt) const
virtual bool load_ascii(std::istream &is)
void warn_load(const char *file_type) const
virtual bool save_ascii(std::ostream &os)
size_t length(void) const
class_simple_fcn_handle(const std::string &name, const std::string &file, const std::string &)
std::string type(void) const
octave_value fcn_val(void)
bool save_binary(std::ostream &os, bool save_as_floats)
std::string dispatch_class(void) const
bool save_hdf5(octave_hdf5_id loc_id, const char *name, bool save_as_floats)
friend bool is_equal_to(const class_simple_fcn_handle &fh1, const class_simple_fcn_handle &fh2)
octave_scalar_map info(void)
bool load_binary(std::istream &is, bool swap, mach_info::float_format fmt)
octave_function * function_value(bool=false)
octave_user_function * user_function_value(bool=false)
void print_raw(std::ostream &, bool pr_as_read_syntax, int current_print_indent_level) const
bool save_ascii(std::ostream &os)
std::string m_dispatch_class
bool is_class_simple(void) const
class_simple_fcn_handle * clone(void) const
octave_value_list call(int nargout, const octave_value_list &args)
class_simple_fcn_handle(const class_simple_fcn_handle &)=default
bool load_hdf5(octave_hdf5_id &group_hid, octave_hdf5_id &space_hid, octave_hdf5_id &type_hid)
bool load_ascii(std::istream &is)
~class_simple_fcn_handle(void)=default
octave_scalar_map info(void)
std::string type(void) const
internal_fcn_handle * clone(void) const
octave_function * function_value(bool=false)
octave_user_function * user_function_value(bool=false)
internal_fcn_handle(const internal_fcn_handle &)=default
~internal_fcn_handle(void)=default
octave_value fcn_val(void)
octave_value_list call(int nargout, const octave_value_list &args)
friend bool is_equal_to(const internal_fcn_handle &fh1, const internal_fcn_handle &fh2)
bool is_internal(void) const
internal_fcn_handle(const octave_value &fcn)
octave_value_list feval(const char *name, const octave_value_list &args=octave_value_list(), int nargout=0)
Evaluate an Octave function (built-in or interpreted) and return the list of result values.
octave_value varval(const std::string &name) const
octave_value_list eval_string(const std::string &eval_str, bool silent, int &parse_status, int nargout)
symbol_table & get_symbol_table(void)
tree_evaluator & get_evaluator(void)
~invalid_fcn_handle(void)=default
octave_value_list call(int nargout, const octave_value_list &args)
std::string type(void) const
invalid_fcn_handle * clone(void) const
invalid_fcn_handle(const invalid_fcn_handle &)=default
friend bool is_equal_to(const nested_fcn_handle &fh1, const nested_fcn_handle &fh2)
~nested_fcn_handle(void)=default
nested_fcn_handle(const std::string &name="", const std::string &file="", const std::string &="")
bool is_nested(void) const
octave_value fcn_val(void)
nested_fcn_handle(const nested_fcn_handle &)=default
nested_fcn_handle * clone(void) const
octave_value_list call(int nargout, const octave_value_list &args)
std::string type(void) const
bool load_binary(std::istream &is, bool swap, mach_info::float_format fmt)
bool load_ascii(std::istream &is)
bool save_ascii(std::ostream &os)
octave_value workspace(void) const
void print_raw(std::ostream &, bool pr_as_read_syntax, int current_print_indent_level) const
bool save_binary(std::ostream &os, bool save_as_floats)
bool save_hdf5(octave_hdf5_id loc_id, const char *name, bool save_as_floats)
octave_function * function_value(bool=false)
octave_scalar_map info(void)
bool load_hdf5(octave_hdf5_id &group_hid, octave_hdf5_id &space_hid, octave_hdf5_id &type_hid)
octave_user_function * user_function_value(bool=false)
std::shared_ptr< stack_frame > m_closure_frames
octave_user_function * user_function_value(bool=false)
octave_function * function_value(bool=false)
friend bool is_equal_to(const scoped_fcn_handle &fh1, const scoped_fcn_handle &fh2)
bool save_ascii(std::ostream &os)
~scoped_fcn_handle(void)=default
std::string type(void) const
bool load_ascii(std::istream &is)
bool is_scoped(void) const
bool load_hdf5(octave_hdf5_id &group_hid, octave_hdf5_id &space_hid, octave_hdf5_id &type_hid)
bool save_hdf5(octave_hdf5_id loc_id, const char *name, bool save_as_floats)
scoped_fcn_handle(const std::string &name="", const std::string &file="", const std::string &="")
scoped_fcn_handle(const scoped_fcn_handle &)=default
octave_scalar_map info(void)
std::list< std::string > m_parentage
octave_value_list call(int nargout, const octave_value_list &args)
void print_raw(std::ostream &, bool pr_as_read_syntax, int current_print_indent_level) const
octave_value fcn_val(void)
bool load_binary(std::istream &is, bool swap, mach_info::float_format fmt)
scoped_fcn_handle * clone(void) const
bool save_binary(std::ostream &os, bool save_as_floats)
friend bool is_equal_to(const simple_fcn_handle &fh1, const simple_fcn_handle &fh2)
void print_raw(std::ostream &os, bool pr_as_read_syntax, int current_print_indent_level) const
simple_fcn_handle * clone(void) const
octave_scalar_map info(void)
simple_fcn_handle(const simple_fcn_handle &)=default
bool is_simple(void) const
simple_fcn_handle(const octave_value &fcn, const std::string &name)
bool save_ascii(std::ostream &os)
bool load_hdf5(octave_hdf5_id &group_hid, octave_hdf5_id &space_hid, octave_hdf5_id &type_hid)
std::string type(void) const
simple_fcn_handle(const std::string &name="", const std::string &file="", const std::string &="")
octave_value_list call(int nargout, const octave_value_list &args)
bool save_binary(std::ostream &os, bool save_as_floats)
octave_function * function_value(bool)
octave_user_function * user_function_value(bool)
bool save_hdf5(octave_hdf5_id loc_hid, const char *name, bool save_as_floats)
octave_value fcn_val(void)
bool load_ascii(std::istream &is)
bool load_binary(std::istream &is, bool swap, mach_info::float_format fmt)
~simple_fcn_handle(void)=default
std::map< std::string, octave_value > local_vars_map
void cache_name(const std::string &name)
octave_value find_user_function(const std::string &name)
octave_value find_function(const std::string &name, const symbol_scope &search_scope=symbol_scope())
octave_value find_private_function(const std::string &dir_name, const std::string &name)
octave_value make_fcn_handle(const std::string &nm)
void pop_stack_frame(void)
void set_dispatch_class(const std::string &class_name)
void push_dummy_scope(const std::string &name)
void push_stack_frame(const symbol_scope &scope)
void accept(tree_walker &tw)
void print_fcn_handle_body(tree_expression *)
bool is_expression(void) const
tree_expression * expression(void)
int current_print_indent_level(void) const
void newline(std::ostream &os) const
void warn_load(const char *type) const
bool load_ascii(std::istream &is)
Array< std::string > cellstr_value(void) const
bool load_binary(std::istream &is, bool swap, octave::mach_info::float_format fmt)
bool iscellstr(void) const
static const std::string anonymous
std::string fcn_name(void) const
void print_raw(std::ostream &os, bool pr_as_read_syntax=false) const
octave_scalar_map info(void)
bool is_simple(void) const
std::shared_ptr< octave::base_fcn_handle > m_rep
bool load_hdf5(octave_hdf5_id loc_id, const char *name)
bool is_internal(void) const
bool load_ascii(std::istream &is)
bool is_class_simple(void) const
octave::base_fcn_handle * get_rep(void) const
octave_value fcn_val(void)
bool is_anonymous(void) const
dim_vector dims(void) const
bool is_scoped(void) const
bool save_binary(std::ostream &os, bool save_as_floats)
bool save_ascii(std::ostream &os)
bool save_hdf5(octave_hdf5_id loc_id, const char *name, bool save_as_floats)
bool is_nested(void) const
bool load_binary(std::istream &is, bool swap, octave::mach_info::float_format fmt)
void print(std::ostream &os, bool pr_as_read_syntax=false)
std::string dispatch_class(void) const
virtual std::string fcn_file_name(void) const
bool is_class_method(const std::string &cname="") const
void assign(const std::string &k, const octave_value &val)
std::string fcn_file_name(void) const
octave::symbol_scope scope(void)
octave_value_list execute(octave::tree_evaluator &tw, int nargout=0, const octave_value_list &args=octave_value_list())
octave_value find_subfunction(const std::string &subfuns) const
octave_idx_type length(void) const
octave_value_list & prepend(const octave_value &val)
bool is_function(void) const
bool is_classdef_object(void) const
bool is_package(void) const
octave_value subsref(const std::string &type, const std::list< octave_value_list > &idx)
octave_user_function * user_function_value(bool silent=false) const
bool is_cs_list(void) const
bool is_copy_of(const octave_value &val) const
bool save_binary(std::ostream &os, bool save_as_floats)
bool is_defined(void) const
bool save_ascii(std::ostream &os)
bool is_classdef_meta(void) const
octave_function * function_value(bool silent=false) const
octave_fcn_handle * fcn_handle_value(bool silent=false) const
bool is_undefined(void) const
const octave_hdf5_id octave_H5P_DEFAULT
const octave_hdf5_id octave_H5E_DEFAULT
const octave_hdf5_id octave_H5S_ALL
OCTINTERP_API void print_usage(void)
#define DEFMETHOD(name, interp_name, args_name, nargout_name, doc)
Macro to define a builtin method.
#define DEFUN(name, args_name, nargout_name, doc)
Macro to define a builtin function.
void warning(const char *fmt,...)
void warning_with_id(const char *id, const char *fmt,...)
void error(const char *fmt,...)
#define panic_impossible()
std::string read_until_newline(std::istream &is, bool keep_newline)
void skip_preceeding_newline(std::istream &is)
octave_hdf5_err hdf5_h5g_iterate(octave_hdf5_id loc_id, const char *name, int *idx, void *operator_data)
bool add_hdf5_data(octave_hdf5_id loc_id, const octave_value &tc, const std::string &name, const std::string &doc, bool mark_global, bool save_as_floats)
std::string read_binary_data(std::istream &is, bool swap, octave::mach_info::float_format fmt, const std::string &filename, bool &global, octave_value &tc, std::string &doc)
bool save_binary_data(std::ostream &os, const octave_value &tc, const std::string &name, const std::string &doc, bool mark_global, bool save_as_floats)
std::string read_text_data(std::istream &is, const std::string &filename, bool &global, octave_value &tc, octave_idx_type count, const bool do_name_validation)
std::string extract_keyword(std::istream &is, const char *keyword, const bool next_only)
bool save_text_data(std::ostream &os, const octave_value &val_arg, const std::string &name, bool mark_global, int precision)
std::string octave_exec_home(void)
std::string dirname(const std::string &path)
std::string dir_sep_chars(void)
static double f(double k, double l_nu, double c_pm)
interpreter & __get_interpreter__(const std::string &who)
static void err_invalid_fcn_handle(const std::string &name)
tree_evaluator & __get_evaluator__(const std::string &who)
symbol_table & __get_symbol_table__(const std::string &who)
bool is_equal_to(const anonymous_fcn_handle &fh1, const anonymous_fcn_handle &fh2)
static octave_value make_fcn_handle(const octave_value &fcn, const std::string &meth_name, const std::string &class_name)
#define OCTAVE_LOCAL_BUFFER(T, buf, size)
return octave_value(v1.char_array_value() . concat(v2.char_array_value(), ra_idx),((a1.is_sq_string()||a2.is_sq_string()) ? '\'' :'"'))
#define DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA(t, n, c)
bool is_equal_to(const octave_fcn_handle &fh1, const octave_fcn_handle &fh2)
octave_value::octave_value(const Array< char > &chm, char type) return retval
octave_value_list ovl(const OV_Args &... args)
Construct an octave_value_list with less typing.
void octave_print_internal(std::ostream &os, const float_display_format &fmt, bool d, bool pr_as_read_syntax)