annotate src/ov-file.h @ 3219:30770ba4457a

[project @ 1998-11-13 03:44:31 by jwe]
author jwe
date Fri, 13 Nov 1998 03:44:36 +0000
parents 4e7bea116f24
children 585a8809fd9b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2901
e6d25bc478dd [project @ 1997-04-30 03:41:26 by jwe]
jwe
parents:
diff changeset
1 /*
e6d25bc478dd [project @ 1997-04-30 03:41:26 by jwe]
jwe
parents:
diff changeset
2
e6d25bc478dd [project @ 1997-04-30 03:41:26 by jwe]
jwe
parents:
diff changeset
3 Copyright (C) 1996, 1997 John W. Eaton
e6d25bc478dd [project @ 1997-04-30 03:41:26 by jwe]
jwe
parents:
diff changeset
4
e6d25bc478dd [project @ 1997-04-30 03:41:26 by jwe]
jwe
parents:
diff changeset
5 This file is part of Octave.
e6d25bc478dd [project @ 1997-04-30 03:41:26 by jwe]
jwe
parents:
diff changeset
6
e6d25bc478dd [project @ 1997-04-30 03:41:26 by jwe]
jwe
parents:
diff changeset
7 Octave is free software; you can redistribute it and/or modify it
e6d25bc478dd [project @ 1997-04-30 03:41:26 by jwe]
jwe
parents:
diff changeset
8 under the terms of the GNU General Public License as published by the
e6d25bc478dd [project @ 1997-04-30 03:41:26 by jwe]
jwe
parents:
diff changeset
9 Free Software Foundation; either version 2, or (at your option) any
e6d25bc478dd [project @ 1997-04-30 03:41:26 by jwe]
jwe
parents:
diff changeset
10 later version.
e6d25bc478dd [project @ 1997-04-30 03:41:26 by jwe]
jwe
parents:
diff changeset
11
e6d25bc478dd [project @ 1997-04-30 03:41:26 by jwe]
jwe
parents:
diff changeset
12 Octave is distributed in the hope that it will be useful, but WITHOUT
e6d25bc478dd [project @ 1997-04-30 03:41:26 by jwe]
jwe
parents:
diff changeset
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
e6d25bc478dd [project @ 1997-04-30 03:41:26 by jwe]
jwe
parents:
diff changeset
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
e6d25bc478dd [project @ 1997-04-30 03:41:26 by jwe]
jwe
parents:
diff changeset
15 for more details.
e6d25bc478dd [project @ 1997-04-30 03:41:26 by jwe]
jwe
parents:
diff changeset
16
e6d25bc478dd [project @ 1997-04-30 03:41:26 by jwe]
jwe
parents:
diff changeset
17 You should have received a copy of the GNU General Public License
e6d25bc478dd [project @ 1997-04-30 03:41:26 by jwe]
jwe
parents:
diff changeset
18 along with Octave; see the file COPYING. If not, write to the Free
e6d25bc478dd [project @ 1997-04-30 03:41:26 by jwe]
jwe
parents:
diff changeset
19 Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
e6d25bc478dd [project @ 1997-04-30 03:41:26 by jwe]
jwe
parents:
diff changeset
20
e6d25bc478dd [project @ 1997-04-30 03:41:26 by jwe]
jwe
parents:
diff changeset
21 */
e6d25bc478dd [project @ 1997-04-30 03:41:26 by jwe]
jwe
parents:
diff changeset
22
e6d25bc478dd [project @ 1997-04-30 03:41:26 by jwe]
jwe
parents:
diff changeset
23 #if !defined (octave_file_h)
e6d25bc478dd [project @ 1997-04-30 03:41:26 by jwe]
jwe
parents:
diff changeset
24 #define octave_file_h 1
e6d25bc478dd [project @ 1997-04-30 03:41:26 by jwe]
jwe
parents:
diff changeset
25
e6d25bc478dd [project @ 1997-04-30 03:41:26 by jwe]
jwe
parents:
diff changeset
26 #if defined (__GNUG__)
e6d25bc478dd [project @ 1997-04-30 03:41:26 by jwe]
jwe
parents:
diff changeset
27 #pragma interface
e6d25bc478dd [project @ 1997-04-30 03:41:26 by jwe]
jwe
parents:
diff changeset
28 #endif
e6d25bc478dd [project @ 1997-04-30 03:41:26 by jwe]
jwe
parents:
diff changeset
29
e6d25bc478dd [project @ 1997-04-30 03:41:26 by jwe]
jwe
parents:
diff changeset
30 #include <cstdlib>
e6d25bc478dd [project @ 1997-04-30 03:41:26 by jwe]
jwe
parents:
diff changeset
31
e6d25bc478dd [project @ 1997-04-30 03:41:26 by jwe]
jwe
parents:
diff changeset
32 #include <string>
e6d25bc478dd [project @ 1997-04-30 03:41:26 by jwe]
jwe
parents:
diff changeset
33
e6d25bc478dd [project @ 1997-04-30 03:41:26 by jwe]
jwe
parents:
diff changeset
34 class ostream;
e6d25bc478dd [project @ 1997-04-30 03:41:26 by jwe]
jwe
parents:
diff changeset
35
e6d25bc478dd [project @ 1997-04-30 03:41:26 by jwe]
jwe
parents:
diff changeset
36 #include "oct-alloc.h"
e6d25bc478dd [project @ 1997-04-30 03:41:26 by jwe]
jwe
parents:
diff changeset
37 #include "ov-base.h"
e6d25bc478dd [project @ 1997-04-30 03:41:26 by jwe]
jwe
parents:
diff changeset
38 #include "ov-typeinfo.h"
e6d25bc478dd [project @ 1997-04-30 03:41:26 by jwe]
jwe
parents:
diff changeset
39
e6d25bc478dd [project @ 1997-04-30 03:41:26 by jwe]
jwe
parents:
diff changeset
40 class tree_walker;
e6d25bc478dd [project @ 1997-04-30 03:41:26 by jwe]
jwe
parents:
diff changeset
41 class octave_stream;
e6d25bc478dd [project @ 1997-04-30 03:41:26 by jwe]
jwe
parents:
diff changeset
42 class octave_value;
e6d25bc478dd [project @ 1997-04-30 03:41:26 by jwe]
jwe
parents:
diff changeset
43 class octave_value_list;
e6d25bc478dd [project @ 1997-04-30 03:41:26 by jwe]
jwe
parents:
diff changeset
44
e6d25bc478dd [project @ 1997-04-30 03:41:26 by jwe]
jwe
parents:
diff changeset
45 // Lists.
e6d25bc478dd [project @ 1997-04-30 03:41:26 by jwe]
jwe
parents:
diff changeset
46
e6d25bc478dd [project @ 1997-04-30 03:41:26 by jwe]
jwe
parents:
diff changeset
47 class
e6d25bc478dd [project @ 1997-04-30 03:41:26 by jwe]
jwe
parents:
diff changeset
48 octave_file : public octave_base_value
e6d25bc478dd [project @ 1997-04-30 03:41:26 by jwe]
jwe
parents:
diff changeset
49 {
e6d25bc478dd [project @ 1997-04-30 03:41:26 by jwe]
jwe
parents:
diff changeset
50 public:
e6d25bc478dd [project @ 1997-04-30 03:41:26 by jwe]
jwe
parents:
diff changeset
51
e6d25bc478dd [project @ 1997-04-30 03:41:26 by jwe]
jwe
parents:
diff changeset
52 octave_file (void)
e6d25bc478dd [project @ 1997-04-30 03:41:26 by jwe]
jwe
parents:
diff changeset
53 : octave_base_value (), stream (0), number (-1) { }
e6d25bc478dd [project @ 1997-04-30 03:41:26 by jwe]
jwe
parents:
diff changeset
54
e6d25bc478dd [project @ 1997-04-30 03:41:26 by jwe]
jwe
parents:
diff changeset
55 octave_file (octave_stream *s, int n)
e6d25bc478dd [project @ 1997-04-30 03:41:26 by jwe]
jwe
parents:
diff changeset
56 : octave_base_value (), stream (s), number (n) { }
e6d25bc478dd [project @ 1997-04-30 03:41:26 by jwe]
jwe
parents:
diff changeset
57
e6d25bc478dd [project @ 1997-04-30 03:41:26 by jwe]
jwe
parents:
diff changeset
58 octave_file (const octave_file& f)
e6d25bc478dd [project @ 1997-04-30 03:41:26 by jwe]
jwe
parents:
diff changeset
59 : octave_base_value (), stream (f.stream), number (f.number) { }
e6d25bc478dd [project @ 1997-04-30 03:41:26 by jwe]
jwe
parents:
diff changeset
60
e6d25bc478dd [project @ 1997-04-30 03:41:26 by jwe]
jwe
parents:
diff changeset
61 ~octave_file (void) { }
e6d25bc478dd [project @ 1997-04-30 03:41:26 by jwe]
jwe
parents:
diff changeset
62
e6d25bc478dd [project @ 1997-04-30 03:41:26 by jwe]
jwe
parents:
diff changeset
63 octave_value *clone (void) { return new octave_file (*this); }
e6d25bc478dd [project @ 1997-04-30 03:41:26 by jwe]
jwe
parents:
diff changeset
64
e6d25bc478dd [project @ 1997-04-30 03:41:26 by jwe]
jwe
parents:
diff changeset
65 type_conv_fcn numeric_conversion_function (void) const;
e6d25bc478dd [project @ 1997-04-30 03:41:26 by jwe]
jwe
parents:
diff changeset
66
2916
4e7bea116f24 [project @ 1997-04-30 20:56:31 by jwe]
jwe
parents: 2901
diff changeset
67 double double_value (bool) const { return static_cast<double> (number); }
4e7bea116f24 [project @ 1997-04-30 20:56:31 by jwe]
jwe
parents: 2901
diff changeset
68
4e7bea116f24 [project @ 1997-04-30 20:56:31 by jwe]
jwe
parents: 2901
diff changeset
69 double scalar_value (bool) const { return static_cast<double> (number); }
2901
e6d25bc478dd [project @ 1997-04-30 03:41:26 by jwe]
jwe
parents:
diff changeset
70
e6d25bc478dd [project @ 1997-04-30 03:41:26 by jwe]
jwe
parents:
diff changeset
71 octave_stream *stream_value (void) const { return stream; }
e6d25bc478dd [project @ 1997-04-30 03:41:26 by jwe]
jwe
parents:
diff changeset
72
e6d25bc478dd [project @ 1997-04-30 03:41:26 by jwe]
jwe
parents:
diff changeset
73 int stream_number (void) const { return number; }
e6d25bc478dd [project @ 1997-04-30 03:41:26 by jwe]
jwe
parents:
diff changeset
74
e6d25bc478dd [project @ 1997-04-30 03:41:26 by jwe]
jwe
parents:
diff changeset
75 bool is_defined (void) const { return true; }
e6d25bc478dd [project @ 1997-04-30 03:41:26 by jwe]
jwe
parents:
diff changeset
76
e6d25bc478dd [project @ 1997-04-30 03:41:26 by jwe]
jwe
parents:
diff changeset
77 bool is_file (void) const { return true; }
e6d25bc478dd [project @ 1997-04-30 03:41:26 by jwe]
jwe
parents:
diff changeset
78
e6d25bc478dd [project @ 1997-04-30 03:41:26 by jwe]
jwe
parents:
diff changeset
79 void print (ostream& os, bool pr_as_read_syntax = false) const;
e6d25bc478dd [project @ 1997-04-30 03:41:26 by jwe]
jwe
parents:
diff changeset
80
e6d25bc478dd [project @ 1997-04-30 03:41:26 by jwe]
jwe
parents:
diff changeset
81 void print_raw (ostream& os, bool pr_as_read_syntax = false) const;
e6d25bc478dd [project @ 1997-04-30 03:41:26 by jwe]
jwe
parents:
diff changeset
82
e6d25bc478dd [project @ 1997-04-30 03:41:26 by jwe]
jwe
parents:
diff changeset
83 bool print_name_tag (ostream& os, const string& name) const;
e6d25bc478dd [project @ 1997-04-30 03:41:26 by jwe]
jwe
parents:
diff changeset
84
e6d25bc478dd [project @ 1997-04-30 03:41:26 by jwe]
jwe
parents:
diff changeset
85 private:
e6d25bc478dd [project @ 1997-04-30 03:41:26 by jwe]
jwe
parents:
diff changeset
86
e6d25bc478dd [project @ 1997-04-30 03:41:26 by jwe]
jwe
parents:
diff changeset
87 // The stream object.
e6d25bc478dd [project @ 1997-04-30 03:41:26 by jwe]
jwe
parents:
diff changeset
88 octave_stream *stream;
e6d25bc478dd [project @ 1997-04-30 03:41:26 by jwe]
jwe
parents:
diff changeset
89
e6d25bc478dd [project @ 1997-04-30 03:41:26 by jwe]
jwe
parents:
diff changeset
90 // The number of the beast.
e6d25bc478dd [project @ 1997-04-30 03:41:26 by jwe]
jwe
parents:
diff changeset
91 int number;
e6d25bc478dd [project @ 1997-04-30 03:41:26 by jwe]
jwe
parents:
diff changeset
92
3219
30770ba4457a [project @ 1998-11-13 03:44:31 by jwe]
jwe
parents: 2916
diff changeset
93 DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA
2901
e6d25bc478dd [project @ 1997-04-30 03:41:26 by jwe]
jwe
parents:
diff changeset
94
3219
30770ba4457a [project @ 1998-11-13 03:44:31 by jwe]
jwe
parents: 2916
diff changeset
95 DECLARE_OCTAVE_ALLOCATOR
2901
e6d25bc478dd [project @ 1997-04-30 03:41:26 by jwe]
jwe
parents:
diff changeset
96 };
e6d25bc478dd [project @ 1997-04-30 03:41:26 by jwe]
jwe
parents:
diff changeset
97
e6d25bc478dd [project @ 1997-04-30 03:41:26 by jwe]
jwe
parents:
diff changeset
98 #endif
e6d25bc478dd [project @ 1997-04-30 03:41:26 by jwe]
jwe
parents:
diff changeset
99
e6d25bc478dd [project @ 1997-04-30 03:41:26 by jwe]
jwe
parents:
diff changeset
100 /*
e6d25bc478dd [project @ 1997-04-30 03:41:26 by jwe]
jwe
parents:
diff changeset
101 ;;; Local Variables: ***
e6d25bc478dd [project @ 1997-04-30 03:41:26 by jwe]
jwe
parents:
diff changeset
102 ;;; mode: C++ ***
e6d25bc478dd [project @ 1997-04-30 03:41:26 by jwe]
jwe
parents:
diff changeset
103 ;;; End: ***
e6d25bc478dd [project @ 1997-04-30 03:41:26 by jwe]
jwe
parents:
diff changeset
104 */