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]

[Ada] Handle Soft_Hyphen as non-graphic in Ada 2005 mode


This patch implements proper handling of Soft_Hyphen (16#A5#) in
Ada 2005 where it is considered a non-graphic and correspons to
the special name SOFT_HYPHEN.

The following test, compiled with -gnat05, prints SOFT_HYPHEN 6 times.

with Ada.Text_IO; use  Ada.Text_IO;
procedure SoftHyphen is
begin
   Put_Line (Character'Image
              (Character'Val (16#00AD#)));
   Put_Line (Wide_Character'Image
              (Wide_Character'Val (16#00AD#)));
   Put_Line (Wide_Wide_Character'Image
              (Wide_Wide_Character'Val (16#00AD#)));
   Put_Line (Character'Image
              (Character'Value ("SOFT_HYPHEN")));
   Put_Line (Wide_Character'Image
              (Wide_Character'Value ("SOFT_HYPHEN")));
   Put_Line (Wide_Wide_Character'Image
              (Wide_Wide_Character'Value ("SOFT_HYPHEN")));
end;

This modified version of the test compiled with -gnat95 prints
out '?' four times, where ? is the soft hyphen character 16#A5#

with Ada.Text_IO; use  Ada.Text_IO;
procedure SoftHyphen2 is
begin
   Put_Line (Character'Image
              (Character'Val (16#00AD#)));
   Put_Line (Wide_Character'Image
              (Wide_Character'Val (16#00AD#)));
   Put_Line (Character'Image
              (Character'Value ("SOFT_HYPHEN")));
   Put_Line (Wide_Character'Image
              (Wide_Character'Value ("SOFT_HYPHEN")));
end;

Note that we recognize SOFT_HYPHEN for Value input even
in Ada 95 mode, which is permitted and seems reasonable!

Tested on x86_64-pc-linux-gnu, committed on trunk

2010-10-08  Robert Dewar  <dewar@adacore.com>

	* exp_imgv.adb (Expand_Image_Attribute): Handle special calling
	sequence for soft hyphen for Character'Image case.
	* rtsfind.ads (Image_Character_05): New entry
	* s-imgcha.adb (Image_Character_05): New procedurew
	* s-imgcha.ads (Image_Character_05): New procedure
	* s-imgwch.adb (Image_Wide_Character): Deal with Ada 2005 soft hyphen
	case.
	* s-valcha.adb (Value_Character): Recognize SOFT_HYPHEN for 16#AD#
	* sem_attr.adb (Eval_Attribute, case Width): Handle soft_hyphen name
	properly.

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]