aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/mingw32.h
diff options
context:
space:
mode:
authorPascal Obry <obry@adacore.com>2007-04-06 11:23:12 +0200
committerArnaud Charlet <charlet@gcc.gnu.org>2007-04-06 11:23:12 +0200
commit0ee3046437815605b29af1b39aa17596286078ca (patch)
tree6b7e25930e8254d2db9568b0aa6ac5b49373b92d /gcc/ada/mingw32.h
parent5bdd76e8810d20d8f033c61c83045560f8942163 (diff)
downloadgcc-0ee3046437815605b29af1b39aa17596286078ca.zip
gcc-0ee3046437815605b29af1b39aa17596286078ca.tar.gz
gcc-0ee3046437815605b29af1b39aa17596286078ca.tar.bz2
i-cstrea.ads: (fopen): Add encoding parameter.
2007-04-06 Pascal Obry <obry@adacore.com> * i-cstrea.ads: (fopen): Add encoding parameter. (freopen): Idem. Change reference from a-sysdep.c to sysdep.c in comment. Update copyright notice. This set of patch add support for the encoding form parameter. * mingw32.h (S2WSU): New macro to convert from a string to a wide-string using the UTF-8 encoding. The S2WS macro supports now only standard 8bits encoding. (WS2SU): As above but converting from wide-sring to string. This is needed as it is necessary to have access to both versions in the runtime for the form parameter encoding support. This set of patch add support for the encoding form parameter. (S2WS): Improve implementation to handle cases where the filename is not UTF-8 encoded. In this case we default to using the current code page for the conversion. * s-crtl-vms64.ads, s-crtl.ads (Filename_Encoding): New enumeration type (UTF8, ASCII_8bits). This enumeration has a rep clause to match the constants defined in adaint.h. (fopen): Add encoding parameter. (freopen): Idem. * s-ficobl.ads (AFCB): Add Encoding field to record the filename encoding. This is needed for the Reset routine (freopen low level-call). * s-fileio.adb (Open): Decode encoding form parameter and set the corresponding encoding value into AFCB structure. (Reset): Pass the encoding value to freopen. (Close): Move the call to Lock_Task to the beginning of the procedure. From-SVN: r123578
Diffstat (limited to 'gcc/ada/mingw32.h')
-rw-r--r--gcc/ada/mingw32.h14
1 files changed, 10 insertions, 4 deletions
diff --git a/gcc/ada/mingw32.h b/gcc/ada/mingw32.h
index 7b63531..6637fd1 100644
--- a/gcc/ada/mingw32.h
+++ b/gcc/ada/mingw32.h
@@ -71,13 +71,19 @@
the proper translations using the UTF-8 encoding. */
#ifdef GNAT_UNICODE_SUPPORT
+#define S2WSU(wstr,str,len) \
+ MultiByteToWideChar (CP_UTF8,0,str,-1,wstr,len)
+#define WS2SU(str,wstr,len) \
+ WideCharToMultiByte (CP_UTF8,0,wstr,-1,str,len,NULL,NULL)
#define S2WS(wstr,str,len) \
- MultiByteToWideChar (CP_UTF8,0,str,-1,wstr,len);
+ MultiByteToWideChar (CP_ACP,0,str,-1,wstr,len)
#define WS2S(str,wstr,len) \
- WideCharToMultiByte (CP_UTF8,0,wstr,-1,str,len,NULL,NULL);
+ WideCharToMultiByte (CP_ACP,0,wstr,-1,str,len,NULL,NULL)
#else
-#define S2WS(wstr,str,len) strncpy(wstr,str,len);
-#define WS2S(str,wstr,len) strncpy(str,wstr,len);
+#define S2WSU(wstr,str,len) strncpy(wstr,str,len)
+#define WS2SU(str,wstr,len) strncpy(str,wstr,len)
+#define S2WS(wstr,str,len) strncpy(wstr,str,len)
+#define WS2S(str,wstr,len) strncpy(str,wstr,len)
#endif
#include <stdlib.h>