Navigation

Operators and Keywords

Function List:

C++ API

oct-stream.cc File Reference

#include <cassert>
#include <cctype>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <fstream>
#include <sstream>
#include <string>
#include <Array.h>
#include "byte-swap.h"
#include "lo-ieee.h"
#include "lo-mappers.h"
#include "lo-utils.h"
#include "str-vec.h"
#include "quit.h"
#include "error.h"
#include "gripes.h"
#include "input.h"
#include "oct-stdstrm.h"
#include "oct-stream.h"
#include "oct-obj.h"
#include "utils.h"

Include dependency graph for oct-stream.cc:


Classes

class  printf_value_cache

Defines

#define OCTAVE_SCAN(is, fmt, arg)   octave_scan (is, fmt, arg)
#define DO_WHITESPACE_CONVERSION()
#define DO_LITERAL_CONVERSION()
#define DO_PCT_CONVERSION()
#define BEGIN_C_CONVERSION()
#define BEGIN_S_CONVERSION()
#define BEGIN_CHAR_CLASS_CONVERSION()
#define FINISH_CHARACTER_CONVERSION()
#define DO_DOUBLE_CONV(TQUAL)
#define DO_READ_VAL_TEMPLATE(RET_T, READ_T)
#define INSTANTIATE_DO_READ(VAL_T)
#define FILL_TABLE_ROW(R, VAL_T)

Typedefs

typedef octave_value(* read_fptr )(octave_stream &, octave_idx_type, octave_idx_type, octave_idx_type, octave_idx_type, bool, bool, oct_mach_info::float_format ffmt, octave_idx_type &)

Functions

template<class T >
std::istream & octave_scan_1 (std::istream &is, const scanf_format_elt &fmt, T *valptr)
template<class T >
std::istream & octave_scan (std::istream &is, const scanf_format_elt &fmt, T *valptr)
template<>
std::istream & octave_scan (std::istream &is, const scanf_format_elt &, char *valptr)
template std::istream & octave_scan (std::istream &, const scanf_format_elt &, int *)
template std::istream & octave_scan (std::istream &, const scanf_format_elt &, long int *)
template std::istream & octave_scan (std::istream &, const scanf_format_elt &, short int *)
template std::istream & octave_scan (std::istream &, const scanf_format_elt &, unsigned int *)
template std::istream & octave_scan (std::istream &, const scanf_format_elt &, unsigned long int *)
template std::istream & octave_scan (std::istream &, const scanf_format_elt &, unsigned short int *)
template<>
std::istream & octave_scan (std::istream &is, const scanf_format_elt &fmt, double *valptr)
template<class T >
void 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 do_scanf_conv (std::istream &, const scanf_format_elt &, int *, Matrix &, double *, octave_idx_type &, octave_idx_type &, octave_idx_type, octave_idx_type, bool)
template void do_scanf_conv (std::istream &, const scanf_format_elt &, long int *, Matrix &, double *, octave_idx_type &, octave_idx_type &, octave_idx_type, octave_idx_type, bool)
template void do_scanf_conv (std::istream &, const scanf_format_elt &, short int *, Matrix &, double *, octave_idx_type &, octave_idx_type &, octave_idx_type, octave_idx_type, bool)
template void do_scanf_conv (std::istream &, const scanf_format_elt &, unsigned int *, Matrix &, double *, octave_idx_type &, octave_idx_type &, octave_idx_type, octave_idx_type, bool)
template void do_scanf_conv (std::istream &, const scanf_format_elt &, unsigned long int *, Matrix &, double *, octave_idx_type &, octave_idx_type &, octave_idx_type, octave_idx_type, bool)
template void do_scanf_conv (std::istream &, const scanf_format_elt &, unsigned short int *, Matrix &, double *, octave_idx_type &, octave_idx_type &, octave_idx_type, octave_idx_type, bool)
template void 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)
template<class T >
int do_printf_conv (std::ostream &os, const char *fmt, int nsa, int sa_1, int sa_2, T arg, const std::string &who)
template int do_printf_conv (std::ostream &, const char *, int, int, int, int, const std::string &)
template int do_printf_conv (std::ostream &, const char *, int, int, int, long, const std::string &)
template int do_printf_conv (std::ostream &, const char *, int, int, int, unsigned int, const std::string &)
template int do_printf_conv (std::ostream &, const char *, int, int, int, double, const std::string &)
template int do_printf_conv (std::ostream &, const char *, int, int, int, const char *, const std::string &)
template<class RET_T , class READ_T >
octave_value do_read (octave_stream &strm, octave_idx_type nr, octave_idx_type nc, octave_idx_type block_size, octave_idx_type skip, bool do_float_fmt_conv, bool do_NA_conv, oct_mach_info::float_format from_flt_fmt, octave_idx_type &count)
 INSTANTIATE_DO_READ (int8NDArray)
 INSTANTIATE_DO_READ (FloatNDArray)
 INSTANTIATE_DO_READ (NDArray)
 INSTANTIATE_DO_READ (charNDArray)
 INSTANTIATE_DO_READ (boolNDArray)
template<class T >
void write_int (std::ostream &os, bool swap, const T &val)
template void write_int (std::ostream &, bool, const octave_int8 &)
template bool do_write (std::ostream &, const octave_int8 &, oct_data_conv::data_type, oct_mach_info::float_format, bool, bool)

Define Documentation

 
#define BEGIN_C_CONVERSION (  ) 

Value:

is.unsetf (std::ios::skipws); \
 \
  int width = elt->width ? elt->width : 1; \
 \
  char *tbuf = new char[width + 1]; \
 \
  int c = EOF; \
  int n = 0; \
 \
  while (is && n < width && (c = is.get ()) != EOF) \
    tbuf[n++] = static_cast<char> (c);              \
 \
  tbuf[n] = '\0'; \
 \
  if (n > 0 && c == EOF) \
    is.clear (); \
 \
  std::string tmp = tbuf; \
 \
  delete [] tbuf

 
#define BEGIN_CHAR_CLASS_CONVERSION (  ) 

 
#define BEGIN_S_CONVERSION (  ) 

#define DO_DOUBLE_CONV ( TQUAL   ) 

Value:

do \
    { \
      if (val > std::numeric_limits<TQUAL long>::max () \
          || val < std::numeric_limits<TQUAL long>::min ()) \
        { \
          std::string tfmt = fmt; \
 \
          tfmt.replace (tfmt.rfind (elt->type), 1, ".f"); \
 \
          if (elt->modifier == 'l') \
            tfmt.replace (tfmt.rfind (elt->modifier), 1, ""); \
 \
          retval += do_printf_conv (os, tfmt.c_str (), nsa, sa_1, sa_2, \
                                    val, who); \
        } \
      else \
        retval += do_printf_conv (os, fmt, nsa, sa_1, sa_2, \
                                  static_cast<TQUAL long> (val), who); \
    } \
  while (0)

 
#define DO_LITERAL_CONVERSION (  ) 

Value:

do \
    { \
      int c = EOF; \
 \
      int n = strlen (fmt); \
      int i = 0; \
 \
      while (i < n && is && (c = is.get ()) != 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)

 
#define DO_PCT_CONVERSION (  ) 

Value:

do \
    { \
      int c = is.get (); \
 \
      if (c != EOF) \
        { \
          if (c != '%') \
            { \
              is.putback (c); \
              is.setstate (std::ios::failbit); \
            } \
        } \
      else \
        is.setstate (std::ios::failbit); \
    } \
  while (0)

#define DO_READ_VAL_TEMPLATE ( RET_T,
READ_T   ) 

 
#define DO_WHITESPACE_CONVERSION (  ) 

Value:

do \
    { \
      int c = EOF; \
 \
      while (is && (c = is.get ()) != EOF && isspace (c)) \
        /* skip whitespace */; \
 \
      if (c != EOF) \
        is.putback (c); \
    } \
  while (0)

#define FILL_TABLE_ROW ( R,
VAL_T   ) 

Value:

read_fptr_table[R][oct_data_conv::dt_int8] = do_read<VAL_T, octave_int8>; \
  read_fptr_table[R][oct_data_conv::dt_uint8] = do_read<VAL_T, octave_uint8>; \
  read_fptr_table[R][oct_data_conv::dt_int16] = do_read<VAL_T, octave_int16>; \
  read_fptr_table[R][oct_data_conv::dt_uint16] = do_read<VAL_T, octave_uint16>; \
  read_fptr_table[R][oct_data_conv::dt_int32] = do_read<VAL_T, octave_int32>; \
  read_fptr_table[R][oct_data_conv::dt_uint32] = do_read<VAL_T, octave_uint32>; \
  read_fptr_table[R][oct_data_conv::dt_int64] = do_read<VAL_T, octave_int64>; \
  read_fptr_table[R][oct_data_conv::dt_uint64] = do_read<VAL_T, octave_uint64>; \
  read_fptr_table[R][oct_data_conv::dt_single] = do_read<VAL_T, float>; \
  read_fptr_table[R][oct_data_conv::dt_double] = do_read<VAL_T, double>; \
  read_fptr_table[R][oct_data_conv::dt_char] = do_read<VAL_T, char>; \
  read_fptr_table[R][oct_data_conv::dt_schar] = do_read<VAL_T, signed char>; \
  read_fptr_table[R][oct_data_conv::dt_uchar] = do_read<VAL_T, unsigned char>; \
  read_fptr_table[R][oct_data_conv::dt_logical] = do_read<VAL_T, unsigned char>

 
#define FINISH_CHARACTER_CONVERSION (  ) 

#define INSTANTIATE_DO_READ ( VAL_T   ) 

#define OCTAVE_SCAN ( is,
fmt,
arg   )     octave_scan (is, fmt, arg)


Typedef Documentation


Function Documentation

template int do_printf_conv ( std::ostream ,
const char *  ,
int  ,
int  ,
int  ,
const char *  ,
const std::string  
)

template int do_printf_conv ( std::ostream ,
const char *  ,
int  ,
int  ,
int  ,
double  ,
const std::string  
)

template int do_printf_conv ( std::ostream ,
const char *  ,
int  ,
int  ,
int  ,
unsigned  int,
const std::string  
)

template int do_printf_conv ( std::ostream ,
const char *  ,
int  ,
int  ,
int  ,
long  ,
const std::string  
)

template int do_printf_conv ( std::ostream ,
const char *  ,
int  ,
int  ,
int  ,
int  ,
const std::string  
)

template<class T >
int do_printf_conv ( std::ostream os,
const char *  fmt,
int  nsa,
int  sa_1,
int  sa_2,
T  arg,
const std::string who 
) [inline]

template<class RET_T , class READ_T >
octave_value do_read ( octave_stream strm,
octave_idx_type  nr,
octave_idx_type  nc,
octave_idx_type  block_size,
octave_idx_type  skip,
bool  do_float_fmt_conv,
bool  do_NA_conv,
oct_mach_info::float_format  from_flt_fmt,
octave_idx_type count 
) [inline]

template void 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   
)

template void do_scanf_conv ( std::istream &  ,
const scanf_format_elt ,
unsigned short int ,
Matrix ,
double ,
octave_idx_type ,
octave_idx_type ,
octave_idx_type  ,
octave_idx_type  ,
bool   
)

template void do_scanf_conv ( std::istream &  ,
const scanf_format_elt ,
unsigned long int ,
Matrix ,
double ,
octave_idx_type ,
octave_idx_type ,
octave_idx_type  ,
octave_idx_type  ,
bool   
)

template void do_scanf_conv ( std::istream &  ,
const scanf_format_elt ,
unsigned int ,
Matrix ,
double ,
octave_idx_type ,
octave_idx_type ,
octave_idx_type  ,
octave_idx_type  ,
bool   
)

template void do_scanf_conv ( std::istream &  ,
const scanf_format_elt ,
short int ,
Matrix ,
double ,
octave_idx_type ,
octave_idx_type ,
octave_idx_type  ,
octave_idx_type  ,
bool   
)

template void do_scanf_conv ( std::istream &  ,
const scanf_format_elt ,
long int ,
Matrix ,
double ,
octave_idx_type ,
octave_idx_type ,
octave_idx_type  ,
octave_idx_type  ,
bool   
)

template void do_scanf_conv ( std::istream &  ,
const scanf_format_elt ,
int ,
Matrix ,
double ,
octave_idx_type ,
octave_idx_type ,
octave_idx_type  ,
octave_idx_type  ,
bool   
)

template<class T >
void 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 
) [inline]

INSTANTIATE_DO_READ ( boolNDArray   ) 

INSTANTIATE_DO_READ ( charNDArray   ) 

INSTANTIATE_DO_READ ( NDArray   ) 

INSTANTIATE_DO_READ ( FloatNDArray   ) 

INSTANTIATE_DO_READ ( int8NDArray   ) 

template<>
std::istream& octave_scan ( std::istream &  is,
const scanf_format_elt fmt,
double valptr 
) [inline]

template std::istream& octave_scan ( std::istream &  ,
const scanf_format_elt ,
unsigned short int  
)

template std::istream& octave_scan ( std::istream &  ,
const scanf_format_elt ,
unsigned long int  
)

template std::istream& octave_scan ( std::istream &  ,
const scanf_format_elt ,
unsigned int  
)

template std::istream& octave_scan ( std::istream &  ,
const scanf_format_elt ,
short int  
)

template std::istream& octave_scan ( std::istream &  ,
const scanf_format_elt ,
long int  
)

template std::istream& octave_scan ( std::istream &  ,
const scanf_format_elt ,
int  
)

template<>
std::istream& octave_scan ( std::istream &  is,
const scanf_format_elt ,
char *  valptr 
) [inline]

template<class T >
std::istream& octave_scan ( std::istream &  is,
const scanf_format_elt fmt,
T valptr 
) [inline]

template<class T >
std::istream& octave_scan_1 ( std::istream &  is,
const scanf_format_elt fmt,
T valptr 
) [inline]

template void write_int ( std::ostream ,
bool  ,
const octave_int8  
)

template<class T >
void write_int ( std::ostream os,
bool  swap,
const T val 
) [inline]