]> gcc.gnu.org Git - gcc.git/blame - gcc/ada/mingw32.h
ada: Deconstruct build support for ancient MinGW
[gcc.git] / gcc / ada / mingw32.h
CommitLineData
65f1ebd1
AC
1/****************************************************************************
2 * *
3 * GNAT COMPILER COMPONENTS *
4 * *
5 * M I N G W 3 2 *
6 * *
7 * C Header File *
8 * *
bc0b26b9 9 * Copyright (C) 2002-2022, Free Software Foundation, Inc. *
65f1ebd1
AC
10 * *
11 * GNAT is free software; you can redistribute it and/or modify it under *
12 * terms of the GNU General Public License as published by the Free Soft- *
748086b7 13 * ware Foundation; either version 3, or (at your option) any later ver- *
65f1ebd1
AC
14 * sion. GNAT is distributed in the hope that it will be useful, but WITH- *
15 * OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *
748086b7
JJ
16 * or FITNESS FOR A PARTICULAR PURPOSE. *
17 * *
18 * As a special exception under Section 7 of GPL version 3, you are granted *
19 * additional permissions described in the GCC Runtime Library Exception, *
20 * version 3.1, as published by the Free Software Foundation. *
21 * *
22 * You should have received a copy of the GNU General Public License and *
23 * a copy of the GCC Runtime Library Exception along with this program; *
24 * see the files COPYING3 and COPYING.RUNTIME respectively. If not, see *
25 * <http://www.gnu.org/licenses/>. *
65f1ebd1
AC
26 * *
27 * GNAT was originally developed by the GNAT team at New York University. *
28 * Extensive contributions were provided by Ada Core Technologies Inc. *
29 * *
30 ****************************************************************************/
31
32/* This file provides some macros used for the MINGW32 platform. The main
18f22284
PO
33 goal is to be able to build GNAT with a standard MINGW32 C header
34 set. This files contains also the circuitry for the unicode support. */
65f1ebd1
AC
35
36#ifndef _MINGW32_H
37#define _MINGW32_H
38
0816e70c
AC
39#include <_mingw.h>
40
e7fceebc 41#ifndef RTX
18f22284 42#define GNAT_UNICODE_SUPPORT
0022d9e3
PO
43#define _UNICODE /* For C runtime */
44#define UNICODE /* For Win32 API */
45#endif
46
75069667 47/* We need functionality available only starting with Windows XP */
0816e70c 48#ifndef _WIN32_WINNT
75069667 49#define _WIN32_WINNT 0x0501
0816e70c 50#endif
75069667 51
29c38396 52#ifndef __CYGWIN__
0022d9e3 53#include <tchar.h>
29c38396 54#endif
7e8338d8
BE
55#if defined (__CYGWIN__) && !defined (__CYGWIN32__) && !defined (IN_RTS)
56/* Note: windows.h on cygwin-64 includes x86intrin.h which uses malloc.
57 That fails to compile, if malloc is poisoned, i.e. if !IN_RTS. */
58#define _X86INTRIN_H_INCLUDED
cc7e4de9 59#define _EMMINTRIN_H_INCLUDED
7e8338d8 60#endif
ffec8e81 61#include <windows.h>
0022d9e3
PO
62
63/* After including this file it is possible to use the character t as prefix
64 to routines. If GNAT_UNICODE_SUPPORT is defined then the unicode enabled
18f22284 65 versions will be used. */
0022d9e3
PO
66
67/* Copy to/from wide-string, if GNAT_UNICODE_SUPPORT activated this will do
68 the proper translations using the UTF-8 encoding. */
69
70#ifdef GNAT_UNICODE_SUPPORT
ffec8e81 71
ca0eb951
AC
72extern UINT __gnat_current_codepage;
73extern UINT __gnat_current_ccs_encoding;
ffec8e81 74
ca0eb951
AC
75/* Macros to convert to/from the code page specified in
76 __gnat_current_codepage. */
ffec8e81 77#define S2WSC(wstr,str,len) \
ca0eb951 78 MultiByteToWideChar (__gnat_current_codepage,0,str,-1,wstr,len)
ffec8e81 79#define WS2SC(str,wstr,len) \
ca0eb951 80 WideCharToMultiByte (__gnat_current_codepage,0,wstr,-1,str,len,NULL,NULL)
ffec8e81
AC
81
82/* Macros to convert to/from UTF-8 code page. */
0ee30464
PO
83#define S2WSU(wstr,str,len) \
84 MultiByteToWideChar (CP_UTF8,0,str,-1,wstr,len)
85#define WS2SU(str,wstr,len) \
86 WideCharToMultiByte (CP_UTF8,0,wstr,-1,str,len,NULL,NULL)
ffec8e81
AC
87
88/* Macros to convert to/from Windows default code page. */
0022d9e3 89#define S2WS(wstr,str,len) \
0ee30464 90 MultiByteToWideChar (CP_ACP,0,str,-1,wstr,len)
0022d9e3 91#define WS2S(str,wstr,len) \
0ee30464 92 WideCharToMultiByte (CP_ACP,0,wstr,-1,str,len,NULL,NULL)
0022d9e3 93#else
46e26fe3
PO
94#define S2WSC(wstr,str,len) strncpy(wstr,str,len)
95#define WS2SC(str,wstr,len) strncpy(str,wstr,len)
0ee30464
PO
96#define S2WSU(wstr,str,len) strncpy(wstr,str,len)
97#define WS2SU(str,wstr,len) strncpy(str,wstr,len)
98#define S2WS(wstr,str,len) strncpy(wstr,str,len)
99#define WS2S(str,wstr,len) strncpy(str,wstr,len)
0022d9e3
PO
100#endif
101
65f1ebd1
AC
102#include <stdlib.h>
103
aa75e737 104#ifndef MAXPATHLEN
65f1ebd1 105#define MAXPATHLEN MAX_PATH
aa75e737 106#endif
65f1ebd1
AC
107
108#endif /* _MINGW32_H */
This page took 5.448171 seconds and 5 git commands to generate.