diff options
author | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-12-13 10:20:52 +0000 |
---|---|---|
committer | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-12-13 10:20:52 +0000 |
commit | d03308df6e185f691bb854d38e1e3b3a8198ce1a (patch) | |
tree | 1c8e06d9a692908c2062d3287c702c32b03ea3e4 /gcc/ada/a-textio.ads | |
parent | 51f168eb1338af75aff54518b52f8dd577014060 (diff) | |
download | gcc-d03308df6e185f691bb854d38e1e3b3a8198ce1a.tar.gz |
2007-12-06 Robert Dewar <dewar@adacore.com>
* a-textio.adb, a-textio.ads:
Extensive changes to private part for wide character encoding
* a-witeio.ads, a-witeio.adb, a-ztexio.ads, a-ztexio.adb
(Look_Ahead): Fix mishandling of encoded sequences
Move declaration of Wch_Con to private part (should not be visible)
* ali.adb (Scan_ALI): Set default encoding method to brackets instead of
UTF-8. Probably this is never used, but if it is, brackets is
clearly correct.
* bindgen.adb (Get_WC_Encoding): New procedure to properly handle
setting wide character encoding for no main program case and when
encoding is specified using -W?
Initialize stack limit of environment task if stack limit method of
stack checking is enabled.
(Gen_Adainit_Ada): Use Get_WC_Encoding to output encoding method
(Gen_Adainit_C): Use Get_WC_Encoding to output encoding method
(Get_Main_Unit_Name): New function.
(Gen_Adainit_Ada): Add call to main program for .NET when needed.
(Gen_Output_File): Set Bind_Main_Program to True for .NET
* bindusg.adb: Add line for -Wx switch
* s-wchcon.adb, s-wchcon.ads: (Is_Start_Of_Encoding): New function
Add comments
Add new useful constant WC_Longest_Sequences
* switch-b.adb: Clean up handling of -Wx switch
For -gnatWx, set Wide_Character_Encoding_Method_Specified
* switch-c.adb: -gnatg activates warning on assertion errors
For -gnatWx, set Wide_Character_Encoding_Method_Specified
* s-wchcon.adb: (Is_Start_Of_Encoding): New function
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@130817 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/a-textio.ads')
-rw-r--r-- | gcc/ada/a-textio.ads | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/gcc/ada/a-textio.ads b/gcc/ada/a-textio.ads index 38b4cb178ea..8e3926479d5 100644 --- a/gcc/ada/a-textio.ads +++ b/gcc/ada/a-textio.ads @@ -45,6 +45,7 @@ with Ada.IO_Exceptions; with Ada.Streams; with System; with System.File_Control_Block; +with System.WCh_Con; package Ada.Text_IO is pragma Elaborate_Body; @@ -334,6 +335,11 @@ private -- Text_IO File Control Block -- -------------------------------- + Default_WCEM : System.WCh_Con.WC_Encoding_Method := + System.WCh_Con.WCEM_UTF8; + -- This gets modified during initialization (see body) using + -- the default value established in the call to Set_Globals. + package FCB renames System.File_Control_Block; type Text_AFCB; @@ -366,6 +372,31 @@ private -- after a LM-PM sequence when logically we are before the LM-PM. This -- flag can only be set if Before_LM is also set. + WC_Method : System.WCh_Con.WC_Encoding_Method := Default_WCEM; + -- Encoding method to be used for this file. Text_IO does not deal with + -- wide characters, but it does deal with upper half characters in the + -- range 16#80#-16#FF# which may need encoding, e.g. in UTF-8 mode. + + Before_Upper_Half_Character : Boolean := False; + -- This flag is set to indicate that an encoded upper half character has + -- been read by Text_IO.Look_Ahead. If it is set to True, then it means + -- that the stream is logically positioned before the character but is + -- physically positioned after it. The character involved must be in + -- the range 16#80#-16#FF#, i.e. if the flag is set, then we know the + -- next character has a code greater than 16#7F#, and the value of this + -- character is saved in Saved_Upper_Half_Character. + + Saved_Upper_Half_Character : Character; + -- This field is valid only if Before_Upper_Half_Character is set. It + -- contains an upper-half character read by Look_Ahead. If Look_Ahead + -- reads a character in the range 16#00# to 16#7F#, then it can use + -- ungetc to put it back, but ungetc cannot be called more than once, + -- so for characters above this range, we don't try to back up the + -- file. Instead we save the character in this field and set the flag + -- Before_Upper_Half_Character to True to indicate that we are logically + -- positioned before this character even though the stream is physically + -- positioned after it. + end record; function AFCB_Allocate (Control_Block : Text_AFCB) return FCB.AFCB_Ptr; |