# HG changeset patch # User Rik # Date 1342272176 25200 # Node ID f7afecdd87efc09fb1c240082208db7d34fb895d # Parent e027f98403c39b488fbec3d48f3fb447d9b53326 maint: Use Octave coding conventions for cuddling parentheses in src/ directory * bitfcns.cc, comment-list.cc, data.cc, defun.cc, error.cc, gl-render.cc, graphics.cc, graphics.in.h, load-path.cc, load-path.h, load-save.cc, ls-hdf5.cc, ls-mat4.cc, ls-mat5.cc, ls-oct-ascii.cc, mappers.cc, mex.cc, oct-map.cc, oct-obj.cc, ov-base-int.cc, ov-base-mat.h, ov-base-sparse.cc, ov-bool-mat.cc, ov-bool-sparse.cc, ov-cell.cc, ov-class.cc, ov-complex.cc, ov-cx-mat.cc, ov-cx-sparse.cc, ov-fcn-handle.cc, ov-flt-cx-mat.cc, ov-flt-re-mat.cc, ov-re-mat.cc, ov-re-sparse.cc, ov-scalar.cc, ov-str-mat.cc, ov-struct.cc, ov-usr-fcn.cc, ov.cc, pr-output.cc, procstream.h, sighandlers.cc, sparse-xdiv.cc, sparse-xpow.cc, sparse.cc, symtab.cc, syscalls.cc, sysdep.cc, txt-eng-ft.cc, variables.cc, zfstream.cc, zfstream.h: Use Octave coding conventions for cuddling parentheses. diff --git a/src/bitfcns.cc b/src/bitfcns.cc --- a/src/bitfcns.cc +++ b/src/bitfcns.cc @@ -72,8 +72,8 @@ template octave_value -bitopxx(const OP& op, const std::string& fname, - const Array& x, const Array& y) +bitopxx (const OP& op, const std::string& fname, + const Array& x, const Array& y) { int nelx = x.numel (); int nely = y.numel (); @@ -98,9 +98,9 @@ for (int i = 0; i < nelx; i++) if (is_scalar_op) for (int k = 0; k < nely; k++) - result(i+k) = op(x(i), y(k)); + result(i+k) = op (x(i), y(k)); else - result(i) = op(x(i), y(i)); + result(i) = op (x(i), y(i)); retval = result; } @@ -117,7 +117,7 @@ // information about which integer types we need to instantiate. template octave_value -bitopx(const std::string& fname, const Array& x, const Array& y) +bitopx (const std::string& fname, const Array& x, const Array& y) { if (fname == "bitand") return bitopxx (std::bit_and(), fname, x, y); @@ -129,7 +129,7 @@ } octave_value -bitop(const std::string& fname, const octave_value_list& args) +bitop (const std::string& fname, const octave_value_list& args) { octave_value retval; diff --git a/src/comment-list.cc b/src/comment-list.cc --- a/src/comment-list.cc +++ b/src/comment-list.cc @@ -88,7 +88,7 @@ octave_comment_buffer::do_append (const std::string& s, octave_comment_elt::comment_type t) { - comment_list->append(s, t); + comment_list->append (s, t); } octave_comment_list * diff --git a/src/data.cc b/src/data.cc --- a/src/data.cc +++ b/src/data.cc @@ -1834,7 +1834,7 @@ for (int j = 0; j < n_args; j++) { // Can't fast return here to skip empty matrices as something - // like cat(1,[],single([])) must return an empty matrix of + // like cat (1,[],single ([])) must return an empty matrix of // the right type. tmp = do_cat_op (tmp, args (j), ra_idx); @@ -2340,7 +2340,7 @@ @deftypefn {Built-in Function} {} permute (@var{A}, @var{perm})\n\ Return the generalized transpose for an N-D array object @var{A}.\n\ The permutation vector @var{perm} must contain the elements\n\ -@code{1:ndims(A)} (in any order, but each element must appear only once).\n\ +@code{1:ndims (A)} (in any order, but each element must appear only once).\n\ @seealso{ipermute}\n\ @end deftypefn") { @@ -3100,10 +3100,10 @@ for (octave_idx_type j = 0; j < nc; j++) { octave_idx_type off = j * nr; - for (octave_idx_type i = im_val.cidx(j); - i < im_val.cidx(j + 1); i++) - result.data (im_val.ridx(i) + off) = - result.data (im_val.ridx(i) + off) + + for (octave_idx_type i = im_val.cidx (j); + i < im_val.cidx (j + 1); i++) + result.data (im_val.ridx (i) + off) = + result.data (im_val.ridx (i) + off) + Complex (0, im_val.data (i)); } } @@ -3123,10 +3123,10 @@ for (octave_idx_type j = 0; j < nc; j++) { octave_idx_type off = j * nr; - for (octave_idx_type i = re_val.cidx(j); - i < re_val.cidx(j + 1); i++) - result.data (re_val.ridx(i) + off) = - result.data (re_val.ridx(i) + off) + + for (octave_idx_type i = re_val.cidx (j); + i < re_val.cidx (j + 1); i++) + result.data (re_val.ridx (i) + off) = + result.data (re_val.ridx (i) + off) + re_val.data (i); } } diff --git a/src/defun.cc b/src/defun.cc --- a/src/defun.cc +++ b/src/defun.cc @@ -194,7 +194,7 @@ for (int i = 0; i < nout; i++) isargout[i] = true; - for (int i = std::max(nargout, 1); i < nout; i++) + for (int i = std::max (nargout, 1); i < nout; i++) isargout[i] = false; } diff --git a/src/error.cc b/src/error.cc --- a/src/error.cc +++ b/src/error.cc @@ -850,8 +850,8 @@ { if (err.contains ("message") && err.contains ("identifier")) { - std::string msg = err.contents("message").string_value (); - std::string id = err.contents("identifier").string_value (); + std::string msg = err.contents ("message").string_value (); + std::string id = err.contents ("identifier").string_value (); int len = msg.length (); std::string file; @@ -863,21 +863,21 @@ if (err.contains ("stack")) { - err_stack = err.contents("stack").map_value (); + err_stack = err.contents ("stack").map_value (); if (err_stack.numel () > 0) { if (err_stack.contains ("file")) - file = err_stack.contents("file")(0).string_value (); + file = err_stack.contents ("file")(0).string_value (); if (err_stack.contains ("name")) - nm = err_stack.contents("name")(0).string_value (); + nm = err_stack.contents ("name")(0).string_value (); if (err_stack.contains ("line")) - l = err_stack.contents("line")(0).nint_value (); + l = err_stack.contents ("line")(0).nint_value (); if (err_stack.contains ("column")) - c = err_stack.contents("column")(0).nint_value (); + c = err_stack.contents ("column")(0).nint_value (); } } @@ -1585,7 +1585,7 @@ Vlast_error_stack = initialize_last_error_stack (); } else - error("lasterror: unrecognized string argument"); + error ("lasterror: unrecognized string argument"); } else if (args(0).is_map ()) { @@ -1600,47 +1600,47 @@ if (! error_state && new_err.contains ("message")) { const std::string tmp = - new_err.getfield("message").string_value (); + new_err.getfield ("message").string_value (); new_error_message = tmp; } if (! error_state && new_err.contains ("identifier")) { const std::string tmp = - new_err.getfield("identifier").string_value (); + new_err.getfield ("identifier").string_value (); new_error_id = tmp; } if (! error_state && new_err.contains ("stack")) { octave_scalar_map new_err_stack = - new_err.getfield("stack").scalar_map_value (); + new_err.getfield ("stack").scalar_map_value (); if (! error_state && new_err_stack.contains ("file")) { const std::string tmp = - new_err_stack.getfield("file").string_value (); + new_err_stack.getfield ("file").string_value (); new_error_file = tmp; } if (! error_state && new_err_stack.contains ("name")) { const std::string tmp = - new_err_stack.getfield("name").string_value (); + new_err_stack.getfield ("name").string_value (); new_error_name = tmp; } if (! error_state && new_err_stack.contains ("line")) { const int tmp = - new_err_stack.getfield("line").nint_value (); + new_err_stack.getfield ("line").nint_value (); new_error_line = tmp; } if (! error_state && new_err_stack.contains ("column")) { const int tmp = - new_err_stack.getfield("column").nint_value (); + new_err_stack.getfield ("column").nint_value (); new_error_column = tmp; } } diff --git a/src/gl-render.cc b/src/gl-render.cc --- a/src/gl-render.cc +++ b/src/gl-render.cc @@ -416,7 +416,7 @@ protected: void begin (GLenum type) { - //printf("patch_tesselator::begin (%d)\n", type); + //printf ("patch_tesselator::begin (%d)\n", type); first = true; if (color_mode == 2 || light_mode == 2) @@ -432,7 +432,7 @@ void end (void) { - //printf("patch_tesselator::end\n"); + //printf ("patch_tesselator::end\n"); glEnd (); renderer->set_polygon_offset (false); } @@ -441,7 +441,7 @@ { vertex_data::vertex_data_rep *v = reinterpret_cast (data); - //printf("patch_tesselator::vertex (%g, %g, %g)\n", v->coords(0), v->coords(1), v->coords(2)); + //printf ("patch_tesselator::vertex (%g, %g, %g)\n", v->coords(0), v->coords(1), v->coords(2)); // FIXME: why did I need to keep the first vertex of the face // in JHandles? I think it's related to the fact that the @@ -481,7 +481,7 @@ void combine (GLdouble xyz[3], void *data[4], GLfloat w[4], void **out_data) { - //printf("patch_tesselator::combine\n"); + //printf ("patch_tesselator::combine\n"); vertex_data::vertex_data_rep *v[4]; int vmax = 4; @@ -508,14 +508,14 @@ cc.resize (1, 3, 0.0); for (int ic = 0; ic < 3; ic++) for (int iv = 0; iv < vmax; iv++) - cc(ic) += (w[iv] * v[iv]->color(ic)); + cc(ic) += (w[iv] * v[iv]->color (ic)); } if (v[0]->normal.numel () > 0) { for (int in = 0; in < 3; in++) for (int iv = 0; iv < vmax; iv++) - nn(in) += (w[iv] * v[iv]->normal(in)); + nn(in) += (w[iv] * v[iv]->normal (in)); } for (int iv = 0; iv < vmax; iv++) @@ -807,7 +807,7 @@ glMatrixMode (GL_MODELVIEW); glLoadIdentity (); - glScaled(1, 1, -1); + glScaled (1, 1, -1); glMultMatrixd (x_mat1.data ()); glMatrixMode (GL_PROJECTION); glLoadIdentity (); @@ -1016,14 +1016,14 @@ { render_tickmarks (xticks, x_min, x_max, ypTick, ypTick, zpTick, zpTickN, 0., 0., - signum(zpTick-zpTickN)*fz*xticklen, + signum (zpTick-zpTickN)*fz*xticklen, 0, mirror); } else { render_tickmarks (xticks, x_min, x_max, ypTick, ypTickN, zpTick, zpTick, 0., - signum(ypTick-ypTickN)*fy*xticklen, + signum (ypTick-ypTickN)*fy*xticklen, 0., 0, mirror); } @@ -1035,11 +1035,11 @@ if (tick_along_z) render_ticktexts (xticks, xticklabels, x_min, x_max, ypTick, - zpTick+signum(zpTick-zpTickN)*fz*xtickoffset, + zpTick+signum (zpTick-zpTickN)*fz*xtickoffset, 0, halign, valign, wmax, hmax); else render_ticktexts (xticks, xticklabels, x_min, x_max, - ypTick+signum(ypTick-ypTickN)*fy*xtickoffset, + ypTick+signum (ypTick-ypTickN)*fy*xtickoffset, zpTick, 0, halign, valign, wmax, hmax); } @@ -1055,12 +1055,12 @@ if (tick_along_z) render_tickmarks (xmticks, x_min, x_max, ypTick, ypTick, zpTick, zpTickN, 0., 0., - signum(zpTick-zpTickN)*fz*xticklen/2, + signum (zpTick-zpTickN)*fz*xticklen/2, 0, mirror); else render_tickmarks (xmticks, x_min, x_max, ypTick, ypTickN, zpTick, zpTick, 0., - signum(ypTick-ypTickN)*fy*xticklen/2, + signum (ypTick-ypTickN)*fy*xticklen/2, 0., 0, mirror); } @@ -1123,12 +1123,12 @@ if (tick_along_z) render_tickmarks (yticks, y_min, y_max, xpTick, xpTick, zpTick, zpTickN, 0., 0., - signum(zpTick-zpTickN)*fz*yticklen, + signum (zpTick-zpTickN)*fz*yticklen, 1, mirror); else render_tickmarks (yticks, y_min, y_max, xpTick, xpTickN, zpTick, zpTick, - signum(xPlaneN-xPlane)*fx*yticklen, + signum (xPlaneN-xPlane)*fx*yticklen, 0., 0., 1, mirror); // tick texts @@ -1140,11 +1140,11 @@ if (tick_along_z) render_ticktexts (yticks, yticklabels, y_min, y_max, xpTick, - zpTick+signum(zpTick-zpTickN)*fz*ytickoffset, + zpTick+signum (zpTick-zpTickN)*fz*ytickoffset, 1, halign, valign, wmax, hmax); else render_ticktexts (yticks, yticklabels, y_min, y_max, - xpTick+signum(xpTick-xpTickN)*fx*ytickoffset, + xpTick+signum (xpTick-xpTickN)*fx*ytickoffset, zpTick, 1, halign, valign, wmax, hmax); } @@ -1160,12 +1160,12 @@ if (tick_along_z) render_tickmarks (ymticks, y_min, y_max, xpTick, xpTick, zpTick, zpTickN, 0., 0., - signum(zpTick-zpTickN)*fz*yticklen/2, + signum (zpTick-zpTickN)*fz*yticklen/2, 1, mirror); else render_tickmarks (ymticks, y_min, y_max, xpTick, xpTickN, zpTick, zpTick, - signum(xpTick-xpTickN)*fx*yticklen/2, + signum (xpTick-xpTickN)*fx*yticklen/2, 0., 0., 1, mirror); } @@ -1220,12 +1220,12 @@ if (xisinf (fy)) render_tickmarks (zticks, z_min, z_max, xPlaneN, xPlane, yPlane, yPlane, - signum(xPlaneN-xPlane)*fx*zticklen, + signum (xPlaneN-xPlane)*fx*zticklen, 0., 0., 2, mirror); else render_tickmarks (zticks, z_min, z_max, xPlaneN, xPlaneN, yPlane, yPlane, 0., - signum(yPlane-yPlaneN)*fy*zticklen, + signum (yPlane-yPlaneN)*fy*zticklen, 0., 2, false); } else @@ -1233,12 +1233,12 @@ if (xisinf (fx)) render_tickmarks (zticks, z_min, z_max, xPlaneN, xPlane, yPlaneN, yPlane, 0., - signum(yPlaneN-yPlane)*fy*zticklen, + signum (yPlaneN-yPlane)*fy*zticklen, 0., 2, mirror); else render_tickmarks (zticks, z_min, z_max, xPlane, xPlane, yPlaneN, yPlane, - signum(xPlane-xPlaneN)*fx*zticklen, + signum (xPlane-xPlaneN)*fx*zticklen, 0., 0., 2, false); } @@ -1252,22 +1252,22 @@ { if (xisinf (fy)) render_ticktexts (zticks, zticklabels, z_min, z_max, - xPlaneN+signum(xPlaneN-xPlane)*fx*ztickoffset, + xPlaneN+signum (xPlaneN-xPlane)*fx*ztickoffset, yPlane, 2, halign, valign, wmax, hmax); else render_ticktexts (zticks, zticklabels, z_min, z_max, xPlaneN, - yPlane+signum(yPlane-yPlaneN)*fy*ztickoffset, + yPlane+signum (yPlane-yPlaneN)*fy*ztickoffset, 2, halign, valign, wmax, hmax); } else { if (xisinf (fx)) render_ticktexts (zticks, zticklabels, z_min, z_max, xPlane, - yPlaneN+signum(yPlaneN-yPlane)*fy*ztickoffset, + yPlaneN+signum (yPlaneN-yPlane)*fy*ztickoffset, 2, halign, valign, wmax, hmax); else render_ticktexts (zticks, zticklabels, z_min, z_max, - xPlane+signum(xPlane-xPlaneN)*fx*ztickoffset, + xPlane+signum (xPlane-xPlaneN)*fx*ztickoffset, yPlaneN, 2, halign, valign, wmax, hmax); } } @@ -1285,12 +1285,12 @@ if (xisinf (fy)) render_tickmarks (zmticks, z_min, z_max, xPlaneN, xPlane, yPlane, yPlane, - signum(xPlaneN-xPlane)*fx*zticklen/2, + signum (xPlaneN-xPlane)*fx*zticklen/2, 0., 0., 2, mirror); else render_tickmarks (zmticks, z_min, z_max, xPlaneN, xPlaneN, yPlane, yPlane, 0., - signum(yPlane-yPlaneN)*fy*zticklen/2, + signum (yPlane-yPlaneN)*fy*zticklen/2, 0., 2, false); } else @@ -1298,12 +1298,12 @@ if (xisinf (fx)) render_tickmarks (zmticks, z_min, z_max, xPlane, xPlane, yPlaneN, yPlane, 0., - signum(yPlaneN-yPlane)*fy*zticklen/2, + signum (yPlaneN-yPlane)*fy*zticklen/2, 0., 2, mirror); else render_tickmarks (zmticks, z_min, z_max, xPlane, xPlane, yPlaneN, yPlaneN, - signum(xPlane-xPlaneN)*fx*zticklen/2, + signum (xPlane-xPlaneN)*fx*zticklen/2, 0., 0., 2, false); } } @@ -2104,16 +2104,16 @@ bool has_facecolor = false; bool has_facealpha = false; - int fc_mode = ((props.facecolor_is("none") + int fc_mode = ((props.facecolor_is ("none") || props.facecolor_is_rgb ()) ? 0 : - (props.facecolor_is("flat") ? 1 : 2)); + (props.facecolor_is ("flat") ? 1 : 2)); int fl_mode = (props.facelighting_is ("none") ? 0 : (props.facelighting_is ("flat") ? 1 : 2)); int fa_mode = (props.facealpha_is_double () ? 0 : (props.facealpha_is ("flat") ? 1 : 2)); - int ec_mode = ((props.edgecolor_is("none") + int ec_mode = ((props.edgecolor_is ("none") || props.edgecolor_is_rgb ()) ? 0 : - (props.edgecolor_is("flat") ? 1 : 2)); + (props.edgecolor_is ("flat") ? 1 : 2)); int el_mode = (props.edgelighting_is ("none") ? 0 : (props.edgelighting_is ("flat") ? 1 : 2)); int ea_mode = (props.edgealpha_is_double () ? 0 : @@ -2469,7 +2469,7 @@ glEnable (GL_BLEND); glEnable (GL_ALPHA_TEST); glRasterPos3d (pos(0), pos(1), pos.numel () > 2 ? pos(2) : 0.0); - glBitmap(0, 0, 0, 0, bbox(0), bbox(1), 0); + glBitmap (0, 0, 0, 0, bbox(0), bbox(1), 0); glDrawPixels (bbox(2), bbox(3), GL_RGBA, GL_UNSIGNED_BYTE, props.get_pixels ().data ()); glDisable (GL_ALPHA_TEST); @@ -2553,7 +2553,7 @@ else // clip to viewport { GLfloat vp[4]; - glGetFloatv(GL_VIEWPORT, vp); + glGetFloatv (GL_VIEWPORT, vp); // FIXME -- actually add the code to do it! } @@ -2862,7 +2862,7 @@ glEnd (); break; case 'x': - glBegin(GL_LINES); + glBegin (GL_LINES); glVertex2f (-sz/2, -sz/2); glVertex2f (sz/2, sz/2); glVertex2f (-sz/2, sz/2); @@ -2887,7 +2887,7 @@ glBegin (GL_POLYGON); for (double ang = 0; ang < (2*M_PI); ang += ang_step) - glVertex2d (sz*cos(ang)/3, sz*sin(ang)/3); + glVertex2d (sz*cos (ang)/3, sz*sin (ang)/3); glEnd (); } break; @@ -2905,7 +2905,7 @@ glBegin ((filled ? GL_POLYGON : GL_LINE_LOOP)); for (double ang = 0; ang < (2*M_PI); ang += ang_step) - glVertex2d (sz*cos(ang)/2, sz*sin(ang)/2); + glVertex2d (sz*cos (ang)/2, sz*sin (ang)/2); glEnd (); } break; @@ -2949,14 +2949,14 @@ { double ang; double r; - double dr = 1.0 - sin(M_PI/10)/sin(3*M_PI/10)*1.02; + double dr = 1.0 - sin (M_PI/10)/sin (3*M_PI/10)*1.02; glBegin ((filled ? GL_POLYGON : GL_LINE_LOOP)); for (int i = 0; i < 2*5; i++) { ang = (-0.5 + double(i+1)/5) * M_PI; - r = 1.0 - (dr * fmod(double(i+1), 2.0)); - glVertex2d (sz*r*cos(ang)/2, sz*r*sin(ang)/2); + r = 1.0 - (dr * fmod (double(i+1), 2.0)); + glVertex2d (sz*r*cos (ang)/2, sz*r*sin (ang)/2); } glEnd (); } @@ -2965,14 +2965,14 @@ { double ang; double r; - double dr = 1.0 - 0.5/sin(M_PI/3)*1.02; + double dr = 1.0 - 0.5/sin (M_PI/3)*1.02; glBegin ((filled ? GL_POLYGON : GL_LINE_LOOP)); for (int i = 0; i < 2*6; i++) { ang = (0.5 + double(i+1)/6.0) * M_PI; - r = 1.0 - (dr * fmod(double(i+1), 2.0)); - glVertex2d (sz*r*cos(ang)/2, sz*r*sin(ang)/2); + r = 1.0 - (dr * fmod (double(i+1), 2.0)); + glVertex2d (sz*r*cos (ang)/2, sz*r*sin (ang)/2); } glEnd (); } diff --git a/src/graphics.cc b/src/graphics.cc --- a/src/graphics.cc +++ b/src/graphics.cc @@ -1041,23 +1041,23 @@ std::transform (str.begin (), str.end (), str.begin (), tolower); - if (str.compare(0, len, "blue", 0, len) == 0) + if (str.compare (0, len, "blue", 0, len) == 0) tmp_rgb[2] = 1; - else if (str.compare(0, len, "black", 0, len) == 0 - || str.compare(0, len, "k", 0, len) == 0) + else if (str.compare (0, len, "black", 0, len) == 0 + || str.compare (0, len, "k", 0, len) == 0) tmp_rgb[0] = tmp_rgb[1] = tmp_rgb[2] = 0; - else if (str.compare(0, len, "red", 0, len) == 0) + else if (str.compare (0, len, "red", 0, len) == 0) tmp_rgb[0] = 1; - else if (str.compare(0, len, "green", 0, len) == 0) + else if (str.compare (0, len, "green", 0, len) == 0) tmp_rgb[1] = 1; - else if (str.compare(0, len, "yellow", 0, len) == 0) + else if (str.compare (0, len, "yellow", 0, len) == 0) tmp_rgb[0] = tmp_rgb[1] = 1; - else if (str.compare(0, len, "magenta", 0, len) == 0) + else if (str.compare (0, len, "magenta", 0, len) == 0) tmp_rgb[0] = tmp_rgb[2] = 1; - else if (str.compare(0, len, "cyan", 0, len) == 0) + else if (str.compare (0, len, "cyan", 0, len) == 0) tmp_rgb[1] = tmp_rgb[2] = 1; - else if (str.compare(0, len, "white", 0, len) == 0 - || str.compare(0, len, "w", 0, len) == 0) + else if (str.compare (0, len, "white", 0, len) == 0 + || str.compare (0, len, "w", 0, len) == 0) tmp_rgb[0] = tmp_rgb[1] = tmp_rgb[2] = 1; else retval = false; @@ -1123,7 +1123,7 @@ if (m.numel () == 3) { - color_values col (m (0), m (1), m(2)); + color_values col (m(0), m(1), m(2)); if (! error_state) { if (current_type != color_t || col != color_val) @@ -1983,7 +1983,7 @@ { if (names.numel () != values.columns ()) { - error("set: number of names must match number of value columns (%d != %d)", + error ("set: number of names must match number of value columns (%d != %d)", names.numel (), values.columns ()); } @@ -3963,20 +3963,20 @@ { axes::properties& props = dynamic_cast (go.get_properties ()); - if (props.autopos_tag_is("subplot")) + if (props.autopos_tag_is ("subplot")) { Matrix outpos = go.get ("outerposition").matrix_value (); - bool l_align=(std::abs (outpos(0)-ref_outbox(0)) < 1e-15); - bool b_align=(std::abs (outpos(1)-ref_outbox(1)) < 1e-15); - bool r_align=(std::abs (outpos(0)+outpos(2)-ref_outbox(2)) < 1e-15); - bool t_align=(std::abs (outpos(1)+outpos(3)-ref_outbox(3)) < 1e-15); + bool l_align = (std::abs (outpos(0)-ref_outbox(0)) < 1e-15); + bool b_align = (std::abs (outpos(1)-ref_outbox(1)) < 1e-15); + bool r_align = (std::abs (outpos(0)+outpos(2)-ref_outbox(2)) < 1e-15); + bool t_align = (std::abs (outpos(1)+outpos(3)-ref_outbox(3)) < 1e-15); if (l_align || b_align || r_align || t_align) { - aligned.push_back(kids(i)); - l_aligned.push_back(l_align); - b_aligned.push_back(b_align); - r_aligned.push_back(r_align); - t_aligned.push_back(t_align); + aligned.push_back (kids(i)); + l_aligned.push_back (l_align); + b_aligned.push_back (b_align); + r_aligned.push_back (r_align); + t_aligned.push_back (t_align); // FIXME: the temporarily deleted tags should be // protected from interrupts props.set_autopos_tag ("none"); @@ -3985,7 +3985,7 @@ } } // Determine a minimum box which aligns the subplots - Matrix ref_box(1, 4, 0.); + Matrix ref_box (1, 4, 0.); ref_box(2) = 1.; ref_box(3) = 1.; for (size_t i = 0; i < aligned.size (); i++) @@ -4540,7 +4540,7 @@ inline void normalize (ColumnVector& v) { - double fact = 1.0/sqrt(v(0)*v(0)+v(1)*v(1)+v(2)*v(2)); + double fact = 1.0 / sqrt (v(0)*v(0)+v(1)*v(1)+v(2)*v(2)); scale (v, fact, fact, fact); } @@ -4579,7 +4579,7 @@ 0,1,1,1, 1,1,1,1}; Matrix m (4, 8); - memcpy (m.fortran_vec (), data, sizeof(double)*32); + memcpy (m.fortran_vec (), data, sizeof (double)*32); return m; } @@ -4587,7 +4587,7 @@ cam2xform (const Array& m) { ColumnVector retval (4, 1.0); - memcpy (retval.fortran_vec (), m.fortran_vec (), sizeof(double)*3); + memcpy (retval.fortran_vec (), m.fortran_vec (), sizeof (double)*3); return retval; } @@ -4618,7 +4618,7 @@ && cameratargetmode_is ("auto") && cameraupvectormode_is ("auto") && cameraviewanglemode_is ("auto")); - bool dowarp = (autocam && dataaspectratiomode_is("auto") + bool dowarp = (autocam && dataaspectratiomode_is ("auto") && plotboxaspectratiomode_is ("auto")); ColumnVector c_eye (xform_vector ()); @@ -4640,17 +4640,17 @@ { Matrix tview = get_view ().matrix_value (); double az = tview(0), el = tview(1); - double d = 5*sqrt(pb(0)*pb(0)+pb(1)*pb(1)+pb(2)*pb(2)); + double d = 5 * sqrt (pb(0)*pb(0)+pb(1)*pb(1)+pb(2)*pb(2)); if (el == 90 || el == -90) - c_eye(2) = d*signum(el); + c_eye(2) = d*signum (el); else { az *= M_PI/180.0; el *= M_PI/180.0; - c_eye(0) = d*cos(el)*sin(az); - c_eye(1) = -d*cos(el)*cos(az); - c_eye(2) = d*sin(el); + c_eye(0) = d * cos (el) * sin (az); + c_eye(1) = -d* cos (el) * cos (az); + c_eye(2) = d * sin (el); } c_eye(0) = c_eye(0)*(xlimits(1)-xlimits(0))/(xd*pb(0))+c_center(0); c_eye(1) = c_eye(1)*(ylimits(1)-ylimits(0))/(yd*pb(1))+c_center(1); @@ -4669,9 +4669,9 @@ if (el == 90 || el == -90) { c_upv(0) = - -signum(el)*sin(az*M_PI/180.0)*(xlimits(1)-xlimits(0))/pb(0); + -signum (el) *sin (az*M_PI/180.0)*(xlimits(1)-xlimits(0))/pb(0); c_upv(1) = - signum(el)*cos(az*M_PI/180.0)*(ylimits(1)-ylimits(0))/pb(1); + signum (el) * cos (az*M_PI/180.0)*(ylimits(1)-ylimits(0))/pb(1); } else c_upv(2) = 1; @@ -4708,7 +4708,7 @@ if (std::abs (dot (f, UP)) > 1e-15) { - double fa = 1/sqrt(1-f(2)*f(2)); + double fa = 1 / sqrt(1-f(2)*f(2)); scale (UP, fa, fa, fa); } @@ -4866,7 +4866,7 @@ xPlane = (dir(2) < 0 ? x_min : x_max); xPlaneN = (xPlane == x_min ? x_max : x_min); - fx = (x_max-x_min)/sqrt(dir(0)*dir(0)+dir(1)*dir(1)); + fx = (x_max-x_min) / sqrt (dir(0)*dir(0)+dir(1)*dir(1)); p1 = xform.transform ((x_min+x_max)/2, y_min, (z_min+z_max)/2, false); p2 = xform.transform ((x_min+x_max)/2, y_max, (z_min+z_max)/2, false); @@ -4894,11 +4894,11 @@ yPlane = (dir(2) < 0 ? y_min : y_max); yPlaneN = (yPlane == y_min ? y_max : y_min); - fy = (y_max-y_min)/sqrt(dir(0)*dir(0)+dir(1)*dir(1)); - - p1 = xform.transform((x_min+x_max)/2, (y_min+y_max)/2, z_min, false); - p2 = xform.transform((x_min+x_max)/2, (y_min+y_max)/2, z_max, false); - dir(0) = xround(p2(0)-p1(0)); + fy = (y_max-y_min) / sqrt (dir(0)*dir(0)+dir(1)*dir(1)); + + p1 = xform.transform ((x_min+x_max)/2, (y_min+y_max)/2, z_min, false); + p2 = xform.transform ((x_min+x_max)/2, (y_min+y_max)/2, z_max, false); + dir(0) = xround (p2(0)-p1(0)); dir(1) = xround (p2(1)-p1(1)); dir(2) = (p2(2)-p1(2)); if (dir(0) == 0 && dir(1) == 0) @@ -4922,7 +4922,7 @@ zPlane = (dir(2) < 0 ? z_min : z_max); zPlaneN = (zPlane == z_min ? z_max : z_min); - fz = (z_max-z_min)/sqrt(dir(0)*dir(0)+dir(1)*dir(1)); + fz = (z_max-z_min) / sqrt (dir(0)*dir(0)+dir(1)*dir(1)); unwind_protect frame; frame.protect_var (updating_axes_layout); @@ -4972,7 +4972,7 @@ } Matrix viewmat = get_view ().matrix_value (); - nearhoriz = std::abs(viewmat(1)) <= 5; + nearhoriz = std::abs (viewmat(1)) <= 5; update_ticklength (); } @@ -5079,9 +5079,9 @@ bool tick_along_z = nearhoriz || xisinf (fy); if (tick_along_z) - p(2) += (signum(zpTick-zpTickN)*fz*xtickoffset); + p(2) += (signum (zpTick-zpTickN)*fz*xtickoffset); else - p(1) += (signum(ypTick-ypTickN)*fy*xtickoffset); + p(1) += (signum (ypTick-ypTickN)*fy*xtickoffset); p = xform.transform (p(0), p(1), p(2), false); @@ -5170,9 +5170,9 @@ bool tick_along_z = nearhoriz || xisinf (fx); if (tick_along_z) - p(2) += (signum(zpTick-zpTickN)*fz*ytickoffset); + p(2) += (signum (zpTick-zpTickN)*fz*ytickoffset); else - p(0) += (signum(xpTick-xpTickN)*fx*ytickoffset); + p(0) += (signum (xpTick-xpTickN)*fx*ytickoffset); p = xform.transform (p(0), p(1), p(2), false); @@ -5264,18 +5264,18 @@ p = graphics_xform::xform_vector (xPlaneN, yPlane, (zpTickN+zpTick)/2); if (xisinf (fy)) - p(0) += (signum(xPlaneN-xPlane)*fx*ztickoffset); + p(0) += (signum (xPlaneN-xPlane)*fx*ztickoffset); else - p(1) += (signum(yPlane-yPlaneN)*fy*ztickoffset); + p(1) += (signum (yPlane-yPlaneN)*fy*ztickoffset); } else { p = graphics_xform::xform_vector (xPlane, yPlaneN, (zpTickN+zpTick)/2); if (xisinf (fx)) - p(1) += (signum(yPlaneN-yPlane)*fy*ztickoffset); + p(1) += (signum (yPlaneN-yPlane)*fy*ztickoffset); else - p(0) += (signum(xPlane-xPlaneN)*fx*ztickoffset); + p(0) += (signum (xPlane-xPlaneN)*fx*ztickoffset); } p = xform.transform (p(0), p(1), p(2), false); @@ -5359,7 +5359,7 @@ p = xform.untransform (p(0), p(1), p(2), true); - title_props.set_position (p.extract_n(0, 3).transpose ()); + title_props.set_position (p.extract_n (0, 3).transpose ()); title_props.set_positionmode ("auto"); } } @@ -5715,7 +5715,7 @@ double parent_height = box_pix_height; if (fontunits_is ("normalized") && parent_height <= 0) - parent_height = get_boundingbox (true).elem(3); + parent_height = get_boundingbox (true).elem (3); return convert_font_size (fs, get_fontunits (), "points", parent_height); } @@ -6303,7 +6303,7 @@ } \ else \ { \ - limits.resize(4, 1); \ + limits.resize (4, 1); \ limits(0) = min_val; \ limits(1) = max_val; \ limits(2) = min_pos; \ @@ -6831,16 +6831,16 @@ { Matrix v = get_view ().matrix_value (); - v (1) += delta_el; + v(1) += delta_el; if(v(1) > 90) v(1) = 90; if(v(1) < -90) v(1) = -90; - v (0) = fmod(v(0) - delta_az + 720,360); - - set_view(v); + v(0) = fmod (v(0) - delta_az + 720,360); + + set_view (v); update_transform (); } @@ -7057,7 +7057,7 @@ graphics_object go (gh_manager::get_object (get___myhandle__ ())); graphics_object ax (go.get_ancestor ("axes")); - parent_height = ax.get_properties ().get_boundingbox (true).elem(3); + parent_height = ax.get_properties ().get_boundingbox (true).elem (3); } return convert_font_size (fs, get_fontunits (), "points", parent_height); @@ -7274,7 +7274,7 @@ } else { - limits.resize(4,1); + limits.resize (4,1); limits(0) = min_val; limits(1) = max_val; limits(2) = min_pos; @@ -7543,7 +7543,7 @@ double parent_height = box_pix_height; if (fontunits_is ("normalized") && parent_height <= 0) - parent_height = get_boundingbox (false).elem(3); + parent_height = get_boundingbox (false).elem (3); return convert_font_size (fs, get_fontunits (), "points", parent_height); } @@ -7679,7 +7679,7 @@ double parent_height = box_pix_height; if (fontunits_is ("normalized") && parent_height <= 0) - parent_height = get_boundingbox (false).elem(3); + parent_height = get_boundingbox (false).elem (3); return convert_font_size (fs, get_fontunits (), "points", parent_height); } @@ -8428,7 +8428,7 @@ } else { - error("set: number of graphics handles must match number of value rows (%d != %d)", + error ("set: number of graphics handles must match number of value rows (%d != %d)", hcv.length (), args(2).cell_value ().rows ()); break; @@ -8926,7 +8926,7 @@ if (hnd.ok ()) { - const graphics_object& kid = gh_manager::get_object(hnd); + const graphics_object& kid = gh_manager::get_object (hnd); if (kid.valid_object ()) nd = calc_dimensions (kid); @@ -9947,11 +9947,11 @@ } static void -cleanup_waitfor_postset_listener(const octave_value& listener) +cleanup_waitfor_postset_listener (const octave_value& listener) { do_cleanup_waitfor_listener (listener, POSTSET); } static void -cleanup_waitfor_predelete_listener(const octave_value& listener) +cleanup_waitfor_predelete_listener (const octave_value& listener) { do_cleanup_waitfor_listener (listener, PREDELETE); } static octave_value_list diff --git a/src/graphics.in.h b/src/graphics.in.h --- a/src/graphics.in.h +++ b/src/graphics.in.h @@ -465,7 +465,7 @@ if (found) { for (int j = i; j < l.length () - 1; j++) - l(j) = l (j + 1); + l(j) = l(j + 1); l.resize (l.length () - 1); } diff --git a/src/load-path.cc b/src/load-path.cc --- a/src/load-path.cc +++ b/src/load-path.cc @@ -532,19 +532,19 @@ { //Don't remove it if it's gonna be added again, but remove it from //list of items to add, to avoid duplicates later on - std::set::iterator j = new_elts.find(i->dir_name); + std::set::iterator j = new_elts.find (i->dir_name); if (j != new_elts.end ()) { - new_elts.erase(j); + new_elts.erase (j); i++; } else { //Warn if removing a default directory and not immediately adding //it back again - if(i->is_init) + if (i->is_init) warn_default_path_clobbered = true; - i = dir_info_list.erase(i); + i = dir_info_list.erase (i); } } diff --git a/src/load-path.h b/src/load-path.h --- a/src/load-path.h +++ b/src/load-path.h @@ -297,13 +297,13 @@ // constructor for any other purpose. dir_info (void) : dir_name (), abs_dir_name (), is_relative (false), - is_init(false), dir_mtime (), dir_time_last_checked (), + is_init (false), dir_mtime (), dir_time_last_checked (), all_files (), fcn_files (), private_file_map (), method_file_map () { } dir_info (const std::string& d) : dir_name (d), abs_dir_name (), is_relative (false), - is_init(false), dir_mtime (), dir_time_last_checked (), + is_init (false), dir_mtime (), dir_time_last_checked (), all_files (), fcn_files (), private_file_map (), method_file_map () { initialize (); diff --git a/src/load-save.cc b/src/load-save.cc --- a/src/load-save.cc +++ b/src/load-save.cc @@ -649,7 +649,7 @@ std::string orig_fname = ""; // Function called with Matlab-style ["filename", options] syntax - if (argc > 1 && ! argv[1].empty () && argv[1].at(0) != '-') + if (argc > 1 && ! argv[1].empty () && argv[1].at (0) != '-') { orig_fname = argv[1]; i++; @@ -1001,7 +1001,7 @@ { std::string empty_str; - if (pat.match(m.key (p))) + if (pat.match (m.key (p))) { do_save (os, m.contents (p), m.key (p), empty_str, 0, fmt, save_as_floats); diff --git a/src/ls-hdf5.cc b/src/ls-hdf5.cc --- a/src/ls-hdf5.cc +++ b/src/ls-hdf5.cc @@ -749,7 +749,7 @@ int load_hdf5_empty (hid_t loc_id, const char *name, dim_vector &d) { - if (!hdf5_check_attr(loc_id, "OCTAVE_EMPTY_MATRIX")) + if (! hdf5_check_attr (loc_id, "OCTAVE_EMPTY_MATRIX")) return 0; hsize_t hdims, maxdims; diff --git a/src/ls-mat4.cc b/src/ls-mat4.cc --- a/src/ls-mat4.cc +++ b/src/ls-mat4.cc @@ -344,18 +344,18 @@ read_mat_binary_data (is, dtmp, prec, nr, swap, flt_fmt); for (octave_idx_type i = 0; i < nr - 1; i++) - r.xelem(i) = dtmp[i] - 1; + r.xelem (i) = dtmp[i] - 1; nr_new = dtmp[nr - 1]; read_mat_binary_data (is, dtmp, prec, nr, swap, flt_fmt); for (octave_idx_type i = 0; i < nr - 1; i++) - c.xelem(i) = dtmp[i] - 1; + c.xelem (i) = dtmp[i] - 1; nc_new = dtmp[nr - 1]; read_mat_binary_data (is, dtmp, prec, nr - 1, swap, flt_fmt); read_mat_binary_data (is, ctmp, prec, 1, swap, flt_fmt); read_mat_binary_data (is, ctmp, prec, nr - 1, swap, flt_fmt); for (octave_idx_type i = 0; i < nr - 1; i++) - data.xelem(i) = Complex (dtmp[i], ctmp[i]); + data.xelem (i) = Complex (dtmp[i], ctmp[i]); read_mat_binary_data (is, ctmp, prec, 1, swap, flt_fmt); SparseComplexMatrix smc = SparseComplexMatrix (data, r, c, @@ -373,11 +373,11 @@ read_mat_binary_data (is, dtmp, prec, nr, swap, flt_fmt); for (octave_idx_type i = 0; i < nr - 1; i++) - r.xelem(i) = dtmp[i] - 1; + r.xelem (i) = dtmp[i] - 1; nr_new = dtmp[nr - 1]; read_mat_binary_data (is, dtmp, prec, nr, swap, flt_fmt); for (octave_idx_type i = 0; i < nr - 1; i++) - c.xelem(i) = dtmp[i] - 1; + c.xelem (i) = dtmp[i] - 1; nc_new = dtmp[nr - 1]; read_mat_binary_data (is, data.fortran_vec (), prec, nr - 1, swap, flt_fmt); read_mat_binary_data (is, dtmp, prec, 1, swap, flt_fmt); @@ -509,7 +509,7 @@ for (octave_idx_type j = 0; j < ncol; j++) buf[j*nrow+i] = static_cast (*s++ & 0x00FF); } - os.write (reinterpret_cast (buf), nrow*ncol*sizeof(double)); + os.write (reinterpret_cast (buf), nrow*ncol*sizeof (double)); } else if (tc.is_range ()) { @@ -537,27 +537,27 @@ SparseComplexMatrix m = tc.sparse_complex_matrix_value (); for (octave_idx_type i = 0; i < len; i++) - dtmp [i] = m.ridx(i) + 1; + dtmp[i] = m.ridx (i) + 1; os.write (reinterpret_cast (dtmp), 8 * len); ds = nr; os.write (reinterpret_cast (&ds), 8); octave_idx_type ii = 0; for (octave_idx_type j = 0; j < nc; j++) - for (octave_idx_type i = m.cidx(j); i < m.cidx(j+1); i++) + for (octave_idx_type i = m.cidx (j); i < m.cidx (j+1); i++) dtmp[ii++] = j + 1; os.write (reinterpret_cast (dtmp), 8 * len); ds = nc; os.write (reinterpret_cast (&ds), 8); for (octave_idx_type i = 0; i < len; i++) - dtmp [i] = std::real (m.data(i)); + dtmp[i] = std::real (m.data (i)); os.write (reinterpret_cast (dtmp), 8 * len); ds = 0.; os.write (reinterpret_cast (&ds), 8); for (octave_idx_type i = 0; i < len; i++) - dtmp [i] = std::imag (m.data(i)); + dtmp[i] = std::imag (m.data (i)); os.write (reinterpret_cast (dtmp), 8 * len); os.write (reinterpret_cast (&ds), 8); } @@ -566,14 +566,14 @@ SparseMatrix m = tc.sparse_matrix_value (); for (octave_idx_type i = 0; i < len; i++) - dtmp [i] = m.ridx(i) + 1; + dtmp[i] = m.ridx (i) + 1; os.write (reinterpret_cast (dtmp), 8 * len); ds = nr; os.write (reinterpret_cast (&ds), 8); octave_idx_type ii = 0; for (octave_idx_type j = 0; j < nc; j++) - for (octave_idx_type i = m.cidx(j); i < m.cidx(j+1); i++) + for (octave_idx_type i = m.cidx (j); i < m.cidx (j+1); i++) dtmp[ii++] = j + 1; os.write (reinterpret_cast (dtmp), 8 * len); ds = nc; diff --git a/src/ls-mat5.cc b/src/ls-mat5.cc --- a/src/ls-mat5.cc +++ b/src/ls-mat5.cc @@ -667,7 +667,7 @@ else { // Why did mathworks decide to not have dims for a workspace!!! - dims.resize(2); + dims.resize (2); dims(0) = 1; dims(1) = 1; } @@ -864,10 +864,10 @@ // and so can ignore the seperator field of m0. I think the // sentinel field is also save to ignore. Octave_map m0 = tc2.map_value (); - Octave_map m1 = m0.contents("function_handle")(0).map_value (); - std::string ftype = m1.contents("type")(0).string_value (); - std::string fname = m1.contents("function")(0).string_value (); - std::string fpath = m1.contents("file")(0).string_value (); + Octave_map m1 = m0.contents ("function_handle")(0).map_value (); + std::string ftype = m1.contents ("type")(0).string_value (); + std::string fname = m1.contents ("function")(0).string_value (); + std::string fpath = m1.contents ("file")(0).string_value (); if (ftype == "simple" || ftype == "scopedfunction") { @@ -877,10 +877,10 @@ else { std::string mroot = - m0.contents("matlabroot")(0).string_value (); + m0.contents ("matlabroot")(0).string_value (); if ((fpath.length () >= mroot.length ()) && - fpath.substr(0, mroot.length ()) == mroot && + fpath.substr (0, mroot.length ()) == mroot && OCTAVE_EXEC_PREFIX != mroot) { // If fpath starts with matlabroot, and matlabroot @@ -979,12 +979,12 @@ } else if (ftype == "anonymous") { - Octave_map m2 = m1.contents("workspace")(0).map_value (); - uint32NDArray MCOS = m2.contents("MCOS")(0).uint32_array_value (); + Octave_map m2 = m1.contents ("workspace")(0).map_value (); + uint32NDArray MCOS = m2.contents ("MCOS")(0).uint32_array_value (); octave_idx_type off = static_cast(MCOS(4).double_value ()); m2 = subsys_ov.map_value (); - m2 = m2.contents("MCOS")(0).map_value (); - tc2 = m2.contents("MCOS")(0).cell_value ()(1 + off).cell_value ()(1); + m2 = m2.contents ("MCOS")(0).map_value (); + tc2 = m2.contents ("MCOS")(0).cell_value ()(1 + off).cell_value ()(1); m2 = tc2.map_value (); unwind_protect_safe frame; @@ -1007,8 +1007,8 @@ for (Octave_map::iterator p0 = m2.begin () ; p0 != m2.end (); p0++) { - std::string key = m2.key(p0); - octave_value val = m2.contents(p0)(0); + std::string key = m2.key (p0); + octave_value val = m2.contents (p0)(0); symbol_table::varref (key, local_scope, 0) = val; } @@ -1219,8 +1219,8 @@ // inline is not an object in Octave but rather an // overload of a function handle. Special case. tc = - new octave_fcn_inline (m.contents("expr")(0).string_value (), - m.contents("args")(0).string_value ()); + new octave_fcn_inline (m.contents ("expr")(0).string_value (), + m.contents ("args")(0).string_value ()); } else { @@ -1277,7 +1277,7 @@ boolNDArray out (dims); for (octave_idx_type i = 0; i < nel; i++) - out (i) = in(i).bool_value (); + out(i) = in(i).bool_value (); tc = out; } diff --git a/src/ls-oct-ascii.cc b/src/ls-oct-ascii.cc --- a/src/ls-oct-ascii.cc +++ b/src/ls-oct-ascii.cc @@ -110,7 +110,7 @@ while (is.get (c) && (c == ' ' || c == '\t' || c == ':')) ; // Skip whitespace and the colon. - is.putback(c); + is.putback (c); retval = read_until_newline (is, false); break; } diff --git a/src/mappers.cc b/src/mappers.cc --- a/src/mappers.cc +++ b/src/mappers.cc @@ -1177,13 +1177,13 @@ %!assert (isinf (Inf)) %!assert (!isinf (NaN)) %!assert (!isinf (NA)) -%!assert (isinf (rand(1,10)), false (1,10)) +%!assert (isinf (rand (1,10)), false (1,10)) %!assert (isinf ([NaN -Inf -1 0 1 Inf NA]), [false, true, false, false, false, true, false]) %!assert (isinf (single (Inf))) %!assert (!isinf (single (NaN))) %!assert (!isinf (single (NA))) -%!assert (isinf (single (rand(1,10))), false (1,10)) +%!assert (isinf (single (rand (1,10))), false (1,10)) %!assert (isinf (single ([NaN -Inf -1 0 1 Inf NA])), [false, true, false, false, false, true, false]) %!error isinf () @@ -1276,13 +1276,13 @@ %!assert (!isna (Inf)) %!assert (!isna (NaN)) %!assert (isna (NA)) -%!assert (isna (rand(1,10)), false (1,10)) +%!assert (isna (rand (1,10)), false (1,10)) %!assert (isna ([NaN -Inf -1 0 1 Inf NA]), [false, false, false, false, false, false, true]) %!assert (!isna (single (Inf))) %!assert (!isna (single (NaN))) %!assert (isna (single (NA))) -%!assert (isna (single (rand(1,10))), false (1,10)) +%!assert (isna (single (rand (1,10))), false (1,10)) %!assert (isna (single ([NaN -Inf -1 0 1 Inf NA])), [false, false, false, false, false, false, true]) %!error isna () @@ -1318,13 +1318,13 @@ %!assert (!isnan (Inf)) %!assert (isnan (NaN)) %!assert (isnan (NA)) -%!assert (isnan (rand(1,10)), false (1,10)) +%!assert (isnan (rand (1,10)), false (1,10)) %!assert (isnan ([NaN -Inf -1 0 1 Inf NA]), [true, false, false, false, false, false, true]) %!assert (!isnan (single (Inf))) %!assert (isnan (single (NaN))) %!assert (isnan (single (NA))) -%!assert (isnan (single (rand(1,10))), false (1,10)) +%!assert (isnan (single (rand (1,10))), false (1,10)) %!assert (isnan (single ([NaN -Inf -1 0 1 Inf NA])), [true, false, false, false, false, false, true]) %!error isnan () diff --git a/src/mex.cc b/src/mex.cc --- a/src/mex.cc +++ b/src/mex.cc @@ -1576,12 +1576,12 @@ for (mwIndex i = 0; i < nzmax; i++) { - val.xdata(i) = ppr[i]; - val.xridx(i) = ir[i]; + val.xdata (i) = ppr[i]; + val.xridx (i) = ir[i]; } for (mwIndex i = 0; i < get_n () + 1; i++) - val.xcidx(i) = jc[i]; + val.xcidx (i) = jc[i]; retval = val; } @@ -1603,12 +1603,12 @@ for (mwIndex i = 0; i < nzmax; i++) { - val.xdata(i) = Complex (ppr[i], ppi[i]); - val.xridx(i) = ir[i]; + val.xdata (i) = Complex (ppr[i], ppi[i]); + val.xridx (i) = ir[i]; } for (mwIndex i = 0; i < get_n () + 1; i++) - val.xcidx(i) = jc[i]; + val.xcidx (i) = jc[i]; retval = val; } @@ -1621,12 +1621,12 @@ for (mwIndex i = 0; i < nzmax; i++) { - val.xdata(i) = ppr[i]; - val.xridx(i) = ir[i]; + val.xdata (i) = ppr[i]; + val.xridx (i) = ir[i]; } for (mwIndex i = 0; i < get_n () + 1; i++) - val.xcidx(i) = jc[i]; + val.xcidx (i) = jc[i]; retval = val; } diff --git a/src/oct-map.cc b/src/oct-map.cc --- a/src/oct-map.cc +++ b/src/oct-map.cc @@ -152,7 +152,7 @@ string_vector retval(n); for (iterator p = begin (); p != end (); p++) - retval.xelem(p->second) = p->first; + retval.xelem (p->second) = p->first; return retval; } @@ -197,7 +197,7 @@ octave_idx_type nf = nfields (); for (octave_idx_type i = 0; i < nf; i++) - retval.xvals[i] = xvals[perm.xelem(i)]; + retval.xvals[i] = xvals[perm.xelem (i)]; return retval; } @@ -215,7 +215,7 @@ { octave_idx_type nf = nfields (); for (octave_idx_type i = 0; i < nf; i++) - retval.xvals[i] = xvals[perm.xelem(i)]; + retval.xvals[i] = xvals[perm.xelem (i)]; } else error ("orderfields: structs must have same fields up to order"); @@ -247,7 +247,7 @@ for (octave_idx_type i = 0; i < nf; i++) { xvals.push_back (Cell (dimensions)); - xvals[i].xelem(0) = m.xvals[i]; + xvals[i].xelem (0) = m.xvals[i]; } } @@ -308,7 +308,7 @@ octave_idx_type nf = nfields (); for (octave_idx_type i = 0; i < nf; i++) - retval.xvals[i] = xvals[perm.xelem(i)]; + retval.xvals[i] = xvals[perm.xelem (i)]; return retval; } @@ -326,7 +326,7 @@ { octave_idx_type nf = nfields (); for (octave_idx_type i = 0; i < nf; i++) - retval.xvals[i] = xvals[perm.xelem(i)]; + retval.xvals[i] = xvals[perm.xelem (i)]; } else error ("orderfields: structs must have same fields up to order"); @@ -591,7 +591,7 @@ retval.xvals.push_back (Cell (rd)); assert (retval.xvals[j].numel () == n); for (octave_idx_type i = 0; i < n; i++) - retval.xvals[j].xelem(i) = map_list[i].xvals[j]; + retval.xvals[j].xelem (i) = map_list[i].xvals[j]; } } @@ -1278,7 +1278,7 @@ break; } - contents(pa).insert (rb.contents(pb), ra_idx); + contents(pa).insert (rb.contents (pb), ra_idx); } } else diff --git a/src/oct-obj.cc b/src/oct-obj.cc --- a/src/oct-obj.cc +++ b/src/oct-obj.cc @@ -157,7 +157,7 @@ retval(k++) = elem (i); for (octave_idx_type i = 0; i < lst_len; i++) - retval(k++) = lst(i); + retval(k++) = lst (i); for (octave_idx_type i = offset + rep_length; i < len; i++) retval(k++) = elem (i); diff --git a/src/ov-base-int.cc b/src/ov-base-int.cc --- a/src/ov-base-int.cc +++ b/src/ov-base-int.cc @@ -381,7 +381,7 @@ dim_vector dv; int empty = load_hdf5_empty (loc_id, name, dv); if (empty > 0) - this->matrix.resize(dv); + this->matrix.resize (dv); if (empty) return (empty > 0); diff --git a/src/ov-base-mat.h b/src/ov-base-mat.h --- a/src/ov-base-mat.h +++ b/src/ov-base-mat.h @@ -53,7 +53,7 @@ octave_base_matrix (const MT& m, const MatrixType& t = MatrixType ()) : octave_base_value (), matrix (m), - typ (t.is_known () ? new MatrixType(t) : 0), idx_cache () + typ (t.is_known () ? new MatrixType (t) : 0), idx_cache () { if (matrix.ndims () == 0) matrix.resize (dim_vector (0, 0)); diff --git a/src/ov-base-sparse.cc b/src/ov-base-sparse.cc --- a/src/ov-base-sparse.cc +++ b/src/ov-base-sparse.cc @@ -370,13 +370,13 @@ // at all the nonzero values and display them with the same // formatting rules that apply to columns of a matrix. - for (octave_idx_type i = matrix.cidx(j); i < matrix.cidx(j+1); i++) + for (octave_idx_type i = matrix.cidx (j); i < matrix.cidx (j+1); i++) { os << "\n"; - os << " (" << matrix.ridx(i)+1 << + os << " (" << matrix.ridx (i)+1 << ", " << j+1 << ") -> "; - octave_print_internal (os, matrix.data(i), pr_as_read_syntax); + octave_print_internal (os, matrix.data (i), pr_as_read_syntax); } } } diff --git a/src/ov-bool-mat.cc b/src/ov-bool-mat.cc --- a/src/ov-bool-mat.cc +++ b/src/ov-bool-mat.cc @@ -469,7 +469,7 @@ dim_vector dv; int empty = load_hdf5_empty (loc_id, name, dv); if (empty > 0) - matrix.resize(dv); + matrix.resize (dv); if (empty) return (empty > 0); diff --git a/src/ov-bool-sparse.cc b/src/ov-bool-sparse.cc --- a/src/ov-bool-sparse.cc +++ b/src/ov-bool-sparse.cc @@ -163,7 +163,7 @@ NDArray octave_sparse_bool_matrix::array_value (bool) const { - return NDArray (Matrix(matrix.matrix_value ())); + return NDArray (Matrix (matrix.matrix_value ())); } charNDArray @@ -174,8 +174,8 @@ octave_idx_type nr = matrix.rows (); for (octave_idx_type j = 0; j < nc; j++) - for (octave_idx_type i = matrix.cidx(j); i < matrix.cidx(j+1); i++) - retval(matrix.ridx(i) + nr * j) = static_cast(matrix.data (i)); + for (octave_idx_type i = matrix.cidx (j); i < matrix.cidx (j+1); i++) + retval(matrix.ridx (i) + nr * j) = static_cast(matrix.data (i)); return retval; } @@ -238,14 +238,14 @@ for (int i = 0; i < nc+1; i++) { octave_quit (); - itmp = matrix.cidx(i); + itmp = matrix.cidx (i); os.write (reinterpret_cast (&itmp), 4); } for (int i = 0; i < nz; i++) { octave_quit (); - itmp = matrix.ridx(i); + itmp = matrix.ridx (i); os.write (reinterpret_cast (&itmp), 4); } @@ -300,7 +300,7 @@ return false; if (swap) swap_bytes<4> (&tmp); - m.cidx(i) = tmp; + m.cidx (i) = tmp; } for (int i = 0; i < nz; i++) @@ -310,7 +310,7 @@ return false; if (swap) swap_bytes<4> (&tmp); - m.ridx(i) = tmp; + m.ridx (i) = tmp; } if (error_state || ! is) @@ -551,7 +551,7 @@ dim_vector dv; int empty = load_hdf5_empty (loc_id, name, dv); if (empty > 0) - matrix.resize(dv); + matrix.resize (dv); if (empty) return (empty > 0); @@ -782,12 +782,12 @@ for (mwIndex i = 0; i < nz; i++) { - pr[i] = matrix.data(i); - ir[i] = matrix.ridx(i); + pr[i] = matrix.data (i); + ir[i] = matrix.ridx (i); } for (mwIndex i = 0; i < columns () + 1; i++) - jc[i] = matrix.cidx(i); + jc[i] = matrix.cidx (i); return retval; } diff --git a/src/ov-cell.cc b/src/ov-cell.cc --- a/src/ov-cell.cc +++ b/src/ov-cell.cc @@ -1155,7 +1155,7 @@ dim_vector dv; int empty = load_hdf5_empty (loc_id, name, dv); if (empty > 0) - matrix.resize(dv); + matrix.resize (dv); if (empty) return (empty > 0); diff --git a/src/ov-class.cc b/src/ov-class.cc --- a/src/ov-class.cc +++ b/src/ov-class.cc @@ -142,7 +142,7 @@ = parent.parent_class_name_list (); for (octave_idx_type i = 0; i < p_nel; i++) - c(i) = octave_value (pmap.index(i), pcnm, plist); + c(i) = octave_value (pmap.index (i), pcnm, plist); map.assign (pcnm, c); } @@ -187,7 +187,7 @@ = parent.parent_class_name_list (); for (octave_idx_type i = 0; i < p_nel; i++) - c(i) = octave_value (pmap.index(i), pcnm, plist); + c(i) = octave_value (pmap.index (i), pcnm, plist); map.assign (pcnm, c); } diff --git a/src/ov-complex.cc b/src/ov-complex.cc --- a/src/ov-complex.cc +++ b/src/ov-complex.cc @@ -65,8 +65,8 @@ octave_base_value::type_conv_info octave_complex::numeric_demotion_function (void) const { - return octave_base_value::type_conv_info(default_numeric_demotion_function, - octave_float_complex::static_type_id ()); + return octave_base_value::type_conv_info (default_numeric_demotion_function, + octave_float_complex::static_type_id ()); } octave_base_value * diff --git a/src/ov-cx-mat.cc b/src/ov-cx-mat.cc --- a/src/ov-cx-mat.cc +++ b/src/ov-cx-mat.cc @@ -73,8 +73,8 @@ octave_base_value::type_conv_info octave_complex_matrix::numeric_demotion_function (void) const { - return octave_base_value::type_conv_info(default_numeric_demotion_function, - octave_float_complex_matrix::static_type_id ()); + return octave_base_value::type_conv_info (default_numeric_demotion_function, + octave_float_complex_matrix::static_type_id ()); } octave_base_value * @@ -644,7 +644,7 @@ dim_vector dv; int empty = load_hdf5_empty (loc_id, name, dv); if (empty > 0) - matrix.resize(dv); + matrix.resize (dv); if (empty) return (empty > 0); diff --git a/src/ov-cx-sparse.cc b/src/ov-cx-sparse.cc --- a/src/ov-cx-sparse.cc +++ b/src/ov-cx-sparse.cc @@ -188,8 +188,8 @@ octave_idx_type nr = matrix.rows (); for (octave_idx_type j = 0; j < nc; j++) - for (octave_idx_type i = matrix.cidx(j); i < matrix.cidx(j+1); i++) - retval(matrix.ridx(i) + nr * j) = + for (octave_idx_type i = matrix.cidx (j); i < matrix.cidx (j+1); i++) + retval(matrix.ridx (i) + nr * j) = static_cast(std::real (matrix.data (i))); } @@ -275,14 +275,14 @@ for (int i = 0; i < nc+1; i++) { octave_quit (); - itmp = matrix.cidx(i); + itmp = matrix.cidx (i); os.write (reinterpret_cast (&itmp), 4); } for (int i = 0; i < nz; i++) { octave_quit (); - itmp = matrix.ridx(i); + itmp = matrix.ridx (i); os.write (reinterpret_cast (&itmp), 4); } @@ -334,7 +334,7 @@ return false; if (swap) swap_bytes<4> (&tmp); - m.cidx(i) = tmp; + m.cidx (i) = tmp; } for (int i = 0; i < nz; i++) @@ -344,7 +344,7 @@ return false; if (swap) swap_bytes<4> (&tmp); - m.ridx(i) = tmp; + m.ridx (i) = tmp; } if (! is.read (reinterpret_cast (&ctmp), 1)) @@ -622,7 +622,7 @@ dim_vector dv; int empty = load_hdf5_empty (loc_id, name, dv); if (empty > 0) - matrix.resize(dv); + matrix.resize (dv); if (empty) return (empty > 0); @@ -862,14 +862,14 @@ for (mwIndex i = 0; i < nz; i++) { - Complex val = matrix.data(i); + Complex val = matrix.data (i); pr[i] = std::real (val); pi[i] = std::imag (val); - ir[i] = matrix.ridx(i); + ir[i] = matrix.ridx (i); } for (mwIndex i = 0; i < columns () + 1; i++) - jc[i] = matrix.cidx(i); + jc[i] = matrix.cidx (i); return retval; } diff --git a/src/ov-fcn-handle.cc b/src/ov-fcn-handle.cc --- a/src/ov-fcn-handle.cc +++ b/src/ov-fcn-handle.cc @@ -1636,8 +1636,8 @@ { m.setfield ("type", "subfunction"); Cell parentage (dim_vector (1, 2)); - parentage.elem(0) = fh_nm; - parentage.elem(1) = fcn->parent_fcn_name (); + parentage.elem (0) = fh_nm; + parentage.elem (1) = fcn->parent_fcn_name (); m.setfield ("parentage", octave_value (parentage)); } else if (fcn->is_private_function ()) diff --git a/src/ov-flt-cx-mat.cc b/src/ov-flt-cx-mat.cc --- a/src/ov-flt-cx-mat.cc +++ b/src/ov-flt-cx-mat.cc @@ -611,7 +611,7 @@ dim_vector dv; int empty = load_hdf5_empty (loc_id, name, dv); if (empty > 0) - matrix.resize(dv); + matrix.resize (dv); if (empty) return (empty > 0); diff --git a/src/ov-flt-re-mat.cc b/src/ov-flt-re-mat.cc --- a/src/ov-flt-re-mat.cc +++ b/src/ov-flt-re-mat.cc @@ -624,7 +624,7 @@ dim_vector dv; int empty = load_hdf5_empty (loc_id, name, dv); if (empty > 0) - matrix.resize(dv); + matrix.resize (dv); if (empty) return (empty > 0); @@ -860,8 +860,8 @@ } /* -%!assert (class (single(1)), "single") -%!assert (class (single(1 + i)), "single") +%!assert (class (single (1)), "single") +%!assert (class (single (1 + i)), "single") %!assert (class (single (int8 (1))), "single") %!assert (class (single (uint8 (1))), "single") %!assert (class (single (int16 (1))), "single") diff --git a/src/ov-re-mat.cc b/src/ov-re-mat.cc --- a/src/ov-re-mat.cc +++ b/src/ov-re-mat.cc @@ -89,8 +89,8 @@ octave_base_value::type_conv_info octave_matrix::numeric_demotion_function (void) const { - return octave_base_value::type_conv_info(default_numeric_demotion_function, - octave_float_matrix::static_type_id ()); + return octave_base_value::type_conv_info (default_numeric_demotion_function, + octave_float_matrix::static_type_id ()); } octave_base_value * @@ -747,7 +747,7 @@ dim_vector dv; int empty = load_hdf5_empty (loc_id, name, dv); if (empty > 0) - matrix.resize(dv); + matrix.resize (dv); if (empty) return (empty > 0); diff --git a/src/ov-re-sparse.cc b/src/ov-re-sparse.cc --- a/src/ov-re-sparse.cc +++ b/src/ov-re-sparse.cc @@ -160,8 +160,8 @@ octave_idx_type nr = matrix.rows (); for (octave_idx_type j = 0; j < nc; j++) - for (octave_idx_type i = matrix.cidx(j); i < matrix.cidx(j+1); i++) - retval(matrix.ridx(i) + nr * j) = static_cast(matrix.data (i)); + for (octave_idx_type i = matrix.cidx (j); i < matrix.cidx (j+1); i++) + retval(matrix.ridx (i) + nr * j) = static_cast(matrix.data (i)); return retval; } @@ -216,8 +216,8 @@ bool warned = false; for (octave_idx_type j = 0; j < nc; j++) - for (octave_idx_type i = matrix.cidx(j); - i < matrix.cidx(j+1); i++) + for (octave_idx_type i = matrix.cidx (j); + i < matrix.cidx (j+1); i++) { octave_quit (); @@ -246,7 +246,7 @@ } } - chm (matrix.ridx(i) + j * nr) = + chm (matrix.ridx (i) + j * nr) = static_cast (ival); } } @@ -308,14 +308,14 @@ for (int i = 0; i < nc+1; i++) { octave_quit (); - itmp = matrix.cidx(i); + itmp = matrix.cidx (i); os.write (reinterpret_cast (&itmp), 4); } for (int i = 0; i < nz; i++) { octave_quit (); - itmp = matrix.ridx(i); + itmp = matrix.ridx (i); os.write (reinterpret_cast (&itmp), 4); } @@ -367,7 +367,7 @@ return false; if (swap) swap_bytes<4> (&tmp); - m.xcidx(i) = tmp; + m.xcidx (i) = tmp; } for (int i = 0; i < nz; i++) @@ -377,7 +377,7 @@ return false; if (swap) swap_bytes<4> (&tmp); - m.xridx(i) = tmp; + m.xridx (i) = tmp; } if (! is.read (reinterpret_cast (&ctmp), 1)) @@ -637,7 +637,7 @@ dim_vector dv; int empty = load_hdf5_empty (loc_id, name, dv); if (empty > 0) - matrix.resize(dv); + matrix.resize (dv); if (empty) return (empty > 0); @@ -867,12 +867,12 @@ for (mwIndex i = 0; i < nz; i++) { - pr[i] = matrix.data(i); - ir[i] = matrix.ridx(i); + pr[i] = matrix.data (i); + ir[i] = matrix.ridx (i); } for (mwIndex i = 0; i < nc + 1; i++) - jc[i] = matrix.cidx(i); + jc[i] = matrix.cidx (i); return retval; } diff --git a/src/ov-scalar.cc b/src/ov-scalar.cc --- a/src/ov-scalar.cc +++ b/src/ov-scalar.cc @@ -67,8 +67,8 @@ octave_base_value::type_conv_info octave_scalar::numeric_demotion_function (void) const { - return octave_base_value::type_conv_info(default_numeric_demotion_function, - octave_float_scalar::static_type_id ()); + return octave_base_value::type_conv_info (default_numeric_demotion_function, + octave_float_scalar::static_type_id ()); } octave_value diff --git a/src/ov-str-mat.cc b/src/ov-str-mat.cc --- a/src/ov-str-mat.cc +++ b/src/ov-str-mat.cc @@ -252,7 +252,7 @@ octave_idx_type nr = chm.rows (); retval.clear (nr, 1); for (octave_idx_type i = 0; i < nr; i++) - retval.xelem(i) = chm.row_as_string (i); + retval.xelem (i) = chm.row_as_string (i); } else error ("cellstr: cannot convert multidimensional arrays"); @@ -615,7 +615,7 @@ dim_vector dv; int empty = load_hdf5_empty (loc_id, name, dv); if (empty > 0) - matrix.resize(dv); + matrix.resize (dv); if (empty) return (empty > 0); diff --git a/src/ov-struct.cc b/src/ov-struct.cc --- a/src/ov-struct.cc +++ b/src/ov-struct.cc @@ -2000,11 +2000,11 @@ %!test %! x(3).d=1; x(2).a=2; x(1).b=3; x(2).c=3; %! assert (isfield (x, "b")); -%!assert (isfield (struct("a", "1"), "a")) +%!assert (isfield (struct ("a", "1"), "a")) %!assert (isfield ({1}, "c"), false) -%!assert (isfield (struct("a", "1"), 10), false) -%!assert (isfield (struct("a", "b"), "a "), false) -%!assert (isfield (struct("a", 1, "b", 2), {"a", "c"}), [true, false]) +%!assert (isfield (struct ("a", "1"), 10), false) +%!assert (isfield (struct ("a", "b"), "a "), false) +%!assert (isfield (struct ("a", 1, "b", 2), {"a", "c"}), [true, false]) */ DEFUN (cell2struct, args, , diff --git a/src/ov-usr-fcn.cc b/src/ov-usr-fcn.cc --- a/src/ov-usr-fcn.cc +++ b/src/ov-usr-fcn.cc @@ -188,7 +188,7 @@ system_fcn_file (false), call_depth (-1), num_named_args (param_list ? param_list->length () : 0), subfunction (false), inline_function (false), - anonymous_function (false), nested_function(false), + anonymous_function (false), nested_function (false), class_constructor (false), class_method (false), parent_scope (-1), local_scope (sid), curr_unwind_protect_frame (0) @@ -871,7 +871,7 @@ the tilde (~) special output argument. Functions can use @code{isargout} to\n\ avoid performing unnecessary calculations for outputs which are unwanted.\n\ \n\ -If @var{k} is outside the range @code{1:max(nargout)}, the function returns\n\ +If @var{k} is outside the range @code{1:max (nargout)}, the function returns\n\ false. @var{k} can also be an array, in which case the function works\n\ element-by-element and a logical array is returned. At the top level,\n\ @code{isargout} returns an error.\n\ diff --git a/src/ov.cc b/src/ov.cc --- a/src/ov.cc +++ b/src/ov.cc @@ -2751,7 +2751,7 @@ type_string[k] = '.'; else { - error("%s: invalid indexing type `%s'", name, item.c_str ()); + error ("%s: invalid indexing type `%s'", name, item.c_str ()); return; } } @@ -2810,7 +2810,7 @@ \n\ @example\n\ @group\n\ -val = magic(3)\n\ +val = magic (3)\n\ @result{} val = [ 8 1 6\n\ 3 5 7\n\ 4 9 2 ]\n\ @@ -2957,7 +2957,7 @@ %! assert ({ subsref(c, idx1) }, {13}); %! assert ({ subsref(c, idx2p) }, {7 9 17 19}); %! assert ({ subsref(c, idx3p) }, num2cell ([1:5, 21:25])); -%! assert (subsref(c, idx4), c); +%! assert (subsref (c, idx4), c); %! c = subsasgn (c, idx1, 0); %! c = subsasgn (c, idx2, 0); %! c = subsasgn (c, idx3, 0); diff --git a/src/pr-output.cc b/src/pr-output.cc --- a/src/pr-output.cc +++ b/src/pr-output.cc @@ -303,8 +303,8 @@ else os << std::setw (0) << "e+"; - os << std::setw (pef.f.ex - 2) << std::setfill('0') << ex - << std::setfill(' '); + os << std::setw (pef.f.ex - 2) << std::setfill ('0') << ex + << std::setfill (' '); os.flags (oflags); @@ -360,7 +360,7 @@ { std::ostringstream buf; buf.flags (std::ios::fixed); - buf << std::setprecision (0) << xround(val); + buf << std::setprecision (0) << xround (val); s = buf.str (); } else @@ -2004,8 +2004,8 @@ } template -void print_nd_array(std::ostream& os, const NDA_T& nda, - bool pr_as_read_syntax) +void print_nd_array (std::ostream& os, const NDA_T& nda, + bool pr_as_read_syntax) { if (nda.is_empty ()) @@ -3554,7 +3554,7 @@ %! foo.char = repmat ("- Hello World -", [3, 20]); %! foo.cell = {foo.real, foo.complex, foo.char}; %! fields = fieldnames (foo); -%! for f = 1:numel(fields) +%! for f = 1:numel (fields) %! format loose; %! loose = disp (foo.(fields{f})); %! format compact; diff --git a/src/procstream.h b/src/procstream.h --- a/src/procstream.h +++ b/src/procstream.h @@ -108,10 +108,10 @@ oprocstream (void) : std::ostream (0), procstreambase () { } oprocstream (const std::string& name, int mode = std::ios::out) - : std::ostream (0), procstreambase(name, mode) { } + : std::ostream (0), procstreambase (name, mode) { } oprocstream (const char *name, int mode = std::ios::out) - : std::ostream (0), procstreambase(name, mode) { } + : std::ostream (0), procstreambase (name, mode) { } ~oprocstream (void) { } diff --git a/src/sighandlers.cc b/src/sighandlers.cc --- a/src/sighandlers.cc +++ b/src/sighandlers.cc @@ -252,7 +252,7 @@ octave_signals_caught[SIGCHLD] = true; } -#endif /* defined(SIGCHLD) */ +#endif /* defined (SIGCHLD) */ #ifdef SIGFPE #if defined (__alpha__) @@ -268,8 +268,8 @@ octave_interrupt_state++; } } -#endif /* defined(__alpha__) */ -#endif /* defined(SIGFPE) */ +#endif /* defined (__alpha__) */ +#endif /* defined (SIGFPE) */ #if defined (SIGHUP) || defined (SIGTERM) static void @@ -401,7 +401,7 @@ if (pipe_handler_error_count++ > 100 && octave_interrupt_state >= 0) octave_interrupt_state++; } -#endif /* defined(SIGPIPE) */ +#endif /* defined (SIGPIPE) */ #ifdef USE_W32_SIGINT static BOOL CALLBACK @@ -409,7 +409,7 @@ { const char *sig_name; - switch(sig) + switch (sig) { case CTRL_BREAK_EVENT: sig_name = "Ctrl-Break"; @@ -431,7 +431,7 @@ break; } - switch(sig) + switch (sig) { case CTRL_BREAK_EVENT: case CTRL_C_EVENT: @@ -447,7 +447,7 @@ // We should do the following: // clean_up_and_exit (0); // We can't because we aren't running in the normal Octave thread. - user_abort(sig_name, sig); + user_abort (sig_name, sig); break; } diff --git a/src/sparse-xdiv.cc b/src/sparse-xdiv.cc --- a/src/sparse-xdiv.cc +++ b/src/sparse-xdiv.cc @@ -117,7 +117,7 @@ INSTANTIATE_MX_DIV_CONFORM (SparseComplexMatrix, DiagMatrix); INSTANTIATE_MX_DIV_CONFORM (SparseComplexMatrix, ComplexDiagMatrix); -// Right division functions. X / Y = X * inv(Y) = (inv (Y') * X')' +// Right division functions. X / Y = X * inv (Y) = (inv (Y') * X')' // // Y / X: m cm sm scm // +-- +---+----+----+----+ @@ -384,10 +384,10 @@ for (octave_idx_type j = 0; j < nc; j++) - for (octave_idx_type i = b.cidx(j); i < b.cidx(j+1); i++) + for (octave_idx_type i = b.cidx (j); i < b.cidx (j+1); i++) { octave_quit (); - result.elem (b.ridx(i), j) = a / b.data (i); + result.elem (b.ridx (i), j) = a / b.data (i); } return result; @@ -399,13 +399,13 @@ octave_idx_type nr = b.rows (); octave_idx_type nc = b.cols (); - ComplexMatrix result (nr, nc, Complex(octave_NaN, octave_NaN)); + ComplexMatrix result (nr, nc, Complex (octave_NaN, octave_NaN)); for (octave_idx_type j = 0; j < nc; j++) - for (octave_idx_type i = b.cidx(j); i < b.cidx(j+1); i++) + for (octave_idx_type i = b.cidx (j); i < b.cidx (j+1); i++) { octave_quit (); - result.elem (b.ridx(i), j) = a / b.data (i); + result.elem (b.ridx (i), j) = a / b.data (i); } return result; @@ -420,10 +420,10 @@ ComplexMatrix result (nr, nc, (a / 0.0)); for (octave_idx_type j = 0; j < nc; j++) - for (octave_idx_type i = b.cidx(j); i < b.cidx(j+1); i++) + for (octave_idx_type i = b.cidx (j); i < b.cidx (j+1); i++) { octave_quit (); - result.elem (b.ridx(i), j) = a / b.data (i); + result.elem (b.ridx (i), j) = a / b.data (i); } return result; @@ -438,16 +438,16 @@ ComplexMatrix result (nr, nc, (a / 0.0)); for (octave_idx_type j = 0; j < nc; j++) - for (octave_idx_type i = b.cidx(j); i < b.cidx(j+1); i++) + for (octave_idx_type i = b.cidx (j); i < b.cidx (j+1); i++) { octave_quit (); - result.elem (b.ridx(i), j) = a / b.data (i); + result.elem (b.ridx (i), j) = a / b.data (i); } return result; } -// Left division functions. X \ Y = inv(X) * Y +// Left division functions. X \ Y = inv (X) * Y // // Y \ X : sm scm dm dcm // +-- +---+----+ diff --git a/src/sparse-xpow.cc b/src/sparse-xpow.cc --- a/src/sparse-xpow.cc +++ b/src/sparse-xpow.cc @@ -250,7 +250,7 @@ for (octave_idx_type i = 0; i < nr; i++) { octave_quit (); - result (i, j) = std::pow (atmp, b(i,j)); + result(i, j) = std::pow (atmp, b(i,j)); } } @@ -265,7 +265,7 @@ for (octave_idx_type i = 0; i < nr; i++) { octave_quit (); - result (i, j) = std::pow (a, b(i,j)); + result(i, j) = std::pow (a, b(i,j)); } } @@ -290,7 +290,7 @@ for (octave_idx_type i = 0; i < nr; i++) { octave_quit (); - result (i, j) = std::pow (atmp, b(i,j)); + result(i, j) = std::pow (atmp, b(i,j)); } } @@ -323,13 +323,13 @@ Complex btmp (b); for (octave_idx_type j = 0; j < nc; j++) - for (octave_idx_type i = a.cidx(j); i < a.cidx(j+1); i++) + for (octave_idx_type i = a.cidx (j); i < a.cidx (j+1); i++) { octave_quit (); Complex atmp (a.data (i)); - result (a.ridx(i), j) = std::pow (atmp, btmp); + result(a.ridx (i), j) = std::pow (atmp, btmp); } retval = octave_value (result); @@ -339,10 +339,10 @@ Matrix result (nr, nc, (std::pow (0.0, b))); for (octave_idx_type j = 0; j < nc; j++) - for (octave_idx_type i = a.cidx(j); i < a.cidx(j+1); i++) + for (octave_idx_type i = a.cidx (j); i < a.cidx (j+1); i++) { octave_quit (); - result (a.ridx(i), j) = std::pow (a.data (i), b); + result(a.ridx (i), j) = std::pow (a.data (i), b); } retval = octave_value (result); @@ -407,11 +407,11 @@ int convert_to_complex = 0; for (octave_idx_type j = 0; j < nc; j++) - for (octave_idx_type i = a.cidx(j); i < a.cidx(j+1); i++) + for (octave_idx_type i = a.cidx (j); i < a.cidx (j+1); i++) { if (a.data(i) < 0.0) { - double btmp = b (a.ridx(i), j); + double btmp = b (a.ridx (i), j); if (static_cast (btmp) != btmp) { convert_to_complex = 1; @@ -429,15 +429,15 @@ if (convert_to_complex) { - SparseComplexMatrix complex_result (nr, nc, Complex(1.0, 0.0)); + SparseComplexMatrix complex_result (nr, nc, Complex (1.0, 0.0)); for (octave_idx_type j = 0; j < nc; j++) { - for (octave_idx_type i = a.cidx(j); i < a.cidx(j+1); i++) + for (octave_idx_type i = a.cidx (j); i < a.cidx (j+1); i++) { octave_quit (); - complex_result.xelem(a.ridx(i), j) = - std::pow (Complex(a.data(i)), Complex(b(a.ridx(i), j))); + complex_result.xelem (a.ridx (i), j) = + std::pow (Complex (a.data (i)), Complex (b(a.ridx (i), j))); } } complex_result.maybe_compress (true); @@ -449,11 +449,11 @@ for (octave_idx_type j = 0; j < nc; j++) { - for (octave_idx_type i = a.cidx(j); i < a.cidx(j+1); i++) + for (octave_idx_type i = a.cidx (j); i < a.cidx (j+1); i++) { octave_quit (); - result.xelem(a.ridx(i), j) = std::pow (a.data(i), - b (a.ridx(i), j)); + result.xelem (a.ridx (i), j) = std::pow (a.data (i), + b(a.ridx (i), j)); } } result.maybe_compress (true); @@ -507,13 +507,13 @@ return octave_value (); } - SparseComplexMatrix result (nr, nc, Complex(1.0, 0.0)); + SparseComplexMatrix result (nr, nc, Complex (1.0, 0.0)); for (octave_idx_type j = 0; j < nc; j++) { - for (octave_idx_type i = a.cidx(j); i < a.cidx(j+1); i++) + for (octave_idx_type i = a.cidx (j); i < a.cidx (j+1); i++) { octave_quit (); - result.xelem(a.ridx(i), j) = std::pow (a.data(i), b (a.ridx(i), j)); + result.xelem (a.ridx(i), j) = std::pow (a.data (i), b(a.ridx (i), j)); } } @@ -581,20 +581,20 @@ if (xisint (b)) { for (octave_idx_type j = 0; j < nc; j++) - for (octave_idx_type i = a.cidx(j); i < a.cidx(j+1); i++) + for (octave_idx_type i = a.cidx (j); i < a.cidx (j+1); i++) { octave_quit (); - result (a.ridx(i), j) = + result (a.ridx (i), j) = std::pow (a.data (i), static_cast (b)); } } else { for (octave_idx_type j = 0; j < nc; j++) - for (octave_idx_type i = a.cidx(j); i < a.cidx(j+1); i++) + for (octave_idx_type i = a.cidx (j); i < a.cidx (j+1); i++) { octave_quit (); - result (a.ridx(i), j) = std::pow (a.data (i), b); + result (a.ridx (i), j) = std::pow (a.data (i), b); } } @@ -647,20 +647,20 @@ return octave_value (); } - SparseComplexMatrix result (nr, nc, Complex(1.0, 0.0)); + SparseComplexMatrix result (nr, nc, Complex (1.0, 0.0)); for (octave_idx_type j = 0; j < nc; j++) { - for (octave_idx_type i = a.cidx(j); i < a.cidx(j+1); i++) + for (octave_idx_type i = a.cidx (j); i < a.cidx (j+1); i++) { octave_quit (); - double btmp = b (a.ridx(i), j); + double btmp = b(a.ridx (i), j); Complex tmp; if (xisint (btmp)) - result.xelem(a.ridx(i), j) = std::pow (a.data (i), + result.xelem (a.ridx (i), j) = std::pow (a.data (i), static_cast (btmp)); else - result.xelem(a.ridx(i), j) = std::pow (a.data (i), btmp); + result.xelem (a.ridx (i), j) = std::pow (a.data (i), btmp); } } @@ -715,13 +715,13 @@ return octave_value (); } - SparseComplexMatrix result (nr, nc, Complex(1.0, 0.0)); + SparseComplexMatrix result (nr, nc, Complex (1.0, 0.0)); for (octave_idx_type j = 0; j < nc; j++) { - for (octave_idx_type i = a.cidx(j); i < a.cidx(j+1); i++) + for (octave_idx_type i = a.cidx (j); i < a.cidx (j+1); i++) { octave_quit (); - result.xelem(a.ridx(i), j) = std::pow (a.data (i), b (a.ridx(i), j)); + result.xelem (a.ridx (i), j) = std::pow (a.data (i), b(a.ridx (i), j)); } } result.maybe_compress (true); diff --git a/src/sparse.cc b/src/sparse.cc --- a/src/sparse.cc +++ b/src/sparse.cc @@ -94,7 +94,7 @@ Given the option \"unique\". if more than two values are specified for the\n\ same @var{i}, @var{j} indices, the last specified value will be used.\n\ \n\ -@code{sparse(@var{m}, @var{n})} is equivalent to\n\ +@code{sparse (@var{m}, @var{n})} is equivalent to\n\ @code{sparse ([], [], [], @var{m}, @var{n}, 0)}\n\ \n\ If any of @var{sv}, @var{i} or @var{j} are scalars, they are expanded\n\ @@ -227,9 +227,9 @@ @b{and} that the following conditions are met:\n\ \n\ @itemize\n\ -@item the assignment does not decrease nnz(@var{S}).\n\ +@item the assignment does not decrease nnz (@var{S}).\n\ \n\ -@item after the assignment, nnz(@var{S}) does not exceed @var{nz}.\n\ +@item after the assignment, nnz (@var{S}) does not exceed @var{nz}.\n\ \n\ @item no index is out of bounds.\n\ @end itemize\n\ diff --git a/src/symtab.cc b/src/symtab.cc --- a/src/symtab.cc +++ b/src/symtab.cc @@ -1201,7 +1201,7 @@ std::string fcn_scope = name.substr (0, pos); scope_id stored_scope = xcurrent_scope; xcurrent_scope = xtop_scope; - octave_value parent = find_function (name.substr(0, pos), + octave_value parent = find_function (name.substr (0, pos), octave_value_list (), false); if (parent.is_defined ()) diff --git a/src/syscalls.cc b/src/syscalls.cc --- a/src/syscalls.cc +++ b/src/syscalls.cc @@ -403,9 +403,9 @@ %! until (done) %! fclose (out); %! if (isunix ()) -%! assert(str, {"these\n","strings\n","some\n","are\n"}); +%! assert (str, {"these\n","strings\n","some\n","are\n"}); %! else -%! assert(str, {"these\r\n","strings\r\n","some\r\n","are\r\n"}); +%! assert (str, {"these\r\n","strings\r\n","some\r\n","are\r\n"}); %! endif */ diff --git a/src/sysdep.cc b/src/sysdep.cc --- a/src/sysdep.cc +++ b/src/sysdep.cc @@ -255,7 +255,7 @@ void sysdep_init (void) { -#if defined (__386BSD__) || defined (__FreeBSD__) || defined(__NetBSD__) +#if defined (__386BSD__) || defined (__FreeBSD__) || defined (__NetBSD__) BSD_init (); #elif defined (__MINGW32__) MINGW_init (); diff --git a/src/txt-eng-ft.cc b/src/txt-eng-ft.cc --- a/src/txt-eng-ft.cc +++ b/src/txt-eng-ft.cc @@ -333,7 +333,7 @@ case MODE_RENDER: if (str[i] == '\n') { - glyph_index = FT_Get_Char_Index(face, ' '); + glyph_index = FT_Get_Char_Index (face, ' '); if (!glyph_index || FT_Load_Glyph (face, glyph_index, FT_LOAD_DEFAULT)) { gripe_missing_glyph (' '); @@ -397,7 +397,7 @@ case MODE_BBOX: if (str[i] == '\n') { - glyph_index = FT_Get_Char_Index(face, ' '); + glyph_index = FT_Get_Char_Index (face, ' '); if (! glyph_index || FT_Load_Glyph (face, glyph_index, FT_LOAD_DEFAULT)) { @@ -405,7 +405,7 @@ } else { - multiline_align_xoffsets.push_back(box_line_width); + multiline_align_xoffsets.push_back (box_line_width); // Reset the pixel width for this newline, so we don't // allocate a bounding box larger than the horizontal // width of the multi-line @@ -465,7 +465,7 @@ if (mode == MODE_BBOX) { /* Push last the width associated with the last line */ - multiline_align_xoffsets.push_back(box_line_width); + multiline_align_xoffsets.push_back (box_line_width); for (unsigned int i = 0; i < multiline_align_xoffsets.size (); i++) { diff --git a/src/variables.cc b/src/variables.cc --- a/src/variables.cc +++ b/src/variables.cc @@ -1336,7 +1336,7 @@ param_names(pos_t) = "Type"; for (size_t i = 0; i < param_string.length (); i++) - param_length(i) = param_names(i) . length (); + param_length(i) = param_names(i).length (); // The attribute column needs size 5. param_length(pos_a) = 5; diff --git a/src/zfstream.cc b/src/zfstream.cc --- a/src/zfstream.cc +++ b/src/zfstream.cc @@ -74,16 +74,16 @@ // Set compression level and strategy int -gzfilebuf::setcompression(int comp_level, - int comp_strategy) +gzfilebuf::setcompression (int comp_level, + int comp_strategy) { - return gzsetparams(file, comp_level, comp_strategy); + return gzsetparams (file, comp_level, comp_strategy); } // Open gzipped file gzfilebuf* -gzfilebuf::open(const char *name, - std::ios_base::openmode mode) +gzfilebuf::open (const char *name, + std::ios_base::openmode mode) { // Fail if file already open if (this->is_open ()) @@ -94,11 +94,11 @@ // Build mode string for gzopen and check it [27.8.1.3.2] char char_mode[6] = "\0\0\0\0\0"; - if (!this->open_mode(mode, char_mode)) + if (! this->open_mode (mode, char_mode)) return 0; // Attempt to open file - if ((file = gzopen(name, char_mode)) == 0) + if ((file = gzopen (name, char_mode)) == 0) return 0; // On success, allocate internal buffer and set flags @@ -110,8 +110,8 @@ // Attach to gzipped file gzfilebuf* -gzfilebuf::attach(int fd, - std::ios_base::openmode mode) +gzfilebuf::attach (int fd, + std::ios_base::openmode mode) { // Fail if file already open if (this->is_open ()) @@ -122,11 +122,11 @@ // Build mode string for gzdopen and check it [27.8.1.3.2] char char_mode[6] = "\0\0\0\0\0"; - if (!this->open_mode(mode, char_mode)) + if (! this->open_mode (mode, char_mode)) return 0; // Attempt to attach to file - if ((file = gzdopen(fd, char_mode)) == 0) + if ((file = gzdopen (fd, char_mode)) == 0) return 0; // On success, allocate internal buffer and set flags @@ -141,14 +141,14 @@ gzfilebuf::close () { // Fail immediately if no file is open - if (!this->is_open ()) + if (! this->is_open ()) return 0; // Assume success gzfilebuf* retval = this; // Attempt to sync and close gzipped file if (this->sync () == -1) retval = 0; - if (gzclose(file) < 0) + if (gzclose (file) < 0) retval = 0; // File is now gone anyway (postcondition [27.8.1.3.8]) file = 0; @@ -162,8 +162,8 @@ // Convert int open mode to mode string bool -gzfilebuf::open_mode(std::ios_base::openmode mode, - char* c_mode) const +gzfilebuf::open_mode (std::ios_base::openmode mode, + char* c_mode) const { // FIXME -- do we need testb? // bool testb = mode & std::ios_base::binary; @@ -178,13 +178,13 @@ // excessive though - keeping it at the default level // To change back, just append "9" to the next three mode strings if (!testi && testo && !testt && !testa) - strcpy(c_mode, "w"); + strcpy (c_mode, "w"); if (!testi && testo && !testt && testa) - strcpy(c_mode, "a"); + strcpy (c_mode, "a"); if (!testi && testo && testt && !testa) - strcpy(c_mode, "w"); + strcpy (c_mode, "w"); if (testi && !testo && !testt && !testa) - strcpy(c_mode, "r"); + strcpy (c_mode, "r"); // No read/write mode yet // if (testi && testo && !testt && !testa) // strcpy(c_mode, "r+"); @@ -192,10 +192,10 @@ // strcpy(c_mode, "w+"); // Mode string should be empty for invalid combination of flags - if (strlen(c_mode) == 0) + if (strlen (c_mode) == 0) return false; - strcat(c_mode, "b"); + strcat (c_mode, "b"); return true; } @@ -205,11 +205,11 @@ gzfilebuf::showmanyc () { // Calls to underflow will fail if file not opened for reading - if (!this->is_open () || !(io_mode & std::ios_base::in)) + if (! this->is_open () || !(io_mode & std::ios_base::in)) return -1; // Make sure get area is in use if (this->gptr () && (this->gptr () < this->egptr ())) - return std::streamsize(this->egptr () - this->gptr ()); + return std::streamsize (this->egptr () - this->gptr ()); else return 0; } @@ -231,21 +231,21 @@ // Attempt to fill internal buffer from gzipped file // (buffer must be guaranteed to exist...) - int bytes_read = gzread(file, buffer, buffer_size); + int bytes_read = gzread (file, buffer, buffer_size); // Indicates error or EOF if (bytes_read <= 0) { // Reset get area - this->setg(buffer, buffer, buffer); + this->setg (buffer, buffer, buffer); return traits_type::eof (); } // Make all bytes read from file available as get area - this->setg(buffer, buffer, buffer + bytes_read); + this->setg (buffer, buffer, buffer + bytes_read); // If next character in get area differs from putback character // flag a failure - gzfilebuf::int_type ret = traits_type::to_int_type(*(this->gptr ())); + gzfilebuf::int_type ret = traits_type::to_int_type (*(this->gptr ())); if (ret != c) return traits_type::eof (); else @@ -263,10 +263,10 @@ // (this shouldn't normally happen, as underflow is only supposed // to be called when gptr >= egptr, but it serves as error check) if (this->gptr () && (this->gptr () < this->egptr ())) - return traits_type::to_int_type(*(this->gptr ())); + return traits_type::to_int_type (*(this->gptr ())); // If the file hasn't been opened for reading, produce error - if (!this->is_open () || !(io_mode & std::ios_base::in)) + if (! this->is_open () || !(io_mode & std::ios_base::in)) return traits_type::eof (); // Copy the final characters to the front of the buffer @@ -282,25 +282,25 @@ // Attempt to fill internal buffer from gzipped file // (buffer must be guaranteed to exist...) - int bytes_read = gzread(file, buffer + stash, buffer_size - stash); + int bytes_read = gzread (file, buffer + stash, buffer_size - stash); // Indicates error or EOF if (bytes_read <= 0) { // Reset get area - this->setg(buffer, buffer, buffer); + this->setg (buffer, buffer, buffer); return traits_type::eof (); } // Make all bytes read from file plus the stash available as get area - this->setg(buffer, buffer + stash, buffer + bytes_read + stash); + this->setg (buffer, buffer + stash, buffer + bytes_read + stash); // Return next character in get area - return traits_type::to_int_type(*(this->gptr ())); + return traits_type::to_int_type (*(this->gptr ())); } // Write put area to gzipped file gzfilebuf::int_type -gzfilebuf::overflow(int_type c) +gzfilebuf::overflow (int_type c) { // Determine whether put area is in use if (this->pbase ()) @@ -309,10 +309,10 @@ if (this->pptr () > this->epptr () || this->pptr () < this->pbase ()) return traits_type::eof (); // Add extra character to buffer if not EOF - if (!traits_type::eq_int_type(c, traits_type::eof ())) + if (! traits_type::eq_int_type (c, traits_type::eof ())) { - *(this->pptr()) = traits_type::to_char_type(c); - this->pbump(1); + *(this->pptr ()) = traits_type::to_char_type (c); + this->pbump (1); } // Number of characters to write to file int bytes_to_write = this->pptr () - this->pbase (); @@ -320,40 +320,40 @@ if (bytes_to_write > 0) { // If the file hasn't been opened for writing, produce error - if (!this->is_open () || !(io_mode & std::ios_base::out)) + if (! this->is_open () || !(io_mode & std::ios_base::out)) return traits_type::eof (); // If gzipped file won't accept all bytes written to it, fail - if (gzwrite(file, this->pbase (), bytes_to_write) != bytes_to_write) + if (gzwrite (file, this->pbase (), bytes_to_write) != bytes_to_write) return traits_type::eof (); // Reset next pointer to point to pbase on success - this->pbump(-bytes_to_write); + this->pbump (-bytes_to_write); } } // Write extra character to file if not EOF - else if (!traits_type::eq_int_type(c, traits_type::eof ())) + else if (! traits_type::eq_int_type (c, traits_type::eof ())) { // If the file hasn't been opened for writing, produce error - if (!this->is_open () || !(io_mode & std::ios_base::out)) + if (! this->is_open () || !(io_mode & std::ios_base::out)) return traits_type::eof (); // Impromptu char buffer (allows "unbuffered" output) - char_type last_char = traits_type::to_char_type(c); + char_type last_char = traits_type::to_char_type (c); // If gzipped file won't accept this character, fail - if (gzwrite(file, &last_char, 1) != 1) + if (gzwrite (file, &last_char, 1) != 1) return traits_type::eof (); } // If you got here, you have succeeded (even if c was EOF) // The return value should therefore be non-EOF - if (traits_type::eq_int_type(c, traits_type::eof ())) - return traits_type::not_eof(c); + if (traits_type::eq_int_type (c, traits_type::eof ())) + return traits_type::not_eof (c); else return c; } // Assign new buffer std::streambuf* -gzfilebuf::setbuf(char_type* p, - std::streamsize n) +gzfilebuf::setbuf (char_type* p, + std::streamsize n) { // First make sure stuff is sync'ed, for safety if (this->sync () == -1) @@ -387,7 +387,7 @@ int gzfilebuf::sync () { - return traits_type::eq_int_type(this->overflow (), traits_type::eof ()) ? -1 : 0; + return traits_type::eq_int_type (this->overflow (), traits_type::eof ()) ? -1 : 0; } /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ @@ -405,29 +405,29 @@ // Allocate internal buffer buffer = new char_type[buffer_size]; // Get area starts empty and will be expanded by underflow as need arises - this->setg(buffer, buffer, buffer); + this->setg (buffer, buffer, buffer); // Setup entire internal buffer as put area. // The one-past-end pointer actually points to the last element of the buffer, // so that overflow(c) can safely add the extra character c to the sequence. // These pointers remain in place for the duration of the buffer - this->setp(buffer, buffer + buffer_size - 1); + this->setp (buffer, buffer + buffer_size - 1); } else { // Even in "unbuffered" case, (small?) get buffer is still required buffer_size = SMALLBUFSIZE; buffer = new char_type[buffer_size]; - this->setg(buffer, buffer, buffer); + this->setg (buffer, buffer, buffer); // "Unbuffered" means no put buffer - this->setp(0, 0); + this->setp (0, 0); } } else { // If buffer already allocated, reset buffer pointers just to make sure no // stale chars are lying around - this->setg(buffer, buffer, buffer); - this->setp(buffer, buffer + buffer_size - 1); + this->setg (buffer, buffer, buffer); + this->setp (buffer, buffer + buffer_size - 1); } } @@ -439,21 +439,21 @@ if (own_buffer && buffer) { // Preserve unbuffered status by zeroing size - if (!this->pbase ()) + if (! this->pbase ()) buffer_size = 0; delete[] buffer; buffer = 0; - this->setg(0, 0, 0); - this->setp(0, 0); + this->setg (0, 0, 0); + this->setp (0, 0); } else { // Reset buffer pointers to initial state if external buffer exists - this->setg(buffer, buffer, buffer); + this->setg (buffer, buffer, buffer); if (buffer) - this->setp(buffer, buffer + buffer_size - 1); + this->setp (buffer, buffer + buffer_size - 1); else - this->setp(0, 0); + this->setp (0, 0); } } @@ -461,7 +461,7 @@ // Seek functions gzfilebuf::pos_type -gzfilebuf::seekoff(off_type off, std::ios_base::seekdir way, +gzfilebuf::seekoff (off_type off, std::ios_base::seekdir way, std::ios_base::openmode) { pos_type ret = pos_type (off_type (-1)); @@ -493,7 +493,7 @@ } gzfilebuf::pos_type -gzfilebuf::seekpos(pos_type sp, std::ios_base::openmode) +gzfilebuf::seekpos (pos_type sp, std::ios_base::openmode) { pos_type ret = pos_type (off_type (-1)); @@ -516,45 +516,45 @@ // Default constructor initializes stream buffer gzifstream::gzifstream () -: std::istream(0), sb () -{ this->init(&sb); } +: std::istream (0), sb () +{ this->init (&sb); } // Initialize stream buffer and open file -gzifstream::gzifstream(const char* name, - std::ios_base::openmode mode) -: std::istream(0), sb () +gzifstream::gzifstream (const char* name, + std::ios_base::openmode mode) +: std::istream (0), sb () { - this->init(&sb); - this->open(name, mode); + this->init (&sb); + this->open (name, mode); } // Initialize stream buffer and attach to file -gzifstream::gzifstream(int fd, - std::ios_base::openmode mode) -: std::istream(0), sb () +gzifstream::gzifstream (int fd, + std::ios_base::openmode mode) +: std::istream (0), sb () { - this->init(&sb); - this->attach(fd, mode); + this->init (&sb); + this->attach (fd, mode); } // Open file and go into fail() state if unsuccessful void -gzifstream::open(const char* name, - std::ios_base::openmode mode) +gzifstream::open (const char* name, + std::ios_base::openmode mode) { - if (!sb.open(name, mode | std::ios_base::in)) - this->setstate(std::ios_base::failbit); + if (! sb.open (name, mode | std::ios_base::in)) + this->setstate (std::ios_base::failbit); else this->clear (); } // Attach to file and go into fail() state if unsuccessful void -gzifstream::attach(int fd, - std::ios_base::openmode mode) +gzifstream::attach (int fd, + std::ios_base::openmode mode) { - if (!sb.attach(fd, mode | std::ios_base::in)) - this->setstate(std::ios_base::failbit); + if (! sb.attach (fd, mode | std::ios_base::in)) + this->setstate (std::ios_base::failbit); else this->clear (); } @@ -563,53 +563,53 @@ void gzifstream::close () { - if (!sb.close ()) - this->setstate(std::ios_base::failbit); + if (! sb.close ()) + this->setstate (std::ios_base::failbit); } /*****************************************************************************/ // Default constructor initializes stream buffer gzofstream::gzofstream () -: std::ostream(0), sb () -{ this->init(&sb); } +: std::ostream (0), sb () +{ this->init (&sb); } // Initialize stream buffer and open file -gzofstream::gzofstream(const char* name, - std::ios_base::openmode mode) -: std::ostream(0), sb () +gzofstream::gzofstream (const char* name, + std::ios_base::openmode mode) +: std::ostream (0), sb () { - this->init(&sb); - this->open(name, mode); + this->init (&sb); + this->open (name, mode); } // Initialize stream buffer and attach to file -gzofstream::gzofstream(int fd, - std::ios_base::openmode mode) -: std::ostream(0), sb () +gzofstream::gzofstream (int fd, + std::ios_base::openmode mode) +: std::ostream (0), sb () { - this->init(&sb); - this->attach(fd, mode); + this->init (&sb); + this->attach (fd, mode); } // Open file and go into fail() state if unsuccessful void -gzofstream::open(const char* name, - std::ios_base::openmode mode) +gzofstream::open (const char* name, + std::ios_base::openmode mode) { - if (!sb.open(name, mode | std::ios_base::out)) - this->setstate(std::ios_base::failbit); + if (! sb.open (name, mode | std::ios_base::out)) + this->setstate (std::ios_base::failbit); else this->clear (); } // Attach to file and go into fail() state if unsuccessful void -gzofstream::attach(int fd, - std::ios_base::openmode mode) +gzofstream::attach (int fd, + std::ios_base::openmode mode) { - if (!sb.attach(fd, mode | std::ios_base::out)) - this->setstate(std::ios_base::failbit); + if (! sb.attach (fd, mode | std::ios_base::out)) + this->setstate (std::ios_base::failbit); else this->clear (); } @@ -618,8 +618,8 @@ void gzofstream::close () { - if (!sb.close ()) - this->setstate(std::ios_base::failbit); + if (! sb.close ()) + this->setstate (std::ios_base::failbit); } #endif // HAVE_ZLIB diff --git a/src/zfstream.h b/src/zfstream.h --- a/src/zfstream.h +++ b/src/zfstream.h @@ -71,8 +71,8 @@ * setcompressionlevel(level). */ int - setcompression(int comp_level, - int comp_strategy = Z_DEFAULT_STRATEGY); + setcompression (int comp_level, + int comp_strategy = Z_DEFAULT_STRATEGY); /** * @brief Check if file is open. @@ -88,8 +88,8 @@ * @return @c this on success, NULL on failure. */ gzfilebuf* - open(const char* name, - std::ios_base::openmode mode); + open (const char* name, + std::ios_base::openmode mode); /** * @brief Attach to already open gzipped file. @@ -98,8 +98,8 @@ * @return @c this on success, NULL on failure. */ gzfilebuf* - attach(int fd, - std::ios_base::openmode mode); + attach (int fd, + std::ios_base::openmode mode); /** * @brief Close gzipped file. @@ -114,8 +114,8 @@ * @return True if valid mode flag combination. */ bool - open_mode(std::ios_base::openmode mode, - char* c_mode) const; + open_mode (std::ios_base::openmode mode, + char* c_mode) const; /** * @brief Number of characters available in stream buffer. @@ -147,7 +147,7 @@ * character at a time. */ virtual int_type - overflow(int_type c = traits_type::eof ()); + overflow (int_type c = traits_type::eof ()); /** * @brief Installs external stream buffer. @@ -158,8 +158,8 @@ * Call setbuf(0,0) to enable unbuffered output. */ virtual std::streambuf* - setbuf(char_type* p, - std::streamsize n); + setbuf (char_type* p, + std::streamsize n); /** * @brief Flush stream buffer to file. @@ -176,9 +176,9 @@ * Each derived class provides its own appropriate behavior. */ virtual pos_type - seekoff(off_type off, std::ios_base::seekdir way, - std::ios_base::openmode mode = - std::ios_base::in|std::ios_base::out); + seekoff (off_type off, std::ios_base::seekdir way, + std::ios_base::openmode mode = + std::ios_base::in|std::ios_base::out); /** * @brief Alters the stream positions. @@ -186,8 +186,8 @@ * Each derived class provides its own appropriate behavior. */ virtual pos_type - seekpos(pos_type sp, std::ios_base::openmode mode = - std::ios_base::in|std::ios_base::out); + seekpos (pos_type sp, std::ios_base::openmode mode = + std::ios_base::in|std::ios_base::out); virtual int_type pbackfail (int_type c = traits_type::eof ()); @@ -290,8 +290,8 @@ * @param mode Open mode flags (forced to contain ios::in). */ explicit - gzifstream(const char* name, - std::ios_base::openmode mode = std::ios_base::in); + gzifstream (const char* name, + std::ios_base::openmode mode = std::ios_base::in); /** * @brief Construct stream on already open gzipped file. @@ -299,8 +299,8 @@ * @param mode Open mode flags (forced to contain ios::in). */ explicit - gzifstream(int fd, - std::ios_base::openmode mode = std::ios_base::in); + gzifstream (int fd, + std::ios_base::openmode mode = std::ios_base::in); /** * Obtain underlying stream buffer. @@ -329,8 +329,8 @@ * convenience. */ void - open(const char* name, - std::ios_base::openmode mode = std::ios_base::in); + open (const char* name, + std::ios_base::openmode mode = std::ios_base::in); /** * @brief Attach to already open gzipped file. @@ -341,8 +341,8 @@ * in state fail(). */ void - attach(int fd, - std::ios_base::openmode mode = std::ios_base::in); + attach (int fd, + std::ios_base::openmode mode = std::ios_base::in); /** * @brief Close gzipped file. @@ -379,8 +379,8 @@ * @param mode Open mode flags (forced to contain ios::out). */ explicit - gzofstream(const char* name, - std::ios_base::openmode mode = std::ios_base::out); + gzofstream (const char* name, + std::ios_base::openmode mode = std::ios_base::out); /** * @brief Construct stream on already open gzipped file. @@ -388,8 +388,8 @@ * @param mode Open mode flags (forced to contain ios::out). */ explicit - gzofstream(int fd, - std::ios_base::openmode mode = std::ios_base::out); + gzofstream (int fd, + std::ios_base::openmode mode = std::ios_base::out); /** * Obtain underlying stream buffer. @@ -418,8 +418,8 @@ * convenience. */ void - open(const char* name, - std::ios_base::openmode mode = std::ios_base::out); + open (const char* name, + std::ios_base::openmode mode = std::ios_base::out); /** * @brief Attach to already open gzipped file. @@ -430,8 +430,8 @@ * in state fail(). */ void - attach(int fd, - std::ios_base::openmode mode = std::ios_base::out); + attach (int fd, + std::ios_base::openmode mode = std::ios_base::out); /** * @brief Close gzipped file. @@ -467,9 +467,9 @@ const gzomanip2&); // Constructor - gzomanip2(gzofstream& (*f)(gzofstream&, T1, T2), - T1 v1, - T2 v2); + gzomanip2 (gzofstream& (*f)(gzofstream&, T1, T2), + T1 v1, + T2 v2); private: // Underlying manipulator function gzofstream& @@ -484,18 +484,18 @@ // Manipulator function thunks through to stream buffer inline gzofstream& -setcompression(gzofstream &gzs, int l, int s = Z_DEFAULT_STRATEGY) +setcompression (gzofstream &gzs, int l, int s = Z_DEFAULT_STRATEGY) { - (gzs.rdbuf ())->setcompression(l, s); + (gzs.rdbuf ())->setcompression (l, s); return gzs; } // Manipulator constructor stores arguments template inline - gzomanip2::gzomanip2(gzofstream &(*f)(gzofstream &, T1, T2), - T1 v1, - T2 v2) + gzomanip2::gzomanip2 (gzofstream &(*f)(gzofstream &, T1, T2), + T1 v1, + T2 v2) : func(f), val1(v1), val2(v2) { } @@ -507,7 +507,7 @@ // Insert this onto stream to simplify setting of compression level inline gzomanip2 -setcompression(int l, int s = Z_DEFAULT_STRATEGY) +setcompression (int l, int s = Z_DEFAULT_STRATEGY) { return gzomanip2(&setcompression, l, s); } #endif // HAVE_ZLIB