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