Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
libscpi/inc/scpi/config.h@0:be95bfb06686, 2022-01-17 (annotated)
- Committer:
- wuliqunyy
- Date:
- Mon Jan 17 13:20:09 2022 +0000
- Revision:
- 0:be95bfb06686
a working non_flat + adc_didt for ehp regulation version
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
wuliqunyy | 0:be95bfb06686 | 1 | /*- |
wuliqunyy | 0:be95bfb06686 | 2 | * BSD 2-Clause License |
wuliqunyy | 0:be95bfb06686 | 3 | * |
wuliqunyy | 0:be95bfb06686 | 4 | * Copyright (c) 2012-2018, Jan Breuer |
wuliqunyy | 0:be95bfb06686 | 5 | * All rights reserved. |
wuliqunyy | 0:be95bfb06686 | 6 | * |
wuliqunyy | 0:be95bfb06686 | 7 | * Redistribution and use in source and binary forms, with or without |
wuliqunyy | 0:be95bfb06686 | 8 | * modification, are permitted provided that the following conditions are met: |
wuliqunyy | 0:be95bfb06686 | 9 | * |
wuliqunyy | 0:be95bfb06686 | 10 | * * Redistributions of source code must retain the above copyright notice, this |
wuliqunyy | 0:be95bfb06686 | 11 | * list of conditions and the following disclaimer. |
wuliqunyy | 0:be95bfb06686 | 12 | * |
wuliqunyy | 0:be95bfb06686 | 13 | * * Redistributions in binary form must reproduce the above copyright notice, |
wuliqunyy | 0:be95bfb06686 | 14 | * this list of conditions and the following disclaimer in the documentation |
wuliqunyy | 0:be95bfb06686 | 15 | * and/or other materials provided with the distribution. |
wuliqunyy | 0:be95bfb06686 | 16 | * |
wuliqunyy | 0:be95bfb06686 | 17 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
wuliqunyy | 0:be95bfb06686 | 18 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
wuliqunyy | 0:be95bfb06686 | 19 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
wuliqunyy | 0:be95bfb06686 | 20 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
wuliqunyy | 0:be95bfb06686 | 21 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
wuliqunyy | 0:be95bfb06686 | 22 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
wuliqunyy | 0:be95bfb06686 | 23 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
wuliqunyy | 0:be95bfb06686 | 24 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
wuliqunyy | 0:be95bfb06686 | 25 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
wuliqunyy | 0:be95bfb06686 | 26 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
wuliqunyy | 0:be95bfb06686 | 27 | */ |
wuliqunyy | 0:be95bfb06686 | 28 | |
wuliqunyy | 0:be95bfb06686 | 29 | /** |
wuliqunyy | 0:be95bfb06686 | 30 | * @file config.h |
wuliqunyy | 0:be95bfb06686 | 31 | * @date Wed Mar 20 12:21:26 UTC 2013 |
wuliqunyy | 0:be95bfb06686 | 32 | * |
wuliqunyy | 0:be95bfb06686 | 33 | * @brief SCPI Configuration |
wuliqunyy | 0:be95bfb06686 | 34 | * |
wuliqunyy | 0:be95bfb06686 | 35 | * |
wuliqunyy | 0:be95bfb06686 | 36 | */ |
wuliqunyy | 0:be95bfb06686 | 37 | |
wuliqunyy | 0:be95bfb06686 | 38 | #ifndef __SCPI_CONFIG_H_ |
wuliqunyy | 0:be95bfb06686 | 39 | #define __SCPI_CONFIG_H_ |
wuliqunyy | 0:be95bfb06686 | 40 | |
wuliqunyy | 0:be95bfb06686 | 41 | #ifdef __cplusplus |
wuliqunyy | 0:be95bfb06686 | 42 | extern "C" { |
wuliqunyy | 0:be95bfb06686 | 43 | #endif |
wuliqunyy | 0:be95bfb06686 | 44 | |
wuliqunyy | 0:be95bfb06686 | 45 | #include "cc.h" |
wuliqunyy | 0:be95bfb06686 | 46 | |
wuliqunyy | 0:be95bfb06686 | 47 | #ifdef SCPI_USER_CONFIG |
wuliqunyy | 0:be95bfb06686 | 48 | #include "scpi_user_config.h" |
wuliqunyy | 0:be95bfb06686 | 49 | #endif |
wuliqunyy | 0:be95bfb06686 | 50 | |
wuliqunyy | 0:be95bfb06686 | 51 | /* set the termination character(s) */ |
wuliqunyy | 0:be95bfb06686 | 52 | #define LINE_ENDING_CR "\r" /* use a <CR> carriage return as termination charcter */ |
wuliqunyy | 0:be95bfb06686 | 53 | #define LINE_ENDING_LF "\n" /* use a <LF> line feed as termination charcter */ |
wuliqunyy | 0:be95bfb06686 | 54 | #define LINE_ENDING_CRLF "\r\n" /* use <CR><LF> carriage return + line feed as termination charcters */ |
wuliqunyy | 0:be95bfb06686 | 55 | |
wuliqunyy | 0:be95bfb06686 | 56 | #ifndef SCPI_LINE_ENDING |
wuliqunyy | 0:be95bfb06686 | 57 | #define SCPI_LINE_ENDING LINE_ENDING_CRLF |
wuliqunyy | 0:be95bfb06686 | 58 | #endif |
wuliqunyy | 0:be95bfb06686 | 59 | |
wuliqunyy | 0:be95bfb06686 | 60 | /** |
wuliqunyy | 0:be95bfb06686 | 61 | * Detect, if it has limited resources or it is running on a full blown operating system. |
wuliqunyy | 0:be95bfb06686 | 62 | * All values can be overiden by scpi_user_config.h |
wuliqunyy | 0:be95bfb06686 | 63 | */ |
wuliqunyy | 0:be95bfb06686 | 64 | #define SYSTEM_BARE_METAL 0 |
wuliqunyy | 0:be95bfb06686 | 65 | #define SYSTEM_FULL_BLOWN 1 |
wuliqunyy | 0:be95bfb06686 | 66 | |
wuliqunyy | 0:be95bfb06686 | 67 | /* This should cover all windows compilers (msvc, mingw, cvi) and all Linux/OSX/BSD and other UNIX compatible systems (gcc, clang) */ |
wuliqunyy | 0:be95bfb06686 | 68 | #if defined(_WIN32) || defined(_WIN64) || defined(__unix) || defined(__unix__) || defined(__APPLE__) |
wuliqunyy | 0:be95bfb06686 | 69 | #define SYSTEM_TYPE SYSTEM_FULL_BLOWN |
wuliqunyy | 0:be95bfb06686 | 70 | #else |
wuliqunyy | 0:be95bfb06686 | 71 | #define SYSTEM_TYPE SYSTEM_BARE_METAL |
wuliqunyy | 0:be95bfb06686 | 72 | #endif |
wuliqunyy | 0:be95bfb06686 | 73 | |
wuliqunyy | 0:be95bfb06686 | 74 | /** |
wuliqunyy | 0:be95bfb06686 | 75 | * Enable full error list |
wuliqunyy | 0:be95bfb06686 | 76 | * 0 = Minimal set of errors |
wuliqunyy | 0:be95bfb06686 | 77 | * 1 = Full set of errors |
wuliqunyy | 0:be95bfb06686 | 78 | * |
wuliqunyy | 0:be95bfb06686 | 79 | * For small systems, full set of errors will occupy large ammount of data |
wuliqunyy | 0:be95bfb06686 | 80 | * It is enabled by default on full blown systems and disabled on limited bare metal systems |
wuliqunyy | 0:be95bfb06686 | 81 | */ |
wuliqunyy | 0:be95bfb06686 | 82 | #ifndef USE_FULL_ERROR_LIST |
wuliqunyy | 0:be95bfb06686 | 83 | #define USE_FULL_ERROR_LIST SYSTEM_TYPE |
wuliqunyy | 0:be95bfb06686 | 84 | #endif |
wuliqunyy | 0:be95bfb06686 | 85 | |
wuliqunyy | 0:be95bfb06686 | 86 | /** |
wuliqunyy | 0:be95bfb06686 | 87 | * Enable also LIST_OF_USER_ERRORS to be included |
wuliqunyy | 0:be95bfb06686 | 88 | * 0 = Use only library defined errors |
wuliqunyy | 0:be95bfb06686 | 89 | * 1 = Use also LIST_OF_USER_ERRORS |
wuliqunyy | 0:be95bfb06686 | 90 | */ |
wuliqunyy | 0:be95bfb06686 | 91 | #ifndef USE_USER_ERROR_LIST |
wuliqunyy | 0:be95bfb06686 | 92 | #define USE_USER_ERROR_LIST 0 |
wuliqunyy | 0:be95bfb06686 | 93 | #endif |
wuliqunyy | 0:be95bfb06686 | 94 | |
wuliqunyy | 0:be95bfb06686 | 95 | #ifndef USE_DEVICE_DEPENDENT_ERROR_INFORMATION |
wuliqunyy | 0:be95bfb06686 | 96 | #define USE_DEVICE_DEPENDENT_ERROR_INFORMATION SYSTEM_TYPE |
wuliqunyy | 0:be95bfb06686 | 97 | #endif |
wuliqunyy | 0:be95bfb06686 | 98 | |
wuliqunyy | 0:be95bfb06686 | 99 | #if USE_DEVICE_DEPENDENT_ERROR_INFORMATION |
wuliqunyy | 0:be95bfb06686 | 100 | #ifndef USE_MEMORY_ALLOCATION_FREE |
wuliqunyy | 0:be95bfb06686 | 101 | #define USE_MEMORY_ALLOCATION_FREE 1 |
wuliqunyy | 0:be95bfb06686 | 102 | #endif |
wuliqunyy | 0:be95bfb06686 | 103 | #else |
wuliqunyy | 0:be95bfb06686 | 104 | #ifndef USE_MEMORY_ALLOCATION_FREE |
wuliqunyy | 0:be95bfb06686 | 105 | #define USE_MEMORY_ALLOCATION_FREE 0 |
wuliqunyy | 0:be95bfb06686 | 106 | #endif |
wuliqunyy | 0:be95bfb06686 | 107 | #endif |
wuliqunyy | 0:be95bfb06686 | 108 | |
wuliqunyy | 0:be95bfb06686 | 109 | #ifndef USE_COMMAND_TAGS |
wuliqunyy | 0:be95bfb06686 | 110 | #define USE_COMMAND_TAGS 1 |
wuliqunyy | 0:be95bfb06686 | 111 | #endif |
wuliqunyy | 0:be95bfb06686 | 112 | |
wuliqunyy | 0:be95bfb06686 | 113 | #ifndef USE_DEPRECATED_FUNCTIONS |
wuliqunyy | 0:be95bfb06686 | 114 | #define USE_DEPRECATED_FUNCTIONS 1 |
wuliqunyy | 0:be95bfb06686 | 115 | #endif |
wuliqunyy | 0:be95bfb06686 | 116 | |
wuliqunyy | 0:be95bfb06686 | 117 | #ifndef USE_CUSTOM_DTOSTRE |
wuliqunyy | 0:be95bfb06686 | 118 | #define USE_CUSTOM_DTOSTRE 0 |
wuliqunyy | 0:be95bfb06686 | 119 | #endif |
wuliqunyy | 0:be95bfb06686 | 120 | |
wuliqunyy | 0:be95bfb06686 | 121 | #ifndef USE_UNITS_IMPERIAL |
wuliqunyy | 0:be95bfb06686 | 122 | #define USE_UNITS_IMPERIAL 0 |
wuliqunyy | 0:be95bfb06686 | 123 | #endif |
wuliqunyy | 0:be95bfb06686 | 124 | |
wuliqunyy | 0:be95bfb06686 | 125 | #ifndef USE_UNITS_ANGLE |
wuliqunyy | 0:be95bfb06686 | 126 | #define USE_UNITS_ANGLE SYSTEM_TYPE |
wuliqunyy | 0:be95bfb06686 | 127 | #endif |
wuliqunyy | 0:be95bfb06686 | 128 | |
wuliqunyy | 0:be95bfb06686 | 129 | #ifndef USE_UNITS_PARTICLES |
wuliqunyy | 0:be95bfb06686 | 130 | #define USE_UNITS_PARTICLES SYSTEM_TYPE |
wuliqunyy | 0:be95bfb06686 | 131 | #endif |
wuliqunyy | 0:be95bfb06686 | 132 | |
wuliqunyy | 0:be95bfb06686 | 133 | #ifndef USE_UNITS_DISTANCE |
wuliqunyy | 0:be95bfb06686 | 134 | #define USE_UNITS_DISTANCE SYSTEM_TYPE |
wuliqunyy | 0:be95bfb06686 | 135 | #endif |
wuliqunyy | 0:be95bfb06686 | 136 | |
wuliqunyy | 0:be95bfb06686 | 137 | #ifndef USE_UNITS_MAGNETIC |
wuliqunyy | 0:be95bfb06686 | 138 | #define USE_UNITS_MAGNETIC SYSTEM_TYPE |
wuliqunyy | 0:be95bfb06686 | 139 | #endif |
wuliqunyy | 0:be95bfb06686 | 140 | |
wuliqunyy | 0:be95bfb06686 | 141 | #ifndef USE_UNITS_LIGHT |
wuliqunyy | 0:be95bfb06686 | 142 | #define USE_UNITS_LIGHT SYSTEM_TYPE |
wuliqunyy | 0:be95bfb06686 | 143 | #endif |
wuliqunyy | 0:be95bfb06686 | 144 | |
wuliqunyy | 0:be95bfb06686 | 145 | #ifndef USE_UNITS_ENERGY_FORCE_MASS |
wuliqunyy | 0:be95bfb06686 | 146 | #define USE_UNITS_ENERGY_FORCE_MASS SYSTEM_TYPE |
wuliqunyy | 0:be95bfb06686 | 147 | #endif |
wuliqunyy | 0:be95bfb06686 | 148 | |
wuliqunyy | 0:be95bfb06686 | 149 | #ifndef USE_UNITS_TIME |
wuliqunyy | 0:be95bfb06686 | 150 | #define USE_UNITS_TIME SYSTEM_TYPE |
wuliqunyy | 0:be95bfb06686 | 151 | #endif |
wuliqunyy | 0:be95bfb06686 | 152 | |
wuliqunyy | 0:be95bfb06686 | 153 | #ifndef USE_UNITS_TEMPERATURE |
wuliqunyy | 0:be95bfb06686 | 154 | #define USE_UNITS_TEMPERATURE SYSTEM_TYPE |
wuliqunyy | 0:be95bfb06686 | 155 | #endif |
wuliqunyy | 0:be95bfb06686 | 156 | |
wuliqunyy | 0:be95bfb06686 | 157 | #ifndef USE_UNITS_RATIO |
wuliqunyy | 0:be95bfb06686 | 158 | #define USE_UNITS_RATIO SYSTEM_TYPE |
wuliqunyy | 0:be95bfb06686 | 159 | #endif |
wuliqunyy | 0:be95bfb06686 | 160 | |
wuliqunyy | 0:be95bfb06686 | 161 | #ifndef USE_UNITS_POWER |
wuliqunyy | 0:be95bfb06686 | 162 | #define USE_UNITS_POWER 1 |
wuliqunyy | 0:be95bfb06686 | 163 | #endif |
wuliqunyy | 0:be95bfb06686 | 164 | |
wuliqunyy | 0:be95bfb06686 | 165 | #ifndef USE_UNITS_FREQUENCY |
wuliqunyy | 0:be95bfb06686 | 166 | #define USE_UNITS_FREQUENCY 1 |
wuliqunyy | 0:be95bfb06686 | 167 | #endif |
wuliqunyy | 0:be95bfb06686 | 168 | |
wuliqunyy | 0:be95bfb06686 | 169 | #ifndef USE_UNITS_ELECTRIC |
wuliqunyy | 0:be95bfb06686 | 170 | #define USE_UNITS_ELECTRIC 1 |
wuliqunyy | 0:be95bfb06686 | 171 | #endif |
wuliqunyy | 0:be95bfb06686 | 172 | |
wuliqunyy | 0:be95bfb06686 | 173 | #ifndef USE_UNITS_ELECTRIC_CHARGE_CONDUCTANCE |
wuliqunyy | 0:be95bfb06686 | 174 | #define USE_UNITS_ELECTRIC_CHARGE_CONDUCTANCE SYSTEM_TYPE |
wuliqunyy | 0:be95bfb06686 | 175 | #endif |
wuliqunyy | 0:be95bfb06686 | 176 | |
wuliqunyy | 0:be95bfb06686 | 177 | /* define local macros depending on existance of strnlen */ |
wuliqunyy | 0:be95bfb06686 | 178 | #if HAVE_STRNLEN |
wuliqunyy | 0:be95bfb06686 | 179 | #define SCPIDEFINE_strnlen(s, l) strnlen((s), (l)) |
wuliqunyy | 0:be95bfb06686 | 180 | #else |
wuliqunyy | 0:be95bfb06686 | 181 | #define SCPIDEFINE_strnlen(s, l) BSD_strnlen((s), (l)) |
wuliqunyy | 0:be95bfb06686 | 182 | #endif |
wuliqunyy | 0:be95bfb06686 | 183 | |
wuliqunyy | 0:be95bfb06686 | 184 | /* define local macros depending on existance of strncasecmp and strnicmp */ |
wuliqunyy | 0:be95bfb06686 | 185 | #if HAVE_STRNCASECMP |
wuliqunyy | 0:be95bfb06686 | 186 | #define SCPIDEFINE_strncasecmp(s1, s2, l) strncasecmp((s1), (s2), (l)) |
wuliqunyy | 0:be95bfb06686 | 187 | #elif HAVE_STRNICMP |
wuliqunyy | 0:be95bfb06686 | 188 | #define SCPIDEFINE_strncasecmp(s1, s2, l) strnicmp((s1), (s2), (l)) |
wuliqunyy | 0:be95bfb06686 | 189 | #else |
wuliqunyy | 0:be95bfb06686 | 190 | #define SCPIDEFINE_strncasecmp(s1, s2, l) OUR_strncasecmp((s1), (s2), (l)) |
wuliqunyy | 0:be95bfb06686 | 191 | #endif |
wuliqunyy | 0:be95bfb06686 | 192 | |
wuliqunyy | 0:be95bfb06686 | 193 | #if HAVE_DTOSTRE |
wuliqunyy | 0:be95bfb06686 | 194 | #define SCPIDEFINE_floatToStr(v, s, l) dtostre((double)(v), (s), 6, DTOSTR_PLUS_SIGN | DTOSTR_ALWAYS_SIGN | DTOSTR_UPPERCASE) |
wuliqunyy | 0:be95bfb06686 | 195 | #elif USE_CUSTOM_DTOSTRE |
wuliqunyy | 0:be95bfb06686 | 196 | #define SCPIDEFINE_floatToStr(v, s, l) SCPI_dtostre((v), (s), (l), 6, 0) |
wuliqunyy | 0:be95bfb06686 | 197 | #elif HAVE_SNPRINTF |
wuliqunyy | 0:be95bfb06686 | 198 | #define SCPIDEFINE_floatToStr(v, s, l) snprintf((s), (l), "%g", (v)) |
wuliqunyy | 0:be95bfb06686 | 199 | #else |
wuliqunyy | 0:be95bfb06686 | 200 | #define SCPIDEFINE_floatToStr(v, s, l) SCPI_dtostre((v), (s), (l), 6, 0) |
wuliqunyy | 0:be95bfb06686 | 201 | #endif |
wuliqunyy | 0:be95bfb06686 | 202 | |
wuliqunyy | 0:be95bfb06686 | 203 | #if HAVE_DTOSTRE |
wuliqunyy | 0:be95bfb06686 | 204 | #define SCPIDEFINE_doubleToStr(v, s, l) dtostre((v), (s), 15, DTOSTR_PLUS_SIGN | DTOSTR_ALWAYS_SIGN | DTOSTR_UPPERCASE) |
wuliqunyy | 0:be95bfb06686 | 205 | #elif USE_CUSTOM_DTOSTRE |
wuliqunyy | 0:be95bfb06686 | 206 | #define SCPIDEFINE_doubleToStr(v, s, l) SCPI_dtostre((v), (s), (l), 15, 0) |
wuliqunyy | 0:be95bfb06686 | 207 | #elif HAVE_SNPRINTF |
wuliqunyy | 0:be95bfb06686 | 208 | #define SCPIDEFINE_doubleToStr(v, s, l) snprintf((s), (l), "%.15lg", (v)) |
wuliqunyy | 0:be95bfb06686 | 209 | #else |
wuliqunyy | 0:be95bfb06686 | 210 | #define SCPIDEFINE_doubleToStr(v, s, l) SCPI_dtostre((v), (s), (l), 15, 0) |
wuliqunyy | 0:be95bfb06686 | 211 | #endif |
wuliqunyy | 0:be95bfb06686 | 212 | |
wuliqunyy | 0:be95bfb06686 | 213 | #if USE_DEVICE_DEPENDENT_ERROR_INFORMATION |
wuliqunyy | 0:be95bfb06686 | 214 | |
wuliqunyy | 0:be95bfb06686 | 215 | #if USE_MEMORY_ALLOCATION_FREE |
wuliqunyy | 0:be95bfb06686 | 216 | #include <stdlib.h> |
wuliqunyy | 0:be95bfb06686 | 217 | #include <string.h> |
wuliqunyy | 0:be95bfb06686 | 218 | #define SCPIDEFINE_DESCRIPTION_MAX_PARTS 2 |
wuliqunyy | 0:be95bfb06686 | 219 | #if HAVE_STRNDUP |
wuliqunyy | 0:be95bfb06686 | 220 | #define SCPIDEFINE_strndup(h, s, l) strndup((s), (l)) |
wuliqunyy | 0:be95bfb06686 | 221 | #else |
wuliqunyy | 0:be95bfb06686 | 222 | #define SCPIDEFINE_strndup(h, s, l) OUR_strndup((s), (l)) |
wuliqunyy | 0:be95bfb06686 | 223 | #endif |
wuliqunyy | 0:be95bfb06686 | 224 | #define SCPIDEFINE_free(h, s, r) free((s)) |
wuliqunyy | 0:be95bfb06686 | 225 | #else |
wuliqunyy | 0:be95bfb06686 | 226 | #define SCPIDEFINE_DESCRIPTION_MAX_PARTS 3 |
wuliqunyy | 0:be95bfb06686 | 227 | #define SCPIDEFINE_strndup(h, s, l) scpiheap_strndup((h), (s), (l)) |
wuliqunyy | 0:be95bfb06686 | 228 | #define SCPIDEFINE_free(h, s, r) scpiheap_free((h), (s), (r)) |
wuliqunyy | 0:be95bfb06686 | 229 | #define SCPIDEFINE_get_parts(h, s, l1, s2, l2) scpiheap_get_parts((h), (s), (l1), (s2), (l2)) |
wuliqunyy | 0:be95bfb06686 | 230 | #endif |
wuliqunyy | 0:be95bfb06686 | 231 | #else |
wuliqunyy | 0:be95bfb06686 | 232 | #define SCPIDEFINE_DESCRIPTION_MAX_PARTS 1 |
wuliqunyy | 0:be95bfb06686 | 233 | #define SCPIDEFINE_strndup(h, s, l) NULL |
wuliqunyy | 0:be95bfb06686 | 234 | #define SCPIDEFINE_free(h, s, r) |
wuliqunyy | 0:be95bfb06686 | 235 | #endif |
wuliqunyy | 0:be95bfb06686 | 236 | |
wuliqunyy | 0:be95bfb06686 | 237 | #if HAVE_SIGNBIT |
wuliqunyy | 0:be95bfb06686 | 238 | #define SCPIDEFINE_signbit(n) signbit(n) |
wuliqunyy | 0:be95bfb06686 | 239 | #else |
wuliqunyy | 0:be95bfb06686 | 240 | #define SCPIDEFINE_signbit(n) ((n)<0) |
wuliqunyy | 0:be95bfb06686 | 241 | #endif |
wuliqunyy | 0:be95bfb06686 | 242 | |
wuliqunyy | 0:be95bfb06686 | 243 | #if HAVE_FINITE |
wuliqunyy | 0:be95bfb06686 | 244 | #define SCPIDEFINE_isfinite(n) finite(n) |
wuliqunyy | 0:be95bfb06686 | 245 | #elif HAVE_ISFINITE |
wuliqunyy | 0:be95bfb06686 | 246 | #define SCPIDEFINE_isfinite(n) isfinite(n) |
wuliqunyy | 0:be95bfb06686 | 247 | #else |
wuliqunyy | 0:be95bfb06686 | 248 | #define SCPIDEFINE_isfinite(n) (!SCPIDEFINE_isnan((n)) && ((n) < INFINITY) && ((n) > -INFINITY)) |
wuliqunyy | 0:be95bfb06686 | 249 | #endif |
wuliqunyy | 0:be95bfb06686 | 250 | |
wuliqunyy | 0:be95bfb06686 | 251 | #if HAVE_STRTOF |
wuliqunyy | 0:be95bfb06686 | 252 | #define SCPIDEFINE_strtof(n, p) strtof((n), (p)) |
wuliqunyy | 0:be95bfb06686 | 253 | #else |
wuliqunyy | 0:be95bfb06686 | 254 | #define SCPIDEFINE_strtof(n, p) strtod((n), (p)) |
wuliqunyy | 0:be95bfb06686 | 255 | #endif |
wuliqunyy | 0:be95bfb06686 | 256 | |
wuliqunyy | 0:be95bfb06686 | 257 | #if HAVE_STRTOLL |
wuliqunyy | 0:be95bfb06686 | 258 | #define SCPIDEFINE_strtoll(n, p, b) strtoll((n), (p), (b)) |
wuliqunyy | 0:be95bfb06686 | 259 | #define SCPIDEFINE_strtoull(n, p, b) strtoull((n), (p), (b)) |
wuliqunyy | 0:be95bfb06686 | 260 | #else |
wuliqunyy | 0:be95bfb06686 | 261 | #define SCPIDEFINE_strtoll(n, p, b) strtoll((n), (p), (b)) |
wuliqunyy | 0:be95bfb06686 | 262 | #define SCPIDEFINE_strtoull(n, p, b) strtoull((n), (p), (b)) |
wuliqunyy | 0:be95bfb06686 | 263 | extern long long int strtoll(const char *nptr, char **endptr, int base); |
wuliqunyy | 0:be95bfb06686 | 264 | extern unsigned long long int strtoull(const char *nptr, char **endptr, int base); |
wuliqunyy | 0:be95bfb06686 | 265 | /* TODO: implement OUR_strtoll and OUR_strtoull */ |
wuliqunyy | 0:be95bfb06686 | 266 | /* #warning "64bit string to int conversion not implemented" */ |
wuliqunyy | 0:be95bfb06686 | 267 | #endif |
wuliqunyy | 0:be95bfb06686 | 268 | |
wuliqunyy | 0:be95bfb06686 | 269 | #if HAVE_ISNAN |
wuliqunyy | 0:be95bfb06686 | 270 | #define SCPIDEFINE_isnan(n) isnan((n)) |
wuliqunyy | 0:be95bfb06686 | 271 | #else |
wuliqunyy | 0:be95bfb06686 | 272 | #define SCPIDEFINE_isnan(n) ((n) != (n)) |
wuliqunyy | 0:be95bfb06686 | 273 | #endif |
wuliqunyy | 0:be95bfb06686 | 274 | |
wuliqunyy | 0:be95bfb06686 | 275 | #ifndef NAN |
wuliqunyy | 0:be95bfb06686 | 276 | #define NAN (0.0 / 0.0) |
wuliqunyy | 0:be95bfb06686 | 277 | #endif |
wuliqunyy | 0:be95bfb06686 | 278 | |
wuliqunyy | 0:be95bfb06686 | 279 | #ifndef INFINITY |
wuliqunyy | 0:be95bfb06686 | 280 | #define INFINITY (1.0 / 0.0) |
wuliqunyy | 0:be95bfb06686 | 281 | #endif |
wuliqunyy | 0:be95bfb06686 | 282 | |
wuliqunyy | 0:be95bfb06686 | 283 | #ifdef __cplusplus |
wuliqunyy | 0:be95bfb06686 | 284 | } |
wuliqunyy | 0:be95bfb06686 | 285 | #endif |
wuliqunyy | 0:be95bfb06686 | 286 | |
wuliqunyy | 0:be95bfb06686 | 287 | #endif |
wuliqunyy | 0:be95bfb06686 | 288 |