annotate src/ov-typeinfo.cc @ 7948:af10baa63915 ss-3-1-50

3.1.50 snapshot
author John W. Eaton <jwe@octave.org>
date Fri, 18 Jul 2008 17:42:48 -0400
parents 5861b95e9879
children 7be5917f181a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1 /*
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
2
7017
a1dbe9d80eee [project @ 2007-10-12 21:27:11 by jwe]
jwe
parents: 7016
diff changeset
3 Copyright (C) 1996, 1997, 1998, 2000, 2002, 2003, 2004, 2005, 2006,
a1dbe9d80eee [project @ 2007-10-12 21:27:11 by jwe]
jwe
parents: 7016
diff changeset
4 2007 John W. Eaton
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
5
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
6 This file is part of Octave.
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
7
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
8 Octave is free software; you can redistribute it and/or modify it
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
9 under the terms of the GNU General Public License as published by the
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6708
diff changeset
10 Free Software Foundation; either version 3 of the License, or (at your
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6708
diff changeset
11 option) any later version.
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
12
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
13 Octave is distributed in the hope that it will be useful, but WITHOUT
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
16 for more details.
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
17
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
18 You should have received a copy of the GNU General Public License
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6708
diff changeset
19 along with Octave; see the file COPYING. If not, see
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6708
diff changeset
20 <http://www.gnu.org/licenses/>.
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
21
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
22 */
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
23
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
24 #ifdef HAVE_CONFIG_H
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
25 #include <config.h>
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
26 #endif
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
27
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
28 #include "ov-typeinfo.h"
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
29
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
30 #include "defun.h"
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
31 #include "error.h"
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
32 #include "oct-obj.h"
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
33
2479
26e9ee533d87 [project @ 1996-11-07 17:46:14 by jwe]
jwe
parents: 2457
diff changeset
34 const int
26e9ee533d87 [project @ 1996-11-07 17:46:14 by jwe]
jwe
parents: 2457
diff changeset
35 octave_value_typeinfo::init_tab_sz (16);
26e9ee533d87 [project @ 1996-11-07 17:46:14 by jwe]
jwe
parents: 2457
diff changeset
36
26e9ee533d87 [project @ 1996-11-07 17:46:14 by jwe]
jwe
parents: 2457
diff changeset
37 octave_value_typeinfo *
26e9ee533d87 [project @ 1996-11-07 17:46:14 by jwe]
jwe
parents: 2457
diff changeset
38 octave_value_typeinfo::instance (0);
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
39
4515
228d2d5b6d66 [project @ 2003-09-19 21:53:15 by jwe]
jwe
parents: 4508
diff changeset
40 #include <Array.h>
228d2d5b6d66 [project @ 2003-09-19 21:53:15 by jwe]
jwe
parents: 4508
diff changeset
41 #include <Array2.h>
228d2d5b6d66 [project @ 2003-09-19 21:53:15 by jwe]
jwe
parents: 4508
diff changeset
42 #include <Array3.h>
228d2d5b6d66 [project @ 2003-09-19 21:53:15 by jwe]
jwe
parents: 4508
diff changeset
43
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
44 #include <Array.cc>
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
45
7433
402168152bb9 [project @ 2008-01-31 18:59:09 by dbateman]
dbateman
parents: 7336
diff changeset
46 NO_INSTANTIATE_ARRAY_SORT (octave_value_typeinfo::unary_op_fcn);
6708
0ce71beb1cf3 [project @ 2007-06-13 06:40:48 by jwe]
jwe
parents: 6109
diff changeset
47 INSTANTIATE_ARRAY (octave_value_typeinfo::unary_op_fcn, );
5759
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5307
diff changeset
48 template class Array2<octave_value_typeinfo::unary_op_fcn>;
3203
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
49
7433
402168152bb9 [project @ 2008-01-31 18:59:09 by dbateman]
dbateman
parents: 7336
diff changeset
50 NO_INSTANTIATE_ARRAY_SORT (octave_value_typeinfo::non_const_unary_op_fcn);
6708
0ce71beb1cf3 [project @ 2007-06-13 06:40:48 by jwe]
jwe
parents: 6109
diff changeset
51 INSTANTIATE_ARRAY (octave_value_typeinfo::non_const_unary_op_fcn, );
5759
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5307
diff changeset
52 template class Array2<octave_value_typeinfo::non_const_unary_op_fcn>;
3203
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
53
7433
402168152bb9 [project @ 2008-01-31 18:59:09 by dbateman]
dbateman
parents: 7336
diff changeset
54 NO_INSTANTIATE_ARRAY_SORT (octave_value_typeinfo::binary_op_fcn);
6708
0ce71beb1cf3 [project @ 2007-06-13 06:40:48 by jwe]
jwe
parents: 6109
diff changeset
55 INSTANTIATE_ARRAY (octave_value_typeinfo::binary_op_fcn, );
5759
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5307
diff changeset
56 template class Array2<octave_value_typeinfo::binary_op_fcn>;
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5307
diff changeset
57 template class Array3<octave_value_typeinfo::binary_op_fcn>;
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
58
7433
402168152bb9 [project @ 2008-01-31 18:59:09 by dbateman]
dbateman
parents: 7336
diff changeset
59 NO_INSTANTIATE_ARRAY_SORT (octave_value_typeinfo::cat_op_fcn);
6708
0ce71beb1cf3 [project @ 2007-06-13 06:40:48 by jwe]
jwe
parents: 6109
diff changeset
60 INSTANTIATE_ARRAY (octave_value_typeinfo::cat_op_fcn, );
5759
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5307
diff changeset
61 template class Array2<octave_value_typeinfo::cat_op_fcn>;
4915
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4901
diff changeset
62
7433
402168152bb9 [project @ 2008-01-31 18:59:09 by dbateman]
dbateman
parents: 7336
diff changeset
63 NO_INSTANTIATE_ARRAY_SORT (octave_value_typeinfo::assign_op_fcn);
6708
0ce71beb1cf3 [project @ 2007-06-13 06:40:48 by jwe]
jwe
parents: 6109
diff changeset
64 INSTANTIATE_ARRAY (octave_value_typeinfo::assign_op_fcn, );
5759
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5307
diff changeset
65 template class Array2<octave_value_typeinfo::assign_op_fcn>;
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5307
diff changeset
66 template class Array3<octave_value_typeinfo::assign_op_fcn>;
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
67
7433
402168152bb9 [project @ 2008-01-31 18:59:09 by dbateman]
dbateman
parents: 7336
diff changeset
68 NO_INSTANTIATE_ARRAY_SORT (octave_value_typeinfo::assignany_op_fcn);
6708
0ce71beb1cf3 [project @ 2007-06-13 06:40:48 by jwe]
jwe
parents: 6109
diff changeset
69 INSTANTIATE_ARRAY (octave_value_typeinfo::assignany_op_fcn, );
5891
beae0c02f101 [project @ 2006-07-15 14:19:58 by jwe]
jwe
parents: 5823
diff changeset
70 template class Array2<octave_value_typeinfo::assignany_op_fcn>;
beae0c02f101 [project @ 2006-07-15 14:19:58 by jwe]
jwe
parents: 5823
diff changeset
71
7433
402168152bb9 [project @ 2008-01-31 18:59:09 by dbateman]
dbateman
parents: 7336
diff changeset
72 NO_INSTANTIATE_ARRAY_SORT (octave_base_value::type_conv_fcn);
6708
0ce71beb1cf3 [project @ 2007-06-13 06:40:48 by jwe]
jwe
parents: 6109
diff changeset
73 INSTANTIATE_ARRAY (octave_base_value::type_conv_fcn, );
5759
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5307
diff changeset
74 template class Array2<octave_base_value::type_conv_fcn>;
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
75
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents: 2882
diff changeset
76 bool
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents: 2882
diff changeset
77 octave_value_typeinfo::instance_ok (void)
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents: 2882
diff changeset
78 {
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents: 2882
diff changeset
79 bool retval = true;
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents: 2882
diff changeset
80 if (! instance)
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents: 2882
diff changeset
81 instance = new octave_value_typeinfo ();
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents: 2882
diff changeset
82
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents: 2882
diff changeset
83 if (! instance)
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents: 2882
diff changeset
84 {
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents: 2882
diff changeset
85 ::error ("unable to create value type info object!");
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents: 2882
diff changeset
86
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents: 2882
diff changeset
87 retval = false;
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents: 2882
diff changeset
88 }
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents: 2882
diff changeset
89
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents: 2882
diff changeset
90 return retval;
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents: 2882
diff changeset
91 }
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents: 2882
diff changeset
92
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
93 int
4612
d44675070f1a [project @ 2003-11-14 19:49:56 by jwe]
jwe
parents: 4594
diff changeset
94 octave_value_typeinfo::register_type (const std::string& t_name,
4640
2d237a76dbdd [project @ 2003-11-22 11:24:44 by jwe]
jwe
parents: 4625
diff changeset
95 const std::string& c_name,
2d237a76dbdd [project @ 2003-11-22 11:24:44 by jwe]
jwe
parents: 4625
diff changeset
96 const octave_value& val)
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
97 {
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents: 2882
diff changeset
98 return (instance_ok ())
4640
2d237a76dbdd [project @ 2003-11-22 11:24:44 by jwe]
jwe
parents: 4625
diff changeset
99 ? instance->do_register_type (t_name, c_name, val) : -1;
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
100 }
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
101
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
102 bool
7336
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
103 octave_value_typeinfo::register_unary_class_op (octave_value::unary_op op,
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
104 octave_value_typeinfo::unary_class_op_fcn f)
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
105 {
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
106 return (instance_ok ())
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
107 ? instance->do_register_unary_class_op (op, f) : false;
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
108 }
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
109
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
110 bool
3203
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
111 octave_value_typeinfo::register_unary_op (octave_value::unary_op op,
5759
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5307
diff changeset
112 int t, octave_value_typeinfo::unary_op_fcn f)
3203
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
113 {
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
114 return (instance_ok ())
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
115 ? instance->do_register_unary_op (op, t, f) : false;
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
116 }
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
117
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
118 bool
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
119 octave_value_typeinfo::register_non_const_unary_op (octave_value::unary_op op,
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
120 int t,
5759
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5307
diff changeset
121 octave_value_typeinfo::non_const_unary_op_fcn f)
3203
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
122 {
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
123 return (instance_ok ())
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
124 ? instance->do_register_non_const_unary_op (op, t, f) : false;
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
125 }
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
126
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
127 bool
7336
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
128 octave_value_typeinfo::register_binary_class_op (octave_value::binary_op op,
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
129 octave_value_typeinfo::binary_class_op_fcn f)
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
130 {
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
131 return (instance_ok ())
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
132 ? instance->do_register_binary_class_op (op, f) : false;
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
133 }
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
134
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
135 bool
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
136 octave_value_typeinfo::register_binary_op (octave_value::binary_op op,
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
137 int t1, int t2,
5759
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5307
diff changeset
138 octave_value_typeinfo::binary_op_fcn f)
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
139 {
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents: 2882
diff changeset
140 return (instance_ok ())
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents: 2882
diff changeset
141 ? instance->do_register_binary_op (op, t1, t2, f) : false;
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
142 }
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
143
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
144 bool
7800
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7433
diff changeset
145 octave_value_typeinfo::register_binary_class_op (octave_value::compound_binary_op op,
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7433
diff changeset
146 octave_value_typeinfo::binary_class_op_fcn f)
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7433
diff changeset
147 {
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7433
diff changeset
148 return (instance_ok ())
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7433
diff changeset
149 ? instance->do_register_binary_class_op (op, f) : false;
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7433
diff changeset
150 }
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7433
diff changeset
151
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7433
diff changeset
152 bool
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7433
diff changeset
153 octave_value_typeinfo::register_binary_op (octave_value::compound_binary_op op,
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7433
diff changeset
154 int t1, int t2,
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7433
diff changeset
155 octave_value_typeinfo::binary_op_fcn f)
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7433
diff changeset
156 {
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7433
diff changeset
157 return (instance_ok ())
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7433
diff changeset
158 ? instance->do_register_binary_op (op, t1, t2, f) : false;
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7433
diff changeset
159 }
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7433
diff changeset
160
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7433
diff changeset
161 bool
5759
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5307
diff changeset
162 octave_value_typeinfo::register_cat_op (int t1, int t2, octave_value_typeinfo::cat_op_fcn f)
4915
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4901
diff changeset
163 {
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4901
diff changeset
164 return (instance_ok ())
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4901
diff changeset
165 ? instance->do_register_cat_op (t1, t2, f) : false;
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4901
diff changeset
166 }
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4901
diff changeset
167
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4901
diff changeset
168 bool
2882
05926e1b367d [project @ 1997-04-24 09:48:59 by jwe]
jwe
parents: 2847
diff changeset
169 octave_value_typeinfo::register_assign_op (octave_value::assign_op op,
05926e1b367d [project @ 1997-04-24 09:48:59 by jwe]
jwe
parents: 2847
diff changeset
170 int t_lhs, int t_rhs,
5759
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5307
diff changeset
171 octave_value_typeinfo::assign_op_fcn f)
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
172 {
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents: 2882
diff changeset
173 return (instance_ok ())
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents: 2882
diff changeset
174 ? instance->do_register_assign_op (op, t_lhs, t_rhs, f) : -1;
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
175 }
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
176
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
177 bool
3196
3ac3e8edc258 [project @ 1998-10-28 23:04:39 by jwe]
jwe
parents: 3014
diff changeset
178 octave_value_typeinfo::register_assignany_op (octave_value::assign_op op,
5759
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5307
diff changeset
179 int t_lhs, octave_value_typeinfo::assignany_op_fcn f)
3196
3ac3e8edc258 [project @ 1998-10-28 23:04:39 by jwe]
jwe
parents: 3014
diff changeset
180 {
3ac3e8edc258 [project @ 1998-10-28 23:04:39 by jwe]
jwe
parents: 3014
diff changeset
181 return (instance_ok ())
3ac3e8edc258 [project @ 1998-10-28 23:04:39 by jwe]
jwe
parents: 3014
diff changeset
182 ? instance->do_register_assignany_op (op, t_lhs, f) : -1;
3ac3e8edc258 [project @ 1998-10-28 23:04:39 by jwe]
jwe
parents: 3014
diff changeset
183 }
3ac3e8edc258 [project @ 1998-10-28 23:04:39 by jwe]
jwe
parents: 3014
diff changeset
184
3ac3e8edc258 [project @ 1998-10-28 23:04:39 by jwe]
jwe
parents: 3014
diff changeset
185 bool
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
186 octave_value_typeinfo::register_pref_assign_conv (int t_lhs, int t_rhs,
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
187 int t_result)
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
188 {
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents: 2882
diff changeset
189 return (instance_ok ())
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents: 2882
diff changeset
190 ? instance->do_register_pref_assign_conv (t_lhs, t_rhs, t_result) : false;
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
191 }
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
192
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
193 bool
4901
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4687
diff changeset
194 octave_value_typeinfo::register_type_conv_op (int t, int t_result,
5759
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5307
diff changeset
195 octave_base_value::type_conv_fcn f)
4901
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4687
diff changeset
196 {
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4687
diff changeset
197 return (instance_ok ())
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4687
diff changeset
198 ? instance->do_register_type_conv_op (t, t_result, f) : false;
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4687
diff changeset
199 }
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4687
diff changeset
200
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4687
diff changeset
201 bool
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
202 octave_value_typeinfo::register_widening_op (int t, int t_result,
5759
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5307
diff changeset
203 octave_base_value::type_conv_fcn f)
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
204 {
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents: 2882
diff changeset
205 return (instance_ok ())
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents: 2882
diff changeset
206 ? instance->do_register_widening_op (t, t_result, f) : false;
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
207 }
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
208
5775
ace8d8d26933 [project @ 2006-04-24 19:13:06 by jwe]
jwe
parents: 5759
diff changeset
209 // FIXME -- we should also store all class names and provide a
4687
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4640
diff changeset
210 // way to list them (calling class with nargin == 0?).
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4640
diff changeset
211
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
212 int
4612
d44675070f1a [project @ 2003-11-14 19:49:56 by jwe]
jwe
parents: 4594
diff changeset
213 octave_value_typeinfo::do_register_type (const std::string& t_name,
4640
2d237a76dbdd [project @ 2003-11-22 11:24:44 by jwe]
jwe
parents: 4625
diff changeset
214 const std::string& c_name,
2d237a76dbdd [project @ 2003-11-22 11:24:44 by jwe]
jwe
parents: 4625
diff changeset
215 const octave_value& val)
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
216 {
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
217 int i = 0;
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
218
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
219 for (i = 0; i < num_types; i++)
4612
d44675070f1a [project @ 2003-11-14 19:49:56 by jwe]
jwe
parents: 4594
diff changeset
220 if (t_name == types (i))
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
221 return i;
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
222
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
223 int len = types.length ();
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
224
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
225 if (i == len)
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
226 {
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
227 len *= 2;
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
228
4625
87c01a296263 [project @ 2003-11-15 12:51:20 by jwe]
jwe
parents: 4612
diff changeset
229 types.resize (len, std::string ());
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
230
4640
2d237a76dbdd [project @ 2003-11-22 11:24:44 by jwe]
jwe
parents: 4625
diff changeset
231 vals.resize (len, octave_value ());
2d237a76dbdd [project @ 2003-11-22 11:24:44 by jwe]
jwe
parents: 4625
diff changeset
232
3203
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
233 unary_ops.resize (static_cast<int> (octave_value::num_unary_ops),
5759
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5307
diff changeset
234 len, static_cast<octave_value_typeinfo::unary_op_fcn> (0));
3203
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
235
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
236 non_const_unary_ops.resize
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
237 (static_cast<int> (octave_value::num_unary_ops),
5759
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5307
diff changeset
238 len, static_cast<octave_value_typeinfo::non_const_unary_op_fcn> (0));
3203
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
239
2800
9aeba8e006a4 [project @ 1997-03-09 09:50:20 by jwe]
jwe
parents: 2479
diff changeset
240 binary_ops.resize (static_cast<int> (octave_value::num_binary_ops),
5759
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5307
diff changeset
241 len, len, static_cast<octave_value_typeinfo::binary_op_fcn> (0));
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
242
7800
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7433
diff changeset
243 compound_binary_ops.resize (static_cast<int> (octave_value::num_compound_binary_ops),
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7433
diff changeset
244 len, len, static_cast<octave_value_typeinfo::binary_op_fcn> (0));
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7433
diff changeset
245
5759
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5307
diff changeset
246 cat_ops.resize (len, len, static_cast<octave_value_typeinfo::cat_op_fcn> (0));
4915
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4901
diff changeset
247
2882
05926e1b367d [project @ 1997-04-24 09:48:59 by jwe]
jwe
parents: 2847
diff changeset
248 assign_ops.resize (static_cast<int> (octave_value::num_assign_ops),
5759
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5307
diff changeset
249 len, len, static_cast<octave_value_typeinfo::assign_op_fcn> (0));
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
250
3196
3ac3e8edc258 [project @ 1998-10-28 23:04:39 by jwe]
jwe
parents: 3014
diff changeset
251 assignany_ops.resize (static_cast<int> (octave_value::num_assign_ops),
5759
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5307
diff changeset
252 len, static_cast<octave_value_typeinfo::assignany_op_fcn> (0));
3196
3ac3e8edc258 [project @ 1998-10-28 23:04:39 by jwe]
jwe
parents: 3014
diff changeset
253
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
254 pref_assign_conv.resize (len, len, -1);
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
255
5759
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5307
diff changeset
256 type_conv_ops.resize (len, len, static_cast<octave_base_value::type_conv_fcn> (0));
4901
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4687
diff changeset
257
5759
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5307
diff changeset
258 widening_ops.resize (len, len, static_cast<octave_base_value::type_conv_fcn> (0));
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
259 }
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
260
4612
d44675070f1a [project @ 2003-11-14 19:49:56 by jwe]
jwe
parents: 4594
diff changeset
261 types (i) = t_name;
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
262
4640
2d237a76dbdd [project @ 2003-11-22 11:24:44 by jwe]
jwe
parents: 4625
diff changeset
263 vals (i) = val;
2d237a76dbdd [project @ 2003-11-22 11:24:44 by jwe]
jwe
parents: 4625
diff changeset
264
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
265 num_types++;
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
266
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
267 return i;
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
268 }
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
269
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
270 bool
7336
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
271 octave_value_typeinfo::do_register_unary_class_op (octave_value::unary_op op,
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
272 octave_value_typeinfo::unary_class_op_fcn f)
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
273 {
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
274 if (lookup_unary_class_op (op))
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
275 {
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
276 std::string op_name = octave_value::unary_op_as_string (op);
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
277
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
278 warning ("duplicate unary operator `%s' for class dispatch",
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
279 op_name.c_str ());
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
280 }
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
281
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
282 unary_class_ops.checkelem (static_cast<int> (op)) = f;
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
283
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
284 return false;
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
285 }
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
286
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
287 bool
3203
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
288 octave_value_typeinfo::do_register_unary_op (octave_value::unary_op op,
5759
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5307
diff changeset
289 int t, octave_value_typeinfo::unary_op_fcn f)
3203
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
290 {
4508
2bc437206787 [project @ 2003-09-11 01:06:43 by jwe]
jwe
parents: 4192
diff changeset
291 if (lookup_unary_op (op, t))
2bc437206787 [project @ 2003-09-11 01:06:43 by jwe]
jwe
parents: 4192
diff changeset
292 {
2bc437206787 [project @ 2003-09-11 01:06:43 by jwe]
jwe
parents: 4192
diff changeset
293 std::string op_name = octave_value::unary_op_as_string (op);
2bc437206787 [project @ 2003-09-11 01:06:43 by jwe]
jwe
parents: 4192
diff changeset
294 std::string type_name = types(t);
2bc437206787 [project @ 2003-09-11 01:06:43 by jwe]
jwe
parents: 4192
diff changeset
295
2bc437206787 [project @ 2003-09-11 01:06:43 by jwe]
jwe
parents: 4192
diff changeset
296 warning ("duplicate unary operator `%s' for type `%s'",
2bc437206787 [project @ 2003-09-11 01:06:43 by jwe]
jwe
parents: 4192
diff changeset
297 op_name.c_str (), type_name.c_str ());
2bc437206787 [project @ 2003-09-11 01:06:43 by jwe]
jwe
parents: 4192
diff changeset
298 }
2bc437206787 [project @ 2003-09-11 01:06:43 by jwe]
jwe
parents: 4192
diff changeset
299
3203
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
300 unary_ops.checkelem (static_cast<int> (op), t) = f;
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
301
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
302 return false;
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
303 }
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
304
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
305 bool
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
306 octave_value_typeinfo::do_register_non_const_unary_op
5759
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5307
diff changeset
307 (octave_value::unary_op op, int t, octave_value_typeinfo::non_const_unary_op_fcn f)
3203
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
308 {
4508
2bc437206787 [project @ 2003-09-11 01:06:43 by jwe]
jwe
parents: 4192
diff changeset
309 if (lookup_non_const_unary_op (op, t))
2bc437206787 [project @ 2003-09-11 01:06:43 by jwe]
jwe
parents: 4192
diff changeset
310 {
2bc437206787 [project @ 2003-09-11 01:06:43 by jwe]
jwe
parents: 4192
diff changeset
311 std::string op_name = octave_value::unary_op_as_string (op);
2bc437206787 [project @ 2003-09-11 01:06:43 by jwe]
jwe
parents: 4192
diff changeset
312 std::string type_name = types(t);
2bc437206787 [project @ 2003-09-11 01:06:43 by jwe]
jwe
parents: 4192
diff changeset
313
2bc437206787 [project @ 2003-09-11 01:06:43 by jwe]
jwe
parents: 4192
diff changeset
314 warning ("duplicate unary operator `%s' for type `%s'",
2bc437206787 [project @ 2003-09-11 01:06:43 by jwe]
jwe
parents: 4192
diff changeset
315 op_name.c_str (), type_name.c_str ());
2bc437206787 [project @ 2003-09-11 01:06:43 by jwe]
jwe
parents: 4192
diff changeset
316 }
2bc437206787 [project @ 2003-09-11 01:06:43 by jwe]
jwe
parents: 4192
diff changeset
317
3203
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
318 non_const_unary_ops.checkelem (static_cast<int> (op), t) = f;
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
319
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
320 return false;
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
321 }
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
322
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
323 bool
7336
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
324 octave_value_typeinfo::do_register_binary_class_op (octave_value::binary_op op,
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
325 octave_value_typeinfo::binary_class_op_fcn f)
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
326 {
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
327 if (lookup_binary_class_op (op))
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
328 {
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
329 std::string op_name = octave_value::binary_op_as_string (op);
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
330
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
331 warning ("duplicate binary operator `%s' for class dispatch",
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
332 op_name.c_str ());
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
333 }
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
334
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
335 binary_class_ops.checkelem (static_cast<int> (op)) = f;
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
336
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
337 return false;
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
338 }
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
339
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
340 bool
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
341 octave_value_typeinfo::do_register_binary_op (octave_value::binary_op op,
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
342 int t1, int t2,
5759
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5307
diff changeset
343 octave_value_typeinfo::binary_op_fcn f)
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
344 {
4508
2bc437206787 [project @ 2003-09-11 01:06:43 by jwe]
jwe
parents: 4192
diff changeset
345 if (lookup_binary_op (op, t1, t2))
2bc437206787 [project @ 2003-09-11 01:06:43 by jwe]
jwe
parents: 4192
diff changeset
346 {
2bc437206787 [project @ 2003-09-11 01:06:43 by jwe]
jwe
parents: 4192
diff changeset
347 std::string op_name = octave_value::binary_op_as_string (op);
2bc437206787 [project @ 2003-09-11 01:06:43 by jwe]
jwe
parents: 4192
diff changeset
348 std::string t1_name = types(t1);
2bc437206787 [project @ 2003-09-11 01:06:43 by jwe]
jwe
parents: 4192
diff changeset
349 std::string t2_name = types(t2);
2bc437206787 [project @ 2003-09-11 01:06:43 by jwe]
jwe
parents: 4192
diff changeset
350
2bc437206787 [project @ 2003-09-11 01:06:43 by jwe]
jwe
parents: 4192
diff changeset
351 warning ("duplicate binary operator `%s' for types `%s' and `%s'",
2bc437206787 [project @ 2003-09-11 01:06:43 by jwe]
jwe
parents: 4192
diff changeset
352 op_name.c_str (), t1_name.c_str (), t1_name.c_str ());
2bc437206787 [project @ 2003-09-11 01:06:43 by jwe]
jwe
parents: 4192
diff changeset
353 }
2bc437206787 [project @ 2003-09-11 01:06:43 by jwe]
jwe
parents: 4192
diff changeset
354
2800
9aeba8e006a4 [project @ 1997-03-09 09:50:20 by jwe]
jwe
parents: 2479
diff changeset
355 binary_ops.checkelem (static_cast<int> (op), t1, t2) = f;
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
356
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
357 return false;
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
358 }
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
359
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
360 bool
7800
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7433
diff changeset
361 octave_value_typeinfo::do_register_binary_class_op (octave_value::compound_binary_op op,
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7433
diff changeset
362 octave_value_typeinfo::binary_class_op_fcn f)
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7433
diff changeset
363 {
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7433
diff changeset
364 if (lookup_binary_class_op (op))
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7433
diff changeset
365 {
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7433
diff changeset
366 std::string op_name = octave_value::binary_op_fcn_name (op);
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7433
diff changeset
367
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7433
diff changeset
368 warning ("duplicate compound binary operator `%s' for class dispatch",
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7433
diff changeset
369 op_name.c_str ());
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7433
diff changeset
370 }
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7433
diff changeset
371
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7433
diff changeset
372 compound_binary_class_ops.checkelem (static_cast<int> (op)) = f;
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7433
diff changeset
373
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7433
diff changeset
374 return false;
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7433
diff changeset
375 }
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7433
diff changeset
376
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7433
diff changeset
377 bool
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7433
diff changeset
378 octave_value_typeinfo::do_register_binary_op (octave_value::compound_binary_op op,
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7433
diff changeset
379 int t1, int t2,
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7433
diff changeset
380 octave_value_typeinfo::binary_op_fcn f)
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7433
diff changeset
381 {
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7433
diff changeset
382 if (lookup_binary_op (op, t1, t2))
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7433
diff changeset
383 {
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7433
diff changeset
384 std::string op_name = octave_value::binary_op_fcn_name (op);
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7433
diff changeset
385 std::string t1_name = types(t1);
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7433
diff changeset
386 std::string t2_name = types(t2);
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7433
diff changeset
387
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7433
diff changeset
388 warning ("duplicate compound binary operator `%s' for types `%s' and `%s'",
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7433
diff changeset
389 op_name.c_str (), t1_name.c_str (), t1_name.c_str ());
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7433
diff changeset
390 }
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7433
diff changeset
391
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7433
diff changeset
392 compound_binary_ops.checkelem (static_cast<int> (op), t1, t2) = f;
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7433
diff changeset
393
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7433
diff changeset
394 return false;
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7433
diff changeset
395 }
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7433
diff changeset
396
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7433
diff changeset
397 bool
5759
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5307
diff changeset
398 octave_value_typeinfo::do_register_cat_op (int t1, int t2, octave_value_typeinfo::cat_op_fcn f)
4915
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4901
diff changeset
399 {
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4901
diff changeset
400 if (lookup_cat_op (t1, t2))
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4901
diff changeset
401 {
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4901
diff changeset
402 std::string t1_name = types(t1);
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4901
diff changeset
403 std::string t2_name = types(t2);
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4901
diff changeset
404
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4901
diff changeset
405 warning ("duplicate concatenation operator for types `%s' and `%s'",
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4901
diff changeset
406 t1_name.c_str (), t1_name.c_str ());
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4901
diff changeset
407 }
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4901
diff changeset
408
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4901
diff changeset
409 cat_ops.checkelem (t1, t2) = f;
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4901
diff changeset
410
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4901
diff changeset
411 return false;
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4901
diff changeset
412 }
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4901
diff changeset
413
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4901
diff changeset
414 bool
2882
05926e1b367d [project @ 1997-04-24 09:48:59 by jwe]
jwe
parents: 2847
diff changeset
415 octave_value_typeinfo::do_register_assign_op (octave_value::assign_op op,
05926e1b367d [project @ 1997-04-24 09:48:59 by jwe]
jwe
parents: 2847
diff changeset
416 int t_lhs, int t_rhs,
5759
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5307
diff changeset
417 octave_value_typeinfo::assign_op_fcn f)
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
418 {
4508
2bc437206787 [project @ 2003-09-11 01:06:43 by jwe]
jwe
parents: 4192
diff changeset
419 if (lookup_assign_op (op, t_lhs, t_rhs))
2bc437206787 [project @ 2003-09-11 01:06:43 by jwe]
jwe
parents: 4192
diff changeset
420 {
2bc437206787 [project @ 2003-09-11 01:06:43 by jwe]
jwe
parents: 4192
diff changeset
421 std::string op_name = octave_value::assign_op_as_string (op);
2bc437206787 [project @ 2003-09-11 01:06:43 by jwe]
jwe
parents: 4192
diff changeset
422 std::string t_lhs_name = types(t_lhs);
2bc437206787 [project @ 2003-09-11 01:06:43 by jwe]
jwe
parents: 4192
diff changeset
423 std::string t_rhs_name = types(t_rhs);
2bc437206787 [project @ 2003-09-11 01:06:43 by jwe]
jwe
parents: 4192
diff changeset
424
2bc437206787 [project @ 2003-09-11 01:06:43 by jwe]
jwe
parents: 4192
diff changeset
425 warning ("duplicate assignment operator `%s' for types `%s' and `%s'",
2bc437206787 [project @ 2003-09-11 01:06:43 by jwe]
jwe
parents: 4192
diff changeset
426 op_name.c_str (), t_lhs_name.c_str (), t_rhs_name.c_str ());
2bc437206787 [project @ 2003-09-11 01:06:43 by jwe]
jwe
parents: 4192
diff changeset
427 }
2bc437206787 [project @ 2003-09-11 01:06:43 by jwe]
jwe
parents: 4192
diff changeset
428
2882
05926e1b367d [project @ 1997-04-24 09:48:59 by jwe]
jwe
parents: 2847
diff changeset
429 assign_ops.checkelem (static_cast<int> (op), t_lhs, t_rhs) = f;
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
430
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
431 return false;
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
432 }
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
433
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
434 bool
3196
3ac3e8edc258 [project @ 1998-10-28 23:04:39 by jwe]
jwe
parents: 3014
diff changeset
435 octave_value_typeinfo::do_register_assignany_op (octave_value::assign_op op,
5759
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5307
diff changeset
436 int t_lhs, octave_value_typeinfo::assignany_op_fcn f)
3196
3ac3e8edc258 [project @ 1998-10-28 23:04:39 by jwe]
jwe
parents: 3014
diff changeset
437 {
4508
2bc437206787 [project @ 2003-09-11 01:06:43 by jwe]
jwe
parents: 4192
diff changeset
438 if (lookup_assignany_op (op, t_lhs))
2bc437206787 [project @ 2003-09-11 01:06:43 by jwe]
jwe
parents: 4192
diff changeset
439 {
2bc437206787 [project @ 2003-09-11 01:06:43 by jwe]
jwe
parents: 4192
diff changeset
440 std::string op_name = octave_value::assign_op_as_string (op);
2bc437206787 [project @ 2003-09-11 01:06:43 by jwe]
jwe
parents: 4192
diff changeset
441 std::string t_lhs_name = types(t_lhs);
2bc437206787 [project @ 2003-09-11 01:06:43 by jwe]
jwe
parents: 4192
diff changeset
442
2bc437206787 [project @ 2003-09-11 01:06:43 by jwe]
jwe
parents: 4192
diff changeset
443 warning ("duplicate assignment operator `%s' for types `%s'",
2bc437206787 [project @ 2003-09-11 01:06:43 by jwe]
jwe
parents: 4192
diff changeset
444 op_name.c_str (), t_lhs_name.c_str ());
2bc437206787 [project @ 2003-09-11 01:06:43 by jwe]
jwe
parents: 4192
diff changeset
445 }
2bc437206787 [project @ 2003-09-11 01:06:43 by jwe]
jwe
parents: 4192
diff changeset
446
3196
3ac3e8edc258 [project @ 1998-10-28 23:04:39 by jwe]
jwe
parents: 3014
diff changeset
447 assignany_ops.checkelem (static_cast<int> (op), t_lhs) = f;
3ac3e8edc258 [project @ 1998-10-28 23:04:39 by jwe]
jwe
parents: 3014
diff changeset
448
3ac3e8edc258 [project @ 1998-10-28 23:04:39 by jwe]
jwe
parents: 3014
diff changeset
449 return false;
3ac3e8edc258 [project @ 1998-10-28 23:04:39 by jwe]
jwe
parents: 3014
diff changeset
450 }
3ac3e8edc258 [project @ 1998-10-28 23:04:39 by jwe]
jwe
parents: 3014
diff changeset
451
3ac3e8edc258 [project @ 1998-10-28 23:04:39 by jwe]
jwe
parents: 3014
diff changeset
452 bool
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
453 octave_value_typeinfo::do_register_pref_assign_conv (int t_lhs, int t_rhs,
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
454 int t_result)
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
455 {
4508
2bc437206787 [project @ 2003-09-11 01:06:43 by jwe]
jwe
parents: 4192
diff changeset
456 if (lookup_pref_assign_conv (t_lhs, t_rhs) >= 0)
2bc437206787 [project @ 2003-09-11 01:06:43 by jwe]
jwe
parents: 4192
diff changeset
457 {
2bc437206787 [project @ 2003-09-11 01:06:43 by jwe]
jwe
parents: 4192
diff changeset
458 std::string t_lhs_name = types(t_lhs);
2bc437206787 [project @ 2003-09-11 01:06:43 by jwe]
jwe
parents: 4192
diff changeset
459 std::string t_rhs_name = types(t_rhs);
2bc437206787 [project @ 2003-09-11 01:06:43 by jwe]
jwe
parents: 4192
diff changeset
460
2bc437206787 [project @ 2003-09-11 01:06:43 by jwe]
jwe
parents: 4192
diff changeset
461 warning ("overriding assignment conversion for types `%s' and `%s'",
2bc437206787 [project @ 2003-09-11 01:06:43 by jwe]
jwe
parents: 4192
diff changeset
462 t_lhs_name.c_str (), t_rhs_name.c_str ());
2bc437206787 [project @ 2003-09-11 01:06:43 by jwe]
jwe
parents: 4192
diff changeset
463 }
2bc437206787 [project @ 2003-09-11 01:06:43 by jwe]
jwe
parents: 4192
diff changeset
464
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
465 pref_assign_conv.checkelem (t_lhs, t_rhs) = t_result;
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
466
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
467 return false;
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
468 }
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
469
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
470 bool
4901
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4687
diff changeset
471 octave_value_typeinfo::do_register_type_conv_op
5759
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5307
diff changeset
472 (int t, int t_result, octave_base_value::type_conv_fcn f)
4901
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4687
diff changeset
473 {
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4687
diff changeset
474 if (lookup_type_conv_op (t, t_result))
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4687
diff changeset
475 {
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4687
diff changeset
476 std::string t_name = types(t);
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4687
diff changeset
477 std::string t_result_name = types(t_result);
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4687
diff changeset
478
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4687
diff changeset
479 warning ("overriding type conversion op for `%s' to `%s'",
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4687
diff changeset
480 t_name.c_str (), t_result_name.c_str ());
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4687
diff changeset
481 }
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4687
diff changeset
482
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4687
diff changeset
483 type_conv_ops.checkelem (t, t_result) = f;
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4687
diff changeset
484
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4687
diff changeset
485 return false;
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4687
diff changeset
486 }
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4687
diff changeset
487
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4687
diff changeset
488 bool
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
489 octave_value_typeinfo::do_register_widening_op
5759
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5307
diff changeset
490 (int t, int t_result, octave_base_value::type_conv_fcn f)
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
491 {
4508
2bc437206787 [project @ 2003-09-11 01:06:43 by jwe]
jwe
parents: 4192
diff changeset
492 if (lookup_widening_op (t, t_result))
2bc437206787 [project @ 2003-09-11 01:06:43 by jwe]
jwe
parents: 4192
diff changeset
493 {
2bc437206787 [project @ 2003-09-11 01:06:43 by jwe]
jwe
parents: 4192
diff changeset
494 std::string t_name = types(t);
2bc437206787 [project @ 2003-09-11 01:06:43 by jwe]
jwe
parents: 4192
diff changeset
495 std::string t_result_name = types(t_result);
2bc437206787 [project @ 2003-09-11 01:06:43 by jwe]
jwe
parents: 4192
diff changeset
496
2bc437206787 [project @ 2003-09-11 01:06:43 by jwe]
jwe
parents: 4192
diff changeset
497 warning ("overriding widening op for `%s' to `%s'",
2bc437206787 [project @ 2003-09-11 01:06:43 by jwe]
jwe
parents: 4192
diff changeset
498 t_name.c_str (), t_result_name.c_str ());
2bc437206787 [project @ 2003-09-11 01:06:43 by jwe]
jwe
parents: 4192
diff changeset
499 }
2bc437206787 [project @ 2003-09-11 01:06:43 by jwe]
jwe
parents: 4192
diff changeset
500
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
501 widening_ops.checkelem (t, t_result) = f;
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
502
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
503 return false;
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
504 }
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
505
4640
2d237a76dbdd [project @ 2003-11-22 11:24:44 by jwe]
jwe
parents: 4625
diff changeset
506 octave_value
2d237a76dbdd [project @ 2003-11-22 11:24:44 by jwe]
jwe
parents: 4625
diff changeset
507 octave_value_typeinfo::do_lookup_type (const std::string& nm)
2d237a76dbdd [project @ 2003-11-22 11:24:44 by jwe]
jwe
parents: 4625
diff changeset
508 {
2d237a76dbdd [project @ 2003-11-22 11:24:44 by jwe]
jwe
parents: 4625
diff changeset
509 octave_value retval;
2d237a76dbdd [project @ 2003-11-22 11:24:44 by jwe]
jwe
parents: 4625
diff changeset
510
2d237a76dbdd [project @ 2003-11-22 11:24:44 by jwe]
jwe
parents: 4625
diff changeset
511 for (int i = 0; i < num_types; i++)
2d237a76dbdd [project @ 2003-11-22 11:24:44 by jwe]
jwe
parents: 4625
diff changeset
512 {
2d237a76dbdd [project @ 2003-11-22 11:24:44 by jwe]
jwe
parents: 4625
diff changeset
513 if (nm == types(i))
2d237a76dbdd [project @ 2003-11-22 11:24:44 by jwe]
jwe
parents: 4625
diff changeset
514 {
2d237a76dbdd [project @ 2003-11-22 11:24:44 by jwe]
jwe
parents: 4625
diff changeset
515 retval = vals(i);
4687
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4640
diff changeset
516 retval.make_unique ();
4640
2d237a76dbdd [project @ 2003-11-22 11:24:44 by jwe]
jwe
parents: 4625
diff changeset
517 break;
2d237a76dbdd [project @ 2003-11-22 11:24:44 by jwe]
jwe
parents: 4625
diff changeset
518 }
2d237a76dbdd [project @ 2003-11-22 11:24:44 by jwe]
jwe
parents: 4625
diff changeset
519 }
2d237a76dbdd [project @ 2003-11-22 11:24:44 by jwe]
jwe
parents: 4625
diff changeset
520
2d237a76dbdd [project @ 2003-11-22 11:24:44 by jwe]
jwe
parents: 4625
diff changeset
521 return retval;
2d237a76dbdd [project @ 2003-11-22 11:24:44 by jwe]
jwe
parents: 4625
diff changeset
522 }
2d237a76dbdd [project @ 2003-11-22 11:24:44 by jwe]
jwe
parents: 4625
diff changeset
523
7336
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
524 octave_value_typeinfo::unary_class_op_fcn
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
525 octave_value_typeinfo::do_lookup_unary_class_op (octave_value::unary_op op)
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
526 {
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
527 return unary_class_ops.checkelem (static_cast<int> (op));
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
528 }
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
529
5759
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5307
diff changeset
530 octave_value_typeinfo::unary_op_fcn
3203
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
531 octave_value_typeinfo::do_lookup_unary_op (octave_value::unary_op op, int t)
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
532 {
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
533 return unary_ops.checkelem (static_cast<int> (op), t);
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
534 }
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
535
5759
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5307
diff changeset
536 octave_value_typeinfo::non_const_unary_op_fcn
3203
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
537 octave_value_typeinfo::do_lookup_non_const_unary_op
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
538 (octave_value::unary_op op, int t)
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
539 {
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
540 return non_const_unary_ops.checkelem (static_cast<int> (op), t);
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
541 }
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
542
7336
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
543 octave_value_typeinfo::binary_class_op_fcn
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
544 octave_value_typeinfo::do_lookup_binary_class_op (octave_value::binary_op op)
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
545 {
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
546 return binary_class_ops.checkelem (static_cast<int> (op));
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
547 }
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
548
5759
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5307
diff changeset
549 octave_value_typeinfo::binary_op_fcn
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
550 octave_value_typeinfo::do_lookup_binary_op (octave_value::binary_op op,
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
551 int t1, int t2)
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
552 {
2800
9aeba8e006a4 [project @ 1997-03-09 09:50:20 by jwe]
jwe
parents: 2479
diff changeset
553 return binary_ops.checkelem (static_cast<int> (op), t1, t2);
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
554 }
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
555
7800
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7433
diff changeset
556 octave_value_typeinfo::binary_class_op_fcn
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7433
diff changeset
557 octave_value_typeinfo::do_lookup_binary_class_op (octave_value::compound_binary_op op)
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7433
diff changeset
558 {
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7433
diff changeset
559 return compound_binary_class_ops.checkelem (static_cast<int> (op));
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7433
diff changeset
560 }
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7433
diff changeset
561
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7433
diff changeset
562 octave_value_typeinfo::binary_op_fcn
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7433
diff changeset
563 octave_value_typeinfo::do_lookup_binary_op (octave_value::compound_binary_op op,
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7433
diff changeset
564 int t1, int t2)
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7433
diff changeset
565 {
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7433
diff changeset
566 return compound_binary_ops.checkelem (static_cast<int> (op), t1, t2);
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7433
diff changeset
567 }
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7433
diff changeset
568
5759
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5307
diff changeset
569 octave_value_typeinfo::cat_op_fcn
4915
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4901
diff changeset
570 octave_value_typeinfo::do_lookup_cat_op (int t1, int t2)
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4901
diff changeset
571 {
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4901
diff changeset
572 return cat_ops.checkelem (t1, t2);
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4901
diff changeset
573 }
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4901
diff changeset
574
5759
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5307
diff changeset
575 octave_value_typeinfo::assign_op_fcn
2882
05926e1b367d [project @ 1997-04-24 09:48:59 by jwe]
jwe
parents: 2847
diff changeset
576 octave_value_typeinfo::do_lookup_assign_op (octave_value::assign_op op,
05926e1b367d [project @ 1997-04-24 09:48:59 by jwe]
jwe
parents: 2847
diff changeset
577 int t_lhs, int t_rhs)
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
578 {
2882
05926e1b367d [project @ 1997-04-24 09:48:59 by jwe]
jwe
parents: 2847
diff changeset
579 return assign_ops.checkelem (static_cast<int> (op), t_lhs, t_rhs);
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
580 }
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
581
5759
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5307
diff changeset
582 octave_value_typeinfo::assignany_op_fcn
3196
3ac3e8edc258 [project @ 1998-10-28 23:04:39 by jwe]
jwe
parents: 3014
diff changeset
583 octave_value_typeinfo::do_lookup_assignany_op (octave_value::assign_op op,
3ac3e8edc258 [project @ 1998-10-28 23:04:39 by jwe]
jwe
parents: 3014
diff changeset
584 int t_lhs)
3ac3e8edc258 [project @ 1998-10-28 23:04:39 by jwe]
jwe
parents: 3014
diff changeset
585 {
3ac3e8edc258 [project @ 1998-10-28 23:04:39 by jwe]
jwe
parents: 3014
diff changeset
586 return assignany_ops.checkelem (static_cast<int> (op), t_lhs);
3ac3e8edc258 [project @ 1998-10-28 23:04:39 by jwe]
jwe
parents: 3014
diff changeset
587 }
3ac3e8edc258 [project @ 1998-10-28 23:04:39 by jwe]
jwe
parents: 3014
diff changeset
588
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
589 int
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
590 octave_value_typeinfo::do_lookup_pref_assign_conv (int t_lhs, int t_rhs)
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
591 {
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
592 return pref_assign_conv.checkelem (t_lhs, t_rhs);
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
593 }
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
594
5759
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5307
diff changeset
595 octave_base_value::type_conv_fcn
4901
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4687
diff changeset
596 octave_value_typeinfo::do_lookup_type_conv_op (int t, int t_result)
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4687
diff changeset
597 {
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4687
diff changeset
598 return type_conv_ops.checkelem (t, t_result);
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4687
diff changeset
599 }
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4687
diff changeset
600
5759
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5307
diff changeset
601 octave_base_value::type_conv_fcn
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
602 octave_value_typeinfo::do_lookup_widening_op (int t, int t_result)
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
603 {
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
604 return widening_ops.checkelem (t, t_result);
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
605 }
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
606
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
607 string_vector
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
608 octave_value_typeinfo::do_installed_type_names (void)
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
609 {
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
610 string_vector retval (num_types);
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
611
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
612 for (int i = 0;i < num_types; i++)
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
613 retval (i) = types (i);
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
614
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
615 return retval;
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
616 }
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
617
2457
5be3f6f5986a [project @ 1996-11-03 02:54:44 by jwe]
jwe
parents: 2427
diff changeset
618 DEFUN (typeinfo, args, ,
3445
c3eed8ac845a [project @ 2000-01-17 09:06:51 by jwe]
jwe
parents: 3203
diff changeset
619 "-*- texinfo -*-\n\
c3eed8ac845a [project @ 2000-01-17 09:06:51 by jwe]
jwe
parents: 3203
diff changeset
620 @deftypefn {Built-in Function} {} typeinfo (@var{expr})\n\
2822
7cacd6c766d2 [project @ 1997-03-24 19:13:01 by jwe]
jwe
parents: 2800
diff changeset
621 \n\
3445
c3eed8ac845a [project @ 2000-01-17 09:06:51 by jwe]
jwe
parents: 3203
diff changeset
622 Return the type of the expression @var{expr}, as a string. If\n\
c3eed8ac845a [project @ 2000-01-17 09:06:51 by jwe]
jwe
parents: 3203
diff changeset
623 @var{EXPR} is omitted, return an array of strings containing all the\n\
c3eed8ac845a [project @ 2000-01-17 09:06:51 by jwe]
jwe
parents: 3203
diff changeset
624 currently installed data types.\n\
c3eed8ac845a [project @ 2000-01-17 09:06:51 by jwe]
jwe
parents: 3203
diff changeset
625 @end deftypefn")
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
626 {
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
627 octave_value retval;
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
628
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
629 int nargin = args.length ();
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
630
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
631 if (nargin == 0)
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
632 retval = octave_value_typeinfo::installed_type_names ();
2822
7cacd6c766d2 [project @ 1997-03-24 19:13:01 by jwe]
jwe
parents: 2800
diff changeset
633 else if (nargin == 1)
7cacd6c766d2 [project @ 1997-03-24 19:13:01 by jwe]
jwe
parents: 2800
diff changeset
634 retval = args(0).type_name ();
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
635 else
5823
080c08b192d8 [project @ 2006-05-19 05:32:17 by jwe]
jwe
parents: 5775
diff changeset
636 print_usage ();
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
637
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
638 return retval;
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
639 }
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
640
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
641 /*
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
642 ;;; Local Variables: ***
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
643 ;;; mode: C++ ***
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
644 ;;; End: ***
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
645 */