# HG changeset patch # User John W. Eaton # Date 1424974024 18000 # Node ID 17d647821d6124f7ae022a12197dcd38059ea1d7 # Parent 09ed6f7538dddc5e630b1d5badccfc84fffdae89 maint: More cleanup of C++ code to follow Octave coding conventions. * gl-select.cc, betainc.cc, bitfcns.cc, bsxfun.cc, gl-render.cc, graphics.cc, load-save.cc, ls-mat-ascii.cc, ls-mat5.cc, lu.cc, oct-stream.cc, symtab.cc, variables.cc, __eigs__.cc, __magick_read__.cc, chol.cc, ov-base-sparse.cc, ov-class.cc, ov-classdef.cc, ov-fcn-inline.cc, ov-perm.cc, ov.cc, CMatrix.cc, CSparse.cc, MSparse.cc, MatrixType.cc, MatrixType.h, dMatrix.cc, dSparse.cc, fCMatrix.cc, fMatrix.cc, eigs-base.cc, lo-sysdep.cc, kpse.cc: Break long lines before && and ||. diff -r 09ed6f7538dd -r 17d647821d61 libgui/graphics/gl-select.cc --- a/libgui/graphics/gl-select.cc Thu Feb 26 10:49:20 2015 -0500 +++ b/libgui/graphics/gl-select.cc Thu Feb 26 13:07:04 2015 -0500 @@ -92,8 +92,8 @@ minZ = select_buffer[j++]; j++; // skip maxZ - if (((flags & select_last) == 0 && (minZ <= current_minZ)) || - ((flags & select_last) != 0 && (minZ >= current_minZ))) + if (((flags & select_last) == 0 && (minZ <= current_minZ)) + || ((flags & select_last) != 0 && (minZ >= current_minZ))) { bool candidate = true; GLuint name = diff -r 09ed6f7538dd -r 17d647821d61 libinterp/corefcn/betainc.cc --- a/libinterp/corefcn/betainc.cc Thu Feb 26 10:49:20 2015 -0500 +++ b/libinterp/corefcn/betainc.cc Thu Feb 26 13:07:04 2015 -0500 @@ -74,8 +74,8 @@ octave_value b_arg = args(2); // FIXME: Can we make a template version of the duplicated code below - if (x_arg.is_single_type () || a_arg.is_single_type () || - b_arg.is_single_type ()) + if (x_arg.is_single_type () || a_arg.is_single_type () + || b_arg.is_single_type ()) { if (x_arg.is_scalar_type ()) { @@ -451,8 +451,8 @@ // accepted float inputs and returned float outputs. As it is, we do // extra work to calculate betaincinv to double precision and then throw // that precision away. - if (x_arg.is_single_type () || a_arg.is_single_type () || - b_arg.is_single_type ()) + if (x_arg.is_single_type () || a_arg.is_single_type () + || b_arg.is_single_type ()) { retval = Array (retval.array_value ()); } diff -r 09ed6f7538dd -r 17d647821d61 libinterp/corefcn/bitfcns.cc --- a/libinterp/corefcn/bitfcns.cc Thu Feb 26 10:49:20 2015 -0500 +++ b/libinterp/corefcn/bitfcns.cc Thu Feb 26 13:07:04 2015 -0500 @@ -131,6 +131,26 @@ return bitopxx (std::bit_xor(), fname, x, y); } +static inline int +bitop_arg_is_int (const octave_value& arg) +{ + return (arg.class_name () != octave_scalar::static_class_name () + && arg.class_name () != octave_float_scalar::static_class_name () + && arg.class_name () != octave_bool::static_class_name ()); +} + +static inline int +bitop_arg_is_bool (const octave_value& arg) +{ + return arg.class_name () == octave_bool::static_class_name (); +} + +static inline int +bitop_arg_is_float (const octave_value& arg) +{ + return arg.class_name () == octave_float_scalar::static_class_name (); +} + octave_value bitop (const std::string& fname, const octave_value_list& args) { @@ -140,33 +160,21 @@ if (nargin == 2) { - if ((args(0).class_name () == octave_scalar::static_class_name ()) - || (args(0).class_name () == octave_float_scalar::static_class_name ()) - || (args(0).class_name () == octave_bool::static_class_name ()) - || (args(1).class_name () == octave_scalar::static_class_name ()) - || (args(1).class_name () == octave_float_scalar::static_class_name ()) - || (args(1).class_name () == octave_bool::static_class_name ())) + if (args(0).class_name () == octave_scalar::static_class_name () + || args(0).class_name () == octave_float_scalar::static_class_name () + || args(0).class_name () == octave_bool::static_class_name () + || args(1).class_name () == octave_scalar::static_class_name () + || args(1).class_name () == octave_float_scalar::static_class_name () + || args(1).class_name () == octave_bool::static_class_name ()) { - bool arg0_is_int = (args(0).class_name () != - octave_scalar::static_class_name () && - args(0).class_name () != - octave_float_scalar::static_class_name () && - args(0).class_name () != - octave_bool::static_class_name ()); - bool arg1_is_int = (args(1).class_name () != - octave_scalar::static_class_name () && - args(1).class_name () != - octave_float_scalar::static_class_name () && - args(1).class_name () != - octave_bool::static_class_name ()); - bool arg0_is_bool = args(0).class_name () == - octave_bool::static_class_name (); - bool arg1_is_bool = args(1).class_name () == - octave_bool::static_class_name (); - bool arg0_is_float = args(0).class_name () == - octave_float_scalar::static_class_name (); - bool arg1_is_float = args(1).class_name () == - octave_float_scalar::static_class_name (); + bool arg0_is_int = bitop_arg_is_int (args(0)); + bool arg1_is_int = bitop_arg_is_int (args(1)); + + bool arg0_is_bool = bitop_arg_is_bool (args(0)); + bool arg1_is_bool = bitop_arg_is_bool (args(1)); + + bool arg0_is_float = bitop_arg_is_float (args(0)); + bool arg1_is_float = bitop_arg_is_float (args(1)); if (! (arg0_is_int || arg1_is_int)) { diff -r 09ed6f7538dd -r 17d647821d61 libinterp/corefcn/bsxfun.cc --- a/libinterp/corefcn/bsxfun.cc Thu Feb 26 10:49:20 2015 -0500 +++ b/libinterp/corefcn/bsxfun.cc Thu Feb 26 13:07:04 2015 -0500 @@ -536,8 +536,8 @@ { update_index (ra_idx, dvc, i); - if (have_FloatNDArray || - have_FloatComplexNDArray) + if (have_FloatNDArray + || have_FloatComplexNDArray) { if (! tmp(0).is_float_type ()) { @@ -555,8 +555,8 @@ } else if (tmp(0).is_double_type ()) { - if (tmp(0).is_complex_type () && - have_FloatNDArray) + if (tmp(0).is_complex_type () + && have_FloatNDArray) { result_ComplexNDArray = ComplexNDArray (result_FloatNDArray); diff -r 09ed6f7538dd -r 17d647821d61 libinterp/corefcn/gl-render.cc --- a/libinterp/corefcn/gl-render.cc Thu Feb 26 10:49:20 2015 -0500 +++ b/libinterp/corefcn/gl-render.cc Thu Feb 26 13:07:04 2015 -0500 @@ -1575,9 +1575,9 @@ set_clipping (false); - if (! props.marker_is ("none") && - ! (props.markeredgecolor_is ("none") - && props.markerfacecolor_is ("none"))) + if (! props.marker_is ("none") + && ! (props.markeredgecolor_is ("none") + && props.markerfacecolor_is ("none"))) { Matrix lc, fc; @@ -2136,9 +2136,9 @@ } } - if (! props.marker_is ("none") && - ! (props.markeredgecolor_is ("none") - && props.markerfacecolor_is ("none"))) + if (! props.marker_is ("none") + && ! (props.markeredgecolor_is ("none") + && props.markerfacecolor_is ("none"))) { // FIXME: check how transparency should be handled in markers // FIXME: check what to do with marker facecolor set to auto diff -r 09ed6f7538dd -r 17d647821d61 libinterp/corefcn/graphics.cc --- a/libinterp/corefcn/graphics.cc Thu Feb 26 10:49:20 2015 -0500 +++ b/libinterp/corefcn/graphics.cc Thu Feb 26 13:07:04 2015 -0500 @@ -2806,9 +2806,9 @@ std::string pname = it->first; // Don't reset internal properties and handle_properties - if (! obj.has_readonly_property (pname) && - pname.find ("__") != 0 && pname.find ("current") != 0 && - pname != "uicontextmenu" && pname != "parent") + if (! obj.has_readonly_property (pname) + && pname.find ("__") != 0 && pname.find ("current") != 0 + && pname != "uicontextmenu" && pname != "parent") { // Store *mode prop/val in order to set them last if (pname.find ("mode") == (pname.length () - 4)) @@ -3222,8 +3222,8 @@ for (octave_map::const_iterator pa = m.begin (); pa != m.end (); pa++) { - if (pa->first != "children" && - ! obj.has_readonly_property (pa->first)) + if (pa->first != "children" + && ! obj.has_readonly_property (pa->first)) { property p = get_properties ().get_property (pa->first); @@ -7375,10 +7375,10 @@ void axes::update_axis_limits (const std::string& axis_type) { - if ((updating_axis_limits.find (get_handle ().value ()) != - updating_axis_limits.end ()) || - (updating_aspectratios.find (get_handle ().value ()) != - updating_aspectratios.end ())) + if ((updating_axis_limits.find (get_handle ().value ()) + != updating_axis_limits.end ()) + || (updating_aspectratios.find (get_handle ().value ()) + != updating_aspectratios.end ())) return; Matrix kids = xproperties.get_children (); @@ -8082,16 +8082,16 @@ #endif - if (autopos_tag_is ("xlabel") || autopos_tag_is ("ylabel") || - autopos_tag_is ("zlabel") || autopos_tag_is ("title")) + if (autopos_tag_is ("xlabel") || autopos_tag_is ("ylabel") + || autopos_tag_is ("zlabel") || autopos_tag_is ("title")) update_autopos ("sync"); } void text::properties::request_autopos (void) { - if (autopos_tag_is ("xlabel") || autopos_tag_is ("ylabel") || - autopos_tag_is ("zlabel") || autopos_tag_is ("title")) + if (autopos_tag_is ("xlabel") || autopos_tag_is ("ylabel") + || autopos_tag_is ("zlabel") || autopos_tag_is ("title")) update_autopos (get_autopos_tag ()); } @@ -8176,8 +8176,8 @@ NDArray cd = get_cdata ().array_value (); bad_data_msg = std::string (); - if (xd.dims () != yd.dims () || - (xd.dims () != zd.dims () && ! zd.is_empty ())) + if (xd.dims () != yd.dims () + || (xd.dims () != zd.dims () && ! zd.is_empty ())) { bad_data_msg = "x/y/zdata should have the same dimensions"; return; @@ -11234,8 +11234,8 @@ POSTSET); else { - if (args(2).is_string () && - args(2).string_value () == "persistent") + if (args(2).is_string () + && args(2).string_value () == "persistent") { go.delete_property_listener (pname, octave_value (), PERSISTENT); diff -r 09ed6f7538dd -r 17d647821d61 libinterp/corefcn/load-save.cc --- a/libinterp/corefcn/load-save.cc Thu Feb 26 10:49:20 2015 -0500 +++ b/libinterp/corefcn/load-save.cc Thu Feb 26 13:07:04 2015 -0500 @@ -215,8 +215,8 @@ std::ifstream file (fname.c_str ()); OCTAVE_LOCAL_BUFFER (unsigned char, magic, 2); - if (file.read (reinterpret_cast (magic), 2) && magic[0] == 0x1f && - magic[1] == 0x8b) + if (file.read (reinterpret_cast (magic), 2) && magic[0] == 0x1f + && magic[1] == 0x8b) retval = true; file.close (); @@ -1713,8 +1713,8 @@ return retval; } - bool write_header_info = ! (append && - H5Fis_hdf5 (fname.c_str ()) > 0); + bool write_header_info + = ! (append && H5Fis_hdf5 (fname.c_str ()) > 0); hdf5_ofstream hdf5_file (fname.c_str (), mode); diff -r 09ed6f7538dd -r 17d647821d61 libinterp/corefcn/ls-mat-ascii.cc --- a/libinterp/corefcn/ls-mat-ascii.cc Thu Feb 26 10:49:20 2015 -0500 +++ b/libinterp/corefcn/ls-mat-ascii.cc Thu Feb 26 13:07:04 2015 -0500 @@ -172,8 +172,8 @@ beg = buf.find_first_not_of (", \t", end); - if (beg == std::string::npos || (buf[beg] == '\r' && - beg == buf.length () - 1)) + if (beg == std::string::npos + || (buf[beg] == '\r' && beg == buf.length () - 1)) { // We had a line with trailing spaces and // ending with a CRLF, so this should look like EOL, diff -r 09ed6f7538dd -r 17d647821d61 libinterp/corefcn/ls-mat5.cc --- a/libinterp/corefcn/ls-mat5.cc Thu Feb 26 10:49:20 2015 -0500 +++ b/libinterp/corefcn/ls-mat5.cc Thu Feb 26 13:07:04 2015 -0500 @@ -632,8 +632,8 @@ // array flags subelement int32_t len; - if (read_mat5_tag (is, swap, type, len, is_small_data_element) || - type != miUINT32 || len != 8 || is_small_data_element) + if (read_mat5_tag (is, swap, type, len, is_small_data_element) + || type != miUINT32 || len != 8 || is_small_data_element) { error ("load: invalid array flags subelement"); goto early_read_error; @@ -659,8 +659,8 @@ { int32_t dim_len; - if (read_mat5_tag (is, swap, type, dim_len, is_small_data_element) || - type != miINT32) + if (read_mat5_tag (is, swap, type, dim_len, is_small_data_element) + || type != miINT32) { error ("load: invalid dimensions array subelement"); goto early_read_error; @@ -695,7 +695,8 @@ dims(1) = 1; } - if (read_mat5_tag (is, swap, type, len, is_small_data_element) || !INT8(type)) + if (read_mat5_tag (is, swap, type, len, is_small_data_element) + || ! INT8(type)) { error ("load: invalid array name subelement"); goto early_read_error; @@ -914,9 +915,9 @@ std::string mroot = m0.contents ("matlabroot").string_value (); - if ((fpath.length () >= mroot.length ()) && - fpath.substr (0, mroot.length ()) == mroot && - OCTAVE_EXEC_PREFIX != mroot) + if ((fpath.length () >= mroot.length ()) + && fpath.substr (0, mroot.length ()) == mroot + && OCTAVE_EXEC_PREFIX != mroot) { // If fpath starts with matlabroot, and matlabroot // doesn't equal octave_config_info ("exec_prefix") @@ -1097,7 +1098,7 @@ int32_t fn_type; int32_t fn_len; if (read_mat5_tag (is, swap, fn_type, fn_len, is_small_data_element) - || !INT8(fn_type)) + || ! INT8(fn_type)) { error ("load: invalid field name subelement"); goto data_read_error; @@ -1158,8 +1159,8 @@ { isclass = true; - if (read_mat5_tag (is, swap, type, len, is_small_data_element) || - !INT8(type)) + if (read_mat5_tag (is, swap, type, len, is_small_data_element) + || ! INT8(type)) { error ("load: invalid class name"); goto skip_ahead; @@ -1211,7 +1212,7 @@ // field name subelement. The length of this subelement tells // us how many fields there are. if (read_mat5_tag (is, swap, fn_type, fn_len, is_small_data_element) - || !INT8(fn_type)) + || ! INT8(fn_type)) { error ("load: invalid field name subelement"); goto data_read_error; diff -r 09ed6f7538dd -r 17d647821d61 libinterp/corefcn/lu.cc --- a/libinterp/corefcn/lu.cc Thu Feb 26 10:49:20 2015 -0500 +++ b/libinterp/corefcn/lu.cc Thu Feb 26 13:07:04 2015 -0500 @@ -593,8 +593,8 @@ octave_idx_type k = u.rows (); octave_idx_type n = u.columns (); return ((l.ndims () == 2 && u.ndims () == 2 && k == l.columns ()) - && k == std::min (m, n) && - (p.is_undefined () || p.rows () == m)); + && k == std::min (m, n) + && (p.is_undefined () || p.rows () == m)); } DEFUN (luupdate, args, , diff -r 09ed6f7538dd -r 17d647821d61 libinterp/corefcn/oct-stream.cc --- a/libinterp/corefcn/oct-stream.cc Thu Feb 26 10:49:20 2015 -0500 +++ b/libinterp/corefcn/oct-stream.cc Thu Feb 26 13:07:04 2015 -0500 @@ -4226,15 +4226,18 @@ if ((stream_number = os.file_number ()) == -1) return stream_number; - // Should we test for "(list.find (stream_number) != list.end ()) && - // list[stream_number].is_open ()" and respond with "error - // ("internal error: ...")"? It should not happen except for some - // bug or if the user has opened a stream with an interpreted - // command, but closed it directly with a system call in an - // oct-file; then the kernel knows the fd is free, but Octave does - // not know. If it happens, it should not do harm here to simply - // overwrite this entry, although the wrong entry might have done - // harm before. + // Should we test for + // + // (list.find (stream_number) != list.end () + // && list[stream_number].is_open ()) + // + // and respond with "error ("internal error: ...")"? It should not + // happen except for some bug or if the user has opened a stream with + // an interpreted command, but closed it directly with a system call + // in an oct-file; then the kernel knows the fd is free, but Octave + // does not know. If it happens, it should not do harm here to simply + // overwrite this entry, although the wrong entry might have done harm + // before. if (list.size () < list.max_size ()) list[stream_number] = os; diff -r 09ed6f7538dd -r 17d647821d61 libinterp/corefcn/symtab.cc --- a/libinterp/corefcn/symtab.cc Thu Feb 26 10:49:20 2015 -0500 +++ b/libinterp/corefcn/symtab.cc Thu Feb 26 13:07:04 2015 -0500 @@ -244,10 +244,12 @@ { int nm_len = nm.length (); - if (octave_env::absolute_pathname (nm) && - ((nm_len > 4 && (nm.substr (nm_len-4) == ".oct" - || nm.substr (nm_len-4) == ".mex")) - || (nm_len > 2 && nm.substr (nm_len-2) == ".m"))) + if (octave_env::absolute_pathname (nm) + && ((nm_len > 4 + && (nm.substr (nm_len-4) == ".oct" + || nm.substr (nm_len-4) == ".mex")) + || (nm_len > 2 + && nm.substr (nm_len-2) == ".m"))) file = nm; else { diff -r 09ed6f7538dd -r 17d647821d61 libinterp/corefcn/variables.cc --- a/libinterp/corefcn/variables.cc Thu Feb 26 10:49:20 2015 -0500 +++ b/libinterp/corefcn/variables.cc Thu Feb 26 13:07:04 2015 -0500 @@ -280,8 +280,8 @@ frame.run (); - if (tmp.is_defined () && - (tmp.is_map () || tmp.is_java () || tmp.is_classdef_object ())) + if (tmp.is_defined () + && (tmp.is_map () || tmp.is_java () || tmp.is_classdef_object ())) names = tmp.map_keys (); } } diff -r 09ed6f7538dd -r 17d647821d61 libinterp/dldfcn/__eigs__.cc --- a/libinterp/dldfcn/__eigs__.cc Thu Feb 26 10:49:20 2015 -0500 +++ b/libinterp/dldfcn/__eigs__.cc Thu Feb 26 13:07:04 2015 -0500 @@ -270,8 +270,8 @@ // Note hold off reading B till later to avoid issues of double // copies of the matrix if B is full/real while A is complex. - if (!error_state && nargin > 1 + arg_offset && - !(args(1 + arg_offset).is_real_scalar ())) + if (! error_state && nargin > 1 + arg_offset + && ! (args(1 + arg_offset).is_real_scalar ())) { if (args(1+arg_offset).is_complex_type ()) { diff -r 09ed6f7538dd -r 17d647821d61 libinterp/dldfcn/__magick_read__.cc --- a/libinterp/dldfcn/__magick_read__.cc Thu Feb 26 10:49:20 2015 -0500 +++ b/libinterp/dldfcn/__magick_read__.cc Thu Feb 26 13:07:04 2015 -0500 @@ -800,8 +800,8 @@ const octave_idx_type n = frameidx.nelem (); for (octave_idx_type frame = 0; frame < n; frame++) { - if (nRows != imvec[frameidx(frame)].rows () || - nCols != imvec[frameidx(frame)].columns ()) + if (nRows != imvec[frameidx(frame)].rows () + || nCols != imvec[frameidx(frame)].columns ()) { error ("imread: all frames must have the same size but frame %i is different", frameidx(frame) +1); diff -r 09ed6f7538dd -r 17d647821d61 libinterp/dldfcn/chol.cc --- a/libinterp/dldfcn/chol.cc Thu Feb 26 10:49:20 2015 -0500 +++ b/libinterp/dldfcn/chol.cc Thu Feb 26 13:07:04 2015 -0500 @@ -1271,8 +1271,8 @@ if (j > 0 && j <= n+1 && i > 0 && i <= n+1) { - if (argr.is_single_type () && argi.is_single_type () && - argj.is_single_type ()) + if (argr.is_single_type () && argi.is_single_type () + && argj.is_single_type ()) { if (argr.is_real_type ()) { diff -r 09ed6f7538dd -r 17d647821d61 libinterp/octave-value/ov-base-sparse.cc --- a/libinterp/octave-value/ov-base-sparse.cc Thu Feb 26 10:49:20 2015 -0500 +++ b/libinterp/octave-value/ov-base-sparse.cc Thu Feb 26 13:07:04 2015 -0500 @@ -411,9 +411,9 @@ octave_idx_type nc = 0; bool success = true; - if (extract_keyword (is, "nnz", nz, true) && - extract_keyword (is, "rows", nr, true) && - extract_keyword (is, "columns", nc, true)) + if (extract_keyword (is, "nnz", nz, true) + && extract_keyword (is, "rows", nr, true) + && extract_keyword (is, "columns", nc, true)) { T tmp (nr, nc, nz); diff -r 09ed6f7538dd -r 17d647821d61 libinterp/octave-value/ov-class.cc --- a/libinterp/octave-value/ov-class.cc Thu Feb 26 10:49:20 2015 -0500 +++ b/libinterp/octave-value/ov-class.cc Thu Feb 26 13:07:04 2015 -0500 @@ -1997,10 +1997,10 @@ for (octave_idx_type idx = 0; idx < n; idx++) { const std::string cl = cls(idx); - if ((cl == "float" && obj.is_float_type ()) || - (cl == "integer" && obj.is_integer_type ()) || - (cl == "numeric" && obj.is_numeric_type ()) || - obj.class_name () == cl || obj.is_instance_of (cl)) + if ((cl == "float" && obj.is_float_type ()) + || (cl == "integer" && obj.is_integer_type ()) + || (cl == "numeric" && obj.is_numeric_type ()) + || obj.class_name () == cl || obj.is_instance_of (cl)) matches(idx) = true; } return octave_value (matches); diff -r 09ed6f7538dd -r 17d647821d61 libinterp/octave-value/ov-classdef.cc --- a/libinterp/octave-value/ov-classdef.cc Thu Feb 26 10:49:20 2015 -0500 +++ b/libinterp/octave-value/ov-classdef.cc Thu Feb 26 13:07:04 2015 -0500 @@ -280,12 +280,11 @@ in_constructor = false; - if (fcn && - (fcn->is_class_method () - || fcn->is_classdef_constructor () - || fcn->is_anonymous_function_of_class () - || (fcn->is_private_function () - && ! fcn->dispatch_class ().empty ()))) + if (fcn && (fcn->is_class_method () + || fcn->is_classdef_constructor () + || fcn->is_anonymous_function_of_class () + || (fcn->is_private_function () + && ! fcn->dispatch_class ().empty ()))) { cls = lookup_class (fcn->dispatch_class ()); if (! error_state) @@ -3626,8 +3625,8 @@ // "end" that makes it impossible to execute the // function call at this stage. - if (type.size () > 1 && - ! fcn->is_postfix_index_handled (type[1])) + if (type.size () > 1 + && ! fcn->is_postfix_index_handled (type[1])) { octave_value_list tmp_args; diff -r 09ed6f7538dd -r 17d647821d61 libinterp/octave-value/ov-fcn-inline.cc --- a/libinterp/octave-value/ov-fcn-inline.cc Thu Feb 26 10:49:20 2015 -0500 +++ b/libinterp/octave-value/ov-fcn-inline.cc Thu Feb 26 13:07:04 2015 -0500 @@ -759,11 +759,11 @@ break; } - if (! have_arg && tmp_arg != "i" && tmp_arg != "j" && - tmp_arg != "NaN" && tmp_arg != "nan" && - tmp_arg != "Inf" && tmp_arg != "inf" && - tmp_arg != "NA" && tmp_arg != "pi" && - tmp_arg != "e" && tmp_arg != "eps") + if (! have_arg && tmp_arg != "i" && tmp_arg != "j" + && tmp_arg != "NaN" && tmp_arg != "nan" + && tmp_arg != "Inf" && tmp_arg != "inf" + && tmp_arg != "NA" && tmp_arg != "pi" + && tmp_arg != "e" && tmp_arg != "eps") fargs.append (tmp_arg); tmp_arg = std::string (); diff -r 09ed6f7538dd -r 17d647821d61 libinterp/octave-value/ov-perm.cc --- a/libinterp/octave-value/ov-perm.cc Thu Feb 26 10:49:20 2015 -0500 +++ b/libinterp/octave-value/ov-perm.cc Thu Feb 26 13:07:04 2015 -0500 @@ -112,11 +112,8 @@ // if error_state is set, we've already griped. if (! error_state && ! retval.is_defined ()) { - if (nidx == 2 && ! resize_ok && - idx0.is_scalar () && idx1.is_scalar ()) - { - retval = matrix.checkelem (idx0(0), idx1(0)); - } + if (nidx == 2 && ! resize_ok && idx0.is_scalar () && idx1.is_scalar ()) + retval = matrix.checkelem (idx0(0), idx1(0)); else retval = to_dense ().do_index_op (idx, resize_ok); } diff -r 09ed6f7538dd -r 17d647821d61 libinterp/octave-value/ov.cc --- a/libinterp/octave-value/ov.cc Thu Feb 26 10:49:20 2015 -0500 +++ b/libinterp/octave-value/ov.cc Thu Feb 26 13:07:04 2015 -0500 @@ -2036,8 +2036,9 @@ v2.numeric_conversion_function (); // Try biased (one-sided) conversions first. - if (cf2.type_id () >= 0 && - octave_value_typeinfo::lookup_binary_op (op, t1, cf2.type_id ())) + if (cf2.type_id () >= 0 + && octave_value_typeinfo::lookup_binary_op (op, t1, + cf2.type_id ())) cf1 = 0; else if (cf1.type_id () >= 0 && octave_value_typeinfo::lookup_binary_op (op, @@ -2097,10 +2098,10 @@ && octave_value_typeinfo::lookup_binary_op (op, t1, cf2.type_id ())) cf1 = 0; - else if (cf1.type_id () >= 0 && - octave_value_typeinfo::lookup_binary_op (op, - cf1.type_id (), - t2)) + else if (cf1.type_id () >= 0 + && octave_value_typeinfo::lookup_binary_op (op, + cf1.type_id (), + t2)) cf2 = 0; if (cf1) diff -r 09ed6f7538dd -r 17d647821d61 liboctave/array/CMatrix.cc --- a/liboctave/array/CMatrix.cc Thu Feb 26 10:49:20 2015 -0500 +++ b/liboctave/array/CMatrix.cc Thu Feb 26 13:07:04 2015 -0500 @@ -1938,8 +1938,7 @@ { volatile int typ = mattype.type (); - if (typ == MatrixType::Permuted_Upper || - typ == MatrixType::Upper) + if (typ == MatrixType::Permuted_Upper || typ == MatrixType::Upper) { octave_idx_type b_nc = b.cols (); rcon = 1.; @@ -2034,8 +2033,7 @@ { volatile int typ = mattype.type (); - if (typ == MatrixType::Permuted_Lower || - typ == MatrixType::Lower) + if (typ == MatrixType::Permuted_Lower || typ == MatrixType::Lower) { octave_idx_type b_nc = b.cols (); rcon = 1.; diff -r 09ed6f7538dd -r 17d647821d61 liboctave/array/CSparse.cc --- a/liboctave/array/CSparse.cc Thu Feb 26 10:49:20 2015 -0500 +++ b/liboctave/array/CSparse.cc Thu Feb 26 13:07:04 2015 -0500 @@ -772,8 +772,7 @@ int typ = mattyp.type (); mattyp.info (); - if (typ == MatrixType::Diagonal || - typ == MatrixType::Permuted_Diagonal) + if (typ == MatrixType::Diagonal || typ == MatrixType::Permuted_Diagonal) { if (typ == MatrixType::Permuted_Diagonal) retval = transpose (); @@ -827,8 +826,8 @@ int typ = mattyp.type (); mattyp.info (); - if (typ == MatrixType::Upper || typ == MatrixType::Permuted_Upper || - typ == MatrixType::Lower || typ == MatrixType::Permuted_Lower) + if (typ == MatrixType::Upper || typ == MatrixType::Permuted_Upper + || typ == MatrixType::Lower || typ == MatrixType::Permuted_Lower) { double anorm = 0.; double ainvnorm = 0.; @@ -902,8 +901,8 @@ colXp++; colUp++; } - } while ((rpX a.cidx (j) + 1) || - ((a.cidx (j+1) == a.cidx (j) + 1) && found[a.ridx (j)])) + if ((a.cidx (j+1) > a.cidx (j) + 1) + || ((a.cidx (j+1) == a.cidx (j) + 1) && found[a.ridx (j)])) { tmp_typ = MatrixType::Full; break; @@ -382,8 +382,8 @@ for (octave_idx_type j = 0; j < ncols; j++) { - if ((a.cidx (j+1) - a.cidx (j)) > 0 && - (a.ridx (a.cidx (j+1)-1) == i)) + if ((a.cidx (j+1) - a.cidx (j)) > 0 + && (a.ridx (a.cidx (j+1)-1) == i)) { perm[i] = j; found = true; @@ -474,12 +474,12 @@ // problems as being detected, and force to treat as singular // as this seems to cause issues. if (((typ == MatrixType::Lower || typ == MatrixType::Permuted_Lower) - && nrows > ncols) || - ((typ == MatrixType::Upper || typ == MatrixType::Permuted_Upper) - && nrows < ncols)) + && nrows > ncols) + || ((typ == MatrixType::Upper || typ == MatrixType::Permuted_Upper) + && nrows < ncols)) { - if (typ == MatrixType::Permuted_Upper || - typ == MatrixType::Permuted_Lower) + if (typ == MatrixType::Permuted_Upper + || typ == MatrixType::Permuted_Lower) delete [] perm; nperm = 0; typ = MatrixType::Rectangular; @@ -488,9 +488,9 @@ if (typ == MatrixType::Full && ncols != nrows) typ = MatrixType::Rectangular; - if (maybe_hermitian && (typ == MatrixType::Full || - typ == MatrixType::Tridiagonal || - typ == MatrixType::Banded)) + if (maybe_hermitian && (typ == MatrixType::Full + || typ == MatrixType::Tridiagonal + || typ == MatrixType::Banded)) { bool is_herm = true; @@ -596,8 +596,8 @@ for (octave_idx_type j = i; j < nm; j++) { - if ((a.cidx (j+1) > a.cidx (j) + 1) || - ((a.cidx (j+1) == a.cidx (j) + 1) && found[a.ridx (j)])) + if ((a.cidx (j+1) > a.cidx (j) + 1) + || ((a.cidx (j+1) == a.cidx (j) + 1) && found[a.ridx (j)])) { tmp_typ = MatrixType::Full; break; @@ -700,8 +700,8 @@ for (octave_idx_type j = 0; j < ncols; j++) { - if ((a.cidx (j+1) - a.cidx (j)) > 0 && - (a.ridx (a.cidx (j+1)-1) == i)) + if ((a.cidx (j+1) - a.cidx (j)) > 0 + && (a.ridx (a.cidx (j+1)-1) == i)) { perm[i] = j; found = true; @@ -792,12 +792,12 @@ // problems as being detected, and force to treat as singular // as this seems to cause issues. if (((typ == MatrixType::Lower || typ == MatrixType::Permuted_Lower) - && nrows > ncols) || - ((typ == MatrixType::Upper || typ == MatrixType::Permuted_Upper) - && nrows < ncols)) + && nrows > ncols) + || ((typ == MatrixType::Upper || typ == MatrixType::Permuted_Upper) + && nrows < ncols)) { - if (typ == MatrixType::Permuted_Upper || - typ == MatrixType::Permuted_Lower) + if (typ == MatrixType::Permuted_Upper + || typ == MatrixType::Permuted_Lower) delete [] perm; nperm = 0; typ = MatrixType::Rectangular; @@ -806,9 +806,9 @@ if (typ == MatrixType::Full && ncols != nrows) typ = MatrixType::Rectangular; - if (maybe_hermitian && (typ == MatrixType::Full || - typ == MatrixType::Tridiagonal || - typ == MatrixType::Banded)) + if (maybe_hermitian && (typ == MatrixType::Full + || typ == MatrixType::Tridiagonal + || typ == MatrixType::Banded)) { bool is_herm = true; @@ -890,8 +890,8 @@ bandden (0), upper_band (0), lower_band (0), dense (false), full (_full), nperm (0), perm (0) { - if ((t == MatrixType::Permuted_Upper || t == MatrixType::Permuted_Lower) && - np > 0 && p != 0) + if ((t == MatrixType::Permuted_Upper || t == MatrixType::Permuted_Lower) + && np > 0 && p != 0) { typ = t; nperm = np; @@ -965,15 +965,14 @@ if (typ != MatrixType::Unknown && (full || sp_bandden == octave_sparse_params::get_bandden ())) { - if (!quiet && - octave_sparse_params::get_key ("spumoni") != 0.) + if (!quiet && octave_sparse_params::get_key ("spumoni") != 0.) warn_cached (); return typ; } - if (typ != MatrixType::Unknown && - octave_sparse_params::get_key ("spumoni") != 0.) + if (typ != MatrixType::Unknown + && octave_sparse_params::get_key ("spumoni") != 0.) (*current_liboctave_warning_with_id_handler) ("Octave:matrix-type-info", "invalidating matrix type"); @@ -1208,14 +1207,13 @@ void MatrixType::mark_as_symmetric (void) { - if (typ == MatrixType::Tridiagonal || - typ == MatrixType::Tridiagonal_Hermitian) + if (typ == MatrixType::Tridiagonal + || typ == MatrixType::Tridiagonal_Hermitian) typ = MatrixType::Tridiagonal_Hermitian; - else if (typ == MatrixType::Banded || - typ == MatrixType::Banded_Hermitian) + else if (typ == MatrixType::Banded || typ == MatrixType::Banded_Hermitian) typ = MatrixType::Banded_Hermitian; - else if (typ == MatrixType::Full || typ == MatrixType::Hermitian || - typ == MatrixType::Unknown) + else if (typ == MatrixType::Full || typ == MatrixType::Hermitian + || typ == MatrixType::Unknown) typ = MatrixType::Hermitian; else (*current_liboctave_error_handler) @@ -1225,14 +1223,13 @@ void MatrixType::mark_as_unsymmetric (void) { - if (typ == MatrixType::Tridiagonal || - typ == MatrixType::Tridiagonal_Hermitian) + if (typ == MatrixType::Tridiagonal + || typ == MatrixType::Tridiagonal_Hermitian) typ = MatrixType::Tridiagonal; - else if (typ == MatrixType::Banded || - typ == MatrixType::Banded_Hermitian) + else if (typ == MatrixType::Banded || typ == MatrixType::Banded_Hermitian) typ = MatrixType::Banded; - else if (typ == MatrixType::Full || typ == MatrixType::Hermitian || - typ == MatrixType::Unknown) + else if (typ == MatrixType::Full || typ == MatrixType::Hermitian + || typ == MatrixType::Unknown) typ = MatrixType::Full; } diff -r 09ed6f7538dd -r 17d647821d61 liboctave/array/MatrixType.h --- a/liboctave/array/MatrixType.h Thu Feb 26 10:49:20 2015 -0500 +++ b/liboctave/array/MatrixType.h Thu Feb 26 13:07:04 2015 -0500 @@ -121,8 +121,8 @@ bool is_hermitian (void) const { - return (typ == Banded_Hermitian || typ == Tridiagonal_Hermitian || - typ == Hermitian); + return (typ == Banded_Hermitian || typ == Tridiagonal_Hermitian + || typ == Hermitian); } bool is_rectangular (void) const { return (typ == Rectangular); } diff -r 09ed6f7538dd -r 17d647821d61 liboctave/array/dMatrix.cc --- a/liboctave/array/dMatrix.cc Thu Feb 26 10:49:20 2015 -0500 +++ b/liboctave/array/dMatrix.cc Thu Feb 26 13:07:04 2015 -0500 @@ -1577,8 +1577,7 @@ { volatile int typ = mattype.type (); - if (typ == MatrixType::Permuted_Upper || - typ == MatrixType::Upper) + if (typ == MatrixType::Permuted_Upper || typ == MatrixType::Upper) { octave_idx_type b_nc = b.cols (); rcon = 1.; @@ -1672,8 +1671,7 @@ { volatile int typ = mattype.type (); - if (typ == MatrixType::Permuted_Lower || - typ == MatrixType::Lower) + if (typ == MatrixType::Permuted_Lower || typ == MatrixType::Lower) { octave_idx_type b_nc = b.cols (); rcon = 1.; diff -r 09ed6f7538dd -r 17d647821d61 liboctave/array/dSparse.cc --- a/liboctave/array/dSparse.cc Thu Feb 26 10:49:20 2015 -0500 +++ b/liboctave/array/dSparse.cc Thu Feb 26 13:07:04 2015 -0500 @@ -782,8 +782,8 @@ while (ja_lt_max || jb_lt_max) { octave_quit (); - if ((! jb_lt_max) || - (ja_lt_max && (x.ridx (ja) < y.ridx (jb)))) + if ((! jb_lt_max) + || (ja_lt_max && (x.ridx (ja) < y.ridx (jb)))) { r.ridx (jx) = x.ridx (ja); r.data (jx) = atan2 (x.data (ja), 0.); @@ -791,8 +791,8 @@ ja++; ja_lt_max= ja < ja_max; } - else if ((! ja_lt_max) || - (jb_lt_max && (y.ridx (jb) < x.ridx (ja)))) + else if ((! ja_lt_max) + || (jb_lt_max && (y.ridx (jb) < x.ridx (ja)))) { jb++; jb_lt_max= jb < jb_max; @@ -867,8 +867,7 @@ int typ = mattyp.type (); mattyp.info (); - if (typ == MatrixType::Diagonal || - typ == MatrixType::Permuted_Diagonal) + if (typ == MatrixType::Diagonal || typ == MatrixType::Permuted_Diagonal) { if (typ == MatrixType::Permuted_Diagonal) retval = transpose (); @@ -922,8 +921,8 @@ int typ = mattyp.type (); mattyp.info (); - if (typ == MatrixType::Upper || typ == MatrixType::Permuted_Upper || - typ == MatrixType::Lower || typ == MatrixType::Permuted_Lower) + if (typ == MatrixType::Upper || typ == MatrixType::Permuted_Upper + || typ == MatrixType::Lower || typ == MatrixType::Permuted_Lower) { double anorm = 0.; double ainvnorm = 0.; @@ -997,8 +996,8 @@ colXp++; colUp++; } - } while ((rpX U.xcidx (j) && - U.xridx (U.xcidx (j+1)-1) == j) + if (U.xcidx (j+1) > U.xcidx (j) + && U.xridx (U.xcidx (j+1)-1) == j) d = std::abs (U.xdata (U.xcidx (j+1)-1)); if (xisnan (minU) || d < minU) @@ -666,8 +666,8 @@ for (octave_idx_type j = 0; j < n; j++) { double d = 0.; - if (U.xcidx (j+1) > U.xcidx (j) && - U.xridx (U.xcidx (j+1)-1) == j) + if (U.xcidx (j+1) > U.xcidx (j) + && U.xridx (U.xcidx (j+1)-1) == j) d = std::abs (U.xdata (U.xcidx (j+1)-1)); if (xisnan (minU) || d < minU) @@ -846,8 +846,8 @@ { octave_idx_type bidx = static_cast (permB(i)); - if (checked(bidx) || bidx < 0 || - bidx >= n || D_NINT (bidx) != bidx) + if (checked(bidx) || bidx < 0 || bidx >= n + || D_NINT (bidx) != bidx) { (*current_liboctave_error_handler) ("eigs: permB vector invalid"); @@ -857,9 +857,9 @@ } } - if (typ != "LM" && typ != "SM" && typ != "LA" && typ != "SA" && - typ != "BE" && typ != "LR" && typ != "SR" && typ != "LI" && - typ != "SI") + if (typ != "LM" && typ != "SM" && typ != "LA" && typ != "SA" + && typ != "BE" && typ != "LR" && typ != "SR" && typ != "LI" + && typ != "SI") { (*current_liboctave_error_handler) ("eigs: unrecognized sigma value"); @@ -1169,8 +1169,8 @@ { octave_idx_type bidx = static_cast (permB(i)); - if (checked(bidx) || bidx < 0 || - bidx >= n || D_NINT (bidx) != bidx) + if (checked(bidx) || bidx < 0 || bidx >= n + || D_NINT (bidx) != bidx) { (*current_liboctave_error_handler) ("eigs: permB vector invalid"); @@ -1465,9 +1465,9 @@ if (! have_sigma) { - if (typ != "LM" && typ != "SM" && typ != "LA" && typ != "SA" && - typ != "BE" && typ != "LR" && typ != "SR" && typ != "LI" && - typ != "SI") + if (typ != "LM" && typ != "SM" && typ != "LA" && typ != "SA" + && typ != "BE" && typ != "LR" && typ != "SR" && typ != "LI" + && typ != "SI") (*current_liboctave_error_handler) ("eigs: unrecognized sigma value"); @@ -1760,8 +1760,8 @@ { octave_idx_type bidx = static_cast (permB(i)); - if (checked(bidx) || bidx < 0 || - bidx >= n || D_NINT (bidx) != bidx) + if (checked(bidx) || bidx < 0 || bidx >= n + || D_NINT (bidx) != bidx) { (*current_liboctave_error_handler) ("eigs: permB vector invalid"); @@ -1771,9 +1771,9 @@ } } - if (typ != "LM" && typ != "SM" && typ != "LA" && typ != "SA" && - typ != "BE" && typ != "LR" && typ != "SR" && typ != "LI" && - typ != "SI") + if (typ != "LM" && typ != "SM" && typ != "LA" && typ != "SA" + && typ != "BE" && typ != "LR" && typ != "SR" && typ != "LI" + && typ != "SI") { (*current_liboctave_error_handler) ("eigs: unrecognized sigma value"); @@ -2132,8 +2132,8 @@ { octave_idx_type bidx = static_cast (permB(i)); - if (checked(bidx) || bidx < 0 || - bidx >= n || D_NINT (bidx) != bidx) + if (checked(bidx) || bidx < 0 || bidx >= n + || D_NINT (bidx) != bidx) { (*current_liboctave_error_handler) ("eigs: permB vector invalid"); @@ -2483,9 +2483,9 @@ if (! have_sigma) { - if (typ != "LM" && typ != "SM" && typ != "LA" && typ != "SA" && - typ != "BE" && typ != "LR" && typ != "SR" && typ != "LI" && - typ != "SI") + if (typ != "LM" && typ != "SM" && typ != "LA" && typ != "SA" + && typ != "BE" && typ != "LR" && typ != "SR" && typ != "LI" + && typ != "SI") (*current_liboctave_error_handler) ("eigs: unrecognized sigma value"); @@ -2828,8 +2828,8 @@ { octave_idx_type bidx = static_cast (permB(i)); - if (checked(bidx) || bidx < 0 || - bidx >= n || D_NINT (bidx) != bidx) + if (checked(bidx) || bidx < 0 || bidx >= n + || D_NINT (bidx) != bidx) { (*current_liboctave_error_handler) ("eigs: permB vector invalid"); @@ -2839,9 +2839,9 @@ } } - if (typ != "LM" && typ != "SM" && typ != "LA" && typ != "SA" && - typ != "BE" && typ != "LR" && typ != "SR" && typ != "LI" && - typ != "SI") + if (typ != "LM" && typ != "SM" && typ != "LA" && typ != "SA" + && typ != "BE" && typ != "LR" && typ != "SR" && typ != "LI" + && typ != "SI") { (*current_liboctave_error_handler) ("eigs: unrecognized sigma value"); @@ -3152,8 +3152,8 @@ { octave_idx_type bidx = static_cast (permB(i)); - if (checked(bidx) || bidx < 0 || - bidx >= n || D_NINT (bidx) != bidx) + if (checked(bidx) || bidx < 0 || bidx >= n + || D_NINT (bidx) != bidx) { (*current_liboctave_error_handler) ("eigs: permB vector invalid"); @@ -3456,9 +3456,9 @@ if (! have_sigma) { - if (typ != "LM" && typ != "SM" && typ != "LA" && typ != "SA" && - typ != "BE" && typ != "LR" && typ != "SR" && typ != "LI" && - typ != "SI") + if (typ != "LM" && typ != "SM" && typ != "LA" && typ != "SA" + && typ != "BE" && typ != "LR" && typ != "SR" && typ != "LI" + && typ != "SI") (*current_liboctave_error_handler) ("eigs: unrecognized sigma value"); diff -r 09ed6f7538dd -r 17d647821d61 liboctave/system/lo-sysdep.cc --- a/liboctave/system/lo-sysdep.cc Thu Feb 26 10:49:20 2015 -0500 +++ b/liboctave/system/lo-sysdep.cc Thu Feb 26 13:07:04 2015 -0500 @@ -99,16 +99,18 @@ ZeroMemory (&si, sizeof (si)); si.cb = sizeof (si); - if (! CreatePipe (&childRead, &parentWrite, 0, 0) || - ! DuplicateHandle (hProcess, childRead, hProcess, &childRead, 0, TRUE, - DUPLICATE_SAME_ACCESS | DUPLICATE_CLOSE_SOURCE)) + if (! CreatePipe (&childRead, &parentWrite, 0, 0) + || ! DuplicateHandle (hProcess, childRead, hProcess, &childRead, + 0, TRUE, + DUPLICATE_SAME_ACCESS | DUPLICATE_CLOSE_SOURCE)) { msg = "popen2: pipe creation failed"; return -1; } - if (! CreatePipe (&parentRead, &childWrite, 0, 0) || - ! DuplicateHandle (hProcess, childWrite, hProcess, &childWrite, 0, TRUE, - DUPLICATE_SAME_ACCESS | DUPLICATE_CLOSE_SOURCE)) + if (! CreatePipe (&parentRead, &childWrite, 0, 0) + || ! DuplicateHandle (hProcess, childWrite, hProcess, &childWrite, + 0, TRUE, + DUPLICATE_SAME_ACCESS | DUPLICATE_CLOSE_SOURCE)) { msg = "popen2: pipe creation failed"; return -1; diff -r 09ed6f7538dd -r 17d647821d61 liboctave/util/kpse.cc --- a/liboctave/util/kpse.cc Thu Feb 26 10:49:20 2015 -0500 +++ b/liboctave/util/kpse.cc Thu Feb 26 13:07:04 2015 -0500 @@ -1658,10 +1658,10 @@ /* We ignore an open brace surrounded by whitespace, and also an open brace followed immediately by a close brace, that was preceded with whitespace. */ - if (c == '{' && - ((i == 0 || brace_whitespace (text[i-1])) && - (i+1 < text_len && - (brace_whitespace (text[i+1]) || text[i+1] == '}')))) + if (c == '{' + && ((i == 0 || brace_whitespace (text[i-1])) + && (i+1 < text_len + && (brace_whitespace (text[i+1]) || text[i+1] == '}')))) continue; /* If this is being compiled as part of bash, ignore the '{' in a '${ }' construct */