1 /* Copyright (C) 2011 Circuits At Home, LTD. All rights reserved.
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
14 Web : http://www.circuitsathome.com
15 e-mail : support@circuitsathome.com
19 * Universal Arduino(tm) "IDE" fixups.
20 * Includes fixes for versions as low as 0023, used by Digilent.
23 #if defined(ARDUINO) && ARDUINO >=100
27 #include <pins_arduino.h>
29 #include <avr/pgmspace.h>
36 #define __PGMSPACE_H_ 1
44 #define PGM_P const char *
47 #define PSTR(str) (str)
53 #define _SFR_BYTE(n) (n)
57 #define memchr_P(str, c, len) memchr((str), (c), (len))
60 #define memcmp_P(a, b, n) memcmp((a), (b), (n))
63 #define memcpy_P(dest, src, num) memcpy((dest), (src), (num))
66 #define memmem_P(a, alen, b, blen) memmem((a), (alen), (b), (blen))
69 #define memrchr_P(str, val, len) memrchr((str), (val), (len))
72 #define strcat_P(dest, src) strcat((dest), (src))
75 #define strchr_P(str, c) strchr((str), (c))
78 #define strchrnul_P(str, c) strchrnul((str), (c))
81 #define strcmp_P(a, b) strcmp((a), (b))
84 #define strcpy_P(dest, src) strcpy((dest), (src))
87 #define strcasecmp_P(a, b) strcasecmp((a), (b))
90 #define strcasestr_P(a, b) strcasestr((a), (b))
93 #define strlcat_P(dest, src, len) strlcat((dest), (src), (len))
96 #define strlcpy_P(dest, src, len) strlcpy((dest), (src), (len))
99 #define strlen_P(s) strlen((const char *)(s))
102 #define strnlen_P(str, len) strnlen((str), (len))
105 #define strncmp_P(a, b, n) strncmp((a), (b), (n))
107 #ifndef strncasecmp_P
108 #define strncasecmp_P(a, b, n) strncasecmp((a), (b), (n))
111 #define strncat_P(a, b, n) strncat((a), (b), (n))
114 #define strncpy_P(a, b, n) strncmp((a), (b), (n))
117 #define strpbrk_P(str, chrs) strpbrk((str), (chrs))
120 #define strrchr_P(str, c) strrchr((str), (c))
123 #define strsep_P(strp, delim) strsep((strp), (delim))
126 #define strspn_P(str, chrs) strspn((str), (chrs))
129 #define strstr_P(a, b) strstr((a), (b))
132 #define sprintf_P(s, ...) sprintf((s), __VA_ARGS__)
135 #define vfprintf_P(s, ...) vfprintf((s), __VA_ARGS__)
138 #define printf_P(...) printf(__VA_ARGS__)
141 #define snprintf_P(s, n, ...) ((s), (n), __VA_ARGS__)
144 #define vsprintf_P(s, ...) ((s),__VA_ARGS__)
147 #define vsnprintf_P(s, n, ...) ((s), (n),__VA_ARGS__)
150 #define fprintf_P(s, ...) ((s), __VA_ARGS__)
153 #ifndef pgm_read_byte
154 #define pgm_read_byte(addr) (*(const unsigned char *)(addr))
156 #ifndef pgm_read_word
157 #define pgm_read_word(addr) (*(const unsigned short *)(addr))
159 #ifndef pgm_read_dword
160 #define pgm_read_dword(addr) (*(const unsigned long *)(addr))
162 #ifndef pgm_read_float
163 #define pgm_read_float(addr) (*(const float *)(addr))
166 #ifndef pgm_read_byte_near
167 #define pgm_read_byte_near(addr) pgm_read_byte(addr)
169 #ifndef pgm_read_word_near
170 #define pgm_read_word_near(addr) pgm_read_word(addr)
172 #ifndef pgm_read_dword_near
173 #define pgm_read_dword_near(addr) pgm_read_dword(addr)
175 #ifndef pgm_read_float_near
176 #define pgm_read_float_near(addr) pgm_read_float(addr)
178 #ifndef pgm_read_byte_far
179 #define pgm_read_byte_far(addr) pgm_read_byte(addr)
181 #ifndef pgm_read_word_far
182 #define pgm_read_word_far(addr) pgm_read_word(addr)
184 #ifndef pgm_read_dword_far
185 #define pgm_read_dword_far(addr) pgm_read_dword(addr)
187 #ifndef pgm_read_float_far
188 #define pgm_read_float_far(addr) pgm_read_float(addr)
191 #ifndef pgm_read_pointer
192 #define pgm_read_pointer