GNU Octave  4.0.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Functions | Variables
load-save.cc File Reference
#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"
Include dependency graph for load-save.cc:

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 ()
 

Function Documentation

static bool check_gzip_magic ( const std::string &  fname)
static

Definition at line 212 of file load-save.cc.

References OCTAVE_LOCAL_BUFFER.

Referenced by get_file_format().

static std::string default_save_header_format ( void  )
static
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 
)
static
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 
)
static
void dump_octave_core ( void  )
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 
)
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 
)

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 
)
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 load_save_format get_file_format ( std::istream &  file,
const std::string &  filename 
)
static
static load_save_format get_file_format ( const std::string &  fname,
const std::string &  orig_fname,
bool use_zlib,
bool  quiet = false 
)
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 bool glob_pattern_p ( const std::string &  pattern)
static

Definition at line 894 of file load-save.cc.

Referenced by Fsave().

static void gripe_file_open ( const std::string &  fcn,
const std::string &  file 
)
static

Definition at line 129 of file load-save.cc.

References error().

Referenced by Fload(), Fsave(), and get_file_format().

static void install_loaded_variable ( const std::string &  name,
const octave_value val,
bool  global,
const std::string &   
)
static
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 bool matches_patterns ( const string_vector patterns,
int  pat_idx,
int  num_pat,
const std::string &  name 
)
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 string_vector parse_save_options ( const string_vector argv,
load_save_format format,
bool append,
bool save_as_floats,
bool use_zlib 
)
static
static string_vector parse_save_options ( const std::string &  arg,
load_save_format format,
bool append,
bool save_as_floats,
bool use_zlib 
)
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 
)
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
static size_t save_vars ( std::ostream &  os,
const std::string &  pattern,
load_save_format  fmt,
bool  save_as_floats 
)
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 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 
)
static
void write_header ( std::ostream &  os,
load_save_format  format 
)

Variable Documentation

bool Vcrash_dumps_octave_core = true
static

Definition at line 95 of file load-save.cc.

Referenced by dump_octave_core().

double Voctave_core_file_limit = -1.0
static

Definition at line 99 of file load-save.cc.

std::string Voctave_core_file_name = "octave-workspace"
static

Definition at line 102 of file load-save.cc.

Referenced by dump_octave_core().

std::string Voctave_core_file_options = "-binary"
static

Definition at line 109 of file load-save.cc.

Referenced by dump_octave_core().

std::string Vsave_default_options = "-text"
static

Definition at line 106 of file load-save.cc.

Referenced by Fsave().

std::string Vsave_header_format_string = default_save_header_format ()
static

Definition at line 126 of file load-save.cc.

Referenced by write_header().