annotate src/ov-typeinfo.cc @ 14138:72c96de7a403 stable

maint: update copyright notices for 2012
author John W. Eaton <jwe@octave.org>
date Mon, 02 Jan 2012 14:25:41 -0500
parents 1734ebe27134
children eff4a5933e28 d174210ce1ec
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
14138
72c96de7a403 maint: update copyright notices for 2012
John W. Eaton <jwe@octave.org>
parents: 14013
diff changeset
3 Copyright (C) 1996-2012 John W. Eaton
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
4
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
5 This file is part of Octave.
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
6
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
7 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
8 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
9 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
10 option) any later version.
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
11
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
12 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
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
14 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
15 for more details.
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
16
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
17 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
18 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
19 <http://www.gnu.org/licenses/>.
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
20
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 #ifdef HAVE_CONFIG_H
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
24 #include <config.h>
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
25 #endif
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
26
13983
7dd7cccf0757 clean up memory allocated for singletons before exit
John W. Eaton <jwe@octave.org>
parents: 13095
diff changeset
27 #include "Array.h"
7dd7cccf0757 clean up memory allocated for singletons before exit
John W. Eaton <jwe@octave.org>
parents: 13095
diff changeset
28 #include "singleton-cleanup.h"
2376
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"
13983
7dd7cccf0757 clean up memory allocated for singletons before exit
John W. Eaton <jwe@octave.org>
parents: 13095
diff changeset
32 #include "ov-typeinfo.h"
2376
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
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents: 2882
diff changeset
40 bool
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents: 2882
diff changeset
41 octave_value_typeinfo::instance_ok (void)
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents: 2882
diff changeset
42 {
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents: 2882
diff changeset
43 bool retval = true;
13983
7dd7cccf0757 clean up memory allocated for singletons before exit
John W. Eaton <jwe@octave.org>
parents: 13095
diff changeset
44
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents: 2882
diff changeset
45 if (! instance)
13983
7dd7cccf0757 clean up memory allocated for singletons before exit
John W. Eaton <jwe@octave.org>
parents: 13095
diff changeset
46 {
7dd7cccf0757 clean up memory allocated for singletons before exit
John W. Eaton <jwe@octave.org>
parents: 13095
diff changeset
47 instance = new octave_value_typeinfo ();
7dd7cccf0757 clean up memory allocated for singletons before exit
John W. Eaton <jwe@octave.org>
parents: 13095
diff changeset
48
7dd7cccf0757 clean up memory allocated for singletons before exit
John W. Eaton <jwe@octave.org>
parents: 13095
diff changeset
49 if (instance)
7dd7cccf0757 clean up memory allocated for singletons before exit
John W. Eaton <jwe@octave.org>
parents: 13095
diff changeset
50 singleton_cleanup_list::add (cleanup_instance);
7dd7cccf0757 clean up memory allocated for singletons before exit
John W. Eaton <jwe@octave.org>
parents: 13095
diff changeset
51 }
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents: 2882
diff changeset
52
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents: 2882
diff changeset
53 if (! instance)
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents: 2882
diff changeset
54 {
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents: 2882
diff changeset
55 ::error ("unable to create value type info object!");
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents: 2882
diff changeset
56
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents: 2882
diff changeset
57 retval = false;
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents: 2882
diff changeset
58 }
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents: 2882
diff changeset
59
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents: 2882
diff changeset
60 return retval;
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents: 2882
diff changeset
61 }
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents: 2882
diff changeset
62
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
63 int
4612
d44675070f1a [project @ 2003-11-14 19:49:56 by jwe]
jwe
parents: 4594
diff changeset
64 octave_value_typeinfo::register_type (const std::string& t_name,
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
65 const std::string& c_name,
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
66 const octave_value& val)
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
67 {
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents: 2882
diff changeset
68 return (instance_ok ())
4640
2d237a76dbdd [project @ 2003-11-22 11:24:44 by jwe]
jwe
parents: 4625
diff changeset
69 ? 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
70 }
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
71
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
72 bool
7336
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
73 octave_value_typeinfo::register_unary_class_op (octave_value::unary_op op,
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
74 octave_value_typeinfo::unary_class_op_fcn f)
7336
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
75 {
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
76 return (instance_ok ())
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
77 ? instance->do_register_unary_class_op (op, f) : false;
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
78 }
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
79
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
80 bool
3203
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
81 octave_value_typeinfo::register_unary_op (octave_value::unary_op op,
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
82 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
83 {
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
84 return (instance_ok ())
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
85 ? instance->do_register_unary_op (op, t, f) : false;
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
86 }
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
87
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
88 bool
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
89 octave_value_typeinfo::register_non_const_unary_op (octave_value::unary_op op,
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
90 int t,
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
91 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
92 {
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
93 return (instance_ok ())
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
94 ? 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
95 }
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
96
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
97 bool
7336
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
98 octave_value_typeinfo::register_binary_class_op (octave_value::binary_op op,
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
99 octave_value_typeinfo::binary_class_op_fcn f)
7336
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
100 {
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
101 return (instance_ok ())
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
102 ? instance->do_register_binary_class_op (op, f) : false;
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
103 }
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
104
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
105 bool
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
106 octave_value_typeinfo::register_binary_op (octave_value::binary_op op,
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
107 int t1, int t2,
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
108 octave_value_typeinfo::binary_op_fcn f)
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
109 {
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents: 2882
diff changeset
110 return (instance_ok ())
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents: 2882
diff changeset
111 ? 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
112 }
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
113
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
114 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
115 octave_value_typeinfo::register_binary_class_op (octave_value::compound_binary_op op,
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
116 octave_value_typeinfo::binary_class_op_fcn f)
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
117 {
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7433
diff changeset
118 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
119 ? 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
120 }
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7433
diff changeset
121
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7433
diff changeset
122 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
123 octave_value_typeinfo::register_binary_op (octave_value::compound_binary_op op,
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
124 int t1, int t2,
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
125 octave_value_typeinfo::binary_op_fcn f)
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
126 {
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7433
diff changeset
127 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
128 ? 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
129 }
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7433
diff changeset
130
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7433
diff changeset
131 bool
5759
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5307
diff changeset
132 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
133 {
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4901
diff changeset
134 return (instance_ok ())
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4901
diff changeset
135 ? instance->do_register_cat_op (t1, t2, f) : false;
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4901
diff changeset
136 }
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4901
diff changeset
137
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4901
diff changeset
138 bool
2882
05926e1b367d [project @ 1997-04-24 09:48:59 by jwe]
jwe
parents: 2847
diff changeset
139 octave_value_typeinfo::register_assign_op (octave_value::assign_op op,
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
140 int t_lhs, int t_rhs,
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
141 octave_value_typeinfo::assign_op_fcn f)
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
142 {
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents: 2882
diff changeset
143 return (instance_ok ())
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents: 2882
diff changeset
144 ? 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
145 }
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
146
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
147 bool
3196
3ac3e8edc258 [project @ 1998-10-28 23:04:39 by jwe]
jwe
parents: 3014
diff changeset
148 octave_value_typeinfo::register_assignany_op (octave_value::assign_op op,
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
149 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
150 {
3ac3e8edc258 [project @ 1998-10-28 23:04:39 by jwe]
jwe
parents: 3014
diff changeset
151 return (instance_ok ())
3ac3e8edc258 [project @ 1998-10-28 23:04:39 by jwe]
jwe
parents: 3014
diff changeset
152 ? 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
153 }
3ac3e8edc258 [project @ 1998-10-28 23:04:39 by jwe]
jwe
parents: 3014
diff changeset
154
3ac3e8edc258 [project @ 1998-10-28 23:04:39 by jwe]
jwe
parents: 3014
diff changeset
155 bool
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
156 octave_value_typeinfo::register_pref_assign_conv (int t_lhs, int t_rhs,
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11570
diff changeset
157 int t_result)
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
158 {
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents: 2882
diff changeset
159 return (instance_ok ())
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents: 2882
diff changeset
160 ? 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
161 }
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
162
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
163 bool
4901
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4687
diff changeset
164 octave_value_typeinfo::register_type_conv_op (int t, int t_result,
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
165 octave_base_value::type_conv_fcn f)
4901
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4687
diff changeset
166 {
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4687
diff changeset
167 return (instance_ok ())
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4687
diff changeset
168 ? 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
169 }
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4687
diff changeset
170
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4687
diff changeset
171 bool
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
172 octave_value_typeinfo::register_widening_op (int t, int t_result,
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
173 octave_base_value::type_conv_fcn f)
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
174 {
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents: 2882
diff changeset
175 return (instance_ok ())
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents: 2882
diff changeset
176 ? 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
177 }
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
178
5775
ace8d8d26933 [project @ 2006-04-24 19:13:06 by jwe]
jwe
parents: 5759
diff changeset
179 // 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
180 // way to list them (calling class with nargin == 0?).
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4640
diff changeset
181
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
182 int
4612
d44675070f1a [project @ 2003-11-14 19:49:56 by jwe]
jwe
parents: 4594
diff changeset
183 octave_value_typeinfo::do_register_type (const std::string& t_name,
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
184 const std::string& /* c_name */,
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
185 const octave_value& val)
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
186 {
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
187 int i = 0;
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
188
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
189 for (i = 0; i < num_types; i++)
4612
d44675070f1a [project @ 2003-11-14 19:49:56 by jwe]
jwe
parents: 4594
diff changeset
190 if (t_name == types (i))
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
191 return i;
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 int len = types.length ();
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
194
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
195 if (i == len)
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
196 {
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
197 len *= 2;
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
198
11570
57632dea2446 attempt better backward compatibility for Array constructors
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
199 types.resize (dim_vector (len, 1), std::string ());
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
200
11570
57632dea2446 attempt better backward compatibility for Array constructors
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
201 vals.resize (dim_vector (len, 1), octave_value ());
4640
2d237a76dbdd [project @ 2003-11-22 11:24:44 by jwe]
jwe
parents: 4625
diff changeset
202
11570
57632dea2446 attempt better backward compatibility for Array constructors
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
203 unary_ops.resize (dim_vector (octave_value::num_unary_ops, len), 0);
3203
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
204
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
205 non_const_unary_ops.resize
11570
57632dea2446 attempt better backward compatibility for Array constructors
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
206 (dim_vector (octave_value::num_unary_ops, len), 0);
3203
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
207
11570
57632dea2446 attempt better backward compatibility for Array constructors
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
208 binary_ops.resize
57632dea2446 attempt better backward compatibility for Array constructors
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
209 (dim_vector (octave_value::num_binary_ops, len, len), 0);
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
210
11570
57632dea2446 attempt better backward compatibility for Array constructors
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
211 compound_binary_ops.resize
57632dea2446 attempt better backward compatibility for Array constructors
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
212 (dim_vector (octave_value::num_compound_binary_ops, len, len), 0);
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
213
11570
57632dea2446 attempt better backward compatibility for Array constructors
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
214 cat_ops.resize (dim_vector (len, len), 0);
4915
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4901
diff changeset
215
11570
57632dea2446 attempt better backward compatibility for Array constructors
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
216 assign_ops.resize
57632dea2446 attempt better backward compatibility for Array constructors
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
217 (dim_vector (octave_value::num_assign_ops, len, len), 0);
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
218
11570
57632dea2446 attempt better backward compatibility for Array constructors
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
219 assignany_ops.resize
57632dea2446 attempt better backward compatibility for Array constructors
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
220 (dim_vector (octave_value::num_assign_ops, len), 0);
3196
3ac3e8edc258 [project @ 1998-10-28 23:04:39 by jwe]
jwe
parents: 3014
diff changeset
221
11570
57632dea2446 attempt better backward compatibility for Array constructors
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
222 pref_assign_conv.resize (dim_vector (len, len), -1);
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
223
11570
57632dea2446 attempt better backward compatibility for Array constructors
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
224 type_conv_ops.resize (dim_vector (len, len), 0);
4901
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4687
diff changeset
225
11570
57632dea2446 attempt better backward compatibility for Array constructors
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
226 widening_ops.resize (dim_vector (len, len), 0);
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
227 }
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
228
4612
d44675070f1a [project @ 2003-11-14 19:49:56 by jwe]
jwe
parents: 4594
diff changeset
229 types (i) = t_name;
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 (i) = val;
2d237a76dbdd [project @ 2003-11-22 11:24:44 by jwe]
jwe
parents: 4625
diff changeset
232
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
233 num_types++;
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
234
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
235 return i;
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
236 }
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
237
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
238 bool
7336
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
239 octave_value_typeinfo::do_register_unary_class_op (octave_value::unary_op op,
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
240 octave_value_typeinfo::unary_class_op_fcn f)
7336
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
241 {
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
242 if (lookup_unary_class_op (op))
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
243 {
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
244 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
245
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
246 warning ("duplicate unary operator `%s' for class dispatch",
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
247 op_name.c_str ());
7336
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
248 }
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
249
9223
902a4597dce8 use Array<void *> in ov-typeinfo.h
Jaroslav Hajek <highegg@gmail.com>
parents: 9219
diff changeset
250 unary_class_ops.checkelem (static_cast<int> (op)) = reinterpret_cast<void *> (f);
7336
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
251
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
252 return false;
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
253 }
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
254
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
255 bool
3203
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
256 octave_value_typeinfo::do_register_unary_op (octave_value::unary_op op,
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
257 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
258 {
4508
2bc437206787 [project @ 2003-09-11 01:06:43 by jwe]
jwe
parents: 4192
diff changeset
259 if (lookup_unary_op (op, t))
2bc437206787 [project @ 2003-09-11 01:06:43 by jwe]
jwe
parents: 4192
diff changeset
260 {
2bc437206787 [project @ 2003-09-11 01:06:43 by jwe]
jwe
parents: 4192
diff changeset
261 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
262 std::string type_name = types(t);
2bc437206787 [project @ 2003-09-11 01:06:43 by jwe]
jwe
parents: 4192
diff changeset
263
2bc437206787 [project @ 2003-09-11 01:06:43 by jwe]
jwe
parents: 4192
diff changeset
264 warning ("duplicate unary operator `%s' for type `%s'",
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
265 op_name.c_str (), type_name.c_str ());
4508
2bc437206787 [project @ 2003-09-11 01:06:43 by jwe]
jwe
parents: 4192
diff changeset
266 }
2bc437206787 [project @ 2003-09-11 01:06:43 by jwe]
jwe
parents: 4192
diff changeset
267
9223
902a4597dce8 use Array<void *> in ov-typeinfo.h
Jaroslav Hajek <highegg@gmail.com>
parents: 9219
diff changeset
268 unary_ops.checkelem (static_cast<int> (op), t) = reinterpret_cast<void *> (f);
3203
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
269
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
270 return false;
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
271 }
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
272
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
273 bool
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
274 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
275 (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
276 {
4508
2bc437206787 [project @ 2003-09-11 01:06:43 by jwe]
jwe
parents: 4192
diff changeset
277 if (lookup_non_const_unary_op (op, t))
2bc437206787 [project @ 2003-09-11 01:06:43 by jwe]
jwe
parents: 4192
diff changeset
278 {
2bc437206787 [project @ 2003-09-11 01:06:43 by jwe]
jwe
parents: 4192
diff changeset
279 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
280 std::string type_name = types(t);
2bc437206787 [project @ 2003-09-11 01:06:43 by jwe]
jwe
parents: 4192
diff changeset
281
2bc437206787 [project @ 2003-09-11 01:06:43 by jwe]
jwe
parents: 4192
diff changeset
282 warning ("duplicate unary operator `%s' for type `%s'",
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
283 op_name.c_str (), type_name.c_str ());
4508
2bc437206787 [project @ 2003-09-11 01:06:43 by jwe]
jwe
parents: 4192
diff changeset
284 }
2bc437206787 [project @ 2003-09-11 01:06:43 by jwe]
jwe
parents: 4192
diff changeset
285
9223
902a4597dce8 use Array<void *> in ov-typeinfo.h
Jaroslav Hajek <highegg@gmail.com>
parents: 9219
diff changeset
286 non_const_unary_ops.checkelem (static_cast<int> (op), t) = reinterpret_cast<void *> (f);
3203
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
287
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
288 return false;
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
289 }
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
290
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
291 bool
7336
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
292 octave_value_typeinfo::do_register_binary_class_op (octave_value::binary_op op,
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
293 octave_value_typeinfo::binary_class_op_fcn f)
7336
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
294 {
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
295 if (lookup_binary_class_op (op))
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
296 {
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
297 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
298
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
299 warning ("duplicate binary operator `%s' for class dispatch",
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
300 op_name.c_str ());
7336
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
301 }
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
302
9223
902a4597dce8 use Array<void *> in ov-typeinfo.h
Jaroslav Hajek <highegg@gmail.com>
parents: 9219
diff changeset
303 binary_class_ops.checkelem (static_cast<int> (op)) = reinterpret_cast<void *> (f);
7336
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
304
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
305 return false;
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
306 }
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
307
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
308 bool
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
309 octave_value_typeinfo::do_register_binary_op (octave_value::binary_op op,
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
310 int t1, int t2,
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
311 octave_value_typeinfo::binary_op_fcn f)
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
312 {
4508
2bc437206787 [project @ 2003-09-11 01:06:43 by jwe]
jwe
parents: 4192
diff changeset
313 if (lookup_binary_op (op, t1, t2))
2bc437206787 [project @ 2003-09-11 01:06:43 by jwe]
jwe
parents: 4192
diff changeset
314 {
2bc437206787 [project @ 2003-09-11 01:06:43 by jwe]
jwe
parents: 4192
diff changeset
315 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
316 std::string t1_name = types(t1);
2bc437206787 [project @ 2003-09-11 01:06:43 by jwe]
jwe
parents: 4192
diff changeset
317 std::string t2_name = types(t2);
2bc437206787 [project @ 2003-09-11 01:06:43 by jwe]
jwe
parents: 4192
diff changeset
318
2bc437206787 [project @ 2003-09-11 01:06:43 by jwe]
jwe
parents: 4192
diff changeset
319 warning ("duplicate binary operator `%s' for types `%s' and `%s'",
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
320 op_name.c_str (), t1_name.c_str (), t1_name.c_str ());
4508
2bc437206787 [project @ 2003-09-11 01:06:43 by jwe]
jwe
parents: 4192
diff changeset
321 }
2bc437206787 [project @ 2003-09-11 01:06:43 by jwe]
jwe
parents: 4192
diff changeset
322
9223
902a4597dce8 use Array<void *> in ov-typeinfo.h
Jaroslav Hajek <highegg@gmail.com>
parents: 9219
diff changeset
323 binary_ops.checkelem (static_cast<int> (op), t1, t2) = reinterpret_cast<void *> (f);
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
324
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
325 return false;
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
326 }
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
327
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
328 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
329 octave_value_typeinfo::do_register_binary_class_op (octave_value::compound_binary_op op,
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
330 octave_value_typeinfo::binary_class_op_fcn f)
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
331 {
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7433
diff changeset
332 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
333 {
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7433
diff changeset
334 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
335
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7433
diff changeset
336 warning ("duplicate compound binary operator `%s' for class dispatch",
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
337 op_name.c_str ());
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
338 }
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7433
diff changeset
339
9223
902a4597dce8 use Array<void *> in ov-typeinfo.h
Jaroslav Hajek <highegg@gmail.com>
parents: 9219
diff changeset
340 compound_binary_class_ops.checkelem (static_cast<int> (op)) = reinterpret_cast<void *> (f);
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
341
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7433
diff changeset
342 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
343 }
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7433
diff changeset
344
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7433
diff changeset
345 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
346 octave_value_typeinfo::do_register_binary_op (octave_value::compound_binary_op op,
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
347 int t1, int t2,
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
348 octave_value_typeinfo::binary_op_fcn f)
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
349 {
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7433
diff changeset
350 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
351 {
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7433
diff changeset
352 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
353 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
354 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
355
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7433
diff changeset
356 warning ("duplicate compound binary operator `%s' for types `%s' and `%s'",
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
357 op_name.c_str (), t1_name.c_str (), t1_name.c_str ());
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
358 }
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7433
diff changeset
359
9223
902a4597dce8 use Array<void *> in ov-typeinfo.h
Jaroslav Hajek <highegg@gmail.com>
parents: 9219
diff changeset
360 compound_binary_ops.checkelem (static_cast<int> (op), t1, t2) = reinterpret_cast<void *> (f);
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
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 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
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
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 bool
5759
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5307
diff changeset
366 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
367 {
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4901
diff changeset
368 if (lookup_cat_op (t1, t2))
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4901
diff changeset
369 {
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4901
diff changeset
370 std::string t1_name = types(t1);
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4901
diff changeset
371 std::string t2_name = types(t2);
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4901
diff changeset
372
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4901
diff changeset
373 warning ("duplicate concatenation operator for types `%s' and `%s'",
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
374 t1_name.c_str (), t1_name.c_str ());
4915
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4901
diff changeset
375 }
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4901
diff changeset
376
9223
902a4597dce8 use Array<void *> in ov-typeinfo.h
Jaroslav Hajek <highegg@gmail.com>
parents: 9219
diff changeset
377 cat_ops.checkelem (t1, t2) = reinterpret_cast<void *> (f);
4915
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4901
diff changeset
378
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4901
diff changeset
379 return false;
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4901
diff changeset
380 }
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4901
diff changeset
381
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4901
diff changeset
382 bool
2882
05926e1b367d [project @ 1997-04-24 09:48:59 by jwe]
jwe
parents: 2847
diff changeset
383 octave_value_typeinfo::do_register_assign_op (octave_value::assign_op op,
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
384 int t_lhs, int t_rhs,
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
385 octave_value_typeinfo::assign_op_fcn f)
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
386 {
4508
2bc437206787 [project @ 2003-09-11 01:06:43 by jwe]
jwe
parents: 4192
diff changeset
387 if (lookup_assign_op (op, t_lhs, t_rhs))
2bc437206787 [project @ 2003-09-11 01:06:43 by jwe]
jwe
parents: 4192
diff changeset
388 {
2bc437206787 [project @ 2003-09-11 01:06:43 by jwe]
jwe
parents: 4192
diff changeset
389 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
390 std::string t_lhs_name = types(t_lhs);
2bc437206787 [project @ 2003-09-11 01:06:43 by jwe]
jwe
parents: 4192
diff changeset
391 std::string t_rhs_name = types(t_rhs);
2bc437206787 [project @ 2003-09-11 01:06:43 by jwe]
jwe
parents: 4192
diff changeset
392
2bc437206787 [project @ 2003-09-11 01:06:43 by jwe]
jwe
parents: 4192
diff changeset
393 warning ("duplicate assignment operator `%s' for types `%s' and `%s'",
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
394 op_name.c_str (), t_lhs_name.c_str (), t_rhs_name.c_str ());
4508
2bc437206787 [project @ 2003-09-11 01:06:43 by jwe]
jwe
parents: 4192
diff changeset
395 }
2bc437206787 [project @ 2003-09-11 01:06:43 by jwe]
jwe
parents: 4192
diff changeset
396
9223
902a4597dce8 use Array<void *> in ov-typeinfo.h
Jaroslav Hajek <highegg@gmail.com>
parents: 9219
diff changeset
397 assign_ops.checkelem (static_cast<int> (op), t_lhs, t_rhs) = reinterpret_cast<void *> (f);
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
398
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
399 return false;
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
400 }
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
401
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
402 bool
3196
3ac3e8edc258 [project @ 1998-10-28 23:04:39 by jwe]
jwe
parents: 3014
diff changeset
403 octave_value_typeinfo::do_register_assignany_op (octave_value::assign_op op,
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
404 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
405 {
4508
2bc437206787 [project @ 2003-09-11 01:06:43 by jwe]
jwe
parents: 4192
diff changeset
406 if (lookup_assignany_op (op, t_lhs))
2bc437206787 [project @ 2003-09-11 01:06:43 by jwe]
jwe
parents: 4192
diff changeset
407 {
2bc437206787 [project @ 2003-09-11 01:06:43 by jwe]
jwe
parents: 4192
diff changeset
408 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
409 std::string t_lhs_name = types(t_lhs);
2bc437206787 [project @ 2003-09-11 01:06:43 by jwe]
jwe
parents: 4192
diff changeset
410
2bc437206787 [project @ 2003-09-11 01:06:43 by jwe]
jwe
parents: 4192
diff changeset
411 warning ("duplicate assignment operator `%s' for types `%s'",
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
412 op_name.c_str (), t_lhs_name.c_str ());
4508
2bc437206787 [project @ 2003-09-11 01:06:43 by jwe]
jwe
parents: 4192
diff changeset
413 }
2bc437206787 [project @ 2003-09-11 01:06:43 by jwe]
jwe
parents: 4192
diff changeset
414
9223
902a4597dce8 use Array<void *> in ov-typeinfo.h
Jaroslav Hajek <highegg@gmail.com>
parents: 9219
diff changeset
415 assignany_ops.checkelem (static_cast<int> (op), t_lhs) = reinterpret_cast<void *> (f);
3196
3ac3e8edc258 [project @ 1998-10-28 23:04:39 by jwe]
jwe
parents: 3014
diff changeset
416
3ac3e8edc258 [project @ 1998-10-28 23:04:39 by jwe]
jwe
parents: 3014
diff changeset
417 return false;
3ac3e8edc258 [project @ 1998-10-28 23:04:39 by jwe]
jwe
parents: 3014
diff changeset
418 }
3ac3e8edc258 [project @ 1998-10-28 23:04:39 by jwe]
jwe
parents: 3014
diff changeset
419
3ac3e8edc258 [project @ 1998-10-28 23:04:39 by jwe]
jwe
parents: 3014
diff changeset
420 bool
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
421 octave_value_typeinfo::do_register_pref_assign_conv (int t_lhs, int t_rhs,
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11570
diff changeset
422 int t_result)
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
423 {
4508
2bc437206787 [project @ 2003-09-11 01:06:43 by jwe]
jwe
parents: 4192
diff changeset
424 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
425 {
2bc437206787 [project @ 2003-09-11 01:06:43 by jwe]
jwe
parents: 4192
diff changeset
426 std::string t_lhs_name = types(t_lhs);
2bc437206787 [project @ 2003-09-11 01:06:43 by jwe]
jwe
parents: 4192
diff changeset
427 std::string t_rhs_name = types(t_rhs);
2bc437206787 [project @ 2003-09-11 01:06:43 by jwe]
jwe
parents: 4192
diff changeset
428
2bc437206787 [project @ 2003-09-11 01:06:43 by jwe]
jwe
parents: 4192
diff changeset
429 warning ("overriding assignment conversion for types `%s' and `%s'",
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
430 t_lhs_name.c_str (), t_rhs_name.c_str ());
4508
2bc437206787 [project @ 2003-09-11 01:06:43 by jwe]
jwe
parents: 4192
diff changeset
431 }
2bc437206787 [project @ 2003-09-11 01:06:43 by jwe]
jwe
parents: 4192
diff changeset
432
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
433 pref_assign_conv.checkelem (t_lhs, t_rhs) = t_result;
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
434
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
435 return false;
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
436 }
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
437
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
438 bool
4901
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4687
diff changeset
439 octave_value_typeinfo::do_register_type_conv_op
5759
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5307
diff changeset
440 (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
441 {
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4687
diff changeset
442 if (lookup_type_conv_op (t, t_result))
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4687
diff changeset
443 {
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4687
diff changeset
444 std::string t_name = types(t);
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4687
diff changeset
445 std::string t_result_name = types(t_result);
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4687
diff changeset
446
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4687
diff changeset
447 warning ("overriding type conversion op for `%s' to `%s'",
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
448 t_name.c_str (), t_result_name.c_str ());
4901
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4687
diff changeset
449 }
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4687
diff changeset
450
9223
902a4597dce8 use Array<void *> in ov-typeinfo.h
Jaroslav Hajek <highegg@gmail.com>
parents: 9219
diff changeset
451 type_conv_ops.checkelem (t, t_result) = reinterpret_cast<void *> (f);
4901
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4687
diff changeset
452
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4687
diff changeset
453 return false;
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4687
diff changeset
454 }
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4687
diff changeset
455
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4687
diff changeset
456 bool
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
457 octave_value_typeinfo::do_register_widening_op
5759
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5307
diff changeset
458 (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
459 {
4508
2bc437206787 [project @ 2003-09-11 01:06:43 by jwe]
jwe
parents: 4192
diff changeset
460 if (lookup_widening_op (t, t_result))
2bc437206787 [project @ 2003-09-11 01:06:43 by jwe]
jwe
parents: 4192
diff changeset
461 {
2bc437206787 [project @ 2003-09-11 01:06:43 by jwe]
jwe
parents: 4192
diff changeset
462 std::string t_name = types(t);
2bc437206787 [project @ 2003-09-11 01:06:43 by jwe]
jwe
parents: 4192
diff changeset
463 std::string t_result_name = types(t_result);
2bc437206787 [project @ 2003-09-11 01:06:43 by jwe]
jwe
parents: 4192
diff changeset
464
2bc437206787 [project @ 2003-09-11 01:06:43 by jwe]
jwe
parents: 4192
diff changeset
465 warning ("overriding widening op for `%s' to `%s'",
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
466 t_name.c_str (), t_result_name.c_str ());
4508
2bc437206787 [project @ 2003-09-11 01:06:43 by jwe]
jwe
parents: 4192
diff changeset
467 }
2bc437206787 [project @ 2003-09-11 01:06:43 by jwe]
jwe
parents: 4192
diff changeset
468
9223
902a4597dce8 use Array<void *> in ov-typeinfo.h
Jaroslav Hajek <highegg@gmail.com>
parents: 9219
diff changeset
469 widening_ops.checkelem (t, t_result) = reinterpret_cast<void *> (f);
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
470
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
471 return false;
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
472 }
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
473
4640
2d237a76dbdd [project @ 2003-11-22 11:24:44 by jwe]
jwe
parents: 4625
diff changeset
474 octave_value
2d237a76dbdd [project @ 2003-11-22 11:24:44 by jwe]
jwe
parents: 4625
diff changeset
475 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
476 {
2d237a76dbdd [project @ 2003-11-22 11:24:44 by jwe]
jwe
parents: 4625
diff changeset
477 octave_value retval;
2d237a76dbdd [project @ 2003-11-22 11:24:44 by jwe]
jwe
parents: 4625
diff changeset
478
2d237a76dbdd [project @ 2003-11-22 11:24:44 by jwe]
jwe
parents: 4625
diff changeset
479 for (int i = 0; i < num_types; i++)
2d237a76dbdd [project @ 2003-11-22 11:24:44 by jwe]
jwe
parents: 4625
diff changeset
480 {
2d237a76dbdd [project @ 2003-11-22 11:24:44 by jwe]
jwe
parents: 4625
diff changeset
481 if (nm == types(i))
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
482 {
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
483 retval = vals(i);
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
484 retval.make_unique ();
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
485 break;
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
486 }
4640
2d237a76dbdd [project @ 2003-11-22 11:24:44 by jwe]
jwe
parents: 4625
diff changeset
487 }
2d237a76dbdd [project @ 2003-11-22 11:24:44 by jwe]
jwe
parents: 4625
diff changeset
488
2d237a76dbdd [project @ 2003-11-22 11:24:44 by jwe]
jwe
parents: 4625
diff changeset
489 return retval;
2d237a76dbdd [project @ 2003-11-22 11:24:44 by jwe]
jwe
parents: 4625
diff changeset
490 }
2d237a76dbdd [project @ 2003-11-22 11:24:44 by jwe]
jwe
parents: 4625
diff changeset
491
7336
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
492 octave_value_typeinfo::unary_class_op_fcn
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
493 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
494 {
9223
902a4597dce8 use Array<void *> in ov-typeinfo.h
Jaroslav Hajek <highegg@gmail.com>
parents: 9219
diff changeset
495 void *f = unary_class_ops.checkelem (static_cast<int> (op));
902a4597dce8 use Array<void *> in ov-typeinfo.h
Jaroslav Hajek <highegg@gmail.com>
parents: 9219
diff changeset
496 return reinterpret_cast<octave_value_typeinfo::unary_class_op_fcn> (f);
7336
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
497 }
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
498
5759
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5307
diff changeset
499 octave_value_typeinfo::unary_op_fcn
3203
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
500 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
501 {
9223
902a4597dce8 use Array<void *> in ov-typeinfo.h
Jaroslav Hajek <highegg@gmail.com>
parents: 9219
diff changeset
502 void *f = unary_ops.checkelem (static_cast<int> (op), t);
902a4597dce8 use Array<void *> in ov-typeinfo.h
Jaroslav Hajek <highegg@gmail.com>
parents: 9219
diff changeset
503 return reinterpret_cast<octave_value_typeinfo::unary_op_fcn> (f);
3203
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
504 }
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
505
5759
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5307
diff changeset
506 octave_value_typeinfo::non_const_unary_op_fcn
3203
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
507 octave_value_typeinfo::do_lookup_non_const_unary_op
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
508 (octave_value::unary_op op, int t)
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
509 {
9223
902a4597dce8 use Array<void *> in ov-typeinfo.h
Jaroslav Hajek <highegg@gmail.com>
parents: 9219
diff changeset
510 void *f = non_const_unary_ops.checkelem (static_cast<int> (op), t);
902a4597dce8 use Array<void *> in ov-typeinfo.h
Jaroslav Hajek <highegg@gmail.com>
parents: 9219
diff changeset
511 return reinterpret_cast<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
512 }
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
513
7336
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
514 octave_value_typeinfo::binary_class_op_fcn
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
515 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
516 {
9223
902a4597dce8 use Array<void *> in ov-typeinfo.h
Jaroslav Hajek <highegg@gmail.com>
parents: 9219
diff changeset
517 void *f = binary_class_ops.checkelem (static_cast<int> (op));
902a4597dce8 use Array<void *> in ov-typeinfo.h
Jaroslav Hajek <highegg@gmail.com>
parents: 9219
diff changeset
518 return reinterpret_cast<octave_value_typeinfo::binary_class_op_fcn> (f);
7336
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
519 }
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
520
5759
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5307
diff changeset
521 octave_value_typeinfo::binary_op_fcn
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
522 octave_value_typeinfo::do_lookup_binary_op (octave_value::binary_op op,
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
523 int t1, int t2)
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
524 {
9223
902a4597dce8 use Array<void *> in ov-typeinfo.h
Jaroslav Hajek <highegg@gmail.com>
parents: 9219
diff changeset
525 void *f = binary_ops.checkelem (static_cast<int> (op), t1, t2);
902a4597dce8 use Array<void *> in ov-typeinfo.h
Jaroslav Hajek <highegg@gmail.com>
parents: 9219
diff changeset
526 return reinterpret_cast<octave_value_typeinfo::binary_op_fcn> (f);
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
527 }
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
528
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
529 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
530 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
531 {
9223
902a4597dce8 use Array<void *> in ov-typeinfo.h
Jaroslav Hajek <highegg@gmail.com>
parents: 9219
diff changeset
532 void *f = compound_binary_class_ops.checkelem (static_cast<int> (op));
902a4597dce8 use Array<void *> in ov-typeinfo.h
Jaroslav Hajek <highegg@gmail.com>
parents: 9219
diff changeset
533 return reinterpret_cast<octave_value_typeinfo::binary_class_op_fcn> (f);
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
534 }
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7433
diff changeset
535
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7433
diff changeset
536 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
537 octave_value_typeinfo::do_lookup_binary_op (octave_value::compound_binary_op op,
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
538 int t1, int t2)
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
539 {
9223
902a4597dce8 use Array<void *> in ov-typeinfo.h
Jaroslav Hajek <highegg@gmail.com>
parents: 9219
diff changeset
540 void *f = compound_binary_ops.checkelem (static_cast<int> (op), t1, t2);
902a4597dce8 use Array<void *> in ov-typeinfo.h
Jaroslav Hajek <highegg@gmail.com>
parents: 9219
diff changeset
541 return reinterpret_cast<octave_value_typeinfo::binary_op_fcn> (f);
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
542 }
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7433
diff changeset
543
5759
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5307
diff changeset
544 octave_value_typeinfo::cat_op_fcn
4915
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4901
diff changeset
545 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
546 {
9223
902a4597dce8 use Array<void *> in ov-typeinfo.h
Jaroslav Hajek <highegg@gmail.com>
parents: 9219
diff changeset
547 void *f = cat_ops.checkelem (t1, t2);
902a4597dce8 use Array<void *> in ov-typeinfo.h
Jaroslav Hajek <highegg@gmail.com>
parents: 9219
diff changeset
548 return reinterpret_cast<octave_value_typeinfo::cat_op_fcn> (f);
4915
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4901
diff changeset
549 }
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4901
diff changeset
550
5759
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5307
diff changeset
551 octave_value_typeinfo::assign_op_fcn
2882
05926e1b367d [project @ 1997-04-24 09:48:59 by jwe]
jwe
parents: 2847
diff changeset
552 octave_value_typeinfo::do_lookup_assign_op (octave_value::assign_op op,
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
553 int t_lhs, int t_rhs)
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
554 {
9223
902a4597dce8 use Array<void *> in ov-typeinfo.h
Jaroslav Hajek <highegg@gmail.com>
parents: 9219
diff changeset
555 void *f = assign_ops.checkelem (static_cast<int> (op), t_lhs, t_rhs);
902a4597dce8 use Array<void *> in ov-typeinfo.h
Jaroslav Hajek <highegg@gmail.com>
parents: 9219
diff changeset
556 return reinterpret_cast<octave_value_typeinfo::assign_op_fcn> (f);
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
557 }
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
558
5759
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5307
diff changeset
559 octave_value_typeinfo::assignany_op_fcn
3196
3ac3e8edc258 [project @ 1998-10-28 23:04:39 by jwe]
jwe
parents: 3014
diff changeset
560 octave_value_typeinfo::do_lookup_assignany_op (octave_value::assign_op op,
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
561 int t_lhs)
3196
3ac3e8edc258 [project @ 1998-10-28 23:04:39 by jwe]
jwe
parents: 3014
diff changeset
562 {
9223
902a4597dce8 use Array<void *> in ov-typeinfo.h
Jaroslav Hajek <highegg@gmail.com>
parents: 9219
diff changeset
563 void *f = assignany_ops.checkelem (static_cast<int> (op), t_lhs);
902a4597dce8 use Array<void *> in ov-typeinfo.h
Jaroslav Hajek <highegg@gmail.com>
parents: 9219
diff changeset
564 return reinterpret_cast<octave_value_typeinfo::assignany_op_fcn> (f);
3196
3ac3e8edc258 [project @ 1998-10-28 23:04:39 by jwe]
jwe
parents: 3014
diff changeset
565 }
3ac3e8edc258 [project @ 1998-10-28 23:04:39 by jwe]
jwe
parents: 3014
diff changeset
566
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
567 int
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
568 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
569 {
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
570 return pref_assign_conv.checkelem (t_lhs, t_rhs);
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
571 }
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
572
5759
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5307
diff changeset
573 octave_base_value::type_conv_fcn
4901
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4687
diff changeset
574 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
575 {
9223
902a4597dce8 use Array<void *> in ov-typeinfo.h
Jaroslav Hajek <highegg@gmail.com>
parents: 9219
diff changeset
576 void *f = type_conv_ops.checkelem (t, t_result);
902a4597dce8 use Array<void *> in ov-typeinfo.h
Jaroslav Hajek <highegg@gmail.com>
parents: 9219
diff changeset
577 return reinterpret_cast<octave_base_value::type_conv_fcn> (f);
4901
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4687
diff changeset
578 }
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4687
diff changeset
579
5759
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5307
diff changeset
580 octave_base_value::type_conv_fcn
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
581 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
582 {
9223
902a4597dce8 use Array<void *> in ov-typeinfo.h
Jaroslav Hajek <highegg@gmail.com>
parents: 9219
diff changeset
583 void *f = widening_ops.checkelem (t, t_result);
902a4597dce8 use Array<void *> in ov-typeinfo.h
Jaroslav Hajek <highegg@gmail.com>
parents: 9219
diff changeset
584 return reinterpret_cast<octave_base_value::type_conv_fcn> (f);
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
585 }
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
586
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
587 string_vector
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
588 octave_value_typeinfo::do_installed_type_names (void)
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
589 {
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
590 string_vector retval (num_types);
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
591
11438
9e8497537319 typeinfo: return cellstr, not char array
John W. Eaton <jwe@octave.org>
parents: 10352
diff changeset
592 for (int i = 0; i < num_types; i++)
9e8497537319 typeinfo: return cellstr, not char array
John W. Eaton <jwe@octave.org>
parents: 10352
diff changeset
593 retval(i) = types(i);
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
594
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
595 return retval;
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
596 }
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
597
2457
5be3f6f5986a [project @ 1996-11-03 02:54:44 by jwe]
jwe
parents: 2427
diff changeset
598 DEFUN (typeinfo, args, ,
3445
c3eed8ac845a [project @ 2000-01-17 09:06:51 by jwe]
jwe
parents: 3203
diff changeset
599 "-*- texinfo -*-\n\
12546
39ca02387a32 Improve docstrings for a number of functions.
Rik <octave@nomad.inbox5.com>
parents: 11586
diff changeset
600 @deftypefn {Built-in Function} {} typeinfo ()\n\
39ca02387a32 Improve docstrings for a number of functions.
Rik <octave@nomad.inbox5.com>
parents: 11586
diff changeset
601 @deftypefnx {Built-in Function} {} typeinfo (@var{expr})\n\
2822
7cacd6c766d2 [project @ 1997-03-24 19:13:01 by jwe]
jwe
parents: 2800
diff changeset
602 \n\
3445
c3eed8ac845a [project @ 2000-01-17 09:06:51 by jwe]
jwe
parents: 3203
diff changeset
603 Return the type of the expression @var{expr}, as a string. If\n\
13095
32fdd834c09a tests for typeinfo function
John W. Eaton <jwe@octave.org>
parents: 12546
diff changeset
604 @var{expr} is omitted, return an cell array of strings containing all the\n\
3445
c3eed8ac845a [project @ 2000-01-17 09:06:51 by jwe]
jwe
parents: 3203
diff changeset
605 currently installed data types.\n\
c3eed8ac845a [project @ 2000-01-17 09:06:51 by jwe]
jwe
parents: 3203
diff changeset
606 @end deftypefn")
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
607 {
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
608 octave_value retval;
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 int nargin = args.length ();
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 if (nargin == 0)
11438
9e8497537319 typeinfo: return cellstr, not char array
John W. Eaton <jwe@octave.org>
parents: 10352
diff changeset
613 retval = Cell (octave_value_typeinfo::installed_type_names ());
2822
7cacd6c766d2 [project @ 1997-03-24 19:13:01 by jwe]
jwe
parents: 2800
diff changeset
614 else if (nargin == 1)
7cacd6c766d2 [project @ 1997-03-24 19:13:01 by jwe]
jwe
parents: 2800
diff changeset
615 retval = args(0).type_name ();
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
616 else
5823
080c08b192d8 [project @ 2006-05-19 05:32:17 by jwe]
jwe
parents: 5775
diff changeset
617 print_usage ();
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
618
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
619 return retval;
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
620 }
13095
32fdd834c09a tests for typeinfo function
John W. Eaton <jwe@octave.org>
parents: 12546
diff changeset
621
32fdd834c09a tests for typeinfo function
John W. Eaton <jwe@octave.org>
parents: 12546
diff changeset
622 /*
32fdd834c09a tests for typeinfo function
John W. Eaton <jwe@octave.org>
parents: 12546
diff changeset
623 %!error typeinfo ("foo", 1);
32fdd834c09a tests for typeinfo function
John W. Eaton <jwe@octave.org>
parents: 12546
diff changeset
624
32fdd834c09a tests for typeinfo function
John W. Eaton <jwe@octave.org>
parents: 12546
diff changeset
625 %!assert (iscellstr (typeinfo ()));
32fdd834c09a tests for typeinfo function
John W. Eaton <jwe@octave.org>
parents: 12546
diff changeset
626
32fdd834c09a tests for typeinfo function
John W. Eaton <jwe@octave.org>
parents: 12546
diff changeset
627 %!assert (typeinfo (false), "bool");
32fdd834c09a tests for typeinfo function
John W. Eaton <jwe@octave.org>
parents: 12546
diff changeset
628 %!assert (typeinfo ([true, false]), "bool matrix");
32fdd834c09a tests for typeinfo function
John W. Eaton <jwe@octave.org>
parents: 12546
diff changeset
629
32fdd834c09a tests for typeinfo function
John W. Eaton <jwe@octave.org>
parents: 12546
diff changeset
630 %!assert (typeinfo (1:2), "range");
32fdd834c09a tests for typeinfo function
John W. Eaton <jwe@octave.org>
parents: 12546
diff changeset
631
32fdd834c09a tests for typeinfo function
John W. Eaton <jwe@octave.org>
parents: 12546
diff changeset
632 %!assert (typeinfo ("string"), "string");
32fdd834c09a tests for typeinfo function
John W. Eaton <jwe@octave.org>
parents: 12546
diff changeset
633 %!assert (typeinfo ('string'), "sq_string");
32fdd834c09a tests for typeinfo function
John W. Eaton <jwe@octave.org>
parents: 12546
diff changeset
634
32fdd834c09a tests for typeinfo function
John W. Eaton <jwe@octave.org>
parents: 12546
diff changeset
635 %!assert (typeinfo (diag ([1, 2])), "diagonal matrix")
32fdd834c09a tests for typeinfo function
John W. Eaton <jwe@octave.org>
parents: 12546
diff changeset
636 %!assert (typeinfo (diag ([i, 2])), "complex diagonal matrix")
32fdd834c09a tests for typeinfo function
John W. Eaton <jwe@octave.org>
parents: 12546
diff changeset
637 %!assert (typeinfo (single (diag ([1, 2]))), "float diagonal matrix")
32fdd834c09a tests for typeinfo function
John W. Eaton <jwe@octave.org>
parents: 12546
diff changeset
638 %!assert (typeinfo (single (diag ([i, 2]))), "float complex diagonal matrix")
32fdd834c09a tests for typeinfo function
John W. Eaton <jwe@octave.org>
parents: 12546
diff changeset
639 %!assert (typeinfo (diag (single ([1, 2]))), "float diagonal matrix")
32fdd834c09a tests for typeinfo function
John W. Eaton <jwe@octave.org>
parents: 12546
diff changeset
640 %!assert (typeinfo (diag (single ([i, 2]))), "float complex diagonal matrix")
32fdd834c09a tests for typeinfo function
John W. Eaton <jwe@octave.org>
parents: 12546
diff changeset
641
32fdd834c09a tests for typeinfo function
John W. Eaton <jwe@octave.org>
parents: 12546
diff changeset
642 %!assert (typeinfo ([]), "null_matrix");
32fdd834c09a tests for typeinfo function
John W. Eaton <jwe@octave.org>
parents: 12546
diff changeset
643 %!assert (typeinfo (""), "null_string");
32fdd834c09a tests for typeinfo function
John W. Eaton <jwe@octave.org>
parents: 12546
diff changeset
644 %!assert (typeinfo (''), "null_sq_string");
32fdd834c09a tests for typeinfo function
John W. Eaton <jwe@octave.org>
parents: 12546
diff changeset
645
32fdd834c09a tests for typeinfo function
John W. Eaton <jwe@octave.org>
parents: 12546
diff changeset
646 %!assert (typeinfo (1), "scalar");
32fdd834c09a tests for typeinfo function
John W. Eaton <jwe@octave.org>
parents: 12546
diff changeset
647 %!assert (typeinfo (double (1)), "scalar");
32fdd834c09a tests for typeinfo function
John W. Eaton <jwe@octave.org>
parents: 12546
diff changeset
648 %!assert (typeinfo ([1, 2]), "matrix");
32fdd834c09a tests for typeinfo function
John W. Eaton <jwe@octave.org>
parents: 12546
diff changeset
649 %!assert (typeinfo (double ([1, 2])), "matrix");
32fdd834c09a tests for typeinfo function
John W. Eaton <jwe@octave.org>
parents: 12546
diff changeset
650
32fdd834c09a tests for typeinfo function
John W. Eaton <jwe@octave.org>
parents: 12546
diff changeset
651 %!assert (typeinfo (i), "complex scalar");
32fdd834c09a tests for typeinfo function
John W. Eaton <jwe@octave.org>
parents: 12546
diff changeset
652 %!assert (typeinfo ([i, 2]), "complex matrix");
32fdd834c09a tests for typeinfo function
John W. Eaton <jwe@octave.org>
parents: 12546
diff changeset
653
32fdd834c09a tests for typeinfo function
John W. Eaton <jwe@octave.org>
parents: 12546
diff changeset
654 %!assert (typeinfo (single (1)), "float scalar");
32fdd834c09a tests for typeinfo function
John W. Eaton <jwe@octave.org>
parents: 12546
diff changeset
655 %!assert (typeinfo (single ([1, 2])), "float matrix");
32fdd834c09a tests for typeinfo function
John W. Eaton <jwe@octave.org>
parents: 12546
diff changeset
656
32fdd834c09a tests for typeinfo function
John W. Eaton <jwe@octave.org>
parents: 12546
diff changeset
657 %!assert (typeinfo (single (i)), "float complex scalar");
32fdd834c09a tests for typeinfo function
John W. Eaton <jwe@octave.org>
parents: 12546
diff changeset
658 %!assert (typeinfo (single ([i, 2])), "float complex matrix");
32fdd834c09a tests for typeinfo function
John W. Eaton <jwe@octave.org>
parents: 12546
diff changeset
659
32fdd834c09a tests for typeinfo function
John W. Eaton <jwe@octave.org>
parents: 12546
diff changeset
660 %!assert (typeinfo (sparse (eye (10))), "sparse matrix");
32fdd834c09a tests for typeinfo function
John W. Eaton <jwe@octave.org>
parents: 12546
diff changeset
661 %!assert (typeinfo (sparse (i * eye (10))), "sparse complex matrix");
32fdd834c09a tests for typeinfo function
John W. Eaton <jwe@octave.org>
parents: 12546
diff changeset
662 %!assert (typeinfo (logical (sparse (i * eye (10)))), "sparse bool matrix");
32fdd834c09a tests for typeinfo function
John W. Eaton <jwe@octave.org>
parents: 12546
diff changeset
663
32fdd834c09a tests for typeinfo function
John W. Eaton <jwe@octave.org>
parents: 12546
diff changeset
664 %!assert (typeinfo (int8 (1)), "int8 scalar");
32fdd834c09a tests for typeinfo function
John W. Eaton <jwe@octave.org>
parents: 12546
diff changeset
665 %!assert (typeinfo (int16 (1)), "int16 scalar");
32fdd834c09a tests for typeinfo function
John W. Eaton <jwe@octave.org>
parents: 12546
diff changeset
666 %!assert (typeinfo (int32 (1)), "int32 scalar");
32fdd834c09a tests for typeinfo function
John W. Eaton <jwe@octave.org>
parents: 12546
diff changeset
667 %!assert (typeinfo (int64 (1)), "int64 scalar");
32fdd834c09a tests for typeinfo function
John W. Eaton <jwe@octave.org>
parents: 12546
diff changeset
668 %!assert (typeinfo (uint8 (1)), "uint8 scalar");
32fdd834c09a tests for typeinfo function
John W. Eaton <jwe@octave.org>
parents: 12546
diff changeset
669 %!assert (typeinfo (uint16 (1)), "uint16 scalar");
32fdd834c09a tests for typeinfo function
John W. Eaton <jwe@octave.org>
parents: 12546
diff changeset
670 %!assert (typeinfo (uint32 (1)), "uint32 scalar");
32fdd834c09a tests for typeinfo function
John W. Eaton <jwe@octave.org>
parents: 12546
diff changeset
671 %!assert (typeinfo (uint64 (1)), "uint64 scalar");
32fdd834c09a tests for typeinfo function
John W. Eaton <jwe@octave.org>
parents: 12546
diff changeset
672
32fdd834c09a tests for typeinfo function
John W. Eaton <jwe@octave.org>
parents: 12546
diff changeset
673 %!test
32fdd834c09a tests for typeinfo function
John W. Eaton <jwe@octave.org>
parents: 12546
diff changeset
674 %! s.a = 1;
32fdd834c09a tests for typeinfo function
John W. Eaton <jwe@octave.org>
parents: 12546
diff changeset
675 %! assert (typeinfo (s), "scalar struct");
32fdd834c09a tests for typeinfo function
John W. Eaton <jwe@octave.org>
parents: 12546
diff changeset
676
32fdd834c09a tests for typeinfo function
John W. Eaton <jwe@octave.org>
parents: 12546
diff changeset
677 %!test
32fdd834c09a tests for typeinfo function
John W. Eaton <jwe@octave.org>
parents: 12546
diff changeset
678 %! s(2).a = 1;
32fdd834c09a tests for typeinfo function
John W. Eaton <jwe@octave.org>
parents: 12546
diff changeset
679 %! assert (typeinfo (s), "struct");
32fdd834c09a tests for typeinfo function
John W. Eaton <jwe@octave.org>
parents: 12546
diff changeset
680
32fdd834c09a tests for typeinfo function
John W. Eaton <jwe@octave.org>
parents: 12546
diff changeset
681 %!assert (typeinfo ({"cell"}), "cell");
32fdd834c09a tests for typeinfo function
John W. Eaton <jwe@octave.org>
parents: 12546
diff changeset
682
32fdd834c09a tests for typeinfo function
John W. Eaton <jwe@octave.org>
parents: 12546
diff changeset
683 %!assert (typeinfo (@sin), "function handle");
32fdd834c09a tests for typeinfo function
John W. Eaton <jwe@octave.org>
parents: 12546
diff changeset
684 %!assert (typeinfo (@(x) x), "function handle");
32fdd834c09a tests for typeinfo function
John W. Eaton <jwe@octave.org>
parents: 12546
diff changeset
685
32fdd834c09a tests for typeinfo function
John W. Eaton <jwe@octave.org>
parents: 12546
diff changeset
686 %!assert (typeinfo (inline ('x^2')), "inline function");
32fdd834c09a tests for typeinfo function
John W. Eaton <jwe@octave.org>
parents: 12546
diff changeset
687
32fdd834c09a tests for typeinfo function
John W. Eaton <jwe@octave.org>
parents: 12546
diff changeset
688 %!test
32fdd834c09a tests for typeinfo function
John W. Eaton <jwe@octave.org>
parents: 12546
diff changeset
689 %! [l, u, p] = lu (rand (3));
32fdd834c09a tests for typeinfo function
John W. Eaton <jwe@octave.org>
parents: 12546
diff changeset
690 %! assert (typeinfo (p), "permutation matrix");
32fdd834c09a tests for typeinfo function
John W. Eaton <jwe@octave.org>
parents: 12546
diff changeset
691 */