| 1 | /* If BASE is undefined we use function names like gsl_name() |
| 2 | and assume that we are using doubles. |
| 3 | |
| 4 | If BASE is defined we used function names like gsl_BASE_name() |
| 5 | and use BASE as the base datatype */ |
| 6 | |
| 7 | #if defined(BASE_GSL_COMPLEX_LONG) |
| 8 | #define BASE gsl_complex_long_double |
| 9 | #define SHORT complex_long_double |
| 10 | #define SHORT_REAL long_double |
| 11 | #define ATOMIC long double |
| 12 | #define USES_LONGDOUBLE 1 |
| 13 | #define MULTIPLICITY 2 |
| 14 | #define FP 1 |
| 15 | #define IN_FORMAT "%Lg" |
| 16 | #define OUT_FORMAT "%Lg" |
| 17 | #define ATOMIC_IO ATOMIC |
| 18 | #define ZERO {{0.0L,0.0L}} |
| 19 | #define ONE {{1.0L,0.0L}} |
| 20 | #define BASE_EPSILON GSL_DBL_EPSILON |
| 21 | |
| 22 | #elif defined(BASE_GSL_COMPLEX) |
| 23 | #define BASE gsl_complex |
| 24 | #define SHORT complex |
| 25 | #define SHORT_REAL |
| 26 | #define ATOMIC double |
| 27 | #define MULTIPLICITY 2 |
| 28 | #define FP 1 |
| 29 | #define IN_FORMAT "%lg" |
| 30 | #define OUT_FORMAT "%g" |
| 31 | #define ATOMIC_IO ATOMIC |
| 32 | #define ZERO {{0.0,0.0}} |
| 33 | #define ONE {{1.0,0.0}} |
| 34 | #define BASE_EPSILON GSL_DBL_EPSILON |
| 35 | |
| 36 | #elif defined(BASE_GSL_COMPLEX_FLOAT) |
| 37 | #define BASE gsl_complex_float |
| 38 | #define SHORT complex_float |
| 39 | #define SHORT_REAL float |
| 40 | #define ATOMIC float |
| 41 | #define MULTIPLICITY 2 |
| 42 | #define FP 1 |
| 43 | #define IN_FORMAT "%g" |
| 44 | #define OUT_FORMAT "%g" |
| 45 | #define ATOMIC_IO ATOMIC |
| 46 | #define ZERO {{0.0F,0.0F}} |
| 47 | #define ONE {{1.0F,0.0F}} |
| 48 | #define BASE_EPSILON GSL_FLT_EPSILON |
| 49 | |
| 50 | #elif defined(BASE_LONG_DOUBLE) |
| 51 | #define BASE long double |
| 52 | #define SHORT long_double |
| 53 | #define ATOMIC long double |
| 54 | #define USES_LONGDOUBLE 1 |
| 55 | #define MULTIPLICITY 1 |
| 56 | #define FP 1 |
| 57 | #define IN_FORMAT "%Lg" |
| 58 | #define OUT_FORMAT "%Lg" |
| 59 | #define ATOMIC_IO ATOMIC |
| 60 | #define ZERO 0.0L |
| 61 | #define ONE 1.0L |
| 62 | #define BASE_EPSILON GSL_DBL_EPSILON |
| 63 | |
| 64 | #elif defined(BASE_DOUBLE) |
| 65 | #define BASE double |
| 66 | #define SHORT |
| 67 | #define ATOMIC double |
| 68 | #define MULTIPLICITY 1 |
| 69 | #define FP 1 |
| 70 | #define IN_FORMAT "%lg" |
| 71 | #define OUT_FORMAT "%g" |
| 72 | #define ATOMIC_IO ATOMIC |
| 73 | #define ZERO 0.0 |
| 74 | #define ONE 1.0 |
| 75 | #define BASE_EPSILON GSL_DBL_EPSILON |
| 76 | |
| 77 | #elif defined(BASE_FLOAT) |
| 78 | #define BASE float |
| 79 | #define SHORT float |
| 80 | #define ATOMIC float |
| 81 | #define MULTIPLICITY 1 |
| 82 | #define FP 1 |
| 83 | #define IN_FORMAT "%g" |
| 84 | #define OUT_FORMAT "%g" |
| 85 | #define ATOMIC_IO ATOMIC |
| 86 | #define ZERO 0.0F |
| 87 | #define ONE 1.0F |
| 88 | #define BASE_EPSILON GSL_FLT_EPSILON |
| 89 | |
| 90 | #elif defined(BASE_ULONG) |
| 91 | #define BASE unsigned long |
| 92 | #define SHORT ulong |
| 93 | #define ATOMIC unsigned long |
| 94 | #define MULTIPLICITY 1 |
| 95 | #define IN_FORMAT "%lu" |
| 96 | #define OUT_FORMAT "%lu" |
| 97 | #define ATOMIC_IO ATOMIC |
| 98 | #define ZERO 0UL |
| 99 | #define ONE 1UL |
| 100 | #define UNSIGNED 1 |
| 101 | |
| 102 | #elif defined(BASE_LONG) |
| 103 | #define BASE long |
| 104 | #define SHORT long |
| 105 | #define ATOMIC long |
| 106 | #define MULTIPLICITY 1 |
| 107 | #define IN_FORMAT "%ld" |
| 108 | #define OUT_FORMAT "%ld" |
| 109 | #define ATOMIC_IO ATOMIC |
| 110 | #define ZERO 0L |
| 111 | #define ONE 1L |
| 112 | |
| 113 | #elif defined(BASE_UINT) |
| 114 | #define BASE unsigned int |
| 115 | #define SHORT uint |
| 116 | #define ATOMIC unsigned int |
| 117 | #define MULTIPLICITY 1 |
| 118 | #define IN_FORMAT "%u" |
| 119 | #define OUT_FORMAT "%u" |
| 120 | #define ATOMIC_IO ATOMIC |
| 121 | #define ZERO 0U |
| 122 | #define ONE 1U |
| 123 | #define UNSIGNED 1 |
| 124 | |
| 125 | #elif defined(BASE_INT) |
| 126 | #define BASE int |
| 127 | #define SHORT int |
| 128 | #define ATOMIC int |
| 129 | #define MULTIPLICITY 1 |
| 130 | #define IN_FORMAT "%d" |
| 131 | #define OUT_FORMAT "%d" |
| 132 | #define ATOMIC_IO ATOMIC |
| 133 | #define ZERO 0 |
| 134 | #define ONE 1 |
| 135 | |
| 136 | #elif defined(BASE_USHORT) |
| 137 | #define BASE unsigned short |
| 138 | #define SHORT ushort |
| 139 | #define ATOMIC unsigned short |
| 140 | #define MULTIPLICITY 1 |
| 141 | #define IN_FORMAT "%hu" |
| 142 | #define OUT_FORMAT "%hu" |
| 143 | #define ATOMIC_IO ATOMIC |
| 144 | #define ZERO 0U |
| 145 | #define ONE 1U |
| 146 | #define UNSIGNED 1 |
| 147 | |
| 148 | #elif defined(BASE_SHORT) |
| 149 | #define BASE short |
| 150 | #define SHORT short |
| 151 | #define ATOMIC short |
| 152 | #define MULTIPLICITY 1 |
| 153 | #define IN_FORMAT "%hd" |
| 154 | #define OUT_FORMAT "%hd" |
| 155 | #define ATOMIC_IO ATOMIC |
| 156 | #define ZERO 0 |
| 157 | #define ONE 1 |
| 158 | |
| 159 | #elif defined(BASE_UCHAR) |
| 160 | #define BASE unsigned char |
| 161 | #define SHORT uchar |
| 162 | #define ATOMIC unsigned char |
| 163 | #define MULTIPLICITY 1 |
| 164 | #define IN_FORMAT "%u" |
| 165 | #define OUT_FORMAT "%u" |
| 166 | #define ATOMIC_IO unsigned int |
| 167 | #define ZERO 0U |
| 168 | #define ONE 1U |
| 169 | #define UNSIGNED 1 |
| 170 | |
| 171 | #elif defined(BASE_CHAR) |
| 172 | #define BASE char |
| 173 | #define SHORT char |
| 174 | #define ATOMIC char |
| 175 | #define MULTIPLICITY 1 |
| 176 | #define IN_FORMAT "%d" |
| 177 | #define OUT_FORMAT "%d" |
| 178 | #define ATOMIC_IO int |
| 179 | #define ZERO 0 |
| 180 | #define ONE 1 |
| 181 | #ifdef __CHAR_UNSIGNED__ |
| 182 | #define UNSIGNED 1 |
| 183 | #endif |
| 184 | |
| 185 | #else |
| 186 | #error unknown BASE_ directive in source.h |
| 187 | #endif |
| 188 | |
| 189 | #define CONCAT2x(a,b) a ## _ ## b |
| 190 | #define CONCAT2(a,b) CONCAT2x(a,b) |
| 191 | #define CONCAT3x(a,b,c) a ## _ ## b ## _ ## c |
| 192 | #define CONCAT3(a,b,c) CONCAT3x(a,b,c) |
| 193 | #define CONCAT4x(a,b,c,d) a ## _ ## b ## _ ## c ## _ ## d |
| 194 | #define CONCAT4(a,b,c,d) CONCAT4x(a,b,c,d) |
| 195 | |
| 196 | #ifndef USE_QUALIFIER |
| 197 | #define QUALIFIER |
| 198 | #endif |
| 199 | |
| 200 | #ifdef USE_QUALIFIER |
| 201 | #if defined(BASE_DOUBLE) |
| 202 | #define FUNCTION(dir,name) CONCAT3(dir,QUALIFIER,name) |
| 203 | #define TYPE(dir) dir |
| 204 | #define VIEW(dir,name) CONCAT2(dir,name) |
| 205 | #define QUALIFIED_TYPE(dir) QUALIFIER dir |
| 206 | #define QUALIFIED_VIEW(dir,name) CONCAT3(dir,QUALIFIER,name) |
| 207 | #else |
| 208 | #define FUNCTION(a,c) CONCAT4(a,SHORT,QUALIFIER,c) |
| 209 | #define TYPE(dir) CONCAT2(dir,SHORT) |
| 210 | #define VIEW(dir,name) CONCAT3(dir,SHORT,name) |
| 211 | #define QUALIFIED_TYPE(dir) QUALIFIER CONCAT2(dir,SHORT) |
| 212 | #define QUALIFIED_VIEW(dir,name) CONCAT4(dir,SHORT,QUALIFIER,name) |
| 213 | #endif |
| 214 | #if defined(BASE_GSL_COMPLEX) |
| 215 | #define REAL_TYPE(dir) dir |
| 216 | #define REAL_VIEW(dir,name) CONCAT2(dir,name) |
| 217 | #define QUALIFIED_REAL_TYPE(dir) QUALIFIER dir |
| 218 | #define QUALIFIED_REAL_VIEW(dir,name) CONCAT3(dir,QUALIFIER,name) |
| 219 | #else |
| 220 | #define REAL_TYPE(dir) CONCAT2(dir,SHORT_REAL) |
| 221 | #define REAL_VIEW(dir,name) CONCAT3(dir,SHORT_REAL,name) |
| 222 | #define QUALIFIED_REAL_TYPE(dir) QUALIFIER CONCAT2(dir,SHORT_REAL) |
| 223 | #define QUALIFIED_REAL_VIEW(dir,name) CONCAT4(dir,SHORT_REAL,QUALIFIER,name) |
| 224 | #endif |
| 225 | #else |
| 226 | #if defined(BASE_DOUBLE) |
| 227 | #define FUNCTION(dir,name) CONCAT2(dir,name) |
| 228 | #define TYPE(dir) dir |
| 229 | #define VIEW(dir,name) CONCAT2(dir,name) |
| 230 | #define QUALIFIED_TYPE(dir) TYPE(dir) |
| 231 | #define QUALIFIED_VIEW(dir,name) CONCAT2(dir,name) |
| 232 | #else |
| 233 | #define FUNCTION(a,c) CONCAT3(a,SHORT,c) |
| 234 | #define TYPE(dir) CONCAT2(dir,SHORT) |
| 235 | #define VIEW(dir,name) CONCAT3(dir,SHORT,name) |
| 236 | #define QUALIFIED_TYPE(dir) TYPE(dir) |
| 237 | #define QUALIFIED_VIEW(dir,name) CONCAT3(dir,SHORT,name) |
| 238 | #endif |
| 239 | #if defined(BASE_GSL_COMPLEX) |
| 240 | #define REAL_TYPE(dir) dir |
| 241 | #define REAL_VIEW(dir,name) CONCAT2(dir,name) |
| 242 | #define QUALIFIED_REAL_TYPE(dir) dir |
| 243 | #define QUALIFIED_REAL_VIEW(dir,name) CONCAT2(dir,name) |
| 244 | #else |
| 245 | #define REAL_TYPE(dir) CONCAT2(dir,SHORT_REAL) |
| 246 | #define REAL_VIEW(dir,name) CONCAT3(dir,SHORT_REAL,name) |
| 247 | #define QUALIFIED_REAL_TYPE(dir) CONCAT2(dir,SHORT_REAL) |
| 248 | #define QUALIFIED_REAL_VIEW(dir,name) CONCAT3(dir,SHORT_REAL,name) |
| 249 | #endif |
| 250 | #endif |
| 251 | |
| 252 | #define STRING(x) #x |
| 253 | #define EXPAND(x) STRING(x) |
| 254 | #define NAME(x) EXPAND(TYPE(x)) |