@matheusbsbs / matheus-bagliano / commits / 16fe1e0369
Fork 0

Add MinGW header files to build git with MSVC

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> Acked-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Frank Li committed Sep 16, 2009 at 10:20 UTC 16fe1e03694e75a3923c3a757ec946aa6098aec7
5 files changed +256
compat/vcbuild/include/alloca.h new
+1
@@ -0,0 +1 @@
1 +#include <malloc.h>
compat/vcbuild/include/dirent.h new
+128
@@ -0,0 +1,128 @@
1 +/*
2 + * DIRENT.H (formerly DIRLIB.H)
3 + * This file has no copyright assigned and is placed in the Public Domain.
4 + * This file is a part of the mingw-runtime package.
5 + *
6 + * The mingw-runtime package and its code is distributed in the hope that it
7 + * will be useful but WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESSED OR
8 + * IMPLIED ARE HEREBY DISCLAIMED. This includes but is not limited to
9 + * warranties of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10 + *
11 + * You are free to use this package and its code without limitation.
12 + */
13 +#ifndef _DIRENT_H_
14 +#define _DIRENT_H_
15 +#include <io.h>
16 +
17 +#define PATH_MAX 512
18 +
19 +#define __MINGW_NOTHROW
20 +
21 +#ifndef RC_INVOKED
22 +
23 +#ifdef __cplusplus
24 +extern "C" {
25 +#endif
26 +
27 +struct dirent
28 +{
29 + long d_ino; /* Always zero. */
30 + unsigned short d_reclen; /* Always zero. */
31 + unsigned short d_namlen; /* Length of name in d_name. */
32 + char d_name[FILENAME_MAX]; /* File name. */
33 +};
34 +
35 +/*
36 + * This is an internal data structure. Good programmers will not use it
37 + * except as an argument to one of the functions below.
38 + * dd_stat field is now int (was short in older versions).
39 + */
40 +typedef struct
41 +{
42 + /* disk transfer area for this dir */
43 + struct _finddata_t dd_dta;
44 +
45 + /* dirent struct to return from dir (NOTE: this makes this thread
46 + * safe as long as only one thread uses a particular DIR struct at
47 + * a time) */
48 + struct dirent dd_dir;
49 +
50 + /* _findnext handle */
51 + long dd_handle;
52 +
53 + /*
54 + * Status of search:
55 + * 0 = not started yet (next entry to read is first entry)
56 + * -1 = off the end
57 + * positive = 0 based index of next entry
58 + */
59 + int dd_stat;
60 +
61 + /* given path for dir with search pattern (struct is extended) */
62 + char dd_name[PATH_MAX+3];
63 +} DIR;
64 +
65 +DIR* __cdecl __MINGW_NOTHROW opendir (const char*);
66 +struct dirent* __cdecl __MINGW_NOTHROW readdir (DIR*);
67 +int __cdecl __MINGW_NOTHROW closedir (DIR*);
68 +void __cdecl __MINGW_NOTHROW rewinddir (DIR*);
69 +long __cdecl __MINGW_NOTHROW telldir (DIR*);
70 +void __cdecl __MINGW_NOTHROW seekdir (DIR*, long);
71 +
72 +
73 +/* wide char versions */
74 +
75 +struct _wdirent
76 +{
77 + long d_ino; /* Always zero. */
78 + unsigned short d_reclen; /* Always zero. */
79 + unsigned short d_namlen; /* Length of name in d_name. */
80 + wchar_t d_name[FILENAME_MAX]; /* File name. */
81 +};
82 +
83 +/*
84 + * This is an internal data structure. Good programmers will not use it
85 + * except as an argument to one of the functions below.
86 + */
87 +typedef struct
88 +{
89 + /* disk transfer area for this dir */
90 + //struct _wfinddata_t dd_dta;
91 +
92 + /* dirent struct to return from dir (NOTE: this makes this thread
93 + * safe as long as only one thread uses a particular DIR struct at
94 + * a time) */
95 + struct _wdirent dd_dir;
96 +
97 + /* _findnext handle */
98 + long dd_handle;
99 +
100 + /*
101 + * Status of search:
102 + * 0 = not started yet (next entry to read is first entry)
103 + * -1 = off the end
104 + * positive = 0 based index of next entry
105 + */
106 + int dd_stat;
107 +
108 + /* given path for dir with search pattern (struct is extended) */
109 + wchar_t dd_name[1];
110 +} _WDIR;
111 +
112 +
113 +
114 +_WDIR* __cdecl __MINGW_NOTHROW _wopendir (const wchar_t*);
115 +struct _wdirent* __cdecl __MINGW_NOTHROW _wreaddir (_WDIR*);
116 +int __cdecl __MINGW_NOTHROW _wclosedir (_WDIR*);
117 +void __cdecl __MINGW_NOTHROW _wrewinddir (_WDIR*);
118 +long __cdecl __MINGW_NOTHROW _wtelldir (_WDIR*);
119 +void __cdecl __MINGW_NOTHROW _wseekdir (_WDIR*, long);
120 +
121 +
122 +#ifdef __cplusplus
123 +}
124 +#endif
125 +
126 +#endif /* Not RC_INVOKED */
127 +
128 +#endif /* Not _DIRENT_H_ */
compat/vcbuild/include/sys/utime.h new
+34
@@ -0,0 +1,34 @@
1 +#ifndef _UTIME_H_
2 +#define _UTIME_H_
3 +/*
4 + * UTIME.H
5 + * This file has no copyright assigned and is placed in the Public Domain.
6 + * This file is a part of the mingw-runtime package.
7 + *
8 + * The mingw-runtime package and its code is distributed in the hope that it
9 + * will be useful but WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESSED OR
10 + * IMPLIED ARE HEREBY DISCLAIMED. This includes but is not limited to
11 + * warranties of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12 + *
13 + * You are free to use this package and its code without limitation.
14 + */
15 +
16 +/*
17 + * Structure used by _utime function.
18 + */
19 +struct _utimbuf
20 +{
21 + time_t actime; /* Access time */
22 + time_t modtime; /* Modification time */
23 +};
24 +
25 +#ifndef _NO_OLDNAMES
26 +/* NOTE: Must be the same as _utimbuf above. */
27 +struct utimbuf
28 +{
29 + time_t actime;
30 + time_t modtime;
31 +};
32 +#endif /* Not _NO_OLDNAMES */
33 +
34 +#endif
compat/vcbuild/include/unistd.h new
+92
@@ -0,0 +1,92 @@
1 +#ifndef _UNISTD_
2 +#define _UNISTD_
3 +
4 +/* Win32 define for porting git*/
5 +
6 +#ifndef _MODE_T_
7 +#define _MODE_T_
8 +typedef unsigned short _mode_t;
9 +
10 +#ifndef _NO_OLDNAMES
11 +typedef _mode_t mode_t;
12 +#endif
13 +#endif /* Not _MODE_T_ */
14 +
15 +#ifndef _SSIZE_T_
16 +#define _SSIZE_T_
17 +typedef long _ssize_t;
18 +
19 +#ifndef _OFF_T_
20 +#define _OFF_T_
21 +typedef long _off_t;
22 +
23 +#ifndef _NO_OLDNAMES
24 +typedef _off_t off_t;
25 +#endif
26 +#endif /* Not _OFF_T_ */
27 +
28 +
29 +#ifndef _NO_OLDNAMES
30 +typedef _ssize_t ssize_t;
31 +#endif
32 +#endif /* Not _SSIZE_T_ */
33 +
34 +typedef signed char int8_t;
35 +typedef unsigned char uint8_t;
36 +typedef short int16_t;
37 +typedef unsigned short uint16_t;
38 +typedef int int32_t;
39 +typedef unsigned uint32_t;
40 +typedef long long int64_t;
41 +typedef unsigned long long uint64_t;
42 +
43 +typedef long long intmax_t;
44 +typedef unsigned long long uintmax_t;
45 +
46 +typedef int64_t off64_t;
47 +
48 +#define STDOUT_FILENO 1
49 +#define STDERR_FILENO 2
50 +
51 +/* Some defines for _access nAccessMode (MS doesn't define them, but
52 + * it doesn't seem to hurt to add them). */
53 +#define F_OK 0 /* Check for file existence */
54 +/* Well maybe it does hurt. On newer versions of MSVCRT, an access mode
55 + of 1 causes invalid parameter error. */
56 +#define X_OK 0 /* MS access() doesn't check for execute permission. */
57 +#define W_OK 2 /* Check for write permission */
58 +#define R_OK 4 /* Check for read permission */
59 +
60 +#define _S_IFIFO 0x1000 /* FIFO */
61 +#define _S_IFCHR 0x2000 /* Character */
62 +#define _S_IFBLK 0x3000 /* Block: Is this ever set under w32? */
63 +#define _S_IFDIR 0x4000 /* Directory */
64 +#define _S_IFREG 0x8000 /* Regular */
65 +
66 +#define _S_IFMT 0xF000 /* File type mask */
67 +
68 +#define _S_IXUSR _S_IEXEC
69 +#define _S_IWUSR _S_IWRITE
70 +#define _S_IRUSR _S_IREAD
71 +#define _S_ISDIR(m) (((m) & _S_IFMT) == _S_IFDIR)
72 +
73 +#define S_IFIFO _S_IFIFO
74 +#define S_IFCHR _S_IFCHR
75 +#define S_IFBLK _S_IFBLK
76 +#define S_IFDIR _S_IFDIR
77 +#define S_IFREG _S_IFREG
78 +#define S_IFMT _S_IFMT
79 +#define S_IEXEC _S_IEXEC
80 +#define S_IWRITE _S_IWRITE
81 +#define S_IREAD _S_IREAD
82 +#define S_IRWXU _S_IRWXU
83 +#define S_IXUSR _S_IXUSR
84 +#define S_IWUSR _S_IWUSR
85 +#define S_IRUSR _S_IRUSR
86 +
87 +
88 +#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
89 +#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
90 +#define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO)
91 +
92 +#endif
compat/vcbuild/include/utime.h new
+1
@@ -0,0 +1 @@
1 +#include <sys/utime.h>