d6dadb8d28f244c3f0a444f215fdc2aab9c76f68
[aversive.git] / include / aversive / pgmspace.h
1 /*  
2  *  Copyright Droids Corporation, Microb Technology, Eirbot (2005)
3  * 
4  *  This program is free software; you can redistribute it and/or modify
5  *  it under the terms of the GNU General Public License as published by
6  *  the Free Software Foundation; either version 2 of the License, or
7  *  (at your option) any later version.
8  *
9  *  This program is distributed in the hope that it will be useful,
10  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  *  GNU General Public License for more details.
13  *
14  *  You should have received a copy of the GNU General Public License
15  *  along with this program; if not, write to the Free Software
16  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
17  *
18  *  Revision : $Id: pgmspace.h,v 1.1.2.4 2007-11-21 21:54:38 zer0 Exp $
19  *
20  */
21
22 /**
23  * This file is used for compatibility between host and avr : with
24  * this we can emulate pgmspace on a host.
25  */
26
27 #ifndef _AVERSIVE_PGMSPACE_H_
28 #define _AVERSIVE_PGMSPACE_H_
29
30 #ifndef HOST_VERSION
31
32 #include <avr/pgmspace.h>
33
34
35 #else
36
37 #include <stdint.h>
38
39 #define printf_P printf
40 #define memcmp_P memcmp
41 #define strcat_P strcat
42 #define strcmp_P strcmp
43 #define strncmp_P strncmp
44 #define strlen_P strlen
45 #define vfprintf_P vfprintf
46 #define vsprintf_P vsprintf
47 #define PGM_P const char *
48 #define PSTR(x) x
49 #define PROGMEM
50
51 /* XXX don't define it, it's dangerous because it can be used to read
52  * an address that have not the same size */
53 /* #define pgm_read_word(x) (*(x)) */
54 /* #define pgm_read_byte(x) (*(x)) */
55
56 typedef void prog_void;
57 typedef char prog_char;
58 typedef unsigned char prog_uchar;
59 typedef int8_t prog_int8_t;
60 typedef uint8_t prog_uint8_t;
61 typedef int16_t prog_int16_t;
62 typedef uint16_t prog_uint16_t;
63 typedef int32_t prog_int32_t;
64 typedef uint32_t prog_uint32_t;
65 typedef int64_t prog_int64_t;
66
67 #endif /* HOST_VERSION */
68 #endif /* _AVERSIVE_PGMSPACE_H_ */
69
70