Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/prusa3d/PrusaSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/avrdude/windows/unistd.h')
-rw-r--r--src/avrdude/windows/unistd.h85
1 files changed, 85 insertions, 0 deletions
diff --git a/src/avrdude/windows/unistd.h b/src/avrdude/windows/unistd.h
new file mode 100644
index 000000000..b1bc6bf7f
--- /dev/null
+++ b/src/avrdude/windows/unistd.h
@@ -0,0 +1,85 @@
+#ifndef SLIC3R_AVRDUDE_UNISTD_H
+#define SLIC3R_AVRDUDE_UNISTD_H 1
+
+/* This is intended as a drop-in replacement for unistd.h on Windows.
+ * Please add functionality as neeeded.
+ * https://stackoverflow.com/a/826027/1202830
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+#include <stdlib.h>
+#include <io.h>
+#include <getopt.h> /* getopt at: https://gist.github.com/ashelly/7776712 */
+#include <process.h> /* for getpid() and the exec..() family */
+#include <direct.h> /* for _getcwd() and _chdir() */
+#include <sys/types.h>
+#include <sys/stat.h> /* both for stat() */
+
+#ifndef __cplusplus
+#define inline __inline
+#endif
+
+#define __func__ __FUNCTION__
+
+#define srandom srand
+#define random rand
+
+/* Values for the second argument to access.
+ These may be OR'd together. */
+#define R_OK 4 /* Test for read permission. */
+#define W_OK 2 /* Test for write permission. */
+//#define X_OK 1 /* execute permission - unsupported in windows*/
+#define F_OK 0 /* Test for existence. */
+
+#define access _access
+#define dup2 _dup2
+#define execve _execve
+#define ftruncate _chsize
+#define unlink _unlink
+#define fileno _fileno
+#define getcwd _getcwd
+#define chdir _chdir
+#define isatty _isatty
+#define lseek _lseek
+#define snprintf _snprintf
+#define strncasecmp _strnicmp
+#define strcasecmp _stricmp
+#define stat _stat
+/* read, write, and close are NOT being #defined here, because while there are file handle specific versions for Windows, they probably don't work for sockets. You need to look at your app and consider whether to call e.g. closesocket(). */
+
+#ifdef _WIN64
+#define ssize_t __int64
+#else
+#define ssize_t long
+#endif
+
+#define STDIN_FILENO 0
+#define STDOUT_FILENO 1
+#define STDERR_FILENO 2
+
+#ifndef __cplusplus
+/* should be in some equivalent to <sys/types.h> */
+typedef __int8 int8_t;
+typedef __int16 int16_t;
+typedef __int32 int32_t;
+typedef __int64 int64_t;
+typedef unsigned __int8 uint8_t;
+typedef unsigned __int16 uint16_t;
+typedef unsigned __int32 uint32_t;
+typedef unsigned __int64 uint64_t;
+#endif
+
+
+int usleep(unsigned usec);
+int gettimeofday(struct timeval *tp, struct timezone *tzp);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* unistd.h */