GNU Octave
4.0.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
|
#include <cfloat>
#include <cstring>
#include <cctype>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <sstream>
#include <string>
#include "strftime.h"
#include "byte-swap.h"
#include "data-conv.h"
#include "file-ops.h"
#include "file-stat.h"
#include "glob-match.h"
#include "lo-mappers.h"
#include "mach-info.h"
#include "oct-env.h"
#include "oct-time.h"
#include "quit.h"
#include "str-vec.h"
#include "oct-locbuf.h"
#include "Cell.h"
#include "defun.h"
#include "error.h"
#include "gripes.h"
#include "load-path.h"
#include "load-save.h"
#include "oct-obj.h"
#include "oct-map.h"
#include "ov-cell.h"
#include "pager.h"
#include "pt-exp.h"
#include "symtab.h"
#include "sysdep.h"
#include "unwind-prot.h"
#include "utils.h"
#include "variables.h"
#include "version.h"
#include "dMatrix.h"
#include "ls-hdf5.h"
#include "ls-mat-ascii.h"
#include "ls-mat4.h"
#include "ls-mat5.h"
#include "ls-oct-ascii.h"
#include "ls-oct-binary.h"
#include "zfstream.h"
Go to the source code of this file.
Functions | |
static bool | check_gzip_magic (const std::string &fname) |
static std::string | default_save_header_format (void) |
octave_value | do_load (std::istream &stream, const std::string &orig_fname, load_save_format format, oct_mach_info::float_format flt_fmt, bool list_only, bool swap, bool verbose, const string_vector &argv, int argv_idx, int argc, int nargout) |
static void | do_save (std::ostream &os, const octave_value &tc, const std::string &name, const std::string &help, bool global, load_save_format fmt, bool save_as_floats) |
void | do_save (std::ostream &os, const symbol_table::symbol_record &sr, load_save_format fmt, bool save_as_floats) |
static void | dump_octave_core (std::ostream &os, const char *fname, load_save_format fmt, bool save_as_floats) |
void | dump_octave_core (void) |
OCTAVE_EXPORT octave_value_list | Fcrash_dumps_octave_core (const octave_value_list &args, int nargout) |
std::string | find_file_to_load (const std::string &name, const std::string &orig_name) |
OCTAVE_EXPORT octave_value_list | Fload (const octave_value_list &args, int nargout) |
OCTAVE_EXPORT octave_value_list | Foctave_core_file_limit (const octave_value_list &args, int nargout) |
OCTAVE_EXPORT octave_value_list | Foctave_core_file_name (const octave_value_list &args, int nargout) |
OCTAVE_EXPORT octave_value_list | Foctave_core_file_options (const octave_value_list &args, int nargout) |
OCTAVE_EXPORT octave_value_list | Fsave (const octave_value_list &args, int nargout) |
OCTAVE_EXPORT octave_value_list | Fsave_default_options (const octave_value_list &args, int nargout) |
OCTAVE_EXPORT octave_value_list | Fsave_header_format_string (const octave_value_list &args, int nargout)%a%b%d%H |
static load_save_format | get_file_format (std::istream &file, const std::string &filename) |
static load_save_format | get_file_format (const std::string &fname, const std::string &orig_fname, bool &use_zlib, bool quiet=false) |
static bool | glob_pattern_p (const std::string &pattern) |
static void | gripe_file_open (const std::string &fcn, const std::string &file) |
static void | install_loaded_variable (const std::string &name, const octave_value &val, bool global, const std::string &) |
bool | is_octave_data_file (const std::string &fname) |
static bool | matches_patterns (const string_vector &patterns, int pat_idx, int num_pat, const std::string &name) |
void | octave_finalize_hdf5 (void) |
void | octave_prepare_hdf5 (void) |
static string_vector | parse_save_options (const string_vector &argv, load_save_format &format, bool &append, bool &save_as_floats, bool &use_zlib) |
static string_vector | parse_save_options (const std::string &arg, load_save_format &format, bool &append, bool &save_as_floats, bool &use_zlib) |
int | read_binary_file_header (std::istream &is, bool &swap, oct_mach_info::float_format &flt_fmt, bool quiet) |
static size_t | save_fields (std::ostream &os, const octave_scalar_map &m, const std::string &pattern, load_save_format fmt, bool save_as_floats) |
static size_t | save_vars (std::ostream &os, const std::string &pattern, load_save_format fmt, bool save_as_floats) |
static void | save_vars (const string_vector &argv, int argv_idx, int argc, std::ostream &os, load_save_format fmt, bool save_as_floats, bool write_header_info) |
void | write_header (std::ostream &os, load_save_format format) |
Variables | |
static bool | Vcrash_dumps_octave_core = true |
static double | Voctave_core_file_limit = -1.0 |
static std::string | Voctave_core_file_name = "octave-workspace" |
static std::string | Voctave_core_file_options = "-binary" |
static std::string | Vsave_default_options = "-text" |
static std::string | Vsave_header_format_string = default_save_header_format () |
|
static |
Definition at line 212 of file load-save.cc.
References OCTAVE_LOCAL_BUFFER.
Referenced by get_file_format().
|
static |
Definition at line 112 of file load-save.cc.
References octave_env::get_host_name(), octave_env::get_user_name(), and OCTAVE_VERSION.
octave_value do_load | ( | std::istream & | stream, |
const std::string & | orig_fname, | ||
load_save_format | format, | ||
oct_mach_info::float_format | flt_fmt, | ||
bool | list_only, | ||
bool | swap, | ||
bool | verbose, | ||
const string_vector & | argv, | ||
int | argv_idx, | ||
int | argc, | ||
int | nargout | ||
) |
Definition at line 341 of file load-save.cc.
References octave_scalar_map::assign(), octave_value::columns(), error(), error_state, gripe_unrecognized_data_fmt(), install_loaded_variable(), octave_value::is_defined(), left, string_vector::list_in_columns(), LS_ASCII, LS_BINARY, LS_HDF5, LS_MAT5_BINARY, LS_MAT7_BINARY, LS_MAT_ASCII, LS_MAT_BINARY, matches_patterns(), names(), octave_scalar_map::nfields(), octave_stdout, read_ascii_data(), read_binary_data(), read_hdf5_data(), read_mat5_binary_element(), read_mat_ascii_data(), read_mat_binary_data(), octave_value::rows(), load_save_format::type, octave_value::type_name(), and warning().
Referenced by Fload().
|
static |
Definition at line 932 of file load-save.cc.
References gripe_unrecognized_data_fmt(), LS_ASCII, LS_BINARY, LS_HDF5, LS_MAT5_BINARY, LS_MAT7_BINARY, LS_MAT_ASCII, LS_MAT_ASCII_LONG, LS_MAT_ASCII_TABS, LS_MAT_BINARY, load_save_format::opts, save_ascii_data(), save_binary_data(), save_hdf5_data(), save_mat5_binary_element(), save_mat_ascii_data(), save_mat_binary_data(), load_save_format::type, and warning().
Referenced by do_save(), dump_octave_core(), save_fields(), and save_vars().
void do_save | ( | std::ostream & | os, |
const symbol_table::symbol_record & | sr, | ||
load_save_format | fmt, | ||
bool | save_as_floats | ||
) |
Definition at line 979 of file load-save.cc.
References do_save(), octave_value::is_defined(), symbol_table::symbol_record::is_global(), symbol_table::symbol_record::name(), and symbol_table::symbol_record::varval().
|
static |
Definition at line 1348 of file load-save.cc.
References symbol_table::all_variables(), octave_value::byte_size(), do_save(), error_state, octave_value::is_defined(), message(), symbol_table::top_scope(), vars, and write_header().
Referenced by dump_octave_core(), and my_friendly_exit().
void dump_octave_core | ( | void | ) |
Definition at line 1392 of file load-save.cc.
References hdf5_fstreambase::close(), gzofstream::close(), dump_octave_core(), hdf5_fstreambase::file_id, LS_BINARY, LS_HDF5, LS_MAT5_BINARY, LS_MAT7_BINARY, LS_MAT_BINARY, message(), parse_save_options(), Vcrash_dumps_octave_core, Voctave_core_file_name, Voctave_core_file_options, and warning().
OCTAVE_EXPORT octave_value_list Fcrash_dumps_octave_core | ( | const octave_value_list & | args, |
int | nargout | ||
) |
Definition at line 1802 of file load-save.cc.
References SET_INTERNAL_VARIABLE.
Referenced by maximum_braindamage().
std::string find_file_to_load | ( | const std::string & | name, |
const std::string & | orig_name | ||
) |
Definition at line 499 of file load-save.cc.
References file_ops::dir_sep_chars(), error(), base_file_stat::exists(), find_data_file_in_load_path(), and base_file_stat::is_reg().
Referenced by Fload().
OCTAVE_EXPORT octave_value_list Fload | ( | const octave_value_list & | args, |
int | nargout | ||
) |
Definition at line 636 of file load-save.cc.
References gzifstream::close(), do_load(), error(), error_state, find_file_to_load(), oct_mach_info::flt_fmt_unknown, get_file_format(), gripe_file_open(), octave_value_list::length(), LS_ASCII, LS_BINARY, LS_HDF5, LS_MAT5_BINARY, LS_MAT7_BINARY, LS_MAT_ASCII, LS_MAT_BINARY, LS_UNKNOWN, print_usage(), read_binary_file_header(), read_mat5_binary_file_header(), file_ops::tilde_expand(), and warning().
Referenced by main_window::load_workspace_callback().
OCTAVE_EXPORT octave_value_list Foctave_core_file_limit | ( | const octave_value_list & | args, |
int | nargout | ||
) |
Definition at line 1846 of file load-save.cc.
References SET_INTERNAL_VARIABLE.
OCTAVE_EXPORT octave_value_list Foctave_core_file_name | ( | const octave_value_list & | args, |
int | nargout | ||
) |
Definition at line 1865 of file load-save.cc.
References SET_NONEMPTY_INTERNAL_STRING_VARIABLE.
OCTAVE_EXPORT octave_value_list Foctave_core_file_options | ( | const octave_value_list & | args, |
int | nargout | ||
) |
Definition at line 1886 of file load-save.cc.
References SET_NONEMPTY_INTERNAL_STRING_VARIABLE.
OCTAVE_EXPORT octave_value_list Fsave | ( | const octave_value_list & | args, |
int | nargout | ||
) |
Definition at line 1610 of file load-save.cc.
References error(), error_state, glob_pattern_p(), gripe_file_open(), Array< T >::length(), LS_ASCII, LS_BINARY, LS_HDF5, LS_MAT5_BINARY, LS_MAT7_BINARY, LS_MAT_BINARY, octave_value(), parse_save_options(), print_usage(), save_vars(), file_ops::tilde_expand(), Vsave_default_options, and warning().
Referenced by main_window::save_workspace_callback().
OCTAVE_EXPORT octave_value_list Fsave_default_options | ( | const octave_value_list & | args, |
int | nargout | ||
) |
Definition at line 1822 of file load-save.cc.
References SET_NONEMPTY_INTERNAL_STRING_VARIABLE.
Referenced by maximum_braindamage().
OCTAVE_EXPORT octave_value_list Fsave_header_format_string | ( | const octave_value_list & | args, |
int | nargout | ||
) |
Definition at line 1914 of file load-save.cc.
References SET_INTERNAL_VARIABLE.
|
static |
Definition at line 228 of file load-save.cc.
References extract_keyword(), oct_mach_info::flt_fmt_unknown, imag(), looks_like_mat_ascii_file(), LS_ASCII, LS_BINARY, LS_MAT5_BINARY, LS_MAT_ASCII, LS_MAT_BINARY, LS_UNKNOWN, read_binary_file_header(), read_mat5_binary_file_header(), and read_mat_file_header().
Referenced by Fload(), get_file_format(), and is_octave_data_file().
|
static |
Definition at line 295 of file load-save.cc.
References check_gzip_magic(), get_file_format(), gripe_file_open(), LS_HDF5, and LS_UNKNOWN.
|
static |
Definition at line 894 of file load-save.cc.
Referenced by Fsave().
|
static |
Definition at line 129 of file load-save.cc.
References error().
Referenced by Fload(), Fsave(), and get_file_format().
|
static |
Definition at line 143 of file load-save.cc.
References symbol_table::assign(), symbol_table::clear(), symbol_table::global_assign(), and symbol_table::mark_global().
Referenced by do_load().
bool is_octave_data_file | ( | const std::string & | fname | ) |
Definition at line 533 of file load-save.cc.
References get_file_format(), and LS_UNKNOWN.
Referenced by files_dock_widget::display_directory().
|
static |
Definition at line 160 of file load-save.cc.
References glob_match::match().
Referenced by do_load().
void octave_finalize_hdf5 | ( | void | ) |
Definition at line 1273 of file load-save.cc.
Referenced by do_octave_atexit().
void octave_prepare_hdf5 | ( | void | ) |
Definition at line 1265 of file load-save.cc.
Referenced by octave_execute_interpreter().
|
static |
Definition at line 1050 of file load-save.cc.
References string_vector::append(), error(), Array< T >::length(), LS_ASCII, LS_BINARY, LS_HDF5, LS_MAT5_BINARY, LS_MAT7_BINARY, LS_MAT_ASCII, LS_MAT_ASCII_LONG, LS_MAT_ASCII_TABS, LS_MAT_BINARY, load_save_format::opts, and warning().
Referenced by dump_octave_core(), Fsave(), and parse_save_options().
|
static |
Definition at line 1164 of file load-save.cc.
References string_vector::append(), and parse_save_options().
int read_binary_file_header | ( | std::istream & | is, |
bool & | swap, | ||
oct_mach_info::float_format & | flt_fmt, | ||
bool | quiet | ||
) |
Definition at line 175 of file load-save.cc.
References error(), oct_mach_info::flt_fmt_unknown, mopt_digit_to_float_format(), and oct_mach_info::words_big_endian().
Referenced by Fload(), and get_file_format().
|
static |
Definition at line 998 of file load-save.cc.
References octave_scalar_map::begin(), octave_scalar_map::contents(), do_save(), octave_scalar_map::end(), octave_scalar_map::key(), and glob_match::match().
Referenced by save_vars().
|
static |
Definition at line 1026 of file load-save.cc.
References do_save(), error_state, symbol_table::glob(), and vars.
Referenced by Fsave(), my_friendly_exit(), and save_vars().
|
static |
Definition at line 1281 of file load-save.cc.
References error(), octave_value::is_map(), symbol_table::is_variable(), octave_value::numel(), save_fields(), save_vars(), octave_value::scalar_map_value(), symbol_table::varval(), warning(), and write_header().
void write_header | ( | std::ostream & | os, |
load_save_format | format | ||
) |
Definition at line 1183 of file load-save.cc.
References hdf5_fstreambase::file_id, float_format_to_mopt_digit(), LS_ASCII, LS_BINARY, LS_HDF5, LS_MAT5_BINARY, LS_MAT7_BINARY, oct_mach_info::native_float_format(), OCTAVE_VERSION, octave_base_tm::strftime(), load_save_format::type, Vsave_header_format_string, and oct_mach_info::words_big_endian().
Referenced by dump_octave_core(), and save_vars().
|
static |
Definition at line 95 of file load-save.cc.
Referenced by dump_octave_core().
|
static |
Definition at line 99 of file load-save.cc.
|
static |
Definition at line 102 of file load-save.cc.
Referenced by dump_octave_core().
|
static |
Definition at line 109 of file load-save.cc.
Referenced by dump_octave_core().
|
static |
Definition at line 106 of file load-save.cc.
Referenced by Fsave().
|
static |
Definition at line 126 of file load-save.cc.
Referenced by write_header().