MATCH: Improve `A CMP 0 ? A : -A` set of patterns to use bitwise_equal_p.
[official-gcc.git] / gcc / ada / mingw32.h
blob31a3e1f4f28579d322dd54b7b4cdf08302ecf940
1 /****************************************************************************
2 * *
3 * GNAT COMPILER COMPONENTS *
4 * *
5 * M I N G W 3 2 *
6 * *
7 * C Header File *
8 * *
9 * Copyright (C) 2002-2023, Free Software Foundation, Inc. *
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- *
13 * ware Foundation; either version 3, or (at your option) any later ver- *
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 *
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/>. *
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 ****************************************************************************/
32 /* This file provides some macros used for the MINGW32 platform. The main
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. */
36 #ifndef _MINGW32_H
37 #define _MINGW32_H
39 #include <_mingw.h>
41 #ifndef RTX
42 #define GNAT_UNICODE_SUPPORT
43 #define _UNICODE /* For C runtime */
44 #define UNICODE /* For Win32 API */
45 #endif
47 #ifndef __CYGWIN__
48 #include <tchar.h>
49 #endif
50 #if defined (__CYGWIN__) && !defined (__CYGWIN32__) && !defined (IN_RTS)
51 /* Note: windows.h on cygwin-64 includes x86intrin.h which uses malloc.
52 That fails to compile, if malloc is poisoned, i.e. if !IN_RTS. */
53 #define _X86INTRIN_H_INCLUDED
54 #define _EMMINTRIN_H_INCLUDED
55 #endif
56 #define WIN32_LEAN_AND_MEAN
57 #include <windows.h>
59 /* After including this file it is possible to use the character t as prefix
60 to routines. If GNAT_UNICODE_SUPPORT is defined then the unicode enabled
61 versions will be used. */
63 /* Copy to/from wide-string, if GNAT_UNICODE_SUPPORT activated this will do
64 the proper translations using the UTF-8 encoding. */
66 #ifdef GNAT_UNICODE_SUPPORT
68 extern UINT __gnat_current_codepage;
69 extern UINT __gnat_current_ccs_encoding;
71 /* Macros to convert to/from the code page specified in
72 __gnat_current_codepage. */
73 #define S2WSC(wstr,str,len) \
74 MultiByteToWideChar (__gnat_current_codepage,0,str,-1,wstr,len)
75 #define WS2SC(str,wstr,len) \
76 WideCharToMultiByte (__gnat_current_codepage,0,wstr,-1,str,len,NULL,NULL)
78 /* Macros to convert to/from UTF-8 code page. */
79 #define S2WSU(wstr,str,len) \
80 MultiByteToWideChar (CP_UTF8,0,str,-1,wstr,len)
81 #define WS2SU(str,wstr,len) \
82 WideCharToMultiByte (CP_UTF8,0,wstr,-1,str,len,NULL,NULL)
84 /* Macros to convert to/from Windows default code page. */
85 #define S2WS(wstr,str,len) \
86 MultiByteToWideChar (CP_ACP,0,str,-1,wstr,len)
87 #define WS2S(str,wstr,len) \
88 WideCharToMultiByte (CP_ACP,0,wstr,-1,str,len,NULL,NULL)
89 #else
90 #define S2WSC(wstr,str,len) strncpy(wstr,str,len)
91 #define WS2SC(str,wstr,len) strncpy(str,wstr,len)
92 #define S2WSU(wstr,str,len) strncpy(wstr,str,len)
93 #define WS2SU(str,wstr,len) strncpy(str,wstr,len)
94 #define S2WS(wstr,str,len) strncpy(wstr,str,len)
95 #define WS2S(str,wstr,len) strncpy(str,wstr,len)
96 #endif
98 #endif /* _MINGW32_H */