summaryrefslogtreecommitdiffstats
path: root/compat/pb_syshdr.h
diff options
context:
space:
mode:
Diffstat (limited to 'compat/pb_syshdr.h')
-rw-r--r--compat/pb_syshdr.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/compat/pb_syshdr.h b/compat/pb_syshdr.h
index c170c8de..b69a1671 100644
--- a/compat/pb_syshdr.h
+++ b/compat/pb_syshdr.h
@@ -12,6 +12,9 @@
#define _PB_SYSHDR_H_
/* stdint.h subset */
+#ifdef HAVE_STDINT_H
+#include <stdint.h>
+#else
/* You will need to modify these to match the word size of your platform. */
typedef signed char int8_t;
typedef unsigned char uint8_t;
@@ -21,8 +24,13 @@ typedef signed int int32_t;
typedef unsigned int uint32_t;
typedef signed long long int64_t;
typedef unsigned long long uint64_t;
+#endif
/* stddef.h subset */
+#ifdef HAVE_STDDEF_H
+#include <stddef.h>
+#else
+
typedef uint32_t size_t;
#define offsetof(st, m) ((size_t)(&((st *)0)->m))
@@ -30,12 +38,26 @@ typedef uint32_t size_t;
#define NULL 0
#endif
+#endif
+
/* stdbool.h subset */
+#ifdef HAVE_STDBOOL_H
+#include <stdbool.h>
+#else
+
+#ifndef __cplusplus
typedef int bool;
#define false 0
#define true 1
+#endif
+
+#endif
/* string.h subset */
+#ifdef HAVE_STRING_H
+#include <string.h>
+#else
+
/* Implementations are from the Public Domain C Library (PDCLib). */
static size_t strlen( const char * s )
{
@@ -67,5 +89,6 @@ static void * memset( void * s, int c, size_t n )
}
return s;
}
+#endif
#endif