Mercurial > octave
annotate libinterp/octave-value/ov-ch-mat.cc @ 22407:34ce5be04942
maint: Style check C++ code in libinterp/.
* build-env.h, build-env.in.cc, builtins.h, Cell.cc, Cell.h, __contourc__.cc,
__dispatch__.cc, __dsearchn__.cc, __ilu__.cc, __lin_interpn__.cc, __luinc__.cc,
__magick_read__.cc, __pchip_deriv__.cc, __qp__.cc, balance.cc,
base-text-renderer.h, besselj.cc, bitfcns.cc, bsxfun.cc, c-file-ptr-stream.cc,
c-file-ptr-stream.h, call-stack.cc, call-stack.h, cdisplay.c, cdisplay.h,
cellfun.cc, coct-hdf5-types.c, comment-list.cc, comment-list.h, conv2.cc,
daspk.cc, dasrt.cc, dassl.cc, data.cc, data.h, debug.cc, debug.h, defaults.cc,
defaults.in.h, defun-dld.h, defun-int.h, defun.h, det.cc, dirfns.cc, dirfns.h,
display.cc, display.h, dlmread.cc, dynamic-ld.cc, dynamic-ld.h, eig.cc,
error.cc, error.h, errwarn.h, event-queue.cc, event-queue.h, fft.cc, fft2.cc,
fftn.cc, file-io.cc, file-io.h, filter.cc, find.cc, ft-text-renderer.cc,
ft-text-renderer.h, gammainc.cc, gcd.cc, getgrent.cc, getpwent.cc, givens.cc,
gl-render.cc, gl-render.h, gl2ps-print.cc, gl2ps-print.h, graphics.cc,
graphics.in.h, gripes.h, gsvd.cc, hash.cc, help.cc, help.h, hess.cc,
hex2num.cc, hook-fcn.cc, hook-fcn.h, input.cc, input.h, interpreter.cc,
interpreter.h, inv.cc, jit-ir.cc, jit-ir.h, jit-typeinfo.cc, jit-typeinfo.h,
jit-util.cc, jit-util.h, kron.cc, load-path.cc, load-path.h, load-save.cc,
load-save.h, lookup.cc, ls-ascii-helper.cc, ls-ascii-helper.h, ls-hdf5.cc,
ls-hdf5.h, ls-mat-ascii.cc, ls-mat-ascii.h, ls-mat4.cc, ls-mat4.h, ls-mat5.h,
ls-oct-binary.cc, ls-oct-binary.h, ls-oct-text.cc, ls-oct-text.h, ls-utils.cc,
ls-utils.h, lsode.cc, lu.cc, matrix_type.cc, max.cc, mex.cc, mex.h, mexproto.h,
mgorth.cc, mxarray.in.h, nproc.cc, oct-errno.h, oct-errno.in.cc, oct-fstrm.cc,
oct-fstrm.h, oct-handle.h, oct-hdf5-types.cc, oct-hdf5-types.h, oct-hdf5.h,
oct-hist.cc, oct-hist.h, oct-iostrm.cc, oct-iostrm.h, oct-lvalue.cc,
oct-lvalue.h, oct-map.h, oct-obj.h, oct-opengl.h, oct-prcstrm.cc,
oct-prcstrm.h, oct-procbuf.cc, oct-procbuf.h, oct-stdstrm.h, oct-stream.cc,
oct-stream.h, oct-strstrm.cc, oct-strstrm.h, oct.h, octave-default-image.h,
octave-link.h, octave-preserve-stream-state.h, ordschur.cc, pager.cc, pager.h,
pinv.cc, pr-output.cc, pr-output.h, procstream.cc, procstream.h, profiler.h,
psi.cc, pt-jit.cc, pt-jit.h, quad.cc, quadcc.cc, qz.cc, rand.cc, rcond.cc,
regexp.cc, schur.cc, sighandlers.cc, sighandlers.h, sparse-xdiv.cc,
sparse-xdiv.h, sparse-xpow.cc, sparse-xpow.h, sparse.cc, spparms.cc, sqrtm.cc,
str2double.cc, strfind.cc, strfns.cc, sub2ind.cc, svd.cc, sylvester.cc,
symtab.cc, symtab.h, syscalls.cc, sysdep.cc, sysdep.h, text-renderer.cc,
text-renderer.h, time.cc, toplev.cc, toplev.h, tril.cc, tsearch.cc, txt-eng.cc,
txt-eng.h, typecast.cc, urlwrite.cc, utils.cc, utils.h, variables.cc,
variables.h, workspace-element.h, xdiv.cc, xdiv.h, xnorm.cc, xnorm.h, xpow.cc,
xpow.h, zfstream.cc, zfstream.h, deprecated-config.h, __delaunayn__.cc,
__eigs__.cc, __fltk_uigetfile__.cc, __glpk__.cc, __init_fltk__.cc,
__init_gnuplot__.cc, __osmesa_print__.cc, __voronoi__.cc, amd.cc,
audiodevinfo.cc, audioread.cc, ccolamd.cc, chol.cc, colamd.cc, convhulln.cc,
dmperm.cc, fftw.cc, gzip.cc, oct-qhull.h, qr.cc, symbfact.cc, symrcm.cc,
liboctinterp-build-info.h, liboctinterp-build-info.in.cc, ov-base-diag.h,
ov-base-int.cc, ov-base-int.h, ov-base-mat.cc, ov-base-mat.h, ov-base-scalar.h,
ov-base-sparse.cc, ov-base-sparse.h, ov-base.cc, ov-base.h, ov-bool-mat.cc,
ov-bool-mat.h, ov-bool-sparse.cc, ov-bool-sparse.h, ov-bool.cc, ov-bool.h,
ov-builtin.cc, ov-builtin.h, ov-cell.cc, ov-cell.h, ov-ch-mat.cc, ov-ch-mat.h,
ov-class.cc, ov-class.h, ov-classdef.cc, ov-classdef.h, ov-colon.cc,
ov-colon.h, ov-complex.cc, ov-complex.h, ov-cs-list.h, ov-cx-diag.cc,
ov-cx-diag.h, ov-cx-mat.cc, ov-cx-mat.h, ov-cx-sparse.cc, ov-cx-sparse.h,
ov-dld-fcn.cc, ov-dld-fcn.h, ov-fcn-handle.cc, ov-fcn-handle.h,
ov-fcn-inline.cc, ov-fcn-inline.h, ov-fcn.cc, ov-fcn.h, ov-float.cc,
ov-float.h, ov-flt-complex.cc, ov-flt-complex.h, ov-flt-cx-diag.cc,
ov-flt-cx-diag.h, ov-flt-cx-mat.cc, ov-flt-cx-mat.h, ov-flt-re-diag.cc,
ov-flt-re-diag.h, ov-flt-re-mat.cc, ov-flt-re-mat.h, ov-int-traits.h,
ov-int16.cc, ov-int16.h, ov-int32.cc, ov-int32.h, ov-int64.cc, ov-int64.h,
ov-int8.cc, ov-int8.h, ov-intx.h, ov-java.cc, ov-java.h, ov-lazy-idx.cc,
ov-lazy-idx.h, ov-mex-fcn.cc, ov-mex-fcn.h, ov-null-mat.cc, ov-null-mat.h,
ov-oncleanup.cc, ov-oncleanup.h, ov-perm.cc, ov-perm.h, ov-range.cc,
ov-range.h, ov-re-diag.cc, ov-re-diag.h, ov-re-mat.cc, ov-re-mat.h,
ov-re-sparse.cc, ov-re-sparse.h, ov-scalar.cc, ov-scalar.h, ov-str-mat.cc,
ov-str-mat.h, ov-struct.cc, ov-struct.h, ov-typeinfo.cc, ov-typeinfo.h,
ov-uint16.cc, ov-uint16.h, ov-uint32.cc, ov-uint32.h, ov-uint64.cc,
ov-uint64.h, ov-uint8.cc, ov-uint8.h, ov-usr-fcn.cc, ov-usr-fcn.h, ov.h,
ovl.cc, ovl.h, octave.cc, octave.h, op-b-b.cc, op-b-bm.cc, op-b-sbm.cc,
op-bm-b.cc, op-bm-bm.cc, op-bm-sbm.cc, op-cdm-cdm.cc, op-cell.cc, op-chm.cc,
op-class.cc, op-cm-cm.cc, op-cm-cs.cc, op-cm-m.cc, op-cm-pm.cc, op-cm-s.cc,
op-cm-scm.cc, op-cm-sm.cc, op-cs-cm.cc, op-cs-cs.cc, op-cs-m.cc, op-cs-s.cc,
op-cs-scm.cc, op-cs-sm.cc, op-dm-dm.cc, op-dm-scm.cc, op-dm-sm.cc,
op-dm-template.cc, op-dms-template.cc, op-fcdm-fcdm.cc, op-fcm-fcm.cc,
op-fcm-fcs.cc, op-fcm-fm.cc, op-fcm-fs.cc, op-fcm-pm.cc, op-fcn.cc,
op-fcs-fcm.cc, op-fcs-fcs.cc, op-fcs-fm.cc, op-fcs-fs.cc, op-fdm-fdm.cc,
op-fm-fcm.cc, op-fm-fcs.cc, op-fm-fm.cc, op-fm-fs.cc, op-fm-pm.cc,
op-fs-fcm.cc, op-fs-fcs.cc, op-fs-fm.cc, op-fs-fs.cc, op-i16-i16.cc,
op-i32-i32.cc, op-i64-i64.cc, op-i8-i8.cc, op-int-concat.cc, op-int.h,
op-m-cm.cc, op-m-cs.cc, op-m-m.cc, op-m-pm.cc, op-m-s.cc, op-m-scm.cc,
op-m-sm.cc, op-pm-cm.cc, op-pm-fcm.cc, op-pm-fm.cc, op-pm-m.cc, op-pm-pm.cc,
op-pm-scm.cc, op-pm-sm.cc, op-pm-template.cc, op-range.cc, op-s-cm.cc,
op-s-cs.cc, op-s-m.cc, op-s-s.cc, op-s-scm.cc, op-s-sm.cc, op-sbm-b.cc,
op-sbm-bm.cc, op-sbm-sbm.cc, op-scm-cm.cc, op-scm-cs.cc, op-scm-m.cc,
op-scm-s.cc, op-scm-scm.cc, op-scm-sm.cc, op-sm-cm.cc, op-sm-cs.cc, op-sm-m.cc,
op-sm-s.cc, op-sm-scm.cc, op-sm-sm.cc, op-str-m.cc, op-str-s.cc, op-str-str.cc,
op-struct.cc, op-ui16-ui16.cc, op-ui32-ui32.cc, op-ui64-ui64.cc, op-ui8-ui8.cc,
ops.h, options-usage.h, lex.h, parse.h, pt-all.h, pt-arg-list.cc,
pt-arg-list.h, pt-array-list.h, pt-assign.cc, pt-assign.h, pt-binop.cc,
pt-binop.h, pt-bp.cc, pt-bp.h, pt-cbinop.cc, pt-cbinop.h, pt-cell.cc,
pt-cell.h, pt-check.cc, pt-check.h, pt-classdef.cc, pt-classdef.h, pt-cmd.cc,
pt-cmd.h, pt-colon.cc, pt-colon.h, pt-const.cc, pt-const.h, pt-decl.cc,
pt-decl.h, pt-eval.cc, pt-eval.h, pt-except.cc, pt-except.h, pt-exp.cc,
pt-exp.h, pt-fcn-handle.cc, pt-fcn-handle.h, pt-funcall.cc, pt-funcall.h,
pt-id.cc, pt-id.h, pt-idx.cc, pt-idx.h, pt-jump.cc, pt-jump.h, pt-loop.cc,
pt-loop.h, pt-mat.cc, pt-mat.h, pt-misc.cc, pt-misc.h, pt-pr-code.cc,
pt-pr-code.h, pt-select.cc, pt-select.h, pt-stmt.cc, pt-stmt.h, pt-unop.cc,
pt-unop.h, pt-walk.h, pt.cc, pt.h, token.cc, token.h, Array-jit.cc,
Array-tc.cc, version.cc, version.in.h:
Style check C++ code in libinterp/
author | Rik <rik@octave.org> |
---|---|
date | Tue, 30 Aug 2016 21:46:47 -0700 |
parents | bac0d6f07a3e |
children | 6bf1cbb90705 |
rev | line source |
---|---|
2376 | 1 /* |
2 | |
22323
bac0d6f07a3e
maint: Update copyright notices for 2016.
John W. Eaton <jwe@octave.org>
parents:
22296
diff
changeset
|
3 Copyright (C) 1996-2016 John W. Eaton |
11523 | 4 Copyright (C) 2009-2010 VZLU Prague |
2376 | 5 |
6 This file is part of Octave. | |
7 | |
8 Octave is free software; you can redistribute it and/or modify it | |
9 under the terms of the GNU General Public License as published by the | |
7016 | 10 Free Software Foundation; either version 3 of the License, or (at your |
11 option) any later version. | |
2376 | 12 |
13 Octave is distributed in the hope that it will be useful, but WITHOUT | |
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
16 for more details. | |
17 | |
18 You should have received a copy of the GNU General Public License | |
7016 | 19 along with Octave; see the file COPYING. If not, see |
20 <http://www.gnu.org/licenses/>. | |
2376 | 21 |
22 */ | |
23 | |
21724
aba2e6293dd8
use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
24 #if defined (HAVE_CONFIG_H) |
21301
40de9f8f23a6
Use '#include "config.h"' rather than <config.h>.
Rik <rik@octave.org>
parents:
21200
diff
changeset
|
25 # include "config.h" |
2376 | 26 #endif |
27 | |
9941
1369f13ae6b2
several fixes by M. Goffioul
Jaroslav Hajek <highegg@gmail.com>
parents:
9813
diff
changeset
|
28 #include <cctype> |
3503 | 29 #include <iostream> |
2901 | 30 |
22296
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
31 #include "dNDArray.h" |
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
32 #include "fNDArray.h" |
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
33 #include "int8NDArray.h" |
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
34 #include "int16NDArray.h" |
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
35 #include "int32NDArray.h" |
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
36 #include "int64NDArray.h" |
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
37 #include "uint8NDArray.h" |
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
38 #include "uint16NDArray.h" |
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
39 #include "uint32NDArray.h" |
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
40 #include "uint64NDArray.h" |
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
41 |
2376 | 42 #include "lo-ieee.h" |
43 #include "mx-base.h" | |
44 | |
15149
62a35ae7d6a2
use forward decls for mxArray in ov.h and ov-base.h
John W. Eaton <jwe@octave.org>
parents:
15057
diff
changeset
|
45 #include "mxarray.h" |
3219 | 46 #include "ov-base.h" |
47 #include "ov-base-mat.h" | |
48 #include "ov-base-mat.cc" | |
2376 | 49 #include "ov-ch-mat.h" |
21100
e39e05d90788
Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents:
20711
diff
changeset
|
50 #include "errwarn.h" |
2376 | 51 #include "pr-output.h" |
52 | |
4513 | 53 template class octave_base_matrix<charNDArray>; |
2376 | 54 |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
55 idx_vector |
18130
e473c4853afc
enable non-integer ranges as indices by default and deprecate preference
John W. Eaton <jwe@octave.org>
parents:
17787
diff
changeset
|
56 octave_char_matrix::index_vector (bool /* require_integers */) const |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
57 { |
6720 | 58 const char *p = matrix.data (); |
59 if (numel () == 1 && *p == ':') | |
60 return idx_vector (':'); | |
61 else | |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
62 return idx_vector (array_value (true)); |
6720 | 63 } |
64 | |
2376 | 65 double |
66 octave_char_matrix::double_value (bool) const | |
67 { | |
4102 | 68 double retval = lo_ieee_nan_value (); |
2376 | 69 |
21118
3ac9f47fb04b
Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents:
21100
diff
changeset
|
70 if (rows () == 0 || columns () == 0) |
3ac9f47fb04b
Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents:
21100
diff
changeset
|
71 err_invalid_conversion ("character matrix", "real scalar"); |
4455 | 72 |
21118
3ac9f47fb04b
Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents:
21100
diff
changeset
|
73 warn_implicit_conversion ("Octave:array-to-scalar", |
3ac9f47fb04b
Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents:
21100
diff
changeset
|
74 "character matrix", "real scalar"); |
3ac9f47fb04b
Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents:
21100
diff
changeset
|
75 |
3ac9f47fb04b
Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents:
21100
diff
changeset
|
76 retval = static_cast<unsigned char> (matrix(0, 0)); |
2376 | 77 |
78 return retval; | |
79 } | |
80 | |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
81 float |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
82 octave_char_matrix::float_value (bool) const |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
83 { |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
84 float retval = lo_ieee_float_nan_value (); |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
85 |
21118
3ac9f47fb04b
Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents:
21100
diff
changeset
|
86 if (rows () == 0 && columns () == 0) |
3ac9f47fb04b
Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents:
21100
diff
changeset
|
87 err_invalid_conversion ("character matrix", "real scalar"); |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
88 |
21118
3ac9f47fb04b
Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents:
21100
diff
changeset
|
89 warn_implicit_conversion ("Octave:array-to-scalar", |
3ac9f47fb04b
Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents:
21100
diff
changeset
|
90 "character matrix", "real scalar"); |
3ac9f47fb04b
Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents:
21100
diff
changeset
|
91 |
3ac9f47fb04b
Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents:
21100
diff
changeset
|
92 retval = static_cast<unsigned char> (matrix(0, 0)); |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
93 |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
94 return retval; |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
95 } |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
96 |
20252
7fa170cc14fe
Return correct hex value for printf when used with string inputs (bug #45263).
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
97 octave_int64 |
7fa170cc14fe
Return correct hex value for printf when used with string inputs (bug #45263).
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
98 octave_char_matrix::int64_scalar_value () const |
7fa170cc14fe
Return correct hex value for printf when used with string inputs (bug #45263).
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
99 { |
7fa170cc14fe
Return correct hex value for printf when used with string inputs (bug #45263).
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
100 octave_int64 retval = 0; |
7fa170cc14fe
Return correct hex value for printf when used with string inputs (bug #45263).
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
101 |
21118
3ac9f47fb04b
Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents:
21100
diff
changeset
|
102 if (rows () == 0 || columns () == 0) |
3ac9f47fb04b
Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents:
21100
diff
changeset
|
103 err_invalid_conversion ("character matrix", "int64 scalar"); |
20252
7fa170cc14fe
Return correct hex value for printf when used with string inputs (bug #45263).
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
104 |
21118
3ac9f47fb04b
Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents:
21100
diff
changeset
|
105 warn_implicit_conversion ("Octave:array-to-scalar", |
3ac9f47fb04b
Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents:
21100
diff
changeset
|
106 "character matrix", "int64 scalar"); |
3ac9f47fb04b
Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents:
21100
diff
changeset
|
107 |
3ac9f47fb04b
Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents:
21100
diff
changeset
|
108 retval = octave_int64 (matrix(0, 0)); |
20252
7fa170cc14fe
Return correct hex value for printf when used with string inputs (bug #45263).
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
109 |
7fa170cc14fe
Return correct hex value for printf when used with string inputs (bug #45263).
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
110 return retval; |
7fa170cc14fe
Return correct hex value for printf when used with string inputs (bug #45263).
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
111 } |
7fa170cc14fe
Return correct hex value for printf when used with string inputs (bug #45263).
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
112 |
7fa170cc14fe
Return correct hex value for printf when used with string inputs (bug #45263).
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
113 octave_uint64 |
7fa170cc14fe
Return correct hex value for printf when used with string inputs (bug #45263).
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
114 octave_char_matrix::uint64_scalar_value () const |
7fa170cc14fe
Return correct hex value for printf when used with string inputs (bug #45263).
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
115 { |
7fa170cc14fe
Return correct hex value for printf when used with string inputs (bug #45263).
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
116 octave_uint64 retval = 0; |
7fa170cc14fe
Return correct hex value for printf when used with string inputs (bug #45263).
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
117 |
21118
3ac9f47fb04b
Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents:
21100
diff
changeset
|
118 if (rows () == 0 || columns () == 0) |
3ac9f47fb04b
Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents:
21100
diff
changeset
|
119 err_invalid_conversion ("character matrix", "uint64 scalar"); |
20252
7fa170cc14fe
Return correct hex value for printf when used with string inputs (bug #45263).
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
120 |
21118
3ac9f47fb04b
Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents:
21100
diff
changeset
|
121 warn_implicit_conversion ("Octave:array-to-scalar", |
3ac9f47fb04b
Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents:
21100
diff
changeset
|
122 "character matrix", "uint64 scalar"); |
3ac9f47fb04b
Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents:
21100
diff
changeset
|
123 |
3ac9f47fb04b
Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents:
21100
diff
changeset
|
124 retval = octave_uint64 (matrix(0, 0)); |
20252
7fa170cc14fe
Return correct hex value for printf when used with string inputs (bug #45263).
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
125 |
7fa170cc14fe
Return correct hex value for printf when used with string inputs (bug #45263).
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
126 return retval; |
7fa170cc14fe
Return correct hex value for printf when used with string inputs (bug #45263).
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
127 } |
7fa170cc14fe
Return correct hex value for printf when used with string inputs (bug #45263).
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
128 |
2376 | 129 Complex |
130 octave_char_matrix::complex_value (bool) const | |
131 { | |
4102 | 132 double tmp = lo_ieee_nan_value (); |
133 | |
134 Complex retval (tmp, tmp); | |
2376 | 135 |
21118
3ac9f47fb04b
Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents:
21100
diff
changeset
|
136 if (rows () == 0 && columns () == 0) |
3ac9f47fb04b
Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents:
21100
diff
changeset
|
137 err_invalid_conversion ("character matrix", "complex scalar"); |
4455 | 138 |
21118
3ac9f47fb04b
Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents:
21100
diff
changeset
|
139 warn_implicit_conversion ("Octave:array-to-scalar", |
3ac9f47fb04b
Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents:
21100
diff
changeset
|
140 "character matrix", "complex scalar"); |
3ac9f47fb04b
Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents:
21100
diff
changeset
|
141 |
3ac9f47fb04b
Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents:
21100
diff
changeset
|
142 retval = static_cast<unsigned char> (matrix(0, 0)); |
2376 | 143 |
144 return retval; | |
145 } | |
146 | |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
147 FloatComplex |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
148 octave_char_matrix::float_complex_value (bool) const |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
149 { |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
150 float tmp = lo_ieee_float_nan_value (); |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
151 |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
152 FloatComplex retval (tmp, tmp); |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
153 |
21118
3ac9f47fb04b
Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents:
21100
diff
changeset
|
154 if (rows () == 0 || columns () == 0) |
3ac9f47fb04b
Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents:
21100
diff
changeset
|
155 err_invalid_conversion ("character matrix", "complex scalar"); |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
156 |
21118
3ac9f47fb04b
Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents:
21100
diff
changeset
|
157 warn_implicit_conversion ("Octave:array-to-scalar", |
3ac9f47fb04b
Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents:
21100
diff
changeset
|
158 "character matrix", "complex scalar"); |
3ac9f47fb04b
Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents:
21100
diff
changeset
|
159 |
3ac9f47fb04b
Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents:
21100
diff
changeset
|
160 retval = static_cast<unsigned char> (matrix(0, 0)); |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
161 |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
162 return retval; |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
163 } |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
164 |
22296
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
165 octave_value |
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
166 octave_char_matrix::as_double (void) const |
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
167 { |
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
168 return NDArray (matrix); |
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
169 } |
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
170 |
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
171 octave_value |
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
172 octave_char_matrix::as_single (void) const |
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
173 { |
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
174 return FloatNDArray (matrix); |
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
175 } |
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
176 |
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
177 octave_value |
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
178 octave_char_matrix::as_int8 (void) const |
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
179 { |
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
180 return int8NDArray (matrix); |
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
181 } |
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
182 |
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
183 octave_value |
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
184 octave_char_matrix::as_int16 (void) const |
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
185 { |
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
186 return int16NDArray (matrix); |
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
187 } |
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
188 |
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
189 octave_value |
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
190 octave_char_matrix::as_int32 (void) const |
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
191 { |
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
192 return int32NDArray (matrix); |
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
193 } |
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
194 |
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
195 octave_value |
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
196 octave_char_matrix::as_int64 (void) const |
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
197 { |
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
198 return int64NDArray (matrix); |
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
199 } |
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
200 |
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
201 octave_value |
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
202 octave_char_matrix::as_uint8 (void) const |
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
203 { |
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
204 return uint8NDArray (matrix); |
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
205 } |
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
206 |
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
207 octave_value |
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
208 octave_char_matrix::as_uint16 (void) const |
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
209 { |
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
210 return uint16NDArray (matrix); |
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
211 } |
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
212 |
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
213 octave_value |
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
214 octave_char_matrix::as_uint32 (void) const |
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
215 { |
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
216 return uint32NDArray (matrix); |
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
217 } |
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
218 |
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
219 octave_value |
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
220 octave_char_matrix::as_uint64 (void) const |
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
221 { |
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
222 return uint64NDArray (matrix); |
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
223 } |
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
224 |
4643 | 225 void |
226 octave_char_matrix::print_raw (std::ostream& os, | |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
227 bool pr_as_read_syntax) const |
4643 | 228 { |
229 octave_print_internal (os, matrix, pr_as_read_syntax, | |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
230 current_print_indent_level ()); |
4643 | 231 } |
232 | |
5900 | 233 mxArray * |
234 octave_char_matrix::as_mxArray (void) const | |
235 { | |
236 mxArray *retval = new mxArray (mxCHAR_CLASS, dims (), mxREAL); | |
237 | |
238 mxChar *pr = static_cast<mxChar *> (retval->get_data ()); | |
239 | |
6686 | 240 mwSize nel = numel (); |
5900 | 241 |
242 const char *p = matrix.data (); | |
243 | |
6686 | 244 for (mwIndex i = 0; i < nel; i++) |
5900 | 245 pr[i] = p[i]; |
246 | |
247 return retval; | |
248 } | |
249 | |
15491
c9844b82945f
reformat interesting comment
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
15452
diff
changeset
|
250 // The C++ standard guarantees cctype defines functions, not macros (and |
c9844b82945f
reformat interesting comment
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
15452
diff
changeset
|
251 // hence macros *CAN'T* be defined if only cctype is included) so |
15850
ffd1a99733bd
build: Check for isascii() before using it.
Rik <rik@octave.org>
parents:
15501
diff
changeset
|
252 // there's no need to fuck around. The exceptions are isascii and |
ffd1a99733bd
build: Check for isascii() before using it.
Rik <rik@octave.org>
parents:
15501
diff
changeset
|
253 // toascii, which are not C++. Oddly enough, all those character |
ffd1a99733bd
build: Check for isascii() before using it.
Rik <rik@octave.org>
parents:
15501
diff
changeset
|
254 // functions are int (*) (int), even in C++. Wicked! |
9812
f80c566bc751
improve unary mapper system
Jaroslav Hajek <highegg@gmail.com>
parents:
9690
diff
changeset
|
255 static inline int xisascii (int c) |
15850
ffd1a99733bd
build: Check for isascii() before using it.
Rik <rik@octave.org>
parents:
15501
diff
changeset
|
256 { |
21724
aba2e6293dd8
use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
257 #if defined (HAVE_ISASCII) |
15850
ffd1a99733bd
build: Check for isascii() before using it.
Rik <rik@octave.org>
parents:
15501
diff
changeset
|
258 return isascii (c); |
ffd1a99733bd
build: Check for isascii() before using it.
Rik <rik@octave.org>
parents:
15501
diff
changeset
|
259 #else |
ffd1a99733bd
build: Check for isascii() before using it.
Rik <rik@octave.org>
parents:
15501
diff
changeset
|
260 return (c >= 0x00 && c <= 0x7f); |
ffd1a99733bd
build: Check for isascii() before using it.
Rik <rik@octave.org>
parents:
15501
diff
changeset
|
261 #endif |
ffd1a99733bd
build: Check for isascii() before using it.
Rik <rik@octave.org>
parents:
15501
diff
changeset
|
262 } |
9689
34d6f005db4b
eliminate is_string argument from octave_value character array constructors
John W. Eaton <jwe@octave.org>
parents:
8956
diff
changeset
|
263 |
9812
f80c566bc751
improve unary mapper system
Jaroslav Hajek <highegg@gmail.com>
parents:
9690
diff
changeset
|
264 static inline int xtoascii (int c) |
15452
4d960b078272
build: Remove unnecessary AC_CHECK_FUNCS calls.
Rik <rik@octave.org>
parents:
15195
diff
changeset
|
265 { |
21724
aba2e6293dd8
use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
266 #if defined (HAVE_TOASCII) |
15452
4d960b078272
build: Remove unnecessary AC_CHECK_FUNCS calls.
Rik <rik@octave.org>
parents:
15195
diff
changeset
|
267 return toascii (c); |
4d960b078272
build: Remove unnecessary AC_CHECK_FUNCS calls.
Rik <rik@octave.org>
parents:
15195
diff
changeset
|
268 #else |
4d960b078272
build: Remove unnecessary AC_CHECK_FUNCS calls.
Rik <rik@octave.org>
parents:
15195
diff
changeset
|
269 return (c & 0x7F); |
4d960b078272
build: Remove unnecessary AC_CHECK_FUNCS calls.
Rik <rik@octave.org>
parents:
15195
diff
changeset
|
270 #endif |
4d960b078272
build: Remove unnecessary AC_CHECK_FUNCS calls.
Rik <rik@octave.org>
parents:
15195
diff
changeset
|
271 } |
9812
f80c566bc751
improve unary mapper system
Jaroslav Hajek <highegg@gmail.com>
parents:
9690
diff
changeset
|
272 |
f80c566bc751
improve unary mapper system
Jaroslav Hajek <highegg@gmail.com>
parents:
9690
diff
changeset
|
273 octave_value |
f80c566bc751
improve unary mapper system
Jaroslav Hajek <highegg@gmail.com>
parents:
9690
diff
changeset
|
274 octave_char_matrix::map (unary_mapper_t umap) const |
f80c566bc751
improve unary mapper system
Jaroslav Hajek <highegg@gmail.com>
parents:
9690
diff
changeset
|
275 { |
15501
814c4b0d5c49
make numeric mapper functions throw error for char args (bug #37535)
John W. Eaton <jwe@octave.org>
parents:
15491
diff
changeset
|
276 octave_value retval; |
814c4b0d5c49
make numeric mapper functions throw error for char args (bug #37535)
John W. Eaton <jwe@octave.org>
parents:
15491
diff
changeset
|
277 |
9812
f80c566bc751
improve unary mapper system
Jaroslav Hajek <highegg@gmail.com>
parents:
9690
diff
changeset
|
278 switch (umap) |
f80c566bc751
improve unary mapper system
Jaroslav Hajek <highegg@gmail.com>
parents:
9690
diff
changeset
|
279 { |
22407
34ce5be04942
maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
280 #define STRING_MAPPER(UMAP,FCN,TYPE) \ |
34ce5be04942
maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
281 case umap_ ## UMAP: \ |
34ce5be04942
maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
282 return octave_value (matrix.map<TYPE, int (&) (int)> (FCN)) |
9689
34d6f005db4b
eliminate is_string argument from octave_value character array constructors
John W. Eaton <jwe@octave.org>
parents:
8956
diff
changeset
|
283 |
9813
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
284 STRING_MAPPER (xisalnum, std::isalnum, bool); |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
285 STRING_MAPPER (xisalpha, std::isalpha, bool); |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
286 STRING_MAPPER (xisascii, xisascii, bool); |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
287 STRING_MAPPER (xiscntrl, std::iscntrl, bool); |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
288 STRING_MAPPER (xisdigit, std::isdigit, bool); |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
289 STRING_MAPPER (xisgraph, std::isgraph, bool); |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
290 STRING_MAPPER (xislower, std::islower, bool); |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
291 STRING_MAPPER (xisprint, std::isprint, bool); |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
292 STRING_MAPPER (xispunct, std::ispunct, bool); |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
293 STRING_MAPPER (xisspace, std::isspace, bool); |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
294 STRING_MAPPER (xisupper, std::isupper, bool); |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
295 STRING_MAPPER (xisxdigit, std::isxdigit, bool); |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
296 STRING_MAPPER (xtoascii, xtoascii, double); |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
297 STRING_MAPPER (xtolower, std::tolower, char); |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
298 STRING_MAPPER (xtoupper, std::toupper, char); |
9689
34d6f005db4b
eliminate is_string argument from octave_value character array constructors
John W. Eaton <jwe@octave.org>
parents:
8956
diff
changeset
|
299 |
20711
7b608fadc663
Make error messages more specific about the variable and problem encountered.
Rik <rik@octave.org>
parents:
20252
diff
changeset
|
300 // For Matlab compatibility, these should work on ASCII values |
7b608fadc663
Make error messages more specific about the variable and problem encountered.
Rik <rik@octave.org>
parents:
20252
diff
changeset
|
301 // without error or warning. |
15501
814c4b0d5c49
make numeric mapper functions throw error for char args (bug #37535)
John W. Eaton <jwe@octave.org>
parents:
15491
diff
changeset
|
302 case umap_abs: |
814c4b0d5c49
make numeric mapper functions throw error for char args (bug #37535)
John W. Eaton <jwe@octave.org>
parents:
15491
diff
changeset
|
303 case umap_ceil: |
814c4b0d5c49
make numeric mapper functions throw error for char args (bug #37535)
John W. Eaton <jwe@octave.org>
parents:
15491
diff
changeset
|
304 case umap_fix: |
814c4b0d5c49
make numeric mapper functions throw error for char args (bug #37535)
John W. Eaton <jwe@octave.org>
parents:
15491
diff
changeset
|
305 case umap_floor: |
814c4b0d5c49
make numeric mapper functions throw error for char args (bug #37535)
John W. Eaton <jwe@octave.org>
parents:
15491
diff
changeset
|
306 case umap_imag: |
814c4b0d5c49
make numeric mapper functions throw error for char args (bug #37535)
John W. Eaton <jwe@octave.org>
parents:
15491
diff
changeset
|
307 case umap_isinf: |
814c4b0d5c49
make numeric mapper functions throw error for char args (bug #37535)
John W. Eaton <jwe@octave.org>
parents:
15491
diff
changeset
|
308 case umap_isnan: |
814c4b0d5c49
make numeric mapper functions throw error for char args (bug #37535)
John W. Eaton <jwe@octave.org>
parents:
15491
diff
changeset
|
309 case umap_real: |
814c4b0d5c49
make numeric mapper functions throw error for char args (bug #37535)
John W. Eaton <jwe@octave.org>
parents:
15491
diff
changeset
|
310 case umap_round: |
9812
f80c566bc751
improve unary mapper system
Jaroslav Hajek <highegg@gmail.com>
parents:
9690
diff
changeset
|
311 { |
f80c566bc751
improve unary mapper system
Jaroslav Hajek <highegg@gmail.com>
parents:
9690
diff
changeset
|
312 octave_matrix m (array_value (true)); |
f80c566bc751
improve unary mapper system
Jaroslav Hajek <highegg@gmail.com>
parents:
9690
diff
changeset
|
313 return m.map (umap); |
f80c566bc751
improve unary mapper system
Jaroslav Hajek <highegg@gmail.com>
parents:
9690
diff
changeset
|
314 } |
15501
814c4b0d5c49
make numeric mapper functions throw error for char args (bug #37535)
John W. Eaton <jwe@octave.org>
parents:
15491
diff
changeset
|
315 |
814c4b0d5c49
make numeric mapper functions throw error for char args (bug #37535)
John W. Eaton <jwe@octave.org>
parents:
15491
diff
changeset
|
316 default: |
20711
7b608fadc663
Make error messages more specific about the variable and problem encountered.
Rik <rik@octave.org>
parents:
20252
diff
changeset
|
317 error ("%s: argument must be numeric", get_umap_name (umap)); |
15501
814c4b0d5c49
make numeric mapper functions throw error for char args (bug #37535)
John W. Eaton <jwe@octave.org>
parents:
15491
diff
changeset
|
318 break; |
9812
f80c566bc751
improve unary mapper system
Jaroslav Hajek <highegg@gmail.com>
parents:
9690
diff
changeset
|
319 } |
15501
814c4b0d5c49
make numeric mapper functions throw error for char args (bug #37535)
John W. Eaton <jwe@octave.org>
parents:
15491
diff
changeset
|
320 |
814c4b0d5c49
make numeric mapper functions throw error for char args (bug #37535)
John W. Eaton <jwe@octave.org>
parents:
15491
diff
changeset
|
321 return retval; |
9812
f80c566bc751
improve unary mapper system
Jaroslav Hajek <highegg@gmail.com>
parents:
9690
diff
changeset
|
322 } |
22407
34ce5be04942
maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
323 |