This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
This patch implements AI-185 which defines two new Ada 2012 packages Ada.Wide_[Wide_]Characters.Handling. The Wide_Wide package is available in Ada 2005 mode, and the Wide package is available in Ada 95 mode. Both are of course available in Ada 2012 mode. The following two programs execute quietly with -gnata -gnat12 with Ada.Wide_Characters.Handling; use Ada.Wide_Characters.Handling; with Text_IO; use Text_IO; procedure WchTest is subtype WC is Wide_Character; C : WC; procedure T (Test : String; Val : Boolean) is begin if not Val then Put_Line ("Test " & test & " failed"); end if; end T; begin -- To_Upper/To_Lower T ("01", To_Upper (WC'Val (16#B5#)) = WC'Val (16#B5#)); T ("02", To_Upper ('a') = 'A'); T ("03", To_Upper (WC'Val (16#253#)) = WC'Val(16#253# - 210)); T ("04", To_Upper ("Hello!") = "HELLO!"); T ("05", To_Lower (WC'Val(16#B5#)) = WC'Val(16#B5#)); T ("06", To_Lower (WC'Val(16#253# - 210)) = WC'Val(16#253#)); T ("07", To_Lower ('A') = 'a'); T ("08", To_Lower ("Hello Robert!") = "hello robert!"); for J in Wide_Character loop C := To_Lower (J); T ("09", C = J or else To_Upper (C) = J); C := To_Upper (J); T ("10", C = J or else To_Lower (C) = J); end loop; T ("11", Is_Control (WC'Val (13))); T ("12", not Is_Control ('a')); T ("13", Is_Lower ('a')); T ("14", not Is_Lower ('A')); T ("15", Is_Upper ('A')); T ("16", not Is_Upper ('a')); T ("17", Is_Digit ('3')); T ("18", not Is_Digit ('a')); T ("17", Is_Digit ('3')); T ("18", not Is_Digit ('a')); T ("19", Is_Decimal_Digit ('3')); T ("20", not Is_Decimal_Digit ('a')); T ("21", Is_Hexadecimal_Digit ('3')); T ("22", Is_Hexadecimal_Digit ('a')); T ("23", not Is_Hexadecimal_Digit ('g')); T ("24", Is_Alphanumeric ('3')); T ("25", Is_Alphanumeric ('a')); T ("26", not Is_Alphanumeric ('!')); T ("27", Is_Special ('!')); T ("28", not Is_Special ('a')); T ("29", Is_Line_Terminator (WC'Val (13))); T ("30", not Is_Line_Terminator ('a')); T ("31", Is_Mark (WC'Val (16#35E#))); T ("32", not Is_Mark ('.')); T ("33", Is_Other (WC'Val (16#6DD#))); T ("34", not Is_Other (''')); T ("35", Is_Punctuation (WC'Val (16#2054#))); T ("36", not Is_Punctuation ('.')); T ("37", Is_Space (' ')); T ("38", Is_Space (WC'Val (16#202F#))); T ("39", not Is_Space ('_')); T ("40", Is_Graphic (WC'Val (16#2027#))); T ("41", not Is_Graphic (WC'Val (16#2029#))); end WchTest; with Ada.Wide_Wide_Characters.Handling; use Ada.Wide_Wide_Characters.Handling; with Text_IO; use Text_IO; procedure WWchTest is subtype WC is Wide_Wide_Character; C : WC; procedure T (Test : String; Val : Boolean) is begin if not Val then Put_Line ("Test " & test & " failed"); end if; end T; begin -- To_Upper/To_Lower T ("01", To_Upper (WC'Val (16#B5#)) = WC'Val (16#B5#)); T ("02", To_Upper ('a') = 'A'); T ("03", To_Upper (WC'Val (16#253#)) = WC'Val(16#253# - 210)); T ("04", To_Upper ("Hello!") = "HELLO!"); T ("05", To_Lower (WC'Val(16#B5#)) = WC'Val(16#B5#)); T ("06", To_Lower (WC'Val(16#253# - 210)) = WC'Val(16#253#)); T ("07", To_Lower ('A') = 'a'); T ("08", To_Lower ("Hello Robert!") = "hello robert!"); for J in WC'Val (0) .. WC'Val (16#10_FFFF#) loop C := To_Lower (J); T ("09", C = J or else To_Upper (C) = J); C := To_Upper (J); T ("10", C = J or else To_Lower (C) = J); end loop; T ("11", Is_Control (WC'Val (13))); T ("12", not Is_Control ('a')); T ("13", Is_Lower ('a')); T ("14", not Is_Lower ('A')); T ("15", Is_Upper ('A')); T ("16", not Is_Upper ('a')); T ("17", Is_Digit ('3')); T ("18", not Is_Digit ('a')); T ("17", Is_Digit ('3')); T ("18", not Is_Digit ('a')); T ("19", Is_Decimal_Digit ('3')); T ("20", not Is_Decimal_Digit ('a')); T ("21", Is_Hexadecimal_Digit ('3')); T ("22", Is_Hexadecimal_Digit ('a')); T ("23", not Is_Hexadecimal_Digit ('g')); T ("24", Is_Alphanumeric ('3')); T ("25", Is_Alphanumeric ('a')); T ("26", not Is_Alphanumeric ('!')); T ("27", Is_Special ('!')); T ("28", not Is_Special ('a')); T ("29", Is_Line_Terminator (WC'Val (13))); T ("30", not Is_Line_Terminator ('a')); T ("31", Is_Mark (WC'Val (16#35E#))); T ("32", not Is_Mark ('.')); T ("33", Is_Other (WC'Val (16#6DD#))); T ("34", not Is_Other (''')); T ("35", Is_Punctuation (WC'Val (16#2054#))); T ("36", not Is_Punctuation ('.')); T ("37", Is_Space (' ')); T ("38", Is_Space (WC'Val (16#202F#))); T ("39", not Is_Space ('_')); T ("40", Is_Graphic (WC'Val (16#2027#))); T ("41", not Is_Graphic (WC'Val (16#2029#))); end WWchTest; Tested on x86_64-pc-linux-gnu, committed on trunk 2010-10-07 Robert Dewar <dewar@adacore.com> * a-wichha.adb, a-wichha.ads, a-zchhan.adb, a-zchhan.ads: New file. * impunit.adb: Add entries for a-wichha/a-zchhan * Makefile.rtl: Add entries for a-wichha/a-zchhan
Attachment:
difs
Description: Text document
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |