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 { |
5073
|
53 CAST_BINOP_ARGS (octave_char_matrix_str&, const octave_matrix&); |
4915
|
54 |
|
55 if (Vwarn_num_to_str) |
|
56 gripe_implicit_conversion (v2.type_name (), v1.type_name ()); |
|
57 |
5073
|
58 return octave_value (v1.char_array_value (). concat (v2.array_value (), |
4915
|
59 ra_idx), true); |
|
60 } |
|
61 |
|
62 DEFCATOP (m_str, matrix, char_matrix_str) |
|
63 { |
5073
|
64 CAST_BINOP_ARGS (octave_matrix&, const octave_char_matrix_str&); |
4915
|
65 |
|
66 if (Vwarn_num_to_str) |
|
67 gripe_implicit_conversion (v1.type_name (), v2.type_name ()); |
|
68 |
5073
|
69 return octave_value (v1.array_value (). concat (v2.char_array_value (), |
4915
|
70 ra_idx), true); |
|
71 } |
|
72 |
4488
|
73 void |
|
74 install_str_m_ops (void) |
|
75 { |
|
76 INSTALL_ASSIGNOP (op_asn_eq, octave_char_matrix_str, octave_matrix, assign); |
4915
|
77 |
|
78 INSTALL_CATOP (octave_char_matrix_str, octave_matrix, str_m); |
|
79 INSTALL_CATOP (octave_matrix, octave_char_matrix_str, m_str); |
4488
|
80 } |
|
81 |
|
82 /* |
|
83 ;;; Local Variables: *** |
|
84 ;;; mode: C++ *** |
|
85 ;;; End: *** |
|
86 */ |