diff libinterp/corefcn/oct-stream.cc @ 22197:e43d83253e28

refill multi-line macro definitions Use the Emacs C++ mode style for line continuation markers in multi-line macro definitions. * make_int.cc, __dsearchn__.cc, __magick_read__.cc, besselj.cc, bitfcns.cc, bsxfun.cc, cellfun.cc, data.cc, defun-dld.h, defun-int.h, defun.h, det.cc, error.h, find.cc, gcd.cc, graphics.cc, interpreter.h, jit-ir.h, jit-typeinfo.h, lookup.cc, ls-mat5.cc, max.cc, mexproto.h, mxarray.in.h, oct-stream.cc, ordschur.cc, pr-output.cc, profiler.h, psi.cc, regexp.cc, sparse-xdiv.cc, sparse-xpow.cc, tril.cc, txt-eng.h, utils.cc, variables.cc, variables.h, xdiv.cc, xpow.cc, __glpk__.cc, ov-base.cc, ov-base.h, ov-cell.cc, ov-ch-mat.cc, ov-classdef.cc, ov-complex.cc, ov-cx-mat.cc, ov-cx-sparse.cc, ov-float.cc, ov-float.h, ov-flt-complex.cc, ov-flt-cx-mat.cc, ov-flt-re-mat.cc, ov-int-traits.h, ov-lazy-idx.h, ov-perm.cc, ov-re-mat.cc, ov-re-sparse.cc, ov-scalar.cc, ov-scalar.h, ov-str-mat.cc, ov-type-conv.h, ov.cc, ov.h, op-class.cc, op-int-conv.cc, op-int.h, op-str-str.cc, ops.h, lex.ll, Array.cc, CMatrix.cc, CSparse.cc, MArray.cc, MArray.h, MDiagArray2.cc, MDiagArray2.h, MSparse.h, Sparse.cc, dMatrix.cc, dSparse.cc, fCMatrix.cc, fMatrix.cc, idx-vector.cc, f77-fcn.h, quit.h, bsxfun-decl.h, bsxfun-defs.cc, lo-specfun.cc, oct-convn.cc, oct-convn.h, oct-norm.cc, oct-norm.h, oct-rand.cc, Sparse-op-decls.h, Sparse-op-defs.h, mx-inlines.cc, mx-op-decl.h, mx-op-defs.h, mach-info.cc, oct-group.cc, oct-passwd.cc, oct-syscalls.cc, oct-time.cc, data-conv.cc, kpse.cc, lo-ieee.h, lo-macros.h, oct-cmplx.h, oct-glob.cc, oct-inttypes.cc, oct-inttypes.h, oct-locbuf.h, oct-sparse.h, url-transfer.cc, oct-conf-post.in.h, shared-fcns.h: Refill macro definitions.
author John W. Eaton <jwe@octave.org>
date Mon, 01 Aug 2016 12:40:18 -0400
parents 9203833cab7d
children bac0d6f07a3e
line wrap: on
line diff
--- a/libinterp/corefcn/oct-stream.cc	Tue Jul 12 14:28:07 2016 -0400
+++ b/libinterp/corefcn/oct-stream.cc	Mon Aug 01 12:40:18 2016 -0400
@@ -4344,222 +4344,223 @@
                Matrix&, double*, octave_idx_type&, octave_idx_type&,
                octave_idx_type, octave_idx_type, bool);
 
-#define DO_WHITESPACE_CONVERSION() \
-  do \
-    { \
-      int c = std::istream::traits_type::eof (); \
- \
+#define DO_WHITESPACE_CONVERSION()                                      \
+  do                                                                    \
+    {                                                                   \
+      int c = std::istream::traits_type::eof ();                        \
+                                                                        \
       while (is && (c = is.get ()) != std::istream::traits_type::eof () \
-             && isspace (c)) \
-        { /* skip whitespace */ } \
- \
-      if (c != std::istream::traits_type::eof ()) \
-        is.putback (c); \
-    } \
+             && isspace (c))                                            \
+        { /* skip whitespace */ }                                       \
+                                                                        \
+      if (c != std::istream::traits_type::eof ())                       \
+        is.putback (c);                                                 \
+    }                                                                   \
   while (0)
 
-#define DO_LITERAL_CONVERSION() \
-  do \
-    { \
-      int c = std::istream::traits_type::eof (); \
- \
-      int n = strlen (fmt); \
-      int i = 0; \
- \
-      while (i < n && is && (c = is.get ()) != std::istream::traits_type::eof ()) \
-        { \
-          if (c == static_cast<unsigned char> (fmt[i])) \
-            { \
-              i++; \
-              continue; \
-            } \
-          else \
-            { \
-              is.putback (c); \
-              break; \
-            } \
-        } \
- \
-      if (i != n) \
-        is.setstate (std::ios::failbit); \
-    } \
+#define DO_LITERAL_CONVERSION()                                         \
+  do                                                                    \
+    {                                                                   \
+     int c = std::istream::traits_type::eof ();                         \
+                                                                        \
+     int n = strlen (fmt);                                              \
+     int i = 0;                                                         \
+                                                                        \
+     while (i < n && is && (c = is.get ()) != std::istream::traits_type::eof ()) \
+       {                                                                \
+        if (c == static_cast<unsigned char> (fmt[i]))                   \
+          {                                                             \
+           i++;                                                         \
+           continue;                                                    \
+           }                                                            \
+        else                                                            \
+          {                                                             \
+           is.putback (c);                                              \
+           break;                                                       \
+           }                                                            \
+        }                                                               \
+                                                                        \
+     if (i != n)                                                        \
+       is.setstate (std::ios::failbit);                                 \
+     }                                                                  \
   while (0)
 
-#define DO_PCT_CONVERSION() \
-  do \
-    { \
-      int c = is.get (); \
- \
-      if (c != std::istream::traits_type::eof ()) \
-        { \
-          if (c != '%') \
-            { \
-              is.putback (c); \
-              is.setstate (std::ios::failbit); \
-            } \
-        } \
-      else \
-        is.setstate (std::ios::failbit); \
-    } \
+#define DO_PCT_CONVERSION()                             \
+  do                                                    \
+    {                                                   \
+      int c = is.get ();                                \
+                                                        \
+      if (c != std::istream::traits_type::eof ())       \
+        {                                               \
+          if (c != '%')                                 \
+            {                                           \
+              is.putback (c);                           \
+              is.setstate (std::ios::failbit);          \
+            }                                           \
+        }                                               \
+      else                                              \
+        is.setstate (std::ios::failbit);                \
+    }                                                   \
   while (0)
 
-#define BEGIN_C_CONVERSION() \
-  is.unsetf (std::ios::skipws); \
- \
-  int width = elt->width ? elt->width : 1; \
- \
-  std::string tmp (width, '\0'); \
- \
-  int c = std::istream::traits_type::eof (); \
-  int n = 0; \
- \
-  while (is && n < width && (c = is.get ()) != std::istream::traits_type::eof ()) \
-    tmp[n++] = static_cast<char> (c); \
- \
-  if (n > 0 && c == std::istream::traits_type::eof ()) \
-    is.clear (); \
- \
+#define BEGIN_C_CONVERSION()                                            \
+  is.unsetf (std::ios::skipws);                                         \
+                                                                        \
+  int width = elt->width ? elt->width : 1;                              \
+                                                                        \
+  std::string tmp (width, '\0');                                        \
+                                                                        \
+  int c = std::istream::traits_type::eof ();                            \
+  int n = 0;                                                            \
+                                                                        \
+  while (is && n < width                                                \
+         && (c = is.get ()) != std::istream::traits_type::eof ())       \
+    tmp[n++] = static_cast<char> (c);                                   \
+                                                                        \
+  if (n > 0 && c == std::istream::traits_type::eof ())                  \
+    is.clear ();                                                        \
+                                                                        \
   tmp.resize (n)
 
 // For a '%s' format, skip initial whitespace and then read until the
 // next whitespace character or until WIDTH characters have been read.
-#define BEGIN_S_CONVERSION() \
-  int width = elt->width; \
- \
-  std::string tmp; \
- \
-  do \
-    { \
-      if (width) \
-        { \
-          tmp = std::string (width, '\0'); \
- \
-          int c = std::istream::traits_type::eof (); \
- \
-          int n = 0; \
- \
+#define BEGIN_S_CONVERSION()                                            \
+  int width = elt->width;                                               \
+                                                                        \
+  std::string tmp;                                                      \
+                                                                        \
+  do                                                                    \
+    {                                                                   \
+      if (width)                                                        \
+        {                                                               \
+          tmp = std::string (width, '\0');                              \
+                                                                        \
+          int c = std::istream::traits_type::eof ();                    \
+                                                                        \
+          int n = 0;                                                    \
+                                                                        \
           while (is && (c = is.get ()) != std::istream::traits_type::eof ()) \
-            { \
-              if (! isspace (c)) \
-                { \
-                  tmp[n++] = static_cast<char> (c); \
-                  break; \
-                } \
-            } \
- \
-          while (is && n < width \
+            {                                                           \
+              if (! isspace (c))                                        \
+                {                                                       \
+                  tmp[n++] = static_cast<char> (c);                     \
+                  break;                                                \
+                }                                                       \
+            }                                                           \
+                                                                        \
+          while (is && n < width                                        \
                  && (c = is.get ()) != std::istream::traits_type::eof ()) \
-            { \
-              if (isspace (c)) \
-                { \
-                  is.putback (c); \
-                  break; \
-                } \
-              else \
-                tmp[n++] = static_cast<char> (c); \
-            } \
- \
-          if (n > 0 && c == std::istream::traits_type::eof ()) \
-            is.clear (); \
- \
-          tmp.resize (n); \
-        } \
-      else \
-        { \
-          is >> std::ws >> tmp; \
-        } \
-    } \
+            {                                                           \
+              if (isspace (c))                                          \
+                {                                                       \
+                  is.putback (c);                                       \
+                  break;                                                \
+                }                                                       \
+              else                                                      \
+                tmp[n++] = static_cast<char> (c);                       \
+            }                                                           \
+                                                                        \
+          if (n > 0 && c == std::istream::traits_type::eof ())          \
+            is.clear ();                                                \
+                                                                        \
+          tmp.resize (n);                                               \
+        }                                                               \
+      else                                                              \
+        {                                                               \
+          is >> std::ws >> tmp;                                         \
+        }                                                               \
+    }                                                                   \
   while (0)
 
 // This format must match a nonempty sequence of characters.
-#define BEGIN_CHAR_CLASS_CONVERSION() \
-  int width = elt->width; \
- \
-  std::string tmp; \
- \
-  do \
-    { \
-      if (! width) \
-        width = std::numeric_limits<int>::max (); \
- \
-      std::ostringstream buf; \
- \
-      std::string char_class = elt->char_class; \
- \
-      int c = std::istream::traits_type::eof (); \
- \
-      if (elt->type == '[') \
-        { \
-          int chars_read = 0; \
-          while (is && chars_read++ < width \
-                 && (c = is.get ()) != std::istream::traits_type::eof () \
-                 && char_class.find (c) != std::string::npos) \
-            buf << static_cast<char> (c); \
-        } \
-      else \
-        { \
-          int chars_read = 0; \
-          while (is && chars_read++ < width \
-                 && (c = is.get ()) != std::istream::traits_type::eof () \
-                 && char_class.find (c) == std::string::npos) \
-            buf << static_cast<char> (c); \
-        } \
- \
-      if (width == std::numeric_limits<int>::max () \
-          && c != std::istream::traits_type::eof ()) \
-        is.putback (c); \
- \
-      tmp = buf.str (); \
- \
-      if (tmp.empty ()) \
-        is.setstate (std::ios::failbit); \
-      else if (c == std::istream::traits_type::eof ()) \
-        is.clear (); \
- \
-    } \
+#define BEGIN_CHAR_CLASS_CONVERSION()                                   \
+  int width = elt->width;                                               \
+                                                                        \
+  std::string tmp;                                                      \
+                                                                        \
+  do                                                                    \
+    {                                                                   \
+     if (! width)                                                       \
+       width = std::numeric_limits<int>::max ();                        \
+                                                                        \
+     std::ostringstream buf;                                            \
+                                                                        \
+     std::string char_class = elt->char_class;                          \
+                                                                        \
+     int c = std::istream::traits_type::eof ();                         \
+                                                                        \
+     if (elt->type == '[')                                              \
+       {                                                                \
+        int chars_read = 0;                                             \
+        while (is && chars_read++ < width                               \
+               && (c = is.get ()) != std::istream::traits_type::eof ()  \
+                                    && char_class.find (c) != std::string::npos) \
+          buf << static_cast<char> (c);                                 \
+        }                                                               \
+     else                                                               \
+       {                                                                \
+         int chars_read = 0;                                            \
+         while (is && chars_read++ < width                              \
+                && (c = is.get ()) != std::istream::traits_type::eof () \
+                && char_class.find (c) == std::string::npos)            \
+           buf << static_cast<char> (c);                                \
+       }                                                                \
+                                                                        \
+     if (width == std::numeric_limits<int>::max ()                      \
+         && c != std::istream::traits_type::eof ())                     \
+       is.putback (c);                                                  \
+                                                                        \
+     tmp = buf.str ();                                                  \
+                                                                        \
+     if (tmp.empty ())                                                  \
+       is.setstate (std::ios::failbit);                                 \
+     else if (c == std::istream::traits_type::eof ())                   \
+       is.clear ();                                                     \
+                                                                        \
+    }                                                                   \
   while (0)
 
-#define FINISH_CHARACTER_CONVERSION() \
-  do \
-    { \
-      width = tmp.length (); \
- \
-      if (is) \
-        { \
-          int i = 0; \
- \
-          if (! discard) \
-            { \
-              conversion_count++; \
- \
-              while (i < width) \
-                { \
-                  if (data_index == max_size) \
-                    { \
-                      max_size *= 2; \
- \
-                      if (all_char_conv) \
-                        { \
-                          if (one_elt_size_spec) \
-                            mval.resize (1, max_size, 0.0); \
-                          else if (nr > 0) \
-                            mval.resize (nr, max_size / nr, 0.0); \
-                          else \
-                            panic_impossible (); \
-                        } \
-                      else if (nr > 0) \
-                        mval.resize (nr, max_size / nr, 0.0); \
-                      else \
-                        mval.resize (max_size, 1, 0.0); \
- \
-                      data = mval.fortran_vec (); \
-                    } \
- \
-                  data[data_index++] = tmp[i++]; \
-                } \
-            } \
-        } \
-    } \
+#define FINISH_CHARACTER_CONVERSION()                                   \
+  do                                                                    \
+    {                                                                   \
+      width = tmp.length ();                                            \
+                                                                        \
+      if (is)                                                           \
+        {                                                               \
+          int i = 0;                                                    \
+                                                                        \
+          if (! discard)                                                \
+            {                                                           \
+              conversion_count++;                                       \
+                                                                        \
+              while (i < width)                                         \
+                {                                                       \
+                  if (data_index == max_size)                           \
+                    {                                                   \
+                      max_size *= 2;                                    \
+                                                                        \
+                      if (all_char_conv)                                \
+                        {                                               \
+                          if (one_elt_size_spec)                        \
+                            mval.resize (1, max_size, 0.0);             \
+                          else if (nr > 0)                              \
+                            mval.resize (nr, max_size / nr, 0.0);       \
+                          else                                          \
+                            panic_impossible ();                        \
+                        }                                               \
+                      else if (nr > 0)                                  \
+                        mval.resize (nr, max_size / nr, 0.0);           \
+                      else                                              \
+                        mval.resize (max_size, 1, 0.0);                 \
+                                                                        \
+                      data = mval.fortran_vec ();                       \
+                    }                                                   \
+                                                                        \
+                  data[data_index++] = tmp[i++];                        \
+                }                                                       \
+            }                                                           \
+        }                                                               \
+    }                                                                   \
   while (0)
 
 octave_value
@@ -6321,23 +6322,23 @@
    bool swap, bool do_float_fmt_conv, bool do_NA_conv,
    octave::mach_info::float_format from_flt_fmt);
 
-#define TABLE_ELT(T, U, V, W) \
+#define TABLE_ELT(T, U, V, W)                                           \
   conv_fptr_table[oct_data_conv::T][oct_data_conv::U] = convert_and_copy<V, W>
 
-#define FILL_TABLE_ROW(T, V) \
-  TABLE_ELT (T, dt_int8, V, int8NDArray); \
-  TABLE_ELT (T, dt_uint8, V, uint8NDArray); \
-  TABLE_ELT (T, dt_int16, V, int16NDArray); \
-  TABLE_ELT (T, dt_uint16, V, uint16NDArray); \
-  TABLE_ELT (T, dt_int32, V, int32NDArray); \
-  TABLE_ELT (T, dt_uint32, V, uint32NDArray); \
-  TABLE_ELT (T, dt_int64, V, int64NDArray); \
-  TABLE_ELT (T, dt_uint64, V, uint64NDArray); \
-  TABLE_ELT (T, dt_single, V, FloatNDArray); \
-  TABLE_ELT (T, dt_double, V, NDArray); \
-  TABLE_ELT (T, dt_char, V, charNDArray); \
-  TABLE_ELT (T, dt_schar, V, charNDArray); \
-  TABLE_ELT (T, dt_uchar, V, charNDArray); \
+#define FILL_TABLE_ROW(T, V)                    \
+  TABLE_ELT (T, dt_int8, V, int8NDArray);       \
+  TABLE_ELT (T, dt_uint8, V, uint8NDArray);     \
+  TABLE_ELT (T, dt_int16, V, int16NDArray);     \
+  TABLE_ELT (T, dt_uint16, V, uint16NDArray);   \
+  TABLE_ELT (T, dt_int32, V, int32NDArray);     \
+  TABLE_ELT (T, dt_uint32, V, uint32NDArray);   \
+  TABLE_ELT (T, dt_int64, V, int64NDArray);     \
+  TABLE_ELT (T, dt_uint64, V, uint64NDArray);   \
+  TABLE_ELT (T, dt_single, V, FloatNDArray);    \
+  TABLE_ELT (T, dt_double, V, NDArray);         \
+  TABLE_ELT (T, dt_char, V, charNDArray);       \
+  TABLE_ELT (T, dt_schar, V, charNDArray);      \
+  TABLE_ELT (T, dt_uchar, V, charNDArray);      \
   TABLE_ELT (T, dt_logical, V, boolNDArray);
 
 octave_value
@@ -6930,12 +6931,12 @@
   return nel;
 }
 
-#define INSTANTIATE_WRITE(T) \
-  template \
-  octave_idx_type \
+#define INSTANTIATE_WRITE(T)                                            \
+  template                                                              \
+  octave_idx_type                                                       \
   octave_stream::write (const Array<T>& data, octave_idx_type block_size, \
-                        oct_data_conv::data_type output_type, \
-                        octave_idx_type skip, \
+                        oct_data_conv::data_type output_type,           \
+                        octave_idx_type skip,                           \
                         octave::mach_info::float_format flt_fmt)
 
 INSTANTIATE_WRITE (octave_int8);