a-strunb.ads, [...]: Add missing pragma Ada_05 statements Fix name of Set routine

2005-02-09  Robert Dewar  <dewar@adacore.com>

        * a-strunb.ads, a-strunb.adb: Add missing pragma Ada_05 statements
        Fix name of Set routine

	* a-strfix.ads, a-strfix.adb: Add new index functions from AI-301 to
	fixed packages.

	* a-stwise.ads, a-stwise.adb, a-stwifi.ads, a-stwifi.adb,
	a-strsea.ads, a-strsea.adb: Add new index functions from AI-301 to
	fixed packages

	* a-witeio.ads, a-witeio.adb, a-textio.ads, a-textio.adb: New function
	forms of Get_Line subprograms for AI-301.

	* a-wtcoau.adb, a-wtcoau.ads, a-wtcoio.adb, a-wtcoio.ads,
	a-wtedit.adb, a-wtedit.adb, a-wtedit.ads, a-wttest.adb,
	a-wttest.ads, a-strmap.ads, a-strmap.adb, a-stwima.adb,
	a-stwima.ads: Minor reformatting.

From-SVN: r94810
This commit is contained in:
Robert Dewar 2005-02-10 14:51:40 +01:00 committed by Arnaud Charlet
parent 82c8073471
commit 4e45e7a930
26 changed files with 1753 additions and 1321 deletions

View File

@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
-- Copyright (C) 1992-2002 Free Software Foundation, Inc. --
-- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@ -50,59 +50,82 @@ package body Ada.Strings.Fixed is
------------------------
function Index
(Source : in String;
Pattern : in String;
Going : in Direction := Forward;
Mapping : in Maps.Character_Mapping := Maps.Identity)
return Natural
(Source : String;
Pattern : String;
Going : Direction := Forward;
Mapping : Maps.Character_Mapping := Maps.Identity) return Natural
renames Ada.Strings.Search.Index;
function Index
(Source : in String;
Pattern : in String;
Going : in Direction := Forward;
Mapping : in Maps.Character_Mapping_Function)
return Natural
(Source : String;
Pattern : String;
Going : Direction := Forward;
Mapping : Maps.Character_Mapping_Function) return Natural
renames Ada.Strings.Search.Index;
function Index
(Source : in String;
Set : in Maps.Character_Set;
Test : in Membership := Inside;
Going : in Direction := Forward)
return Natural
(Source : String;
Set : Maps.Character_Set;
Test : Membership := Inside;
Going : Direction := Forward) return Natural
renames Ada.Strings.Search.Index;
function Index
(Source : String;
Pattern : String;
From : Positive;
Going : Direction := Forward;
Mapping : Maps.Character_Mapping := Maps.Identity) return Natural
renames Ada.Strings.Search.Index;
function Index
(Source : String;
Pattern : String;
From : Positive;
Going : Direction := Forward;
Mapping : Maps.Character_Mapping_Function) return Natural
renames Ada.Strings.Search.Index;
function Index
(Source : String;
Set : Maps.Character_Set;
From : Positive;
Test : Membership := Inside;
Going : Direction := Forward) return Natural
renames Ada.Strings.Search.Index;
function Index_Non_Blank
(Source : in String;
Going : in Direction := Forward)
return Natural
(Source : String;
Going : Direction := Forward) return Natural
renames Ada.Strings.Search.Index_Non_Blank;
function Index_Non_Blank
(Source : String;
From : Positive;
Going : Direction := Forward) return Natural
renames Ada.Strings.Search.Index_Non_Blank;
function Count
(Source : in String;
Pattern : in String;
Mapping : in Maps.Character_Mapping := Maps.Identity)
return Natural
(Source : String;
Pattern : String;
Mapping : Maps.Character_Mapping := Maps.Identity) return Natural
renames Ada.Strings.Search.Count;
function Count
(Source : in String;
Pattern : in String;
Mapping : in Maps.Character_Mapping_Function)
return Natural
(Source : String;
Pattern : String;
Mapping : Maps.Character_Mapping_Function) return Natural
renames Ada.Strings.Search.Count;
function Count
(Source : in String;
Set : in Maps.Character_Set)
return Natural
(Source : String;
Set : Maps.Character_Set) return Natural
renames Ada.Strings.Search.Count;
procedure Find_Token
(Source : in String;
Set : in Maps.Character_Set;
Test : in Membership;
(Source : String;
Set : Maps.Character_Set;
Test : Membership;
First : out Positive;
Last : out Natural)
renames Ada.Strings.Search.Find_Token;
@ -112,9 +135,8 @@ package body Ada.Strings.Fixed is
---------
function "*"
(Left : in Natural;
Right : in Character)
return String
(Left : Natural;
Right : Character) return String
is
Result : String (1 .. Left);
@ -127,9 +149,8 @@ package body Ada.Strings.Fixed is
end "*";
function "*"
(Left : in Natural;
Right : in String)
return String
(Left : Natural;
Right : String) return String
is
Result : String (1 .. Left * Right'Length);
Ptr : Integer := 1;
@ -148,10 +169,9 @@ package body Ada.Strings.Fixed is
------------
function Delete
(Source : in String;
From : in Positive;
Through : in Natural)
return String
(Source : String;
From : Positive;
Through : Natural) return String
is
begin
if From > Through then
@ -185,10 +205,10 @@ package body Ada.Strings.Fixed is
procedure Delete
(Source : in out String;
From : in Positive;
Through : in Natural;
Justify : in Alignment := Left;
Pad : in Character := Space)
From : Positive;
Through : Natural;
Justify : Alignment := Left;
Pad : Character := Space)
is
begin
Move (Source => Delete (Source, From, Through),
@ -202,10 +222,9 @@ package body Ada.Strings.Fixed is
----------
function Head
(Source : in String;
Count : in Natural;
Pad : in Character := Space)
return String
(Source : String;
Count : Natural;
Pad : Character := Space) return String
is
subtype Result_Type is String (1 .. Count);
@ -232,9 +251,9 @@ package body Ada.Strings.Fixed is
procedure Head
(Source : in out String;
Count : in Natural;
Justify : in Alignment := Left;
Pad : in Character := Space)
Count : Natural;
Justify : Alignment := Left;
Pad : Character := Space)
is
begin
Move (Source => Head (Source, Count, Pad),
@ -249,10 +268,9 @@ package body Ada.Strings.Fixed is
------------
function Insert
(Source : in String;
Before : in Positive;
New_Item : in String)
return String
(Source : String;
Before : Positive;
New_Item : String) return String
is
Result : String (1 .. Source'Length + New_Item'Length);
Front : constant Integer := Before - Source'First;
@ -274,9 +292,9 @@ package body Ada.Strings.Fixed is
procedure Insert
(Source : in out String;
Before : in Positive;
New_Item : in String;
Drop : in Truncation := Error)
Before : Positive;
New_Item : String;
Drop : Truncation := Error)
is
begin
Move (Source => Insert (Source, Before, New_Item),
@ -289,11 +307,11 @@ package body Ada.Strings.Fixed is
----------
procedure Move
(Source : in String;
(Source : String;
Target : out String;
Drop : in Truncation := Error;
Justify : in Alignment := Left;
Pad : in Character := Space)
Drop : Truncation := Error;
Justify : Alignment := Left;
Pad : Character := Space)
is
Sfirst : constant Integer := Source'First;
Slast : constant Integer := Source'Last;
@ -398,10 +416,9 @@ package body Ada.Strings.Fixed is
---------------
function Overwrite
(Source : in String;
Position : in Positive;
New_Item : in String)
return String
(Source : String;
Position : Positive;
New_Item : String) return String
is
begin
if Position not in Source'First .. Source'Last + 1 then
@ -430,9 +447,9 @@ package body Ada.Strings.Fixed is
procedure Overwrite
(Source : in out String;
Position : in Positive;
New_Item : in String;
Drop : in Truncation := Right)
Position : Positive;
New_Item : String;
Drop : Truncation := Right)
is
begin
Move (Source => Overwrite (Source, Position, New_Item),
@ -445,11 +462,10 @@ package body Ada.Strings.Fixed is
-------------------
function Replace_Slice
(Source : in String;
Low : in Positive;
High : in Natural;
By : in String)
return String
(Source : String;
Low : Positive;
High : Natural;
By : String) return String
is
begin
if Low > Source'Last + 1 or High < Source'First - 1 then
@ -490,12 +506,12 @@ package body Ada.Strings.Fixed is
procedure Replace_Slice
(Source : in out String;
Low : in Positive;
High : in Natural;
By : in String;
Drop : in Truncation := Error;
Justify : in Alignment := Left;
Pad : in Character := Space)
Low : Positive;
High : Natural;
By : String;
Drop : Truncation := Error;
Justify : Alignment := Left;
Pad : Character := Space)
is
begin
Move (Replace_Slice (Source, Low, High, By), Source, Drop, Justify, Pad);
@ -506,10 +522,9 @@ package body Ada.Strings.Fixed is
----------
function Tail
(Source : in String;
Count : in Natural;
Pad : in Character := Space)
return String
(Source : String;
Count : Natural;
Pad : Character := Space) return String
is
subtype Result_Type is String (1 .. Count);
@ -536,9 +551,9 @@ package body Ada.Strings.Fixed is
procedure Tail
(Source : in out String;
Count : in Natural;
Justify : in Alignment := Left;
Pad : in Character := Space)
Count : Natural;
Justify : Alignment := Left;
Pad : Character := Space)
is
begin
Move (Source => Tail (Source, Count, Pad),
@ -553,9 +568,8 @@ package body Ada.Strings.Fixed is
---------------
function Translate
(Source : in String;
Mapping : in Maps.Character_Mapping)
return String
(Source : String;
Mapping : Maps.Character_Mapping) return String
is
Result : String (1 .. Source'Length);
@ -569,7 +583,7 @@ package body Ada.Strings.Fixed is
procedure Translate
(Source : in out String;
Mapping : in Maps.Character_Mapping)
Mapping : Maps.Character_Mapping)
is
begin
for J in Source'Range loop
@ -578,9 +592,8 @@ package body Ada.Strings.Fixed is
end Translate;
function Translate
(Source : in String;
Mapping : in Maps.Character_Mapping_Function)
return String
(Source : String;
Mapping : Maps.Character_Mapping_Function) return String
is
Result : String (1 .. Source'Length);
pragma Unsuppress (Access_Check);
@ -595,7 +608,7 @@ package body Ada.Strings.Fixed is
procedure Translate
(Source : in out String;
Mapping : in Maps.Character_Mapping_Function)
Mapping : Maps.Character_Mapping_Function)
is
pragma Unsuppress (Access_Check);
begin
@ -609,9 +622,8 @@ package body Ada.Strings.Fixed is
----------
function Trim
(Source : in String;
Side : in Trim_End)
return String
(Source : String;
Side : Trim_End) return String
is
Low, High : Integer;
@ -658,9 +670,9 @@ package body Ada.Strings.Fixed is
procedure Trim
(Source : in out String;
Side : in Trim_End;
Justify : in Alignment := Left;
Pad : in Character := Space)
Side : Trim_End;
Justify : Alignment := Left;
Pad : Character := Space)
is
begin
Move (Trim (Source, Side),
@ -670,10 +682,9 @@ package body Ada.Strings.Fixed is
end Trim;
function Trim
(Source : in String;
Left : in Maps.Character_Set;
Right : in Maps.Character_Set)
return String
(Source : String;
Left : Maps.Character_Set;
Right : Maps.Character_Set) return String
is
High, Low : Integer;
@ -705,10 +716,10 @@ package body Ada.Strings.Fixed is
procedure Trim
(Source : in out String;
Left : in Maps.Character_Set;
Right : in Maps.Character_Set;
Justify : in Alignment := Strings.Left;
Pad : in Character := Space)
Left : Maps.Character_Set;
Right : Maps.Character_Set;
Justify : Alignment := Strings.Left;
Pad : Character := Space)
is
begin
Move (Source => Trim (Source, Left, Right),

View File

@ -6,32 +6,10 @@
-- --
-- S p e c --
-- --
-- Copyright (C) 1992-1997 Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
-- apply solely to the contents of the part following the private keyword. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 2, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
-- for more details. You should have received a copy of the GNU General --
-- Public License distributed with GNAT; see file COPYING. If not, write --
-- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, --
-- MA 02111-1307, USA. --
-- --
-- As a special exception, if other files instantiate generics from this --
-- unit, or you link this unit with other files to produce an executable, --
-- this unit does not by itself cause the resulting executable to be --
-- covered by the GNU General Public License. This exception does not --
-- however invalidate any other reasons why the executable file might be --
-- covered by the GNU Public License. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- This specification is adapted from the Ada Reference Manual for use with --
-- GNAT. In accordance with the copyright of that document, you can freely --
-- copy and modify this specification, provided that if you redistribute a --
-- modified version, any changes that you have made are clearly indicated. --
-- --
------------------------------------------------------------------------------
@ -46,63 +24,86 @@ pragma Preelaborate (Fixed);
--------------------------------------------------------------
procedure Move
(Source : in String;
(Source : String;
Target : out String;
Drop : in Truncation := Error;
Justify : in Alignment := Left;
Pad : in Character := Space);
Drop : Truncation := Error;
Justify : Alignment := Left;
Pad : Character := Space);
------------------------
-- Search Subprograms --
------------------------
function Index
(Source : in String;
Pattern : in String;
Going : in Direction := Forward;
Mapping : in Maps.Character_Mapping := Maps.Identity)
return Natural;
(Source : String;
Pattern : String;
Going : Direction := Forward;
Mapping : Maps.Character_Mapping := Maps.Identity) return Natural;
function Index
(Source : in String;
Pattern : in String;
Going : in Direction := Forward;
Mapping : in Maps.Character_Mapping_Function)
return Natural;
(Source : String;
Pattern : String;
Going : Direction := Forward;
Mapping : Maps.Character_Mapping_Function) return Natural;
function Index
(Source : in String;
Set : in Maps.Character_Set;
Test : in Membership := Inside;
Going : in Direction := Forward)
return Natural;
(Source : String;
Set : Maps.Character_Set;
Test : Membership := Inside;
Going : Direction := Forward) return Natural;
function Index
(Source : String;
Pattern : String;
From : Positive;
Going : Direction := Forward;
Mapping : Maps.Character_Mapping := Maps.Identity) return Natural;
pragma Ada_05 (Index);
function Index
(Source : String;
Pattern : String;
From : Positive;
Going : Direction := Forward;
Mapping : Maps.Character_Mapping_Function) return Natural;
pragma Ada_05 (Index);
function Index
(Source : String;
Set : Maps.Character_Set;
From : Positive;
Test : Membership := Inside;
Going : Direction := Forward) return Natural;
pragma Ada_05 (Index);
function Index_Non_Blank
(Source : in String;
Going : in Direction := Forward)
return Natural;
(Source : String;
Going : Direction := Forward) return Natural;
function Index_Non_Blank
(Source : String;
From : Positive;
Going : Direction := Forward) return Natural;
pragma Ada_05 (Index_Non_Blank);
function Count
(Source : in String;
Pattern : in String;
Mapping : in Maps.Character_Mapping := Maps.Identity)
return Natural;
(Source : String;
Pattern : String;
Mapping : Maps.Character_Mapping := Maps.Identity) return Natural;
function Count
(Source : in String;
Pattern : in String;
Mapping : in Maps.Character_Mapping_Function)
return Natural;
(Source : String;
Pattern : String;
Mapping : Maps.Character_Mapping_Function) return Natural;
function Count
(Source : in String;
Set : in Maps.Character_Set)
return Natural;
(Source : String;
Set : Maps.Character_Set) return Natural;
procedure Find_Token
(Source : in String;
Set : in Maps.Character_Set;
Test : in Membership;
(Source : String;
Set : Maps.Character_Set;
Test : Membership;
First : out Positive;
Last : out Natural);
@ -111,144 +112,132 @@ pragma Preelaborate (Fixed);
------------------------------------
function Translate
(Source : in String;
Mapping : in Maps.Character_Mapping)
return String;
(Source : String;
Mapping : Maps.Character_Mapping) return String;
procedure Translate
(Source : in out String;
Mapping : in Maps.Character_Mapping);
Mapping : Maps.Character_Mapping);
function Translate
(Source : in String;
Mapping : in Maps.Character_Mapping_Function)
return String;
(Source : String;
Mapping : Maps.Character_Mapping_Function) return String;
procedure Translate
(Source : in out String;
Mapping : in Maps.Character_Mapping_Function);
Mapping : Maps.Character_Mapping_Function);
---------------------------------------
-- String Transformation Subprograms --
---------------------------------------
function Replace_Slice
(Source : in String;
Low : in Positive;
High : in Natural;
By : in String)
return String;
(Source : String;
Low : Positive;
High : Natural;
By : String) return String;
procedure Replace_Slice
(Source : in out String;
Low : in Positive;
High : in Natural;
By : in String;
Drop : in Truncation := Error;
Justify : in Alignment := Left;
Pad : in Character := Space);
Low : Positive;
High : Natural;
By : String;
Drop : Truncation := Error;
Justify : Alignment := Left;
Pad : Character := Space);
function Insert
(Source : in String;
Before : in Positive;
New_Item : in String)
return String;
(Source : String;
Before : Positive;
New_Item : String) return String;
procedure Insert
(Source : in out String;
Before : in Positive;
New_Item : in String;
Drop : in Truncation := Error);
Before : Positive;
New_Item : String;
Drop : Truncation := Error);
function Overwrite
(Source : in String;
Position : in Positive;
New_Item : in String)
return String;
(Source : String;
Position : Positive;
New_Item : String) return String;
procedure Overwrite
(Source : in out String;
Position : in Positive;
New_Item : in String;
Drop : in Truncation := Right);
Position : Positive;
New_Item : String;
Drop : Truncation := Right);
function Delete
(Source : in String;
From : in Positive;
Through : in Natural)
return String;
(Source : String;
From : Positive;
Through : Natural) return String;
procedure Delete
(Source : in out String;
From : in Positive;
Through : in Natural;
Justify : in Alignment := Left;
Pad : in Character := Space);
From : Positive;
Through : Natural;
Justify : Alignment := Left;
Pad : Character := Space);
---------------------------------
-- String Selector Subprograms --
---------------------------------
function Trim
(Source : in String;
Side : in Trim_End)
return String;
(Source : String;
Side : Trim_End) return String;
procedure Trim
(Source : in out String;
Side : in Trim_End;
Justify : in Alignment := Left;
Pad : in Character := Space);
Side : Trim_End;
Justify : Alignment := Left;
Pad : Character := Space);
function Trim
(Source : in String;
Left : in Maps.Character_Set;
Right : in Maps.Character_Set)
return String;
(Source : String;
Left : Maps.Character_Set;
Right : Maps.Character_Set) return String;
procedure Trim
(Source : in out String;
Left : in Maps.Character_Set;
Right : in Maps.Character_Set;
Justify : in Alignment := Strings.Left;
Pad : in Character := Space);
Left : Maps.Character_Set;
Right : Maps.Character_Set;
Justify : Alignment := Strings.Left;
Pad : Character := Space);
function Head
(Source : in String;
Count : in Natural;
Pad : in Character := Space)
return String;
(Source : String;
Count : Natural;
Pad : Character := Space) return String;
procedure Head
(Source : in out String;
Count : in Natural;
Justify : in Alignment := Left;
Pad : in Character := Space);
Count : Natural;
Justify : Alignment := Left;
Pad : Character := Space);
function Tail
(Source : in String;
Count : in Natural;
Pad : in Character := Space)
return String;
(Source : String;
Count : Natural;
Pad : Character := Space) return String;
procedure Tail
(Source : in out String;
Count : in Natural;
Justify : in Alignment := Left;
Pad : in Character := Space);
Count : Natural;
Justify : Alignment := Left;
Pad : Character := Space);
----------------------------------
-- String Constructor Functions --
----------------------------------
function "*"
(Left : in Natural;
Right : in Character)
return String;
(Left : Natural;
Right : Character) return String;
function "*"
(Left : in Natural;
Right : in String)
return String;
(Left : Natural;
Right : String) return String;
end Ada.Strings.Fixed;

View File

@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
-- Copyright (C) 1992-2004 Free Software Foundation, Inc. --
-- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --

View File

@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
-- Copyright (C) 1992-2004 Free Software Foundation, Inc. --
-- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --

View File

@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
-- Copyright (C) 1992-2004 Free Software Foundation, Inc. --
-- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@ -76,9 +76,9 @@ package body Ada.Strings.Search is
-----------
function Count
(Source : String;
Pattern : String;
Mapping : Maps.Character_Mapping := Maps.Identity) return Natural
(Source : String;
Pattern : String;
Mapping : Maps.Character_Mapping := Maps.Identity) return Natural
is
N : Natural;
J : Natural;
@ -110,9 +110,9 @@ package body Ada.Strings.Search is
end Count;
function Count
(Source : String;
Pattern : String;
Mapping : Maps.Character_Mapping_Function) return Natural
(Source : String;
Pattern : String;
Mapping : Maps.Character_Mapping_Function) return Natural
is
Mapped_Source : String (Source'Range);
N : Natural;
@ -280,7 +280,6 @@ package body Ada.Strings.Search is
declare
pragma Unsuppress (Access_Check);
begin
for J in Source'Range loop
Mapped_Source (J) := Mapping.all (Source (J));
@ -348,6 +347,84 @@ package body Ada.Strings.Search is
return 0;
end Index;
function Index
(Source : String;
Pattern : String;
From : Positive;
Going : Direction := Forward;
Mapping : Maps.Character_Mapping := Maps.Identity) return Natural
is
begin
if Going = Forward then
if From < Source'First then
raise Index_Error;
end if;
return
Index (Source (From .. Source'Last), Pattern, Forward, Mapping);
else
if From > Source'Last then
raise Index_Error;
end if;
return
Index (Source (Source'First .. From), Pattern, Backward, Mapping);
end if;
end Index;
function Index
(Source : String;
Pattern : String;
From : Positive;
Going : Direction := Forward;
Mapping : Maps.Character_Mapping_Function) return Natural
is
begin
if Going = Forward then
if From < Source'First then
raise Index_Error;
end if;
return Index
(Source (From .. Source'Last), Pattern, Forward, Mapping);
else
if From > Source'Last then
raise Index_Error;
end if;
return Index
(Source (Source'First .. From), Pattern, Backward, Mapping);
end if;
end Index;
function Index
(Source : String;
Set : Maps.Character_Set;
From : Positive;
Test : Membership := Inside;
Going : Direction := Forward) return Natural
is
begin
if Going = Forward then
if From < Source'First then
raise Index_Error;
end if;
return
Index (Source (From .. Source'Last), Set, Test, Forward);
else
if From > Source'Last then
raise Index_Error;
end if;
return
Index (Source (Source'First .. From), Set, Test, Backward);
end if;
end Index;
---------------------
-- Index_Non_Blank --
---------------------
@ -375,7 +452,30 @@ package body Ada.Strings.Search is
-- Fall through if no match
return 0;
end Index_Non_Blank;
function Index_Non_Blank
(Source : String;
From : Positive;
Going : Direction := Forward) return Natural
is
begin
if Going = Forward then
if From < Source'First then
raise Index_Error;
end if;
return
Index_Non_Blank (Source (From .. Source'Last), Forward);
else
if From > Source'Last then
raise Index_Error;
end if;
return
Index_Non_Blank (Source (Source'First .. From), Backward);
end if;
end Index_Non_Blank;
end Ada.Strings.Search;

View File

@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
-- Copyright (C) 1992-2004 Free Software Foundation, Inc. --
-- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@ -61,10 +61,36 @@ pragma Preelaborate (Search);
Test : Membership := Inside;
Going : Direction := Forward) return Natural;
function Index
(Source : String;
Pattern : String;
From : Positive;
Going : Direction := Forward;
Mapping : Maps.Character_Mapping := Maps.Identity) return Natural;
function Index
(Source : String;
Pattern : String;
From : Positive;
Going : Direction := Forward;
Mapping : Maps.Character_Mapping_Function) return Natural;
function Index
(Source : String;
Set : Maps.Character_Set;
From : Positive;
Test : Membership := Inside;
Going : Direction := Forward) return Natural;
function Index_Non_Blank
(Source : String;
Going : Direction := Forward) return Natural;
function Index_Non_Blank
(Source : String;
From : Positive;
Going : Direction := Forward) return Natural;
function Count
(Source : String;
Pattern : String;

View File

@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
-- Copyright (C) 1992-2002 Free Software Foundation, Inc. --
-- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@ -44,16 +44,19 @@ package body Ada.Strings.Unbounded is
Chunk_Size : Natural);
pragma Inline (Realloc_For_Chunk);
-- Adjust the size allocated for the string. Add at least Chunk_Size so it
-- is safe to add a string of this size at the end of the current
-- content. The real size allocated for the string is Chunk_Size + x %
-- of the current string size. This buffered handling makes the Append
-- unbounded string routines very fast.
-- is safe to add a string of this size at the end of the current content.
-- The real size allocated for the string is Chunk_Size + x of the current
-- string size. This buffered handling makes the Append unbounded string
-- routines very fast.
---------
-- "&" --
---------
function "&" (Left, Right : Unbounded_String) return Unbounded_String is
function "&"
(Left : Unbounded_String;
Right : Unbounded_String) return Unbounded_String
is
L_Length : constant Natural := Left.Last;
R_Length : constant Natural := Right.Last;
Result : Unbounded_String;
@ -73,8 +76,7 @@ package body Ada.Strings.Unbounded is
function "&"
(Left : Unbounded_String;
Right : String)
return Unbounded_String
Right : String) return Unbounded_String
is
L_Length : constant Natural := Left.Last;
Result : Unbounded_String;
@ -92,8 +94,7 @@ package body Ada.Strings.Unbounded is
function "&"
(Left : String;
Right : Unbounded_String)
return Unbounded_String
Right : Unbounded_String) return Unbounded_String
is
R_Length : constant Natural := Right.Last;
Result : Unbounded_String;
@ -112,8 +113,7 @@ package body Ada.Strings.Unbounded is
function "&"
(Left : Unbounded_String;
Right : Character)
return Unbounded_String
Right : Character) return Unbounded_String
is
Result : Unbounded_String;
@ -131,8 +131,7 @@ package body Ada.Strings.Unbounded is
function "&"
(Left : Character;
Right : Unbounded_String)
return Unbounded_String
Right : Unbounded_String) return Unbounded_String
is
Result : Unbounded_String;
@ -152,8 +151,7 @@ package body Ada.Strings.Unbounded is
function "*"
(Left : Natural;
Right : Character)
return Unbounded_String
Right : Character) return Unbounded_String
is
Result : Unbounded_String;
@ -170,8 +168,7 @@ package body Ada.Strings.Unbounded is
function "*"
(Left : Natural;
Right : String)
return Unbounded_String
Right : String) return Unbounded_String
is
Len : constant Natural := Right'Length;
K : Positive;
@ -193,8 +190,7 @@ package body Ada.Strings.Unbounded is
function "*"
(Left : Natural;
Right : Unbounded_String)
return Unbounded_String
Right : Unbounded_String) return Unbounded_String
is
Len : constant Natural := Right.Last;
K : Positive;
@ -219,7 +215,10 @@ package body Ada.Strings.Unbounded is
-- "<" --
---------
function "<" (Left, Right : Unbounded_String) return Boolean is
function "<"
(Left : Unbounded_String;
Right : Unbounded_String) return Boolean
is
begin
return
Left.Reference (1 .. Left.Last) < Right.Reference (1 .. Right.Last);
@ -227,8 +226,7 @@ package body Ada.Strings.Unbounded is
function "<"
(Left : Unbounded_String;
Right : String)
return Boolean
Right : String) return Boolean
is
begin
return Left.Reference (1 .. Left.Last) < Right;
@ -236,8 +234,7 @@ package body Ada.Strings.Unbounded is
function "<"
(Left : String;
Right : Unbounded_String)
return Boolean
Right : Unbounded_String) return Boolean
is
begin
return Left < Right.Reference (1 .. Right.Last);
@ -247,7 +244,10 @@ package body Ada.Strings.Unbounded is
-- "<=" --
----------
function "<=" (Left, Right : Unbounded_String) return Boolean is
function "<="
(Left : Unbounded_String;
Right : Unbounded_String) return Boolean
is
begin
return
Left.Reference (1 .. Left.Last) <= Right.Reference (1 .. Right.Last);
@ -255,8 +255,7 @@ package body Ada.Strings.Unbounded is
function "<="
(Left : Unbounded_String;
Right : String)
return Boolean
Right : String) return Boolean
is
begin
return Left.Reference (1 .. Left.Last) <= Right;
@ -264,8 +263,7 @@ package body Ada.Strings.Unbounded is
function "<="
(Left : String;
Right : Unbounded_String)
return Boolean
Right : Unbounded_String) return Boolean
is
begin
return Left <= Right.Reference (1 .. Right.Last);
@ -275,7 +273,10 @@ package body Ada.Strings.Unbounded is
-- "=" --
---------
function "=" (Left, Right : Unbounded_String) return Boolean is
function "="
(Left : Unbounded_String;
Right : Unbounded_String) return Boolean
is
begin
return
Left.Reference (1 .. Left.Last) = Right.Reference (1 .. Right.Last);
@ -283,8 +284,7 @@ package body Ada.Strings.Unbounded is
function "="
(Left : Unbounded_String;
Right : String)
return Boolean
Right : String) return Boolean
is
begin
return Left.Reference (1 .. Left.Last) = Right;
@ -292,8 +292,7 @@ package body Ada.Strings.Unbounded is
function "="
(Left : String;
Right : Unbounded_String)
return Boolean
Right : Unbounded_String) return Boolean
is
begin
return Left = Right.Reference (1 .. Right.Last);
@ -303,7 +302,10 @@ package body Ada.Strings.Unbounded is
-- ">" --
---------
function ">" (Left, Right : Unbounded_String) return Boolean is
function ">"
(Left : Unbounded_String;
Right : Unbounded_String) return Boolean
is
begin
return
Left.Reference (1 .. Left.Last) > Right.Reference (1 .. Right.Last);
@ -311,8 +313,7 @@ package body Ada.Strings.Unbounded is
function ">"
(Left : Unbounded_String;
Right : String)
return Boolean
Right : String) return Boolean
is
begin
return Left.Reference (1 .. Left.Last) > Right;
@ -320,8 +321,7 @@ package body Ada.Strings.Unbounded is
function ">"
(Left : String;
Right : Unbounded_String)
return Boolean
Right : Unbounded_String) return Boolean
is
begin
return Left > Right.Reference (1 .. Right.Last);
@ -331,7 +331,10 @@ package body Ada.Strings.Unbounded is
-- ">=" --
----------
function ">=" (Left, Right : Unbounded_String) return Boolean is
function ">="
(Left : Unbounded_String;
Right : Unbounded_String) return Boolean
is
begin
return
Left.Reference (1 .. Left.Last) >= Right.Reference (1 .. Right.Last);
@ -339,8 +342,7 @@ package body Ada.Strings.Unbounded is
function ">="
(Left : Unbounded_String;
Right : String)
return Boolean
Right : String) return Boolean
is
begin
return Left.Reference (1 .. Left.Last) >= Right;
@ -348,8 +350,7 @@ package body Ada.Strings.Unbounded is
function ">="
(Left : String;
Right : Unbounded_String)
return Boolean
Right : Unbounded_String) return Boolean
is
begin
return Left >= Right.Reference (1 .. Right.Last);
@ -362,9 +363,8 @@ package body Ada.Strings.Unbounded is
procedure Adjust (Object : in out Unbounded_String) is
begin
-- Copy string, except we do not copy the statically allocated null
-- string, since it can never be deallocated.
-- Note that we do not copy extra string room here to avoid dragging
-- unused allocated memory.
-- string, since it can never be deallocated. Note that we do not copy
-- extra string room here to avoid dragging unused allocated memory.
if Object.Reference /= Null_String'Access then
Object.Reference := new String'(Object.Reference (1 .. Object.Last));
@ -412,10 +412,9 @@ package body Ada.Strings.Unbounded is
-----------
function Count
(Source : Unbounded_String;
Pattern : String;
Mapping : Maps.Character_Mapping := Maps.Identity)
return Natural
(Source : Unbounded_String;
Pattern : String;
Mapping : Maps.Character_Mapping := Maps.Identity) return Natural
is
begin
return
@ -423,10 +422,9 @@ package body Ada.Strings.Unbounded is
end Count;
function Count
(Source : Unbounded_String;
Pattern : String;
Mapping : Maps.Character_Mapping_Function)
return Natural
(Source : Unbounded_String;
Pattern : String;
Mapping : Maps.Character_Mapping_Function) return Natural
is
begin
return
@ -434,9 +432,8 @@ package body Ada.Strings.Unbounded is
end Count;
function Count
(Source : Unbounded_String;
Set : Maps.Character_Set)
return Natural
(Source : Unbounded_String;
Set : Maps.Character_Set) return Natural
is
begin
return Search.Count (Source.Reference (1 .. Source.Last), Set);
@ -449,8 +446,7 @@ package body Ada.Strings.Unbounded is
function Delete
(Source : Unbounded_String;
From : Positive;
Through : Natural)
return Unbounded_String
Through : Natural) return Unbounded_String
is
begin
return
@ -488,8 +484,7 @@ package body Ada.Strings.Unbounded is
function Element
(Source : Unbounded_String;
Index : Positive)
return Character
Index : Positive) return Character
is
begin
if Index <= Source.Last then
@ -556,8 +551,7 @@ package body Ada.Strings.Unbounded is
function Head
(Source : Unbounded_String;
Count : Natural;
Pad : Character := Space)
return Unbounded_String
Pad : Character := Space) return Unbounded_String
is
begin
return To_Unbounded_String
@ -570,7 +564,6 @@ package body Ada.Strings.Unbounded is
Pad : Character := Space)
is
Old : String_Access := Source.Reference;
begin
Source.Reference :=
new String'(Fixed.Head (Source.Reference (1 .. Source.Last),
@ -584,11 +577,10 @@ package body Ada.Strings.Unbounded is
-----------
function Index
(Source : Unbounded_String;
Pattern : String;
Going : Strings.Direction := Strings.Forward;
Mapping : Maps.Character_Mapping := Maps.Identity)
return Natural
(Source : Unbounded_String;
Pattern : String;
Going : Strings.Direction := Strings.Forward;
Mapping : Maps.Character_Mapping := Maps.Identity) return Natural
is
begin
return Search.Index
@ -596,11 +588,10 @@ package body Ada.Strings.Unbounded is
end Index;
function Index
(Source : Unbounded_String;
Pattern : String;
Going : Direction := Forward;
Mapping : Maps.Character_Mapping_Function)
return Natural
(Source : Unbounded_String;
Pattern : String;
Going : Direction := Forward;
Mapping : Maps.Character_Mapping_Function) return Natural
is
begin
return Search.Index
@ -611,22 +602,69 @@ package body Ada.Strings.Unbounded is
(Source : Unbounded_String;
Set : Maps.Character_Set;
Test : Strings.Membership := Strings.Inside;
Going : Strings.Direction := Strings.Forward)
return Natural
Going : Strings.Direction := Strings.Forward) return Natural
is
begin
return Search.Index
(Source.Reference (1 .. Source.Last), Set, Test, Going);
end Index;
function Index
(Source : Unbounded_String;
Pattern : String;
From : Positive;
Going : Direction := Forward;
Mapping : Maps.Character_Mapping := Maps.Identity) return Natural
is
begin
return Search.Index
(Source.Reference (1 .. Source.Last), Pattern, From, Going, Mapping);
end Index;
function Index
(Source : Unbounded_String;
Pattern : String;
From : Positive;
Going : Direction := Forward;
Mapping : Maps.Character_Mapping_Function) return Natural
is
begin
return Search.Index
(Source.Reference (1 .. Source.Last), Pattern, From, Going, Mapping);
end Index;
function Index
(Source : Unbounded_String;
Set : Maps.Character_Set;
From : Positive;
Test : Membership := Inside;
Going : Direction := Forward) return Natural
is
begin
return Search.Index
(Source.Reference (1 .. Source.Last), Set, From, Test, Going);
end Index;
function Index_Non_Blank
(Source : Unbounded_String;
Going : Strings.Direction := Strings.Forward)
return Natural
Going : Strings.Direction := Strings.Forward) return Natural
is
begin
return
Search.Index_Non_Blank (Source.Reference (1 .. Source.Last), Going);
Search.Index_Non_Blank
(Source.Reference (1 .. Source.Last), Going);
end Index_Non_Blank;
function Index_Non_Blank
(Source : Unbounded_String;
From : Positive;
Going : Direction := Forward) return Natural
is
begin
return
Search.Index_Non_Blank
(Source.Reference (1 .. Source.Last), From, Going);
end Index_Non_Blank;
----------------
@ -646,8 +684,7 @@ package body Ada.Strings.Unbounded is
function Insert
(Source : Unbounded_String;
Before : Positive;
New_Item : String)
return Unbounded_String
New_Item : String) return Unbounded_String
is
begin
return To_Unbounded_String
@ -688,11 +725,10 @@ package body Ada.Strings.Unbounded is
---------------
function Overwrite
(Source : Unbounded_String;
Position : Positive;
New_Item : String)
return Unbounded_String is
(Source : Unbounded_String;
Position : Positive;
New_Item : String) return Unbounded_String
is
begin
return To_Unbounded_String
(Fixed.Overwrite
@ -705,15 +741,12 @@ package body Ada.Strings.Unbounded is
New_Item : String)
is
NL : constant Natural := New_Item'Length;
begin
if Position <= Source.Last - NL + 1 then
Source.Reference (Position .. Position + NL - 1) := New_Item;
else
declare
Old : String_Access := Source.Reference;
begin
Source.Reference := new String'
(Fixed.Overwrite
@ -741,7 +774,6 @@ package body Ada.Strings.Unbounded is
Alloc_Chunk_Size : constant Positive :=
Chunk_Size + (S_Length / Growth_Factor);
Tmp : String_Access;
begin
Tmp := new String (1 .. S_Length + Alloc_Chunk_Size);
Tmp (1 .. Source.Last) := Source.Reference (1 .. Source.Last);
@ -773,11 +805,10 @@ package body Ada.Strings.Unbounded is
-------------------
function Replace_Slice
(Source : Unbounded_String;
Low : Positive;
High : Natural;
By : String)
return Unbounded_String
(Source : Unbounded_String;
Low : Positive;
High : Natural;
By : String) return Unbounded_String
is
begin
return To_Unbounded_String
@ -786,13 +817,12 @@ package body Ada.Strings.Unbounded is
end Replace_Slice;
procedure Replace_Slice
(Source : in out Unbounded_String;
Low : Positive;
High : Natural;
By : String)
(Source : in out Unbounded_String;
Low : Positive;
High : Natural;
By : String)
is
Old : String_Access := Source.Reference;
begin
Source.Reference := new String'
(Fixed.Replace_Slice
@ -801,6 +831,20 @@ package body Ada.Strings.Unbounded is
Free (Old);
end Replace_Slice;
--------------------------
-- Set_Unbounded_String --
--------------------------
procedure Set_Unbounded_String
(Target : out Unbounded_String;
Source : String)
is
begin
Target.Last := Source'Length;
Target.Reference := new String (1 .. Source'Length);
Target.Reference.all := Source;
end Set_Unbounded_String;
-----------
-- Slice --
-----------
@ -808,8 +852,7 @@ package body Ada.Strings.Unbounded is
function Slice
(Source : Unbounded_String;
Low : Positive;
High : Natural)
return String
High : Natural) return String
is
begin
-- Note: test of High > Length is in accordance with AI95-00128
@ -828,9 +871,7 @@ package body Ada.Strings.Unbounded is
function Tail
(Source : Unbounded_String;
Count : Natural;
Pad : Character := Space)
return Unbounded_String is
Pad : Character := Space) return Unbounded_String is
begin
return To_Unbounded_String
(Fixed.Tail (Source.Reference (1 .. Source.Last), Count, Pad));
@ -842,7 +883,6 @@ package body Ada.Strings.Unbounded is
Pad : Character := Space)
is
Old : String_Access := Source.Reference;
begin
Source.Reference := new String'
(Fixed.Tail (Source.Reference (1 .. Source.Last), Count, Pad));
@ -865,7 +905,6 @@ package body Ada.Strings.Unbounded is
function To_Unbounded_String (Source : String) return Unbounded_String is
Result : Unbounded_String;
begin
Result.Last := Source'Length;
Result.Reference := new String (1 .. Source'Length);
@ -874,11 +913,9 @@ package body Ada.Strings.Unbounded is
end To_Unbounded_String;
function To_Unbounded_String
(Length : Natural)
return Unbounded_String
(Length : Natural) return Unbounded_String
is
Result : Unbounded_String;
begin
Result.Last := Length;
Result.Reference := new String (1 .. Length);
@ -891,8 +928,7 @@ package body Ada.Strings.Unbounded is
function Translate
(Source : Unbounded_String;
Mapping : Maps.Character_Mapping)
return Unbounded_String
Mapping : Maps.Character_Mapping) return Unbounded_String
is
begin
return To_Unbounded_String
@ -909,8 +945,7 @@ package body Ada.Strings.Unbounded is
function Translate
(Source : Unbounded_String;
Mapping : Maps.Character_Mapping_Function)
return Unbounded_String
Mapping : Maps.Character_Mapping_Function) return Unbounded_String
is
begin
return To_Unbounded_String
@ -931,8 +966,7 @@ package body Ada.Strings.Unbounded is
function Trim
(Source : Unbounded_String;
Side : Trim_End)
return Unbounded_String
Side : Trim_End) return Unbounded_String
is
begin
return To_Unbounded_String
@ -944,7 +978,6 @@ package body Ada.Strings.Unbounded is
Side : Trim_End)
is
Old : String_Access := Source.Reference;
begin
Source.Reference := new String'
(Fixed.Trim (Source.Reference (1 .. Source.Last), Side));
@ -955,8 +988,7 @@ package body Ada.Strings.Unbounded is
function Trim
(Source : Unbounded_String;
Left : Maps.Character_Set;
Right : Maps.Character_Set)
return Unbounded_String
Right : Maps.Character_Set) return Unbounded_String
is
begin
return To_Unbounded_String
@ -969,7 +1001,6 @@ package body Ada.Strings.Unbounded is
Right : Maps.Character_Set)
is
Old : String_Access := Source.Reference;
begin
Source.Reference := new String'
(Fixed.Trim (Source.Reference (1 .. Source.Last), Left, Right));
@ -977,4 +1008,35 @@ package body Ada.Strings.Unbounded is
Free (Old);
end Trim;
---------------------
-- Unbounded_Slice --
---------------------
function Unbounded_Slice
(Source : Unbounded_String;
Low : Positive;
High : Natural) return Unbounded_String
is
begin
if Low > Source.Last + 1 or else High > Source.Last then
raise Index_Error;
else
return To_Unbounded_String (Source.Reference.all (Low .. High));
end if;
end Unbounded_Slice;
procedure Unbounded_Slice
(Source : Unbounded_String;
Target : out Unbounded_String;
Low : Positive;
High : Natural)
is
begin
if Low > Source.Last + 1 or else High > Source.Last then
raise Index_Error;
else
Target := To_Unbounded_String (Source.Reference.all (Low .. High));
end if;
end Unbounded_Slice;
end Ada.Strings.Unbounded;

View File

@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
-- Copyright (C) 1992-2002 Free Software Foundation, Inc. --
-- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
@ -55,172 +55,212 @@ pragma Preelaborate (Unbounded);
-- Conversion, Concatenation, and Selection Functions --
--------------------------------------------------------
function To_Unbounded_String (Source : String) return Unbounded_String;
function To_Unbounded_String (Length : in Natural) return Unbounded_String;
function To_Unbounded_String
(Source : String) return Unbounded_String;
function To_Unbounded_String
(Length : Natural) return Unbounded_String;
function To_String (Source : Unbounded_String) return String;
procedure Append
(Source : in out Unbounded_String;
New_Item : in Unbounded_String);
procedure Set_Unbounded_String
(Target : out Unbounded_String;
Source : String);
pragma Ada_05 (Set_Unbounded_String);
procedure Append
(Source : in out Unbounded_String;
New_Item : in String);
New_Item : Unbounded_String);
procedure Append
(Source : in out Unbounded_String;
New_Item : in Character);
New_Item : String);
function "&" (Left, Right : Unbounded_String) return Unbounded_String;
procedure Append
(Source : in out Unbounded_String;
New_Item : Character);
function "&"
(Left : in Unbounded_String;
Right : in String)
return Unbounded_String;
(Left : Unbounded_String;
Right : Unbounded_String) return Unbounded_String;
function "&"
(Left : in String;
Right : in Unbounded_String)
return Unbounded_String;
(Left : Unbounded_String;
Right : String) return Unbounded_String;
function "&"
(Left : in Unbounded_String;
Right : in Character)
return Unbounded_String;
(Left : String;
Right : Unbounded_String) return Unbounded_String;
function "&"
(Left : in Character;
Right : in Unbounded_String)
return Unbounded_String;
(Left : Unbounded_String;
Right : Character) return Unbounded_String;
function "&"
(Left : Character;
Right : Unbounded_String) return Unbounded_String;
function Element
(Source : in Unbounded_String;
Index : in Positive)
return Character;
(Source : Unbounded_String;
Index : Positive) return Character;
procedure Replace_Element
(Source : in out Unbounded_String;
Index : in Positive;
Index : Positive;
By : Character);
function Slice
(Source : in Unbounded_String;
Low : in Positive;
High : in Natural)
return String;
(Source : Unbounded_String;
Low : Positive;
High : Natural) return String;
function "=" (Left, Right : in Unbounded_String) return Boolean;
function Unbounded_Slice
(Source : Unbounded_String;
Low : Positive;
High : Natural) return Unbounded_String;
pragma Ada_05 (Unbounded_Slice);
procedure Unbounded_Slice
(Source : Unbounded_String;
Target : out Unbounded_String;
Low : Positive;
High : Natural);
pragma Ada_05 (Unbounded_Slice);
function "="
(Left : in Unbounded_String;
Right : in String)
return Boolean;
(Left : Unbounded_String;
Right : Unbounded_String) return Boolean;
function "="
(Left : in String;
Right : in Unbounded_String)
return Boolean;
(Left : Unbounded_String;
Right : String) return Boolean;
function "<" (Left, Right : in Unbounded_String) return Boolean;
function "="
(Left : String;
Right : Unbounded_String) return Boolean;
function "<"
(Left : in Unbounded_String;
Right : in String)
return Boolean;
(Left : Unbounded_String;
Right : Unbounded_String) return Boolean;
function "<"
(Left : in String;
Right : in Unbounded_String)
return Boolean;
(Left : Unbounded_String;
Right : String) return Boolean;
function "<=" (Left, Right : in Unbounded_String) return Boolean;
function "<"
(Left : String;
Right : Unbounded_String) return Boolean;
function "<="
(Left : in Unbounded_String;
Right : in String)
return Boolean;
(Left : Unbounded_String;
Right : Unbounded_String) return Boolean;
function "<="
(Left : in String;
Right : in Unbounded_String)
return Boolean;
(Left : Unbounded_String;
Right : String) return Boolean;
function ">" (Left, Right : in Unbounded_String) return Boolean;
function "<="
(Left : String;
Right : Unbounded_String) return Boolean;
function ">"
(Left : in Unbounded_String;
Right : in String)
return Boolean;
(Left : Unbounded_String;
Right : Unbounded_String) return Boolean;
function ">"
(Left : in String;
Right : in Unbounded_String)
return Boolean;
(Left : Unbounded_String;
Right : String) return Boolean;
function ">=" (Left, Right : in Unbounded_String) return Boolean;
function ">"
(Left : String;
Right : Unbounded_String) return Boolean;
function ">="
(Left : in Unbounded_String;
Right : in String)
return Boolean;
(Left : Unbounded_String;
Right : Unbounded_String) return Boolean;
function ">="
(Left : in String;
Right : in Unbounded_String)
return Boolean;
(Left : Unbounded_String;
Right : String) return Boolean;
function ">="
(Left : String;
Right : Unbounded_String) return Boolean;
------------------------
-- Search Subprograms --
------------------------
function Index
(Source : in Unbounded_String;
Pattern : in String;
Going : in Direction := Forward;
Mapping : in Maps.Character_Mapping := Maps.Identity)
return Natural;
(Source : Unbounded_String;
Pattern : String;
Going : Direction := Forward;
Mapping : Maps.Character_Mapping := Maps.Identity) return Natural;
function Index
(Source : in Unbounded_String;
Pattern : in String;
Going : in Direction := Forward;
Mapping : in Maps.Character_Mapping_Function)
return Natural;
(Source : Unbounded_String;
Pattern : String;
Going : Direction := Forward;
Mapping : Maps.Character_Mapping_Function) return Natural;
function Index
(Source : in Unbounded_String;
Set : in Maps.Character_Set;
Test : in Membership := Inside;
Going : in Direction := Forward)
return Natural;
(Source : Unbounded_String;
Set : Maps.Character_Set;
Test : Membership := Inside;
Going : Direction := Forward) return Natural;
function Index
(Source : Unbounded_String;
Pattern : String;
From : Positive;
Going : Direction := Forward;
Mapping : Maps.Character_Mapping := Maps.Identity) return Natural;
pragma Ada_05 (Index);
function Index
(Source : Unbounded_String;
Pattern : String;
From : Positive;
Going : Direction := Forward;
Mapping : Maps.Character_Mapping_Function) return Natural;
pragma Ada_05 (Index);
function Index
(Source : Unbounded_String;
Set : Maps.Character_Set;
From : Positive;
Test : Membership := Inside;
Going : Direction := Forward) return Natural;
pragma Ada_05 (Index);
function Index_Non_Blank
(Source : in Unbounded_String;
Going : in Direction := Forward)
return Natural;
(Source : Unbounded_String;
Going : Direction := Forward) return Natural;
function Index_Non_Blank
(Source : Unbounded_String;
From : Positive;
Going : Direction := Forward) return Natural;
pragma Ada_05 (Index_Non_Blank);
function Count
(Source : in Unbounded_String;
Pattern : in String;
Mapping : in Maps.Character_Mapping := Maps.Identity)
return Natural;
(Source : Unbounded_String;
Pattern : String;
Mapping : Maps.Character_Mapping := Maps.Identity) return Natural;
function Count
(Source : in Unbounded_String;
Pattern : in String;
Mapping : in Maps.Character_Mapping_Function)
return Natural;
(Source : Unbounded_String;
Pattern : String;
Mapping : Maps.Character_Mapping_Function) return Natural;
function Count
(Source : in Unbounded_String;
Set : in Maps.Character_Set)
return Natural;
(Source : Unbounded_String;
Set : Maps.Character_Set) return Natural;
procedure Find_Token
(Source : in Unbounded_String;
Set : in Maps.Character_Set;
Test : in Membership;
(Source : Unbounded_String;
Set : Maps.Character_Set;
Test : Membership;
First : out Positive;
Last : out Natural);
@ -229,129 +269,116 @@ pragma Preelaborate (Unbounded);
------------------------------------
function Translate
(Source : in Unbounded_String;
Mapping : in Maps.Character_Mapping)
return Unbounded_String;
(Source : Unbounded_String;
Mapping : Maps.Character_Mapping) return Unbounded_String;
procedure Translate
(Source : in out Unbounded_String;
Mapping : Maps.Character_Mapping);
function Translate
(Source : in Unbounded_String;
Mapping : in Maps.Character_Mapping_Function)
return Unbounded_String;
(Source : Unbounded_String;
Mapping : Maps.Character_Mapping_Function) return Unbounded_String;
procedure Translate
(Source : in out Unbounded_String;
Mapping : in Maps.Character_Mapping_Function);
Mapping : Maps.Character_Mapping_Function);
---------------------------------------
-- String Transformation Subprograms --
---------------------------------------
function Replace_Slice
(Source : in Unbounded_String;
Low : in Positive;
High : in Natural;
By : in String)
return Unbounded_String;
(Source : Unbounded_String;
Low : Positive;
High : Natural;
By : String) return Unbounded_String;
procedure Replace_Slice
(Source : in out Unbounded_String;
Low : in Positive;
High : in Natural;
By : in String);
(Source : in out Unbounded_String;
Low : Positive;
High : Natural;
By : String);
function Insert
(Source : in Unbounded_String;
Before : in Positive;
New_Item : in String)
return Unbounded_String;
(Source : Unbounded_String;
Before : Positive;
New_Item : String) return Unbounded_String;
procedure Insert
(Source : in out Unbounded_String;
Before : in Positive;
New_Item : in String);
Before : Positive;
New_Item : String);
function Overwrite
(Source : in Unbounded_String;
Position : in Positive;
New_Item : in String)
return Unbounded_String;
(Source : Unbounded_String;
Position : Positive;
New_Item : String) return Unbounded_String;
procedure Overwrite
(Source : in out Unbounded_String;
Position : in Positive;
New_Item : in String);
(Source : in out Unbounded_String;
Position : Positive;
New_Item : String);
function Delete
(Source : in Unbounded_String;
From : in Positive;
Through : in Natural)
return Unbounded_String;
(Source : Unbounded_String;
From : Positive;
Through : Natural) return Unbounded_String;
procedure Delete
(Source : in out Unbounded_String;
From : in Positive;
Through : in Natural);
From : Positive;
Through : Natural);
function Trim
(Source : in Unbounded_String;
Side : in Trim_End)
return Unbounded_String;
(Source : Unbounded_String;
Side : Trim_End) return Unbounded_String;
procedure Trim
(Source : in out Unbounded_String;
Side : in Trim_End);
Side : Trim_End);
function Trim
(Source : in Unbounded_String;
Left : in Maps.Character_Set;
Right : in Maps.Character_Set)
return Unbounded_String;
(Source : Unbounded_String;
Left : Maps.Character_Set;
Right : Maps.Character_Set) return Unbounded_String;
procedure Trim
(Source : in out Unbounded_String;
Left : in Maps.Character_Set;
Right : in Maps.Character_Set);
Left : Maps.Character_Set;
Right : Maps.Character_Set);
function Head
(Source : in Unbounded_String;
Count : in Natural;
Pad : in Character := Space)
return Unbounded_String;
(Source : Unbounded_String;
Count : Natural;
Pad : Character := Space) return Unbounded_String;
procedure Head
(Source : in out Unbounded_String;
Count : in Natural;
Pad : in Character := Space);
Count : Natural;
Pad : Character := Space);
function Tail
(Source : in Unbounded_String;
Count : in Natural;
Pad : in Character := Space)
return Unbounded_String;
(Source : Unbounded_String;
Count : Natural;
Pad : Character := Space) return Unbounded_String;
procedure Tail
(Source : in out Unbounded_String;
Count : in Natural;
Pad : in Character := Space);
Count : Natural;
Pad : Character := Space);
function "*"
(Left : in Natural;
Right : in Character)
return Unbounded_String;
(Left : Natural;
Right : Character) return Unbounded_String;
function "*"
(Left : in Natural;
Right : in String)
return Unbounded_String;
(Left : Natural;
Right : String) return Unbounded_String;
function "*"
(Left : in Natural;
Right : in Unbounded_String)
return Unbounded_String;
(Left : Natural;
Right : Unbounded_String) return Unbounded_String;
private
pragma Inline (Length);

View File

@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
-- Copyright (C) 1992-2002 Free Software Foundation, Inc. --
-- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@ -41,59 +41,85 @@ package body Ada.Strings.Wide_Fixed is
------------------------
function Index
(Source : in Wide_String;
Pattern : in Wide_String;
Going : in Direction := Forward;
Mapping : in Wide_Maps.Wide_Character_Mapping := Wide_Maps.Identity)
return Natural
(Source : Wide_String;
Pattern : Wide_String;
Going : Direction := Forward;
Mapping : Wide_Maps.Wide_Character_Mapping := Wide_Maps.Identity)
return Natural
renames Ada.Strings.Wide_Search.Index;
function Index
(Source : in Wide_String;
Pattern : in Wide_String;
Going : in Direction := Forward;
Mapping : in Wide_Maps.Wide_Character_Mapping_Function)
return Natural
(Source : Wide_String;
Pattern : Wide_String;
Going : Direction := Forward;
Mapping : Wide_Maps.Wide_Character_Mapping_Function) return Natural
renames Ada.Strings.Wide_Search.Index;
function Index
(Source : in Wide_String;
Set : in Wide_Maps.Wide_Character_Set;
Test : in Membership := Inside;
Going : in Direction := Forward)
return Natural
(Source : Wide_String;
Set : Wide_Maps.Wide_Character_Set;
Test : Membership := Inside;
Going : Direction := Forward) return Natural
renames Ada.Strings.Wide_Search.Index;
function Index
(Source : Wide_String;
Pattern : Wide_String;
From : Positive;
Going : Direction := Forward;
Mapping : Wide_Maps.Wide_Character_Mapping := Wide_Maps.Identity)
return Natural
renames Ada.Strings.Wide_Search.Index;
function Index
(Source : Wide_String;
Pattern : Wide_String;
From : Positive;
Going : Direction := Forward;
Mapping : Wide_Maps.Wide_Character_Mapping_Function) return Natural
renames Ada.Strings.Wide_Search.Index;
function Index
(Source : Wide_String;
Set : Wide_Maps.Wide_Character_Set;
From : Positive;
Test : Membership := Inside;
Going : Direction := Forward) return Natural
renames Ada.Strings.Wide_Search.Index;
function Index_Non_Blank
(Source : in Wide_String;
Going : in Direction := Forward)
return Natural
(Source : Wide_String;
Going : Direction := Forward) return Natural
renames Ada.Strings.Wide_Search.Index_Non_Blank;
function Index_Non_Blank
(Source : Wide_String;
From : Positive;
Going : Direction := Forward) return Natural
renames Ada.Strings.Wide_Search.Index_Non_Blank;
function Count
(Source : in Wide_String;
Pattern : in Wide_String;
Mapping : in Wide_Maps.Wide_Character_Mapping := Wide_Maps.Identity)
return Natural
(Source : Wide_String;
Pattern : Wide_String;
Mapping : Wide_Maps.Wide_Character_Mapping := Wide_Maps.Identity)
return Natural
renames Ada.Strings.Wide_Search.Count;
function Count
(Source : in Wide_String;
Pattern : in Wide_String;
Mapping : in Wide_Maps.Wide_Character_Mapping_Function)
return Natural
(Source : Wide_String;
Pattern : Wide_String;
Mapping : Wide_Maps.Wide_Character_Mapping_Function) return Natural
renames Ada.Strings.Wide_Search.Count;
function Count
(Source : in Wide_String;
Set : in Wide_Maps.Wide_Character_Set)
return Natural
(Source : Wide_String;
Set : Wide_Maps.Wide_Character_Set) return Natural
renames Ada.Strings.Wide_Search.Count;
procedure Find_Token
(Source : in Wide_String;
Set : in Wide_Maps.Wide_Character_Set;
Test : in Membership;
(Source : Wide_String;
Set : Wide_Maps.Wide_Character_Set;
Test : Membership;
First : out Positive;
Last : out Natural)
renames Ada.Strings.Wide_Search.Find_Token;
@ -103,9 +129,8 @@ package body Ada.Strings.Wide_Fixed is
---------
function "*"
(Left : in Natural;
Right : in Wide_Character)
return Wide_String
(Left : Natural;
Right : Wide_Character) return Wide_String
is
Result : Wide_String (1 .. Left);
@ -118,9 +143,8 @@ package body Ada.Strings.Wide_Fixed is
end "*";
function "*"
(Left : in Natural;
Right : in Wide_String)
return Wide_String
(Left : Natural;
Right : Wide_String) return Wide_String
is
Result : Wide_String (1 .. Left * Right'Length);
Ptr : Integer := 1;
@ -139,10 +163,9 @@ package body Ada.Strings.Wide_Fixed is
------------
function Delete
(Source : in Wide_String;
From : in Positive;
Through : in Natural)
return Wide_String
(Source : Wide_String;
From : Positive;
Through : Natural) return Wide_String
is
begin
if From not in Source'Range
@ -168,10 +191,10 @@ package body Ada.Strings.Wide_Fixed is
procedure Delete
(Source : in out Wide_String;
From : in Positive;
Through : in Natural;
Justify : in Alignment := Left;
Pad : in Wide_Character := Wide_Space)
From : Positive;
Through : Natural;
Justify : Alignment := Left;
Pad : Wide_Character := Wide_Space)
is
begin
Move (Source => Delete (Source, From, Through),
@ -185,10 +208,9 @@ package body Ada.Strings.Wide_Fixed is
----------
function Head
(Source : in Wide_String;
Count : in Natural;
Pad : in Wide_Character := Wide_Space)
return Wide_String
(Source : Wide_String;
Count : Natural;
Pad : Wide_Character := Wide_Space) return Wide_String
is
Result : Wide_String (1 .. Count);
@ -209,9 +231,9 @@ package body Ada.Strings.Wide_Fixed is
procedure Head
(Source : in out Wide_String;
Count : in Natural;
Justify : in Alignment := Left;
Pad : in Wide_Character := Ada.Strings.Wide_Space)
Count : Natural;
Justify : Alignment := Left;
Pad : Wide_Character := Ada.Strings.Wide_Space)
is
begin
Move (Source => Head (Source, Count, Pad),
@ -226,10 +248,9 @@ package body Ada.Strings.Wide_Fixed is
------------
function Insert
(Source : in Wide_String;
Before : in Positive;
New_Item : in Wide_String)
return Wide_String
(Source : Wide_String;
Before : Positive;
New_Item : Wide_String) return Wide_String
is
Result : Wide_String (1 .. Source'Length + New_Item'Length);
@ -245,9 +266,9 @@ package body Ada.Strings.Wide_Fixed is
procedure Insert
(Source : in out Wide_String;
Before : in Positive;
New_Item : in Wide_String;
Drop : in Truncation := Error)
Before : Positive;
New_Item : Wide_String;
Drop : Truncation := Error)
is
begin
Move (Source => Insert (Source, Before, New_Item),
@ -260,11 +281,11 @@ package body Ada.Strings.Wide_Fixed is
----------
procedure Move
(Source : in Wide_String;
(Source : Wide_String;
Target : out Wide_String;
Drop : in Truncation := Error;
Justify : in Alignment := Left;
Pad : in Wide_Character := Wide_Space)
Drop : Truncation := Error;
Justify : Alignment := Left;
Pad : Wide_Character := Wide_Space)
is
Sfirst : constant Integer := Source'First;
Slast : constant Integer := Source'Last;
@ -369,10 +390,9 @@ package body Ada.Strings.Wide_Fixed is
---------------
function Overwrite
(Source : in Wide_String;
Position : in Positive;
New_Item : in Wide_String)
return Wide_String
(Source : Wide_String;
Position : Positive;
New_Item : Wide_String) return Wide_String
is
begin
if Position not in Source'First .. Source'Last + 1 then
@ -396,9 +416,9 @@ package body Ada.Strings.Wide_Fixed is
procedure Overwrite
(Source : in out Wide_String;
Position : in Positive;
New_Item : in Wide_String;
Drop : in Truncation := Right)
Position : Positive;
New_Item : Wide_String;
Drop : Truncation := Right)
is
begin
Move (Source => Overwrite (Source, Position, New_Item),
@ -411,11 +431,10 @@ package body Ada.Strings.Wide_Fixed is
-------------------
function Replace_Slice
(Source : in Wide_String;
Low : in Positive;
High : in Natural;
By : in Wide_String)
return Wide_String
(Source : Wide_String;
Low : Positive;
High : Natural;
By : Wide_String) return Wide_String
is
Result_Length : Natural;
@ -446,12 +465,12 @@ package body Ada.Strings.Wide_Fixed is
procedure Replace_Slice
(Source : in out Wide_String;
Low : in Positive;
High : in Natural;
By : in Wide_String;
Drop : in Truncation := Error;
Justify : in Alignment := Left;
Pad : in Wide_Character := Wide_Space)
Low : Positive;
High : Natural;
By : Wide_String;
Drop : Truncation := Error;
Justify : Alignment := Left;
Pad : Wide_Character := Wide_Space)
is
begin
Move (Replace_Slice (Source, Low, High, By), Source, Drop, Justify, Pad);
@ -462,10 +481,9 @@ package body Ada.Strings.Wide_Fixed is
----------
function Tail
(Source : in Wide_String;
Count : in Natural;
Pad : in Wide_Character := Wide_Space)
return Wide_String
(Source : Wide_String;
Count : Natural;
Pad : Wide_Character := Wide_Space) return Wide_String
is
Result : Wide_String (1 .. Count);
@ -488,9 +506,9 @@ package body Ada.Strings.Wide_Fixed is
procedure Tail
(Source : in out Wide_String;
Count : in Natural;
Justify : in Alignment := Left;
Pad : in Wide_Character := Ada.Strings.Wide_Space)
Count : Natural;
Justify : Alignment := Left;
Pad : Wide_Character := Ada.Strings.Wide_Space)
is
begin
Move (Source => Tail (Source, Count, Pad),
@ -505,9 +523,8 @@ package body Ada.Strings.Wide_Fixed is
---------------
function Translate
(Source : in Wide_String;
Mapping : in Wide_Maps.Wide_Character_Mapping)
return Wide_String
(Source : Wide_String;
Mapping : Wide_Maps.Wide_Character_Mapping) return Wide_String
is
Result : Wide_String (1 .. Source'Length);
@ -521,7 +538,7 @@ package body Ada.Strings.Wide_Fixed is
procedure Translate
(Source : in out Wide_String;
Mapping : in Wide_Maps.Wide_Character_Mapping)
Mapping : Wide_Maps.Wide_Character_Mapping)
is
begin
for J in Source'Range loop
@ -530,9 +547,8 @@ package body Ada.Strings.Wide_Fixed is
end Translate;
function Translate
(Source : in Wide_String;
Mapping : in Wide_Maps.Wide_Character_Mapping_Function)
return Wide_String
(Source : Wide_String;
Mapping : Wide_Maps.Wide_Character_Mapping_Function) return Wide_String
is
Result : Wide_String (1 .. Source'Length);
@ -546,7 +562,7 @@ package body Ada.Strings.Wide_Fixed is
procedure Translate
(Source : in out Wide_String;
Mapping : in Wide_Maps.Wide_Character_Mapping_Function)
Mapping : Wide_Maps.Wide_Character_Mapping_Function)
is
begin
for J in Source'Range loop
@ -559,9 +575,8 @@ package body Ada.Strings.Wide_Fixed is
----------
function Trim
(Source : in Wide_String;
Side : in Trim_End)
return Wide_String
(Source : Wide_String;
Side : Trim_End) return Wide_String
is
Low : Natural := Source'First;
High : Natural := Source'Last;
@ -599,9 +614,9 @@ package body Ada.Strings.Wide_Fixed is
procedure Trim
(Source : in out Wide_String;
Side : in Trim_End;
Justify : in Alignment := Left;
Pad : in Wide_Character := Wide_Space)
Side : Trim_End;
Justify : Alignment := Left;
Pad : Wide_Character := Wide_Space)
is
begin
Move (Source => Trim (Source, Side),
@ -611,10 +626,9 @@ package body Ada.Strings.Wide_Fixed is
end Trim;
function Trim
(Source : in Wide_String;
Left : in Wide_Maps.Wide_Character_Set;
Right : in Wide_Maps.Wide_Character_Set)
return Wide_String
(Source : Wide_String;
Left : Wide_Maps.Wide_Character_Set;
Right : Wide_Maps.Wide_Character_Set) return Wide_String
is
Low : Natural := Source'First;
High : Natural := Source'Last;
@ -644,10 +658,10 @@ package body Ada.Strings.Wide_Fixed is
procedure Trim
(Source : in out Wide_String;
Left : in Wide_Maps.Wide_Character_Set;
Right : in Wide_Maps.Wide_Character_Set;
Justify : in Alignment := Strings.Left;
Pad : in Wide_Character := Wide_Space)
Left : Wide_Maps.Wide_Character_Set;
Right : Wide_Maps.Wide_Character_Set;
Justify : Alignment := Strings.Left;
Pad : Wide_Character := Wide_Space)
is
begin
Move (Source => Trim (Source, Left, Right),

View File

@ -24,63 +24,89 @@ pragma Preelaborate (Wide_Fixed);
-------------------------------------------------------------------
procedure Move
(Source : in Wide_String;
(Source : Wide_String;
Target : out Wide_String;
Drop : in Truncation := Error;
Justify : in Alignment := Left;
Pad : in Wide_Character := Ada.Strings.Wide_Space);
Drop : Truncation := Error;
Justify : Alignment := Left;
Pad : Wide_Character := Ada.Strings.Wide_Space);
------------------------
-- Search Subprograms --
------------------------
function Index
(Source : in Wide_String;
Pattern : in Wide_String;
Going : in Direction := Forward;
Mapping : in Wide_Maps.Wide_Character_Mapping := Wide_Maps.Identity)
return Natural;
(Source : Wide_String;
Pattern : Wide_String;
Going : Direction := Forward;
Mapping : Wide_Maps.Wide_Character_Mapping := Wide_Maps.Identity)
return Natural;
function Index
(Source : in Wide_String;
Pattern : in Wide_String;
Going : in Direction := Forward;
Mapping : in Wide_Maps.Wide_Character_Mapping_Function)
return Natural;
(Source : Wide_String;
Pattern : Wide_String;
Going : Direction := Forward;
Mapping : Wide_Maps.Wide_Character_Mapping_Function) return Natural;
function Index
(Source : in Wide_String;
Set : in Wide_Maps.Wide_Character_Set;
Test : in Membership := Inside;
Going : in Direction := Forward)
return Natural;
(Source : Wide_String;
Set : Wide_Maps.Wide_Character_Set;
Test : Membership := Inside;
Going : Direction := Forward) return Natural;
function Index
(Source : Wide_String;
Pattern : Wide_String;
From : Positive;
Going : Direction := Forward;
Mapping : Wide_Maps.Wide_Character_Mapping := Wide_Maps.Identity)
return Natural;
pragma Ada_05 (Index);
function Index
(Source : Wide_String;
Pattern : Wide_String;
From : Positive;
Going : Direction := Forward;
Mapping : Wide_Maps.Wide_Character_Mapping_Function) return Natural;
pragma Ada_05 (Index);
function Index
(Source : Wide_String;
Set : Wide_Maps.Wide_Character_Set;
From : Positive;
Test : Membership := Inside;
Going : Direction := Forward) return Natural;
pragma Ada_05 (Index);
function Index_Non_Blank
(Source : in Wide_String;
Going : in Direction := Forward)
return Natural;
(Source : Wide_String;
Going : Direction := Forward) return Natural;
function Index_Non_Blank
(Source : Wide_String;
From : Positive;
Going : Direction := Forward) return Natural;
pragma Ada_05 (Index_Non_Blank);
function Count
(Source : in Wide_String;
Pattern : in Wide_String;
Mapping : in Wide_Maps.Wide_Character_Mapping := Wide_Maps.Identity)
return Natural;
(Source : Wide_String;
Pattern : Wide_String;
Mapping : Wide_Maps.Wide_Character_Mapping := Wide_Maps.Identity)
return Natural;
function Count
(Source : in Wide_String;
Pattern : in Wide_String;
Mapping : in Wide_Maps.Wide_Character_Mapping_Function)
return Natural;
(Source : Wide_String;
Pattern : Wide_String;
Mapping : Wide_Maps.Wide_Character_Mapping_Function) return Natural;
function Count
(Source : in Wide_String;
Set : in Wide_Maps.Wide_Character_Set)
return Natural;
(Source : Wide_String;
Set : Wide_Maps.Wide_Character_Set) return Natural;
procedure Find_Token
(Source : in Wide_String;
Set : in Wide_Maps.Wide_Character_Set;
Test : in Membership;
(Source : Wide_String;
Set : Wide_Maps.Wide_Character_Set;
Test : Membership;
First : out Positive;
Last : out Natural);
@ -89,144 +115,132 @@ pragma Preelaborate (Wide_Fixed);
-----------------------------------------
function Translate
(Source : in Wide_String;
Mapping : in Wide_Maps.Wide_Character_Mapping)
return Wide_String;
(Source : Wide_String;
Mapping : Wide_Maps.Wide_Character_Mapping) return Wide_String;
procedure Translate
(Source : in out Wide_String;
Mapping : in Wide_Maps.Wide_Character_Mapping);
Mapping : Wide_Maps.Wide_Character_Mapping);
function Translate
(Source : in Wide_String;
Mapping : in Wide_Maps.Wide_Character_Mapping_Function)
return Wide_String;
(Source : Wide_String;
Mapping : Wide_Maps.Wide_Character_Mapping_Function) return Wide_String;
procedure Translate
(Source : in out Wide_String;
Mapping : in Wide_Maps.Wide_Character_Mapping_Function);
Mapping : Wide_Maps.Wide_Character_Mapping_Function);
--------------------------------------------
-- Wide_String Transformation Subprograms --
--------------------------------------------
function Replace_Slice
(Source : in Wide_String;
Low : in Positive;
High : in Natural;
By : in Wide_String)
return Wide_String;
(Source : Wide_String;
Low : Positive;
High : Natural;
By : Wide_String) return Wide_String;
procedure Replace_Slice
(Source : in out Wide_String;
Low : in Positive;
High : in Natural;
By : in Wide_String;
Drop : in Truncation := Error;
Justify : in Alignment := Left;
Pad : in Wide_Character := Ada.Strings.Wide_Space);
Low : Positive;
High : Natural;
By : Wide_String;
Drop : Truncation := Error;
Justify : Alignment := Left;
Pad : Wide_Character := Ada.Strings.Wide_Space);
function Insert
(Source : in Wide_String;
Before : in Positive;
New_Item : in Wide_String)
return Wide_String;
(Source : Wide_String;
Before : Positive;
New_Item : Wide_String) return Wide_String;
procedure Insert
(Source : in out Wide_String;
Before : in Positive;
New_Item : in Wide_String;
Drop : in Truncation := Error);
Before : Positive;
New_Item : Wide_String;
Drop : Truncation := Error);
function Overwrite
(Source : in Wide_String;
Position : in Positive;
New_Item : in Wide_String)
return Wide_String;
(Source : Wide_String;
Position : Positive;
New_Item : Wide_String) return Wide_String;
procedure Overwrite
(Source : in out Wide_String;
Position : in Positive;
New_Item : in Wide_String;
Drop : in Truncation := Right);
Position : Positive;
New_Item : Wide_String;
Drop : Truncation := Right);
function Delete
(Source : in Wide_String;
From : in Positive;
Through : in Natural)
return Wide_String;
(Source : Wide_String;
From : Positive;
Through : Natural) return Wide_String;
procedure Delete
(Source : in out Wide_String;
From : in Positive;
Through : in Natural;
Justify : in Alignment := Left;
Pad : in Wide_Character := Ada.Strings.Wide_Space);
From : Positive;
Through : Natural;
Justify : Alignment := Left;
Pad : Wide_Character := Ada.Strings.Wide_Space);
--------------------------------------
-- Wide_String Selector Subprograms --
--------------------------------------
function Trim
(Source : in Wide_String;
Side : in Trim_End)
return Wide_String;
(Source : Wide_String;
Side : Trim_End) return Wide_String;
procedure Trim
(Source : in out Wide_String;
Side : in Trim_End;
Justify : in Alignment := Left;
Pad : in Wide_Character := Wide_Space);
Side : Trim_End;
Justify : Alignment := Left;
Pad : Wide_Character := Wide_Space);
function Trim
(Source : in Wide_String;
Left : in Wide_Maps.Wide_Character_Set;
Right : in Wide_Maps.Wide_Character_Set)
return Wide_String;
(Source : Wide_String;
Left : Wide_Maps.Wide_Character_Set;
Right : Wide_Maps.Wide_Character_Set) return Wide_String;
procedure Trim
(Source : in out Wide_String;
Left : in Wide_Maps.Wide_Character_Set;
Right : in Wide_Maps.Wide_Character_Set;
Justify : in Alignment := Ada.Strings.Left;
Pad : in Wide_Character := Ada.Strings.Wide_Space);
Left : Wide_Maps.Wide_Character_Set;
Right : Wide_Maps.Wide_Character_Set;
Justify : Alignment := Ada.Strings.Left;
Pad : Wide_Character := Ada.Strings.Wide_Space);
function Head
(Source : in Wide_String;
Count : in Natural;
Pad : in Wide_Character := Ada.Strings.Wide_Space)
return Wide_String;
(Source : Wide_String;
Count : Natural;
Pad : Wide_Character := Ada.Strings.Wide_Space) return Wide_String;
procedure Head
(Source : in out Wide_String;
Count : in Natural;
Justify : in Alignment := Left;
Pad : in Wide_Character := Ada.Strings.Wide_Space);
Count : Natural;
Justify : Alignment := Left;
Pad : Wide_Character := Ada.Strings.Wide_Space);
function Tail
(Source : in Wide_String;
Count : in Natural;
Pad : in Wide_Character := Ada.Strings.Wide_Space)
return Wide_String;
(Source : Wide_String;
Count : Natural;
Pad : Wide_Character := Ada.Strings.Wide_Space) return Wide_String;
procedure Tail
(Source : in out Wide_String;
Count : in Natural;
Justify : in Alignment := Left;
Pad : in Wide_Character := Ada.Strings.Wide_Space);
Count : Natural;
Justify : Alignment := Left;
Pad : Wide_Character := Ada.Strings.Wide_Space);
---------------------------------------
-- Wide_String Constructor Functions --
---------------------------------------
function "*"
(Left : in Natural;
Right : in Wide_Character)
return Wide_String;
(Left : Natural;
Right : Wide_Character) return Wide_String;
function "*"
(Left : in Natural;
Right : in Wide_String)
return Wide_String;
(Left : Natural;
Right : Wide_String) return Wide_String;
end Ada.Strings.Wide_Fixed;

View File

@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
-- Copyright (C) 1992-2002 Free Software Foundation, Inc. --
-- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@ -40,8 +40,7 @@ package body Ada.Strings.Wide_Maps is
---------
function "-"
(Left, Right : in Wide_Character_Set)
return Wide_Character_Set
(Left, Right : Wide_Character_Set) return Wide_Character_Set
is
LS : constant Wide_Character_Ranges_Access := Left.Set;
RS : constant Wide_Character_Ranges_Access := Right.Set;
@ -159,8 +158,7 @@ package body Ada.Strings.Wide_Maps is
-----------
function "and"
(Left, Right : in Wide_Character_Set)
return Wide_Character_Set
(Left, Right : Wide_Character_Set) return Wide_Character_Set
is
LS : constant Wide_Character_Ranges_Access := Left.Set;
RS : constant Wide_Character_Ranges_Access := Right.Set;
@ -210,8 +208,7 @@ package body Ada.Strings.Wide_Maps is
-----------
function "not"
(Right : in Wide_Character_Set)
return Wide_Character_Set
(Right : Wide_Character_Set) return Wide_Character_Set
is
RS : constant Wide_Character_Ranges_Access := Right.Set;
@ -253,8 +250,7 @@ package body Ada.Strings.Wide_Maps is
----------
function "or"
(Left, Right : in Wide_Character_Set)
return Wide_Character_Set
(Left, Right : Wide_Character_Set) return Wide_Character_Set
is
LS : constant Wide_Character_Ranges_Access := Left.Set;
RS : constant Wide_Character_Ranges_Access := Right.Set;
@ -341,8 +337,7 @@ package body Ada.Strings.Wide_Maps is
-----------
function "xor"
(Left, Right : in Wide_Character_Set)
return Wide_Character_Set
(Left, Right : Wide_Character_Set) return Wide_Character_Set
is
begin
return (Left or Right) - (Left and Right);
@ -409,9 +404,8 @@ package body Ada.Strings.Wide_Maps is
-----------
function Is_In
(Element : in Wide_Character;
Set : in Wide_Character_Set)
return Boolean
(Element : Wide_Character;
Set : Wide_Character_Set) return Boolean
is
L, R, M : Natural;
SS : constant Wide_Character_Ranges_Access := Set.Set;
@ -446,9 +440,8 @@ package body Ada.Strings.Wide_Maps is
---------------
function Is_Subset
(Elements : in Wide_Character_Set;
Set : in Wide_Character_Set)
return Boolean
(Elements : Wide_Character_Set;
Set : Wide_Character_Set) return Boolean
is
ES : constant Wide_Character_Ranges_Access := Elements.Set;
SS : constant Wide_Character_Ranges_Access := Set.Set;
@ -493,8 +486,7 @@ package body Ada.Strings.Wide_Maps is
---------------
function To_Domain
(Map : in Wide_Character_Mapping)
return Wide_Character_Sequence
(Map : Wide_Character_Mapping) return Wide_Character_Sequence
is
begin
return Map.Map.Domain;
@ -505,8 +497,7 @@ package body Ada.Strings.Wide_Maps is
----------------
function To_Mapping
(From, To : in Wide_Character_Sequence)
return Wide_Character_Mapping
(From, To : Wide_Character_Sequence) return Wide_Character_Mapping
is
Domain : Wide_Character_Sequence (1 .. From'Length);
Rangev : Wide_Character_Sequence (1 .. To'Length);
@ -554,8 +545,7 @@ package body Ada.Strings.Wide_Maps is
--------------
function To_Range
(Map : in Wide_Character_Mapping)
return Wide_Character_Sequence
(Map : Wide_Character_Mapping) return Wide_Character_Sequence
is
begin
return Map.Map.Rangev;
@ -566,8 +556,7 @@ package body Ada.Strings.Wide_Maps is
---------------
function To_Ranges
(Set : in Wide_Character_Set)
return Wide_Character_Ranges
(Set : in Wide_Character_Set) return Wide_Character_Ranges
is
begin
return Set.Set.all;
@ -578,8 +567,7 @@ package body Ada.Strings.Wide_Maps is
-----------------
function To_Sequence
(Set : in Wide_Character_Set)
return Wide_Character_Sequence
(Set : Wide_Character_Set) return Wide_Character_Sequence
is
SS : constant Wide_Character_Ranges_Access := Set.Set;
@ -604,8 +592,7 @@ package body Ada.Strings.Wide_Maps is
-- Case of multiple range input
function To_Set
(Ranges : in Wide_Character_Ranges)
return Wide_Character_Set
(Ranges : Wide_Character_Ranges) return Wide_Character_Set
is
Result : Wide_Character_Ranges (Ranges'Range);
N : Natural := 0;
@ -667,8 +654,7 @@ package body Ada.Strings.Wide_Maps is
-- Case of single range input
function To_Set
(Span : in Wide_Character_Range)
return Wide_Character_Set
(Span : Wide_Character_Range) return Wide_Character_Set
is
begin
if Span.Low > Span.High then
@ -685,8 +671,7 @@ package body Ada.Strings.Wide_Maps is
-- Case of wide string input
function To_Set
(Sequence : in Wide_Character_Sequence)
return Wide_Character_Set
(Sequence : Wide_Character_Sequence) return Wide_Character_Set
is
R : Wide_Character_Ranges (1 .. Sequence'Length);
@ -701,8 +686,7 @@ package body Ada.Strings.Wide_Maps is
-- Case of single wide character input
function To_Set
(Singleton : in Wide_Character)
return Wide_Character_Set
(Singleton : Wide_Character) return Wide_Character_Set
is
begin
return
@ -715,9 +699,8 @@ package body Ada.Strings.Wide_Maps is
-----------
function Value
(Map : in Wide_Character_Mapping;
Element : in Wide_Character)
return Wide_Character
(Map : Wide_Character_Mapping;
Element : Wide_Character) return Wide_Character
is
L, R, M : Natural;

View File

@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
-- Copyright (C) 1992-1998 Free Software Foundation, Inc. --
-- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
@ -63,16 +63,13 @@ package Ada.Strings.Wide_Maps is
array (Positive range <>) of Wide_Character_Range;
function To_Set
(Ranges : in Wide_Character_Ranges)
return Wide_Character_Set;
(Ranges : Wide_Character_Ranges) return Wide_Character_Set;
function To_Set
(Span : in Wide_Character_Range)
return Wide_Character_Set;
(Span : Wide_Character_Range) return Wide_Character_Set;
function To_Ranges
(Set : in Wide_Character_Set)
return Wide_Character_Ranges;
(Set : in Wide_Character_Set) return Wide_Character_Ranges;
---------------------------------------
-- Operations on Wide Character Sets --
@ -81,55 +78,44 @@ package Ada.Strings.Wide_Maps is
function "=" (Left, Right : in Wide_Character_Set) return Boolean;
function "not"
(Right : in Wide_Character_Set)
return Wide_Character_Set;
(Right : Wide_Character_Set) return Wide_Character_Set;
function "and"
(Left, Right : in Wide_Character_Set)
return Wide_Character_Set;
(Left, Right : Wide_Character_Set) return Wide_Character_Set;
function "or"
(Left, Right : in Wide_Character_Set)
return Wide_Character_Set;
(Left, Right : Wide_Character_Set) return Wide_Character_Set;
function "xor"
(Left, Right : in Wide_Character_Set)
return Wide_Character_Set;
(Left, Right : Wide_Character_Set) return Wide_Character_Set;
function "-"
(Left, Right : in Wide_Character_Set)
return Wide_Character_Set;
(Left, Right : Wide_Character_Set) return Wide_Character_Set;
function Is_In
(Element : in Wide_Character;
Set : in Wide_Character_Set)
return Boolean;
(Element : Wide_Character;
Set : Wide_Character_Set) return Boolean;
function Is_Subset
(Elements : in Wide_Character_Set;
Set : in Wide_Character_Set)
return Boolean;
(Elements : Wide_Character_Set;
Set : Wide_Character_Set) return Boolean;
function "<="
(Left : in Wide_Character_Set;
Right : in Wide_Character_Set)
return Boolean
(Left : Wide_Character_Set;
Right : Wide_Character_Set) return Boolean
renames Is_Subset;
subtype Wide_Character_Sequence is Wide_String;
-- Alternative representation for a set of character values
function To_Set
(Sequence : in Wide_Character_Sequence)
return Wide_Character_Set;
(Sequence : Wide_Character_Sequence) return Wide_Character_Set;
function To_Set
(Singleton : in Wide_Character)
return Wide_Character_Set;
(Singleton : Wide_Character) return Wide_Character_Set;
function To_Sequence
(Set : in Wide_Character_Set)
return Wide_Character_Sequence;
(Set : Wide_Character_Set) return Wide_Character_Sequence;
-----------------------------------------
-- Wide Character Mapping Declarations --
@ -139,9 +125,8 @@ package Ada.Strings.Wide_Maps is
-- Representation for a wide character to wide character mapping:
function Value
(Map : in Wide_Character_Mapping;
Element : in Wide_Character)
return Wide_Character;
(Map : Wide_Character_Mapping;
Element : Wide_Character) return Wide_Character;
Identity : constant Wide_Character_Mapping;
@ -150,19 +135,16 @@ package Ada.Strings.Wide_Maps is
---------------------------------
function To_Mapping
(From, To : in Wide_Character_Sequence)
return Wide_Character_Mapping;
(From, To : Wide_Character_Sequence) return Wide_Character_Mapping;
function To_Domain
(Map : in Wide_Character_Mapping)
return Wide_Character_Sequence;
(Map : Wide_Character_Mapping) return Wide_Character_Sequence;
function To_Range
(Map : in Wide_Character_Mapping)
return Wide_Character_Sequence;
(Map : Wide_Character_Mapping) return Wide_Character_Sequence;
type Wide_Character_Mapping_Function is
access function (From : in Wide_Character) return Wide_Character;
access function (From : Wide_Character) return Wide_Character;
private
package AF renames Ada.Finalization;

View File

@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
-- Copyright (C) 1992,1993,1994 Free Software Foundation, Inc. --
-- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@ -42,8 +42,7 @@ package body Ada.Strings.Wide_Search is
function Belongs
(Element : Wide_Character;
Set : Wide_Maps.Wide_Character_Set;
Test : Membership)
return Boolean;
Test : Membership) return Boolean;
pragma Inline (Belongs);
-- Determines if the given element is in (Test = Inside) or not in
-- (Test = Outside) the given character set.
@ -55,9 +54,8 @@ package body Ada.Strings.Wide_Search is
function Belongs
(Element : Wide_Character;
Set : Wide_Maps.Wide_Character_Set;
Test : Membership)
return Boolean is
Test : Membership) return Boolean
is
begin
if Test = Inside then
return Is_In (Element, Set);
@ -71,10 +69,10 @@ package body Ada.Strings.Wide_Search is
-----------
function Count
(Source : in Wide_String;
Pattern : in Wide_String;
Mapping : in Wide_Maps.Wide_Character_Mapping := Wide_Maps.Identity)
return Natural
(Source : Wide_String;
Pattern : Wide_String;
Mapping : Wide_Maps.Wide_Character_Mapping := Wide_Maps.Identity)
return Natural
is
N : Natural;
J : Natural;
@ -117,10 +115,9 @@ package body Ada.Strings.Wide_Search is
end Count;
function Count
(Source : in Wide_String;
Pattern : in Wide_String;
Mapping : in Wide_Maps.Wide_Character_Mapping_Function)
return Natural
(Source : Wide_String;
Pattern : Wide_String;
Mapping : Wide_Maps.Wide_Character_Mapping_Function) return Natural
is
Mapped_Source : Wide_String (Source'Range);
@ -132,9 +129,9 @@ package body Ada.Strings.Wide_Search is
return Count (Mapped_Source, Pattern);
end Count;
function Count (Source : in Wide_String;
Set : in Wide_Maps.Wide_Character_Set)
return Natural
function Count
(Source : in Wide_String;
Set : Wide_Maps.Wide_Character_Set) return Natural
is
N : Natural := 0;
@ -153,9 +150,9 @@ package body Ada.Strings.Wide_Search is
----------------
procedure Find_Token
(Source : in Wide_String;
Set : in Wide_Maps.Wide_Character_Set;
Test : in Membership;
(Source : Wide_String;
Set : Wide_Maps.Wide_Character_Set;
Test : Membership;
First : out Positive;
Last : out Natural)
is
@ -190,11 +187,11 @@ package body Ada.Strings.Wide_Search is
-----------
function Index
(Source : in Wide_String;
Pattern : in Wide_String;
Going : in Direction := Forward;
Mapping : in Wide_Maps.Wide_Character_Mapping := Wide_Maps.Identity)
return Natural
(Source : Wide_String;
Pattern : Wide_String;
Going : Direction := Forward;
Mapping : Wide_Maps.Wide_Character_Mapping := Wide_Maps.Identity)
return Natural
is
begin
if Pattern = "" then
@ -239,16 +236,11 @@ package body Ada.Strings.Wide_Search is
return 0;
end Index;
-----------
-- Index --
-----------
function Index
(Source : in Wide_String;
Pattern : in Wide_String;
Going : in Direction := Forward;
Mapping : in Wide_Maps.Wide_Character_Mapping_Function)
return Natural
(Source : Wide_String;
Pattern : Wide_String;
Going : Direction := Forward;
Mapping : Wide_Maps.Wide_Character_Mapping_Function) return Natural
is
Mapped_Source : Wide_String (Source'Range);
@ -261,11 +253,10 @@ package body Ada.Strings.Wide_Search is
end Index;
function Index
(Source : in Wide_String;
Set : in Wide_Maps.Wide_Character_Set;
Test : in Membership := Inside;
Going : in Direction := Forward)
return Natural
(Source : Wide_String;
Set : Wide_Maps.Wide_Character_Set;
Test : Membership := Inside;
Going : Direction := Forward) return Natural
is
begin
if Going = Forward then
@ -288,14 +279,92 @@ package body Ada.Strings.Wide_Search is
return 0;
end Index;
function Index
(Source : Wide_String;
Pattern : Wide_String;
From : Positive;
Going : Direction := Forward;
Mapping : Wide_Maps.Wide_Character_Mapping := Wide_Maps.Identity)
return Natural
is
begin
if Going = Forward then
if From < Source'First then
raise Index_Error;
end if;
return
Index (Source (From .. Source'Last), Pattern, Forward, Mapping);
else
if From > Source'Last then
raise Index_Error;
end if;
return
Index (Source (Source'First .. From), Pattern, Backward, Mapping);
end if;
end Index;
function Index
(Source : Wide_String;
Pattern : Wide_String;
From : Positive;
Going : Direction := Forward;
Mapping : Wide_Maps.Wide_Character_Mapping_Function) return Natural
is
begin
if Going = Forward then
if From < Source'First then
raise Index_Error;
end if;
return Index
(Source (From .. Source'Last), Pattern, Forward, Mapping);
else
if From > Source'Last then
raise Index_Error;
end if;
return Index
(Source (Source'First .. From), Pattern, Backward, Mapping);
end if;
end Index;
function Index
(Source : Wide_String;
Set : Wide_Maps.Wide_Character_Set;
From : Positive;
Test : Membership := Inside;
Going : Direction := Forward) return Natural
is
begin
if Going = Forward then
if From < Source'First then
raise Index_Error;
end if;
return
Index (Source (From .. Source'Last), Set, Test, Forward);
else
if From > Source'Last then
raise Index_Error;
end if;
return
Index (Source (Source'First .. From), Set, Test, Backward);
end if;
end Index;
---------------------
-- Index_Non_Blank --
---------------------
function Index_Non_Blank
(Source : in Wide_String;
Going : in Direction := Forward)
return Natural
(Source : Wide_String;
Going : Direction := Forward) return Natural
is
begin
if Going = Forward then
@ -316,7 +385,30 @@ package body Ada.Strings.Wide_Search is
-- Fall through if no match
return 0;
end Index_Non_Blank;
function Index_Non_Blank
(Source : Wide_String;
From : Positive;
Going : Direction := Forward) return Natural
is
begin
if Going = Forward then
if From < Source'First then
raise Index_Error;
end if;
return
Index_Non_Blank (Source (From .. Source'Last), Forward);
else
if From > Source'Last then
raise Index_Error;
end if;
return
Index_Non_Blank (Source (Source'First .. From), Backward);
end if;
end Index_Non_Blank;
end Ada.Strings.Wide_Search;

View File

@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
-- Copyright (C) 1992-1997 Free Software Foundation, Inc. --
-- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@ -43,49 +43,76 @@ with Ada.Strings.Wide_Maps;
private package Ada.Strings.Wide_Search is
pragma Preelaborate (Wide_Search);
function Index (Source : in Wide_String;
Pattern : in Wide_String;
Going : in Direction := Forward;
Mapping : in Wide_Maps.Wide_Character_Mapping :=
Wide_Maps.Identity)
function Index
(Source : Wide_String;
Pattern : Wide_String;
Going : Direction := Forward;
Mapping : Wide_Maps.Wide_Character_Mapping :=
Wide_Maps.Identity) return Natural;
function Index
(Source : Wide_String;
Pattern : Wide_String;
Going : Direction := Forward;
Mapping : Wide_Maps.Wide_Character_Mapping_Function) return Natural;
function Index
(Source : Wide_String;
Set : Wide_Maps.Wide_Character_Set;
Test : Membership := Inside;
Going : Direction := Forward) return Natural;
function Index
(Source : Wide_String;
Pattern : Wide_String;
From : Positive;
Going : Direction := Forward;
Mapping : Wide_Maps.Wide_Character_Mapping := Wide_Maps.Identity)
return Natural;
function Index (Source : in Wide_String;
Pattern : in Wide_String;
Going : in Direction := Forward;
Mapping : in Wide_Maps.Wide_Character_Mapping_Function)
function Index
(Source : Wide_String;
Pattern : Wide_String;
From : Positive;
Going : Direction := Forward;
Mapping : Wide_Maps.Wide_Character_Mapping_Function) return Natural;
function Index
(Source : Wide_String;
Set : Wide_Maps.Wide_Character_Set;
From : Positive;
Test : Membership := Inside;
Going : Direction := Forward) return Natural;
function Index_Non_Blank
(Source : Wide_String;
Going : Direction := Forward) return Natural;
function Index_Non_Blank
(Source : Wide_String;
From : Positive;
Going : Direction := Forward) return Natural;
function Count
(Source : Wide_String;
Pattern : Wide_String;
Mapping : Wide_Maps.Wide_Character_Mapping := Wide_Maps.Identity)
return Natural;
function Index (Source : in Wide_String;
Set : in Wide_Maps.Wide_Character_Set;
Test : in Membership := Inside;
Going : in Direction := Forward)
return Natural;
function Count
(Source : Wide_String;
Pattern : Wide_String;
Mapping : Wide_Maps.Wide_Character_Mapping_Function) return Natural;
function Index_Non_Blank (Source : in Wide_String;
Going : in Direction := Forward)
return Natural;
function Count
(Source : Wide_String;
Set : Wide_Maps.Wide_Character_Set) return Natural;
function Count (Source : in Wide_String;
Pattern : in Wide_String;
Mapping : in Wide_Maps.Wide_Character_Mapping :=
Wide_Maps.Identity)
return Natural;
function Count (Source : in Wide_String;
Pattern : in Wide_String;
Mapping : in Wide_Maps.Wide_Character_Mapping_Function)
return Natural;
function Count (Source : in Wide_String;
Set : in Wide_Maps.Wide_Character_Set)
return Natural;
procedure Find_Token (Source : in Wide_String;
Set : in Wide_Maps.Wide_Character_Set;
Test : in Membership;
First : out Positive;
Last : out Natural);
procedure Find_Token
(Source : Wide_String;
Set : Wide_Maps.Wide_Character_Set;
Test : Membership;
First : out Positive;
Last : out Natural);
end Ada.Strings.Wide_Search;

View File

@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
-- Copyright (C) 1992-2004 Free Software Foundation, Inc. --
-- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@ -60,7 +60,6 @@ package body Ada.Text_IO is
function AFCB_Allocate (Control_Block : Text_AFCB) return FCB.AFCB_Ptr is
pragma Unreferenced (Control_Block);
begin
return new Text_AFCB;
end AFCB_Allocate;
@ -118,7 +117,7 @@ package body Ada.Text_IO is
-- to exceed the value of Count'Last, i.e. no check is required for
-- overflow raising layout error.
function Col (File : in File_Type) return Positive_Count is
function Col (File : File_Type) return Positive_Count is
begin
FIO.Check_File_Open (AP (File));
return File.Col;
@ -135,9 +134,9 @@ package body Ada.Text_IO is
procedure Create
(File : in out File_Type;
Mode : in File_Mode := Out_File;
Name : in String := "";
Form : in String := "")
Mode : File_Mode := Out_File;
Name : String := "";
Form : String := "")
is
Dummy_File_Control_Block : Text_AFCB;
pragma Warnings (Off, Dummy_File_Control_Block);
@ -212,8 +211,8 @@ package body Ada.Text_IO is
-- End_Of_File --
-----------------
function End_Of_File (File : in File_Type) return Boolean is
ch : int;
function End_Of_File (File : File_Type) return Boolean is
ch : int;
begin
FIO.Check_Read_Status (AP (File));
@ -270,7 +269,7 @@ package body Ada.Text_IO is
-- End_Of_Line --
-----------------
function End_Of_Line (File : in File_Type) return Boolean is
function End_Of_Line (File : File_Type) return Boolean is
ch : int;
begin
@ -301,7 +300,7 @@ package body Ada.Text_IO is
-- End_Of_Page --
-----------------
function End_Of_Page (File : in File_Type) return Boolean is
function End_Of_Page (File : File_Type) return Boolean is
ch : int;
begin
@ -357,7 +356,7 @@ package body Ada.Text_IO is
-- Flush --
-----------
procedure Flush (File : in File_Type) is
procedure Flush (File : File_Type) is
begin
FIO.Flush (AP (File));
end Flush;
@ -371,7 +370,7 @@ package body Ada.Text_IO is
-- Form --
----------
function Form (File : in File_Type) return String is
function Form (File : File_Type) return String is
begin
return FIO.Form (AP (File));
end Form;
@ -381,7 +380,7 @@ package body Ada.Text_IO is
---------
procedure Get
(File : in File_Type;
(File : File_Type;
Item : out Character)
is
ch : int;
@ -430,7 +429,7 @@ package body Ada.Text_IO is
end Get;
procedure Get
(File : in File_Type;
(File : File_Type;
Item : out String)
is
ch : int;
@ -489,7 +488,7 @@ package body Ada.Text_IO is
-- More work required here ???
procedure Get_Immediate
(File : in File_Type;
(File : File_Type;
Item : out Character)
is
ch : int;
@ -530,7 +529,7 @@ package body Ada.Text_IO is
end Get_Immediate;
procedure Get_Immediate
(File : in File_Type;
(File : File_Type;
Item : out Character;
Available : out Boolean)
is
@ -594,7 +593,7 @@ package body Ada.Text_IO is
--------------
procedure Get_Line
(File : in File_Type;
(File : File_Type;
Item : out String;
Last : out Natural)
is
@ -712,6 +711,58 @@ package body Ada.Text_IO is
Get_Line (Current_In, Item, Last);
end Get_Line;
function Get_Line (File : File_Type) return String is
Buffer : String (1 .. 500);
Last : Natural;
function Get_Rest (S : String) return String;
-- This is a recursive function that reads the rest of the line and
-- returns it. S is the part read so far.
--------------
-- Get_Rest --
--------------
function Get_Rest (S : String) return String is
-- Each time we allocate a buffer the same size as what we have
-- read so far. This limits us to a logarithmic number of calls
-- to Get_Rest and also ensures only a linear use of stack space.
Buffer : String (1 .. S'Length);
Last : Natural;
begin
Get_Line (File, Buffer, Last);
declare
R : constant String := S & Buffer (1 .. Last);
begin
if Last < Buffer'Last then
return R;
else
return Get_Rest (R);
end if;
end;
end Get_Rest;
-- Start of processing for Get_Line
begin
Get_Line (File, Buffer, Last);
if Last < Buffer'Last then
return Buffer (1 .. Last);
else
return Get_Rest (Buffer (1 .. Last));
end if;
end Get_Line;
function Get_Line return String is
begin
return Get_Line (Current_In);
end Get_Line;
----------
-- Getc --
----------
@ -733,7 +784,7 @@ package body Ada.Text_IO is
-- Is_Open --
-------------
function Is_Open (File : in File_Type) return Boolean is
function Is_Open (File : File_Type) return Boolean is
begin
return FIO.Is_Open (AP (File));
end Is_Open;
@ -746,7 +797,7 @@ package body Ada.Text_IO is
-- to exceed the value of Count'Last, i.e. no check is required for
-- overflow raising layout error.
function Line (File : in File_Type) return Positive_Count is
function Line (File : File_Type) return Positive_Count is
begin
FIO.Check_File_Open (AP (File));
return File.Line;
@ -761,7 +812,7 @@ package body Ada.Text_IO is
-- Line_Length --
-----------------
function Line_Length (File : in File_Type) return Count is
function Line_Length (File : File_Type) return Count is
begin
FIO.Check_Write_Status (AP (File));
return File.Line_Length;
@ -777,7 +828,7 @@ package body Ada.Text_IO is
----------------
procedure Look_Ahead
(File : in File_Type;
(File : File_Type;
Item : out Character;
End_Of_Line : out Boolean)
is
@ -818,7 +869,7 @@ package body Ada.Text_IO is
-- Mode --
----------
function Mode (File : in File_Type) return File_Mode is
function Mode (File : File_Type) return File_Mode is
begin
return To_TIO (FIO.Mode (AP (File)));
end Mode;
@ -827,7 +878,7 @@ package body Ada.Text_IO is
-- Name --
----------
function Name (File : in File_Type) return String is
function Name (File : File_Type) return String is
begin
return FIO.Name (AP (File));
end Name;
@ -837,8 +888,8 @@ package body Ada.Text_IO is
--------------
procedure New_Line
(File : in File_Type;
Spacing : in Positive_Count := 1)
(File : File_Type;
Spacing : Positive_Count := 1)
is
begin
-- Raise Constraint_Error if out of range value. The reason for this
@ -867,7 +918,7 @@ package body Ada.Text_IO is
File.Col := 1;
end New_Line;
procedure New_Line (Spacing : in Positive_Count := 1) is
procedure New_Line (Spacing : Positive_Count := 1) is
begin
New_Line (Current_Out, Spacing);
end New_Line;
@ -876,7 +927,7 @@ package body Ada.Text_IO is
-- New_Page --
--------------
procedure New_Page (File : in File_Type) is
procedure New_Page (File : File_Type) is
begin
FIO.Check_Write_Status (AP (File));
@ -925,9 +976,9 @@ package body Ada.Text_IO is
procedure Open
(File : in out File_Type;
Mode : in File_Mode;
Name : in String;
Form : in String := "")
Mode : File_Mode;
Name : String;
Form : String := "")
is
Dummy_File_Control_Block : Text_AFCB;
pragma Warnings (Off, Dummy_File_Control_Block);
@ -955,7 +1006,7 @@ package body Ada.Text_IO is
-- to exceed the value of Count'Last, i.e. no check is required for
-- overflow raising layout error.
function Page (File : in File_Type) return Positive_Count is
function Page (File : File_Type) return Positive_Count is
begin
FIO.Check_File_Open (AP (File));
return File.Page;
@ -970,7 +1021,7 @@ package body Ada.Text_IO is
-- Page_Length --
-----------------
function Page_Length (File : in File_Type) return Count is
function Page_Length (File : File_Type) return Count is
begin
FIO.Check_Write_Status (AP (File));
return File.Page_Length;
@ -986,8 +1037,8 @@ package body Ada.Text_IO is
---------
procedure Put
(File : in File_Type;
Item : in Character)
(File : File_Type;
Item : Character)
is
begin
FIO.Check_Write_Status (AP (File));
@ -1003,7 +1054,7 @@ package body Ada.Text_IO is
File.Col := File.Col + 1;
end Put;
procedure Put (Item : in Character) is
procedure Put (Item : Character) is
begin
FIO.Check_Write_Status (AP (Current_Out));
@ -1025,8 +1076,8 @@ package body Ada.Text_IO is
---------
procedure Put
(File : in File_Type;
Item : in String)
(File : File_Type;
Item : String)
is
begin
FIO.Check_Write_Status (AP (File));
@ -1052,7 +1103,7 @@ package body Ada.Text_IO is
end if;
end Put;
procedure Put (Item : in String) is
procedure Put (Item : String) is
begin
Put (Current_Out, Item);
end Put;
@ -1062,8 +1113,8 @@ package body Ada.Text_IO is
--------------
procedure Put_Line
(File : in File_Type;
Item : in String)
(File : File_Type;
Item : String)
is
Ilen : Natural := Item'Length;
Istart : Natural := Item'First;
@ -1127,7 +1178,7 @@ package body Ada.Text_IO is
end;
end Put_Line;
procedure Put_Line (Item : in String) is
procedure Put_Line (Item : String) is
begin
Put_Line (Current_Out, Item);
end Put_Line;
@ -1231,7 +1282,7 @@ package body Ada.Text_IO is
procedure Reset
(File : in out File_Type;
Mode : in File_Mode)
Mode : File_Mode)
is
begin
-- Don't allow change of mode for current file (RM A.10.2(5))
@ -1273,8 +1324,8 @@ package body Ada.Text_IO is
-------------
procedure Set_Col
(File : in File_Type;
To : in Positive_Count)
(File : File_Type;
To : Positive_Count)
is
ch : int;
@ -1333,7 +1384,7 @@ package body Ada.Text_IO is
end if;
end Set_Col;
procedure Set_Col (To : in Positive_Count) is
procedure Set_Col (To : Positive_Count) is
begin
Set_Col (Current_Out, To);
end Set_Col;
@ -1342,7 +1393,7 @@ package body Ada.Text_IO is
-- Set_Error --
---------------
procedure Set_Error (File : in File_Type) is
procedure Set_Error (File : File_Type) is
begin
FIO.Check_Write_Status (AP (File));
Current_Err := File;
@ -1352,7 +1403,7 @@ package body Ada.Text_IO is
-- Set_Input --
---------------
procedure Set_Input (File : in File_Type) is
procedure Set_Input (File : File_Type) is
begin
FIO.Check_Read_Status (AP (File));
Current_In := File;
@ -1363,8 +1414,8 @@ package body Ada.Text_IO is
--------------
procedure Set_Line
(File : in File_Type;
To : in Positive_Count)
(File : File_Type;
To : Positive_Count)
is
begin
-- Raise Constraint_Error if out of range value. The reason for this
@ -1401,7 +1452,7 @@ package body Ada.Text_IO is
end if;
end Set_Line;
procedure Set_Line (To : in Positive_Count) is
procedure Set_Line (To : Positive_Count) is
begin
Set_Line (Current_Out, To);
end Set_Line;
@ -1410,7 +1461,7 @@ package body Ada.Text_IO is
-- Set_Line_Length --
---------------------
procedure Set_Line_Length (File : in File_Type; To : in Count) is
procedure Set_Line_Length (File : File_Type; To : Count) is
begin
-- Raise Constraint_Error if out of range value. The reason for this
-- explicit test is that we don't want junk values around, even if
@ -1424,7 +1475,7 @@ package body Ada.Text_IO is
File.Line_Length := To;
end Set_Line_Length;
procedure Set_Line_Length (To : in Count) is
procedure Set_Line_Length (To : Count) is
begin
Set_Line_Length (Current_Out, To);
end Set_Line_Length;
@ -1433,7 +1484,7 @@ package body Ada.Text_IO is
-- Set_Output --
----------------
procedure Set_Output (File : in File_Type) is
procedure Set_Output (File : File_Type) is
begin
FIO.Check_Write_Status (AP (File));
Current_Out := File;
@ -1443,7 +1494,7 @@ package body Ada.Text_IO is
-- Set_Page_Length --
---------------------
procedure Set_Page_Length (File : in File_Type; To : in Count) is
procedure Set_Page_Length (File : File_Type; To : Count) is
begin
-- Raise Constraint_Error if out of range value. The reason for this
-- explicit test is that we don't want junk values around, even if
@ -1457,7 +1508,7 @@ package body Ada.Text_IO is
File.Page_Length := To;
end Set_Page_Length;
procedure Set_Page_Length (To : in Count) is
procedure Set_Page_Length (To : Count) is
begin
Set_Page_Length (Current_Out, To);
end Set_Page_Length;
@ -1467,8 +1518,8 @@ package body Ada.Text_IO is
---------------
procedure Skip_Line
(File : in File_Type;
Spacing : in Positive_Count := 1)
(File : File_Type;
Spacing : Positive_Count := 1)
is
ch : int;
@ -1548,7 +1599,7 @@ package body Ada.Text_IO is
end loop;
end Skip_Line;
procedure Skip_Line (Spacing : in Positive_Count := 1) is
procedure Skip_Line (Spacing : Positive_Count := 1) is
begin
Skip_Line (Current_In, Spacing);
end Skip_Line;
@ -1557,7 +1608,7 @@ package body Ada.Text_IO is
-- Skip_Page --
---------------
procedure Skip_Page (File : in File_Type) is
procedure Skip_Page (File : File_Type) is
ch : int;
begin
@ -1712,7 +1763,7 @@ package body Ada.Text_IO is
procedure Write
(File : in out Text_AFCB;
Item : in Stream_Element_Array)
Item : Stream_Element_Array)
is
function Has_Translated_Characters return Boolean;

View File

@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
-- Copyright (C) 1992-2002 Free Software Foundation, Inc. --
-- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
@ -86,34 +86,34 @@ pragma Elaborate_Body (Text_IO);
procedure Create
(File : in out File_Type;
Mode : in File_Mode := Out_File;
Name : in String := "";
Form : in String := "");
Mode : File_Mode := Out_File;
Name : String := "";
Form : String := "");
procedure Open
(File : in out File_Type;
Mode : in File_Mode;
Name : in String;
Form : in String := "");
Mode : File_Mode;
Name : String;
Form : String := "");
procedure Close (File : in out File_Type);
procedure Delete (File : in out File_Type);
procedure Reset (File : in out File_Type; Mode : in File_Mode);
procedure Reset (File : in out File_Type; Mode : File_Mode);
procedure Reset (File : in out File_Type);
function Mode (File : in File_Type) return File_Mode;
function Name (File : in File_Type) return String;
function Form (File : in File_Type) return String;
function Mode (File : File_Type) return File_Mode;
function Name (File : File_Type) return String;
function Form (File : File_Type) return String;
function Is_Open (File : in File_Type) return Boolean;
function Is_Open (File : File_Type) return Boolean;
------------------------------------------------------
-- Control of default input, output and error files --
------------------------------------------------------
procedure Set_Input (File : in File_Type);
procedure Set_Output (File : in File_Type);
procedure Set_Error (File : in File_Type);
procedure Set_Input (File : File_Type);
procedure Set_Output (File : File_Type);
procedure Set_Error (File : File_Type);
function Standard_Input return File_Type;
function Standard_Output return File_Type;
@ -140,76 +140,76 @@ pragma Elaborate_Body (Text_IO);
-- Note: The parameter file is IN OUT in the RM, but this is clearly
-- an oversight, and was intended to be IN, see AI95-00057.
procedure Flush (File : in File_Type);
procedure Flush (File : File_Type);
procedure Flush;
--------------------------------------------
-- Specification of line and page lengths --
--------------------------------------------
procedure Set_Line_Length (File : in File_Type; To : in Count);
procedure Set_Line_Length (To : in Count);
procedure Set_Line_Length (File : File_Type; To : Count);
procedure Set_Line_Length (To : Count);
procedure Set_Page_Length (File : in File_Type; To : in Count);
procedure Set_Page_Length (To : in Count);
procedure Set_Page_Length (File : File_Type; To : Count);
procedure Set_Page_Length (To : Count);
function Line_Length (File : in File_Type) return Count;
function Line_Length (File : File_Type) return Count;
function Line_Length return Count;
function Page_Length (File : in File_Type) return Count;
function Page_Length (File : File_Type) return Count;
function Page_Length return Count;
------------------------------------
-- Column, Line, and Page Control --
------------------------------------
procedure New_Line (File : in File_Type; Spacing : in Positive_Count := 1);
procedure New_Line (Spacing : in Positive_Count := 1);
procedure New_Line (File : File_Type; Spacing : Positive_Count := 1);
procedure New_Line (Spacing : Positive_Count := 1);
procedure Skip_Line (File : in File_Type; Spacing : in Positive_Count := 1);
procedure Skip_Line (Spacing : in Positive_Count := 1);
procedure Skip_Line (File : File_Type; Spacing : Positive_Count := 1);
procedure Skip_Line (Spacing : Positive_Count := 1);
function End_Of_Line (File : in File_Type) return Boolean;
function End_Of_Line (File : File_Type) return Boolean;
function End_Of_Line return Boolean;
procedure New_Page (File : in File_Type);
procedure New_Page (File : File_Type);
procedure New_Page;
procedure Skip_Page (File : in File_Type);
procedure Skip_Page (File : File_Type);
procedure Skip_Page;
function End_Of_Page (File : in File_Type) return Boolean;
function End_Of_Page (File : File_Type) return Boolean;
function End_Of_Page return Boolean;
function End_Of_File (File : in File_Type) return Boolean;
function End_Of_File (File : File_Type) return Boolean;
function End_Of_File return Boolean;
procedure Set_Col (File : in File_Type; To : in Positive_Count);
procedure Set_Col (To : in Positive_Count);
procedure Set_Col (File : File_Type; To : Positive_Count);
procedure Set_Col (To : Positive_Count);
procedure Set_Line (File : in File_Type; To : in Positive_Count);
procedure Set_Line (To : in Positive_Count);
procedure Set_Line (File : File_Type; To : Positive_Count);
procedure Set_Line (To : Positive_Count);
function Col (File : in File_Type) return Positive_Count;
function Col (File : File_Type) return Positive_Count;
function Col return Positive_Count;
function Line (File : in File_Type) return Positive_Count;
function Line (File : File_Type) return Positive_Count;
function Line return Positive_Count;
function Page (File : in File_Type) return Positive_Count;
function Page (File : File_Type) return Positive_Count;
function Page return Positive_Count;
----------------------------
-- Character Input-Output --
----------------------------
procedure Get (File : in File_Type; Item : out Character);
procedure Get (File : File_Type; Item : out Character);
procedure Get (Item : out Character);
procedure Put (File : in File_Type; Item : in Character);
procedure Put (Item : in Character);
procedure Put (File : File_Type; Item : Character);
procedure Put (Item : Character);
procedure Look_Ahead
(File : in File_Type;
(File : File_Type;
Item : out Character;
End_Of_Line : out Boolean);
@ -218,14 +218,14 @@ pragma Elaborate_Body (Text_IO);
End_Of_Line : out Boolean);
procedure Get_Immediate
(File : in File_Type;
(File : File_Type;
Item : out Character);
procedure Get_Immediate
(Item : out Character);
procedure Get_Immediate
(File : in File_Type;
(File : File_Type;
Item : out Character;
Available : out Boolean);
@ -237,13 +237,13 @@ pragma Elaborate_Body (Text_IO);
-- String Input-Output --
-------------------------
procedure Get (File : in File_Type; Item : out String);
procedure Get (File : File_Type; Item : out String);
procedure Get (Item : out String);
procedure Put (File : in File_Type; Item : in String);
procedure Put (Item : in String);
procedure Put (File : File_Type; Item : String);
procedure Put (Item : String);
procedure Get_Line
(File : in File_Type;
(File : File_Type;
Item : out String;
Last : out Natural);
@ -251,12 +251,18 @@ pragma Elaborate_Body (Text_IO);
(Item : out String;
Last : out Natural);
procedure Put_Line
(File : in File_Type;
Item : in String);
function Get_Line (File : File_Type) return String;
pragma Ada_05 (Get_Line);
function Get_Line return String;
pragma Ada_05 (Get_Line);
procedure Put_Line
(Item : in String);
(File : File_Type;
Item : String);
procedure Put_Line
(Item : String);
---------------------------------------
-- Generic packages for Input-Output --
@ -375,7 +381,7 @@ private
procedure Write
(File : in out Text_AFCB;
Item : in Ada.Streams.Stream_Element_Array);
Item : Ada.Streams.Stream_Element_Array);
-- Write operation used when Text_IO file is treated directly as Stream
------------------------

View File

@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
-- Copyright (C) 1992-2003 Free Software Foundation, Inc. --
-- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@ -40,6 +40,7 @@ with System.CRTL;
with System.File_IO;
with System.WCh_Cnv; use System.WCh_Cnv;
with System.WCh_Con; use System.WCh_Con;
with Unchecked_Conversion;
with Unchecked_Deallocation;
@ -65,14 +66,13 @@ package body Ada.Wide_Text_IO is
-- Local Subprograms --
-----------------------
function Getc_Immed (File : in File_Type) return int;
function Getc_Immed (File : File_Type) return int;
-- This routine is identical to Getc, except that the read is done in
-- Get_Immediate mode (i.e. without waiting for a line return).
function Get_Wide_Char_Immed
(C : Character;
File : File_Type)
return Wide_Character;
File : File_Type) return Wide_Character;
-- This routine is identical to Get_Wide_Char, except that the reads are
-- done in Get_Immediate mode (i.e. without waiting for a line return).
@ -86,11 +86,9 @@ package body Ada.Wide_Text_IO is
-------------------
function AFCB_Allocate
(Control_Block : Wide_Text_AFCB)
return FCB.AFCB_Ptr
(Control_Block : Wide_Text_AFCB) return FCB.AFCB_Ptr
is
pragma Unreferenced (Control_Block);
begin
return new Wide_Text_AFCB;
end AFCB_Allocate;
@ -148,7 +146,7 @@ package body Ada.Wide_Text_IO is
-- to exceed the value of Count'Last, i.e. no check is required for
-- overflow raising layout error.
function Col (File : in File_Type) return Positive_Count is
function Col (File : File_Type) return Positive_Count is
begin
FIO.Check_File_Open (AP (File));
return File.Col;
@ -165,9 +163,9 @@ package body Ada.Wide_Text_IO is
procedure Create
(File : in out File_Type;
Mode : in File_Mode := Out_File;
Name : in String := "";
Form : in String := "")
Mode : File_Mode := Out_File;
Name : String := "";
Form : String := "")
is
Dummy_File_Control_Block : Wide_Text_AFCB;
pragma Warnings (Off, Dummy_File_Control_Block);
@ -241,7 +239,7 @@ package body Ada.Wide_Text_IO is
-- End_Of_File --
-----------------
function End_Of_File (File : in File_Type) return Boolean is
function End_Of_File (File : File_Type) return Boolean is
ch : int;
begin
@ -302,7 +300,7 @@ package body Ada.Wide_Text_IO is
-- End_Of_Line --
-----------------
function End_Of_Line (File : in File_Type) return Boolean is
function End_Of_Line (File : File_Type) return Boolean is
ch : int;
begin
@ -336,7 +334,7 @@ package body Ada.Wide_Text_IO is
-- End_Of_Page --
-----------------
function End_Of_Page (File : in File_Type) return Boolean is
function End_Of_Page (File : File_Type) return Boolean is
ch : int;
begin
@ -386,7 +384,7 @@ package body Ada.Wide_Text_IO is
-- Flush --
-----------
procedure Flush (File : in File_Type) is
procedure Flush (File : File_Type) is
begin
FIO.Flush (AP (File));
end Flush;
@ -400,7 +398,7 @@ package body Ada.Wide_Text_IO is
-- Form --
----------
function Form (File : in File_Type) return String is
function Form (File : File_Type) return String is
begin
return FIO.Form (AP (File));
end Form;
@ -410,7 +408,7 @@ package body Ada.Wide_Text_IO is
---------
procedure Get
(File : in File_Type;
(File : File_Type;
Item : out Wide_Character)
is
C : Character;
@ -434,7 +432,7 @@ package body Ada.Wide_Text_IO is
end Get;
procedure Get
(File : in File_Type;
(File : File_Type;
Item : out Wide_String)
is
begin
@ -453,7 +451,7 @@ package body Ada.Wide_Text_IO is
-------------------
procedure Get_Character
(File : in File_Type;
(File : File_Type;
Item : out Character)
is
ch : int;
@ -501,7 +499,7 @@ package body Ada.Wide_Text_IO is
-------------------
procedure Get_Immediate
(File : in File_Type;
(File : File_Type;
Item : out Wide_Character)
is
ch : int;
@ -537,7 +535,7 @@ package body Ada.Wide_Text_IO is
end Get_Immediate;
procedure Get_Immediate
(File : in File_Type;
(File : File_Type;
Item : out Wide_Character;
Available : out Boolean)
is
@ -580,7 +578,7 @@ package body Ada.Wide_Text_IO is
--------------
procedure Get_Line
(File : in File_Type;
(File : File_Type;
Item : out Wide_String;
Last : out Natural)
is
@ -671,22 +669,78 @@ package body Ada.Wide_Text_IO is
Get_Line (Current_In, Item, Last);
end Get_Line;
function Get_Line (File : File_Type) return Wide_String is
Buffer : Wide_String (1 .. 500);
Last : Natural;
function Get_Rest (S : Wide_String) return Wide_String;
-- This is a recursive function that reads the rest of the line and
-- returns it. S is the part read so far.
--------------
-- Get_Rest --
--------------
function Get_Rest (S : Wide_String) return Wide_String is
-- Each time we allocate a buffer the same size as what we have
-- read so far. This limits us to a logarithmic number of calls
-- to Get_Rest and also ensures only a linear use of stack space.
Buffer : Wide_String (1 .. S'Length);
Last : Natural;
begin
Get_Line (File, Buffer, Last);
declare
R : constant Wide_String := S & Buffer (1 .. Last);
begin
if Last < Buffer'Last then
return R;
else
return Get_Rest (R);
end if;
end;
end Get_Rest;
-- Start of processing for Get_Line
begin
Get_Line (File, Buffer, Last);
if Last < Buffer'Last then
return Buffer (1 .. Last);
else
return Get_Rest (Buffer (1 .. Last));
end if;
end Get_Line;
function Get_Line return Wide_String is
begin
return Get_Line (Current_In);
end Get_Line;
-------------------
-- Get_Wide_Char --
-------------------
function Get_Wide_Char
(C : Character;
File : File_Type)
return Wide_Character
File : File_Type) return Wide_Character
is
function In_Char return Character;
-- Function used to obtain additional characters it the wide character
-- sequence is more than one character long.
function WC_In is new Char_Sequence_To_Wide_Char (In_Char);
-------------
-- In_Char --
-------------
function In_Char return Character is
ch : constant Integer := Getc (File);
begin
if ch = EOF then
raise End_Error;
@ -695,7 +749,7 @@ package body Ada.Wide_Text_IO is
end if;
end In_Char;
function WC_In is new Char_Sequence_To_Wide_Char (In_Char);
-- Start of processing for In_Char
begin
return WC_In (C, File.WC_Method);
@ -707,16 +761,20 @@ package body Ada.Wide_Text_IO is
function Get_Wide_Char_Immed
(C : Character;
File : File_Type)
return Wide_Character
File : File_Type) return Wide_Character
is
function In_Char return Character;
-- Function used to obtain additional characters it the wide character
-- sequence is more than one character long.
function WC_In is new Char_Sequence_To_Wide_Char (In_Char);
-------------
-- In_Char --
-------------
function In_Char return Character is
ch : constant Integer := Getc_Immed (File);
begin
if ch = EOF then
raise End_Error;
@ -725,7 +783,7 @@ package body Ada.Wide_Text_IO is
end if;
end In_Char;
function WC_In is new Char_Sequence_To_Wide_Char (In_Char);
-- Start of processing for Get_Wide_Char_Immed
begin
return WC_In (C, File.WC_Method);
@ -752,7 +810,7 @@ package body Ada.Wide_Text_IO is
-- Getc_Immed --
----------------
function Getc_Immed (File : in File_Type) return int is
function Getc_Immed (File : File_Type) return int is
ch : int;
end_of_file : int;
@ -785,7 +843,7 @@ package body Ada.Wide_Text_IO is
-- Is_Open --
-------------
function Is_Open (File : in File_Type) return Boolean is
function Is_Open (File : File_Type) return Boolean is
begin
return FIO.Is_Open (AP (File));
end Is_Open;
@ -798,7 +856,7 @@ package body Ada.Wide_Text_IO is
-- to exceed the value of Count'Last, i.e. no check is required for
-- overflow raising layout error.
function Line (File : in File_Type) return Positive_Count is
function Line (File : File_Type) return Positive_Count is
begin
FIO.Check_File_Open (AP (File));
return File.Line;
@ -813,7 +871,7 @@ package body Ada.Wide_Text_IO is
-- Line_Length --
-----------------
function Line_Length (File : in File_Type) return Count is
function Line_Length (File : File_Type) return Count is
begin
FIO.Check_Write_Status (AP (File));
return File.Line_Length;
@ -829,7 +887,7 @@ package body Ada.Wide_Text_IO is
----------------
procedure Look_Ahead
(File : in File_Type;
(File : File_Type;
Item : out Wide_Character;
End_Of_Line : out Boolean)
is
@ -902,7 +960,7 @@ package body Ada.Wide_Text_IO is
-- Mode --
----------
function Mode (File : in File_Type) return File_Mode is
function Mode (File : File_Type) return File_Mode is
begin
return To_TIO (FIO.Mode (AP (File)));
end Mode;
@ -911,7 +969,7 @@ package body Ada.Wide_Text_IO is
-- Name --
----------
function Name (File : in File_Type) return String is
function Name (File : File_Type) return String is
begin
return FIO.Name (AP (File));
end Name;
@ -921,8 +979,8 @@ package body Ada.Wide_Text_IO is
--------------
procedure New_Line
(File : in File_Type;
Spacing : in Positive_Count := 1)
(File : File_Type;
Spacing : Positive_Count := 1)
is
begin
-- Raise Constraint_Error if out of range value. The reason for this
@ -951,7 +1009,7 @@ package body Ada.Wide_Text_IO is
File.Col := 1;
end New_Line;
procedure New_Line (Spacing : in Positive_Count := 1) is
procedure New_Line (Spacing : Positive_Count := 1) is
begin
New_Line (Current_Out, Spacing);
end New_Line;
@ -960,7 +1018,7 @@ package body Ada.Wide_Text_IO is
-- New_Page --
--------------
procedure New_Page (File : in File_Type) is
procedure New_Page (File : File_Type) is
begin
FIO.Check_Write_Status (AP (File));
@ -1009,9 +1067,9 @@ package body Ada.Wide_Text_IO is
procedure Open
(File : in out File_Type;
Mode : in File_Mode;
Name : in String;
Form : in String := "")
Mode : File_Mode;
Name : String;
Form : String := "")
is
Dummy_File_Control_Block : Wide_Text_AFCB;
pragma Warnings (Off, Dummy_File_Control_Block);
@ -1038,7 +1096,7 @@ package body Ada.Wide_Text_IO is
-- to exceed the value of Count'Last, i.e. no check is required for
-- overflow raising layout error.
function Page (File : in File_Type) return Positive_Count is
function Page (File : File_Type) return Positive_Count is
begin
FIO.Check_File_Open (AP (File));
return File.Page;
@ -1053,7 +1111,7 @@ package body Ada.Wide_Text_IO is
-- Page_Length --
-----------------
function Page_Length (File : in File_Type) return Count is
function Page_Length (File : File_Type) return Count is
begin
FIO.Check_Write_Status (AP (File));
return File.Page_Length;
@ -1069,25 +1127,30 @@ package body Ada.Wide_Text_IO is
---------
procedure Put
(File : in File_Type;
Item : in Wide_Character)
(File : File_Type;
Item : Wide_Character)
is
procedure Out_Char (C : Character);
-- Procedure to output one character of a wide character sequence
procedure WC_Out is new Wide_Char_To_Char_Sequence (Out_Char);
--------------
-- Out_Char --
--------------
procedure Out_Char (C : Character) is
begin
Putc (Character'Pos (C), File);
end Out_Char;
procedure WC_Out is new Wide_Char_To_Char_Sequence (Out_Char);
-- Start of processing for Put
begin
WC_Out (Item, File.WC_Method);
File.Col := File.Col + 1;
end Put;
procedure Put (Item : in Wide_Character) is
procedure Put (Item : Wide_Character) is
begin
Put (Current_Out, Item);
end Put;
@ -1097,8 +1160,8 @@ package body Ada.Wide_Text_IO is
---------
procedure Put
(File : in File_Type;
Item : in Wide_String)
(File : File_Type;
Item : Wide_String)
is
begin
for J in Item'Range loop
@ -1106,7 +1169,7 @@ package body Ada.Wide_Text_IO is
end loop;
end Put;
procedure Put (Item : in Wide_String) is
procedure Put (Item : Wide_String) is
begin
Put (Current_Out, Item);
end Put;
@ -1116,15 +1179,15 @@ package body Ada.Wide_Text_IO is
--------------
procedure Put_Line
(File : in File_Type;
Item : in Wide_String)
(File : File_Type;
Item : Wide_String)
is
begin
Put (File, Item);
New_Line (File);
end Put_Line;
procedure Put_Line (Item : in Wide_String) is
procedure Put_Line (Item : Wide_String) is
begin
Put (Current_Out, Item);
New_Line (Current_Out);
@ -1231,7 +1294,7 @@ package body Ada.Wide_Text_IO is
procedure Reset
(File : in out File_Type;
Mode : in File_Mode)
Mode : File_Mode)
is
begin
-- Don't allow change of mode for current file (RM A.10.2(5))
@ -1273,8 +1336,8 @@ package body Ada.Wide_Text_IO is
-------------
procedure Set_Col
(File : in File_Type;
To : in Positive_Count)
(File : File_Type;
To : Positive_Count)
is
ch : int;
@ -1333,7 +1396,7 @@ package body Ada.Wide_Text_IO is
end if;
end Set_Col;
procedure Set_Col (To : in Positive_Count) is
procedure Set_Col (To : Positive_Count) is
begin
Set_Col (Current_Out, To);
end Set_Col;
@ -1342,7 +1405,7 @@ package body Ada.Wide_Text_IO is
-- Set_Error --
---------------
procedure Set_Error (File : in File_Type) is
procedure Set_Error (File : File_Type) is
begin
FIO.Check_Write_Status (AP (File));
Current_Err := File;
@ -1352,7 +1415,7 @@ package body Ada.Wide_Text_IO is
-- Set_Input --
---------------
procedure Set_Input (File : in File_Type) is
procedure Set_Input (File : File_Type) is
begin
FIO.Check_Read_Status (AP (File));
Current_In := File;
@ -1363,8 +1426,8 @@ package body Ada.Wide_Text_IO is
--------------
procedure Set_Line
(File : in File_Type;
To : in Positive_Count)
(File : File_Type;
To : Positive_Count)
is
begin
-- Raise Constraint_Error if out of range value. The reason for this
@ -1401,7 +1464,7 @@ package body Ada.Wide_Text_IO is
end if;
end Set_Line;
procedure Set_Line (To : in Positive_Count) is
procedure Set_Line (To : Positive_Count) is
begin
Set_Line (Current_Out, To);
end Set_Line;
@ -1410,7 +1473,7 @@ package body Ada.Wide_Text_IO is
-- Set_Line_Length --
---------------------
procedure Set_Line_Length (File : in File_Type; To : in Count) is
procedure Set_Line_Length (File : File_Type; To : Count) is
begin
-- Raise Constraint_Error if out of range value. The reason for this
-- explicit test is that we don't want junk values around, even if
@ -1424,7 +1487,7 @@ package body Ada.Wide_Text_IO is
File.Line_Length := To;
end Set_Line_Length;
procedure Set_Line_Length (To : in Count) is
procedure Set_Line_Length (To : Count) is
begin
Set_Line_Length (Current_Out, To);
end Set_Line_Length;
@ -1433,7 +1496,7 @@ package body Ada.Wide_Text_IO is
-- Set_Output --
----------------
procedure Set_Output (File : in File_Type) is
procedure Set_Output (File : File_Type) is
begin
FIO.Check_Write_Status (AP (File));
Current_Out := File;
@ -1443,7 +1506,7 @@ package body Ada.Wide_Text_IO is
-- Set_Page_Length --
---------------------
procedure Set_Page_Length (File : in File_Type; To : in Count) is
procedure Set_Page_Length (File : File_Type; To : Count) is
begin
-- Raise Constraint_Error if out of range value. The reason for this
-- explicit test is that we don't want junk values around, even if
@ -1457,7 +1520,7 @@ package body Ada.Wide_Text_IO is
File.Page_Length := To;
end Set_Page_Length;
procedure Set_Page_Length (To : in Count) is
procedure Set_Page_Length (To : Count) is
begin
Set_Page_Length (Current_Out, To);
end Set_Page_Length;
@ -1497,8 +1560,8 @@ package body Ada.Wide_Text_IO is
---------------
procedure Skip_Line
(File : in File_Type;
Spacing : in Positive_Count := 1)
(File : File_Type;
Spacing : Positive_Count := 1)
is
ch : int;
@ -1580,7 +1643,7 @@ package body Ada.Wide_Text_IO is
File.Before_Wide_Character := False;
end Skip_Line;
procedure Skip_Line (Spacing : in Positive_Count := 1) is
procedure Skip_Line (Spacing : Positive_Count := 1) is
begin
Skip_Line (Current_In, Spacing);
end Skip_Line;
@ -1589,7 +1652,7 @@ package body Ada.Wide_Text_IO is
-- Skip_Page --
---------------
procedure Skip_Page (File : in File_Type) is
procedure Skip_Page (File : File_Type) is
ch : int;
begin
@ -1741,7 +1804,7 @@ package body Ada.Wide_Text_IO is
procedure Write
(File : in out Wide_Text_AFCB;
Item : in Stream_Element_Array)
Item : Stream_Element_Array)
is
Siz : constant size_t := Item'Length;

View File

@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
-- Copyright (C) 1992-2000 Free Software Foundation, Inc. --
-- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
@ -89,34 +89,34 @@ package Ada.Wide_Text_IO is
procedure Create
(File : in out File_Type;
Mode : in File_Mode := Out_File;
Name : in String := "";
Form : in String := "");
Mode : File_Mode := Out_File;
Name : String := "";
Form : String := "");
procedure Open
(File : in out File_Type;
Mode : in File_Mode;
Name : in String;
Form : in String := "");
Mode : File_Mode;
Name : String;
Form : String := "");
procedure Close (File : in out File_Type);
procedure Delete (File : in out File_Type);
procedure Reset (File : in out File_Type; Mode : in File_Mode);
procedure Reset (File : in out File_Type; Mode : File_Mode);
procedure Reset (File : in out File_Type);
function Mode (File : in File_Type) return File_Mode;
function Name (File : in File_Type) return String;
function Form (File : in File_Type) return String;
function Mode (File : File_Type) return File_Mode;
function Name (File : File_Type) return String;
function Form (File : File_Type) return String;
function Is_Open (File : in File_Type) return Boolean;
function Is_Open (File : File_Type) return Boolean;
------------------------------------------------------
-- Control of default input, output and error files --
------------------------------------------------------
procedure Set_Input (File : in File_Type);
procedure Set_Output (File : in File_Type);
procedure Set_Error (File : in File_Type);
procedure Set_Input (File : File_Type);
procedure Set_Output (File : File_Type);
procedure Set_Error (File : File_Type);
function Standard_Input return File_Type;
function Standard_Output return File_Type;
@ -143,76 +143,76 @@ package Ada.Wide_Text_IO is
-- Note: The paramter file is in out in the RM, but as pointed out
-- in <<95-5166.a Tucker Taft 95-6-23>> this is clearly an oversight.
procedure Flush (File : in File_Type);
procedure Flush (File : File_Type);
procedure Flush;
--------------------------------------------
-- Specification of line and page lengths --
--------------------------------------------
procedure Set_Line_Length (File : in File_Type; To : in Count);
procedure Set_Line_Length (To : in Count);
procedure Set_Line_Length (File : File_Type; To : Count);
procedure Set_Line_Length (To : Count);
procedure Set_Page_Length (File : in File_Type; To : in Count);
procedure Set_Page_Length (To : in Count);
procedure Set_Page_Length (File : File_Type; To : Count);
procedure Set_Page_Length (To : Count);
function Line_Length (File : in File_Type) return Count;
function Line_Length (File : File_Type) return Count;
function Line_Length return Count;
function Page_Length (File : in File_Type) return Count;
function Page_Length (File : File_Type) return Count;
function Page_Length return Count;
------------------------------------
-- Column, Line, and Page Control --
------------------------------------
procedure New_Line (File : in File_Type; Spacing : in Positive_Count := 1);
procedure New_Line (Spacing : in Positive_Count := 1);
procedure New_Line (File : File_Type; Spacing : Positive_Count := 1);
procedure New_Line (Spacing : Positive_Count := 1);
procedure Skip_Line (File : in File_Type; Spacing : in Positive_Count := 1);
procedure Skip_Line (Spacing : in Positive_Count := 1);
procedure Skip_Line (File : File_Type; Spacing : Positive_Count := 1);
procedure Skip_Line (Spacing : Positive_Count := 1);
function End_Of_Line (File : in File_Type) return Boolean;
function End_Of_Line (File : File_Type) return Boolean;
function End_Of_Line return Boolean;
procedure New_Page (File : in File_Type);
procedure New_Page (File : File_Type);
procedure New_Page;
procedure Skip_Page (File : in File_Type);
procedure Skip_Page (File : File_Type);
procedure Skip_Page;
function End_Of_Page (File : in File_Type) return Boolean;
function End_Of_Page (File : File_Type) return Boolean;
function End_Of_Page return Boolean;
function End_Of_File (File : in File_Type) return Boolean;
function End_Of_File (File : File_Type) return Boolean;
function End_Of_File return Boolean;
procedure Set_Col (File : in File_Type; To : in Positive_Count);
procedure Set_Col (To : in Positive_Count);
procedure Set_Col (File : File_Type; To : Positive_Count);
procedure Set_Col (To : Positive_Count);
procedure Set_Line (File : in File_Type; To : in Positive_Count);
procedure Set_Line (To : in Positive_Count);
procedure Set_Line (File : File_Type; To : Positive_Count);
procedure Set_Line (To : Positive_Count);
function Col (File : in File_Type) return Positive_Count;
function Col (File : File_Type) return Positive_Count;
function Col return Positive_Count;
function Line (File : in File_Type) return Positive_Count;
function Line (File : File_Type) return Positive_Count;
function Line return Positive_Count;
function Page (File : in File_Type) return Positive_Count;
function Page (File : File_Type) return Positive_Count;
function Page return Positive_Count;
----------------------------
-- Character Input-Output --
----------------------------
procedure Get (File : in File_Type; Item : out Wide_Character);
procedure Get (File : File_Type; Item : out Wide_Character);
procedure Get (Item : out Wide_Character);
procedure Put (File : in File_Type; Item : in Wide_Character);
procedure Put (Item : in Wide_Character);
procedure Put (File : File_Type; Item : Wide_Character);
procedure Put (Item : Wide_Character);
procedure Look_Ahead
(File : in File_Type;
(File : File_Type;
Item : out Wide_Character;
End_Of_Line : out Boolean);
@ -221,14 +221,14 @@ package Ada.Wide_Text_IO is
End_Of_Line : out Boolean);
procedure Get_Immediate
(File : in File_Type;
(File : File_Type;
Item : out Wide_Character);
procedure Get_Immediate
(Item : out Wide_Character);
procedure Get_Immediate
(File : in File_Type;
(File : File_Type;
Item : out Wide_Character;
Available : out Boolean);
@ -240,13 +240,13 @@ package Ada.Wide_Text_IO is
-- String Input-Output --
-------------------------
procedure Get (File : in File_Type; Item : out Wide_String);
procedure Get (File : File_Type; Item : out Wide_String);
procedure Get (Item : out Wide_String);
procedure Put (File : in File_Type; Item : in Wide_String);
procedure Put (Item : in Wide_String);
procedure Put (File : File_Type; Item : Wide_String);
procedure Put (Item : Wide_String);
procedure Get_Line
(File : in File_Type;
(File : File_Type;
Item : out Wide_String;
Last : out Natural);
@ -254,12 +254,18 @@ package Ada.Wide_Text_IO is
(Item : out Wide_String;
Last : out Natural);
procedure Put_Line
(File : in File_Type;
Item : in Wide_String);
function Get_Line (File : File_Type) return Wide_String;
pragma Ada_05 (Get_Line);
function Get_Line return Wide_String;
pragma Ada_05 (Get_Line);
procedure Put_Line
(Item : in Wide_String);
(File : File_Type;
Item : Wide_String);
procedure Put_Line
(Item : Wide_String);
---------------------------------------
-- Generic packages for Input-Output --
@ -398,7 +404,7 @@ private
procedure Write
(File : in out Wide_Text_AFCB;
Item : in Ada.Streams.Stream_Element_Array);
Item : Ada.Streams.Stream_Element_Array);
-- Write operation used when Wide_Text_IO file is treated as a Stream
------------------------
@ -440,7 +446,7 @@ private
-- occurs. The result is EOF if the end of file was read.
procedure Get_Character
(File : in File_Type;
(File : File_Type;
Item : out Character);
-- This is essentially a copy of the normal Get routine from Text_IO. It
-- obtains a single character from the input file File, and places it in
@ -449,8 +455,7 @@ private
function Get_Wide_Char
(C : Character;
File : File_Type)
return Wide_Character;
File : File_Type) return Wide_Character;
-- This function is shared by Get and Get_Immediate to extract a wide
-- character value from the given File. The first byte has already been
-- read and is passed in C. The wide character value is returned as the

View File

@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
-- Copyright (C) 1992,1993,1994,1995,1996 Free Software Foundation, Inc. --
-- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@ -45,7 +45,7 @@ package body Ada.Wide_Text_IO.Complex_Aux is
---------
procedure Get
(File : in File_Type;
(File : File_Type;
ItemR : out Long_Long_Float;
ItemI : out Long_Long_Float;
Width : Field)
@ -96,7 +96,7 @@ package body Ada.Wide_Text_IO.Complex_Aux is
----------
procedure Gets
(From : in String;
(From : String;
ItemR : out Long_Long_Float;
ItemI : out Long_Long_Float;
Last : out Positive)
@ -163,8 +163,8 @@ package body Ada.Wide_Text_IO.Complex_Aux is
(To : out String;
ItemR : Long_Long_Float;
ItemI : Long_Long_Float;
Aft : in Field;
Exp : in Field)
Aft : Field;
Exp : Field)
is
I_String : String (1 .. 3 * Field'Last);
R_String : String (1 .. 3 * Field'Last);

View File

@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
-- Copyright (C) 1992,1993,1994,1995,1996 Free Software Foundation, Inc. --
-- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@ -42,7 +42,7 @@
package Ada.Wide_Text_IO.Complex_Aux is
procedure Get
(File : in File_Type;
(File : File_Type;
ItemR : out Long_Long_Float;
ItemI : out Long_Long_Float;
Width : Field);

View File

@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
-- Copyright (C) 1992,1993,1994,1995,1996 Free Software Foundation, Inc. --
-- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@ -32,6 +32,7 @@
------------------------------------------------------------------------------
with Ada.Wide_Text_IO.Complex_Aux;
with System.WCh_Con; use System.WCh_Con;
with System.WCh_WtS; use System.WCh_WtS;
@ -44,9 +45,6 @@ package body Ada.Wide_Text_IO.Complex_IO is
subtype LLF is Long_Long_Float;
-- Type used for calls to routines in Aux
-- subtype TFT is Ada.Wide_Text_IO.File_Type;
-- File type required for calls to routines in Aux
function TFT is new
Ada.Unchecked_Conversion (File_Type, Ada.Wide_Text_IO.File_Type);
-- This unchecked conversion is to get around a visibility bug in
@ -58,12 +56,12 @@ package body Ada.Wide_Text_IO.Complex_IO is
---------
procedure Get
(File : in File_Type;
(File : File_Type;
Item : out Complex;
Width : in Field := 0)
Width : Field := 0)
is
Real_Item : Real'Base;
Imag_Item : Real'Base;
Real_Item : Real'Base;
Imag_Item : Real'Base;
begin
Aux.Get (TFT (File), LLF (Real_Item), LLF (Imag_Item), Width);
@ -79,7 +77,7 @@ package body Ada.Wide_Text_IO.Complex_IO is
procedure Get
(Item : out Complex;
Width : in Field := 0)
Width : Field := 0)
is
begin
Get (Current_Input, Item, Width);
@ -90,7 +88,7 @@ package body Ada.Wide_Text_IO.Complex_IO is
---------
procedure Get
(From : in Wide_String;
(From : Wide_String;
Item : out Complex;
Last : out Positive)
is
@ -116,11 +114,11 @@ package body Ada.Wide_Text_IO.Complex_IO is
---------
procedure Put
(File : in File_Type;
Item : in Complex;
Fore : in Field := Default_Fore;
Aft : in Field := Default_Aft;
Exp : in Field := Default_Exp)
(File : File_Type;
Item : Complex;
Fore : Field := Default_Fore;
Aft : Field := Default_Aft;
Exp : Field := Default_Exp)
is
begin
Aux.Put (TFT (File), LLF (Re (Item)), LLF (Im (Item)), Fore, Aft, Exp);
@ -131,10 +129,10 @@ package body Ada.Wide_Text_IO.Complex_IO is
---------
procedure Put
(Item : in Complex;
Fore : in Field := Default_Fore;
Aft : in Field := Default_Aft;
Exp : in Field := Default_Exp)
(Item : Complex;
Fore : Field := Default_Fore;
Aft : Field := Default_Aft;
Exp : Field := Default_Exp)
is
begin
Put (Current_Output, Item, Fore, Aft, Exp);
@ -146,9 +144,9 @@ package body Ada.Wide_Text_IO.Complex_IO is
procedure Put
(To : out Wide_String;
Item : in Complex;
Aft : in Field := Default_Aft;
Exp : in Field := Default_Exp)
Item : Complex;
Aft : Field := Default_Aft;
Exp : Field := Default_Exp)
is
S : String (To'First .. To'Last);

View File

@ -27,36 +27,36 @@ package Ada.Wide_Text_IO.Complex_IO is
Default_Exp : Field := 3;
procedure Get
(File : in File_Type;
(File : File_Type;
Item : out Complex;
Width : in Field := 0);
Width : Field := 0);
procedure Get
(Item : out Complex;
Width : in Field := 0);
Width : Field := 0);
procedure Put
(File : in File_Type;
Item : in Complex;
Fore : in Field := Default_Fore;
Aft : in Field := Default_Aft;
Exp : in Field := Default_Exp);
(File : File_Type;
Item : Complex;
Fore : Field := Default_Fore;
Aft : Field := Default_Aft;
Exp : Field := Default_Exp);
procedure Put
(Item : in Complex;
Fore : in Field := Default_Fore;
Aft : in Field := Default_Aft;
Exp : in Field := Default_Exp);
(Item : Complex;
Fore : Field := Default_Fore;
Aft : Field := Default_Aft;
Exp : Field := Default_Exp);
procedure Get
(From : in Wide_String;
(From : Wide_String;
Item : out Complex;
Last : out Positive);
procedure Put
(To : out Wide_String;
Item : in Complex;
Aft : in Field := Default_Aft;
Exp : in Field := Default_Exp);
Item : Complex;
Aft : Field := Default_Aft;
Exp : Field := Default_Exp);
end Ada.Wide_Text_IO.Complex_IO;

View File

@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
-- Copyright (C) 1992-2002 Free Software Foundation, Inc. --
-- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@ -69,13 +69,12 @@ package body Ada.Wide_Text_IO.Editing is
-----------
function Image
(Item : in Num;
Pic : in Picture;
Currency : in Wide_String := Default_Currency;
Fill : in Wide_Character := Default_Fill;
Separator : in Wide_Character := Default_Separator;
Radix_Mark : in Wide_Character := Default_Radix_Mark)
return Wide_String
(Item : Num;
Pic : Picture;
Currency : Wide_String := Default_Currency;
Fill : Wide_Character := Default_Fill;
Separator : Wide_Character := Default_Separator;
Radix_Mark : Wide_Character := Default_Radix_Mark) return Wide_String
is
begin
return Format_Number
@ -88,9 +87,8 @@ package body Ada.Wide_Text_IO.Editing is
------------
function Length
(Pic : in Picture;
Currency : in Wide_String := Default_Currency)
return Natural
(Pic : Picture;
Currency : Wide_String := Default_Currency) return Natural
is
Picstr : constant String := Pic_String (Pic);
V_Adjust : Integer := 0;
@ -122,13 +120,13 @@ package body Ada.Wide_Text_IO.Editing is
---------
procedure Put
(File : in Wide_Text_IO.File_Type;
Item : in Num;
Pic : in Picture;
Currency : in Wide_String := Default_Currency;
Fill : in Wide_Character := Default_Fill;
Separator : in Wide_Character := Default_Separator;
Radix_Mark : in Wide_Character := Default_Radix_Mark)
(File : Wide_Text_IO.File_Type;
Item : Num;
Pic : Picture;
Currency : Wide_String := Default_Currency;
Fill : Wide_Character := Default_Fill;
Separator : Wide_Character := Default_Separator;
Radix_Mark : Wide_Character := Default_Radix_Mark)
is
begin
Wide_Text_IO.Put (File, Image (Item, Pic,
@ -136,12 +134,12 @@ package body Ada.Wide_Text_IO.Editing is
end Put;
procedure Put
(Item : in Num;
Pic : in Picture;
Currency : in Wide_String := Default_Currency;
Fill : in Wide_Character := Default_Fill;
Separator : in Wide_Character := Default_Separator;
Radix_Mark : in Wide_Character := Default_Radix_Mark)
(Item : Num;
Pic : Picture;
Currency : Wide_String := Default_Currency;
Fill : Wide_Character := Default_Fill;
Separator : Wide_Character := Default_Separator;
Radix_Mark : Wide_Character := Default_Radix_Mark)
is
begin
Wide_Text_IO.Put (Image (Item, Pic,
@ -150,12 +148,12 @@ package body Ada.Wide_Text_IO.Editing is
procedure Put
(To : out Wide_String;
Item : in Num;
Pic : in Picture;
Currency : in Wide_String := Default_Currency;
Fill : in Wide_Character := Default_Fill;
Separator : in Wide_Character := Default_Separator;
Radix_Mark : in Wide_Character := Default_Radix_Mark)
Item : Num;
Pic : Picture;
Currency : Wide_String := Default_Currency;
Fill : Wide_Character := Default_Fill;
Separator : Wide_Character := Default_Separator;
Radix_Mark : Wide_Character := Default_Radix_Mark)
is
Result : constant Wide_String :=
Image (Item, Pic, Currency, Fill, Separator, Radix_Mark);
@ -175,15 +173,13 @@ package body Ada.Wide_Text_IO.Editing is
function Valid
(Item : Num;
Pic : in Picture;
Currency : in Wide_String := Default_Currency)
return Boolean
Pic : Picture;
Currency : Wide_String := Default_Currency) return Boolean
is
begin
declare
Temp : constant Wide_String := Image (Item, Pic, Currency);
pragma Warnings (Off, Temp);
begin
return True;
end;
@ -192,7 +188,6 @@ package body Ada.Wide_Text_IO.Editing is
when Layout_Error => return False;
end Valid;
end Decimal_Output;
------------
@ -220,11 +215,11 @@ package body Ada.Wide_Text_IO.Editing is
when '(' =>
-- We now need to scan out the count after a left paren.
-- In the non-wide version we used Integer_IO.Get, but
-- that is not convenient here, since we don't want to
-- drag in normal Text_IO just for this purpose. So we
-- do the scan ourselves, with the normal validity checks.
-- We now need to scan out the count after a left paren. In
-- the non-wide version we used Integer_IO.Get, but that is
-- not convenient here, since we don't want to drag in normal
-- Text_IO just for this purpose. So we do the scan ourselves,
-- with the normal validity checks.
Last := Picture_Index + 1;
Count := 0;
@ -262,7 +257,7 @@ package body Ada.Wide_Text_IO.Editing is
end loop;
-- In what follows note that one copy of the repeated
-- character has already been made, so a count of one is a
-- character has already been made, so a count of one is
-- no-op, and a count of zero erases a character.
for J in 2 .. Count loop
@ -293,7 +288,6 @@ package body Ada.Wide_Text_IO.Editing is
exception
when others =>
raise Picture_Error;
end Expand;
-------------------
@ -306,8 +300,7 @@ package body Ada.Wide_Text_IO.Editing is
Currency_Symbol : Wide_String;
Fill_Character : Wide_Character;
Separator_Character : Wide_Character;
Radix_Point : Wide_Character)
return Wide_String
Radix_Point : Wide_Character) return Wide_String
is
Attrs : Number_Attributes := Parse_Number_String (Number);
Position : Integer;
@ -368,8 +361,8 @@ package body Ada.Wide_Text_IO.Editing is
end loop;
-- The rounding may add a digit in front. Either the
-- leading blank or the sign (already captured) can
-- be overwritten.
-- leading blank or the sign (already captured) can be
-- overwritten.
if R_Pos = 1 then
Rounded (R_Pos) := '1';
@ -421,7 +414,7 @@ package body Ada.Wide_Text_IO.Editing is
for J in reverse Last .. Answer'Last loop
exit when J = Pic.Radix_Position;
-- Do this test First, Separator_Character can equal Pic.Floater.
-- Do this test First, Separator_Character can equal Pic.Floater
if Answer (J) = Pic.Floater then
exit;
@ -547,7 +540,7 @@ package body Ada.Wide_Text_IO.Editing is
or else
Pic.Floater = '-'
then
for J in Pic.End_Float .. Position loop -- May be null range.
for J in Pic.End_Float .. Position loop -- May be null range
if Answer (J) = '9' then
Answer (J) := '0';
@ -573,12 +566,12 @@ package body Ada.Wide_Text_IO.Editing is
elsif Pic.Floater = '$' then
for J in Pic.End_Float .. Position loop -- May be null range.
for J in Pic.End_Float .. Position loop -- May be null range
if Answer (J) = '9' then
Answer (J) := '0';
elsif Answer (J) = '_' then
Answer (J) := ' '; -- no separator before leftmost digit.
Answer (J) := ' '; -- no separator before leftmost digit
elsif Answer (J) = 'b' then
Answer (J) := ' ';
@ -598,7 +591,7 @@ package body Ada.Wide_Text_IO.Editing is
elsif Pic.Floater = '*' then
for J in Pic.End_Float .. Position loop -- May be null range.
for J in Pic.End_Float .. Position loop -- May be null range
if Answer (J) = '9' then
Answer (J) := '0';
@ -1013,7 +1006,6 @@ package body Ada.Wide_Text_IO.Editing is
return Answer;
end if;
end Format_Number;
-------------------------
@ -1094,7 +1086,6 @@ package body Ada.Wide_Text_IO.Editing is
-- No significant (intger) digits needs a null range.
return Answer;
end Parse_Number_String;
----------------
@ -2713,9 +2704,8 @@ package body Ada.Wide_Text_IO.Editing is
----------------
function To_Picture
(Pic_String : in String;
Blank_When_Zero : in Boolean := False)
return Picture
(Pic_String : String;
Blank_When_Zero : Boolean := False) return Picture
is
Result : Picture;
@ -2751,9 +2741,8 @@ package body Ada.Wide_Text_IO.Editing is
-----------
function Valid
(Pic_String : in String;
Blank_When_Zero : in Boolean := False)
return Boolean
(Pic_String : String;
Blank_When_Zero : Boolean := False) return Boolean
is
begin
declare
@ -2777,7 +2766,6 @@ package body Ada.Wide_Text_IO.Editing is
exception
when others => return False;
end Valid;
end Ada.Wide_Text_IO.Editing;

View File

@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
-- Copyright (C) 1992-1997 Free Software Foundation, Inc. --
-- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
@ -40,14 +40,12 @@ package Ada.Wide_Text_IO.Editing is
type Picture is private;
function Valid
(Pic_String : in String;
Blank_When_Zero : in Boolean := False)
return Boolean;
(Pic_String : String;
Blank_When_Zero : Boolean := False) return Boolean;
function To_Picture
(Pic_String : in String;
Blank_When_Zero : in Boolean := False)
return Picture;
(Pic_String : String;
Blank_When_Zero : Boolean := False) return Picture;
function Pic_String (Pic : in Picture) return String;
function Blank_When_Zero (Pic : in Picture) return Boolean;
@ -63,62 +61,59 @@ package Ada.Wide_Text_IO.Editing is
generic
type Num is delta <> digits <>;
Default_Currency : in Wide_String :=
Default_Currency : Wide_String :=
Wide_Text_IO.Editing.Default_Currency;
Default_Fill : in Wide_Character :=
Default_Fill : Wide_Character :=
Wide_Text_IO.Editing.Default_Fill;
Default_Separator : in Wide_Character :=
Default_Separator : Wide_Character :=
Wide_Text_IO.Editing.Default_Separator;
Default_Radix_Mark : in Wide_Character :=
Default_Radix_Mark : Wide_Character :=
Wide_Text_IO.Editing.Default_Radix_Mark;
package Decimal_Output is
function Length
(Pic : in Picture;
Currency : in Wide_String := Default_Currency)
return Natural;
(Pic : Picture;
Currency : Wide_String := Default_Currency) return Natural;
function Valid
(Item : Num;
Pic : in Picture;
Currency : in Wide_String := Default_Currency)
return Boolean;
Pic : Picture;
Currency : Wide_String := Default_Currency) return Boolean;
function Image
(Item : Num;
Pic : in Picture;
Currency : in Wide_String := Default_Currency;
Fill : in Wide_Character := Default_Fill;
Separator : in Wide_Character := Default_Separator;
Radix_Mark : in Wide_Character := Default_Radix_Mark)
return Wide_String;
Pic : Picture;
Currency : Wide_String := Default_Currency;
Fill : Wide_Character := Default_Fill;
Separator : Wide_Character := Default_Separator;
Radix_Mark : Wide_Character := Default_Radix_Mark) return Wide_String;
procedure Put
(File : in File_Type;
(File : File_Type;
Item : Num;
Pic : in Picture;
Currency : in Wide_String := Default_Currency;
Fill : in Wide_Character := Default_Fill;
Separator : in Wide_Character := Default_Separator;
Radix_Mark : in Wide_Character := Default_Radix_Mark);
Pic : Picture;
Currency : Wide_String := Default_Currency;
Fill : Wide_Character := Default_Fill;
Separator : Wide_Character := Default_Separator;
Radix_Mark : Wide_Character := Default_Radix_Mark);
procedure Put
(Item : Num;
Pic : in Picture;
Currency : in Wide_String := Default_Currency;
Fill : in Wide_Character := Default_Fill;
Separator : in Wide_Character := Default_Separator;
Radix_Mark : in Wide_Character := Default_Radix_Mark);
Pic : Picture;
Currency : Wide_String := Default_Currency;
Fill : Wide_Character := Default_Fill;
Separator : Wide_Character := Default_Separator;
Radix_Mark : Wide_Character := Default_Radix_Mark);
procedure Put
(To : out Wide_String;
Item : Num;
Pic : in Picture;
Currency : in Wide_String := Default_Currency;
Fill : in Wide_Character := Default_Fill;
Separator : in Wide_Character := Default_Separator;
Radix_Mark : in Wide_Character := Default_Radix_Mark);
Pic : Picture;
Currency : Wide_String := Default_Currency;
Fill : Wide_Character := Default_Fill;
Separator : Wide_Character := Default_Separator;
Radix_Mark : Wide_Character := Default_Radix_Mark);
end Decimal_Output;
@ -196,8 +191,7 @@ private
Currency_Symbol : Wide_String;
Fill_Character : Wide_Character;
Separator_Character : Wide_Character;
Radix_Point : Wide_Character)
return Wide_String;
Radix_Point : Wide_Character) return Wide_String;
-- Formats number according to Pic
function Expand (Picture : in String) return String;

View File

@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
-- Copyright (C) 1992,1993,1994,1995,1996 Free Software Foundation, Inc. --
-- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@ -39,7 +39,7 @@ package body Ada.Wide_Text_IO.Text_Streams is
-- Stream --
------------
function Stream (File : in File_Type) return Stream_Access is
function Stream (File : File_Type) return Stream_Access is
begin
System.File_IO.Check_File_Open (FCB.AFCB_Ptr (File));
return Stream_Access (File);

View File

@ -19,6 +19,6 @@ package Ada.Wide_Text_IO.Text_Streams is
type Stream_Access is access all Streams.Root_Stream_Type'Class;
function Stream (File : in File_Type) return Stream_Access;
function Stream (File : File_Type) return Stream_Access;
end Ada.Wide_Text_IO.Text_Streams;