From 18f2c4608d3bd85f19aef3068357f1c8fbe098b5 Mon Sep 17 00:00:00 2001 From: Pascal Obry Date: Fri, 18 Jul 2014 10:56:54 +0000 Subject: a-textio.adb: Rename Is_Text_File to Text_Encoding. 2014-07-18 Pascal Obry * a-textio.adb: Rename Is_Text_File to Text_Encoding. * a-ztexio.adb: Likewise. * a-witeio.adb: Likewise. (Open): Pass file's translation mode to set_text_mode. * s-ficobl.ads (Content_Encoding): New type. (Text_Content_Encoding): New subtype. (AFCB): Rename Is_Text_File to Text_Encoding. * s-fileio.adb (Open): Handles new text_translation values. Remove Is_Text_File which is equivalent to Text_Encoding in Text_Content_Encoding. * adaint.h (__gnat_set_mode): New routine. * sysdep.c (__gnat_set_wide_text_mode): Removed. (__gnat_set_mode): New routine. From-SVN: r212810 --- gcc/ada/sysdep.c | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) (limited to 'gcc/ada/sysdep.c') diff --git a/gcc/ada/sysdep.c b/gcc/ada/sysdep.c index 693fec2..e2187e7 100644 --- a/gcc/ada/sysdep.c +++ b/gcc/ada/sysdep.c @@ -152,9 +152,26 @@ __gnat_set_text_mode (int handle) } void -__gnat_set_wide_text_mode (int handle) +__gnat_set_mode (int handle, int mode) { - WIN_SETMODE (handle, CurrentCCSEncoding); + /* the values here must be synchronized with + System.File_Control_Block.Content_Encodding: + + None = 0 + Default_Text = 1 + Text = 2 + U8text = 3 + Wtext = 4 + U16text = 5 */ + + switch (mode) { + case 0 : WIN_SETMODE (handle, _O_BINARY); break; + case 1 : WIN_SETMODE (handle, CurrentCCSEncoding); break; + case 2 : WIN_SETMODE (handle, _O_TEXT); break; + case 3 : WIN_SETMODE (handle, _O_U8TEXT); break; + case 4 : WIN_SETMODE (handle, _O_WTEXT); break; + case 5 : WIN_SETMODE (handle, _O_U16TEXT); break; + } } #ifdef __CYGWIN__ @@ -254,7 +271,7 @@ __gnat_set_text_mode (int handle ATTRIBUTE_UNUSED) } void -__gnat_set_wide_text_mode (int handle ATTRIBUTE_UNUSED) +__gnat_set_mode (int handle ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED) { } -- cgit v1.1