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 program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License as published by
5 the Free Software Foundation; either version 2 of the License, or
6 (at your option) any later version.
7 
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
12 
13 You should have received a copy of the GNU General Public License
14 along with this program; if not, write to the Free Software
15 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 
17 Contact information
18 -------------------
19 
20 Circuits At Home, LTD
21 Web : http://www.circuitsathome.com
22 e-mail : support@circuitsathome.com
23  */
24 
25 /*
26  * Universal Arduino(tm) "IDE" fixups.
27  * Includes fixes for versions as low as 0023, used by Digilent.
28  */
29 
30 #if defined(ARDUINO) && ARDUINO >=100
31 #include <Arduino.h>
32 #else
33 #include <WProgram.h>
34 #include <pins_arduino.h>
35 #ifdef __AVR__
36 #include <avr/pgmspace.h>
37 #include <avr/io.h>
38 #else
39 #endif
40 #endif
41 
42 #ifndef __PGMSPACE_H_
43 #define __PGMSPACE_H_ 1
44 
45 #include <inttypes.h>
46 
47 #ifndef PROGMEM
48 #define PROGMEM
49 #endif
50 #ifndef PGM_P
51 #define PGM_P const char *
52 #endif
53 #ifndef PSTR
54 #define PSTR(str) (str)
55 #endif
56 #ifndef F
57 #define F(str) (str)
58 #endif
59 #ifndef _SFR_BYTE
60 #define _SFR_BYTE(n) (n)
61 #endif
62 
63 #ifndef memchr_P
64 #define memchr_P(str, c, len) memchr((str), (c), (len))
65 #endif
66 #ifndef memcmp_P
67 #define memcmp_P(a, b, n) memcmp((a), (b), (n))
68 #endif
69 #ifndef memcpy_P
70 #define memcpy_P(dest, src, num) memcpy((dest), (src), (num))
71 #endif
72 #ifndef memmem_P
73 #define memmem_P(a, alen, b, blen) memmem((a), (alen), (b), (blen))
74 #endif
75 #ifndef memrchr_P
76 #define memrchr_P(str, val, len) memrchr((str), (val), (len))
77 #endif
78 #ifndef strcat_P
79 #define strcat_P(dest, src) strcat((dest), (src))
80 #endif
81 #ifndef strchr_P
82 #define strchr_P(str, c) strchr((str), (c))
83 #endif
84 #ifndef strchrnul_P
85 #define strchrnul_P(str, c) strchrnul((str), (c))
86 #endif
87 #ifndef strcmp_P
88 #define strcmp_P(a, b) strcmp((a), (b))
89 #endif
90 #ifndef strcpy_P
91 #define strcpy_P(dest, src) strcpy((dest), (src))
92 #endif
93 #ifndef strcasecmp_P
94 #define strcasecmp_P(a, b) strcasecmp((a), (b))
95 #endif
96 #ifndef strcasestr_P
97 #define strcasestr_P(a, b) strcasestr((a), (b))
98 #endif
99 #ifndef strlcat_P
100 #define strlcat_P(dest, src, len) strlcat((dest), (src), (len))
101 #endif
102 #ifndef strlcpy_P
103 #define strlcpy_P(dest, src, len) strlcpy((dest), (src), (len))
104 #endif
105 #ifndef strlen_P
106 #define strlen_P(s) strlen((const char *)(s))
107 #endif
108 #ifndef strnlen_P
109 #define strnlen_P(str, len) strnlen((str), (len))
110 #endif
111 #ifndef strncmp_P
112 #define strncmp_P(a, b, n) strncmp((a), (b), (n))
113 #endif
114 #ifndef strncasecmp_P
115 #define strncasecmp_P(a, b, n) strncasecmp((a), (b), (n))
116 #endif
117 #ifndef strncat_P
118 #define strncat_P(a, b, n) strncat((a), (b), (n))
119 #endif
120 #ifndef strncpy_P
121 #define strncpy_P(a, b, n) strncpy((a), (b), (n))
122 #endif
123 #ifndef strpbrk_P
124 #define strpbrk_P(str, chrs) strpbrk((str), (chrs))
125 #endif
126 #ifndef strrchr_P
127 #define strrchr_P(str, c) strrchr((str), (c))
128 #endif
129 #ifndef strsep_P
130 #define strsep_P(strp, delim) strsep((strp), (delim))
131 #endif
132 #ifndef strspn_P
133 #define strspn_P(str, chrs) strspn((str), (chrs))
134 #endif
135 #ifndef strstr_P
136 #define strstr_P(a, b) strstr((a), (b))
137 #endif
138 #ifndef sprintf_P
139 #define sprintf_P(s, ...) sprintf((s), __VA_ARGS__)
140 #endif
141 #ifndef vfprintf_P
142 #define vfprintf_P(s, ...) vfprintf((s), __VA_ARGS__)
143 #endif
144 #ifndef printf_P
145 #define printf_P(...) printf(__VA_ARGS__)
146 #endif
147 #ifndef snprintf_P
148 #define snprintf_P(s, n, ...) ((s), (n), __VA_ARGS__)
149 #endif
150 #ifndef vsprintf_P
151 #define vsprintf_P(s, ...) ((s),__VA_ARGS__)
152 #endif
153 #ifndef vsnprintf_P
154 #define vsnprintf_P(s, n, ...) ((s), (n),__VA_ARGS__)
155 #endif
156 #ifndef fprintf_P
157 #define fprintf_P(s, ...) ((s), __VA_ARGS__)
158 #endif
159 
160 #ifndef pgm_read_byte
161 #define pgm_read_byte(addr) (*(const unsigned char *)(addr))
162 #endif
163 #ifndef pgm_read_word
164 #define pgm_read_word(addr) (*(const unsigned short *)(addr))
165 #endif
166 #ifndef pgm_read_dword
167 #define pgm_read_dword(addr) (*(const unsigned long *)(addr))
168 #endif
169 #ifndef pgm_read_float
170 #define pgm_read_float(addr) (*(const float *)(addr))
171 #endif
172 
173 #ifndef pgm_read_byte_near
174 #define pgm_read_byte_near(addr) pgm_read_byte(addr)
175 #endif
176 #ifndef pgm_read_word_near
177 #define pgm_read_word_near(addr) pgm_read_word(addr)
178 #endif
179 #ifndef pgm_read_dword_near
180 #define pgm_read_dword_near(addr) pgm_read_dword(addr)
181 #endif
182 #ifndef pgm_read_float_near
183 #define pgm_read_float_near(addr) pgm_read_float(addr)
184 #endif
185 #ifndef pgm_read_byte_far
186 #define pgm_read_byte_far(addr) pgm_read_byte(addr)
187 #endif
188 #ifndef pgm_read_word_far
189 #define pgm_read_word_far(addr) pgm_read_word(addr)
190 #endif
191 #ifndef pgm_read_dword_far
192 #define pgm_read_dword_far(addr) pgm_read_dword(addr)
193 #endif
194 #ifndef pgm_read_float_far
195 #define pgm_read_float_far(addr) pgm_read_float(addr)
196 #endif
197 
198 #ifndef pgm_read_pointer
199 #define pgm_read_pointer
200 #endif
201 #endif