2376
|
1 /* |
|
2 |
2847
|
3 Copyright (C) 1996, 1997 John W. Eaton |
2376
|
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 2, or (at your option) any |
|
10 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, write to the Free |
|
19 Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
|
20 |
|
21 */ |
|
22 |
|
23 #if defined (__GNUG__) |
|
24 #pragma implementation |
|
25 #endif |
|
26 |
|
27 #ifdef HAVE_CONFIG_H |
|
28 #include <config.h> |
|
29 #endif |
|
30 |
|
31 #include "lo-ieee.h" |
|
32 #include "mx-base.h" |
|
33 |
|
34 #include "ov-ch-mat.h" |
|
35 #include "gripes.h" |
|
36 #include "pr-output.h" |
|
37 |
2477
|
38 octave_allocator |
|
39 octave_char_matrix::allocator (sizeof (octave_char_matrix)); |
2376
|
40 |
2477
|
41 int |
|
42 octave_char_matrix::t_id (-1); |
|
43 |
|
44 const string |
|
45 octave_char_matrix::t_name ("char matrix"); |
2376
|
46 |
|
47 bool |
|
48 octave_char_matrix::valid_as_scalar_index (void) const |
|
49 { |
|
50 // XXX FIXME XXX |
|
51 return false; |
|
52 } |
|
53 |
|
54 bool |
|
55 octave_char_matrix::valid_as_zero_index (void) const |
|
56 { |
|
57 // XXX FIXME XXX |
|
58 return false; |
|
59 } |
|
60 |
|
61 bool |
|
62 octave_char_matrix::is_true (void) const |
|
63 { |
|
64 // XXX FIXME XXX |
|
65 return false; |
|
66 } |
|
67 |
|
68 double |
|
69 octave_char_matrix::double_value (bool) const |
|
70 { |
|
71 double retval = octave_NaN; |
|
72 |
|
73 if ((rows () == 1 && columns () == 1) |
|
74 || (Vdo_fortran_indexing && rows () > 0 && columns () > 0)) |
|
75 retval = matrix (0, 0); |
|
76 else |
|
77 gripe_invalid_conversion ("character matrix", "real scalar"); |
|
78 |
|
79 return retval; |
|
80 } |
|
81 |
|
82 Complex |
|
83 octave_char_matrix::complex_value (bool) const |
|
84 { |
|
85 Complex retval (octave_NaN, octave_NaN); |
|
86 |
|
87 if ((rows () == 1 && columns () == 1) |
|
88 || (Vdo_fortran_indexing && rows () > 0 && columns () > 0)) |
|
89 retval = matrix (0, 0); |
|
90 else |
|
91 gripe_invalid_conversion ("character matrix", "complex scalar"); |
|
92 |
|
93 return retval; |
|
94 } |
|
95 |
|
96 void |
2466
|
97 octave_char_matrix::print (ostream& os, bool pr_as_read_syntax) |
2376
|
98 { |
2466
|
99 octave_print_internal (os, matrix, pr_as_read_syntax, false, struct_indent); |
2376
|
100 } |
|
101 |
|
102 /* |
|
103 ;;; Local Variables: *** |
|
104 ;;; mode: C++ *** |
|
105 ;;; End: *** |
|
106 */ |