GNU Octave  4.4.1
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
oct-stream.cc File Reference
#include <cassert>
#include <cctype>
#include <cstring>
#include <algorithm>
#include <deque>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <sstream>
#include <string>
#include "Array.h"
#include "Cell.h"
#include "byte-swap.h"
#include "lo-ieee.h"
#include "lo-mappers.h"
#include "lo-utils.h"
#include "oct-locbuf.h"
#include "quit.h"
#include "str-vec.h"
#include "error.h"
#include "errwarn.h"
#include "input.h"
#include "interpreter.h"
#include "octave.h"
#include "oct-iostrm.h"
#include "oct-stdstrm.h"
#include "oct-stream.h"
#include "ov.h"
#include "ovl.h"
#include "pager.h"
#include "utils.h"
Include dependency graph for oct-stream.cc:

Go to the source code of this file.

Classes

class  octave::delimited_stream
 
class  octave::printf_format_elt
 
class  octave::printf_format_list
 
class  octave::printf_value_cache
 
class  octave::scanf_format_elt
 
class  octave::scanf_format_list
 
class  octave::textscan
 
class  octave::textscan_format_elt
 
class  octave::textscan_format_list
 
class  octave::ultimate_element_type< T >
 
class  octave::ultimate_element_type< octave_int< T > >
 

Namespaces

 octave
 

Macros

#define BEGIN_C_CONVERSION()
 
#define BEGIN_CHAR_CLASS_CONVERSION()
 
#define BEGIN_S_CONVERSION()
 
#define DO_LITERAL_CONVERSION()
 
#define DO_PCT_CONVERSION()
 
#define DO_WHITESPACE_CONVERSION()
 
#define FILL_TABLE_ROW(T, V)
 
#define FINISH_CHARACTER_CONVERSION()
 
#define INSTANTIATE_WRITE(T)
 
#define TABLE_ELT(T, U, V, W)   conv_fptr_table[oct_data_conv::T][oct_data_conv::U] = convert_and_copy<V, W>
 

Typedefs

typedef octave_value(* octave::conv_fptr) (std::list< void *> &input_buf_list, octave_idx_type input_buf_elts, octave_idx_type elts_read, octave_idx_type nr, octave_idx_type nc, bool swap, bool do_float_fmt_conv, bool do_NA_conv, octave::mach_info::float_format from_flt_fmt)
 

Functions

template<typename SRC_T , typename DST_T >
static octave_value octave::convert_and_copy (std::list< void *> &input_buf_list, octave_idx_type input_buf_elts, octave_idx_type elts_read, octave_idx_type nr, octave_idx_type nc, bool swap, bool do_float_fmt_conv, bool do_NA_conv, octave::mach_info::float_format from_flt_fmt)
 
template<typename T , typename V >
static void octave::convert_chars (const void *data, void *conv_data, octave_idx_type n_elts)
 
template<typename T >
static bool octave::convert_data (const T *data, void *conv_data, octave_idx_type n_elts, oct_data_conv::data_type output_type, octave::mach_info::float_format flt_fmt)
 
template<typename T , typename V >
static void octave::convert_ints (const T *data, void *conv_data, octave_idx_type n_elts, bool swap)
 
static int octave::convert_to_valid_int (const octave_value &tc, int &conv_err)
 
template<typename T >
int octave::do_printf_conv (std::ostream &os, const char *fmt, int nsa, int sa_1, int sa_2, T arg, const std::string &who)
 
static size_t octave::do_printf_string (std::ostream &os, const octave::printf_format_elt *elt, int nsa, int sa_1, int sa_2, const std::string &arg, const std::string &who)
 
template<typename T >
void octave::do_scanf_conv (std::istream &is, const scanf_format_elt &fmt, T valptr, Matrix &mval, double *data, octave_idx_type &idx, octave_idx_type &conversion_count, octave_idx_type nr, octave_idx_type max_size, bool discard)
 
template void octave::do_scanf_conv (std::istream &, const scanf_format_elt &, double *, Matrix &, double *, octave_idx_type &, octave_idx_type &, octave_idx_type, octave_idx_type, bool)
 
static OCTAVE_NORETURN void octave::err_invalid_file_id (int fid, const std::string &who)
 
static std::string octave::expand_char_class (const std::string &s)
 
static octave_idx_type octave::get_size (double d, const std::string &who)
 
static void octave::get_size (const Array< double > &size, octave_idx_type &nr, octave_idx_type &nc, bool &one_elt_size_spec, const std::string &who)
 
static Cell octave::init_inf_nan (void)
 
static bool octave::is_nan_or_inf (const octave_value &val)
 
template<typename T >
static bool octave::is_old_NA (T)
 
template<>
bool octave::is_old_NA< double > (double val)
 
template<typename T >
std::istream & octave::octave_scan (std::istream &is, const scanf_format_elt &fmt, T *valptr)
 
template<>
std::istream & octave::octave_scan (std::istream &is, const scanf_format_elt &, char *valptr)
 
template<>
std::istream & octave::octave_scan (std::istream &is, const scanf_format_elt &fmt, double *valptr)
 
template<typename T >
std::istream & octave::octave_scan_1 (std::istream &is, const scanf_format_elt &fmt, T *valptr)
 
static bool octave::ok_for_signed_int_conv (const octave_value &val)
 
static bool octave::ok_for_unsigned_int_conv (const octave_value &val)
 
static double octave::pown (double x, unsigned int n)
 
template<typename T >
static T octave::replace_old_NA (T val)
 
template<>
double octave::replace_old_NA< double > (double val)
 
static std::string octave::switch_to_g_format (const octave::printf_format_elt *elt)
 

Macro Definition Documentation

◆ BEGIN_C_CONVERSION

#define BEGIN_C_CONVERSION ( )
Value:
is.unsetf (std::ios::skipws); \
\
int width = (elt->width ? elt->width : 1); \
\
std::string tmp (width, '\0'); \
\
int c = std::istream::traits_type::eof (); \
int n = 0; \
while (is && n < width \
&& (c = is.get ()) != std::istream::traits_type::eof ()) \
tmp[n++] = static_cast<char> (c); \
if (n > 0 && c == std::istream::traits_type::eof ()) \
is.clear (); \
\
tmp.resize (n)
while(ischar(s=fgets(fid))) fputs(stdout
nd example oindent opens the file binary numeric values will be read assuming they are stored in IEEE format with the least significant bit and then converted to the native representation Opening a file that is already open simply opens it again and returns a separate file id It is not an error to open a file several though writing to the same file through several different file ids may produce unexpected results The possible values of text mode reading and writing automatically converts linefeeds to the appropriate line end character for the you may append a you must also open the file in binary mode The parameter conversions are currently only supported for and permissions will be set to and then everything is written in a single operation This is very efficient and improves performance c
Definition: file-io.cc:587
if(nargin< 2) print_usage()
Definition: cellfun.cc:407
double tmp
Definition: data.cc:6252
write the output to stdout if nargout is
Definition: load-save.cc:1612
If this string is the system will ring the terminal sometimes it is useful to be able to print the original representation of the string
Definition: utils.cc:888

Definition at line 4409 of file oct-stream.cc.

Referenced by octave::base_stream::do_oscanf(), and octave::base_stream::do_scanf().

◆ BEGIN_CHAR_CLASS_CONVERSION

#define BEGIN_CHAR_CLASS_CONVERSION ( )

◆ BEGIN_S_CONVERSION

#define BEGIN_S_CONVERSION ( )

◆ DO_LITERAL_CONVERSION

#define DO_LITERAL_CONVERSION ( )
Value:
do \
{ \
int c = std::istream::traits_type::eof (); \
\
int n = fmt.length (); \
int i = 0; \
while (i < n && is && (c = is.get ()) != std::istream::traits_type::eof ()) \
{ \
if (c == static_cast<unsigned char> (fmt[i])) \
{ \
i++; \
continue; \
} \
else \
{ \
is.putback (c); \
break; \
} \
} \
if (i != n) \
is.setstate (std::ios::failbit); \
} \
while (0)
while(ischar(s=fgets(fid))) fputs(stdout
nd example oindent opens the file binary numeric values will be read assuming they are stored in IEEE format with the least significant bit and then converted to the native representation Opening a file that is already open simply opens it again and returns a separate file id It is not an error to open a file several though writing to the same file through several different file ids may produce unexpected results The possible values of text mode reading and writing automatically converts linefeeds to the appropriate line end character for the you may append a you must also open the file in binary mode The parameter conversions are currently only supported for and permissions will be set to and then everything is written in a single operation This is very efficient and improves performance c
Definition: file-io.cc:587
if(nargin< 2) print_usage()
Definition: cellfun.cc:407
for i
Definition: data.cc:5264
write the output to stdout if nargout is
Definition: load-save.cc:1612

Definition at line 4364 of file oct-stream.cc.

Referenced by octave::base_stream::do_oscanf(), and octave::base_stream::do_scanf().

◆ DO_PCT_CONVERSION

#define DO_PCT_CONVERSION ( )
Value:
do \
{ \
int c = is.get (); \
if (c != std::istream::traits_type::eof ()) \
{ \
if (c != '%') \
{ \
is.putback (c); \
is.setstate (std::ios::failbit); \
} \
} \
else \
is.setstate (std::ios::failbit); \
} \
while (0)
nd example oindent opens the file binary numeric values will be read assuming they are stored in IEEE format with the least significant bit and then converted to the native representation Opening a file that is already open simply opens it again and returns a separate file id It is not an error to open a file several though writing to the same file through several different file ids may produce unexpected results The possible values of text mode reading and writing automatically converts linefeeds to the appropriate line end character for the you may append a you must also open the file in binary mode The parameter conversions are currently only supported for and permissions will be set to and then everything is written in a single operation This is very efficient and improves performance c
Definition: file-io.cc:587
if(nargin< 2) print_usage()
Definition: cellfun.cc:407
write the output to stdout if nargout is
Definition: load-save.cc:1612

Definition at line 4391 of file oct-stream.cc.

Referenced by octave::base_stream::do_oscanf(), and octave::base_stream::do_scanf().

◆ DO_WHITESPACE_CONVERSION

#define DO_WHITESPACE_CONVERSION ( )
Value:
do \
{ \
int c = std::istream::traits_type::eof (); \
while (is && (c = is.get ()) != std::istream::traits_type::eof () \
&& isspace (c)) \
{ /* skip whitespace */ } \
if (c != std::istream::traits_type::eof ()) \
is.putback (c); \
} \
while (0)
while(ischar(s=fgets(fid))) fputs(stdout
nd example oindent opens the file binary numeric values will be read assuming they are stored in IEEE format with the least significant bit and then converted to the native representation Opening a file that is already open simply opens it again and returns a separate file id It is not an error to open a file several though writing to the same file through several different file ids may produce unexpected results The possible values of text mode reading and writing automatically converts linefeeds to the appropriate line end character for the you may append a you must also open the file in binary mode The parameter conversions are currently only supported for and permissions will be set to and then everything is written in a single operation This is very efficient and improves performance c
Definition: file-io.cc:587
if(nargin< 2) print_usage()
Definition: cellfun.cc:407
write the output to stdout if nargout is
Definition: load-save.cc:1612

Definition at line 4350 of file oct-stream.cc.

Referenced by octave::base_stream::do_oscanf(), and octave::base_stream::do_scanf().

◆ FILL_TABLE_ROW

#define FILL_TABLE_ROW (   T,
  V 
)
Value:
TABLE_ELT (T, dt_int8, V, int8NDArray); \
TABLE_ELT (T, dt_uint8, V, uint8NDArray); \
TABLE_ELT (T, dt_int16, V, int16NDArray); \
TABLE_ELT (T, dt_uint16, V, uint16NDArray); \
TABLE_ELT (T, dt_int32, V, int32NDArray); \
TABLE_ELT (T, dt_uint32, V, uint32NDArray); \
TABLE_ELT (T, dt_int64, V, int64NDArray); \
TABLE_ELT (T, dt_uint64, V, uint64NDArray); \
TABLE_ELT (T, dt_single, V, FloatNDArray); \
TABLE_ELT (T, dt_double, V, NDArray); \
TABLE_ELT (T, dt_char, V, charNDArray); \
TABLE_ELT (T, dt_schar, V, charNDArray); \
TABLE_ELT (T, dt_uchar, V, charNDArray); \
TABLE_ELT (T, dt_logical, V, boolNDArray);
F77_RET_T const F77_INT const F77_INT const F77_INT const F77_DBLE const F77_DBLE F77_INT F77_DBLE * V
#define TABLE_ELT(T, U, V, W)
Definition: oct-stream.cc:6399

Definition at line 6402 of file oct-stream.cc.

Referenced by octave::stream::finalize_read().

◆ FINISH_CHARACTER_CONVERSION

#define FINISH_CHARACTER_CONVERSION ( )

Definition at line 4526 of file oct-stream.cc.

Referenced by octave::base_stream::do_scanf().

◆ INSTANTIATE_WRITE

#define INSTANTIATE_WRITE (   T)
Value:
template \
octave_idx_type \
stream::write (const Array<T>& data, octave_idx_type block_size, \
oct_data_conv::data_type output_type, \
octave::mach_info::float_format flt_fmt
Definition: load-save.cc:736
N Dimensional Array with copy-on-write semantics.
Definition: Array.h:125

Definition at line 7014 of file oct-stream.cc.

◆ TABLE_ELT

#define TABLE_ELT (   T,
  U,
  V,
 
)    conv_fptr_table[oct_data_conv::T][oct_data_conv::U] = convert_and_copy<V, W>

Definition at line 6399 of file oct-stream.cc.