diff options
author | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-04-06 09:23:12 +0000 |
---|---|---|
committer | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-04-06 09:23:12 +0000 |
commit | b4fde0cf29d17f951cc51fe014d8fb877ab9f47f (patch) | |
tree | 6b7e25930e8254d2db9568b0aa6ac5b49373b92d /gcc/ada/s-crtl.ads | |
parent | e9553e01b9b3f21919d925a3552f70cc0f25e435 (diff) | |
download | gcc-b4fde0cf29d17f951cc51fe014d8fb877ab9f47f.tar.gz |
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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@123578 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/s-crtl.ads')
-rw-r--r-- | gcc/ada/s-crtl.ads | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/gcc/ada/s-crtl.ads b/gcc/ada/s-crtl.ads index 53977768c5d..30bca62c455 100644 --- a/gcc/ada/s-crtl.ads +++ b/gcc/ada/s-crtl.ads @@ -57,6 +57,11 @@ package System.CRTL is type size_t is mod 2 ** Standard'Address_Size; + type Filename_Encoding is (UTF8, ASCII_8bits); + for Filename_Encoding use (UTF8 => 0, ASCII_8bits => 1); + pragma Convention (C, Filename_Encoding); + -- Describes the filename's encoding + function atoi (A : System.Address) return Integer; pragma Import (C, atoi, "atoi"); @@ -84,7 +89,10 @@ package System.CRTL is function fgets (strng : chars; n : int; stream : FILEs) return chars; pragma Import (C, fgets, "fgets"); - function fopen (filename : chars; Mode : chars) return FILEs; + function fopen + (filename : chars; + mode : chars; + encoding : Filename_Encoding := UTF8) return FILEs; pragma Import (C, fopen, "__gnat_fopen"); function fputc (C : int; stream : FILEs) return int; @@ -99,8 +107,8 @@ package System.CRTL is function freopen (filename : chars; mode : chars; - stream : FILEs) - return FILEs; + stream : FILEs; + encoding : Filename_Encoding := UTF8) return FILEs; pragma Import (C, freopen, "__gnat_freopen"); function fseek @@ -175,4 +183,5 @@ package System.CRTL is function write (fd : int; buffer : chars; nbytes : int) return int; pragma Import (C, write, "write"); + end System.CRTL; |