GNU Octave  3.8.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
file-io.cc File Reference
#include <cerrno>
#include <cstdio>
#include <iostream>
#include <limits>
#include <stack>
#include <vector>
#include <fcntl.h>
#include <sys/types.h>
#include <unistd.h>
#include "error.h"
#include "file-ops.h"
#include "file-stat.h"
#include "lo-ieee.h"
#include "oct-env.h"
#include "oct-locbuf.h"
#include "defun.h"
#include "file-io.h"
#include "load-path.h"
#include "oct-fstrm.h"
#include "oct-iostrm.h"
#include "oct-map.h"
#include "oct-obj.h"
#include "oct-prcstrm.h"
#include "oct-stream.h"
#include "oct-strstrm.h"
#include "pager.h"
#include "sysdep.h"
#include "utils.h"
#include "variables.h"
Include dependency graph for file-io.cc:

Go to the source code of this file.

Functions

void cleanup_tmp_files (void)
void close_files (void)
static octave_value const_value (const char *, const octave_value_list &args, int val)
static octave_value const_value (const char *, const octave_value_list &args, const octave_value &val)
static int convert (int x, int ibase, int obase)
static octave_value do_fread (octave_stream &os, const octave_value &size_arg, const octave_value &prec_arg, const octave_value &skip_arg, const octave_value &arch_arg, octave_idx_type &count)
static int do_fwrite (octave_stream &os, const octave_value &data, const octave_value &prec_arg, const octave_value &skip_arg, const octave_value &arch_arg)
static octave_stream do_stream_open (const std::string &name, const std::string &mode_arg, const std::string &arch, int &fid)
static octave_stream do_stream_open (const octave_value &tc_name, const octave_value &tc_mode, const octave_value &tc_arch, const char *fcn, int &fid)
OCTAVE_EXPORT octave_value_list Ffclear (const octave_value_list &args, int)
OCTAVE_EXPORT octave_value_list Ffclose (const octave_value_list &args, int)
OCTAVE_EXPORT octave_value_list Ffeof (const octave_value_list &args, int)
OCTAVE_EXPORT octave_value_list Fferror (const octave_value_list &args, int)
OCTAVE_EXPORT octave_value_list Ffflush (const octave_value_list &args, int)
OCTAVE_EXPORT octave_value_list Ffgetl (const octave_value_list &args, int)
OCTAVE_EXPORT octave_value_list Ffgets (const octave_value_list &args, int)
OCTAVE_EXPORT octave_value_list Ffopen (const octave_value_list &args, int nargout)
OCTAVE_EXPORT octave_value_list Ffprintf (const octave_value_list &args, int nargout)
OCTAVE_EXPORT octave_value_list Ffputs (const octave_value_list &args, int)
OCTAVE_EXPORT octave_value_list Ffread (const octave_value_list &args, int)
OCTAVE_EXPORT octave_value_list Ffreport (const octave_value_list &args, int)
OCTAVE_EXPORT octave_value_list Ffrewind (const octave_value_list &args, int nargout)
OCTAVE_EXPORT octave_value_list Ffscanf (const octave_value_list &args, int)
OCTAVE_EXPORT octave_value_list Ffseek (const octave_value_list &args, int)
OCTAVE_EXPORT octave_value_list Ffskipl (const octave_value_list &args, int)
OCTAVE_EXPORT octave_value_list Fftell (const octave_value_list &args, int)
OCTAVE_EXPORT octave_value_list Ffwrite (const octave_value_list &args, int)
OCTAVE_EXPORT octave_value_list Fmkstemp (const octave_value_list &args, int)
static std::ios::openmode fopen_mode_to_ios_mode (const std::string &mode)
OCTAVE_EXPORT octave_value_list FP_tmpdir (const octave_value_list &args, int)
OCTAVE_EXPORT octave_value_list Fpclose (const octave_value_list &args, int)
OCTAVE_EXPORT octave_value_list Fpopen (const octave_value_list &args, int)
OCTAVE_EXPORT octave_value_list Fprintf (const octave_value_list &args, int nargout)
OCTAVE_EXPORT octave_value_list Fputs (const octave_value_list &args, int)
OCTAVE_EXPORT octave_value_list Fscanf (const octave_value_list &args, int nargout)
OCTAVE_EXPORT octave_value_list FSEEK_CUR (const octave_value_list &args, int)
OCTAVE_EXPORT octave_value_list FSEEK_END (const octave_value_list &args, int)
OCTAVE_EXPORT octave_value_list FSEEK_SET (const octave_value_list &args, int)
OCTAVE_EXPORT octave_value_list Fsprintf (const octave_value_list &args, int)
OCTAVE_EXPORT octave_value_list Fsscanf (const octave_value_list &args, int)
OCTAVE_EXPORT octave_value_list Fstderr (const octave_value_list &args, int)
OCTAVE_EXPORT octave_value_list Fstdin (const octave_value_list &args, int)
OCTAVE_EXPORT octave_value_list Fstdout (const octave_value_list &args, int)
OCTAVE_EXPORT octave_value_list Ftmpfile (const octave_value_list &args, int)
OCTAVE_EXPORT octave_value_list Ftmpnam (const octave_value_list &args, int)
OCTAVE_EXPORT octave_value_list Fumask (const octave_value_list &args, int)
static std::string get_sscanf_data (const octave_value &val)
void initialize_file_io (void)
void mark_for_deletion (const std::string &file)
static void normalize_fopen_mode (std::string &mode, bool &use_zlib)

Variables

static octave_value stderr_file
static octave_stream stderr_stream
static octave_value stdin_file
static octave_stream stdin_stream
static octave_value stdout_file
static octave_stream stdout_stream
std::stack< std::string > tmp_files

Function Documentation

void cleanup_tmp_files ( void  )

Definition at line 123 of file file-io.cc.

Referenced by do_octave_atexit().

void close_files ( void  )

Definition at line 105 of file file-io.cc.

References octave_stream_list::clear().

Referenced by do_octave_atexit().

static octave_value const_value ( const char ,
const octave_value_list args,
int  val 
)
static

Definition at line 2160 of file file-io.cc.

References octave_value_list::length(), and print_usage().

Referenced by FSEEK_CUR(), FSEEK_END(), FSEEK_SET(), Fstderr(), Fstdin(), and Fstdout().

static octave_value const_value ( const char ,
const octave_value_list args,
const octave_value val 
)
static

Definition at line 2243 of file file-io.cc.

References octave_value_list::length(), and print_usage().

static int convert ( int  x,
int  ibase,
int  obase 
)
static

Definition at line 2084 of file file-io.cc.

References error().

Referenced by jit_function::call(), jit_function::do_return(), and Fumask().

static octave_value do_fread ( octave_stream os,
const octave_value size_arg,
const octave_value prec_arg,
const octave_value skip_arg,
const octave_value arch_arg,
octave_idx_type count 
)
static
static int do_fwrite ( octave_stream os,
const octave_value data,
const octave_value prec_arg,
const octave_value skip_arg,
const octave_value arch_arg 
)
static
static octave_stream do_stream_open ( const std::string &  name,
const std::string &  mode_arg,
const std::string &  arch,
int fid 
)
static
static octave_stream do_stream_open ( const octave_value tc_name,
const octave_value tc_mode,
const octave_value tc_arch,
const char fcn,
int fid 
)
static

Definition at line 558 of file file-io.cc.

References do_stream_open(), error(), error_state, and octave_value::string_value().

OCTAVE_EXPORT octave_value_list Ffclear ( const octave_value_list args,
int   
)
OCTAVE_EXPORT octave_value_list Ffclose ( const octave_value_list args,
int   
)

Definition at line 247 of file file-io.cc.

References octave_value::length(), print_usage(), and octave_stream_list::remove().

OCTAVE_EXPORT octave_value_list Ffeof ( const octave_value_list args,
int   
)
OCTAVE_EXPORT octave_value_list Fferror ( const octave_value_list args,
int   
)
OCTAVE_EXPORT octave_value_list Ffflush ( const octave_value_list args,
int   
)
OCTAVE_EXPORT octave_value_list Ffgetl ( const octave_value_list args,
int   
)
OCTAVE_EXPORT octave_value_list Ffgets ( const octave_value_list args,
int   
)
OCTAVE_EXPORT octave_value_list Ffopen ( const octave_value_list args,
int  nargout 
)
OCTAVE_EXPORT octave_value_list Ffprintf ( const octave_value_list args,
int  nargout 
)
OCTAVE_EXPORT octave_value_list Ffputs ( const octave_value_list args,
int   
)
OCTAVE_EXPORT octave_value_list Ffread ( const octave_value_list args,
int   
)
OCTAVE_EXPORT octave_value_list Ffreport ( const octave_value_list args,
int   
)
OCTAVE_EXPORT octave_value_list Ffrewind ( const octave_value_list args,
int  nargout 
)
OCTAVE_EXPORT octave_value_list Ffscanf ( const octave_value_list args,
int   
)
OCTAVE_EXPORT octave_value_list Ffseek ( const octave_value_list args,
int   
)
OCTAVE_EXPORT octave_value_list Ffskipl ( const octave_value_list args,
int   
)
OCTAVE_EXPORT octave_value_list Fftell ( const octave_value_list args,
int   
)
OCTAVE_EXPORT octave_value_list Ffwrite ( const octave_value_list args,
int   
)
OCTAVE_EXPORT octave_value_list Fmkstemp ( const octave_value_list args,
int   
)
static std::ios::openmode fopen_mode_to_ios_mode ( const std::string &  mode)
static

Definition at line 200 of file file-io.cc.

References error(), and error_state.

Referenced by do_stream_open(), Fmkstemp(), and Ftmpfile().

OCTAVE_EXPORT octave_value_list FP_tmpdir ( const octave_value_list args,
int   
)

Definition at line 2179 of file file-io.cc.

References get_P_tmpdir(), octave_value::length(), and print_usage().

Referenced by install_file_io_fcns().

OCTAVE_EXPORT octave_value_list Fpclose ( const octave_value_list args,
int   
)
OCTAVE_EXPORT octave_value_list Fpopen ( const octave_value_list args,
int   
)
OCTAVE_EXPORT octave_value_list Fprintf ( const octave_value_list args,
int  nargout 
)
OCTAVE_EXPORT octave_value_list Fputs ( const octave_value_list args,
int   
)

Definition at line 1022 of file file-io.cc.

References print_usage(), and octave_stream::puts().

OCTAVE_EXPORT octave_value_list Fscanf ( const octave_value_list args,
int  nargout 
)

Definition at line 1333 of file file-io.cc.

References Ffscanf().

OCTAVE_EXPORT octave_value_list FSEEK_CUR ( const octave_value_list args,
int   
)

Definition at line 2226 of file file-io.cc.

References const_value().

Referenced by install_file_io_fcns().

OCTAVE_EXPORT octave_value_list FSEEK_END ( const octave_value_list args,
int   
)

Definition at line 2237 of file file-io.cc.

References const_value().

Referenced by install_file_io_fcns().

OCTAVE_EXPORT octave_value_list FSEEK_SET ( const octave_value_list args,
int   
)

Definition at line 2215 of file file-io.cc.

References const_value().

Referenced by install_file_io_fcns().

OCTAVE_EXPORT octave_value_list Fsprintf ( const octave_value_list args,
int   
)
OCTAVE_EXPORT octave_value_list Fsscanf ( const octave_value_list args,
int   
)
OCTAVE_EXPORT octave_value_list Fstderr ( const octave_value_list args,
int   
)

Definition at line 2288 of file file-io.cc.

References const_value().

Referenced by install_file_io_fcns().

OCTAVE_EXPORT octave_value_list Fstdin ( const octave_value_list args,
int   
)

Definition at line 2265 of file file-io.cc.

References const_value().

Referenced by install_file_io_fcns().

OCTAVE_EXPORT octave_value_list Fstdout ( const octave_value_list args,
int   
)

Definition at line 2276 of file file-io.cc.

References const_value().

Referenced by install_file_io_fcns().

OCTAVE_EXPORT octave_value_list Ftmpfile ( const octave_value_list args,
int   
)
OCTAVE_EXPORT octave_value_list Ftmpnam ( const octave_value_list args,
int   
)

Definition at line 1915 of file file-io.cc.

References error(), error_state, octave_value::length(), octave_tempnam(), and print_usage().

Referenced by install_file_io_fcns().

OCTAVE_EXPORT octave_value_list Fumask ( const octave_value_list args,
int   
)

Definition at line 2119 of file file-io.cc.

References convert(), error(), error_state, octave_umask(), and print_usage().

Referenced by install_file_io_fcns().

static std::string get_sscanf_data ( const octave_value val)
static
void initialize_file_io ( void  )
void mark_for_deletion ( const std::string &  file)

Definition at line 117 of file file-io.cc.

Referenced by Fmkstemp().

static void normalize_fopen_mode ( std::string &  mode,
bool use_zlib 
)
static

Definition at line 134 of file file-io.cc.

References error(), error_state, and warning_with_id().

Referenced by do_stream_open().

Variable Documentation

octave_value stderr_file
static

Definition at line 81 of file file-io.cc.

octave_stream stderr_stream
static

Definition at line 85 of file file-io.cc.

octave_value stdin_file
static

Definition at line 79 of file file-io.cc.

octave_stream stdin_stream
static

Definition at line 83 of file file-io.cc.

octave_value stdout_file
static

Definition at line 80 of file file-io.cc.

octave_stream stdout_stream
static

Definition at line 84 of file file-io.cc.

std::stack<std::string> tmp_files

Definition at line 114 of file file-io.cc.