]> ncurses.scripts.mit.edu Git - ncurses.git/blobdiff - include/nc_mingw.h
ncurses 6.2 - patch 20200926
[ncurses.git] / include / nc_mingw.h
index a524da87124de0177eebcfc114a79af6fe156201..6729b29d3d0945db4cda179b1bab322f897d1ff3 100644 (file)
@@ -1,5 +1,6 @@
 /****************************************************************************
- * Copyright (c) 2008,2009 Free Software Foundation, Inc.                   *
+ * Copyright 2018-2019,2020 Thomas E. Dickey                                *
+ * Copyright 2008-2010,2017 Free Software Foundation, Inc.                  *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
  ****************************************************************************/
 
 /****************************************************************************
- * Author: Thomas Dickey, 2008-on                                           * 
- *                                                                          *
+ * Author: Thomas Dickey, 2008-on                                           *
  ****************************************************************************/
 
-/* $Id: nc_mingw.h,v 1.1 2009/02/07 23:33:19 tom Exp $ */
+/* $Id: nc_mingw.h,v 1.9 2020/07/11 22:13:19 tom Exp $ */
 
 #ifndef NC_MINGW_H
 #define NC_MINGW_H 1
 
-#define WINVER 0x0501
+#ifdef _WIN32
+
+#ifdef WINVER
+#  if WINVER < 0x0501
+#    error WINVER must at least be 0x0501
+#  endif
+#else
+#  define WINVER 0x0501
+#endif
 #include <windows.h>
 
 #undef sleep
 #undef gettimeofday
 #define gettimeofday(tv,tz) _nc_gettimeofday(tv,tz)
 
-#include <sys/time.h>  /* for struct timeval */
+#if HAVE_SYS_TIME_H
+#include <sys/time.h>          /* for struct timeval */
+#endif
+
+#ifdef _MSC_VER
+#include <winsock2.h>          /* for struct timeval */
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
 
-extern int _nc_gettimeofday(struct timeval *, void *);
+#include <ncurses_dll.h>
+
+NCURSES_EXPORT(int) _nc_gettimeofday(struct timeval *, void *);
 
 #undef HAVE_GETTIMEOFDAY
 #define HAVE_GETTIMEOFDAY 1
@@ -56,4 +76,14 @@ extern int _nc_gettimeofday(struct timeval *, void *);
 #define SIGKILL 9
 #define getlogin() "username"
 
+#undef wcwidth
+#define wcwidth(ucs) _nc_wcwidth((wchar_t)(ucs))
+NCURSES_EXPORT(int) _nc_wcwidth(wchar_t);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _WIN32 */
+
 #endif /* NC_MINGW_H */