From: Marius Storm-Olsen <mstormo@gmail.com>
To: Johannes.Schindelin@gmx.de
Cc: msysgit@googlegroups.com, git@vger.kernel.org, lznuaa@gmail.com,
Marius Storm-Olsen <mstormo@gmail.com>
Subject: [PATCH 10/17] Add MinGW header files to build git with MSVC
Date: Mon, 14 Sep 2009 15:11:23 +0200 [thread overview]
Message-ID: <aed24a7f9524c9872f8a2455cfc5dd8baf6c3c0b.1252925290.git.mstormo@gmail.com> (raw)
In-Reply-To: <a48108513bf13247ba9b42fd703ba679804e8d8a.1252925290.git.mstormo@gmail.com>
In-Reply-To: <cover.1252925290.git.mstormo@gmail.com>
From: Frank Li <lznuaa@gmail.com>
Added the header files dirent.h, unistd.h and utime.h
Add alloca.h, which simply includes malloc.h, which defines alloca
Signed-off-by: Frank Li <lznuaa@gmail.com>
Signed-off-by: Marius Storm-Olsen <mstormo@gmail.com>
---
compat/vcbuild/include/alloca.h | 1 +
compat/vcbuild/include/dirent.h | 128 ++++++++++++++++++++++++++++++++++++
compat/vcbuild/include/sys/utime.h | 34 ++++++++++
compat/vcbuild/include/unistd.h | 92 ++++++++++++++++++++++++++
compat/vcbuild/include/utime.h | 1 +
5 files changed, 256 insertions(+), 0 deletions(-)
create mode 100644 compat/vcbuild/include/alloca.h
create mode 100644 compat/vcbuild/include/dirent.h
create mode 100644 compat/vcbuild/include/sys/utime.h
create mode 100644 compat/vcbuild/include/unistd.h
create mode 100644 compat/vcbuild/include/utime.h
diff --git a/compat/vcbuild/include/alloca.h b/compat/vcbuild/include/alloca.h
new file mode 100644
index 0000000..c0d7985
--- /dev/null
+++ b/compat/vcbuild/include/alloca.h
@@ -0,0 +1 @@
+#include <malloc.h>
diff --git a/compat/vcbuild/include/dirent.h b/compat/vcbuild/include/dirent.h
new file mode 100644
index 0000000..440618d
--- /dev/null
+++ b/compat/vcbuild/include/dirent.h
@@ -0,0 +1,128 @@
+/*
+ * DIRENT.H (formerly DIRLIB.H)
+ * This file has no copyright assigned and is placed in the Public Domain.
+ * This file is a part of the mingw-runtime package.
+ *
+ * The mingw-runtime package and its code is distributed in the hope that it
+ * will be useful but WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESSED OR
+ * IMPLIED ARE HEREBY DISCLAIMED. This includes but is not limited to
+ * warranties of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * You are free to use this package and its code without limitation.
+ */
+#ifndef _DIRENT_H_
+#define _DIRENT_H_
+#include <io.h>
+
+#define PATH_MAX 512
+
+#define __MINGW_NOTHROW
+
+#ifndef RC_INVOKED
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct dirent
+{
+ long d_ino; /* Always zero. */
+ unsigned short d_reclen; /* Always zero. */
+ unsigned short d_namlen; /* Length of name in d_name. */
+ char d_name[FILENAME_MAX]; /* File name. */
+};
+
+/*
+ * This is an internal data structure. Good programmers will not use it
+ * except as an argument to one of the functions below.
+ * dd_stat field is now int (was short in older versions).
+ */
+typedef struct
+{
+ /* disk transfer area for this dir */
+ struct _finddata_t dd_dta;
+
+ /* dirent struct to return from dir (NOTE: this makes this thread
+ * safe as long as only one thread uses a particular DIR struct at
+ * a time) */
+ struct dirent dd_dir;
+
+ /* _findnext handle */
+ long dd_handle;
+
+ /*
+ * Status of search:
+ * 0 = not started yet (next entry to read is first entry)
+ * -1 = off the end
+ * positive = 0 based index of next entry
+ */
+ int dd_stat;
+
+ /* given path for dir with search pattern (struct is extended) */
+ char dd_name[PATH_MAX+3];
+} DIR;
+
+DIR* __cdecl __MINGW_NOTHROW opendir (const char*);
+struct dirent* __cdecl __MINGW_NOTHROW readdir (DIR*);
+int __cdecl __MINGW_NOTHROW closedir (DIR*);
+void __cdecl __MINGW_NOTHROW rewinddir (DIR*);
+long __cdecl __MINGW_NOTHROW telldir (DIR*);
+void __cdecl __MINGW_NOTHROW seekdir (DIR*, long);
+
+
+/* wide char versions */
+
+struct _wdirent
+{
+ long d_ino; /* Always zero. */
+ unsigned short d_reclen; /* Always zero. */
+ unsigned short d_namlen; /* Length of name in d_name. */
+ wchar_t d_name[FILENAME_MAX]; /* File name. */
+};
+
+/*
+ * This is an internal data structure. Good programmers will not use it
+ * except as an argument to one of the functions below.
+ */
+typedef struct
+{
+ /* disk transfer area for this dir */
+ //struct _wfinddata_t dd_dta;
+
+ /* dirent struct to return from dir (NOTE: this makes this thread
+ * safe as long as only one thread uses a particular DIR struct at
+ * a time) */
+ struct _wdirent dd_dir;
+
+ /* _findnext handle */
+ long dd_handle;
+
+ /*
+ * Status of search:
+ * 0 = not started yet (next entry to read is first entry)
+ * -1 = off the end
+ * positive = 0 based index of next entry
+ */
+ int dd_stat;
+
+ /* given path for dir with search pattern (struct is extended) */
+ wchar_t dd_name[1];
+} _WDIR;
+
+
+
+_WDIR* __cdecl __MINGW_NOTHROW _wopendir (const wchar_t*);
+struct _wdirent* __cdecl __MINGW_NOTHROW _wreaddir (_WDIR*);
+int __cdecl __MINGW_NOTHROW _wclosedir (_WDIR*);
+void __cdecl __MINGW_NOTHROW _wrewinddir (_WDIR*);
+long __cdecl __MINGW_NOTHROW _wtelldir (_WDIR*);
+void __cdecl __MINGW_NOTHROW _wseekdir (_WDIR*, long);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* Not RC_INVOKED */
+
+#endif /* Not _DIRENT_H_ */
diff --git a/compat/vcbuild/include/sys/utime.h b/compat/vcbuild/include/sys/utime.h
new file mode 100644
index 0000000..582589c
--- /dev/null
+++ b/compat/vcbuild/include/sys/utime.h
@@ -0,0 +1,34 @@
+#ifndef _UTIME_H_
+#define _UTIME_H_
+/*
+ * UTIME.H
+ * This file has no copyright assigned and is placed in the Public Domain.
+ * This file is a part of the mingw-runtime package.
+ *
+ * The mingw-runtime package and its code is distributed in the hope that it
+ * will be useful but WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESSED OR
+ * IMPLIED ARE HEREBY DISCLAIMED. This includes but is not limited to
+ * warranties of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * You are free to use this package and its code without limitation.
+ */
+
+/*
+ * Structure used by _utime function.
+ */
+struct _utimbuf
+{
+ time_t actime; /* Access time */
+ time_t modtime; /* Modification time */
+};
+
+#ifndef _NO_OLDNAMES
+/* NOTE: Must be the same as _utimbuf above. */
+struct utimbuf
+{
+ time_t actime;
+ time_t modtime;
+};
+#endif /* Not _NO_OLDNAMES */
+
+#endif
diff --git a/compat/vcbuild/include/unistd.h b/compat/vcbuild/include/unistd.h
new file mode 100644
index 0000000..2a4f276
--- /dev/null
+++ b/compat/vcbuild/include/unistd.h
@@ -0,0 +1,92 @@
+#ifndef _UNISTD_
+#define _UNISTD_
+
+/* Win32 define for porting git*/
+
+#ifndef _MODE_T_
+#define _MODE_T_
+typedef unsigned short _mode_t;
+
+#ifndef _NO_OLDNAMES
+typedef _mode_t mode_t;
+#endif
+#endif /* Not _MODE_T_ */
+
+#ifndef _SSIZE_T_
+#define _SSIZE_T_
+typedef long _ssize_t;
+
+#ifndef _OFF_T_
+#define _OFF_T_
+typedef long _off_t;
+
+#ifndef _NO_OLDNAMES
+typedef _off_t off_t;
+#endif
+#endif /* Not _OFF_T_ */
+
+
+#ifndef _NO_OLDNAMES
+typedef _ssize_t ssize_t;
+#endif
+#endif /* Not _SSIZE_T_ */
+
+typedef signed char int8_t;
+typedef unsigned char uint8_t;
+typedef short int16_t;
+typedef unsigned short uint16_t;
+typedef int int32_t;
+typedef unsigned uint32_t;
+typedef long long int64_t;
+typedef unsigned long long uint64_t;
+
+typedef long long intmax_t;
+typedef unsigned long long uintmax_t;
+
+typedef int64_t off64_t;
+
+#define STDOUT_FILENO 1
+#define STDERR_FILENO 2
+
+/* Some defines for _access nAccessMode (MS doesn't define them, but
+ * it doesn't seem to hurt to add them). */
+#define F_OK 0 /* Check for file existence */
+/* Well maybe it does hurt. On newer versions of MSVCRT, an access mode
+ of 1 causes invalid parameter error. */
+#define X_OK 0 /* MS access() doesn't check for execute permission. */
+#define W_OK 2 /* Check for write permission */
+#define R_OK 4 /* Check for read permission */
+
+#define _S_IFIFO 0x1000 /* FIFO */
+#define _S_IFCHR 0x2000 /* Character */
+#define _S_IFBLK 0x3000 /* Block: Is this ever set under w32? */
+#define _S_IFDIR 0x4000 /* Directory */
+#define _S_IFREG 0x8000 /* Regular */
+
+#define _S_IFMT 0xF000 /* File type mask */
+
+#define _S_IXUSR _S_IEXEC
+#define _S_IWUSR _S_IWRITE
+#define _S_IRUSR _S_IREAD
+#define _S_ISDIR(m) (((m) & _S_IFMT) == _S_IFDIR)
+
+#define S_IFIFO _S_IFIFO
+#define S_IFCHR _S_IFCHR
+#define S_IFBLK _S_IFBLK
+#define S_IFDIR _S_IFDIR
+#define S_IFREG _S_IFREG
+#define S_IFMT _S_IFMT
+#define S_IEXEC _S_IEXEC
+#define S_IWRITE _S_IWRITE
+#define S_IREAD _S_IREAD
+#define S_IRWXU _S_IRWXU
+#define S_IXUSR _S_IXUSR
+#define S_IWUSR _S_IWUSR
+#define S_IRUSR _S_IRUSR
+
+
+#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
+#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
+#define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO)
+
+#endif
diff --git a/compat/vcbuild/include/utime.h b/compat/vcbuild/include/utime.h
new file mode 100644
index 0000000..8285f38
--- /dev/null
+++ b/compat/vcbuild/include/utime.h
@@ -0,0 +1 @@
+#include <sys/utime.h>
--
1.6.2.1.418.g33d56.dirty
next prev parent reply other threads:[~2009-09-14 13:13 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-09-14 13:11 [RFC/PATCH v2 00/17] Build Git with MSVC Marius Storm-Olsen
2009-09-14 13:11 ` [PATCH 01/17] Avoid declaration after statement Marius Storm-Olsen
2009-09-14 13:11 ` [PATCH 02/17] boolean is a typedef under MSVC, so rename variable to 'i_boolean' Marius Storm-Olsen
2009-09-14 13:11 ` [PATCH 03/17] Define SNPRINTF_SIZE_CORR=1 for Microsoft Visual C++ Marius Storm-Olsen
2009-09-14 13:11 ` [PATCH 04/17] Add define guards to compat/win32.h Marius Storm-Olsen
2009-09-14 13:11 ` [PATCH 05/17] Change regerror() declaration from K&R style to ANSI C (C89) Marius Storm-Olsen
2009-09-14 13:11 ` [PATCH 06/17] mingw.c: Use the O_BINARY flag to open files Marius Storm-Olsen
2009-09-14 13:11 ` [PATCH 07/17] Fix __stdcall/WINAPI placement and function prototype Marius Storm-Olsen
2009-09-14 13:11 ` [PATCH 08/17] Test for WIN32 instead of __MINGW32_ Marius Storm-Olsen
2009-09-14 13:11 ` [PATCH 09/17] Add empty header files for MSVC port Marius Storm-Olsen
2009-09-14 13:11 ` Marius Storm-Olsen [this message]
2009-09-14 13:11 ` [PATCH 11/17] Add platform files for MSVC porting Marius Storm-Olsen
2009-09-14 13:11 ` [PATCH 12/17] Make usage of windows.h lean and mean Marius Storm-Olsen
2009-09-14 13:11 ` [PATCH 13/17] Define strncasecmp as _strnicmp for MSVC Marius Storm-Olsen
2009-09-14 13:11 ` [PATCH 14/17] Add ftruncate implementation " Marius Storm-Olsen
2009-09-14 13:11 ` [PATCH 15/17] Add MSVC to Makefile Marius Storm-Olsen
2009-09-14 13:11 ` [PATCH 16/17] Add README for MSVC build Marius Storm-Olsen
2009-09-14 13:11 ` [PATCH 17/17] Add scripts to generate projects for other buildsystems (MSVC vcproj, QMake) Marius Storm-Olsen
2009-09-14 14:06 ` [PATCH 15/17] Add MSVC to Makefile Alex Riesen
2009-09-14 19:09 ` Marius Storm-Olsen
2009-09-14 14:18 ` [PATCH 14/17] Add ftruncate implementation for MSVC Alex Riesen
2009-09-14 19:03 ` Marius Storm-Olsen
2009-09-14 19:48 ` Junio C Hamano
2009-09-14 19:31 ` [PATCH 08/17] Test for WIN32 instead of __MINGW32_ Junio C Hamano
2009-09-14 19:42 ` Marius Storm-Olsen
2009-09-14 20:00 ` [PATCH 07/17] Fix __stdcall/WINAPI placement and function prototype Johannes Sixt
2009-09-15 0:24 ` [msysGit] " Johannes Schindelin
2009-09-15 5:59 ` Marius Storm-Olsen
2009-09-14 19:06 ` [msysGit] [PATCH 06/17] mingw.c: Use the O_BINARY flag to open files Alexey Borzenkov
2009-09-14 13:41 ` [PATCH 02/17] boolean is a typedef under MSVC, so rename variable to 'i_boolean' Marius Storm-Olsen
2009-09-14 13:59 ` [PATCH 01/17] Avoid declaration after statement Alex Riesen
2009-09-14 14:01 ` Marius Storm-Olsen
2009-09-14 14:04 ` Frank Li
2009-09-14 14:10 ` Alex Riesen
2009-09-14 19:00 ` Marius Storm-Olsen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aed24a7f9524c9872f8a2455cfc5dd8baf6c3c0b.1252925290.git.mstormo@gmail.com \
--to=mstormo@gmail.com \
--cc=Johannes.Schindelin@gmx.de \
--cc=git@vger.kernel.org \
--cc=lznuaa@gmail.com \
--cc=msysgit@googlegroups.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).