beta-0.89.2
[luatex.git] / source / texk / kpathsea / mingw32.h
blob8db9c135f252cf4c43927231bec0ec70248b4744
1 /* mingw32.h: declarations for mingw32.
3 Copyright 2009-2014 Taco Hoekwater <taco@luatex.org>.
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public License
16 along with this library; if not, see <http://www.gnu.org/licenses/>. */
18 #ifndef _MINGW32_H_
19 #define _MINGW32_H_
21 /* We need GetLongPathName and perhaps others. */
22 #if !defined WINVER || WINVER < 0x0500
23 #undef WINVER
24 #define WINVER 0x0500
25 #endif
27 #include <stdlib.h>
28 /* The embedded rndnpc.h defines boolean as 'unsigned char',
29 and we do not want that.
30 This should be safe as long as we don't use npc ourselves. */
31 #define boolean saved_boolean
32 /* With WINVER >= 0x0403 winuser.h declares INPUT as `struct tagINPUT`,
33 and we do not want that. */
34 #define INPUT saved_INPUT
35 #include <windows.h>
36 #include <winerror.h>
37 #include <winnt.h>
38 #undef boolean
39 #undef INPUT
40 #include <dirent.h>
41 #include <direct.h>
42 #include <fcntl.h>
43 #include <ctype.h>
45 /* sys/types.h defines off_t as `long' and we do not want that.
46 We need to include unistd.h and sys/stat.h using off_t
47 before defining off_t (no need to include wchar.h). */
48 #include <unistd.h>
49 #include <sys/stat.h>
50 #define off_t off64_t
51 #define ftello ftello64
52 #define fseeko fseeko64
54 #ifndef MAXPATHLEN
55 #define MAXPATHLEN _MAX_PATH
56 #endif
58 #ifndef MAX_PIPES
59 #define MAX_PIPES 128
60 #endif
62 #ifdef __cplusplus
63 extern "C" {
64 #endif
66 #ifdef MAKE_KPSE_DLL /* libkpathsea internal only */
68 extern void init_user_info (void);
69 extern BOOL look_for_cmd (const char *, char **);
70 extern char *quote_args(char **);
72 #endif /* MAKE_KPSE_DLL */
74 extern KPSEDLL BOOL win32_get_long_filename (char *, char *, int);
75 extern KPSEDLL void texlive_gs_init (void);
76 extern KPSEDLL double win32_floor (double);
78 static inline FILE *
79 win32_popen (const char *command, const char *fmode)
81 char mode[3];
83 /* We always use binary mode */
84 mode[0] = fmode[0];
85 mode[1] = 'b';
86 mode[2] = '\0';
88 return _popen (command, mode);
90 #undef popen
91 #define popen(cmd, mode) win32_popen(cmd, mode)
93 #ifdef __cplusplus
95 #endif
97 #endif