USB Host Shield 2.0
version_helper.h
Go to the documentation of this file.
1 /* Copyright (C) 2011 Circuits At Home, LTD. All rights reserved.
2 
3 This software may be distributed and modified under the terms of the GNU
4 General Public License version 2 (GPL2) as published by the Free Software
5 Foundation and appearing in the file GPL2.TXT included in the packaging of
6 this file. Please note that GPL2 Section 2[b] requires that all works based
7 on this software must also be made publicly available under the terms of
8 the GPL2 ("Copyleft").
9 
10 Contact information
11 -------------------
12 
13 Circuits At Home, LTD
14 Web : http://www.circuitsathome.com
15 e-mail : support@circuitsathome.com
16  */
17 
18 /*
19  * Universal Arduino(tm) "IDE" fixups.
20  * Includes fixes for versions as low as 0023, used by Digilent.
21  */
22 
23 #if defined(ARDUINO) && ARDUINO >=100
24 #include <Arduino.h>
25 #else
26 #include <WProgram.h>
27 #include <pins_arduino.h>
28 #ifdef __AVR__
29 #include <avr/pgmspace.h>
30 #include <avr/io.h>
31 #else
32 #endif
33 #endif
34 
35 #ifndef __PGMSPACE_H_
36 #define __PGMSPACE_H_ 1
37 
38 #include <inttypes.h>
39 
40 #ifndef PROGMEM
41 #define PROGMEM
42 #endif
43 #ifndef PGM_P
44 #define PGM_P const char *
45 #endif
46 #ifndef PSTR
47 #define PSTR(str) (str)
48 #endif
49 #ifndef F
50 #define F(str) (str)
51 #endif
52 #ifndef _SFR_BYTE
53 #define _SFR_BYTE(n) (n)
54 #endif
55 
56 #ifndef memchr_P
57 #define memchr_P(str, c, len) memchr((str), (c), (len))
58 #endif
59 #ifndef memcmp_P
60 #define memcmp_P(a, b, n) memcmp((a), (b), (n))
61 #endif
62 #ifndef memcpy_P
63 #define memcpy_P(dest, src, num) memcpy((dest), (src), (num))
64 #endif
65 #ifndef memmem_P
66 #define memmem_P(a, alen, b, blen) memmem((a), (alen), (b), (blen))
67 #endif
68 #ifndef memrchr_P
69 #define memrchr_P(str, val, len) memrchr((str), (val), (len))
70 #endif
71 #ifndef strcat_P
72 #define strcat_P(dest, src) strcat((dest), (src))
73 #endif
74 #ifndef strchr_P
75 #define strchr_P(str, c) strchr((str), (c))
76 #endif
77 #ifndef strchrnul_P
78 #define strchrnul_P(str, c) strchrnul((str), (c))
79 #endif
80 #ifndef strcmp_P
81 #define strcmp_P(a, b) strcmp((a), (b))
82 #endif
83 #ifndef strcpy_P
84 #define strcpy_P(dest, src) strcpy((dest), (src))
85 #endif
86 #ifndef strcasecmp_P
87 #define strcasecmp_P(a, b) strcasecmp((a), (b))
88 #endif
89 #ifndef strcasestr_P
90 #define strcasestr_P(a, b) strcasestr((a), (b))
91 #endif
92 #ifndef strlcat_P
93 #define strlcat_P(dest, src, len) strlcat((dest), (src), (len))
94 #endif
95 #ifndef strlcpy_P
96 #define strlcpy_P(dest, src, len) strlcpy((dest), (src), (len))
97 #endif
98 #ifndef strlen_P
99 #define strlen_P(s) strlen((const char *)(s))
100 #endif
101 #ifndef strnlen_P
102 #define strnlen_P(str, len) strnlen((str), (len))
103 #endif
104 #ifndef strncmp_P
105 #define strncmp_P(a, b, n) strncmp((a), (b), (n))
106 #endif
107 #ifndef strncasecmp_P
108 #define strncasecmp_P(a, b, n) strncasecmp((a), (b), (n))
109 #endif
110 #ifndef strncat_P
111 #define strncat_P(a, b, n) strncat((a), (b), (n))
112 #endif
113 #ifndef strncpy_P
114 #define strncpy_P(a, b, n) strncmp((a), (b), (n))
115 #endif
116 #ifndef strpbrk_P
117 #define strpbrk_P(str, chrs) strpbrk((str), (chrs))
118 #endif
119 #ifndef strrchr_P
120 #define strrchr_P(str, c) strrchr((str), (c))
121 #endif
122 #ifndef strsep_P
123 #define strsep_P(strp, delim) strsep((strp), (delim))
124 #endif
125 #ifndef strspn_P
126 #define strspn_P(str, chrs) strspn((str), (chrs))
127 #endif
128 #ifndef strstr_P
129 #define strstr_P(a, b) strstr((a), (b))
130 #endif
131 #ifndef sprintf_P
132 #define sprintf_P(s, ...) sprintf((s), __VA_ARGS__)
133 #endif
134 #ifndef vfprintf_P
135 #define vfprintf_P(s, ...) vfprintf((s), __VA_ARGS__)
136 #endif
137 #ifndef printf_P
138 #define printf_P(...) printf(__VA_ARGS__)
139 #endif
140 #ifndef snprintf_P
141 #define snprintf_P(s, n, ...) ((s), (n), __VA_ARGS__)
142 #endif
143 #ifndef vsprintf_P
144 #define vsprintf_P(s, ...) ((s),__VA_ARGS__)
145 #endif
146 #ifndef vsnprintf_P
147 #define vsnprintf_P(s, n, ...) ((s), (n),__VA_ARGS__)
148 #endif
149 #ifndef fprintf_P
150 #define fprintf_P(s, ...) ((s), __VA_ARGS__)
151 #endif
152 
153 #ifndef pgm_read_byte
154 #define pgm_read_byte(addr) (*(const unsigned char *)(addr))
155 #endif
156 #ifndef pgm_read_word
157 #define pgm_read_word(addr) (*(const unsigned short *)(addr))
158 #endif
159 #ifndef pgm_read_dword
160 #define pgm_read_dword(addr) (*(const unsigned long *)(addr))
161 #endif
162 #ifndef pgm_read_float
163 #define pgm_read_float(addr) (*(const float *)(addr))
164 #endif
165 
166 #ifndef pgm_read_byte_near
167 #define pgm_read_byte_near(addr) pgm_read_byte(addr)
168 #endif
169 #ifndef pgm_read_word_near
170 #define pgm_read_word_near(addr) pgm_read_word(addr)
171 #endif
172 #ifndef pgm_read_dword_near
173 #define pgm_read_dword_near(addr) pgm_read_dword(addr)
174 #endif
175 #ifndef pgm_read_float_near
176 #define pgm_read_float_near(addr) pgm_read_float(addr)
177 #endif
178 #ifndef pgm_read_byte_far
179 #define pgm_read_byte_far(addr) pgm_read_byte(addr)
180 #endif
181 #ifndef pgm_read_word_far
182 #define pgm_read_word_far(addr) pgm_read_word(addr)
183 #endif
184 #ifndef pgm_read_dword_far
185 #define pgm_read_dword_far(addr) pgm_read_dword(addr)
186 #endif
187 #ifndef pgm_read_float_far
188 #define pgm_read_float_far(addr) pgm_read_float(addr)
189 #endif
190 
191 #ifndef pgm_read_pointer
192 #define pgm_read_pointer
193 #endif
194 #endif