Mercurial > octave
comparison libinterp/corefcn/pr-output.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 | 278fc29b69ca |
children | bac0d6f07a3e |
comparison
equal
deleted
inserted
replaced
22196:dd992fd74fce | 22197:e43d83253e28 |
---|---|
1415 { | 1415 { |
1416 double d; | 1416 double d; |
1417 unsigned char i[sizeof (double)]; | 1417 unsigned char i[sizeof (double)]; |
1418 }; | 1418 }; |
1419 | 1419 |
1420 #define PRINT_CHAR_BITS(os, c) \ | 1420 #define PRINT_CHAR_BITS(os, c) \ |
1421 do \ | 1421 do \ |
1422 { \ | 1422 { \ |
1423 unsigned char ctmp = c; \ | 1423 unsigned char ctmp = c; \ |
1424 char stmp[9]; \ | 1424 char stmp[9]; \ |
1425 stmp[0] = (ctmp & 0x80) ? '1' : '0'; \ | 1425 stmp[0] = (ctmp & 0x80) ? '1' : '0'; \ |
1426 stmp[1] = (ctmp & 0x40) ? '1' : '0'; \ | 1426 stmp[1] = (ctmp & 0x40) ? '1' : '0'; \ |
1427 stmp[2] = (ctmp & 0x20) ? '1' : '0'; \ | 1427 stmp[2] = (ctmp & 0x20) ? '1' : '0'; \ |
1428 stmp[3] = (ctmp & 0x10) ? '1' : '0'; \ | 1428 stmp[3] = (ctmp & 0x10) ? '1' : '0'; \ |
1429 stmp[4] = (ctmp & 0x08) ? '1' : '0'; \ | 1429 stmp[4] = (ctmp & 0x08) ? '1' : '0'; \ |
1430 stmp[5] = (ctmp & 0x04) ? '1' : '0'; \ | 1430 stmp[5] = (ctmp & 0x04) ? '1' : '0'; \ |
1431 stmp[6] = (ctmp & 0x02) ? '1' : '0'; \ | 1431 stmp[6] = (ctmp & 0x02) ? '1' : '0'; \ |
1432 stmp[7] = (ctmp & 0x01) ? '1' : '0'; \ | 1432 stmp[7] = (ctmp & 0x01) ? '1' : '0'; \ |
1433 stmp[8] = '\0'; \ | 1433 stmp[8] = '\0'; \ |
1434 os << stmp; \ | 1434 os << stmp; \ |
1435 } \ | 1435 } \ |
1436 while (0) | 1436 while (0) |
1437 | 1437 |
1438 #define PRINT_CHAR_BITS_SWAPPED(os, c) \ | 1438 #define PRINT_CHAR_BITS_SWAPPED(os, c) \ |
1439 do \ | 1439 do \ |
1440 { \ | 1440 { \ |
1441 unsigned char ctmp = c; \ | 1441 unsigned char ctmp = c; \ |
1442 char stmp[9]; \ | 1442 char stmp[9]; \ |
1443 stmp[0] = (ctmp & 0x01) ? '1' : '0'; \ | 1443 stmp[0] = (ctmp & 0x01) ? '1' : '0'; \ |
1444 stmp[1] = (ctmp & 0x02) ? '1' : '0'; \ | 1444 stmp[1] = (ctmp & 0x02) ? '1' : '0'; \ |
1445 stmp[2] = (ctmp & 0x04) ? '1' : '0'; \ | 1445 stmp[2] = (ctmp & 0x04) ? '1' : '0'; \ |
1446 stmp[3] = (ctmp & 0x08) ? '1' : '0'; \ | 1446 stmp[3] = (ctmp & 0x08) ? '1' : '0'; \ |
1447 stmp[4] = (ctmp & 0x10) ? '1' : '0'; \ | 1447 stmp[4] = (ctmp & 0x10) ? '1' : '0'; \ |
1448 stmp[5] = (ctmp & 0x20) ? '1' : '0'; \ | 1448 stmp[5] = (ctmp & 0x20) ? '1' : '0'; \ |
1449 stmp[6] = (ctmp & 0x40) ? '1' : '0'; \ | 1449 stmp[6] = (ctmp & 0x40) ? '1' : '0'; \ |
1450 stmp[7] = (ctmp & 0x80) ? '1' : '0'; \ | 1450 stmp[7] = (ctmp & 0x80) ? '1' : '0'; \ |
1451 stmp[8] = '\0'; \ | 1451 stmp[8] = '\0'; \ |
1452 os << stmp; \ | 1452 os << stmp; \ |
1453 } \ | 1453 } \ |
1454 while (0) | 1454 while (0) |
1455 | 1455 |
1456 static void | 1456 static void |
1457 pr_any_float (const float_format *fmt, std::ostream& os, double d, int fw = 0) | 1457 pr_any_float (const float_format *fmt, std::ostream& os, double d, int fw = 0) |
1458 { | 1458 { |
2976 { | 2976 { |
2977 public: | 2977 public: |
2978 typedef T print_conv_type; | 2978 typedef T print_conv_type; |
2979 }; | 2979 }; |
2980 | 2980 |
2981 #define PRINT_CONV(T1, T2) \ | 2981 #define PRINT_CONV(T1, T2) \ |
2982 template <> \ | 2982 template <> \ |
2983 class \ | 2983 class \ |
2984 octave_print_conv<T1> \ | 2984 octave_print_conv<T1> \ |
2985 { \ | 2985 { \ |
2986 public: \ | 2986 public: \ |
2987 typedef T2 print_conv_type; \ | 2987 typedef T2 print_conv_type; \ |
2988 } | 2988 } |
2989 | 2989 |
2990 PRINT_CONV (octave_int8, octave_int16); | 2990 PRINT_CONV (octave_int8, octave_int16); |
2991 PRINT_CONV (octave_uint8, octave_uint16); | 2991 PRINT_CONV (octave_uint8, octave_uint16); |
2992 | 2992 |
3066 abs (T x) | 3066 abs (T x) |
3067 { | 3067 { |
3068 return x < 0 ? -x : x; | 3068 return x < 0 ? -x : x; |
3069 } | 3069 } |
3070 | 3070 |
3071 #define INSTANTIATE_ABS(T) \ | 3071 #define INSTANTIATE_ABS(T) \ |
3072 template /* static */ T abs (T) | 3072 template /* static */ T abs (T) |
3073 | 3073 |
3074 INSTANTIATE_ABS(signed char); | 3074 INSTANTIATE_ABS(signed char); |
3075 INSTANTIATE_ABS(short); | 3075 INSTANTIATE_ABS(short); |
3076 INSTANTIATE_ABS(int); | 3076 INSTANTIATE_ABS(int); |
3077 INSTANTIATE_ABS(long); | 3077 INSTANTIATE_ABS(long); |
3078 INSTANTIATE_ABS(long long); | 3078 INSTANTIATE_ABS(long long); |
3079 | 3079 |
3080 #define SPECIALIZE_UABS(T) \ | 3080 #define SPECIALIZE_UABS(T) \ |
3081 template <> \ | 3081 template <> \ |
3082 /* static */ inline unsigned T \ | 3082 /* static */ inline unsigned T \ |
3083 abs (unsigned T x) \ | 3083 abs (unsigned T x) \ |
3084 { \ | 3084 { \ |
3085 return x; \ | 3085 return x; \ |
3086 } | 3086 } |
3087 | 3087 |
3088 SPECIALIZE_UABS(char) | 3088 SPECIALIZE_UABS(char) |
3089 SPECIALIZE_UABS(short) | 3089 SPECIALIZE_UABS(short) |
3090 SPECIALIZE_UABS(int) | 3090 SPECIALIZE_UABS(int) |
3131 else | 3131 else |
3132 pr_int (os, val); | 3132 pr_int (os, val); |
3133 } | 3133 } |
3134 } | 3134 } |
3135 | 3135 |
3136 #define PRINT_INT_SCALAR_INTERNAL(TYPE) \ | 3136 #define PRINT_INT_SCALAR_INTERNAL(TYPE) \ |
3137 OCTINTERP_API void \ | 3137 OCTINTERP_API void \ |
3138 octave_print_internal (std::ostream& os, const octave_int<TYPE>& val, bool dummy) \ | 3138 octave_print_internal (std::ostream& os, const octave_int<TYPE>& val, bool dummy) \ |
3139 { \ | 3139 { \ |
3140 octave_print_internal_template (os, val, dummy); \ | 3140 octave_print_internal_template (os, val, dummy); \ |
3141 } | 3141 } |
3142 | 3142 |
3143 PRINT_INT_SCALAR_INTERNAL (int8_t) | 3143 PRINT_INT_SCALAR_INTERNAL (int8_t) |
3144 PRINT_INT_SCALAR_INTERNAL (uint8_t) | 3144 PRINT_INT_SCALAR_INTERNAL (uint8_t) |
3145 PRINT_INT_SCALAR_INTERNAL (int16_t) | 3145 PRINT_INT_SCALAR_INTERNAL (int16_t) |
3376 } | 3376 } |
3377 } | 3377 } |
3378 } | 3378 } |
3379 } | 3379 } |
3380 | 3380 |
3381 #define PRINT_INT_ARRAY_INTERNAL(TYPE) \ | 3381 #define PRINT_INT_ARRAY_INTERNAL(TYPE) \ |
3382 OCTINTERP_API void \ | 3382 OCTINTERP_API void \ |
3383 octave_print_internal (std::ostream& os, const intNDArray<TYPE>& nda, \ | 3383 octave_print_internal (std::ostream& os, const intNDArray<TYPE>& nda, \ |
3384 bool pr_as_read_syntax, int extra_indent) \ | 3384 bool pr_as_read_syntax, int extra_indent) \ |
3385 { \ | 3385 { \ |
3386 octave_print_internal_template (os, nda, pr_as_read_syntax, extra_indent); \ | 3386 octave_print_internal_template (os, nda, pr_as_read_syntax, extra_indent); \ |
3387 } | 3387 } |
3388 | 3388 |
3389 PRINT_INT_ARRAY_INTERNAL (octave_int8) | 3389 PRINT_INT_ARRAY_INTERNAL (octave_int8) |
3390 PRINT_INT_ARRAY_INTERNAL (octave_uint8) | 3390 PRINT_INT_ARRAY_INTERNAL (octave_uint8) |