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] Add version of Find_Token with From parameter


This patch adds a version of Find_Token with a From parameter
to all relevant string packages, as prescribed by AI 0031. The
following test program:

with Ada.Strings;
use Ada.Strings;
with Ada.Strings.Fixed;
use Ada.Strings.Fixed;
with Ada.Strings.Maps;
use Ada.Strings.Maps;
with Text_IO;
use Text_IO;
procedure Testft is
   S : constant String := "999abc999def999";
   M : constant Character_Set :=
         To_Set (Character_Range'('a', 'z'));
   First : Positive;
   Last  : Natural;

begin
   Find_Token (S, M, Inside, First, Last);
   Put_Line ("First =" & First'Img & " Last =" & Last'Img);
   Find_Token (S, M, 7, Inside, First, Last);
   Put_Line ("First =" & First'Img & " Last =" & Last'Img);
end Testft;

outputs:

First = 4 Last = 6
First = 10 Last = 12

If compiled without -gnat12, a warning is issued:

testft.adb:19:04: warning: "Find_Token" is only defined in Ada 2012

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

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

	* a-strbou.ads, a-strfix.adb, a-strfix.ads, a-strsea.adb, a-strsea.ads,
	a-strsup.adb, a-strsup.ads, a-strunb-shared.adb, a-strunb-shared.ads,
	a-strunb.adb, a-strunb.ads, a-stwibo.ads, a-stwifi.adb, a-stwifi.ads,
	a-stwise.adb, a-stwise.ads, a-stwisu.adb, a-stwisu.ads,
	a-stwiun-shared.adb, a-stwiun-shared.ads, a-stwiun.adb, a-stwiun.ads,
	a-stzbou.ads, a-stzfix.adb, a-stzfix.ads, a-stzsea.adb, a-stzsea.ads,
	a-stzsup.adb, a-stzsup.ads, a-stzunb-shared.adb, a-stzunb-shared.ads,
	a-stzunb.adb, a-stzunb.ads (Find_Token): New version with From
	parameter.

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]