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 #ifdef HAVE_CONFIG_H |
|
24 #include <config.h> |
|
25 #endif |
|
26 |
3503
|
27 #include <iostream> |
2901
|
28 |
2376
|
29 #include "lo-ieee.h" |
|
30 #include "mx-base.h" |
|
31 |
3219
|
32 #include "ov-base.h" |
|
33 #include "ov-base-mat.h" |
|
34 #include "ov-base-mat.cc" |
2376
|
35 #include "ov-ch-mat.h" |
|
36 #include "gripes.h" |
|
37 #include "pr-output.h" |
|
38 |
4513
|
39 template class octave_base_matrix<charNDArray>; |
2376
|
40 |
3219
|
41 DEFINE_OCTAVE_ALLOCATOR (octave_char_matrix); |
2477
|
42 |
4612
|
43 DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_char_matrix, |
|
44 "char matrix", "int8"); |
2376
|
45 |
|
46 bool |
|
47 octave_char_matrix::valid_as_scalar_index (void) const |
|
48 { |
3136
|
49 bool retval = false; |
|
50 error ("octave_char_matrix::valid_as_scalar_index(): not implemented"); |
|
51 return retval; |
2376
|
52 } |
|
53 |
|
54 double |
|
55 octave_char_matrix::double_value (bool) const |
|
56 { |
4102
|
57 double retval = lo_ieee_nan_value (); |
2376
|
58 |
4455
|
59 // XXX FIXME XXX -- maybe this should be a function, valid_as_scalar() |
|
60 if (rows () > 0 && columns () > 0) |
|
61 { |
|
62 // XXX FIXME XXX -- is warn_fortran_indexing the right variable here? |
|
63 if (Vwarn_fortran_indexing) |
|
64 gripe_implicit_conversion ("character matrix", "real scalar"); |
|
65 |
|
66 retval = matrix (0, 0); |
|
67 } |
2376
|
68 else |
|
69 gripe_invalid_conversion ("character matrix", "real scalar"); |
|
70 |
|
71 return retval; |
|
72 } |
|
73 |
|
74 Complex |
|
75 octave_char_matrix::complex_value (bool) const |
|
76 { |
4102
|
77 double tmp = lo_ieee_nan_value (); |
|
78 |
|
79 Complex retval (tmp, tmp); |
2376
|
80 |
4455
|
81 // XXX FIXME XXX -- maybe this should be a function, valid_as_scalar() |
|
82 if (rows () > 0 && columns () > 0) |
|
83 { |
|
84 // XXX FIXME XXX -- is warn_fortran_indexing the right variable here? |
|
85 if (Vwarn_fortran_indexing) |
|
86 gripe_implicit_conversion ("character matrix", "complex scalar"); |
|
87 |
|
88 retval = matrix (0, 0); |
|
89 } |
2376
|
90 else |
|
91 gripe_invalid_conversion ("character matrix", "complex scalar"); |
|
92 |
|
93 return retval; |
|
94 } |
|
95 |
4643
|
96 void |
|
97 octave_char_matrix::print_raw (std::ostream& os, |
|
98 bool pr_as_read_syntax) const |
|
99 { |
|
100 octave_print_internal (os, matrix, pr_as_read_syntax, |
|
101 current_print_indent_level ()); |
|
102 } |
|
103 |
2376
|
104 /* |
|
105 ;;; Local Variables: *** |
|
106 ;;; mode: C++ *** |
|
107 ;;; End: *** |
|
108 */ |