GNU Octave  8.1.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 "unistd-wrappers.h"
#include "builtin-defun-decls.h"
#include "defun.h"
#include "error.h"
#include "errwarn.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

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 (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 (stream &os, const octave_value &data, const octave_value &prec_arg, const octave_value &skip_arg, const octave_value &arch_arg)
 
static 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 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 Ftempdir (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)
 
static void normalize_fopen_mode (std::string &mode, bool &use_zlib)
 
static octave_value_list printf_internal (interpreter &interp, const std::string &who, const octave_value_list &args, int nargout)
 
static octave_value_list puts_internal (interpreter &interp, const std::string &who, const octave_value_list &args)
 
static octave_value_list scanf_internal (interpreter &interp, const std::string &who, const octave_value_list &args)
 
static octave_value_list textscan_internal (interpreter &interp, const std::string &who, const octave_value_list &args)
 

Function Documentation

◆ const_value() [1/2]

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

Definition at line 3281 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 3155 of file file-io.cc.

References error(), and x.

Referenced by Fumask().

◆ do_fread()

static octave_value do_fread ( 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 ( 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 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(), and octave_value::xstring_value().

◆ do_stream_open() [2/2]

static stream do_stream_open ( const std::string &  name,
const std::string &  mode_arg,
const std::string &  arch,
std::string  encoding,
int &  fid 
)
static

◆ F__textscan__()

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

Definition at line 1563 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 187 of file file-io.cc.

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

◆ Ffeof()

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

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

References stream::eof(), stream_list::lookup(), ovl(), and print_usage().

◆ Fferror()

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

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

References stream::error(), stream_list::lookup(), ovl(), and print_usage().

◆ Ffflush()

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

◆ Ffgetl()

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

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

References stream::getl(), stream_list::lookup(), octave_value(), ovl(), and print_usage().

◆ Ffgets()

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

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

References stream::gets(), stream_list::lookup(), octave_value(), ovl(), and print_usage().

◆ Ffopen()

◆ Ffprintf()

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

Definition at line 842 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 904 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 685 of file file-io.cc.

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

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

References stream_list::lookup(), ovl(), print_usage(), and stream::rewind().

◆ Ffscanf()

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

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

References scanf_internal().

◆ Ffseek()

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

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

References stream_list::lookup(), octave_value(), ovl(), print_usage(), and stream::seek().

◆ Ffskipl()

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

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

References stream_list::lookup(), octave_value(), ovl(), print_usage(), and stream::skipl().

◆ Fftell()

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

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

References stream_list::lookup(), ovl(), print_usage(), and stream::tell().

◆ Ffwrite()

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

◆ Fmkstemp()

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

◆ 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(), and 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 3236 of file file-io.cc.

References 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 2883 of file file-io.cc.

References ovl(), print_usage(), and 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 868 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 950 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 1206 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 3264 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 3275 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 3253 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 3327 of file file-io.cc.

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

◆ Fstdin()

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

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

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

◆ Fstdout()

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

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

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

◆ Ftempdir()

OCTAVE_EXPORT octave_value_list Ftempdir ( const octave_value_list args,
int   
)

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

References dir_sep_str(), get_temp_directory(), is_dir_sep(), ovl(), and print_usage().

◆ Ftempname()

OCTAVE_EXPORT octave_value_list Ftempname ( const octave_value_list args,
int   
)

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

References ovl(), print_usage(), and tempnam().

◆ Ftextscan()

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

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

References textscan_internal().

◆ Ftmpfile()

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

◆ Fumask()

OCTAVE_EXPORT octave_value_list Fumask ( const octave_value_list args,
int   
)

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

References convert(), error(), ovl(), print_usage(), and umask().

◆ get_scan_string_data()

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

◆ 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 ( interpreter interp,
const std::string &  who,
const octave_value_list args,
int  nargout 
)
static

◆ puts_internal()

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

◆ scanf_internal()

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

◆ textscan_internal()