diff options
author | Pascal Obry <obry@adacore.com> | 2006-02-15 10:30:39 +0100 |
---|---|---|
committer | Arnaud Charlet <charlet@gcc.gnu.org> | 2006-02-15 10:30:39 +0100 |
commit | 0022d9e31d01f2a31808ff38f66dd3e3ac96927a (patch) | |
tree | ff53725d708aacac9be1a454735ad7f7bd86d8f1 /gcc/ada/mingw32.h | |
parent | 4f37ea7d5f6ff5a77db8895034a682ff996b8bed (diff) | |
download | gcc-0022d9e31d01f2a31808ff38f66dd3e3ac96927a.tar.gz |
adaint.h, adaint.c (DIR_SEPARATOR): Use _T() macro for Unicode support.
2006-02-13 Pascal Obry <obry@adacore.com>
Nicolas Roche <roche@adacore.com>
Arnaud Charlet <charlet@adacore.com>
* adaint.h, adaint.c (DIR_SEPARATOR): Use _T() macro for Unicode
support.
(__gnat_try_lock): Add unicode support by using a specific section on
Windows.
(__gnat_get_current_dir): Idem.
(__gnat_open_read): Idem.
(__gnat_open_rw): Idem.
(__gnat_open_create): Idem.
(__gnat_create_output_file): Idem.
(__gnat_open_append): Idem.
(__gnat_open_new): Idem.
(__gnat_file_time_name): Idem.
(__gnat_set_file_time_name): Idem.
(__gnat_stat): Idem.
(win32_no_block_spawn): Idem.
(__gnat_locate_exec_on_path): Idem.
(__gnat_opendir): New routine.
(__gnat_closedir): Idem.
(__gnat_readdir): Add new parameter length (pointer to int). Update
implementation to use it and add specific Win32 code for Unicode
support.
(__gnat_get_env_value_ptr): Remove. Replaced by __gnat_getenv in env.c
(__gnat_set_env_value): Remove. Replaced by __gnat_setenv in env.c
(convert_addresses): Do not define this dummy routine on VMS.
* mingw32.h (GNAT_UNICODE_SUPPORT): New definition, if set the GNAT
runtime Unicode support will be activated.
(S2WS): String to Wide-String conversion. This version just copy a
string in non Unicode version.
(WS2S): Wide-String to String conversion. This version just copy a
string in non Unicode version.
* g-dirope.adb: (Close): Now import __gnat_closedir from adaint.c.
(Open): Now import __gnat_opendir from adaint.c.
(Read): Change the implementation to support unicode characters. It is
not possible to use strlen() on Windows as this version supports only
standard ASCII characters. So the length of the directory entry is now
returned from the imported __gnat_readdir routine.
Update copyright notice.
* s-crtl-vms64.ads, s-crtl.ads: (closedir): Moved to adaint.c.
(opendir): Moved to adaint.c.
* g-os_lib.adb (Copy_Time_Stamp): Fix off-by-one range computation.
(Get_Directory): Fix wrong indexing.
(Getenv): replace __gnat_get_env_value_ptr from adaint.c by
__gnat_getenv from env.c
(Setenv): replace __gnat_set_env_value from adaint.c by __gnat_setenv
from env.c
* env.h, env.c: New file.
* s-scaval.adb (Initialize): Replace __gnat_get_env_value_ptr from
adaint.c by __gnat_getenv from env.c
* s-shasto.adb (Initialize): replace __gnat_get_env_value_ptr from
adaint.c by __gnat_getenv from env.c
* Make-lang.in: Add env.o in the list of C object needed by gnat1
and gnatbind.
Update dependencies.
From-SVN: r111029
Diffstat (limited to 'gcc/ada/mingw32.h')
-rw-r--r-- | gcc/ada/mingw32.h | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/gcc/ada/mingw32.h b/gcc/ada/mingw32.h index 81bfc30d4a0..79d70d77790 100644 --- a/gcc/ada/mingw32.h +++ b/gcc/ada/mingw32.h @@ -6,7 +6,7 @@ * * * C Header File * * * - * Copyright (C) 2002-2004, Free Software Foundation, Inc. * + * Copyright (C) 2002-2006, Free Software Foundation, Inc. * * * * GNAT is free software; you can redistribute it and/or modify it under * * terms of the GNU General Public License as published by the Free Soft- * @@ -36,6 +36,35 @@ #ifndef _MINGW32_H #define _MINGW32_H + + +/* Uncomment to activate the GNAT Unicode support. */ +/*#define GNAT_UNICODE_SUPPORT */ + +#ifdef GNAT_UNICODE_SUPPORT +#define _UNICODE /* For C runtime */ +#define UNICODE /* For Win32 API */ +#endif + +#include <tchar.h> + +/* After including this file it is possible to use the character t as prefix + to routines. If GNAT_UNICODE_SUPPORT is defined then the unicode enabled + versions will be used. */ + +/* Copy to/from wide-string, if GNAT_UNICODE_SUPPORT activated this will do + the proper translations using the UTF-8 encoding. */ + +#ifdef GNAT_UNICODE_SUPPORT +#define S2WS(wstr,str,len) \ + MultiByteToWideChar (CP_UTF8,0,str,-1,wstr,len); +#define WS2S(str,wstr,len) \ + WideCharToMultiByte (CP_UTF8,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); +#endif + #include <stdlib.h> /* STD_MINGW: standard if MINGW32 version > 1.3, we have switched to this |