summaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/psxtypes/__nttypes.h34
-rw-r--r--include/psxtypes/__psxtypes.h10
-rw-r--r--include/psxtypes/arch/nt32/ntalltypes.h178
-rw-r--r--include/psxtypes/arch/nt32/ntneedall.h52
-rw-r--r--include/psxtypes/arch/nt64/ntalltypes.h178
-rw-r--r--include/psxtypes/arch/nt64/ntneedall.h52
-rw-r--r--include/psxtypes/compiler/__nt_compiler_clang.h108
-rw-r--r--include/psxtypes/compiler/__nt_compiler_gcc.h129
-rw-r--r--include/psxtypes/compiler/__nt_compiler_msvc.h109
-rw-r--r--include/psxtypes/compiler/__psx_compiler_gcc.h93
-rw-r--r--include/psxtypes/psxtypes.h84
11 files changed, 1027 insertions, 0 deletions
diff --git a/include/psxtypes/__nttypes.h b/include/psxtypes/__nttypes.h
new file mode 100644
index 0000000..852fa1e
--- /dev/null
+++ b/include/psxtypes/__nttypes.h
@@ -0,0 +1,34 @@
+/* verify matching compiler */
+#if defined(__NT32)
+
+typedef char __sanity[sizeof(int) - sizeof(void *) + 1];
+
+#elif defined(__NT64)
+
+#ifndef _NT64_SANITY_CHECKED
+#define _NT64_SANITY_CHECKED
+
+struct __sanity_struct {int i; void * p;};
+typedef char __sanity[sizeof(struct __sanity_struct) - 2*sizeof(long long) + 1];
+
+#endif
+
+#endif
+
+
+/*compiler directives: unified syntax */
+#if defined(__GNUC__)
+#include "compiler/__nt_compiler_gcc.h"
+#elif defined (_MSC_VER)
+#include "compiler/__nt_compiler_msvc.h"
+#endif
+
+
+/* portable types in a free-standing NT environment */
+#ifndef __ASSEMBLER__
+#if defined(__NT32)
+#include "arch/nt32/ntalltypes.h"
+#elif defined(__NT64)
+#include "arch/nt64/ntalltypes.h"
+#endif
+#endif
diff --git a/include/psxtypes/__psxtypes.h b/include/psxtypes/__psxtypes.h
new file mode 100644
index 0000000..14ae8ca
--- /dev/null
+++ b/include/psxtypes/__psxtypes.h
@@ -0,0 +1,10 @@
+/* basic integer/pointer types and constant definitions */
+#include <stdint.h>
+#include <stddef.h>
+#include <errno.h>
+
+
+/* compiler directives: unified syntax */
+#if defined(__GNUC__)
+#include "compiler/__psx_compiler_gcc.h"
+#endif
diff --git a/include/psxtypes/arch/nt32/ntalltypes.h b/include/psxtypes/arch/nt32/ntalltypes.h
new file mode 100644
index 0000000..5e61552
--- /dev/null
+++ b/include/psxtypes/arch/nt32/ntalltypes.h
@@ -0,0 +1,178 @@
+#ifndef MIDIPIX_EXTERNAL_TYPES
+#include "ntneedall.h"
+#endif
+
+#define __NT_MAX_USERSPACE_ADDRESS 0x7FFEFFFFul
+
+#if !defined(__NEED_wchar16_t)
+#define __NEED_wchar16_t
+#endif
+
+#if !defined(__NEED_wchar32_t)
+#define __NEED_wchar32_t
+#endif
+
+
+#if defined(__NEED_wchar16_t) && !defined(__DEFINED_wchar16_t)
+typedef unsigned short wchar16_t;
+#define __DEFINED_wchar16_t
+#endif
+
+
+#if defined(__NEED_wchar32_t) && !defined(__DEFINED_wchar32_t)
+typedef int wchar32_t;
+#define __DEFINED_wchar32_t
+#endif
+
+
+#if defined(__NEED_size_t) && !defined(__DEFINED_size_t)
+typedef unsigned long size_t;
+#define __DEFINED_size_t
+#endif
+
+#if defined(__NEED_ssize_t) && !defined(__DEFINED_ssize_t)
+typedef signed long ssize_t;
+#define __DEFINED_ssize_t
+#endif
+
+#if defined(__NEED_ptrdiff_t) && !defined(__DEFINED_ptrdiff_t)
+typedef signed long ptrdiff_t;
+#define __DEFINED_ptrdiff_t
+#endif
+
+#if defined(__NEED_off_t) && !defined(__DEFINED_off_t)
+typedef signed long long off_t;
+#define __DEFINED_off_t
+#endif
+
+#if defined(__NEED_int8_t) && !defined(__DEFINED_int8_t)
+typedef signed char int8_t;
+#define __DEFINED_int8_t
+#endif
+
+#if defined(__NEED_int16_t) && !defined(__DEFINED_int16_t)
+typedef short int16_t;
+#define __DEFINED_int16_t
+#endif
+
+#if defined(__NEED_int32_t) && !defined(__DEFINED_int32_t)
+typedef int int32_t;
+#define __DEFINED_int32_t
+#endif
+
+#if defined(__NEED_int64_t) && !defined(__DEFINED_int64_t)
+typedef long long int64_t;
+#define __DEFINED_int64_t
+#endif
+
+
+#if defined(__NEED_uint8_t) && !defined(__DEFINED_uint8_t)
+typedef unsigned char uint8_t;
+#define __DEFINED_uint8_t
+#endif
+
+#if defined(__NEED_uint16_t) && !defined(__DEFINED_uint16_t)
+typedef unsigned short uint16_t;
+#define __DEFINED_uint16_t
+#endif
+
+#if defined(__NEED_uint32_t) && !defined(__DEFINED_uint32_t)
+typedef unsigned long uint32_t;
+#define __DEFINED_uint32_t
+#endif
+
+#if defined(__NEED_uint64_t) && !defined(__DEFINED_uint64_t)
+typedef unsigned long long uint64_t;
+#define __DEFINED_uint64_t
+#endif
+
+
+#if defined(__NEED___uint16_t) && !defined(__DEFINED___uint16_t)
+typedef unsigned short __uint16_t;
+#define __DEFINED___uint16_t
+#endif
+
+#if defined(__NEED___uint32_t) && !defined(__DEFINED___uint32_t)
+typedef unsigned long __uint32_t;
+#define __DEFINED___uint32_t
+#endif
+
+#if defined(__NEED___uint64_t) && !defined(__DEFINED___uint64_t)
+typedef unsigned long long __uint64_t;
+#define __DEFINED___uint64_t
+#endif
+
+
+#if defined(__NEED_int_fast8_t) && !defined(__DEFINED_int_fast8_t)
+typedef int8_t int_fast8_t;
+#define __DEFINED_int_fast8_t
+#endif
+
+#if defined(__NEED_int_fast16_t) && !defined(__DEFINED_int_fast16_t)
+typedef int int_fast16_t;
+#define __DEFINED_int_fast16_t
+#endif
+
+#if defined(__NEED_int_fast32_t) && !defined(__DEFINED_int_fast32_t)
+typedef long int_fast32_t;
+#define __DEFINED_int_fast32_t
+#endif
+
+#if defined(__NEED_int_fast64_t) && !defined(__DEFINED_int_fast64_t)
+typedef int64_t int_fast64_t;
+#define __DEFINED_int_fast64_t
+#endif
+
+
+#if defined(__NEED_uint_fast8_t) && !defined(__DEFINED_uint_fast8_t)
+typedef unsigned char uint_fast8_t;
+#define __DEFINED_uint_fast8_t
+#endif
+
+#if defined(__NEED_uint_fast16_t) && !defined(__DEFINED_uint_fast16_t)
+typedef unsigned int uint_fast16_t;
+#define __DEFINED_uint_fast16_t
+#endif
+
+#if defined(__NEED_uint_fast32_t) && !defined(__DEFINED_uint_fast32_t)
+typedef unsigned long uint_fast32_t;
+#define __DEFINED_uint_fast32_t
+#endif
+
+#if defined(__NEED_uint_fast64_t) && !defined(__DEFINED_uint_fast64_t)
+typedef uint64_t uint_fast64_t;
+#define __DEFINED_uint_fast64_t
+#endif
+
+
+#if defined(__NEED_intptr_t) && !defined(__DEFINED_intptr_t)
+typedef long intptr_t;
+#define __DEFINED_intptr_t
+#endif
+
+#if defined(__NEED_uintptr_t) && !defined(__DEFINED_uintptr_t)
+typedef unsigned long uintptr_t;
+#define __DEFINED_uintptr_t
+#endif
+
+
+#if defined(__NEED_intmax_t) && !defined(__DEFINED_intmax_t)
+typedef long long intmax_t;
+#define __DEFINED_intmax_t
+#endif
+
+#if defined(__NEED_uintmax_t) && !defined(__DEFINED_uintmax_t)
+typedef unsigned long long uintmax_t;
+#define __DEFINED_uintmax_t
+#endif
+
+
+#if defined(__NEED_float_t) && !defined(__DEFINED_float_t)
+typedef float float_t;
+#define __DEFINED_float_t
+#endif
+
+#if defined(__NEED_double_t) && !defined(__DEFINED_double_t)
+typedef double double_t;
+#define __DEFINED_double_t
+#endif
diff --git a/include/psxtypes/arch/nt32/ntneedall.h b/include/psxtypes/arch/nt32/ntneedall.h
new file mode 100644
index 0000000..f676204
--- /dev/null
+++ b/include/psxtypes/arch/nt32/ntneedall.h
@@ -0,0 +1,52 @@
+#ifndef _NTNEEDALL_H_
+#define _NTNEEDALL_H_
+
+#ifndef __ASSEMBLER__
+
+#define __NEED_wchar16_t
+#define __NEED_wchar32_t
+
+#define __NEED_size_t
+#define __NEED_ssize_t
+#define __NEED_ptrdiff_t
+#define __NEED_off_t
+
+#define __NEED_wint_t
+#define __NEED_wctrans_t
+#define __NEED_wctype_t
+
+#define __NEED_int8_t
+#define __NEED_int16_t
+#define __NEED_int32_t
+#define __NEED_int64_t
+
+#define __NEED_uint8_t
+#define __NEED_uint16_t
+#define __NEED_uint32_t
+#define __NEED_uint64_t
+
+#define __NEED___uint16_t
+#define __NEED___uint32_t
+#define __NEED___uint64_t
+
+#define __NEED_int_fast8_t
+#define __NEED_int_fast16_t
+#define __NEED_int_fast32_t
+#define __NEED_int_fast64_t
+
+#define __NEED_uint_fast8_t
+#define __NEED_uint_fast16_t
+#define __NEED_uint_fast32_t
+#define __NEED_uint_fast64_t
+
+#define __NEED_intptr_t
+#define __NEED_uintptr_t
+
+#define __NEED_intmax_t
+#define __NEED_uintmax_t
+
+#define __NEED_float_t
+#define __NEED_double_t
+
+#endif /* __ASSEMBLER__ */
+#endif /* _NTNEEDALL_H_ */
diff --git a/include/psxtypes/arch/nt64/ntalltypes.h b/include/psxtypes/arch/nt64/ntalltypes.h
new file mode 100644
index 0000000..d6640f8
--- /dev/null
+++ b/include/psxtypes/arch/nt64/ntalltypes.h
@@ -0,0 +1,178 @@
+#ifndef MIDIPIX_EXTERNAL_TYPES
+#include "ntneedall.h"
+#endif
+
+#define __NT_MAX_USERSPACE_ADDRESS 0x000007FFFFFEFFFFull
+
+#if !defined(__NEED_wchar16_t)
+#define __NEED_wchar16_t
+#endif
+
+#if !defined(__NEED_wchar32_t)
+#define __NEED_wchar32_t
+#endif
+
+
+#if defined(__NEED_wchar16_t) && !defined(__DEFINED_wchar16_t)
+typedef unsigned short wchar16_t;
+#define __DEFINED_wchar16_t
+#endif
+
+
+#if defined(__NEED_wchar32_t) && !defined(__DEFINED_wchar32_t)
+typedef int wchar32_t;
+#define __DEFINED_wchar32_t
+#endif
+
+
+#if defined(__NEED_size_t) && !defined(__DEFINED_size_t)
+typedef unsigned long long size_t;
+#define __DEFINED_size_t
+#endif
+
+#if defined(__NEED_ssize_t) && !defined(__DEFINED_ssize_t)
+typedef signed long long ssize_t;
+#define __DEFINED_ssize_t
+#endif
+
+#if defined(__NEED_ptrdiff_t) && !defined(__DEFINED_ptrdiff_t)
+typedef signed long long ptrdiff_t;
+#define __DEFINED_ptrdiff_t
+#endif
+
+#if defined(__NEED_off_t) && !defined(__DEFINED_off_t)
+typedef signed long long off_t;
+#define __DEFINED_off_t
+#endif
+
+#if defined(__NEED_int8_t) && !defined(__DEFINED_int8_t)
+typedef signed char int8_t;
+#define __DEFINED_int8_t
+#endif
+
+#if defined(__NEED_int16_t) && !defined(__DEFINED_int16_t)
+typedef short int16_t;
+#define __DEFINED_int16_t
+#endif
+
+#if defined(__NEED_int32_t) && !defined(__DEFINED_int32_t)
+typedef int int32_t;
+#define __DEFINED_int32_t
+#endif
+
+#if defined(__NEED_int64_t) && !defined(__DEFINED_int64_t)
+typedef long long int64_t;
+#define __DEFINED_int64_t
+#endif
+
+
+#if defined(__NEED_uint8_t) && !defined(__DEFINED_uint8_t)
+typedef unsigned char uint8_t;
+#define __DEFINED_uint8_t
+#endif
+
+#if defined(__NEED_uint16_t) && !defined(__DEFINED_uint16_t)
+typedef unsigned short uint16_t;
+#define __DEFINED_uint16_t
+#endif
+
+#if defined(__NEED_uint32_t) && !defined(__DEFINED_uint32_t)
+typedef unsigned int uint32_t;
+#define __DEFINED_uint32_t
+#endif
+
+#if defined(__NEED_uint64_t) && !defined(__DEFINED_uint64_t)
+typedef unsigned long long uint64_t;
+#define __DEFINED_uint64_t
+#endif
+
+
+#if defined(__NEED___uint16_t) && !defined(__DEFINED___uint16_t)
+typedef unsigned short __uint16_t;
+#define __DEFINED___uint16_t
+#endif
+
+#if defined(__NEED___uint32_t) && !defined(__DEFINED___uint32_t)
+typedef unsigned int __uint32_t;
+#define __DEFINED___uint32_t
+#endif
+
+#if defined(__NEED___uint64_t) && !defined(__DEFINED___uint64_t)
+typedef unsigned long long __uint64_t;
+#define __DEFINED___uint64_t
+#endif
+
+
+#if defined(__NEED_int_fast8_t) && !defined(__DEFINED_int_fast8_t)
+typedef int8_t int_fast8_t;
+#define __DEFINED_int_fast8_t
+#endif
+
+#if defined(__NEED_int_fast16_t) && !defined(__DEFINED_int_fast16_t)
+typedef int int_fast16_t;
+#define __DEFINED_int_fast16_t
+#endif
+
+#if defined(__NEED_int_fast32_t) && !defined(__DEFINED_int_fast32_t)
+typedef int int_fast32_t;
+#define __DEFINED_int_fast32_t
+#endif
+
+#if defined(__NEED_int_fast64_t) && !defined(__DEFINED_int_fast64_t)
+typedef int64_t int_fast64_t;
+#define __DEFINED_int_fast64_t
+#endif
+
+
+#if defined(__NEED_uint_fast8_t) && !defined(__DEFINED_uint_fast8_t)
+typedef unsigned char uint_fast8_t;
+#define __DEFINED_uint_fast8_t
+#endif
+
+#if defined(__NEED_uint_fast16_t) && !defined(__DEFINED_uint_fast16_t)
+typedef unsigned int uint_fast16_t;
+#define __DEFINED_uint_fast16_t
+#endif
+
+#if defined(__NEED_uint_fast32_t) && !defined(__DEFINED_uint_fast32_t)
+typedef unsigned int uint_fast32_t;
+#define __DEFINED_uint_fast32_t
+#endif
+
+#if defined(__NEED_uint_fast64_t) && !defined(__DEFINED_uint_fast64_t)
+typedef uint64_t uint_fast64_t;
+#define __DEFINED_uint_fast64_t
+#endif
+
+
+#if defined(__NEED_intptr_t) && !defined(__DEFINED_intptr_t)
+typedef signed long long intptr_t;
+#define __DEFINED_intptr_t
+#endif
+
+#if defined(__NEED_uintptr_t) && !defined(__DEFINED_uintptr_t)
+typedef unsigned long long uintptr_t;
+#define __DEFINED_uintptr_t
+#endif
+
+
+#if defined(__NEED_intmax_t) && !defined(__DEFINED_intmax_t)
+typedef long long intmax_t;
+#define __DEFINED_intmax_t
+#endif
+
+#if defined(__NEED_uintmax_t) && !defined(__DEFINED_uintmax_t)
+typedef unsigned long long uintmax_t;
+#define __DEFINED_uintmax_t
+#endif
+
+
+#if defined(__NEED_float_t) && !defined(__DEFINED_float_t)
+typedef float float_t;
+#define __DEFINED_float_t
+#endif
+
+#if defined(__NEED_double_t) && !defined(__DEFINED_double_t)
+typedef double double_t;
+#define __DEFINED_double_t
+#endif
diff --git a/include/psxtypes/arch/nt64/ntneedall.h b/include/psxtypes/arch/nt64/ntneedall.h
new file mode 100644
index 0000000..f676204
--- /dev/null
+++ b/include/psxtypes/arch/nt64/ntneedall.h
@@ -0,0 +1,52 @@
+#ifndef _NTNEEDALL_H_
+#define _NTNEEDALL_H_
+
+#ifndef __ASSEMBLER__
+
+#define __NEED_wchar16_t
+#define __NEED_wchar32_t
+
+#define __NEED_size_t
+#define __NEED_ssize_t
+#define __NEED_ptrdiff_t
+#define __NEED_off_t
+
+#define __NEED_wint_t
+#define __NEED_wctrans_t
+#define __NEED_wctype_t
+
+#define __NEED_int8_t
+#define __NEED_int16_t
+#define __NEED_int32_t
+#define __NEED_int64_t
+
+#define __NEED_uint8_t
+#define __NEED_uint16_t
+#define __NEED_uint32_t
+#define __NEED_uint64_t
+
+#define __NEED___uint16_t
+#define __NEED___uint32_t
+#define __NEED___uint64_t
+
+#define __NEED_int_fast8_t
+#define __NEED_int_fast16_t
+#define __NEED_int_fast32_t
+#define __NEED_int_fast64_t
+
+#define __NEED_uint_fast8_t
+#define __NEED_uint_fast16_t
+#define __NEED_uint_fast32_t
+#define __NEED_uint_fast64_t
+
+#define __NEED_intptr_t
+#define __NEED_uintptr_t
+
+#define __NEED_intmax_t
+#define __NEED_uintmax_t
+
+#define __NEED_float_t
+#define __NEED_double_t
+
+#endif /* __ASSEMBLER__ */
+#endif /* _NTNEEDALL_H_ */
diff --git a/include/psxtypes/compiler/__nt_compiler_clang.h b/include/psxtypes/compiler/__nt_compiler_clang.h
new file mode 100644
index 0000000..531153e
--- /dev/null
+++ b/include/psxtypes/compiler/__nt_compiler_clang.h
@@ -0,0 +1,108 @@
+#ifndef _PSXTYPES_NT_COMPILER_CLANG_H_
+#define _PSXTYPES_NT_COMPILER_CLANG_H_
+
+
+/* compiler identification */
+#define __COMPILER__ __CLANG__
+#define __COMPILER_DEPENDENT_SUFFIX__ __clang
+
+
+/* NTVER: the bare minimum */
+#ifndef NTVER
+ #define NTVER 0x0500
+#elif (NTVER < 0x0500)
+ #error __^@^__: NTVER: minimum supported NT version is 0x0500.
+#endif
+
+
+/* x86 processor model */
+#if (_M_IX86 == 900)
+ #define __X86_MODEL 986
+#elif (_M_IX86 == 800)
+ #define __X86_MODEL 886
+#elif (_M_IX86 == 700)
+ #define __X86_MODEL 786
+#elif (_M_IX86 == 600)
+ #define __X86_MODEL 686
+#elif (_M_IX86 == 500)
+ #define __X86_MODEL 586
+#elif (_M_IX86 == 400)
+ #define __X86_MODEL 486
+#elif (_M_IX86 == 300)
+ #define __X86_MODEL 386
+#endif
+
+
+/* x86_64 processor model */
+#if defined(_M_AMD64)
+ #define __amd64 1
+ #define __X86_64_MODEL __amd64
+#endif
+
+
+/* va_list */
+#define __CUSTOM_OR_BUILTIN_va_list__ char *
+
+
+/* compiler keywords */
+#define __in
+#define __out
+#define __in_opt
+#define __out_opt
+#define __in_out
+#define __in_out_opt
+#define __reserved
+#define __optional
+#define __simplified
+#define __null_placeholder (0x0)
+
+
+/* __SIZEOF_POINTER__ */
+#if defined(__NT32)
+ #define __SIZEOF_POINTER__ 4
+#elif defined(__NT64)
+ #define __SIZEOF_POINTER__ 8
+#endif
+
+
+/* compiler attributes */
+#define __inline__ __inline
+#define __volatile__ volatile
+#define __attr_aligned__(x) __declspec(align(x))
+#define __attr_ptr_size_aligned__ __attr_aligned__(__SIZEOF_POINTER__)
+#define __attr_packed__
+#define __attr_export__ __declspec(dllexport)
+#define __attr_import__ __declspec(dllimport)
+#define __attr_naked__ __declspec(naked)
+
+#ifdef __PE_VISIBILITY__
+#define __attr_hidden__ __attribute__((visibility("hidden")))
+#define __attr_public__ __attribute__((visibility("default")))
+#define __attr_protected__ __attribute__((visibility("protected")))
+#else
+#define __attr_hidden__
+#define __attr_public__
+#define __attr_protected__
+#endif
+
+
+/* compiler-dependent assertions */
+#define __assert_aligned_size(s,a) typedef char __assert##s [1-((sizeof(s) % a))]
+#define __assert_struct_size(s1,s2) typedef char __assert##s1##s2 [1 + sizeof(s2) -sizeof(s1)]
+
+
+/* calling conventions */
+#undef __stdcall
+#undef APIENTRY
+#undef CALLBACK
+#undef NTAPI
+#undef WINAPI
+
+#define __stdcall _stdcall
+#define APIENTRY __stdcall
+#define CALLBACK __stdcall
+#define NTAPI __stdcall
+#define WINAPI __stdcall
+#define __tep __stdcall
+
+#endif /* _PSXTYPES_NT_COMPILER_CLANG_H_ */
diff --git a/include/psxtypes/compiler/__nt_compiler_gcc.h b/include/psxtypes/compiler/__nt_compiler_gcc.h
new file mode 100644
index 0000000..4c80398
--- /dev/null
+++ b/include/psxtypes/compiler/__nt_compiler_gcc.h
@@ -0,0 +1,129 @@
+#ifndef _PSXTYPES_NT_COMPILER_GCC_H_
+#define _PSXTYPES_NT_COMPILER_GCC_H_
+
+
+/* compiler identification */
+#define __COMPILER__ __GCC__
+#define __COMPILER_DEPENDENT_SUFFIX__ __gcc
+
+
+/* NTVER: the bare minimum */
+#ifndef NTVER
+ #define NTVER 0x0500
+#elif (NTVER < 0x0500)
+ #error __^@^__: NTVER: minimum supported NT version is 0x0500.
+#endif
+
+
+/* x86 processor model */
+#if defined(__i986__)
+ #define __X86_MODEL 986
+#elif defined(__i886__)
+ #define __X86_MODEL 886
+#elif defined(__i786__)
+ #define __X86_MODEL 786
+#elif defined(__i686__)
+ #define __X86_MODEL 686
+#elif defined(__i586__)
+ #define __X86_MODEL 586
+#elif defined(__i486__)
+ #define __X86_MODEL 486
+#elif defined(__i386__)
+ #define __X86_MODEL 386
+#endif
+
+
+/* x86_64 processor model */
+#if defined(__amd64) && (__amd64)
+ #define __X86_64_MODEL __amd64
+#endif
+
+
+/* va_list */
+#define __CUSTOM_OR_BUILTIN_va_list__ __builtin_va_list
+
+
+/* compiler keywords */
+#define __in
+#define __out
+#define __in_opt
+#define __out_opt
+#define __in_out
+#define __in_out_opt
+#define __reserved
+#define __optional
+#define __simplified
+#define __caller_allocated
+#define __caller_initialized
+#define __null_placeholder (0x0)
+
+
+/* compiler attributes */
+#define __attr_aligned__(x) __attribute__((__aligned__(x)))
+#define __attr_ptr_size_aligned__ __attr_aligned__(__SIZEOF_POINTER__)
+#define __attr_packed__ __attribute__((__packed__))
+#define __attr_export__ __attribute__((dllexport))
+#define __attr_import__ __attribute__((dllimport))
+#define __attr_naked__
+
+#ifdef __PE_VISIBILITY__
+#define __attr_hidden__ __attribute__((visibility("hidden")))
+#define __attr_public__ __attribute__((visibility("default")))
+#define __attr_protected__ __attribute__((visibility("protected")))
+#else
+#define __attr_hidden__
+#define __attr_public__
+#define __attr_protected__
+#endif
+
+
+/* compiler-dependent assertions */
+#define __assert_aligned_size(s,a) typedef char __assert##s [-(sizeof(s) % a)]
+#define __assert_struct_size(s1,s2) typedef char __assert##s1##s2 [sizeof(s2) -sizeof(s1)]
+
+
+/* calling conventions */
+#if defined(__X86_MODEL)
+#undef __cdecl
+#define __cdecl __attribute__((cdecl))
+
+#undef __fastcall
+#define __fastcall __attribute__((fastcall))
+
+#undef __stdcall
+#define __stdcall __attribute__((stdcall))
+
+#elif defined (__X86_64_MODEL)
+
+#undef __cdecl
+#define __cdecl
+
+#undef __fastcall
+#define __fastcall
+
+#undef __stdcall
+#define __stdcall
+#endif
+
+#undef APIENTRY
+#undef CALLBACK
+#undef NTAPI
+#undef WINAPI
+
+#define APIENTRY __stdcall
+#define CALLBACK __stdcall
+#define NTAPI __stdcall
+#define WINAPI __stdcall
+
+
+
+/* architecture-specific calling conventions */
+#if defined(__X86_MODEL)
+ #undef __stdcall
+ #define __stdcall __attribute__((__stdcall__))
+#elif defined(__X86_64_MODEL)
+ #undef __stdcall
+ #define __stdcall
+#endif
+
+#endif /* _PSXTYPES_NT_COMPILER_GCC_H_ */
diff --git a/include/psxtypes/compiler/__nt_compiler_msvc.h b/include/psxtypes/compiler/__nt_compiler_msvc.h
new file mode 100644
index 0000000..2a0e8dc
--- /dev/null
+++ b/include/psxtypes/compiler/__nt_compiler_msvc.h
@@ -0,0 +1,109 @@
+#ifndef _PSXTYPES_NT_COMPILER_MSVC_H_
+#define _PSXTYPES_NT_COMPILER_MSVC_H_
+
+
+/* compiler identification */
+#define __COMPILER__ __MSVC__
+#define __COMPILER_DEPENDENT_SUFFIX__ __msvc
+
+
+/* NTVER: the bare minimum */
+#ifndef NTVER
+ #define NTVER 0x0500
+#elif (NTVER < 0x0500)
+ #error __^@^__: NTVER: minimum supported NT version is 0x0500.
+#endif
+
+
+/* x86 processor model */
+#if (_M_IX86 == 900)
+ #define __X86_MODEL 986
+#elif (_M_IX86 == 800)
+ #define __X86_MODEL 886
+#elif (_M_IX86 == 700)
+ #define __X86_MODEL 786
+#elif (_M_IX86 == 600)
+ #define __X86_MODEL 686
+#elif (_M_IX86 == 500)
+ #define __X86_MODEL 586
+#elif (_M_IX86 == 400)
+ #define __X86_MODEL 486
+#elif (_M_IX86 == 300)
+ #define __X86_MODEL 386
+#endif
+
+
+/* x86_64 processor model */
+#if defined(_M_AMD64)
+ #define __amd64 1
+ #define __X86_64_MODEL __amd64
+#endif
+
+
+/* va_list */
+#define __CUSTOM_OR_BUILTIN_va_list__ char *
+
+
+/* compiler keywords */
+#define __in
+#define __out
+#define __in_opt
+#define __out_opt
+#define __in_out
+#define __in_out_opt
+#define __reserved
+#define __optional
+#define __simplified
+#define __caller_allocated
+#define __caller_initialized
+#define __null_placeholder (0x0)
+
+
+/* __SIZEOF_POINTER__ */
+#if defined(__NT32)
+ #define __SIZEOF_POINTER__ 4
+#elif defined(__NT64)
+ #define __SIZEOF_POINTER__ 8
+#endif
+
+
+/* compiler attributes */
+#define __inline__ __inline
+#define __volatile__ volatile
+#define __attr_aligned__(x) __declspec(align(x))
+#define __attr_ptr_size_aligned__ __attr_aligned__(__SIZEOF_POINTER__)
+#define __attr_packed__
+#define __attr_export__ __declspec(dllexport)
+#define __attr_import__ __declspec(dllimport)
+#define __attr_naked__ __declspec(naked)
+
+#ifdef __PE_VISIBILITY__
+#define __attr_hidden__ __attribute__((visibility("hidden")))
+#define __attr_public__ __attribute__((visibility("default")))
+#define __attr_protected__ __attribute__((visibility("protected")))
+#else
+#define __attr_hidden__
+#define __attr_public__
+#define __attr_protected__
+#endif
+
+
+/* compiler-dependent assertions */
+#define __assert_aligned_size(s,a) typedef char __assert##s [1-((sizeof(s) % a))]
+#define __assert_struct_size(s1,s2) typedef char __assert##s1##s2 [1 + sizeof(s2) -sizeof(s1)]
+
+
+/* calling conventions */
+#undef __stdcall
+#undef APIENTRY
+#undef CALLBACK
+#undef NTAPI
+#undef WINAPI
+
+#define __stdcall _stdcall
+#define APIENTRY __stdcall
+#define CALLBACK __stdcall
+#define NTAPI __stdcall
+#define WINAPI __stdcall
+
+#endif /* _PSXTYPES_NT_COMPILER_MSVC_H_ */
diff --git a/include/psxtypes/compiler/__psx_compiler_gcc.h b/include/psxtypes/compiler/__psx_compiler_gcc.h
new file mode 100644
index 0000000..6797182
--- /dev/null
+++ b/include/psxtypes/compiler/__psx_compiler_gcc.h
@@ -0,0 +1,93 @@
+#ifndef _PSXTYPES_COMPILER_GCC_H_
+#define _PSXTYPES_COMPILER_GCC_H_
+
+
+/* compiler identification */
+#define __COMPILER__ __GCC__
+#define __COMPILER_DEPENDENT_SUFFIX__ __gcc
+
+
+/* x86 processor model */
+#if defined(__i986__)
+ #define __X86_MODEL 986
+#elif defined(__i886__)
+ #define __X86_MODEL 886
+#elif defined(__i786__)
+ #define __X86_MODEL 786
+#elif defined(__i686__)
+ #define __X86_MODEL 686
+#elif defined(__i586__)
+ #define __X86_MODEL 586
+#elif defined(__i486__)
+ #define __X86_MODEL 486
+#elif defined(__i386__)
+ #define __X86_MODEL 386
+#endif
+
+
+/* x86_64 processor model */
+#if defined(__amd64) && (__amd64)
+ #define __X86_64_MODEL __amd64
+#endif
+
+
+/* va_list */
+#define __CUSTOM_OR_BUILTIN_va_list__ __builtin_va_list
+
+
+/* compiler keywords */
+#define __in
+#define __out
+#define __in_opt
+#define __out_opt
+#define __in_out
+#define __in_out_opt
+#define __reserved
+#define __optional
+#define __simplified
+#define __caller_allocated
+#define __caller_initialized
+#define __null_placeholder (0x0)
+
+
+/* compiler attributes */
+#define __attr_aligned__(x) __attribute__((__aligned__(x)))
+#define __attr_ptr_size_aligned__ __attr_aligned__(__SIZEOF_POINTER__)
+#define __attr_packed__ __attribute__((__packed__))
+#define __attr_export__ __attribute__((dllexport))
+#define __attr_import__ __attribute__((dllimport))
+#define __attr_naked__
+#define __attr_hidden__ __attribute__ ((visibility("hidden")))
+#define __attr_public__ __attribute__ ((visibility("default")))
+#define __attr_protected__ __attribute__ ((visibility("protected")))
+
+
+/* compiler-dependent assertions */
+#define __assert_aligned_size(s,a) typedef char __assert##s [-(sizeof(s) % a)]
+#define __assert_struct_size(s1,s2) typedef char __assert##s1##s2 [sizeof(s2) -sizeof(s1)]
+
+
+/* calling conventions */
+#ifndef __cdecl
+#define __cdecl
+#endif
+
+#ifndef __fastcall
+#define __fastcall
+#endif
+
+#ifndef __stdcall
+#define __stdcall
+#endif
+
+#undef APIENTRY
+#undef CALLBACK
+#undef NTAPI
+#undef WINAPI
+
+#define APIENTRY
+#define CALLBACK
+#define NTAPI
+#define WINAPI
+
+#endif /* _PSXTYPES_COMPILER_GCC_H_ */
diff --git a/include/psxtypes/psxtypes.h b/include/psxtypes/psxtypes.h
new file mode 100644
index 0000000..5098a3f
--- /dev/null
+++ b/include/psxtypes/psxtypes.h
@@ -0,0 +1,84 @@
+/* support use of these headers by non-native projects */
+#if defined(MIDIPIX_WIN32)
+#ifndef __NT32
+#define __NT32
+#endif
+#elif defined(MIDIPIX_WIN64)
+#ifndef __NT64
+#define __NT64
+#endif
+#endif
+
+
+/* avoid source and/or header mix-ups */
+#if (defined(__WIN32) || defined(_WIN32) || defined (WIN32)) && !defined(MIDIPIX_WIN32) && !defined(MIDIPIX_WIN64)
+ #error __^@^__: Possible mix-up: you have __WIN32 or _WIN32 or WIN32 defined,
+ #error __^@^__: but should have defined __NT32 instead.
+ #error __^@^__:
+ #error __^@^__: if this is a WIN32 project (rather than native or posix), please define MIDIPIX_WIN32
+ #error
+#elif (defined(__WIN64) || defined(_WIN64) || defined (WIN64)) && !defined(MIDIPIX_WIN64)
+ #error __^@^__: Possible mix-up: you have __WIN64 or _WIN64 or WIN64 defined,
+ #error __^@^__: but should have defined __NT64 instead.
+ #error __^@^__:
+ #error __^@^__: if this is a WIN64 project (rather than native or posix), please define MIDIPIX_WIN64
+ #error
+#endif
+
+
+/* require either __NT32 or __NT64 or __NATIVE_POSIX to be defined... */
+#if !defined(__NT32) && !defined(__NT64) && !defined(__NATIVE_POSIX)
+ #error __^@^__: PSXTYPES: explicit definition of either __NT32 or __NT64 or __NATIVE_POSIX is required.
+#endif
+
+
+/* ...but only one */
+#ifdef __NT32
+#define __NT32_MATCHES 1
+#else
+#define __NT32_MATCHES 0
+#endif
+
+#ifdef __NT64
+#define __NT64_MATCHES 1
+#else
+#define __NT64_MATCHES 0
+#endif
+
+#ifdef __NATIVE_POSIX
+#define __NATIVE_POSIX_MATCHES 1
+#else
+#define __NATIVE_POSIX_MATCHES 0
+#endif
+
+#if (__NT32_MATCHES + __NT64_MATCHES + __NATIVE_POSIX_MATCHES) > 1
+ #error __^@^__: PSXTYPES: please choose one platform only...
+ #error __^@^__: (currently supported platforms: __NT32, __NT64, __NATIVE_POSIX)
+#endif
+
+#undef __NT32_MATCHES
+#undef __NT64_MATCHES
+#undef __NATIVE_POSIX_MATCHES
+
+
+
+/**
+ * define arbitrary constants to identify supported compilers;
+ * compiler-specific headers will define __COMPILER__ to equal
+ * one of the values below (crc of upper-cased compiler name).
+**/
+#define __GCC__ 0xBE154EBB
+#define __MSVC__ 0x25F425ED
+
+#if defined(__DEBUG)
+#define __PSX_DEBUG 1
+#else
+#define __PSX_DEBUG 0
+#endif
+
+/* single point to load compiler-specific and architecture-specific definitions */
+#if defined(__NATIVE_POSIX)
+#include "__psxtypes.h"
+#elif defined(__NT32) || defined(__NT64)
+#include "__nttypes.h"
+#endif