GNU Octave  6.2.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
file-io.cc File Reference
#include <cerrno>
#include <cstdio>
#include <iomanip>
#include <string>
#include "file-ops.h"
#include "file-stat.h"
#include "iconv-wrappers.h"
#include "lo-ieee.h"
#include "lo-sysdep.h"
#include "localcharset-wrapper.h"
#include "mkostemp-wrapper.h"
#include "oct-env.h"
#include "oct-locbuf.h"
#include "tmpfile-wrapper.h"
#include "unistd-wrappers.h"
#include "builtin-defun-decls.h"
#include "defun.h"
#include "error.h"
#include "errwarn.h"
#include "file-io.h"
#include "interpreter-private.h"
#include "interpreter.h"
#include "load-path.h"
#include "oct-fstrm.h"
#include "oct-iostrm.h"
#include "oct-map.h"
#include "oct-prcstrm.h"
#include "oct-stream.h"
#include "oct-strstrm.h"
#include "ov.h"
#include "ovl.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)
 
static octave_value const_value (const char *, const octave_value_list &args, const octave_value &val)
 
static octave_value const_value (const char *, const octave_value_list &args, int 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 octave_value &tc_name, const octave_value &tc_mode, const octave_value &tc_arch, const octave_value &tc_encoding, const char *fcn, int &fid)
 
static octave::stream do_stream_open (const std::string &name, const std::string &mode_arg, const std::string &arch, std::string encoding, int &fid)
 
OCTAVE_EXPORT octave_value_list F__textscan__ (octave::interpreter &interp, const octave_value_list &args, int)
 
OCTAVE_EXPORT octave_value_list Ffclear (octave::interpreter &interp, const octave_value_list &args, int)
 
OCTAVE_EXPORT octave_value_list Ffclose (octave::interpreter &interp, const octave_value_list &args, int)
 
OCTAVE_EXPORT octave_value_list Ffeof (octave::interpreter &interp, const octave_value_list &args, int)
 
OCTAVE_EXPORT octave_value_list Fferror (octave::interpreter &interp, const octave_value_list &args, int)
 
OCTAVE_EXPORT octave_value_list Ffflush (octave::interpreter &interp, const octave_value_list &args, int)
 
OCTAVE_EXPORT octave_value_list Ffgetl (octave::interpreter &interp, const octave_value_list &args, int)
 
OCTAVE_EXPORT octave_value_list Ffgets (octave::interpreter &interp, const octave_value_list &args, int)
 
OCTAVE_EXPORT octave_value_list Ffopen (octave::interpreter &interp, const octave_value_list &args, int nargout)
 
OCTAVE_EXPORT octave_value_list Ffprintf (octave::interpreter &interp, const octave_value_list &args, int nargout)
 
OCTAVE_EXPORT octave_value_list Ffputs (octave::interpreter &interp, const octave_value_list &args, int)
 
OCTAVE_EXPORT octave_value_list Ffread (octave::interpreter &interp, const octave_value_list &args, int)
 
OCTAVE_EXPORT octave_value_list Ffreport (octave::interpreter &interp, const octave_value_list &args, int)
 
OCTAVE_EXPORT octave_value_list Ffrewind (octave::interpreter &interp, const octave_value_list &args, int nargout)
 
OCTAVE_EXPORT octave_value_list Ffscanf (octave::interpreter &interp, const octave_value_list &args, int)
 
OCTAVE_EXPORT octave_value_list Ffseek (octave::interpreter &interp, const octave_value_list &args, int)
 
OCTAVE_EXPORT octave_value_list Ffskipl (octave::interpreter &interp, const octave_value_list &args, int)
 
OCTAVE_EXPORT octave_value_list Fftell (octave::interpreter &interp, const octave_value_list &args, int)
 
OCTAVE_EXPORT octave_value_list Ffwrite (octave::interpreter &interp, const octave_value_list &args, int)
 
OCTAVE_EXPORT octave_value_list Fmkstemp (octave::interpreter &interp, 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 (octave::interpreter &interp, const octave_value_list &args, int)
 
OCTAVE_EXPORT octave_value_list Fpopen (octave::interpreter &interp, const octave_value_list &args, int)
 
OCTAVE_EXPORT octave_value_list Fprintf (octave::interpreter &interp, const octave_value_list &args, int nargout)
 
OCTAVE_EXPORT octave_value_list Fputs (octave::interpreter &interp, const octave_value_list &args, int)
 
OCTAVE_EXPORT octave_value_list Fscanf (octave::interpreter &interp, const octave_value_list &args, int)
 
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 (octave::interpreter &interp, const octave_value_list &args, int)
 
OCTAVE_EXPORT octave_value_list Fstdin (octave::interpreter &interp, const octave_value_list &args, int)
 
OCTAVE_EXPORT octave_value_list Fstdout (octave::interpreter &interp, const octave_value_list &args, int)
 
OCTAVE_EXPORT octave_value_list Ftempname (const octave_value_list &args, int)
 
OCTAVE_EXPORT octave_value_list Ftextscan (octave::interpreter &interp, const octave_value_list &args, int)
 
OCTAVE_EXPORT octave_value_list Ftmpfile (octave::interpreter &interp, const octave_value_list &args, int)
 
OCTAVE_EXPORT octave_value_list Fumask (const octave_value_list &args, int)
 
static std::string get_scan_string_data (const octave_value &val, const std::string &who)
 
void mark_for_deletion (const std::string &file)
 
static void normalize_fopen_mode (std::string &mode, bool &use_zlib)
 
static octave_value_list printf_internal (octave::interpreter &interp, const std::string &who, const octave_value_list &args, int nargout)
 
static octave_value_list puts_internal (octave::interpreter &interp, const std::string &who, const octave_value_list &args)
 
static octave_value_list scanf_internal (octave::interpreter &interp, const std::string &who, const octave_value_list &args)
 
static octave_value_list textscan_internal (octave::interpreter &interp, const std::string &who, const octave_value_list &args)
 

Function Documentation

◆ cleanup_tmp_files()

void cleanup_tmp_files ( void  )

◆ const_value() [1/2]

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

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

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

◆ const_value() [2/2]

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

◆ convert()

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

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

References error(), retval, and x.

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

◆ do_fread()

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

◆ do_fwrite()

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

◆ do_stream_open() [1/2]

static octave::stream do_stream_open ( const octave_value tc_name,
const octave_value tc_mode,
const octave_value tc_arch,
const octave_value tc_encoding,
const char *  fcn,
int &  fid 
)
static

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

References do_stream_open(), name, retval, and octave_value::xstring_value().

◆ do_stream_open() [2/2]

◆ F__textscan__()

OCTAVE_EXPORT octave_value_list F__textscan__ ( octave::interpreter interp,
const octave_value_list args,
int   
)

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

References print_usage(), and textscan_internal().

◆ Ffclear()

OCTAVE_EXPORT octave_value_list Ffclear ( octave::interpreter interp,
const octave_value_list args,
int   
)

◆ Ffclose()

OCTAVE_EXPORT octave_value_list Ffclose ( octave::interpreter interp,
const octave_value_list args,
int   
)

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

References ovl(), print_usage(), and octave::stream_list::remove().

◆ Ffeof()

OCTAVE_EXPORT octave_value_list Ffeof ( octave::interpreter interp,
const octave_value_list args,
int   
)

◆ Fferror()

OCTAVE_EXPORT octave_value_list Fferror ( octave::interpreter interp,
const octave_value_list args,
int   
)

◆ Ffflush()

◆ Ffgetl()

OCTAVE_EXPORT octave_value_list Ffgetl ( octave::interpreter interp,
const octave_value_list args,
int   
)

◆ Ffgets()

OCTAVE_EXPORT octave_value_list Ffgets ( octave::interpreter interp,
const octave_value_list args,
int   
)

◆ Ffopen()

◆ Ffprintf()

OCTAVE_EXPORT octave_value_list Ffprintf ( octave::interpreter interp,
const octave_value_list args,
int  nargout 
)

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

References printf_internal().

◆ Ffputs()

OCTAVE_EXPORT octave_value_list Ffputs ( octave::interpreter interp,
const octave_value_list args,
int   
)

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

References puts_internal().

Referenced by gnuplot_graphics_toolkit::send_quit().

◆ Ffread()

OCTAVE_EXPORT octave_value_list Ffread ( octave::interpreter interp,
const octave_value_list args,
int   
)

◆ Ffreport()

OCTAVE_EXPORT octave_value_list Ffreport ( octave::interpreter interp,
const octave_value_list args,
int   
)

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

References octave::stream_list::list_open_files(), octave_stdout, ovl(), and warning().

◆ Ffrewind()

OCTAVE_EXPORT octave_value_list Ffrewind ( octave::interpreter interp,
const octave_value_list args,
int  nargout 
)

◆ Ffscanf()

OCTAVE_EXPORT octave_value_list Ffscanf ( octave::interpreter interp,
const octave_value_list args,
int   
)

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

References scanf_internal().

◆ Ffseek()

OCTAVE_EXPORT octave_value_list Ffseek ( octave::interpreter interp,
const octave_value_list args,
int   
)

◆ Ffskipl()

OCTAVE_EXPORT octave_value_list Ffskipl ( octave::interpreter interp,
const octave_value_list args,
int   
)

◆ Fftell()

OCTAVE_EXPORT octave_value_list Fftell ( octave::interpreter interp,
const octave_value_list args,
int   
)

◆ Ffwrite()

OCTAVE_EXPORT octave_value_list Ffwrite ( octave::interpreter interp,
const octave_value_list args,
int   
)

◆ Fmkstemp()

◆ fopen_mode_to_ios_mode()

static std::ios::openmode fopen_mode_to_ios_mode ( const std::string &  mode)
static

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

References error(), retval, and octave::math::trunc().

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

◆ FP_tmpdir()

OCTAVE_EXPORT octave_value_list FP_tmpdir ( const octave_value_list args,
int   
)

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

References octave::get_P_tmpdir(), ovl(), and print_usage().

◆ Fpclose()

OCTAVE_EXPORT octave_value_list Fpclose ( octave::interpreter interp,
const octave_value_list args,
int   
)

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

References ovl(), print_usage(), and octave::stream_list::remove().

Referenced by gnuplot_graphics_toolkit::send_quit().

◆ Fpopen()

OCTAVE_EXPORT octave_value_list Fpopen ( octave::interpreter interp,
const octave_value_list args,
int   
)

◆ Fprintf()

OCTAVE_EXPORT octave_value_list Fprintf ( octave::interpreter interp,
const octave_value_list args,
int  nargout 
)

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

References octave_value_list::prepend(), and printf_internal().

◆ Fputs()

OCTAVE_EXPORT octave_value_list Fputs ( octave::interpreter interp,
const octave_value_list args,
int   
)

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

References octave_value_list::prepend(), and puts_internal().

◆ Fscanf()

OCTAVE_EXPORT octave_value_list Fscanf ( octave::interpreter interp,
const octave_value_list args,
int   
)

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

References octave_value_list::prepend(), and scanf_internal().

◆ FSEEK_CUR()

OCTAVE_EXPORT octave_value_list FSEEK_CUR ( const octave_value_list args,
int   
)

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

References const_value().

◆ FSEEK_END()

OCTAVE_EXPORT octave_value_list FSEEK_END ( const octave_value_list args,
int   
)

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

References const_value().

◆ FSEEK_SET()

OCTAVE_EXPORT octave_value_list FSEEK_SET ( const octave_value_list args,
int   
)

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

References const_value().

◆ Fsprintf()

◆ Fsscanf()

◆ Fstderr()

OCTAVE_EXPORT octave_value_list Fstderr ( octave::interpreter interp,
const octave_value_list args,
int   
)

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

References const_value(), and octave::stream_list::stderr_file().

◆ Fstdin()

OCTAVE_EXPORT octave_value_list Fstdin ( octave::interpreter interp,
const octave_value_list args,
int   
)

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

References const_value(), and octave::stream_list::stdin_file().

◆ Fstdout()

OCTAVE_EXPORT octave_value_list Fstdout ( octave::interpreter interp,
const octave_value_list args,
int   
)

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

References const_value(), and octave::stream_list::stdout_file().

◆ Ftempname()

OCTAVE_EXPORT octave_value_list Ftempname ( const octave_value_list args,
int   
)

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

References octave::sys::env::getenv(), ovl(), print_usage(), and octave::sys::tempnam().

◆ Ftextscan()

OCTAVE_EXPORT octave_value_list Ftextscan ( octave::interpreter interp,
const octave_value_list args,
int   
)

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

References textscan_internal().

◆ Ftmpfile()

◆ Fumask()

OCTAVE_EXPORT octave_value_list Fumask ( const octave_value_list args,
int   
)

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

References convert(), error(), ovl(), print_usage(), and octave::sys::umask().

◆ get_scan_string_data()

static std::string get_scan_string_data ( const octave_value val,
const std::string &  who 
)
static

◆ mark_for_deletion()

void mark_for_deletion ( const std::string &  file)

◆ normalize_fopen_mode()

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

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

References err_disabled_feature().

Referenced by do_stream_open().

◆ printf_internal()

static octave_value_list printf_internal ( octave::interpreter interp,
const std::string &  who,
const octave_value_list args,
int  nargout 
)
static

◆ puts_internal()

static octave_value_list puts_internal ( octave::interpreter interp,
const std::string &  who,
const octave_value_list args 
)
static

◆ scanf_internal()

◆ textscan_internal()