Mercurial > flash_v2
annotate packages/language/c/libm/current/include/pkgconf/libm.h @ 56:755351606154 ecos-sw-1999-12-01
Merge from eCos master repository on 1999-12-01-18:03:05-GMT
| author | jlarmour |
|---|---|
| date | Wed, 01 Dec 1999 18:33:37 +0000 |
| parents | 443894e2e912 |
| children | c38311975d4f |
| rev | line source |
|---|---|
| 0 | 1 #ifndef CYGONCE_PKGCONF_LIBM_H |
| 2 #define CYGONCE_PKGCONF_LIBM_H | |
| 3 //======================================================================== | |
| 4 // | |
| 5 // libm.h | |
| 6 // | |
| 7 // Configuration header for mathematical function library | |
| 8 // | |
| 9 //======================================================================== | |
| 10 //####COPYRIGHTBEGIN#### | |
| 11 // | |
| 12 // ------------------------------------------- | |
| 13 // The contents of this file are subject to the Cygnus eCos Public License | |
| 14 // Version 1.0 (the "License"); you may not use this file except in | |
| 15 // compliance with the License. You may obtain a copy of the License at | |
| 16 // http://sourceware.cygnus.com/ecos | |
| 17 // | |
| 18 // Software distributed under the License is distributed on an "AS IS" | |
| 19 // basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the | |
| 20 // License for the specific language governing rights and limitations under | |
| 21 // the License. | |
| 22 // | |
| 23 // The Original Code is eCos - Embedded Cygnus Operating System, released | |
| 24 // September 30, 1998. | |
| 25 // | |
| 26 // The Initial Developer of the Original Code is Cygnus. Portions created | |
| 2 | 27 // by Cygnus are Copyright (C) 1998,1999 Cygnus Solutions. All Rights Reserved. |
| 0 | 28 // ------------------------------------------- |
| 29 // | |
| 30 //####COPYRIGHTEND#### | |
| 31 //======================================================================== | |
| 32 //#####DESCRIPTIONBEGIN#### | |
| 33 // | |
| 2 | 34 // Author(s): jlarmour |
| 35 // Contributors: jlarmour | |
| 0 | 36 // Date: 1998-02-13 |
| 37 // Purpose: Configuration of the standard mathematical function library | |
| 38 // Description: Configuration header for mathematical function library | |
| 39 // Usage: #include <pkgconf/libm.h> | |
| 40 // | |
| 41 //####DESCRIPTIONEND#### | |
| 42 // | |
| 43 //======================================================================== | |
| 44 | |
| 45 | |
| 46 //======================================================================== | |
| 47 // | |
| 48 // A NOTE ON COMPATIBILITY MODES | |
| 49 // | |
| 50 // This math library is capable of being operated in several different | |
| 51 // compatibility modes. These options deal solely with how errors are | |
| 52 // handled. | |
| 53 // | |
| 54 // There are 4 compatibility modes: ANSI/POSIX 1003.1; IEEE-754; X/Open | |
| 55 // Portability Guide issue 3 (XPG3); and System V Interface Definition | |
| 56 // Edition 3. | |
| 57 // | |
| 58 // In IEEE mode, the matherr() function (see below) is never called, no | |
| 59 // warning messages are printed on the stderr output stream, and errno is | |
| 60 // never set. | |
| 61 // | |
| 62 // In ANSI/POSIX mode, errno is set correctly, but matherr() is never | |
| 63 // called and no warning messages are printed on the stderr output stream. | |
| 64 // | |
| 65 // In X/Open mode, errno is set correctly, matherr() is called, but no | |
| 66 // warning messages are printed on the stderr output stream. | |
| 67 // | |
| 68 // In SVID mode, functions which overflow return a value "HUGE" (defined in | |
| 69 // math.h), which is the maximum single precision floating point value | |
| 70 // (as opposed to HUGE_VAL which is meant to stand for infinity). errno is | |
| 71 // set correctly and matherr() is called. If matherr() returns 0, warning | |
| 72 // messages are printed on the stderr output stream for some errors. | |
| 73 // | |
| 74 // The mode can be compiled-in as IEEE-only, or any one of the above | |
| 75 // methods settable at run-time. See the configuration options below for | |
| 76 // more. | |
| 77 // | |
| 78 //======================================================================== | |
| 79 // | |
| 80 // MATHERR() | |
| 81 // | |
| 82 // As said, in X/Open or SVID modes, the user can supply a function | |
| 83 // matherr() of the form: | |
| 84 // | |
| 85 // int matherr( struct exception * ); | |
| 86 // | |
| 87 // where: | |
| 88 // struct exception { | |
| 89 // int type; | |
| 90 // char *name; | |
| 91 // double arg1, arg2, retval; | |
| 92 // }; | |
| 93 // | |
| 94 // - type is the exception type and is one of: | |
| 95 // DOMAIN - argument domain exception | |
| 96 // SING - argument singularity | |
| 97 // OVERFLOW - overflow range exception | |
| 98 // UNDERFLOW - underflow range exception | |
| 99 // TLOSS - total loss of significance | |
| 100 // PLOSS - partial loss of significance | |
| 101 // | |
| 102 // - name is a string containing the name of the function | |
| 103 // - arg1 and arg2 are the arguments passed to the function | |
| 104 // - retval is the default value that will be returned by the function, and | |
| 105 // can be changed by matherr | |
| 106 // | |
| 107 // matherr must have "C" linkage, not C++ | |
| 108 // | |
| 109 // If matherr returns zero, or the user doesn't supply their own matherr, | |
| 110 // then the following _usually_ happens in SVID mode: | |
| 111 // | |
| 112 // If type is: | |
| 113 // DOMAIN - 0.0 returned, errno=EDOM, and a message printed on stderr | |
| 114 // SING - HUGE of appropriate sign is returned, errno=EDOM, and a | |
| 115 // message is printed on stderr | |
| 116 // OVERFLOW - HUGE of appropriate sign is returned, and errno=ERANGE | |
| 117 // UNDERFLOW - 0.0 is returned and errno=ERANGE | |
| 118 // TLOSS - 0.0 is returned, errno=ERANGE, and a message is printed on | |
| 119 // stderr | |
| 120 // PLOSS - The current implementation doesn't return this type | |
| 121 // | |
| 122 // X/Open mode is similar except that the message is not printed on stderr | |
| 123 // and HUGE_VAL is used in place of HUGE | |
| 124 // | |
| 125 //======================================================================== | |
| 126 // | |
| 127 // THREAD-SAFETY AND RE-ENTRANCY | |
| 128 // | |
| 129 // With the appropriate configuration options set below, the math library | |
| 130 // is fully thread-safe if: | |
| 131 // | |
| 132 // - Depending on the compatibility mode, the setting of the errno variable | |
| 133 // from the C library is thread-safe | |
| 134 // | |
| 135 // - Depending on the compatibility mode, sending error messages to the | |
| 136 // stderr output stream using the C library fputs() function is | |
| 137 // thread-safe | |
| 138 // | |
| 139 // - Depending on the compatibility mode, the user-supplied matherr() | |
| 140 // function and anything it depends on are thread-safe | |
| 141 // | |
| 142 // In addition, with the exception of the gamma*() and lgamma*() functions, | |
| 143 // the math library is re-entrant (and thus safe to use from interrupt | |
| 144 // handlers) if the Math library is always in IEEE mode | |
| 145 // | |
| 146 //======================================================================== | |
| 147 // | |
| 148 // Also note that this math library assumes the hardware (or software | |
| 149 // floating point emulation) supports IEEE-754 style arithmetic, 32-bit | |
| 150 // 2's complement integer arithmetic, doubles are in 64-bit | |
| 151 // IEEE-754 format. | |
| 152 // | |
| 153 //======================================================================== | |
| 154 | |
| 155 | |
| 156 // INCLUDES | |
| 157 | |
| 158 // Include system configuration file to work out whether the Math library | |
| 159 // is to be included at all | |
| 160 #include <pkgconf/system.h> | |
| 161 | |
| 162 // We want to check if the kernel supports per-thread data | |
| 163 #ifdef CYGPKG_KERNEL | |
| 164 # include <pkgconf/kernel.h> | |
| 165 #endif | |
| 166 | |
| 167 /* | |
| 168 | |
| 169 {{CFG_DATA | |
| 170 cdl_package CYGPKG_LIBM { | |
| 2 | 171 display "Math library" |
| 0 | 172 description "ISO standard floating point mathematical library |
| 173 containing many useful functions for mathematical | |
| 174 calculations." | |
| 175 type boolean | |
| 176 requires CYGPKG_ERROR | |
| 2 | 177 doc ref/ecos-ref/the-iso-standard-c-and-math-libraries.html |
| 0 | 178 } |
| 179 }}CFG_DATA | |
| 180 | |
| 181 */ | |
| 182 | |
| 183 // TYPE DEFINITIONS | |
| 184 | |
| 185 // Compatibility mode selector - required for default below | |
| 186 | |
| 187 typedef enum { | |
| 188 CYGNUM_LIBM_COMPAT_UNINIT= 0, // Default state. DO NOT set it to this | |
| 189 CYGNUM_LIBM_COMPAT_POSIX = 1, // ANSI/POSIX 1003.1 | |
| 190 CYGNUM_LIBM_COMPAT_IEEE = 2, // IEEE-754 | |
| 191 CYGNUM_LIBM_COMPAT_XOPEN = 3, // X/OPEN Portability guide issue 3 | |
| 192 // (XPG3) | |
| 193 CYGNUM_LIBM_COMPAT_SVID = 4 // System V Interface Definition 3rd | |
| 194 // edition | |
| 195 } Cyg_libm_compat_t; | |
| 196 | |
| 197 | |
| 198 //======================================================================== | |
| 199 // | |
| 200 // COMPATIBILITY-MODE RELATED CONFIGURATION OPTIONS | |
| 201 | |
| 202 /* | |
| 203 {{CFG_DATA | |
| 204 | |
| 205 cdl_component CYGPKG_LIBM_COMPATIBILITY { | |
| 206 display "Compatibility mode" | |
| 207 description "These options deal with behaviour related to | |
| 208 the various compatibility modes - POSIX, IEEE, | |
| 209 X/OPEN and SVID." | |
| 210 doc ref/ecos-ref/math-library-compatibility-modes.html | |
| 211 type dummy | |
| 212 parent CYGPKG_LIBM | |
| 213 } | |
| 214 | |
| 215 cdl_option CYGSEM_LIBM_COMPAT_IEEE_ONLY { | |
| 216 display "IEEE-only" | |
| 217 description "The math library can be hard-coded to only | |
| 218 behave in one compatibility mode - IEEE. This | |
| 219 cannot be changed at run-time. IEEE mode is the | |
| 220 most minimal of the compatibility modes, and so | |
| 221 this will best help code size and speed, as well | |
| 222 as omitting the code for other compatibility | |
| 223 modes. If not defined, the math library can be | |
| 224 set at run-time to any of the supported | |
| 225 compatibility modes." | |
| 226 type radio | |
| 227 parent CYGPKG_LIBM_COMPATIBILITY | |
| 228 } | |
| 229 | |
| 230 cdl_component CYGPKG_LIBM_COMPATIBILITY_DEFAULT { | |
| 231 display "Default mode" | |
| 232 description "If you want to have support for more than one | |
| 233 compatibility mode settable at run-time, rather | |
| 234 than hard-coded IEEE mode, this component lets | |
| 235 you choose which mode should be the default." | |
| 236 type radio | |
| 237 parent CYGPKG_LIBM_COMPATIBILITY | |
| 238 requires CYGPKG_LIBC | |
| 239 } | |
| 240 | |
| 241 cdl_option CYGNUM_LIBM_COMPATIBILITY_POSIX { | |
| 242 display "POSIX" | |
| 243 description "This sets the default compatibility mode to | |
| 244 POSIX" | |
| 245 type radio | |
| 246 parent CYGPKG_LIBM_COMPATIBILITY_DEFAULT | |
| 247 } | |
| 248 | |
| 249 cdl_option CYGNUM_LIBM_COMPATIBILITY_IEEE { | |
| 250 display "IEEE" | |
| 251 description "This sets the default compatibility mode to IEEE" | |
| 252 type radio | |
| 253 parent CYGPKG_LIBM_COMPATIBILITY_DEFAULT | |
| 254 } | |
| 255 | |
| 256 cdl_option CYGNUM_LIBM_COMPATIBILITY_XOPEN { | |
| 257 display "X/OPEN" | |
| 258 description "This sets the default compatibility mode to | |
| 259 X/OPEN" | |
| 260 type radio | |
| 261 parent CYGPKG_LIBM_COMPATIBILITY_DEFAULT | |
| 262 } | |
| 263 | |
| 264 cdl_option CYGNUM_LIBM_COMPATIBILITY_SVID { | |
| 265 display "SVID" | |
| 266 description "This sets the default compatibility mode to SVID" | |
| 267 type radio | |
| 268 parent CYGPKG_LIBM_COMPATIBILITY_DEFAULT | |
| 269 } | |
| 270 | |
| 271 cdl_option CYGFUN_LIBM_SVID3_scalb { | |
| 272 display "SVID3-style scalb()" | |
| 273 description "SVID3 defined the scalb() function as double | |
| 274 scalb(double, double) rather than double | |
| 275 scalb(double, int) which is used by IBM, DEC, and | |
| 276 probably others. Enabling this option chooses | |
| 277 the (double, double) version. Note there is a | |
| 278 function double scalbn(double, int) which is | |
| 279 unaffected by this choice." | |
| 280 type boolean | |
| 281 parent CYGPKG_LIBM_COMPATIBILITY | |
| 282 } | |
| 283 | |
| 284 cdl_option CYGSYM_LIBM_NO_XOPEN_SVID_NAMESPACE_POLLUTION { | |
| 285 display "Reduce namespace pollution" | |
| 286 description "If you do not want to use either the X/Open or | |
| 287 SVID3 compatibility modes, you may want to define | |
| 288 this option to reduce the chance of namespace | |
| 289 pollution. This is particularly likely to occur | |
| 290 here as these standards define symbols with | |
| 291 names that often appear in applications, such as | |
| 292 exception, DOMAIN, OVERFLOW, etc. If your | |
| 293 application also used these names, it may cause | |
| 294 problems." | |
| 295 type boolean | |
| 296 parent CYGPKG_LIBM_COMPATIBILITY | |
| 297 } | |
| 298 | |
| 299 cdl_option CYGSEM_LIBM_USE_STDERR { | |
| 300 display "Output to stderr for math errors" | |
| 301 description "The SVID3 standard says that error | |
| 302 messages should be output on the stderr console | |
| 303 output stream. This option allows this ability | |
| 304 to be explicitly controlled. However, this still | |
| 305 only has an effect in SVID3 compatibility mode." | |
| 306 type boolean | |
| 307 requires !CYGSEM_LIBM_COMPAT_IEEE_ONLY | |
| 308 requires CYGPKG_LIBC_STDIO | |
| 309 parent CYGPKG_LIBM_COMPATIBILITY | |
| 310 } | |
| 311 | |
| 312 }}CFG_DATA | |
| 313 */ | |
| 314 | |
| 315 #undef CYGSEM_LIBM_COMPAT_IEEE_ONLY | |
| 316 #define CYGPKG_LIBM_COMPATIBILITY_DEFAULT | |
| 317 | |
| 318 #ifdef CYGPKG_LIBM_COMPATIBILITY_DEFAULT | |
| 319 # ifndef CYGPKG_LIBC | |
| 320 # error You must include the libc package if enabling \ | |
| 321 CYGPKG_LIBM_COMPATIBILITY_DEFAULT | |
| 322 # endif | |
| 323 #endif | |
| 324 | |
| 325 #define CYGNUM_LIBM_COMPATIBILITY_POSIX | |
| 326 #undef CYGNUM_LIBM_COMPATIBILITY_IEEE | |
| 327 #undef CYGNUM_LIBM_COMPATIBILITY_XOPEN | |
| 328 #undef CYGNUM_LIBM_COMPATIBILITY_SVID | |
| 329 | |
|
56
755351606154
Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents:
2
diff
changeset
|
330 #undef CYGNUM_LIBM_COMPAT_DEFAULT /* this is for permtest to find! */ |
| 0 | 331 |
|
56
755351606154
Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents:
2
diff
changeset
|
332 #ifndef CYGNUM_LIBM_COMPAT_DEFAULT |
|
755351606154
Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents:
2
diff
changeset
|
333 # if defined(CYGPKG_LIBM_COMPATIBILITY_DEFAULT) |
|
755351606154
Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents:
2
diff
changeset
|
334 # if defined(CYGNUM_LIBM_COMPATIBILITY_POSIX) |
|
755351606154
Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents:
2
diff
changeset
|
335 # define CYGNUM_LIBM_COMPAT_DEFAULT CYGNUM_LIBM_COMPAT_POSIX |
|
755351606154
Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents:
2
diff
changeset
|
336 # elif defined(CYGNUM_LIBM_COMPATIBILITY_IEEE) |
|
755351606154
Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents:
2
diff
changeset
|
337 # define CYGNUM_LIBM_COMPAT_DEFAULT CYGNUM_LIBM_COMPAT_IEEE |
|
755351606154
Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents:
2
diff
changeset
|
338 # elif defined(CYGNUM_LIBM_COMPATIBILITY_XOPEN) |
|
755351606154
Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents:
2
diff
changeset
|
339 # define CYGNUM_LIBM_COMPAT_DEFAULT CYGNUM_LIBM_COMPAT_XOPEN |
|
755351606154
Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents:
2
diff
changeset
|
340 # elif defined(CYGNUM_LIBM_COMPATIBILITY_SVID) |
|
755351606154
Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents:
2
diff
changeset
|
341 # define CYGNUM_LIBM_COMPAT_DEFAULT CYGNUM_LIBM_COMPAT_SVID |
|
755351606154
Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents:
2
diff
changeset
|
342 # else |
|
755351606154
Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents:
2
diff
changeset
|
343 # error Configuration broken - no default mode set |
|
755351606154
Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents:
2
diff
changeset
|
344 # endif |
| 0 | 345 # endif |
| 346 #endif | |
| 347 | |
| 348 #define CYGFUN_LIBM_SVID3_scalb | |
| 349 | |
| 350 #undef CYGSYM_LIBM_NO_XOPEN_SVID_NAMESPACE_POLLUTION | |
| 351 | |
| 352 #undef CYGSEM_LIBM_USE_STDERR | |
| 353 | |
| 354 //======================================================================== | |
| 355 // | |
| 356 // THREAD-SAFETY CONFIGURATION OPTIONS | |
| 357 | |
| 358 /* | |
| 359 {{CFG_DATA | |
| 360 | |
| 361 cdl_component CYGPKG_LIBM_THREAD_SAFETY { | |
| 362 display "Thread safety" | |
| 363 description "This option controls whether the C library has | |
| 364 support for thread safe operation in general. | |
| 365 This requires eCos kernel support for per-thread | |
| 366 data, and adjustment of the stack limit." | |
| 367 type dummy | |
| 368 parent CYGPKG_LIBM | |
| 369 doc ref/ecos-ref/c-and-math-library-overview-thread-safety.html | |
| 370 } | |
| 371 | |
| 372 cdl_option CYGSEM_LIBM_THREAD_SAFE_COMPAT_MODE { | |
| 373 display "Compatibility mode setting" | |
| 374 description "This option makes the setting of the compatiblity | |
| 375 mode be a per-thread property. This directly | |
| 376 implies that it also becomes thread-safe." | |
| 377 requires !CYGSEM_LIBM_COMPAT_IEEE_ONLY | |
| 378 requires CYGVAR_KERNEL_THREADS_DATA | |
| 379 parent CYGPKG_LIBM_THREAD_SAFETY | |
| 380 } | |
| 381 }}CFG_DATA | |
| 382 | |
| 383 */ | |
| 384 | |
| 385 | |
| 386 #ifndef CYGSEM_LIBM_COMPAT_IEEE_ONLY // irrelevant if mode is constant | |
| 387 #undef CYGSEM_LIBM_THREAD_SAFE_COMPAT_MODE | |
| 388 #endif | |
| 389 | |
| 2 | 390 |
| 391 #if ( defined(CYGSEM_LIBM_THREAD_SAFE_COMPAT_MODE) && \ | |
| 0 | 392 !defined(CYGVAR_KERNEL_THREADS_DATA) ) |
| 2 | 393 # error The kernel must have thread-specific data \ |
| 394 (CYGVAR_KERNEL_THREADS_DATA) turned on for a thread-safe math library | |
| 0 | 395 #endif |
| 396 | |
| 397 //======================================================================== | |
| 398 // | |
| 399 // TRACING OPTIONS | |
| 400 | |
| 401 /* | |
| 402 {{CFG_DATA | |
| 403 | |
| 404 cdl_component CYGPKG_LIBM_TRACE { | |
| 405 display "Tracing output levels in Math library" | |
| 406 description "Tracing support is useful for debugging. Some | |
| 407 Math library modules can be configured with | |
| 408 different levels of tracing verbosity. These | |
| 409 levels can be configured here." | |
| 410 type boolean | |
| 411 requires CYGDBG_USE_TRACING | |
| 412 parent CYGPKG_LIBM | |
| 413 } | |
| 414 | |
| 415 cdl_option CYGNUM_LIBM_COMPATMODE_TRACE_LEVEL { | |
| 416 display "Compatibility mode get/set" | |
| 417 description "Trace level for debugging the getting and | |
| 418 setting of the compatibility mode when it is | |
| 419 configured to be thread-safe." | |
| 420 type count | |
| 421 legal_values 0 to 1 | |
| 422 requires CYGSEM_LIBM_THREAD_SAFE_COMPAT_MODE | |
| 423 parent CYGPKG_LIBM_TRACE | |
| 424 } | |
| 425 }}CFG_DATA | |
| 426 | |
| 427 */ | |
| 428 | |
| 429 #undef CYGPKG_LIBM_TRACE | |
| 430 | |
| 431 #ifdef CYGPKG_LIBM_TRACE | |
| 432 | |
| 433 #define CYGNUM_LIBM_COMPATMODE_TRACE_LEVEL 0 | |
| 434 | |
| 435 | |
| 436 #endif | |
| 437 | |
| 438 | |
| 439 #endif // CYGONCE_PKGCONF_LIBM_H multiple inclusion protection | |
| 440 | |
| 441 // EOF libm.h |
