comparison libinterp/corefcn/bsxfun.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
131 { 131 {
132 static bool filled = false; 132 static bool filled = false;
133 if (filled) 133 if (filled)
134 return; 134 return;
135 135
136 #define REGISTER_OP_HANDLER(OP, BTYP, NDA, FUNOP) \ 136 #define REGISTER_OP_HANDLER(OP, BTYP, NDA, FUNOP) \
137 bsxfun_handler_table[OP][BTYP] = bsxfun_forward_op<NDA, FUNOP> 137 bsxfun_handler_table[OP][BTYP] = bsxfun_forward_op<NDA, FUNOP>
138 138
139 #define REGISTER_REL_HANDLER(REL, BTYP, NDA, FUNREL) \ 139 #define REGISTER_REL_HANDLER(REL, BTYP, NDA, FUNREL) \
140 bsxfun_handler_table[REL][BTYP] = bsxfun_forward_rel<NDA, FUNREL> 140 bsxfun_handler_table[REL][BTYP] = bsxfun_forward_rel<NDA, FUNREL>
141 141
142 #define REGISTER_STD_HANDLERS(BTYP, NDA) \ 142 #define REGISTER_STD_HANDLERS(BTYP, NDA) \
143 REGISTER_OP_HANDLER (bsxfun_builtin_plus, BTYP, NDA, bsxfun_add); \ 143 REGISTER_OP_HANDLER (bsxfun_builtin_plus, BTYP, NDA, bsxfun_add); \
144 REGISTER_OP_HANDLER (bsxfun_builtin_minus, BTYP, NDA, bsxfun_sub); \ 144 REGISTER_OP_HANDLER (bsxfun_builtin_minus, BTYP, NDA, bsxfun_sub); \
145 REGISTER_OP_HANDLER (bsxfun_builtin_times, BTYP, NDA, bsxfun_mul); \ 145 REGISTER_OP_HANDLER (bsxfun_builtin_times, BTYP, NDA, bsxfun_mul); \
146 REGISTER_OP_HANDLER (bsxfun_builtin_divide, BTYP, NDA, bsxfun_div); \ 146 REGISTER_OP_HANDLER (bsxfun_builtin_divide, BTYP, NDA, bsxfun_div); \
147 REGISTER_OP_HANDLER (bsxfun_builtin_max, BTYP, NDA, bsxfun_max); \ 147 REGISTER_OP_HANDLER (bsxfun_builtin_max, BTYP, NDA, bsxfun_max); \
148 REGISTER_OP_HANDLER (bsxfun_builtin_min, BTYP, NDA, bsxfun_min); \ 148 REGISTER_OP_HANDLER (bsxfun_builtin_min, BTYP, NDA, bsxfun_min); \
149 REGISTER_REL_HANDLER (bsxfun_builtin_eq, BTYP, NDA, bsxfun_eq); \ 149 REGISTER_REL_HANDLER (bsxfun_builtin_eq, BTYP, NDA, bsxfun_eq); \
150 REGISTER_REL_HANDLER (bsxfun_builtin_ne, BTYP, NDA, bsxfun_ne); \ 150 REGISTER_REL_HANDLER (bsxfun_builtin_ne, BTYP, NDA, bsxfun_ne); \
151 REGISTER_REL_HANDLER (bsxfun_builtin_lt, BTYP, NDA, bsxfun_lt); \ 151 REGISTER_REL_HANDLER (bsxfun_builtin_lt, BTYP, NDA, bsxfun_lt); \
152 REGISTER_REL_HANDLER (bsxfun_builtin_le, BTYP, NDA, bsxfun_le); \ 152 REGISTER_REL_HANDLER (bsxfun_builtin_le, BTYP, NDA, bsxfun_le); \
153 REGISTER_REL_HANDLER (bsxfun_builtin_gt, BTYP, NDA, bsxfun_gt); \ 153 REGISTER_REL_HANDLER (bsxfun_builtin_gt, BTYP, NDA, bsxfun_gt); \
154 REGISTER_REL_HANDLER (bsxfun_builtin_ge, BTYP, NDA, bsxfun_ge) 154 REGISTER_REL_HANDLER (bsxfun_builtin_ge, BTYP, NDA, bsxfun_ge)
155 155
156 REGISTER_STD_HANDLERS (btyp_double, NDArray); 156 REGISTER_STD_HANDLERS (btyp_double, NDArray);
157 REGISTER_STD_HANDLERS (btyp_float, FloatNDArray); 157 REGISTER_STD_HANDLERS (btyp_float, FloatNDArray);
158 REGISTER_STD_HANDLERS (btyp_complex, ComplexNDArray); 158 REGISTER_STD_HANDLERS (btyp_complex, ComplexNDArray);
418 { 418 {
419 octave_idx_type ncount = 1; 419 octave_idx_type ncount = 1;
420 for (octave_idx_type i = 1; i < nd; i++) 420 for (octave_idx_type i = 1; i < nd; i++)
421 ncount *= dvc(i); 421 ncount *= dvc(i);
422 422
423 #define BSXDEF(T) \ 423 #define BSXDEF(T) \
424 T result_ ## T; \ 424 T result_ ## T; \
425 bool have_ ## T = false; 425 bool have_ ## T = false;
426 426
427 BSXDEF(NDArray); 427 BSXDEF(NDArray);
428 BSXDEF(ComplexNDArray); 428 BSXDEF(ComplexNDArray);
429 BSXDEF(FloatNDArray); 429 BSXDEF(FloatNDArray);
430 BSXDEF(FloatComplexNDArray); 430 BSXDEF(FloatComplexNDArray);
454 if (maybe_update_column (Bc, B, dvb, dvc, i, idxB)) 454 if (maybe_update_column (Bc, B, dvb, dvc, i, idxB))
455 inputs(1) = Bc; 455 inputs(1) = Bc;
456 456
457 octave_value_list tmp = func.do_multi_index_op (1, inputs); 457 octave_value_list tmp = func.do_multi_index_op (1, inputs);
458 458
459 #define BSXINIT(T, CLS, EXTRACTOR) \ 459 #define BSXINIT(T, CLS, EXTRACTOR) \
460 (result_type == CLS) \ 460 (result_type == CLS) \
461 { \ 461 { \
462 have_ ## T = true; \ 462 have_ ## T = true; \
463 result_ ## T = tmp(0). EXTRACTOR ## _array_value (); \ 463 result_ ## T = tmp(0). EXTRACTOR ## _array_value (); \
464 result_ ## T .resize (dvc); \ 464 result_ ## T .resize (dvc); \
465 } 465 }
466 466
467 if (i == 0) 467 if (i == 0)
468 { 468 {
469 if (! tmp(0).is_sparse_type ()) 469 if (! tmp(0).is_sparse_type ())
470 { 470 {
600 have_NDArray = false; 600 have_NDArray = false;
601 have_ComplexNDArray = true; 601 have_ComplexNDArray = true;
602 } 602 }
603 } 603 }
604 604
605 #define BSXLOOP(T, CLS, EXTRACTOR) \ 605 #define BSXLOOP(T, CLS, EXTRACTOR) \
606 (have_ ## T) \ 606 (have_ ## T) \
607 { \ 607 { \
608 if (tmp(0).class_name () != CLS) \ 608 if (tmp(0).class_name () != CLS) \
609 { \ 609 { \
610 have_ ## T = false; \ 610 have_ ## T = false; \
611 C = result_ ## T; \ 611 C = result_ ## T; \
612 C = do_cat_op (C, tmp(0), ra_idx); \ 612 C = do_cat_op (C, tmp(0), ra_idx); \
613 } \ 613 } \
614 else \ 614 else \
615 result_ ## T .insert (tmp(0). EXTRACTOR ## _array_value (), ra_idx); \ 615 result_ ## T .insert (tmp(0). EXTRACTOR ## _array_value (), ra_idx); \
616 } 616 }
617 617
618 else if BSXLOOP(ComplexNDArray, "double", complex) 618 else if BSXLOOP(ComplexNDArray, "double", complex)
619 else if BSXLOOP(boolNDArray, "logical", bool) 619 else if BSXLOOP(boolNDArray, "logical", bool)
620 else if BSXLOOP(int8NDArray, "int8", int8) 620 else if BSXLOOP(int8NDArray, "int8", int8)
621 else if BSXLOOP(int16NDArray, "int16", int16) 621 else if BSXLOOP(int16NDArray, "int16", int16)
628 else 628 else
629 C = do_cat_op (C, tmp(0), ra_idx); 629 C = do_cat_op (C, tmp(0), ra_idx);
630 } 630 }
631 } 631 }
632 632
633 #define BSXEND(T) \ 633 #define BSXEND(T) \
634 (have_ ## T) \ 634 (have_ ## T) \
635 retval(0) = result_ ## T; 635 retval(0) = result_ ## T;
636 636
637 if BSXEND(NDArray) 637 if BSXEND(NDArray)
638 else if BSXEND(ComplexNDArray) 638 else if BSXEND(ComplexNDArray)
639 else if BSXEND(FloatNDArray) 639 else if BSXEND(FloatNDArray)
640 else if BSXEND(FloatComplexNDArray) 640 else if BSXEND(FloatComplexNDArray)