GNU Octave  4.0.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
oct-stream.h
Go to the documentation of this file.
1 /*
2 
3 Copyright (C) 1996-2015 John W. Eaton
4 
5 This file is part of Octave.
6 
7 Octave is free software; you can redistribute it and/or modify it
8 under the terms of the GNU General Public License as published by the
9 Free Software Foundation; either version 3 of the License, or (at your
10 option) any later version.
11 
12 Octave is distributed in the hope that it will be useful, but WITHOUT
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 for more details.
16 
17 You should have received a copy of the GNU General Public License
18 along with Octave; see the file COPYING. If not, see
19 <http://www.gnu.org/licenses/>.
20 
21 */
22 
23 #if !defined (octave_oct_stream_h)
24 #define octave_oct_stream_h 1
25 
26 class Matrix;
27 class string_vector;
28 class octave_value;
29 class octave_value_list;
30 
31 #include <iosfwd>
32 #include <sstream>
33 #include <string>
34 #include <list>
35 #include <map>
36 
37 #include "Array.h"
38 #include "data-conv.h"
39 #include "lo-utils.h"
40 #include "mach-info.h"
41 #include "oct-refcount.h"
42 
43 class
46 {
47 public:
48 
50  {
51  whitespace_conversion = 1,
52  literal_conversion = 2
53  };
54 
55  scanf_format_elt (const char *txt = 0, int w = 0, bool d = false,
56  char typ = '\0', char mod = '\0',
57  const std::string& ch_class = std::string ())
58  : text (strsave (txt)), width (w), discard (d), type (typ),
59  modifier (mod), char_class (ch_class) { }
60 
62  : text (strsave (e.text)), width (e.width), discard (e.discard),
63  type (e.type), modifier (e.modifier), char_class (e.char_class) { }
64 
66  {
67  if (this != &e)
68  {
69  text = strsave (e.text);
70  width = e.width;
71  discard = e.discard;
72  type = e.type;
73  modifier = e.modifier;
74  char_class = e.char_class;
75  }
76 
77  return *this;
78  }
79 
80  ~scanf_format_elt (void) { delete [] text; }
81 
82  // The C-style format string.
83  const char *text;
84 
85  // The maximum field width.
86  int width;
87 
88  // TRUE if we are not storing the result of this conversion.
89  bool discard;
90 
91  // Type of conversion -- 'd', 'i', 'o', 'u', 'x', 'e', 'f', 'g',
92  // 'c', 's', 'p', '%', or '['.
93  char type;
94 
95  // A length modifier -- 'h', 'l', or 'L'.
96  char modifier;
97 
98  // The class of characters in a '[' format.
99  std::string char_class;
100 };
101 
102 class
105 {
106 public:
107 
108  scanf_format_list (const std::string& fmt = std::string ());
109 
110  ~scanf_format_list (void);
111 
112  octave_idx_type num_conversions (void) { return nconv; }
113 
114  // The length can be different than the number of conversions.
115  // For example, "x %d y %d z" has 2 conversions but the length of
116  // the list is 3 because of the characters that appear after the
117  // last conversion.
118 
119  octave_idx_type length (void) { return list.length (); }
120 
121  const scanf_format_elt *first (void)
122  {
123  curr_idx = 0;
124  return current ();
125  }
126 
127  const scanf_format_elt *current (void) const
128  { return list.length () > 0 ? list.elem (curr_idx) : 0; }
129 
130  const scanf_format_elt *next (bool cycle = true)
131  {
132  curr_idx++;
133 
134  if (curr_idx >= list.length ())
135  {
136  if (cycle)
137  curr_idx = 0;
138  else
139  return 0;
140  }
141  return current ();
142  }
143 
144  void printme (void) const;
145 
146  bool ok (void) const { return (nconv >= 0); }
147 
148  operator bool () const { return ok (); }
149 
150  bool all_character_conversions (void);
151 
152  bool all_numeric_conversions (void);
153 
154 private:
155 
156  // Number of conversions specified by this format string, or -1 if
157  // invalid conversions have been found.
159 
160  // Index to current element;
162 
163  // FIXME: maybe LIST should be a std::list object?
164  // List of format elements.
166 
167  // Temporary buffer.
168  std::ostringstream *buf;
169 
170  void add_elt_to_list (int width, bool discard, char type, char modifier,
171  octave_idx_type& num_elts,
172  const std::string& char_class = std::string ());
173 
174  void process_conversion (const std::string& s, size_t& i, size_t n,
175  int& width, bool& discard, char& type,
176  char& modifier, octave_idx_type& num_elts);
177 
178  int finish_conversion (const std::string& s, size_t& i, size_t n,
179  int& width, bool discard, char& type,
180  char modifier, octave_idx_type& num_elts);
181  // No copying!
182 
184 
186 };
187 
188 class
190 {
191 public:
192 
193  printf_format_elt (const char *txt = 0, int n = 0, int w = -1,
194  int p = -1, const std::string& f = std::string (),
195  char typ = '\0', char mod = '\0')
196  : text (strsave (txt)), args (n), fw (w), prec (p), flags (f),
197  type (typ), modifier (mod) { }
198 
200  : text (strsave (e.text)), args (e.args), fw (e.fw), prec (e.prec),
201  flags (e.flags), type (e.type), modifier (e.modifier) { }
202 
204  {
205  if (this != &e)
206  {
207  text = strsave (e.text);
208  args = e.args;
209  fw = e.fw;
210  prec = e.prec;
211  flags = e.flags;
212  type = e.type;
213  modifier = e.modifier;
214  }
215 
216  return *this;
217  }
218 
219  ~printf_format_elt (void) { delete [] text; }
220 
221  // The C-style format string.
222  const char *text;
223 
224  // How many args do we expect to consume?
225  int args;
226 
227  // Field width.
228  int fw;
229 
230  // Precision.
231  int prec;
232 
233  // Flags -- '-', '+', ' ', '0', or '#'.
234  std::string flags;
235 
236  // Type of conversion -- 'd', 'i', 'o', 'x', 'X', 'u', 'c', 's',
237  // 'f', 'e', 'E', 'g', 'G', 'p', or '%'
238  char type;
239 
240  // A length modifier -- 'h', 'l', or 'L'.
241  char modifier;
242 };
243 
244 class
247 {
248 public:
249 
250  printf_format_list (const std::string& fmt = std::string ());
251 
252  ~printf_format_list (void);
253 
254  octave_idx_type num_conversions (void) { return nconv; }
255 
256  const printf_format_elt *first (void)
257  {
258  curr_idx = 0;
259  return current ();
260  }
261 
262  const printf_format_elt *current (void) const
263  { return list.length () > 0 ? list.elem (curr_idx) : 0; }
264 
265  const printf_format_elt *next (bool cycle = true)
266  {
267  curr_idx++;
268 
269  if (curr_idx >= list.length ())
270  {
271  if (cycle)
272  curr_idx = 0;
273  else
274  return 0;
275  }
276 
277  return current ();
278  }
279 
280  bool last_elt_p (void) { return (curr_idx + 1 == list.length ()); }
281 
282  void printme (void) const;
283 
284  bool ok (void) const { return (nconv >= 0); }
285 
286  operator bool () const { return ok (); }
287 
288 private:
289 
290  // Number of conversions specified by this format string, or -1 if
291  // invalid conversions have been found.
293 
294  // Index to current element;
296 
297  // FIXME: maybe LIST should be a std::list object?
298  // List of format elements.
300 
301  // Temporary buffer.
302  std::ostringstream *buf;
303 
304  void add_elt_to_list (int args, const std::string& flags, int fw,
305  int prec, char type, char modifier,
306  octave_idx_type& num_elts);
307 
308  void process_conversion (const std::string& s, size_t& i, size_t n,
309  int& args, std::string& flags, int& fw,
310  int& prec, char& modifier, char& type,
311  octave_idx_type& num_elts);
312 
313  void finish_conversion (const std::string& s, size_t& i, int args,
314  const std::string& flags, int fw, int prec,
315  char modifier, char& type,
316  octave_idx_type& num_elts);
317 
318  // No copying!
319 
321 
323 };
324 
325 // Provide an interface for Octave streams.
326 
327 class
330 {
331  friend class octave_stream;
332 
333 public:
334 
335  octave_base_stream (std::ios::openmode arg_md = std::ios::in|std::ios::out,
338  : count (0), md (arg_md), flt_fmt (ff), fail (false), open_state (true),
339  errmsg ()
340  { }
341 
342  virtual ~octave_base_stream (void) { }
343 
344  // The remaining functions are not specific to input or output only,
345  // and must be provided by the derived classes.
346 
347  // Position a stream at OFFSET relative to ORIGIN.
348 
349  virtual int seek (off_t offset, int origin) = 0;
350 
351  // Return current stream position.
352 
353  virtual off_t tell (void) = 0;
354 
355  // Return TRUE if EOF has been reached on this stream.
356 
357  virtual bool eof (void) const = 0;
358 
359  // The name of the file.
360 
361  virtual std::string name (void) const = 0;
362 
363  // If the derived class provides this function and it returns a
364  // pointer to a valid istream, scanf(), read(), getl(), and gets()
365  // will automatically work for this stream.
366 
367  virtual std::istream *input_stream (void) { return 0; }
368 
369  // If the derived class provides this function and it returns a
370  // pointer to a valid ostream, flush(), write(), and printf() will
371  // automatically work for this stream.
372 
373  virtual std::ostream *output_stream (void) { return 0; }
374 
375  // Return TRUE if this stream is open.
376 
377  bool is_open (void) const { return open_state; }
378 
379  virtual void do_close (void) { }
380 
381  void close (void)
382  {
383  if (is_open ())
384  {
385  open_state = false;
386  do_close ();
387  }
388  }
389 
390  virtual int file_number (void) const
391  {
392  // Kluge alert!
393 
394  if (name () == "stdin")
395  return 0;
396  else if (name () == "stdout")
397  return 1;
398  else if (name () == "stderr")
399  return 2;
400  else
401  return -1;
402  }
403 
404  bool ok (void) const { return ! fail; }
405 
406  // Return current error message for this stream.
407 
408  std::string error (bool clear, int& err_num);
409 
410 protected:
411 
412  int mode (void) const { return md; }
413 
414  oct_mach_info::float_format float_format (void) const { return flt_fmt; }
415 
416  // Set current error state and set fail to TRUE.
417 
418  void error (const std::string& msg);
419  void error (const std::string& who, const std::string& msg);
420 
421  // Clear any error message and set fail to FALSE.
422 
423  void clear (void);
424 
425  // Clear stream state.
426 
427  void clearerr (void);
428 
429 private:
430 
431  // A reference count.
433 
434  // The permission bits for the file. Should be some combination of
435  // std::ios::open_mode bits.
436  int md;
437 
438  // Data format.
440 
441  // TRUE if an error has occurred.
442  bool fail;
443 
444  // TRUE if this stream is open.
446 
447  // Should contain error message if fail is TRUE.
448  std::string errmsg;
449 
450  // Functions that are defined for all input streams (input streams
451  // are those that define is).
452 
453  std::string do_gets (octave_idx_type max_len, bool& err, bool strip_newline,
454  const std::string& who /* = "gets" */);
455 
456  std::string getl (octave_idx_type max_len, bool& err,
457  const std::string& who /* = "getl" */);
458  std::string gets (octave_idx_type max_len, bool& err,
459  const std::string& who /* = "gets" */);
460  off_t skipl (off_t count, bool& err, const std::string& who /* = "skipl" */);
461 
462  octave_value do_scanf (scanf_format_list& fmt_list, octave_idx_type nr,
463  octave_idx_type nc,
464  bool one_elt_size_spec, octave_idx_type& count,
465  const std::string& who /* = "scanf" */);
466 
467  octave_value scanf (const std::string& fmt, const Array<double>& size,
468  octave_idx_type& count, const std::string& who /* = "scanf" */);
469 
470  bool do_oscanf (const scanf_format_elt *elt, octave_value&,
471  const std::string& who /* = "scanf" */);
472 
473  octave_value_list oscanf (const std::string& fmt,
474  const std::string& who /* = "scanf" */);
475 
476  // Functions that are defined for all output streams (output streams
477  // are those that define os).
478 
479  int flush (void);
480 
481  int do_numeric_printf_conv (std::ostream& os, const printf_format_elt *elt,
482  int nsa, int sa_1, int sa_2,
483  const octave_value& val,
484  const std::string& who);
485 
486  int do_printf (printf_format_list& fmt_list, const octave_value_list& args,
487  const std::string& who /* = "printf" */);
488 
489  int printf (const std::string& fmt, const octave_value_list& args,
490  const std::string& who /* = "printf" */);
491 
492  int puts (const std::string& s, const std::string& who /* = "puts" */);
493 
494  // We can always do this in terms of seek(), so the derived class
495  // only has to provide that.
496 
497  void invalid_operation (const std::string& who, const char *rw);
498 
499  // No copying!
500 
502 
504 };
505 
506 class
509 {
510 public:
511 
513 
514  ~octave_stream (void);
515 
516  octave_stream (const octave_stream&);
517 
519 
520  int flush (void);
521 
522  std::string getl (octave_idx_type max_len, bool& err,
523  const std::string& who /* = "getl" */);
524  std::string getl (const octave_value& max_len, bool& err,
525  const std::string& who /* = "getl" */);
526 
527  std::string gets (octave_idx_type max_len, bool& err,
528  const std::string& who /* = "gets" */);
529  std::string gets (const octave_value& max_len, bool& err,
530  const std::string& who /* = "gets" */);
531 
532  off_t skipl (off_t count, bool& err, const std::string& who /* = "skipl" */);
533  off_t skipl (const octave_value& count, bool& err,
534  const std::string& who /* = "skipl" */);
535 
536  int seek (off_t offset, int origin);
537  int seek (const octave_value& offset, const octave_value& origin);
538 
539  off_t tell (void);
540 
541  int rewind (void);
542 
543  bool is_open (void) const;
544 
545  void close (void);
546 
547  octave_value read (const Array<double>& size, octave_idx_type block_size,
548  oct_data_conv::data_type input_type,
549  oct_data_conv::data_type output_type,
551  octave_idx_type& count);
552 
553  octave_idx_type write (const octave_value& data, octave_idx_type block_size,
554  oct_data_conv::data_type output_type,
555  octave_idx_type skip,
557 
558  bool write_bytes (const void *data, size_t n_elts);
559 
560  bool skip_bytes (size_t n_elts);
561 
562  template <class T>
563  octave_idx_type write (const Array<T>& data, octave_idx_type block_size,
564  oct_data_conv::data_type output_type,
565  octave_idx_type skip,
567 
568  octave_value scanf (const std::string& fmt, const Array<double>& size,
569  octave_idx_type& count, const std::string& who /* = "scanf" */);
570 
571  octave_value scanf (const octave_value& fmt, const Array<double>& size,
572  octave_idx_type& count, const std::string& who /* = "scanf" */);
573 
574  octave_value_list oscanf (const std::string& fmt,
575  const std::string& who /* = "scanf" */);
576 
578  const std::string& who /* = "scanf" */);
579 
580  int printf (const std::string& fmt, const octave_value_list& args,
581  const std::string& who /* = "printf" */);
582 
583  int printf (const octave_value& fmt, const octave_value_list& args,
584  const std::string& who /* = "printf" */);
585 
586  int puts (const std::string& s, const std::string& who /* = "puts" */);
587  int puts (const octave_value& s, const std::string& who /* = "puts" */);
588 
589  bool eof (void) const;
590 
591  std::string error (bool clear, int& err_num);
592 
593  std::string error (bool clear = false)
594  {
595  int err_num;
596  return error (clear, err_num);
597  }
598 
599  // Set the error message and state.
600 
601  void error (const std::string& msg)
602  {
603  if (rep)
604  rep->error (msg);
605  }
606 
607  void error (const char *msg) { error (std::string (msg)); }
608 
609  int file_number (void) { return rep ? rep->file_number () : -1; }
610 
611  bool is_valid (void) const { return (rep != 0); }
612 
613  bool ok (void) const { return rep && rep->ok (); }
614 
615  operator bool () const { return ok (); }
616 
617  std::string name (void) const;
618 
619  int mode (void) const;
620 
622 
623  static std::string mode_as_string (int mode);
624 
625  std::istream *input_stream (void)
626  {
627  return rep ? rep->input_stream () : 0;
628  }
629 
630  std::ostream *output_stream (void)
631  {
632  return rep ? rep->output_stream () : 0;
633  }
634 
635  void clearerr (void) { if (rep) rep->clearerr (); }
636 
637 private:
638 
639  // The actual representation of this stream.
641 
642  bool stream_ok (bool clear = true) const
643  {
644  bool retval = true;
645 
646  if (rep)
647  {
648  if (clear)
649  rep->clear ();
650  }
651  else
652  retval = false;
653 
654  return retval;
655  }
656 
657  void invalid_operation (const std::string& who, const char *rw)
658  {
659  if (rep)
660  rep->invalid_operation (who, rw);
661  }
662 
664  finalize_read (std::list<void *>& input_buf_list,
665  octave_idx_type input_buf_elts,
666  octave_idx_type elts_read,
668  oct_data_conv::data_type input_type,
669  oct_data_conv::data_type output_type,
671 };
672 
673 class
676 {
677 protected:
678 
679  octave_stream_list (void) : list (), lookup_cache (list.end ()) { }
680 
681 public:
682 
684 
685  static bool instance_ok (void);
686 
687  static int insert (octave_stream& os);
688 
689  static octave_stream
690  lookup (int fid, const std::string& who = std::string ());
691 
692  static octave_stream
693  lookup (const octave_value& fid, const std::string& who = std::string ());
694 
695  static int remove (int fid, const std::string& who = std::string ());
696  static int remove (const octave_value& fid,
697  const std::string& who = std::string ());
698 
699  static void clear (bool flush = true);
700 
701  static string_vector get_info (int fid);
702  static string_vector get_info (const octave_value& fid);
703 
704  static std::string list_open_files (void);
705 
706  static octave_value open_file_numbers (void);
707 
708  static int get_file_number (const octave_value& fid);
709 
710 private:
711 
712  typedef std::map<int, octave_stream> ostrl_map;
713 
714  ostrl_map list;
715 
716  mutable ostrl_map::const_iterator lookup_cache;
717 
719 
720  static void cleanup_instance (void) { delete instance; instance = 0; }
721 
722  int do_insert (octave_stream& os);
723 
724  octave_stream do_lookup (int fid,
725  const std::string& who = std::string ()) const;
726  octave_stream do_lookup (const octave_value& fid,
727  const std::string& who = std::string ()) const;
728 
729  int do_remove (int fid, const std::string& who = std::string ());
730  int do_remove (const octave_value& fid,
731  const std::string& who = std::string ());
732 
733  void do_clear (bool flush = true);
734 
735  string_vector do_get_info (int fid) const;
736  string_vector do_get_info (const octave_value& fid) const;
737 
738  std::string do_list_open_files (void) const;
739 
740  octave_value do_open_file_numbers (void) const;
741 
742  int do_get_file_number (const octave_value& fid) const;
743 };
744 
745 #endif
int bool
Definition: mex.h:56
void invalid_operation(const std::string &who, const char *rw)
Definition: oct-stream.h:657
static void clear(octave_shlib &oct_file)
Definition: dynamic-ld.cc:236
~scanf_format_elt(void)
Definition: oct-stream.h:80
virtual ~octave_base_stream(void)
Definition: oct-stream.h:342
bool skip_bytes(size_t n_elts)
Definition: oct-stream.cc:3748
octave_idx_type curr_idx
Definition: oct-stream.h:295
octave_value read(const Array< double > &size, octave_idx_type block_size, oct_data_conv::data_type input_type, oct_data_conv::data_type output_type, octave_idx_type skip, oct_mach_info::float_format flt_fmt, octave_idx_type &count)
Definition: oct-stream.cc:3354
const printf_format_elt * first(void)
Definition: oct-stream.h:256
bool last_elt_p(void)
Definition: oct-stream.h:280
bool is_open(void) const
Definition: oct-stream.h:377
octave_base_stream(std::ios::openmode arg_md=std::ios::in|std::ios::out, oct_mach_info::float_format ff=oct_mach_info::native_float_format())
Definition: oct-stream.h:335
int rewind(void)
Definition: oct-stream.cc:3137
scanf_format_elt(const char *txt=0, int w=0, bool d=false, char typ= '\0', char mod= '\0', const std::string &ch_class=std::string())
Definition: oct-stream.h:55
printf_format_elt(const printf_format_elt &e)
Definition: oct-stream.h:199
static octave_stream_list * instance
Definition: oct-stream.h:718
std::string gets(octave_idx_type max_len, bool &err, const std::string &who)
Definition: oct-stream.cc:2910
bool is_open(void) const
Definition: oct-stream.cc:3143
int seek(off_t offset, int origin)
Definition: oct-stream.cc:2995
virtual std::istream * input_stream(void)
Definition: oct-stream.h:367
octave_base_stream * rep
Definition: oct-stream.h:640
octave_int< T > mod(const octave_int< T > &x, const octave_int< T > &y)
Definition: oct-inttypes.h:959
static char * strsave(const char *s)
Definition: main.cc:414
octave_stream_list(void)
Definition: oct-stream.h:679
oct_mach_info::float_format flt_fmt
Definition: oct-stream.h:439
void error(const char *fmt,...)
Definition: error.cc:476
octave_idx_type nconv
Definition: oct-stream.h:158
const char * text
Definition: oct-stream.h:83
off_t skipl(off_t count, bool &err, const std::string &who)
Definition: oct-stream.cc:2950
bool ok(void) const
Definition: oct-stream.h:404
octave_idx_type curr_idx
Definition: oct-stream.h:161
~printf_format_elt(void)
Definition: oct-stream.h:219
T & elem(octave_idx_type n)
Definition: Array.h:380
octave_idx_type lookup(const T *x, octave_idx_type n, T y)
void error(const char *msg)
Definition: oct-stream.h:607
int mode(void) const
Definition: oct-stream.cc:4067
bool ok(void) const
Definition: oct-stream.h:284
std::string char_class
Definition: oct-stream.h:99
std::string flags
Definition: oct-stream.h:234
virtual void do_close(void)
Definition: oct-stream.h:379
std::istream * input_stream(void)
Definition: oct-stream.h:625
octave_idx_type nconv
Definition: oct-stream.h:292
F77_RET_T const double const double double * d
Array< printf_format_elt * > list
Definition: oct-stream.h:299
virtual std::ostream * output_stream(void)
Definition: oct-stream.h:373
int printf(const std::string &fmt, const octave_value_list &args, const std::string &who)
Definition: oct-stream.cc:3964
const scanf_format_elt * next(bool cycle=true)
Definition: oct-stream.h:130
F77_RET_T const double const double * f
#define OCTINTERP_API
Definition: mexproto.h:66
bool ok(void) const
Definition: oct-stream.h:613
void clear(void)
Definition: oct-stream.cc:906
std::string errmsg
Definition: oct-stream.h:448
bool write_bytes(const void *data, size_t n_elts)
Definition: oct-stream.cc:3725
std::complex< double > w(std::complex< double > z, double relerr=0)
const printf_format_elt * current(void) const
Definition: oct-stream.h:262
int mode(void) const
Definition: oct-stream.h:412
int puts(const std::string &s, const std::string &who)
Definition: oct-stream.cc:4001
int flush(void)
Definition: oct-stream.cc:2859
scanf_format_elt(const scanf_format_elt &e)
Definition: oct-stream.h:61
std::ostream * output_stream(void)
Definition: oct-stream.h:630
virtual int file_number(void) const
Definition: oct-stream.h:390
static void cleanup_instance(void)
Definition: oct-stream.h:720
octave_value_list oscanf(const std::string &fmt, const std::string &who)
Definition: oct-stream.cc:3929
Definition: dMatrix.h:35
size_t size(T const (&)[z])
Definition: help.cc:103
octave_value scanf(const std::string &fmt, const Array< double > &size, octave_idx_type &count, const std::string &who)
Definition: oct-stream.cc:3892
oct_mach_info::float_format float_format(void) const
Definition: oct-stream.h:414
const scanf_format_elt * first(void)
Definition: oct-stream.h:121
off_t tell(void)
Definition: oct-stream.cc:3126
octave_idx_type num_conversions(void)
Definition: oct-stream.h:112
std::ostringstream * buf
Definition: oct-stream.h:302
std::string error(bool clear, int &err_num)
Definition: oct-stream.cc:2801
std::string error(bool clear=false)
Definition: oct-stream.h:593
bool stream_ok(bool clear=true) const
Definition: oct-stream.h:642
bool ok(void) const
Definition: oct-stream.h:146
~octave_stream(void)
Definition: oct-stream.cc:2828
octave_stream(octave_base_stream *bs=0)
Definition: oct-stream.cc:2821
octave_idx_type length(void) const
Number of elements in the array.
Definition: Array.h:267
const char * text
Definition: oct-stream.h:222
const printf_format_elt * next(bool cycle=true)
Definition: oct-stream.h:265
bool is_valid(void) const
Definition: oct-stream.h:611
static float_format native_float_format(void)
Definition: mach-info.cc:164
octave_stream & operator=(const octave_stream &)
Definition: oct-stream.cc:2842
bool eof(void) const
Definition: oct-stream.cc:4034
octave_idx_type num_conversions(void)
Definition: oct-stream.h:254
octave_idx_type write(const octave_value &data, octave_idx_type block_size, oct_data_conv::data_type output_type, octave_idx_type skip, oct_mach_info::float_format flt_fmt)
Definition: oct-stream.cc:3546
octave_refcount< octave_idx_type > count
Definition: oct-stream.h:432
octave_value finalize_read(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, oct_data_conv::data_type input_type, oct_data_conv::data_type output_type, oct_mach_info::float_format ffmt)
Definition: oct-stream.cc:3262
oct_mach_info::float_format float_format(void) const
Definition: oct-stream.cc:4078
const scanf_format_elt * current(void) const
Definition: oct-stream.h:127
ostrl_map::const_iterator lookup_cache
Definition: oct-stream.h:716
Array< scanf_format_elt * > list
Definition: oct-stream.h:165
void close(void)
Definition: oct-stream.cc:3154
~octave_stream_list(void)
Definition: oct-stream.h:683
std::ostringstream * buf
Definition: oct-stream.h:168
int file_number(void)
Definition: oct-stream.h:609
void clearerr(void)
Definition: oct-stream.cc:913
printf_format_elt(const char *txt=0, int n=0, int w=-1, int p=-1, const std::string &f=std::string(), char typ= '\0', char mod= '\0')
Definition: oct-stream.h:193
void error(const std::string &msg)
Definition: oct-stream.h:601
octave_idx_type length(void)
Definition: oct-stream.h:119
std::string name(void) const
Definition: oct-stream.cc:4056
void invalid_operation(const std::string &who, const char *rw)
Definition: oct-stream.cc:2814
std::string getl(octave_idx_type max_len, bool &err, const std::string &who)
Definition: oct-stream.cc:2870
void close(void)
Definition: oct-stream.h:381
static std::string mode_as_string(int mode)
Definition: oct-stream.cc:4089
std::map< int, octave_stream > ostrl_map
Definition: oct-stream.h:712
void clearerr(void)
Definition: oct-stream.h:635
octave_value_list & operator=(const octave_value_list &obj)
Definition: oct-obj.h:68