summaryrefslogtreecommitdiffstatshomepage
path: root/windows/mpconfigport.h
diff options
context:
space:
mode:
Diffstat (limited to 'windows/mpconfigport.h')
-rw-r--r--windows/mpconfigport.h46
1 files changed, 45 insertions, 1 deletions
diff --git a/windows/mpconfigport.h b/windows/mpconfigport.h
index 4436b8a197..3651a6120f 100644
--- a/windows/mpconfigport.h
+++ b/windows/mpconfigport.h
@@ -31,6 +31,7 @@
#define MICROPY_USE_READLINE (0)
#endif
+#define MICROPY_PATH_MAX (260) //see minwindef.h for msvc or limits.h for mingw
#define MICROPY_EMIT_X64 (0)
#define MICROPY_EMIT_THUMB (0)
#define MICROPY_EMIT_INLINE_THUMB (0)
@@ -46,9 +47,12 @@
// type definitions for the specific machine
-#ifdef __LP64__
+#if defined( __MINGW32__ ) && defined( __LP64__ )
typedef long machine_int_t; // must be pointer size
typedef unsigned long machine_uint_t; // must be pointer size
+#elif defined ( _MSC_VER ) && defined( _WIN64 )
+typedef __int64 machine_int_t;
+typedef unsigned __int64 machine_uint_t;
#else
// These are definitions for machines where sizeof(int) == sizeof(void*),
// regardless for actual size.
@@ -67,3 +71,43 @@ extern const struct _mp_obj_fun_native_t mp_builtin_open_obj;
#include "realpath.h"
#include "init.h"
+
+
+// MSVC specifics
+#ifdef _MSC_VER
+
+// Sanity check
+
+#if ( _MSC_VER < 1800 )
+ #error Can only build with Visual Studio 2013 toolset
+#endif
+
+
+// CL specific overrides from mpconfig
+
+#define NORETURN __declspec(noreturn)
+#define MICROPY_EXTRA_CONSTANTS { "dummy", 0 } //can't have zero-sized array
+
+
+// CL specific definitions
+
+#define restrict
+#define inline __inline
+#define STDIN_FILENO 0
+#define STDOUT_FILENO 1
+#define STDERR_FILENO 2
+#define PATH_MAX MICROPY_PATH_MAX
+#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
+#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
+
+
+// System headers (needed e.g. for nlr.h)
+
+#include <stddef.h> //for NULL
+#include <assert.h> //for assert
+
+
+// Functions implemented in platform code
+
+int snprintf(char *dest, size_t count, const char *format, ...);
+#endif