AMU Library 3.0
C/C++ library for communicating with AMU (Aerospace Measurement Unit) devices
Loading...
Searching...
No Matches
cc.h
Go to the documentation of this file.
1/*-
2 * Copyright (c) 2012-2013 Jan Breuer,
3 *
4 * All Rights Reserved
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are
8 * met:
9 * 1. Redistributions of source code must retain the above copyright notice,
10 * this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 *
15 * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR
16 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18 * DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
19 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
20 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
21 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
22 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
23 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
24 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
25 * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
35
36#ifndef __SCPI_CC_H_
37#define __SCPI_CC_H_
38
40
41#ifdef __cplusplus
42extern "C" {
43#endif
44
45#if defined(__STDC__)
46# define C89 1
47# if defined(__STDC_VERSION__)
48# define C90 1
49# if (__STDC_VERSION__ >= 199409L)
50# define C94 1
51# endif
52# if (__STDC_VERSION__ >= 199901L)
53# define C99 1
54# endif
55# endif
56#endif
57
58#if _POSIX_C_SOURCE >= 200809L || _XOPEN_SOURCE >= 700 || __cplusplus >= 200112L
59 #define HAVE_STRNDUP 1
60 #define HAVE_STRNLEN 1
61#endif
62
63#if _BSD_SOURCE || _XOPEN_SOURCE >= 500 || _ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L || C99
64 #define HAVE_SNPRINTF 1
65#endif
66
67#if _POSIX_C_SOURCE >= 200112L
68 #define HAVE_STRNCASECMP 1
69#endif
70
71#if _BSD_SOURCE || _SVID_SOURCE || _XOPEN_SOURCE || _ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L || C99
72 #define HAVE_ISNAN 1
73#endif
74
75#if _XOPEN_SOURCE >= 600 || _ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L || C99
76 #define HAVE_ISFINITE 1
77 #define HAVE_SIGNBIT 1
78#endif
79
80#if XOPEN_SOURCE >= 600 || _BSD_SOURCE || _SVID_SOURCE || _ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L
81 #define HAVE_STRTOLL 1
82#endif
83
84#if _XOPEN_SOURCE >= 600 || _ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L || C99
85 #define HAVE_STRTOF 1
86#endif
87
88#if _ISOC99_SOURCE || C99
89 #define HAVE_STDBOOL 1
90#endif
91
92/* Compiler specific */
93/* RealView/Keil ARM Compiler, e.g. Cortex-M CPUs */
94#if defined(__CC_ARM)
95#define HAVE_STRNCASECMP 1
96#endif
97
98/* National Instruments (R) CVI x86/x64 PC platform */
99#if defined(_CVI_)
100#define HAVE_STRNICMP 1
101#endif
102
103/* 8bit PIC - PIC16, etc */
104#if defined(_MPC_)
105#define HAVE_STRNICMP 1
106#endif
107
108/* PIC24 */
109#if defined(__C30__)
110#endif
111
112/* PIC32mx */
113#if defined(__C32__)
114#define HAVE_FINITE 1
115#endif
116
117/* AVR libc */
118#if defined(__AVR__)
119#include <stdlib.h>
120#define HAVE_DTOSTRE 1
121#undef HAVE_STRTOF
122#define HAVE_STRTOF 0
123#define HAVE_STDBOOL 1
124#endif
125
126/* Teensy */
127#if defined(TEENSYDUINO)
128#include <stdlib.h>
129#define HAVE_DTOSTRE 0
130#define HAVE_STRTOF 1
131#define HAVE_STDBOOL 1
132#endif
133
134
135/* ARM */
136#if defined(__arm__)
137#include <stdio.h>
138#include <stdlib.h>
139#include <math.h>
140#include <stdbool.h>
141
142#ifndef HAVE_SNPRINTF
143#define HAVE_SNPRINTF 1
144#endif
145
146#ifndef HAVE_STDBOOL
147#define HAVE_STDBOOL 1
148#endif
149
150#ifndef HAVE_ISNAN
151#define HAVE_ISNAN 1
152#endif
153
154#ifndef HAVE_ISFINITE
155#define HAVE_ISFINITE 1
156#endif
157
158#ifndef HAVE_FINITE
159#define HAVE_FINITE 1
160#endif
161
162#ifndef HAVE_SIGNBIT
163#define HAVE_SIGNBIT 1
164#endif
165
166#ifndef HAVE_STRTOF
167#define HAVE_STRTOF 1
168#endif
169
170#ifndef HAVE_STRTOLL
171#define HAVE_STRTOLL 1
172#endif
173
174#endif
175
176#if defined(__SAMD21E18A__)
177#include <stdlib.h>
178#include <stdbool.h>
179#define HAVE_DTOSTRE 0
180#define HAVE_STRTOF 1
181#define HAVE_STDBOOL 1
182#define HAVE_STRNLEN 1
183#endif
184
185#if defined(__ESP32__)
186#include <stdio.h>
187#include <stdlib.h>
188#include <math.h>
189#include <string.h>
190#include <stdbool.h>
191#define HAVE_STRNLEN 1
192#define HAVE_STRDUP 1
193#define HAVE_STDBOOL 1
194#define HAVE_SNPRINTF 1
195#define HAVE_STRNCASECMP 1
196#define HAVE_ISNAN 1
197#define HAVE_ISFINITE 1
198#define HAVE_FINITE 1
199#define HAVE_SIGNBIT 1
200#define HAVE_STRTOF 1
201#define HAVE_STRTOLL 1
202#endif
203
204/* default values */
205#ifndef HAVE_STRNLEN
206#define HAVE_STRNLEN 0
207#endif
208
209#ifndef HAVE_STRDUP
210#define HAVE_STRDUP 0
211#endif
212
213#ifndef HAVE_STRNICMP
214#define HAVE_STRNICMP 0
215#endif
216
217#ifndef HAVE_STDBOOL
218#define HAVE_STDBOOL 0
219#endif
220
221#ifndef HAVE_SNPRINTF
222#define HAVE_SNPRINTF 0
223#endif
224
225#ifndef HAVE_STRNCASECMP
226#define HAVE_STRNCASECMP 0
227#endif
228
229#ifndef HAVE_ISNAN
230#define HAVE_ISNAN 0
231#endif
232
233#ifndef HAVE_ISFINITE
234#define HAVE_ISFINITE 0
235#endif
236
237#ifndef HAVE_FINITE
238#define HAVE_FINITE 0
239#endif
240
241#ifndef HAVE_SIGNBIT
242#define HAVE_SIGNBIT 0
243#endif
244
245#ifndef HAVE_STRTOLL
246#define HAVE_STRTOLL 0
247#endif
248
249#ifndef HAVE_STRTOF
250#define HAVE_STRTOF 0
251#endif
252
253#ifdef __cplusplus
254}
255#endif
256
257#endif /* __SCPI_CC_H_ */