Mercurial > octave-antonio
annotate libinterp/octave-value/ov-typeinfo.cc @ 17787:175b392e91fe
Use GNU style coding conventions for code in libinterp/
* libinterp/corefcn/Cell.h, libinterp/corefcn/__contourc__.cc,
libinterp/corefcn/__dispatch__.cc, libinterp/corefcn/__lin_interpn__.cc,
libinterp/corefcn/__pchip_deriv__.cc, libinterp/corefcn/__qp__.cc,
libinterp/corefcn/balance.cc, libinterp/corefcn/besselj.cc,
libinterp/corefcn/betainc.cc, libinterp/corefcn/bitfcns.cc,
libinterp/corefcn/bsxfun.cc, libinterp/corefcn/c-file-ptr-stream.cc,
libinterp/corefcn/c-file-ptr-stream.h, libinterp/corefcn/cellfun.cc,
libinterp/corefcn/colloc.cc, libinterp/corefcn/comment-list.h,
libinterp/corefcn/conv2.cc, libinterp/corefcn/daspk.cc,
libinterp/corefcn/dasrt.cc, libinterp/corefcn/dassl.cc,
libinterp/corefcn/data.cc, libinterp/corefcn/debug.cc,
libinterp/corefcn/defaults.cc, libinterp/corefcn/defaults.in.h,
libinterp/corefcn/defun-int.h, libinterp/corefcn/defun.cc,
libinterp/corefcn/det.cc, libinterp/corefcn/dirfns.cc,
libinterp/corefcn/display.cc, libinterp/corefcn/dlmread.cc,
libinterp/corefcn/dot.cc, libinterp/corefcn/dynamic-ld.cc,
libinterp/corefcn/dynamic-ld.h, libinterp/corefcn/eig.cc,
libinterp/corefcn/ellipj.cc, libinterp/corefcn/error.cc,
libinterp/corefcn/error.h, libinterp/corefcn/event-queue.h,
libinterp/corefcn/fft.cc, libinterp/corefcn/fft2.cc, libinterp/corefcn/fftn.cc,
libinterp/corefcn/file-io.cc, libinterp/corefcn/filter.cc,
libinterp/corefcn/find.cc, libinterp/corefcn/gammainc.cc,
libinterp/corefcn/gcd.cc, libinterp/corefcn/getgrent.cc,
libinterp/corefcn/getpwent.cc, libinterp/corefcn/getrusage.cc,
libinterp/corefcn/givens.cc, libinterp/corefcn/gl-render.cc,
libinterp/corefcn/gl2ps-renderer.cc, libinterp/corefcn/gl2ps-renderer.h,
libinterp/corefcn/graphics.cc, libinterp/corefcn/graphics.in.h,
libinterp/corefcn/gripes.cc, libinterp/corefcn/gripes.h,
libinterp/corefcn/help.cc, libinterp/corefcn/hess.cc,
libinterp/corefcn/hex2num.cc, libinterp/corefcn/input.cc,
libinterp/corefcn/input.h, libinterp/corefcn/inv.cc,
libinterp/corefcn/jit-ir.h, libinterp/corefcn/jit-typeinfo.cc,
libinterp/corefcn/jit-typeinfo.h, libinterp/corefcn/jit-util.h,
libinterp/corefcn/kron.cc, libinterp/corefcn/load-path.cc,
libinterp/corefcn/load-path.h, libinterp/corefcn/load-save.cc,
libinterp/corefcn/load-save.h, libinterp/corefcn/lookup.cc,
libinterp/corefcn/ls-ascii-helper.cc, libinterp/corefcn/ls-hdf5.cc,
libinterp/corefcn/ls-hdf5.h, libinterp/corefcn/ls-mat-ascii.cc,
libinterp/corefcn/ls-mat-ascii.h, libinterp/corefcn/ls-mat4.cc,
libinterp/corefcn/ls-mat5.cc, libinterp/corefcn/ls-mat5.h,
libinterp/corefcn/ls-oct-ascii.cc, libinterp/corefcn/lsode.cc,
libinterp/corefcn/lu.cc, libinterp/corefcn/luinc.cc,
libinterp/corefcn/mappers.cc, libinterp/corefcn/matrix_type.cc,
libinterp/corefcn/max.cc, libinterp/corefcn/md5sum.cc,
libinterp/corefcn/mex.cc, libinterp/corefcn/mexproto.h,
libinterp/corefcn/mgorth.cc, libinterp/corefcn/mxarray.in.h,
libinterp/corefcn/nproc.cc, libinterp/corefcn/oct-hist.cc,
libinterp/corefcn/oct-lvalue.h, libinterp/corefcn/oct-map.cc,
libinterp/corefcn/oct-map.h, libinterp/corefcn/oct-obj.h,
libinterp/corefcn/oct-prcstrm.h, libinterp/corefcn/oct-stdstrm.h,
libinterp/corefcn/oct-stream.cc, libinterp/corefcn/oct-stream.h,
libinterp/corefcn/octave-link.cc, libinterp/corefcn/octave-link.h,
libinterp/corefcn/pager.cc, libinterp/corefcn/pinv.cc,
libinterp/corefcn/pr-output.cc, libinterp/corefcn/procstream.h,
libinterp/corefcn/profiler.cc, libinterp/corefcn/pt-jit.cc,
libinterp/corefcn/pt-jit.h, libinterp/corefcn/quad.cc,
libinterp/corefcn/quadcc.cc, libinterp/corefcn/qz.cc,
libinterp/corefcn/rand.cc, libinterp/corefcn/rcond.cc,
libinterp/corefcn/regexp.cc, libinterp/corefcn/schur.cc,
libinterp/corefcn/sighandlers.cc, libinterp/corefcn/sighandlers.h,
libinterp/corefcn/sparse-xdiv.cc, libinterp/corefcn/sparse-xdiv.h,
libinterp/corefcn/sparse-xpow.cc, libinterp/corefcn/sparse.cc,
libinterp/corefcn/spparms.cc, libinterp/corefcn/sqrtm.cc,
libinterp/corefcn/str2double.cc, libinterp/corefcn/strfind.cc,
libinterp/corefcn/strfns.cc, libinterp/corefcn/sub2ind.cc,
libinterp/corefcn/svd.cc, libinterp/corefcn/syl.cc,
libinterp/corefcn/symtab.cc, libinterp/corefcn/symtab.h,
libinterp/corefcn/syscalls.cc, libinterp/corefcn/sysdep.cc,
libinterp/corefcn/sysdep.h, libinterp/corefcn/time.cc,
libinterp/corefcn/toplev.cc, libinterp/corefcn/toplev.h,
libinterp/corefcn/tril.cc, libinterp/corefcn/txt-eng-ft.cc,
libinterp/corefcn/txt-eng-ft.h, libinterp/corefcn/txt-eng.h,
libinterp/corefcn/typecast.cc, libinterp/corefcn/urlwrite.cc,
libinterp/corefcn/utils.cc, libinterp/corefcn/variables.cc,
libinterp/corefcn/variables.h, libinterp/corefcn/xdiv.cc,
libinterp/corefcn/xdiv.h, libinterp/corefcn/xnorm.h, libinterp/corefcn/xpow.cc,
libinterp/corefcn/xpow.h, libinterp/corefcn/zfstream.cc,
libinterp/corefcn/zfstream.h, libinterp/dldfcn/__delaunayn__.cc,
libinterp/dldfcn/__dsearchn__.cc, libinterp/dldfcn/__eigs__.cc,
libinterp/dldfcn/__fltk_uigetfile__.cc, libinterp/dldfcn/__glpk__.cc,
libinterp/dldfcn/__init_fltk__.cc, libinterp/dldfcn/__init_gnuplot__.cc,
libinterp/dldfcn/__magick_read__.cc, libinterp/dldfcn/__voronoi__.cc,
libinterp/dldfcn/amd.cc, libinterp/dldfcn/ccolamd.cc, libinterp/dldfcn/chol.cc,
libinterp/dldfcn/colamd.cc, libinterp/dldfcn/convhulln.cc,
libinterp/dldfcn/dmperm.cc, libinterp/dldfcn/fftw.cc, libinterp/dldfcn/qr.cc,
libinterp/dldfcn/symbfact.cc, libinterp/dldfcn/symrcm.cc,
libinterp/dldfcn/tsearch.cc, libinterp/octave-value/ov-base-diag.cc,
libinterp/octave-value/ov-base-diag.h, libinterp/octave-value/ov-base-int.cc,
libinterp/octave-value/ov-base-int.h, libinterp/octave-value/ov-base-mat.h,
libinterp/octave-value/ov-base-scalar.cc,
libinterp/octave-value/ov-base-scalar.h,
libinterp/octave-value/ov-base-sparse.cc,
libinterp/octave-value/ov-base-sparse.h, libinterp/octave-value/ov-base.cc,
libinterp/octave-value/ov-base.h, libinterp/octave-value/ov-bool-mat.cc,
libinterp/octave-value/ov-bool-mat.h, libinterp/octave-value/ov-bool-sparse.cc,
libinterp/octave-value/ov-bool-sparse.h, libinterp/octave-value/ov-bool.cc,
libinterp/octave-value/ov-bool.h, libinterp/octave-value/ov-builtin.cc,
libinterp/octave-value/ov-builtin.h, libinterp/octave-value/ov-cell.cc,
libinterp/octave-value/ov-cell.h, libinterp/octave-value/ov-ch-mat.cc,
libinterp/octave-value/ov-ch-mat.h, libinterp/octave-value/ov-class.cc,
libinterp/octave-value/ov-class.h, libinterp/octave-value/ov-colon.h,
libinterp/octave-value/ov-complex.cc, libinterp/octave-value/ov-complex.h,
libinterp/octave-value/ov-cx-diag.cc, libinterp/octave-value/ov-cx-diag.h,
libinterp/octave-value/ov-cx-mat.cc, libinterp/octave-value/ov-cx-mat.h,
libinterp/octave-value/ov-cx-sparse.cc, libinterp/octave-value/ov-cx-sparse.h,
libinterp/octave-value/ov-dld-fcn.h, libinterp/octave-value/ov-fcn-handle.cc,
libinterp/octave-value/ov-fcn-handle.h,
libinterp/octave-value/ov-fcn-inline.cc,
libinterp/octave-value/ov-fcn-inline.h, libinterp/octave-value/ov-fcn.h,
libinterp/octave-value/ov-float.cc, libinterp/octave-value/ov-float.h,
libinterp/octave-value/ov-flt-complex.cc,
libinterp/octave-value/ov-flt-complex.h,
libinterp/octave-value/ov-flt-cx-diag.cc,
libinterp/octave-value/ov-flt-cx-diag.h,
libinterp/octave-value/ov-flt-cx-mat.cc,
libinterp/octave-value/ov-flt-cx-mat.h,
libinterp/octave-value/ov-flt-re-diag.cc,
libinterp/octave-value/ov-flt-re-diag.h,
libinterp/octave-value/ov-flt-re-mat.cc,
libinterp/octave-value/ov-flt-re-mat.h, libinterp/octave-value/ov-int16.cc,
libinterp/octave-value/ov-int32.cc, libinterp/octave-value/ov-int64.cc,
libinterp/octave-value/ov-int8.cc, libinterp/octave-value/ov-intx.h,
libinterp/octave-value/ov-java.cc, libinterp/octave-value/ov-lazy-idx.h,
libinterp/octave-value/ov-mex-fcn.cc, libinterp/octave-value/ov-mex-fcn.h,
libinterp/octave-value/ov-null-mat.cc, libinterp/octave-value/ov-null-mat.h,
libinterp/octave-value/ov-oncleanup.cc, libinterp/octave-value/ov-perm.cc,
libinterp/octave-value/ov-perm.h, libinterp/octave-value/ov-range.cc,
libinterp/octave-value/ov-range.h, libinterp/octave-value/ov-re-diag.cc,
libinterp/octave-value/ov-re-diag.h, libinterp/octave-value/ov-re-mat.cc,
libinterp/octave-value/ov-re-mat.h, libinterp/octave-value/ov-re-sparse.cc,
libinterp/octave-value/ov-re-sparse.h, libinterp/octave-value/ov-scalar.cc,
libinterp/octave-value/ov-scalar.h, libinterp/octave-value/ov-str-mat.cc,
libinterp/octave-value/ov-str-mat.h, libinterp/octave-value/ov-struct.cc,
libinterp/octave-value/ov-struct.h, libinterp/octave-value/ov-type-conv.h,
libinterp/octave-value/ov-typeinfo.cc, libinterp/octave-value/ov-typeinfo.h,
libinterp/octave-value/ov-uint16.cc, libinterp/octave-value/ov-uint32.cc,
libinterp/octave-value/ov-uint64.cc, libinterp/octave-value/ov-uint8.cc,
libinterp/octave-value/ov-usr-fcn.cc, libinterp/octave-value/ov-usr-fcn.h,
libinterp/octave-value/ov.cc, libinterp/octave-value/ov.h, libinterp/octave.cc,
libinterp/operators/op-b-bm.cc, libinterp/operators/op-b-sbm.cc,
libinterp/operators/op-bm-b.cc, libinterp/operators/op-bm-bm.cc,
libinterp/operators/op-cdm-cdm.cc, libinterp/operators/op-chm.cc,
libinterp/operators/op-class.cc, libinterp/operators/op-cm-cm.cc,
libinterp/operators/op-cm-cs.cc, libinterp/operators/op-cm-s.cc,
libinterp/operators/op-cm-scm.cc, libinterp/operators/op-cm-sm.cc,
libinterp/operators/op-cs-cm.cc, libinterp/operators/op-cs-cs.cc,
libinterp/operators/op-cs-scm.cc, libinterp/operators/op-cs-sm.cc,
libinterp/operators/op-dm-dm.cc, libinterp/operators/op-dm-scm.cc,
libinterp/operators/op-double-conv.cc, libinterp/operators/op-fcdm-fcdm.cc,
libinterp/operators/op-fcm-fcm.cc, libinterp/operators/op-fcm-fcs.cc,
libinterp/operators/op-fcm-fm.cc, libinterp/operators/op-fcm-fs.cc,
libinterp/operators/op-fcs-fcm.cc, libinterp/operators/op-fcs-fcs.cc,
libinterp/operators/op-fcs-fm.cc, libinterp/operators/op-fcs-fs.cc,
libinterp/operators/op-fdm-fdm.cc, libinterp/operators/op-float-conv.cc,
libinterp/operators/op-fm-fcm.cc, libinterp/operators/op-fm-fcs.cc,
libinterp/operators/op-fm-fm.cc, libinterp/operators/op-fm-fs.cc,
libinterp/operators/op-fs-fcm.cc, libinterp/operators/op-fs-fcs.cc,
libinterp/operators/op-fs-fm.cc, libinterp/operators/op-fs-fs.cc,
libinterp/operators/op-m-cm.cc, libinterp/operators/op-m-cs.cc,
libinterp/operators/op-m-m.cc, libinterp/operators/op-m-s.cc,
libinterp/operators/op-m-scm.cc, libinterp/operators/op-m-sm.cc,
libinterp/operators/op-pm-scm.cc, libinterp/operators/op-range.cc,
libinterp/operators/op-s-cm.cc, libinterp/operators/op-s-cs.cc,
libinterp/operators/op-s-scm.cc, libinterp/operators/op-sbm-b.cc,
libinterp/operators/op-sbm-bm.cc, libinterp/operators/op-sbm-sbm.cc,
libinterp/operators/op-scm-cm.cc, libinterp/operators/op-scm-cs.cc,
libinterp/operators/op-scm-m.cc, libinterp/operators/op-scm-s.cc,
libinterp/operators/op-scm-scm.cc, libinterp/operators/op-scm-sm.cc,
libinterp/operators/op-sm-cm.cc, libinterp/operators/op-sm-m.cc,
libinterp/operators/op-sm-s.cc, libinterp/operators/op-sm-scm.cc,
libinterp/operators/op-sm-sm.cc, libinterp/operators/op-str-m.cc,
libinterp/operators/op-str-s.cc, libinterp/operators/op-str-str.cc,
libinterp/operators/ops.h, libinterp/parse-tree/lex.h,
libinterp/parse-tree/parse.h, libinterp/parse-tree/pt-arg-list.cc,
libinterp/parse-tree/pt-arg-list.h, libinterp/parse-tree/pt-assign.cc,
libinterp/parse-tree/pt-assign.h, libinterp/parse-tree/pt-binop.cc,
libinterp/parse-tree/pt-binop.h, libinterp/parse-tree/pt-bp.h,
libinterp/parse-tree/pt-cbinop.cc, libinterp/parse-tree/pt-check.cc,
libinterp/parse-tree/pt-colon.cc, libinterp/parse-tree/pt-colon.h,
libinterp/parse-tree/pt-const.cc, libinterp/parse-tree/pt-decl.cc,
libinterp/parse-tree/pt-decl.h, libinterp/parse-tree/pt-eval.cc,
libinterp/parse-tree/pt-except.h, libinterp/parse-tree/pt-exp.h,
libinterp/parse-tree/pt-fcn-handle.cc, libinterp/parse-tree/pt-id.cc,
libinterp/parse-tree/pt-id.h, libinterp/parse-tree/pt-idx.cc,
libinterp/parse-tree/pt-idx.h, libinterp/parse-tree/pt-loop.h,
libinterp/parse-tree/pt-mat.cc, libinterp/parse-tree/pt-misc.cc,
libinterp/parse-tree/pt-misc.h, libinterp/parse-tree/pt-pr-code.cc,
libinterp/parse-tree/pt-select.h, libinterp/parse-tree/pt-stmt.h,
libinterp/parse-tree/token.h, libinterp/version.cc:
Use GNU style coding conventions for code in libinterp/
author | Rik <rik@octave.org> |
---|---|
date | Mon, 28 Oct 2013 19:51:46 -0700 |
parents | d63878346099 |
children | ea0d4dea1a17 |
rev | line source |
---|---|
2376 | 1 /* |
2 | |
17744
d63878346099
maint: Update copyright notices for release.
John W. Eaton <jwe@octave.org>
parents:
15810
diff
changeset
|
3 Copyright (C) 1996-2013 John W. Eaton |
2376 | 4 |
5 This file is part of Octave. | |
6 | |
7 Octave is free software; you can redistribute it and/or modify it | |
8 under the terms of the GNU General Public License as published by the | |
7016 | 9 Free Software Foundation; either version 3 of the License, or (at your |
10 option) any later version. | |
2376 | 11 |
12 Octave is distributed in the hope that it will be useful, but WITHOUT | |
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
15 for more details. | |
16 | |
17 You should have received a copy of the GNU General Public License | |
7016 | 18 along with Octave; see the file COPYING. If not, see |
19 <http://www.gnu.org/licenses/>. | |
2376 | 20 |
21 */ | |
22 | |
23 #ifdef HAVE_CONFIG_H | |
24 #include <config.h> | |
25 #endif | |
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 | 29 |
30 #include "defun.h" | |
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 | 33 |
2479 | 34 const int |
35 octave_value_typeinfo::init_tab_sz (16); | |
36 | |
37 octave_value_typeinfo * | |
38 octave_value_typeinfo::instance (0); | |
2376 | 39 |
2926 | 40 bool |
41 octave_value_typeinfo::instance_ok (void) | |
42 { | |
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 | 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 | 52 |
53 if (! instance) | |
54 { | |
55 ::error ("unable to create value type info object!"); | |
56 | |
57 retval = false; | |
58 } | |
59 | |
60 return retval; | |
61 } | |
62 | |
2376 | 63 int |
4612 | 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 | 67 { |
2926 | 68 return (instance_ok ()) |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
69 ? instance->do_register_type (t_name, c_name, val) : -1; |
2376 | 70 } |
71 | |
72 bool | |
7336 | 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 | 75 { |
76 return (instance_ok ()) | |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
77 ? instance->do_register_unary_class_op (op, f) : false; |
7336 | 78 } |
79 | |
80 bool | |
3203 | 81 octave_value_typeinfo::register_unary_op (octave_value::unary_op op, |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
82 int t, |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
83 octave_value_typeinfo::unary_op_fcn f) |
3203 | 84 { |
85 return (instance_ok ()) | |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
86 ? instance->do_register_unary_op (op, t, f) : false; |
3203 | 87 } |
88 | |
89 bool | |
90 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
|
91 int t, |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
92 octave_value_typeinfo::non_const_unary_op_fcn f) |
3203 | 93 { |
94 return (instance_ok ()) | |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
95 ? instance->do_register_non_const_unary_op (op, t, f) : false; |
3203 | 96 } |
97 | |
98 bool | |
7336 | 99 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
|
100 octave_value_typeinfo::binary_class_op_fcn f) |
7336 | 101 { |
102 return (instance_ok ()) | |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
103 ? instance->do_register_binary_class_op (op, f) : false; |
7336 | 104 } |
105 | |
106 bool | |
2376 | 107 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
|
108 int t1, int t2, |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
109 octave_value_typeinfo::binary_op_fcn f) |
2376 | 110 { |
2926 | 111 return (instance_ok ()) |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
112 ? instance->do_register_binary_op (op, t1, t2, f) : false; |
2376 | 113 } |
114 | |
115 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
|
116 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
|
117 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
|
118 { |
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 return (instance_ok ()) |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
120 ? instance->do_register_binary_class_op (op, f) : false; |
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
|
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 |
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 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
|
124 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
|
125 int t1, int t2, |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
126 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
|
127 { |
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 return (instance_ok ()) |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
129 ? instance->do_register_binary_op (op, t1, t2, f) : false; |
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
|
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 |
5861b95e9879
support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents:
7433
diff
changeset
|
132 bool |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
133 octave_value_typeinfo::register_cat_op (int t1, int t2, |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
134 octave_value_typeinfo::cat_op_fcn f) |
4915 | 135 { |
136 return (instance_ok ()) | |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
137 ? instance->do_register_cat_op (t1, t2, f) : false; |
4915 | 138 } |
139 | |
140 bool | |
2882 | 141 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
|
142 int t_lhs, int t_rhs, |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
143 octave_value_typeinfo::assign_op_fcn f) |
2376 | 144 { |
2926 | 145 return (instance_ok ()) |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
146 ? instance->do_register_assign_op (op, t_lhs, t_rhs, f) : -1; |
2376 | 147 } |
148 | |
149 bool | |
3196 | 150 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
|
151 int t_lhs, octave_value_typeinfo::assignany_op_fcn f) |
3196 | 152 { |
153 return (instance_ok ()) | |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
154 ? instance->do_register_assignany_op (op, t_lhs, f) : -1; |
3196 | 155 } |
156 | |
157 bool | |
2376 | 158 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
|
159 int t_result) |
2376 | 160 { |
2926 | 161 return (instance_ok ()) |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
162 ? instance->do_register_pref_assign_conv (t_lhs, t_rhs, t_result) |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
163 : false; |
2376 | 164 } |
165 | |
166 bool | |
4901 | 167 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
|
168 octave_base_value::type_conv_fcn f) |
4901 | 169 { |
170 return (instance_ok ()) | |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
171 ? instance->do_register_type_conv_op (t, t_result, f) : false; |
4901 | 172 } |
173 | |
174 bool | |
2376 | 175 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
|
176 octave_base_value::type_conv_fcn f) |
2376 | 177 { |
2926 | 178 return (instance_ok ()) |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
179 ? instance->do_register_widening_op (t, t_result, f) : false; |
2376 | 180 } |
181 | |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
182 // FIXME: we should also store all class names and provide a |
4687 | 183 // way to list them (calling class with nargin == 0?). |
184 | |
2376 | 185 int |
4612 | 186 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
|
187 const std::string& /* c_name */, |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
188 const octave_value& val) |
2376 | 189 { |
190 int i = 0; | |
191 | |
192 for (i = 0; i < num_types; i++) | |
4612 | 193 if (t_name == types (i)) |
2376 | 194 return i; |
195 | |
196 int len = types.length (); | |
197 | |
198 if (i == len) | |
199 { | |
200 len *= 2; | |
201 | |
11570
57632dea2446
attempt better backward compatibility for Array constructors
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
202 types.resize (dim_vector (len, 1), std::string ()); |
2376 | 203 |
11570
57632dea2446
attempt better backward compatibility for Array constructors
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
204 vals.resize (dim_vector (len, 1), octave_value ()); |
4640 | 205 |
11570
57632dea2446
attempt better backward compatibility for Array constructors
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
206 unary_ops.resize (dim_vector (octave_value::num_unary_ops, len), 0); |
3203 | 207 |
208 non_const_unary_ops.resize | |
11570
57632dea2446
attempt better backward compatibility for Array constructors
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
209 (dim_vector (octave_value::num_unary_ops, len), 0); |
3203 | 210 |
11570
57632dea2446
attempt better backward compatibility for Array constructors
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
211 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_binary_ops, len, len), 0); |
2376 | 213 |
11570
57632dea2446
attempt better backward compatibility for Array constructors
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
214 compound_binary_ops.resize |
57632dea2446
attempt better backward compatibility for Array constructors
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
215 (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
|
216 |
11570
57632dea2446
attempt better backward compatibility for Array constructors
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
217 cat_ops.resize (dim_vector (len, len), 0); |
4915 | 218 |
11570
57632dea2446
attempt better backward compatibility for Array constructors
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
219 assign_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, len), 0); |
2376 | 221 |
11570
57632dea2446
attempt better backward compatibility for Array constructors
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
222 assignany_ops.resize |
57632dea2446
attempt better backward compatibility for Array constructors
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
223 (dim_vector (octave_value::num_assign_ops, len), 0); |
3196 | 224 |
11570
57632dea2446
attempt better backward compatibility for Array constructors
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
225 pref_assign_conv.resize (dim_vector (len, len), -1); |
2376 | 226 |
11570
57632dea2446
attempt better backward compatibility for Array constructors
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
227 type_conv_ops.resize (dim_vector (len, len), 0); |
4901 | 228 |
11570
57632dea2446
attempt better backward compatibility for Array constructors
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
229 widening_ops.resize (dim_vector (len, len), 0); |
2376 | 230 } |
231 | |
4612 | 232 types (i) = t_name; |
2376 | 233 |
4640 | 234 vals (i) = val; |
235 | |
2376 | 236 num_types++; |
237 | |
238 return i; | |
239 } | |
240 | |
241 bool | |
7336 | 242 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
|
243 octave_value_typeinfo::unary_class_op_fcn f) |
7336 | 244 { |
245 if (lookup_unary_class_op (op)) | |
246 { | |
247 std::string op_name = octave_value::unary_op_as_string (op); | |
248 | |
15466
d174210ce1ec
use ' instead of ` in error messages, warnings and most comments
John W. Eaton <jwe@octave.org>
parents:
14138
diff
changeset
|
249 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
|
250 op_name.c_str ()); |
7336 | 251 } |
252 | |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
253 unary_class_ops.checkelem (static_cast<int> (op)) |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
254 = reinterpret_cast<void *> (f); |
7336 | 255 |
256 return false; | |
257 } | |
258 | |
259 bool | |
3203 | 260 octave_value_typeinfo::do_register_unary_op (octave_value::unary_op op, |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
261 int t, |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
262 octave_value_typeinfo::unary_op_fcn f) |
3203 | 263 { |
4508 | 264 if (lookup_unary_op (op, t)) |
265 { | |
266 std::string op_name = octave_value::unary_op_as_string (op); | |
267 std::string type_name = types(t); | |
268 | |
15466
d174210ce1ec
use ' instead of ` in error messages, warnings and most comments
John W. Eaton <jwe@octave.org>
parents:
14138
diff
changeset
|
269 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
|
270 op_name.c_str (), type_name.c_str ()); |
4508 | 271 } |
272 | |
9223
902a4597dce8
use Array<void *> in ov-typeinfo.h
Jaroslav Hajek <highegg@gmail.com>
parents:
9219
diff
changeset
|
273 unary_ops.checkelem (static_cast<int> (op), t) = reinterpret_cast<void *> (f); |
3203 | 274 |
275 return false; | |
276 } | |
277 | |
278 bool | |
279 octave_value_typeinfo::do_register_non_const_unary_op | |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
280 (octave_value::unary_op op, int t, |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
281 octave_value_typeinfo::non_const_unary_op_fcn f) |
3203 | 282 { |
4508 | 283 if (lookup_non_const_unary_op (op, t)) |
284 { | |
285 std::string op_name = octave_value::unary_op_as_string (op); | |
286 std::string type_name = types(t); | |
287 | |
15466
d174210ce1ec
use ' instead of ` in error messages, warnings and most comments
John W. Eaton <jwe@octave.org>
parents:
14138
diff
changeset
|
288 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
|
289 op_name.c_str (), type_name.c_str ()); |
4508 | 290 } |
291 | |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
292 non_const_unary_ops.checkelem (static_cast<int> (op), t) |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
293 = reinterpret_cast<void *> (f); |
3203 | 294 |
295 return false; | |
296 } | |
297 | |
298 bool | |
7336 | 299 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
|
300 octave_value_typeinfo::binary_class_op_fcn f) |
7336 | 301 { |
302 if (lookup_binary_class_op (op)) | |
303 { | |
304 std::string op_name = octave_value::binary_op_as_string (op); | |
305 | |
15466
d174210ce1ec
use ' instead of ` in error messages, warnings and most comments
John W. Eaton <jwe@octave.org>
parents:
14138
diff
changeset
|
306 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
|
307 op_name.c_str ()); |
7336 | 308 } |
309 | |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
310 binary_class_ops.checkelem (static_cast<int> (op)) |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
311 = reinterpret_cast<void *> (f); |
7336 | 312 |
313 return false; | |
314 } | |
315 | |
316 bool | |
2376 | 317 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
|
318 int t1, int t2, |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
319 octave_value_typeinfo::binary_op_fcn f) |
2376 | 320 { |
4508 | 321 if (lookup_binary_op (op, t1, t2)) |
322 { | |
323 std::string op_name = octave_value::binary_op_as_string (op); | |
324 std::string t1_name = types(t1); | |
325 std::string t2_name = types(t2); | |
326 | |
15466
d174210ce1ec
use ' instead of ` in error messages, warnings and most comments
John W. Eaton <jwe@octave.org>
parents:
14138
diff
changeset
|
327 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
|
328 op_name.c_str (), t1_name.c_str (), t1_name.c_str ()); |
4508 | 329 } |
330 | |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
331 binary_ops.checkelem (static_cast<int> (op), t1, t2) |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
332 = reinterpret_cast<void *> (f); |
2376 | 333 |
334 return false; | |
335 } | |
336 | |
337 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
|
338 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
|
339 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
|
340 { |
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 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
|
342 { |
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 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
|
344 |
15466
d174210ce1ec
use ' instead of ` in error messages, warnings and most comments
John W. Eaton <jwe@octave.org>
parents:
14138
diff
changeset
|
345 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
|
346 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
|
347 } |
5861b95e9879
support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents:
7433
diff
changeset
|
348 |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
349 compound_binary_class_ops.checkelem (static_cast<int> (op)) |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
350 = 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
|
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 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
|
353 } |
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 |
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 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
|
356 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
|
357 int t1, int t2, |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
358 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
|
359 { |
5861b95e9879
support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents:
7433
diff
changeset
|
360 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
|
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 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
|
363 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
|
364 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
|
365 |
15466
d174210ce1ec
use ' instead of ` in error messages, warnings and most comments
John W. Eaton <jwe@octave.org>
parents:
14138
diff
changeset
|
366 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
|
367 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
|
368 } |
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 |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
370 compound_binary_ops.checkelem (static_cast<int> (op), t1, t2) |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
371 = 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
|
372 |
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 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
|
374 } |
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 bool |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
377 octave_value_typeinfo::do_register_cat_op (int t1, int t2, |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
378 octave_value_typeinfo::cat_op_fcn f) |
4915 | 379 { |
380 if (lookup_cat_op (t1, t2)) | |
381 { | |
382 std::string t1_name = types(t1); | |
383 std::string t2_name = types(t2); | |
384 | |
15466
d174210ce1ec
use ' instead of ` in error messages, warnings and most comments
John W. Eaton <jwe@octave.org>
parents:
14138
diff
changeset
|
385 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
|
386 t1_name.c_str (), t1_name.c_str ()); |
4915 | 387 } |
388 | |
9223
902a4597dce8
use Array<void *> in ov-typeinfo.h
Jaroslav Hajek <highegg@gmail.com>
parents:
9219
diff
changeset
|
389 cat_ops.checkelem (t1, t2) = reinterpret_cast<void *> (f); |
4915 | 390 |
391 return false; | |
392 } | |
393 | |
394 bool | |
2882 | 395 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
|
396 int t_lhs, int t_rhs, |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
397 octave_value_typeinfo::assign_op_fcn f) |
2376 | 398 { |
4508 | 399 if (lookup_assign_op (op, t_lhs, t_rhs)) |
400 { | |
401 std::string op_name = octave_value::assign_op_as_string (op); | |
402 std::string t_lhs_name = types(t_lhs); | |
403 std::string t_rhs_name = types(t_rhs); | |
404 | |
15466
d174210ce1ec
use ' instead of ` in error messages, warnings and most comments
John W. Eaton <jwe@octave.org>
parents:
14138
diff
changeset
|
405 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
|
406 op_name.c_str (), t_lhs_name.c_str (), t_rhs_name.c_str ()); |
4508 | 407 } |
408 | |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
409 assign_ops.checkelem (static_cast<int> (op), t_lhs, t_rhs) |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
410 = reinterpret_cast<void *> (f); |
2376 | 411 |
412 return false; | |
413 } | |
414 | |
415 bool | |
3196 | 416 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
|
417 int t_lhs, octave_value_typeinfo::assignany_op_fcn f) |
3196 | 418 { |
4508 | 419 if (lookup_assignany_op (op, t_lhs)) |
420 { | |
421 std::string op_name = octave_value::assign_op_as_string (op); | |
422 std::string t_lhs_name = types(t_lhs); | |
423 | |
15466
d174210ce1ec
use ' instead of ` in error messages, warnings and most comments
John W. Eaton <jwe@octave.org>
parents:
14138
diff
changeset
|
424 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
|
425 op_name.c_str (), t_lhs_name.c_str ()); |
4508 | 426 } |
427 | |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
428 assignany_ops.checkelem (static_cast<int> (op), t_lhs) |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
429 = reinterpret_cast<void *> (f); |
3196 | 430 |
431 return false; | |
432 } | |
433 | |
434 bool | |
2376 | 435 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
|
436 int t_result) |
2376 | 437 { |
4508 | 438 if (lookup_pref_assign_conv (t_lhs, t_rhs) >= 0) |
439 { | |
440 std::string t_lhs_name = types(t_lhs); | |
441 std::string t_rhs_name = types(t_rhs); | |
442 | |
15466
d174210ce1ec
use ' instead of ` in error messages, warnings and most comments
John W. Eaton <jwe@octave.org>
parents:
14138
diff
changeset
|
443 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
|
444 t_lhs_name.c_str (), t_rhs_name.c_str ()); |
4508 | 445 } |
446 | |
2376 | 447 pref_assign_conv.checkelem (t_lhs, t_rhs) = t_result; |
448 | |
449 return false; | |
450 } | |
451 | |
452 bool | |
4901 | 453 octave_value_typeinfo::do_register_type_conv_op |
5759 | 454 (int t, int t_result, octave_base_value::type_conv_fcn f) |
4901 | 455 { |
456 if (lookup_type_conv_op (t, t_result)) | |
457 { | |
458 std::string t_name = types(t); | |
459 std::string t_result_name = types(t_result); | |
460 | |
15466
d174210ce1ec
use ' instead of ` in error messages, warnings and most comments
John W. Eaton <jwe@octave.org>
parents:
14138
diff
changeset
|
461 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
|
462 t_name.c_str (), t_result_name.c_str ()); |
4901 | 463 } |
464 | |
9223
902a4597dce8
use Array<void *> in ov-typeinfo.h
Jaroslav Hajek <highegg@gmail.com>
parents:
9219
diff
changeset
|
465 type_conv_ops.checkelem (t, t_result) = reinterpret_cast<void *> (f); |
4901 | 466 |
467 return false; | |
468 } | |
469 | |
470 bool | |
2376 | 471 octave_value_typeinfo::do_register_widening_op |
5759 | 472 (int t, int t_result, octave_base_value::type_conv_fcn f) |
2376 | 473 { |
4508 | 474 if (lookup_widening_op (t, t_result)) |
475 { | |
476 std::string t_name = types(t); | |
477 std::string t_result_name = types(t_result); | |
478 | |
15466
d174210ce1ec
use ' instead of ` in error messages, warnings and most comments
John W. Eaton <jwe@octave.org>
parents:
14138
diff
changeset
|
479 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
|
480 t_name.c_str (), t_result_name.c_str ()); |
4508 | 481 } |
482 | |
9223
902a4597dce8
use Array<void *> in ov-typeinfo.h
Jaroslav Hajek <highegg@gmail.com>
parents:
9219
diff
changeset
|
483 widening_ops.checkelem (t, t_result) = reinterpret_cast<void *> (f); |
2376 | 484 |
485 return false; | |
486 } | |
487 | |
4640 | 488 octave_value |
489 octave_value_typeinfo::do_lookup_type (const std::string& nm) | |
490 { | |
491 octave_value retval; | |
492 | |
493 for (int i = 0; i < num_types; i++) | |
494 { | |
495 if (nm == types(i)) | |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
496 { |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
497 retval = vals(i); |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
498 retval.make_unique (); |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
499 break; |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
500 } |
4640 | 501 } |
502 | |
503 return retval; | |
504 } | |
505 | |
7336 | 506 octave_value_typeinfo::unary_class_op_fcn |
507 octave_value_typeinfo::do_lookup_unary_class_op (octave_value::unary_op op) | |
508 { | |
9223
902a4597dce8
use Array<void *> in ov-typeinfo.h
Jaroslav Hajek <highegg@gmail.com>
parents:
9219
diff
changeset
|
509 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
|
510 return reinterpret_cast<octave_value_typeinfo::unary_class_op_fcn> (f); |
7336 | 511 } |
512 | |
5759 | 513 octave_value_typeinfo::unary_op_fcn |
3203 | 514 octave_value_typeinfo::do_lookup_unary_op (octave_value::unary_op op, int t) |
515 { | |
9223
902a4597dce8
use Array<void *> in ov-typeinfo.h
Jaroslav Hajek <highegg@gmail.com>
parents:
9219
diff
changeset
|
516 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
|
517 return reinterpret_cast<octave_value_typeinfo::unary_op_fcn> (f); |
3203 | 518 } |
519 | |
5759 | 520 octave_value_typeinfo::non_const_unary_op_fcn |
3203 | 521 octave_value_typeinfo::do_lookup_non_const_unary_op |
522 (octave_value::unary_op op, int t) | |
523 { | |
9223
902a4597dce8
use Array<void *> in ov-typeinfo.h
Jaroslav Hajek <highegg@gmail.com>
parents:
9219
diff
changeset
|
524 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
|
525 return reinterpret_cast<octave_value_typeinfo::non_const_unary_op_fcn> (f); |
3203 | 526 } |
527 | |
7336 | 528 octave_value_typeinfo::binary_class_op_fcn |
529 octave_value_typeinfo::do_lookup_binary_class_op (octave_value::binary_op op) | |
530 { | |
9223
902a4597dce8
use Array<void *> in ov-typeinfo.h
Jaroslav Hajek <highegg@gmail.com>
parents:
9219
diff
changeset
|
531 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
|
532 return reinterpret_cast<octave_value_typeinfo::binary_class_op_fcn> (f); |
7336 | 533 } |
534 | |
5759 | 535 octave_value_typeinfo::binary_op_fcn |
2376 | 536 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
|
537 int t1, int t2) |
2376 | 538 { |
9223
902a4597dce8
use Array<void *> in ov-typeinfo.h
Jaroslav Hajek <highegg@gmail.com>
parents:
9219
diff
changeset
|
539 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
|
540 return reinterpret_cast<octave_value_typeinfo::binary_op_fcn> (f); |
2376 | 541 } |
542 | |
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
|
543 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
|
544 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
|
545 { |
9223
902a4597dce8
use Array<void *> in ov-typeinfo.h
Jaroslav Hajek <highegg@gmail.com>
parents:
9219
diff
changeset
|
546 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
|
547 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
|
548 } |
5861b95e9879
support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents:
7433
diff
changeset
|
549 |
5861b95e9879
support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents:
7433
diff
changeset
|
550 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
|
551 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
|
552 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
|
553 { |
9223
902a4597dce8
use Array<void *> in ov-typeinfo.h
Jaroslav Hajek <highegg@gmail.com>
parents:
9219
diff
changeset
|
554 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
|
555 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
|
556 } |
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 |
5759 | 558 octave_value_typeinfo::cat_op_fcn |
4915 | 559 octave_value_typeinfo::do_lookup_cat_op (int t1, int t2) |
560 { | |
9223
902a4597dce8
use Array<void *> in ov-typeinfo.h
Jaroslav Hajek <highegg@gmail.com>
parents:
9219
diff
changeset
|
561 void *f = cat_ops.checkelem (t1, t2); |
902a4597dce8
use Array<void *> in ov-typeinfo.h
Jaroslav Hajek <highegg@gmail.com>
parents:
9219
diff
changeset
|
562 return reinterpret_cast<octave_value_typeinfo::cat_op_fcn> (f); |
4915 | 563 } |
564 | |
5759 | 565 octave_value_typeinfo::assign_op_fcn |
2882 | 566 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
|
567 int t_lhs, int t_rhs) |
2376 | 568 { |
9223
902a4597dce8
use Array<void *> in ov-typeinfo.h
Jaroslav Hajek <highegg@gmail.com>
parents:
9219
diff
changeset
|
569 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
|
570 return reinterpret_cast<octave_value_typeinfo::assign_op_fcn> (f); |
2376 | 571 } |
572 | |
5759 | 573 octave_value_typeinfo::assignany_op_fcn |
3196 | 574 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
|
575 int t_lhs) |
3196 | 576 { |
9223
902a4597dce8
use Array<void *> in ov-typeinfo.h
Jaroslav Hajek <highegg@gmail.com>
parents:
9219
diff
changeset
|
577 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
|
578 return reinterpret_cast<octave_value_typeinfo::assignany_op_fcn> (f); |
3196 | 579 } |
580 | |
2376 | 581 int |
582 octave_value_typeinfo::do_lookup_pref_assign_conv (int t_lhs, int t_rhs) | |
583 { | |
584 return pref_assign_conv.checkelem (t_lhs, t_rhs); | |
585 } | |
586 | |
5759 | 587 octave_base_value::type_conv_fcn |
4901 | 588 octave_value_typeinfo::do_lookup_type_conv_op (int t, int t_result) |
589 { | |
9223
902a4597dce8
use Array<void *> in ov-typeinfo.h
Jaroslav Hajek <highegg@gmail.com>
parents:
9219
diff
changeset
|
590 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
|
591 return reinterpret_cast<octave_base_value::type_conv_fcn> (f); |
4901 | 592 } |
593 | |
5759 | 594 octave_base_value::type_conv_fcn |
2376 | 595 octave_value_typeinfo::do_lookup_widening_op (int t, int t_result) |
596 { | |
9223
902a4597dce8
use Array<void *> in ov-typeinfo.h
Jaroslav Hajek <highegg@gmail.com>
parents:
9219
diff
changeset
|
597 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
|
598 return reinterpret_cast<octave_base_value::type_conv_fcn> (f); |
2376 | 599 } |
600 | |
601 string_vector | |
602 octave_value_typeinfo::do_installed_type_names (void) | |
603 { | |
604 string_vector retval (num_types); | |
605 | |
11438
9e8497537319
typeinfo: return cellstr, not char array
John W. Eaton <jwe@octave.org>
parents:
10352
diff
changeset
|
606 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
|
607 retval(i) = types(i); |
2376 | 608 |
609 return retval; | |
610 } | |
611 | |
2457 | 612 DEFUN (typeinfo, args, , |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
613 "-*- texinfo -*-\n\ |
12546
39ca02387a32
Improve docstrings for a number of functions.
Rik <octave@nomad.inbox5.com>
parents:
11586
diff
changeset
|
614 @deftypefn {Built-in Function} {} typeinfo ()\n\ |
39ca02387a32
Improve docstrings for a number of functions.
Rik <octave@nomad.inbox5.com>
parents:
11586
diff
changeset
|
615 @deftypefnx {Built-in Function} {} typeinfo (@var{expr})\n\ |
2822 | 616 \n\ |
3445 | 617 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
|
618 @var{expr} is omitted, return an cell array of strings containing all the\n\ |
3445 | 619 currently installed data types.\n\ |
620 @end deftypefn") | |
2376 | 621 { |
622 octave_value retval; | |
623 | |
624 int nargin = args.length (); | |
625 | |
626 if (nargin == 0) | |
11438
9e8497537319
typeinfo: return cellstr, not char array
John W. Eaton <jwe@octave.org>
parents:
10352
diff
changeset
|
627 retval = Cell (octave_value_typeinfo::installed_type_names ()); |
2822 | 628 else if (nargin == 1) |
629 retval = args(0).type_name (); | |
2376 | 630 else |
5823 | 631 print_usage (); |
2376 | 632 |
633 return retval; | |
634 } | |
13095
32fdd834c09a
tests for typeinfo function
John W. Eaton <jwe@octave.org>
parents:
12546
diff
changeset
|
635 |
32fdd834c09a
tests for typeinfo function
John W. Eaton <jwe@octave.org>
parents:
12546
diff
changeset
|
636 /* |
14429
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
637 %!assert (iscellstr (typeinfo ())) |
13095
32fdd834c09a
tests for typeinfo function
John W. Eaton <jwe@octave.org>
parents:
12546
diff
changeset
|
638 |
14429
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
639 %!assert (typeinfo ({"cell"}), "cell") |
13095
32fdd834c09a
tests for typeinfo function
John W. Eaton <jwe@octave.org>
parents:
12546
diff
changeset
|
640 |
14429
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
641 %!assert (typeinfo (1), "scalar") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
642 %!assert (typeinfo (double (1)), "scalar") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
643 %!assert (typeinfo (i), "complex scalar") |
13095
32fdd834c09a
tests for typeinfo function
John W. Eaton <jwe@octave.org>
parents:
12546
diff
changeset
|
644 |
14429
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
645 %!assert (typeinfo ([1, 2]), "matrix") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
646 %!assert (typeinfo (double ([1, 2])), "matrix") |
13095
32fdd834c09a
tests for typeinfo function
John W. Eaton <jwe@octave.org>
parents:
12546
diff
changeset
|
647 %!assert (typeinfo (diag ([1, 2])), "diagonal matrix") |
14429
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
648 %!assert (typeinfo ([i, 2]), "complex matrix") |
13095
32fdd834c09a
tests for typeinfo function
John W. Eaton <jwe@octave.org>
parents:
12546
diff
changeset
|
649 %!assert (typeinfo (diag ([i, 2])), "complex diagonal matrix") |
14429
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
650 |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
651 %!assert (typeinfo (1:2), "range") |
13095
32fdd834c09a
tests for typeinfo function
John W. Eaton <jwe@octave.org>
parents:
12546
diff
changeset
|
652 |
14429
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
653 %!assert (typeinfo (false), "bool") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
654 %!assert (typeinfo ([true, false]), "bool matrix") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
655 |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
656 %!assert (typeinfo ("string"), "string") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
657 %!assert (typeinfo ('string'), "sq_string") |
13095
32fdd834c09a
tests for typeinfo function
John W. Eaton <jwe@octave.org>
parents:
12546
diff
changeset
|
658 |
14429
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
659 %!assert (typeinfo (int8 (1)), "int8 scalar") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
660 %!assert (typeinfo (int16 (1)), "int16 scalar") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
661 %!assert (typeinfo (int32 (1)), "int32 scalar") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
662 %!assert (typeinfo (int64 (1)), "int64 scalar") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
663 %!assert (typeinfo (uint8 (1)), "uint8 scalar") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
664 %!assert (typeinfo (uint16 (1)), "uint16 scalar") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
665 %!assert (typeinfo (uint32 (1)), "uint32 scalar") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
666 %!assert (typeinfo (uint64 (1)), "uint64 scalar") |
13095
32fdd834c09a
tests for typeinfo function
John W. Eaton <jwe@octave.org>
parents:
12546
diff
changeset
|
667 |
14429
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
668 %!assert (typeinfo (int8 ([1,2])), "int8 matrix") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
669 %!assert (typeinfo (int16 ([1,2])), "int16 matrix") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
670 %!assert (typeinfo (int32 ([1,2])), "int32 matrix") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
671 %!assert (typeinfo (int64 ([1,2])), "int64 matrix") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
672 %!assert (typeinfo (uint8 ([1,2])), "uint8 matrix") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
673 %!assert (typeinfo (uint16 ([1,2])), "uint16 matrix") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
674 %!assert (typeinfo (uint32 ([1,2])), "uint32 matrix") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
675 %!assert (typeinfo (uint64 ([1,2])), "uint64 matrix") |
13095
32fdd834c09a
tests for typeinfo function
John W. Eaton <jwe@octave.org>
parents:
12546
diff
changeset
|
676 |
14429
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
677 %!assert (typeinfo (sparse ([true, false])), "sparse bool matrix") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
678 %!assert (typeinfo (logical (sparse (i * eye (10)))), "sparse bool matrix") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
679 %!assert (typeinfo (sparse ([1,2])), "sparse matrix") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
680 %!assert (typeinfo (sparse (eye (10))), "sparse matrix") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
681 %!assert (typeinfo (sparse ([i,2])), "sparse complex matrix") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
682 %!assert (typeinfo (sparse (i * eye (10))), "sparse complex matrix") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
683 |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
684 %!test |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
685 %! s(2).a = 1; |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
686 %! assert (typeinfo (s), "struct"); |
13095
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 %! s.a = 1; |
32fdd834c09a
tests for typeinfo function
John W. Eaton <jwe@octave.org>
parents:
12546
diff
changeset
|
690 %! assert (typeinfo (s), "scalar struct"); |
32fdd834c09a
tests for typeinfo function
John W. Eaton <jwe@octave.org>
parents:
12546
diff
changeset
|
691 |
14429
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
692 ## FIXME: This doesn't work as a test for comma-separated list |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
693 %!#test |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
694 %! clist = {1, 2, 3}; |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
695 %! assert (typeinfo (clist{:}), "cs-list"); |
13095
32fdd834c09a
tests for typeinfo function
John W. Eaton <jwe@octave.org>
parents:
12546
diff
changeset
|
696 |
14429
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
697 %!assert (typeinfo (@sin), "function handle") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
698 %!assert (typeinfo (@(x) x), "function handle") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
699 |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
700 %!assert (typeinfo (inline ("x^2")), "inline function") |
13095
32fdd834c09a
tests for typeinfo function
John W. Eaton <jwe@octave.org>
parents:
12546
diff
changeset
|
701 |
14429
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
702 %!assert (typeinfo (single (1)), "float scalar") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
703 %!assert (typeinfo (single (i)), "float complex scalar") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
704 %!assert (typeinfo (single ([1, 2])), "float matrix") |
13095
32fdd834c09a
tests for typeinfo function
John W. Eaton <jwe@octave.org>
parents:
12546
diff
changeset
|
705 |
14429
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
706 %!assert (typeinfo (single (diag ([1, 2]))), "float diagonal matrix") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
707 %!assert (typeinfo (diag (single ([1, 2]))), "float diagonal matrix") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
708 %!assert (typeinfo (single (diag ([i, 2]))), "float complex diagonal matrix") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
709 %!assert (typeinfo (diag (single ([i, 2]))), "float complex diagonal matrix") |
13095
32fdd834c09a
tests for typeinfo function
John W. Eaton <jwe@octave.org>
parents:
12546
diff
changeset
|
710 |
14429
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
711 %!assert (typeinfo (eye(3)(:,[1 3 2])), "permutation matrix") |
13095
32fdd834c09a
tests for typeinfo function
John W. Eaton <jwe@octave.org>
parents:
12546
diff
changeset
|
712 %!test |
32fdd834c09a
tests for typeinfo function
John W. Eaton <jwe@octave.org>
parents:
12546
diff
changeset
|
713 %! [l, u, p] = lu (rand (3)); |
32fdd834c09a
tests for typeinfo function
John W. Eaton <jwe@octave.org>
parents:
12546
diff
changeset
|
714 %! assert (typeinfo (p), "permutation matrix"); |
14429
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
715 |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
716 %!assert (typeinfo ([]), "null_matrix") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
717 %!assert (typeinfo (""), "null_string") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
718 %!assert (typeinfo (''), "null_sq_string") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
719 |
15810
87a61a4d8fd2
Add typeinfo %!tests for onCleanup and octave_java types.
Rik <rik@octave.org>
parents:
15467
diff
changeset
|
720 %!test |
87a61a4d8fd2
Add typeinfo %!tests for onCleanup and octave_java types.
Rik <rik@octave.org>
parents:
15467
diff
changeset
|
721 %! cvar = onCleanup (@() ""); |
87a61a4d8fd2
Add typeinfo %!tests for onCleanup and octave_java types.
Rik <rik@octave.org>
parents:
15467
diff
changeset
|
722 %! assert (typeinfo (cvar), "onCleanup"); |
87a61a4d8fd2
Add typeinfo %!tests for onCleanup and octave_java types.
Rik <rik@octave.org>
parents:
15467
diff
changeset
|
723 |
87a61a4d8fd2
Add typeinfo %!tests for onCleanup and octave_java types.
Rik <rik@octave.org>
parents:
15467
diff
changeset
|
724 %!testif HAVE_JAVA |
87a61a4d8fd2
Add typeinfo %!tests for onCleanup and octave_java types.
Rik <rik@octave.org>
parents:
15467
diff
changeset
|
725 %! x = javaObject ("java.lang.StringBuffer"); |
87a61a4d8fd2
Add typeinfo %!tests for onCleanup and octave_java types.
Rik <rik@octave.org>
parents:
15467
diff
changeset
|
726 %! assert (typeinfo (x), "octave_java"); |
87a61a4d8fd2
Add typeinfo %!tests for onCleanup and octave_java types.
Rik <rik@octave.org>
parents:
15467
diff
changeset
|
727 |
87a61a4d8fd2
Add typeinfo %!tests for onCleanup and octave_java types.
Rik <rik@octave.org>
parents:
15467
diff
changeset
|
728 ## Test input validation |
14429
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
729 %!error typeinfo ("foo", 1) |
13095
32fdd834c09a
tests for typeinfo function
John W. Eaton <jwe@octave.org>
parents:
12546
diff
changeset
|
730 */ |