| 1 |
/* mingw32.h: declarations for mingw32. |
| 2 |
|
| 3 |
Copyright 2009-2016 Taco Hoekwater <[email protected]>. |
| 4 |
|
| 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. |
| 9 |
|
| 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. |
| 14 |
|
| 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/>. */ |
| 17 |
|
| 18 |
#ifndef _MINGW32_H_ |
| 19 |
#define _MINGW32_H_ |
| 20 |
|
| 21 |
/* We need GetLongPathName and perhaps others. */ |
| 22 |
#if !defined WINVER || WINVER < 0x0500 |
| 23 |
#undef WINVER |
| 24 |
#define WINVER 0x0500 |
| 25 |
#endif |
| 26 |
|
| 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> |
| 44 |
|
| 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 |
| 53 |
|
| 54 |
#ifndef MAXPATHLEN |
| 55 |
#define MAXPATHLEN _MAX_PATH |
| 56 |
#endif |
| 57 |
|
| 58 |
#ifndef MAX_PIPES |
| 59 |
#define MAX_PIPES 128 |
| 60 |
#endif |
| 61 |
|
| 62 |
#ifdef __cplusplus |
| 63 |
extern "C" { |
| 64 |
#endif |
| 65 |
|
| 66 |
#ifdef MAKE_KPSE_DLL /* libkpathsea internal only */ |
| 67 |
|
| 68 |
extern void init_user_info (void); |
| 69 |
extern BOOL look_for_cmd (const char *, char **); |
| 70 |
extern char *quote_args(char **); |
| 71 |
|
| 72 |
#endif /* MAKE_KPSE_DLL */ |
| 73 |
|
| 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); |
| 77 |
|
| 78 |
static inline FILE * |
| 79 |
win32_popen (const char *command, const char *fmode) |
| 80 |
{ |
| 81 |
char mode[3]; |
| 82 |
|
| 83 |
/* We always use binary mode */ |
| 84 |
mode[0] = fmode[0]; |
| 85 |
mode[1] = 'b'; |
| 86 |
mode[2] = '\0'; |
| 87 |
|
| 88 |
return _popen (command, mode); |
| 89 |
} |
| 90 |
#undef popen |
| 91 |
#define popen(cmd, mode) win32_popen(cmd, mode) |
| 92 |
|
| 93 |
#ifdef __cplusplus |
| 94 |
} |
| 95 |
#endif |
| 96 |
|
| 97 |
#endif |