# HG changeset patch # User Jordi GutiƩrrez Hermoso # Date 1315361716 18000 # Node ID c6c395505089ac6eec1e954922de33f483eba5e4 # Parent d44d7f3c7998b56d3955e50d9cfc0dd9b81190c9 Remove all blank lines with "format compact" * ov-base.cc: Declare extern compact_format and use it to remove newlines * ov-class.cc: Ditto. * pr-output.cc: Remove static qualifier from compact_format, use it to check for more newlines, and document this change in format DEFUN. diff --git a/src/ov-base.cc b/src/ov-base.cc --- a/src/ov-base.cc +++ b/src/ov-base.cc @@ -53,6 +53,9 @@ #include "utils.h" #include "variables.h" +//Defined in pr-output.cc, necessary here to eliminate some newlines +extern bool compact_format; + builtin_type_t btyp_mixed_numeric (builtin_type_t x, builtin_type_t y) { builtin_type_t retval = btyp_unknown; @@ -419,7 +422,8 @@ { os << name << " ="; newline (os); - newline (os); + if (! compact_format) + newline (os); retval = true; } @@ -435,7 +439,7 @@ print (output_buf); - if (print_padding && pad_after) + if (print_padding && pad_after && ! compact_format) newline (output_buf); } diff --git a/src/ov-class.cc b/src/ov-class.cc --- a/src/ov-class.cc +++ b/src/ov-class.cc @@ -55,6 +55,9 @@ DEFINE_OCTAVE_ALLOCATOR(octave_class); +// Defined in pr-output.cc, necessary here to eliminate some newlines +extern bool compact_format; + int octave_class::t_id (-1); const std::string octave_class::t_name ("class"); @@ -1020,7 +1023,8 @@ indent (os); os << name << " ="; newline (os); - newline (os); + if (! compact_format) + newline (os); return retval; } diff --git a/src/pr-output.cc b/src/pr-output.cc --- a/src/pr-output.cc +++ b/src/pr-output.cc @@ -103,7 +103,8 @@ static int bit_format = 0; // TRUE means don't put newlines around the column number headers. -static bool compact_format = false; +bool compact_format = false; +// (note, not static, used in ov-class.cc and ov-base.cc) // TRUE means use an e format. static bool print_e = false; @@ -1956,7 +1957,10 @@ } else { - os << "Diagonal Matrix\n\n"; + os << "Diagonal Matrix\n"; + if (! compact_format) + os << "\n"; + pr_scale_header (os, scale); // kluge. Get the true width of a number. @@ -2369,7 +2373,10 @@ } else { - os << "Diagonal Matrix\n\n"; + os << "Diagonal Matrix\n"; + if (! compact_format) + os << "\n"; + pr_scale_header (os, scale); // kluge. Get the true width of a number. @@ -2514,7 +2521,9 @@ } else { - os << "Permutation Matrix\n\n"; + os << "Permutation Matrix\n"; + if (! compact_format) + os << "\n"; for (octave_idx_type col = 0; col < nc; col += inc) { @@ -2909,7 +2918,9 @@ octave_idx_type n_rows = page.rows (); octave_idx_type n_cols = page.cols (); - os << nm << " =\n\n"; + os << nm << " =\n"; + if (! compact_format) + os << "\n"; for (octave_idx_type ii = 0; ii < n_rows; ii++) { @@ -3157,7 +3168,9 @@ nm += buf.str (); - os << nm << " =\n\n"; + os << nm << " =\n"; + if (! compact_format) + os << "\n"; } Array idx (dim_vector (ndims, 1)); @@ -3262,7 +3275,9 @@ nm += buf.str (); - os << nm << " =\n\n"; + os << nm << " =\n"; + if (! compact_format) + os << "\n"; } Array idx (dim_vector (ndims, 1)); @@ -3895,12 +3910,12 @@ \n\ @table @code\n\ @item compact\n\ -Remove extra blank space around column number labels producing more compact\n\ -output with more data per page.\n\ +Remove blank lines around column number labels and between\n\ +matrices producing more compact output with more data per page.\n\ \n\ @item loose\n\ -Insert blank lines above and below column number labels to produce a more\n\ -readable output with less data per page. (default).\n\ +Insert blank lines above and below column number labels and between matrices\n\ +to produce a more readable output with less data per page. (default).\n\ @end table\n\ @seealso{fixed_point_format, output_max_field_width, output_precision, split_long_rows, rats}\n\ @end deftypefn")