2376
|
1 /* |
|
2 |
|
3 Copyright (C) 1996 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 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 |
|
38 int octave_char_matrix::t_id = -1; |
|
39 |
|
40 const string octave_char_matrix::t_name ("char matrix"); |
|
41 |
|
42 bool |
|
43 octave_char_matrix::valid_as_scalar_index (void) const |
|
44 { |
|
45 // XXX FIXME XXX |
|
46 return false; |
|
47 } |
|
48 |
|
49 bool |
|
50 octave_char_matrix::valid_as_zero_index (void) const |
|
51 { |
|
52 // XXX FIXME XXX |
|
53 return false; |
|
54 } |
|
55 |
|
56 bool |
|
57 octave_char_matrix::is_true (void) const |
|
58 { |
|
59 // XXX FIXME XXX |
|
60 return false; |
|
61 |
|
62 #if 0 |
|
63 Matrix m = (matrix.all ()) . all (); |
|
64 |
|
65 return (m.rows () == 1 && m.columns () == 1 && m (0, 0) != 0.0); |
|
66 #endif |
|
67 } |
|
68 |
|
69 double |
|
70 octave_char_matrix::double_value (bool) const |
|
71 { |
|
72 double retval = octave_NaN; |
|
73 |
|
74 if ((rows () == 1 && columns () == 1) |
|
75 || (Vdo_fortran_indexing && rows () > 0 && columns () > 0)) |
|
76 retval = matrix (0, 0); |
|
77 else |
|
78 gripe_invalid_conversion ("character matrix", "real scalar"); |
|
79 |
|
80 return retval; |
|
81 } |
|
82 |
|
83 Complex |
|
84 octave_char_matrix::complex_value (bool) const |
|
85 { |
|
86 Complex retval (octave_NaN, octave_NaN); |
|
87 |
|
88 if ((rows () == 1 && columns () == 1) |
|
89 || (Vdo_fortran_indexing && rows () > 0 && columns () > 0)) |
|
90 retval = matrix (0, 0); |
|
91 else |
|
92 gripe_invalid_conversion ("character matrix", "complex scalar"); |
|
93 |
|
94 return retval; |
|
95 } |
|
96 |
|
97 void |
|
98 octave_char_matrix::print (ostream& os) |
|
99 { |
|
100 octave_print_internal (os, matrix, false, struct_indent); |
|
101 } |
|
102 |
|
103 /* |
|
104 ;;; Local Variables: *** |
|
105 ;;; mode: C++ *** |
|
106 ;;; End: *** |
|
107 */ |