4488
|
1 /* |
|
2 |
|
3 Copyright (C) 2003 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__) && defined (USE_PRAGMA_INTERFACE_IMPLEMENTATION) |
|
24 #pragma implementation |
|
25 #endif |
|
26 |
|
27 #ifdef HAVE_CONFIG_H |
|
28 #include <config.h> |
|
29 #endif |
|
30 |
|
31 #include "gripes.h" |
|
32 #include "oct-obj.h" |
|
33 #include "ov.h" |
|
34 #include "ov-re-mat.h" |
|
35 #include "ov-str-mat.h" |
|
36 #include "ov-typeinfo.h" |
|
37 #include "ops.h" |
|
38 |
|
39 DEFASSIGNOP (assign, char_matrix_str, octave_matrix) |
|
40 { |
|
41 CAST_BINOP_ARGS (octave_char_matrix_str&, const octave_matrix&); |
|
42 |
|
43 octave_value tmp = v2.convert_to_str_internal (false, false); |
|
44 |
|
45 if (! error_state) |
|
46 v1.assign (idx, tmp.char_matrix_value ()); |
|
47 |
|
48 return octave_value (); |
|
49 } |
|
50 |
4915
|
51 DEFCATOP (str_m, char_matrix_str, matrix) |
|
52 { |
|
53 CAST_BINOP_ARGS (const octave_char_matrix_str&, |
|
54 const octave_matrix&); |
|
55 |
|
56 if (Vwarn_num_to_str) |
|
57 gripe_implicit_conversion (v2.type_name (), v1.type_name ()); |
|
58 |
|
59 return octave_value (concat (v1.char_array_value (), v2.array_value (), |
|
60 ra_idx), true); |
|
61 } |
|
62 |
|
63 DEFCATOP (m_str, matrix, char_matrix_str) |
|
64 { |
|
65 CAST_BINOP_ARGS (const octave_matrix&, |
|
66 const octave_char_matrix_str&); |
|
67 |
|
68 if (Vwarn_num_to_str) |
|
69 gripe_implicit_conversion (v1.type_name (), v2.type_name ()); |
|
70 |
|
71 return octave_value (concat (v1.array_value (), v2.char_array_value (), |
|
72 ra_idx), true); |
|
73 } |
|
74 |
4488
|
75 void |
|
76 install_str_m_ops (void) |
|
77 { |
|
78 INSTALL_ASSIGNOP (op_asn_eq, octave_char_matrix_str, octave_matrix, assign); |
4915
|
79 |
|
80 INSTALL_CATOP (octave_char_matrix_str, octave_matrix, str_m); |
|
81 INSTALL_CATOP (octave_matrix, octave_char_matrix_str, m_str); |
4488
|
82 } |
|
83 |
|
84 /* |
|
85 ;;; Local Variables: *** |
|
86 ;;; mode: C++ *** |
|
87 ;;; End: *** |
|
88 */ |