1 /* This is an example of a header file for platforms/compilers that do
2 * not come with stdint.h/stddef.h/stdbool.h/string.h. To use it, define
3 * PB_SYSTEM_HEADER as "pb_syshdr.h", including the quotes, and add the
4 * extra folder to your include path.
6 * It is very likely that you will need to customize this file to suit
7 * your platform. For any compiler that supports C99, this file should
18 /* You will need to modify these to match the word size of your platform. */
19 typedef signed char int8_t;
20 typedef unsigned char uint8_t;
21 typedef signed short int16_t;
22 typedef unsigned short uint16_t;
23 typedef signed int int32_t;
24 typedef unsigned int uint32_t;
25 typedef signed long long int64_t;
26 typedef unsigned long long uint64_t;
28 /* These are ok for most platforms, unless uint8_t is actually not available,
29 * in which case you should give the smallest available type. */
30 typedef int8_t int_least8_t;
31 typedef uint8_t uint_least8_t;
32 typedef uint8_t uint_fast8_t;
33 typedef int16_t int_least16_t;
34 typedef uint16_t uint_least16_t;
42 typedef uint32_t size_t;
43 #define offsetof(st, m) ((size_t)(&((st *)0)->m))
51 /* stdbool.h subset */
65 #ifdef PB_ENABLE_MALLOC
69 void *realloc(void *ptr, size_t size);
79 /* Implementations are from the Public Domain C Library (PDCLib). */
80 static size_t strlen( const char * s )
90 static void * memcpy( void *s1, const void *s2, size_t n )
92 char * dest = (char *) s1;
93 const char * src = (const char *) s2;
101 static void * memset( void * s, int c, size_t n )
103 unsigned char * p = (unsigned char *) s;
106 *p++ = (unsigned char) c;