annotate src/c-file-ptr-stream.h @ 3628:168c4d71dc63

[project @ 2000-03-23 07:34:54 by jwe]
author jwe
date Thu, 23 Mar 2000 07:34:55 +0000
parents
children 9add655e8b8c
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3628
168c4d71dc63 [project @ 2000-03-23 07:34:54 by jwe]
jwe
parents:
diff changeset
1 /*
168c4d71dc63 [project @ 2000-03-23 07:34:54 by jwe]
jwe
parents:
diff changeset
2
168c4d71dc63 [project @ 2000-03-23 07:34:54 by jwe]
jwe
parents:
diff changeset
3 Copyright (C) 2000 John W. Eaton
168c4d71dc63 [project @ 2000-03-23 07:34:54 by jwe]
jwe
parents:
diff changeset
4
168c4d71dc63 [project @ 2000-03-23 07:34:54 by jwe]
jwe
parents:
diff changeset
5 This file is part of Octave.
168c4d71dc63 [project @ 2000-03-23 07:34:54 by jwe]
jwe
parents:
diff changeset
6
168c4d71dc63 [project @ 2000-03-23 07:34:54 by jwe]
jwe
parents:
diff changeset
7 Octave is free software; you can redistribute it and/or modify it
168c4d71dc63 [project @ 2000-03-23 07:34:54 by jwe]
jwe
parents:
diff changeset
8 under the terms of the GNU General Public License as published by the
168c4d71dc63 [project @ 2000-03-23 07:34:54 by jwe]
jwe
parents:
diff changeset
9 Free Software Foundation; either version 2, or (at your option) any
168c4d71dc63 [project @ 2000-03-23 07:34:54 by jwe]
jwe
parents:
diff changeset
10 later version.
168c4d71dc63 [project @ 2000-03-23 07:34:54 by jwe]
jwe
parents:
diff changeset
11
168c4d71dc63 [project @ 2000-03-23 07:34:54 by jwe]
jwe
parents:
diff changeset
12 Octave is distributed in the hope that it will be useful, but WITHOUT
168c4d71dc63 [project @ 2000-03-23 07:34:54 by jwe]
jwe
parents:
diff changeset
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
168c4d71dc63 [project @ 2000-03-23 07:34:54 by jwe]
jwe
parents:
diff changeset
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
168c4d71dc63 [project @ 2000-03-23 07:34:54 by jwe]
jwe
parents:
diff changeset
15 for more details.
168c4d71dc63 [project @ 2000-03-23 07:34:54 by jwe]
jwe
parents:
diff changeset
16
168c4d71dc63 [project @ 2000-03-23 07:34:54 by jwe]
jwe
parents:
diff changeset
17 You should have received a copy of the GNU General Public License
168c4d71dc63 [project @ 2000-03-23 07:34:54 by jwe]
jwe
parents:
diff changeset
18 along with Octave; see the file COPYING. If not, write to the Free
168c4d71dc63 [project @ 2000-03-23 07:34:54 by jwe]
jwe
parents:
diff changeset
19 Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
168c4d71dc63 [project @ 2000-03-23 07:34:54 by jwe]
jwe
parents:
diff changeset
20
168c4d71dc63 [project @ 2000-03-23 07:34:54 by jwe]
jwe
parents:
diff changeset
21 */
168c4d71dc63 [project @ 2000-03-23 07:34:54 by jwe]
jwe
parents:
diff changeset
22
168c4d71dc63 [project @ 2000-03-23 07:34:54 by jwe]
jwe
parents:
diff changeset
23 #if !defined (octave_c_file_ptr_stream_h)
168c4d71dc63 [project @ 2000-03-23 07:34:54 by jwe]
jwe
parents:
diff changeset
24 #define octave_c_file_ptr_stream_h 1
168c4d71dc63 [project @ 2000-03-23 07:34:54 by jwe]
jwe
parents:
diff changeset
25
168c4d71dc63 [project @ 2000-03-23 07:34:54 by jwe]
jwe
parents:
diff changeset
26 #ifdef __GNUG__
168c4d71dc63 [project @ 2000-03-23 07:34:54 by jwe]
jwe
parents:
diff changeset
27 #pragma interface
168c4d71dc63 [project @ 2000-03-23 07:34:54 by jwe]
jwe
parents:
diff changeset
28 #endif
168c4d71dc63 [project @ 2000-03-23 07:34:54 by jwe]
jwe
parents:
diff changeset
29
168c4d71dc63 [project @ 2000-03-23 07:34:54 by jwe]
jwe
parents:
diff changeset
30 #include <iostream>
168c4d71dc63 [project @ 2000-03-23 07:34:54 by jwe]
jwe
parents:
diff changeset
31 #include <stdio.h>
168c4d71dc63 [project @ 2000-03-23 07:34:54 by jwe]
jwe
parents:
diff changeset
32
168c4d71dc63 [project @ 2000-03-23 07:34:54 by jwe]
jwe
parents:
diff changeset
33 class
168c4d71dc63 [project @ 2000-03-23 07:34:54 by jwe]
jwe
parents:
diff changeset
34 c_file_ptr_buf : public std::streambuf
168c4d71dc63 [project @ 2000-03-23 07:34:54 by jwe]
jwe
parents:
diff changeset
35 {
168c4d71dc63 [project @ 2000-03-23 07:34:54 by jwe]
jwe
parents:
diff changeset
36 protected:
168c4d71dc63 [project @ 2000-03-23 07:34:54 by jwe]
jwe
parents:
diff changeset
37
168c4d71dc63 [project @ 2000-03-23 07:34:54 by jwe]
jwe
parents:
diff changeset
38 FILE *f;
168c4d71dc63 [project @ 2000-03-23 07:34:54 by jwe]
jwe
parents:
diff changeset
39
168c4d71dc63 [project @ 2000-03-23 07:34:54 by jwe]
jwe
parents:
diff changeset
40 public:
168c4d71dc63 [project @ 2000-03-23 07:34:54 by jwe]
jwe
parents:
diff changeset
41
168c4d71dc63 [project @ 2000-03-23 07:34:54 by jwe]
jwe
parents:
diff changeset
42 FILE* stdiofile (void) const { return f; }
168c4d71dc63 [project @ 2000-03-23 07:34:54 by jwe]
jwe
parents:
diff changeset
43
168c4d71dc63 [project @ 2000-03-23 07:34:54 by jwe]
jwe
parents:
diff changeset
44 c_file_ptr_buf (FILE *f_arg) : std::streambuf (), f (f_arg) { }
168c4d71dc63 [project @ 2000-03-23 07:34:54 by jwe]
jwe
parents:
diff changeset
45
168c4d71dc63 [project @ 2000-03-23 07:34:54 by jwe]
jwe
parents:
diff changeset
46 ~c_file_ptr_buf (void);
168c4d71dc63 [project @ 2000-03-23 07:34:54 by jwe]
jwe
parents:
diff changeset
47
168c4d71dc63 [project @ 2000-03-23 07:34:54 by jwe]
jwe
parents:
diff changeset
48 int overflow (int);
168c4d71dc63 [project @ 2000-03-23 07:34:54 by jwe]
jwe
parents:
diff changeset
49
168c4d71dc63 [project @ 2000-03-23 07:34:54 by jwe]
jwe
parents:
diff changeset
50 int underflow (void);
168c4d71dc63 [project @ 2000-03-23 07:34:54 by jwe]
jwe
parents:
diff changeset
51
168c4d71dc63 [project @ 2000-03-23 07:34:54 by jwe]
jwe
parents:
diff changeset
52 int uflow (void);
168c4d71dc63 [project @ 2000-03-23 07:34:54 by jwe]
jwe
parents:
diff changeset
53
168c4d71dc63 [project @ 2000-03-23 07:34:54 by jwe]
jwe
parents:
diff changeset
54 int pbackfail (int);
168c4d71dc63 [project @ 2000-03-23 07:34:54 by jwe]
jwe
parents:
diff changeset
55
168c4d71dc63 [project @ 2000-03-23 07:34:54 by jwe]
jwe
parents:
diff changeset
56 std::streamsize xsputn (const char*, std::streamsize);
168c4d71dc63 [project @ 2000-03-23 07:34:54 by jwe]
jwe
parents:
diff changeset
57
168c4d71dc63 [project @ 2000-03-23 07:34:54 by jwe]
jwe
parents:
diff changeset
58 std::streamsize xsgetn (char *, std::streamsize);
168c4d71dc63 [project @ 2000-03-23 07:34:54 by jwe]
jwe
parents:
diff changeset
59
168c4d71dc63 [project @ 2000-03-23 07:34:54 by jwe]
jwe
parents:
diff changeset
60 std::streampos seekoff (std::streamoff, std::ios::seekdir,
168c4d71dc63 [project @ 2000-03-23 07:34:54 by jwe]
jwe
parents:
diff changeset
61 std::ios::openmode = std::ios::in | std::ios::out);
168c4d71dc63 [project @ 2000-03-23 07:34:54 by jwe]
jwe
parents:
diff changeset
62
168c4d71dc63 [project @ 2000-03-23 07:34:54 by jwe]
jwe
parents:
diff changeset
63 std::streampos seekpos (std::streampos,
168c4d71dc63 [project @ 2000-03-23 07:34:54 by jwe]
jwe
parents:
diff changeset
64 std::ios::openmode = std::ios::in | std::ios::out);
168c4d71dc63 [project @ 2000-03-23 07:34:54 by jwe]
jwe
parents:
diff changeset
65
168c4d71dc63 [project @ 2000-03-23 07:34:54 by jwe]
jwe
parents:
diff changeset
66 int sync (void);
168c4d71dc63 [project @ 2000-03-23 07:34:54 by jwe]
jwe
parents:
diff changeset
67 };
168c4d71dc63 [project @ 2000-03-23 07:34:54 by jwe]
jwe
parents:
diff changeset
68
168c4d71dc63 [project @ 2000-03-23 07:34:54 by jwe]
jwe
parents:
diff changeset
69 class
168c4d71dc63 [project @ 2000-03-23 07:34:54 by jwe]
jwe
parents:
diff changeset
70 i_c_file_ptr_stream : public std::istream
168c4d71dc63 [project @ 2000-03-23 07:34:54 by jwe]
jwe
parents:
diff changeset
71 {
168c4d71dc63 [project @ 2000-03-23 07:34:54 by jwe]
jwe
parents:
diff changeset
72 private:
168c4d71dc63 [project @ 2000-03-23 07:34:54 by jwe]
jwe
parents:
diff changeset
73
168c4d71dc63 [project @ 2000-03-23 07:34:54 by jwe]
jwe
parents:
diff changeset
74 c_file_ptr_buf f;
168c4d71dc63 [project @ 2000-03-23 07:34:54 by jwe]
jwe
parents:
diff changeset
75
168c4d71dc63 [project @ 2000-03-23 07:34:54 by jwe]
jwe
parents:
diff changeset
76 public:
168c4d71dc63 [project @ 2000-03-23 07:34:54 by jwe]
jwe
parents:
diff changeset
77
168c4d71dc63 [project @ 2000-03-23 07:34:54 by jwe]
jwe
parents:
diff changeset
78 i_c_file_ptr_stream (FILE* f_arg)
168c4d71dc63 [project @ 2000-03-23 07:34:54 by jwe]
jwe
parents:
diff changeset
79 : std::istream (), f (f_arg) { init (&f); }
168c4d71dc63 [project @ 2000-03-23 07:34:54 by jwe]
jwe
parents:
diff changeset
80
168c4d71dc63 [project @ 2000-03-23 07:34:54 by jwe]
jwe
parents:
diff changeset
81 c_file_ptr_buf *rdbuf (void) { return &f; }
168c4d71dc63 [project @ 2000-03-23 07:34:54 by jwe]
jwe
parents:
diff changeset
82 };
168c4d71dc63 [project @ 2000-03-23 07:34:54 by jwe]
jwe
parents:
diff changeset
83
168c4d71dc63 [project @ 2000-03-23 07:34:54 by jwe]
jwe
parents:
diff changeset
84 class
168c4d71dc63 [project @ 2000-03-23 07:34:54 by jwe]
jwe
parents:
diff changeset
85 o_c_file_ptr_stream : public std::ostream
168c4d71dc63 [project @ 2000-03-23 07:34:54 by jwe]
jwe
parents:
diff changeset
86 {
168c4d71dc63 [project @ 2000-03-23 07:34:54 by jwe]
jwe
parents:
diff changeset
87 private:
168c4d71dc63 [project @ 2000-03-23 07:34:54 by jwe]
jwe
parents:
diff changeset
88
168c4d71dc63 [project @ 2000-03-23 07:34:54 by jwe]
jwe
parents:
diff changeset
89 c_file_ptr_buf f;
168c4d71dc63 [project @ 2000-03-23 07:34:54 by jwe]
jwe
parents:
diff changeset
90
168c4d71dc63 [project @ 2000-03-23 07:34:54 by jwe]
jwe
parents:
diff changeset
91 public:
168c4d71dc63 [project @ 2000-03-23 07:34:54 by jwe]
jwe
parents:
diff changeset
92
168c4d71dc63 [project @ 2000-03-23 07:34:54 by jwe]
jwe
parents:
diff changeset
93 o_c_file_ptr_stream (FILE* f_arg)
168c4d71dc63 [project @ 2000-03-23 07:34:54 by jwe]
jwe
parents:
diff changeset
94 : std::ostream (), f (f_arg) { init (&f); }
168c4d71dc63 [project @ 2000-03-23 07:34:54 by jwe]
jwe
parents:
diff changeset
95
168c4d71dc63 [project @ 2000-03-23 07:34:54 by jwe]
jwe
parents:
diff changeset
96 c_file_ptr_buf *rdbuf (void) { return &f; }
168c4d71dc63 [project @ 2000-03-23 07:34:54 by jwe]
jwe
parents:
diff changeset
97 };
168c4d71dc63 [project @ 2000-03-23 07:34:54 by jwe]
jwe
parents:
diff changeset
98
168c4d71dc63 [project @ 2000-03-23 07:34:54 by jwe]
jwe
parents:
diff changeset
99 #endif
168c4d71dc63 [project @ 2000-03-23 07:34:54 by jwe]
jwe
parents:
diff changeset
100
168c4d71dc63 [project @ 2000-03-23 07:34:54 by jwe]
jwe
parents:
diff changeset
101 /*
168c4d71dc63 [project @ 2000-03-23 07:34:54 by jwe]
jwe
parents:
diff changeset
102 ;;; Local Variables: ***
168c4d71dc63 [project @ 2000-03-23 07:34:54 by jwe]
jwe
parents:
diff changeset
103 ;;; mode: C++ ***
168c4d71dc63 [project @ 2000-03-23 07:34:54 by jwe]
jwe
parents:
diff changeset
104 ;;; End: ***
168c4d71dc63 [project @ 2000-03-23 07:34:54 by jwe]
jwe
parents:
diff changeset
105 */
168c4d71dc63 [project @ 2000-03-23 07:34:54 by jwe]
jwe
parents:
diff changeset
106