/usr/include/octave-4.0.0/octave/lo-macros.h is in liboctave-dev 4.0.0-3ubuntu9.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 | /*
Copyright (C) 2010-2015 VZLU Prague
This file is part of Octave.
Octave is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 3 of the License, or (at your
option) any later version.
Octave is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with Octave; see the file COPYING. If not, see
<http://www.gnu.org/licenses/>.
*/
#if !defined (octave_lo_macros_h)
#define octave_lo_macros_h 1
// Core macros. Iteration is supported up to count 10.
#define OCT_ITERATE_PARAM_MACRO0(MACRO, PARAM)
#define OCT_ITERATE_PARAM_MACRO1(MACRO, PARAM) \
MACRO(0, PARAM)
#define OCT_ITERATE_PARAM_MACRO2(MACRO, PARAM) \
MACRO(0, PARAM) MACRO(1, PARAM)
#define OCT_ITERATE_PARAM_MACRO3(MACRO, PARAM) \
MACRO(0, PARAM) MACRO(1, PARAM) MACRO(2, PARAM)
#define OCT_ITERATE_PARAM_MACRO4(MACRO, PARAM) \
MACRO(0, PARAM) MACRO(1, PARAM) MACRO(2, PARAM) MACRO(3, PARAM)
#define OCT_ITERATE_PARAM_MACRO5(MACRO, PARAM) \
MACRO(0, PARAM) MACRO(1, PARAM) MACRO(2, PARAM) MACRO(3, PARAM) MACRO(4, PARAM)
#define OCT_ITERATE_PARAM_MACRO6(MACRO, PARAM) \
OCT_ITERATE_PARAM_MACRO5(MACRO, PARAM) MACRO(5, PARAM)
#define OCT_ITERATE_PARAM_MACRO7(MACRO, PARAM) \
OCT_ITERATE_PARAM_MACRO5(MACRO, PARAM) MACRO(5, PARAM) MACRO(6, PARAM)
#define OCT_ITERATE_PARAM_MACRO8(MACRO, PARAM) \
OCT_ITERATE_PARAM_MACRO5(MACRO, PARAM) MACRO(5, PARAM) MACRO(6, PARAM) MACRO(7, PARAM)
#define OCT_ITERATE_PARAM_MACRO9(MACRO, PARAM) \
OCT_ITERATE_PARAM_MACRO8(MACRO, PARAM) MACRO(8, PARAM)
#define OCT_ITERATE_PARAM_MACRO10(MACRO, PARAM) \
OCT_ITERATE_PARAM_MACRO8(MACRO, PARAM) MACRO(8, PARAM) MACRO(9, PARAM)
// expands to MACRO(0, PARAM) MACRO(1, PARAM) ... MACRO(NUM-1, PARAM)
#define OCT_ITERATE_PARAM_MACRO(MACRO, PARAM, NUM) OCT_ITERATE_PARAM_MACRO##NUM(MACRO,PARAM)
#define OCT_IF_PARAM0(MACRO, PARAM)
#define OCT_IF_PARAM1(MACRO, PARAM) MACRO(PARAM)
#define OCT_IF_PARAM2(MACRO, PARAM) MACRO(PARAM)
#define OCT_IF_PARAM3(MACRO, PARAM) MACRO(PARAM)
#define OCT_IF_PARAM4(MACRO, PARAM) MACRO(PARAM)
#define OCT_IF_PARAM5(MACRO, PARAM) MACRO(PARAM)
#define OCT_IF_PARAM6(MACRO, PARAM) MACRO(PARAM)
#define OCT_IF_PARAM7(MACRO, PARAM) MACRO(PARAM)
#define OCT_IF_PARAM8(MACRO, PARAM) MACRO(PARAM)
#define OCT_IF_PARAM9(MACRO, PARAM) MACRO(PARAM)
// expands to MACRO(PARAM) if NUM > 0
#define OCT_IF_PARAM(NUM, MACRO, PARAM) OCT_IF_PARAM##NUM(MACRO, PARAM)
// concatenation and reverse concat
#define OCT_CONCAT2(ARG1, ARG2) ARG1 ## ARG2
#define OCT_CONCAT2_REVERSE(ARG1, ARG2) ARG2 ## ARG1
#define OCT_IF_HELPER(X) X
// expands to X if NUM > 0
#define OCT_IF(NUM, X) OCT_IF_PARAM(NUM, OCT_IF_HELPER, X)
#define OCT_ITERATE_MACRO_HELPER(NUM, MACRO) MACRO(NUM)
// expands to MACRO(0) ... MACRO(NUM-1)
#define OCT_ITERATE_MACRO(MACRO, NUM) OCT_ITERATE_PARAM_MACRO(OCT_ITERATE_MACRO_HELPER, MACRO, NUM)
#define OCT_MAKE_LIST_HELPER1(ARG) ARG,
// expands to MACRO(0), MACRO(1), ..., MACRO(NUM-1)
#define OCT_MAKE_LIST_HELPER(NUM, MACRO) OCT_IF_PARAM(NUM,OCT_MAKE_LIST_HELPER1,) MACRO(NUM)
#define OCT_MAKE_LIST(MACRO, NUM) OCT_ITERATE_PARAM_MACRO(OCT_MAKE_LIST_HELPER, MACRO, NUM)
#define OCT_MAKE_DECL_LIST_HELPER(NUM, PREFIX) \
OCT_IF_PARAM(NUM,OCT_MAKE_LIST_HELPER1,) OCT_CONCAT2(PREFIX, NUM)
// expands to TYPE PREFIX0, TYPE PREFIX1, ..., TYPE PREFIX ## (NUM-1)
#define OCT_MAKE_DECL_LIST(TYPE, PREFIX, NUM) \
OCT_ITERATE_PARAM_MACRO(OCT_MAKE_DECL_LIST_HELPER, TYPE PREFIX, NUM)
// expands to PREFIX0, PREFIX1, ..., PREFIX ## (NUM-1)
#define OCT_MAKE_ARG_LIST(PREFIX, NUM) \
OCT_ITERATE_PARAM_MACRO(OCT_MAKE_DECL_LIST_HELPER, PREFIX, NUM)
#endif
|