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