26 #if defined (HAVE_CONFIG_H)
65 if (! is.read (
reinterpret_cast<char *
> (&nargs), 4))
76 for (
int i = 0; i < nargs; i++)
78 if (! is.read (
reinterpret_cast<char *
> (&tmp), 4))
85 args(i+1) = std::string (ctmp);
91 if (! is.read (
reinterpret_cast<char *
> (&tmp), 4))
104 if (! is.read (
reinterpret_cast<char *
> (&tmp), 4))
110 is.read (ctmp2, tmp);
114 args(0) = std::string (ctmp2);
120 if (tmp_inl.
length () > 0)
198 const std::string& filename,
bool& global,
203 unsigned char tmp = 0;
205 int32_t name_len = 0;
213 is.read (
reinterpret_cast<char *
> (&name_len), 4);
221 name[name_len] =
'\0';
222 if (! is.read (
reinterpret_cast<char *
> (name), name_len))
223 error (
"load: trouble reading binary file '%s'", filename.c_str ());
227 is.read (
reinterpret_cast<char *
> (&doc_len), 4);
229 error (
"load: trouble reading binary file '%s'", filename.c_str ());
235 tdoc[doc_len] =
'\0';
236 if (! is.read (
reinterpret_cast<char *
> (tdoc), doc_len))
237 error (
"load: trouble reading binary file '%s'", filename.c_str ());
241 if (! is.read (
reinterpret_cast<char *
> (&tmp), 1))
242 error (
"load: trouble reading binary file '%s'", filename.c_str ());
243 global = (tmp ? 1 : 0);
246 if (! is.read (
reinterpret_cast<char *
> (&tmp), 1))
247 error (
"load: trouble reading binary file '%s'", filename.c_str ());
276 if (! is.read (
reinterpret_cast<char *
> (&
len), 4))
277 error (
"load: trouble reading binary file '%s'", filename.c_str ());
281 if (! is.read (
reinterpret_cast<char *
> (s),
len))
282 error (
"load: trouble reading binary file '%s'", filename.c_str ());
303 if (! is.read (
reinterpret_cast<char *
> (&
len), 4))
304 error (
"load: trouble reading binary file '%s'", filename.c_str ());
308 if (! is.read (s,
len))
309 error (
"load: trouble reading binary file '%s'", filename.c_str ());
313 if (typ ==
"inline function")
316 if (! load_inline_fcn (is, swap, fmt, tc))
317 error (
"load: trouble reading binary file '%s'", filename.c_str ());
325 error (
"load: trouble reading binary file '%s'", filename.c_str ());
330 error (
"load: trouble reading binary file '%s'", filename.c_str ());
341 const std::string& name,
const std::string& doc,
342 bool mark_global,
bool save_as_floats)
344 int32_t name_len = name.length ();
346 os.write (
reinterpret_cast<char *
> (&name_len), 4);
349 int32_t doc_len = doc.length ();
351 os.write (
reinterpret_cast<char *
> (&doc_len), 4);
357 os.write (
reinterpret_cast<char *
> (&tmp), 1);
361 os.write (
reinterpret_cast<char *
> (&tmp), 1);
365 int32_t
len = typ.length ();
366 os.write (
reinterpret_cast<char *
> (&
len), 4);
367 const char *btmp = typ.data ();
368 os.write (btmp,
len);
374 bool success = val.
save_binary (os, save_as_floats);
376 return (os && success);
void swap_bytes< 4 >(void *ptr)
octave_idx_type length() const
bool load_binary(std::istream &is, bool swap, octave::mach_info::float_format fmt)
bool save_binary(std::ostream &os, bool save_as_floats)
std::string type_name() const
octave_value lookup_type(const std::string &nm)
void() error(const char *fmt,...)
interpreter & __get_interpreter__()
type_info & __get_type_info__()
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)
#define OCTAVE_LOCAL_BUFFER(T, buf, size)