|
|
DataMuseum.dkPresents historical artifacts from the history of: Rational R1000/400 Tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about Rational R1000/400 Tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - downloadIndex: B T
Length: 28154 (0x6dfa)
Types: TextFile
Names: »B«
└─⟦85b835f43⟧ Bits:30000549 8mm tape, Rational 1000, Xlib rev 6.00
└─⟦0c20f784e⟧ »DATA«
└─⟦1abbe589f⟧
└─⟦591c5b094⟧
└─⟦this⟧
with Arithmetic;
use Arithmetic;
with Vstring_Heap;
use Vstring_Heap;
with Vstring_Type;
use Vstring_Type;
package body Vstring_Assign is
------------------------------------------------------------------------------
-- Copyright 1988 - 1991 by Rational, Santa Clara, California.
--
-- All Rights Reserved.
--
-- Permission to use, copy, modify, and distribute this software and its
-- documentation for any purpose and without fee is hereby granted,
-- provided that the above copyright notice(s) appear in all copies and that
-- both that copyright notice(s) and this permission notice appear in
-- supporting documentation, and that the name of Rational not be used in
-- advertising or publicity pertaining to distribution of the software
-- without specific, written prior permission.
--
-- Rational disclaims all warranties with regard to this software, including
-- all implied warranties of merchantability and fitness, in no event shall
-- Rational be liable for any special, indirect or consequential damages or
-- any damages whatsoever resulting from loss of use, data or profits, whether
-- in an action of contract, negligence or other tortious action, arising out
-- of or in connection with the use or performance of this software.
------------------------------------------------------------------------------
--\f
procedure Assign (Vstr1 : in out Vstring_Data;
Vstr2 : Vstring_Data) is
Pos2 : S_Natural := Vstr2.Length;
begin
if Pos2 > Vstr1.Maximum_Length then
Pos2 := Vstr1.Maximum_Length;
end if;
Vstr1.Chars (1 .. Pos2) := Vstr2.Chars (1 .. Pos2);
Vstr1.Length := Pos2;
end Assign;
--\f
procedure Assign (Vstr1 : in out Vstring_Data;
Vstr2 : Vstring) is
Pos2 : S_Natural := Vstr2.Length;
begin
if Pos2 > Vstr1.Maximum_Length then
Pos2 := Vstr1.Maximum_Length;
end if;
Vstr1.Chars (1 .. Pos2) := Vstr2.Chars (1 .. Pos2);
Vstr1.Length := Pos2;
end Assign;
--\f
procedure Assign (Vstr1 : in out Vstring_Data;
Vstr2 : E_String) is
Pos2 : S_Natural := Vstr2'Length;
begin
if Pos2 > Vstr1.Maximum_Length then
Pos2 := Vstr1.Maximum_Length;
end if;
Vstr1.Chars (1 .. Pos2) :=
Vstr2 (Vstr2'First .. Vstr2'First + Pos2 - 1);
Vstr1.Length := Pos2;
end Assign;
--\f
procedure Assign (Vstr1 : in out Vstring_Data;
Vstr2 : Character) is
begin
if Vstr1.Maximum_Length < 1 then
return;
end if;
Vstr1.Chars (1) := Vstr2;
Vstr1.Length := 1;
end Assign;
--\f
procedure Assign (Vstr1 : in out Vstring_Data;
Vstr2 : Character;
Copies : S_Natural) is
begin
if Vstr1.Maximum_Length < Copies then
Vstr1.Chars := (others => Vstr2);
Vstr1.Length := Vstr1.Maximum_Length;
else
Vstr1.Chars (1 .. Copies) := (others => Vstr2);
Vstr1.Length := Copies;
end if;
end Assign;
--\f
procedure Assign (Vstr1 : Vstring;
Vstr2 : Vstring_Data) is
Pos2 : S_Natural := Vstr2.Length;
begin
if Pos2 > Vstr1.Maximum_Length then
Pos2 := Vstr1.Maximum_Length;
end if;
Vstr1.Chars (1 .. Pos2) := Vstr2.Chars (1 .. Pos2);
Vstr1.Length := Pos2;
end Assign;
--\f
procedure Assign (Vstr1 : Vstring;
Vstr2 : Vstring) is
Pos2 : S_Natural := Vstr2.Length;
begin
if Pos2 > Vstr1.Maximum_Length then
Pos2 := Vstr1.Maximum_Length;
end if;
Vstr1.Chars (1 .. Pos2) := Vstr2.Chars (1 .. Pos2);
Vstr1.Length := Pos2;
end Assign;
--\f
procedure Assign (Vstr1 : Vstring;
Vstr2 : E_String) is
Pos2 : S_Natural := Vstr2'Length;
begin
if Pos2 > Vstr1.Maximum_Length then
Pos2 := Vstr1.Maximum_Length;
end if;
Vstr1.Chars (1 .. Pos2) :=
Vstr2 (Vstr2'First .. Vstr2'First + Pos2 - 1);
Vstr1.Length := Pos2;
end Assign;
--\f
procedure Assign (Vstr1 : Vstring;
Vstr2 : Character) is
begin
if Vstr1.Maximum_Length < 1 then
return;
end if;
Vstr1.Chars (1) := Vstr2;
Vstr1.Length := 1;
end Assign;
--\f
procedure Assign (Vstr1 : Vstring;
Vstr2 : Character;
Copies : S_Natural) is
begin
if Vstr1.Maximum_Length < Copies then
Vstr1.Chars := (others => Vstr2);
Vstr1.Length := Vstr1.Maximum_Length;
else
Vstr1.Chars (1 .. Copies) := (others => Vstr2);
Vstr1.Length := Copies;
end if;
end Assign;
--\f
procedure Assign_New (Vstr1 : out Vstring;
Vstr2 : Vstring_Data) is
V : Vstring := New_Vstring (Vstr2.Length);
Pos2 : S_Natural := Vstr2.Length;
begin
Vstr1 := V;
V.Chars (1 .. Pos2) := Vstr2.Chars (1 .. Pos2);
V.Length := Pos2;
end Assign_New;
--\f
procedure Assign_Resize (Vstr1 : in out Vstring;
Vstr2 : E_String;
Resize_Amount : S_Positive := 256) is
----Just line Assign except that Vstr1 is resized upwards if necessary to
-- hold all of Vstr1&Vstr2.
Ns : S_Natural;
Length : S_Natural := Vstr2'Length;
begin
Ns := Length;
if Vstr1.Maximum_Length < Ns then
Ns := Ns + Resize_Amount - 1;
Ns := Ns - Ns rem Resize_Amount;
Resize_Vstring (Vstr1, Ns);
end if;
Vstr1.Chars (1 .. Length) := Vstr2;
Vstr1.Length := Length;
end Assign_Resize;
--\f
procedure Assign_Resize (Vstr1 : in out Vstring;
Vstr2 : Vstring_Data;
Resize_Amount : S_Positive := 256) is
----Just line Assign except that Vstr1 is resized upwards if necessary to
-- hold all of Vstr1&Vstr2.
Ns : S_Natural;
begin
Ns := Vstr2.Length;
if Vstr1.Maximum_Length < Ns then
Ns := Ns + Resize_Amount - 1;
Ns := Ns - Ns rem Resize_Amount;
Resize_Vstring (Vstr1, Ns);
end if;
Vstr1.Chars (1 .. Vstr2.Length) := Vstr2.Chars (1 .. Vstr2.Length);
Vstr1.Length := Vstr2.Length;
end Assign_Resize;
--\f
procedure Assign_Resize (Vstr1 : in out Vstring;
Vstr2 : Vstring;
Resize_Amount : S_Positive := 256) is
----Just line Assign except that Vstr1 is resized upwards if necessary to
-- hold all of Vstr1&Vstr2.
Ns : S_Natural;
begin
Ns := Vstr2.Length;
if Vstr1.Maximum_Length < Ns then
Ns := Ns + Resize_Amount - 1;
Ns := Ns - Ns rem Resize_Amount;
Resize_Vstring (Vstr1, Ns);
end if;
Vstr1.Chars (1 .. Vstr2.Length) := Vstr2.Chars (1 .. Vstr2.Length);
Vstr1.Length := Vstr2.Length;
end Assign_Resize;
--\f
procedure Assign_New (Vstr1 : out Vstring;
Vstr2 : Vstring) is
V : Vstring := New_Vstring (Vstr2.Length);
Pos2 : S_Natural := Vstr2.Length;
begin
Vstr1 := V;
V.Chars (1 .. Pos2) := Vstr2.Chars (1 .. Pos2);
V.Length := Pos2;
end Assign_New;
--\f
procedure Assign_New (Vstr1 : out Vstring;
Vstr2 : E_String) is
V : Vstring := New_Vstring (Vstr2'Length);
Pos2 : S_Natural := Vstr2'Length;
begin
Vstr1 := V;
V.Chars (1 .. Pos2) :=
Vstr2 (Vstr2'First .. Vstr2'First + Pos2 - 1);
V.Length := Pos2;
end Assign_New;
--\f
procedure Assign_New (Vstr1 : out Vstring;
Vstr2 : Character) is
V : Vstring := New_Vstring (1);
begin
Vstr1 := V;
V.Chars (1) := Vstr2;
V.Length := 1;
end Assign_New;
--\f
procedure Assign_New (Vstr1 : out Vstring;
Vstr2 : Character;
Copies : S_Natural) is
V : Vstring := New_Vstring (Copies);
begin
Vstr1 := V;
V.Chars (1 .. Copies) := (others => Vstr2);
V.Length := Copies;
end Assign_New;
--\f
procedure Append (Vstr1 : in out Vstring_Data;
Vstr2 : Vstring_Data) is
Left : S_Natural := Vstr1.Maximum_Length - Vstr1.Length;
begin
if Left > Vstr2.Length then
Left := Vstr2.Length;
end if;
Vstr1.Chars (Vstr1.Length + 1 .. Vstr1.Length + Left) :=
Vstr2.Chars (1 .. Left);
Vstr1.Length := Vstr1.Length + Left;
end Append;
--\f
procedure Append (Vstr1 : in out Vstring_Data;
Vstr2 : Vstring) is
Left : S_Natural := Vstr1.Maximum_Length - Vstr1.Length;
begin
if Left > Vstr2.Length then
Left := Vstr2.Length;
end if;
Vstr1.Chars (Vstr1.Length + 1 .. Vstr1.Length + Left) :=
Vstr2.Chars (1 .. Left);
Vstr1.Length := Vstr1.Length + Left;
end Append;
--\f
procedure Append (Vstr1 : in out Vstring_Data;
Vstr2 : E_String) is
Left : S_Natural := Vstr1.Maximum_Length - Vstr1.Length;
begin
if Left > Vstr2'Length then
Left := Vstr2'Length;
end if;
Vstr1.Chars (Vstr1.Length + 1 .. Vstr1.Length + Left) :=
Vstr2 (Vstr2'First .. Vstr2'First + Left - 1);
Vstr1.Length := Vstr1.Length + Left;
end Append;
--\f
procedure Append (Vstr1 : in out Vstring_Data;
Vstr2 : Character) is
Left : S_Natural := Vstr1.Maximum_Length - Vstr1.Length;
begin
if Left >= 1 then
Vstr1.Chars (Vstr1.Length + 1) := Vstr2;
Vstr1.Length := Vstr1.Length + 1;
end if;
end Append;
--\f
procedure Append (Vstr1 : in out Vstring_Data;
Vstr2 : Character;
Copies : S_Natural) is
Left : S_Natural := Vstr1.Maximum_Length - Vstr1.Length;
begin
if Left > Copies then
Left := Copies;
end if;
Vstr1.Chars (Vstr1.Length + 1 .. Vstr1.Length + Left) :=
(others => Vstr2);
Vstr1.Length := Vstr1.Length + Copies;
end Append;
--\f
procedure Append (Vstr1 : Vstring;
Vstr2 : Vstring_Data) is
Left : S_Natural := Vstr1.Maximum_Length - Vstr1.Length;
begin
if Left > Vstr2.Length then
Left := Vstr2.Length;
end if;
Vstr1.Chars (Vstr1.Length + 1 .. Vstr1.Length + Left) :=
Vstr2.Chars (1 .. Left);
Vstr1.Length := Vstr1.Length + Left;
end Append;
--\f
procedure Append (Vstr1 : Vstring;
Vstr2 : Vstring) is
Left : S_Natural := Vstr1.Maximum_Length - Vstr1.Length;
begin
if Left > Vstr2.Length then
Left := Vstr2.Length;
end if;
Vstr1.Chars (Vstr1.Length + 1 .. Vstr1.Length + Left) :=
Vstr2.Chars (1 .. Left);
Vstr1.Length := Vstr1.Length + Left;
end Append;
--\f
procedure Append (Vstr1 : Vstring;
Vstr2 : E_String) is
Left : S_Natural := Vstr1.Maximum_Length - Vstr1.Length;
begin
if Left > Vstr2'Length then
Left := Vstr2'Length;
end if;
Vstr1.Chars (Vstr1.Length + 1 .. Vstr1.Length + Left) :=
Vstr2 (Vstr2'First .. Vstr2'First + Left - 1);
Vstr1.Length := Vstr1.Length + Left;
end Append;
--\f
procedure Append (Vstr1 : Vstring;
Vstr2 : Character) is
Left : S_Natural := Vstr1.Maximum_Length - Vstr1.Length;
begin
if Left >= 1 then
Vstr1.Chars (Vstr1.Length + 1) := Vstr2;
Vstr1.Length := Vstr1.Length + 1;
end if;
end Append;
--\f
procedure Append (Vstr1 : Vstring;
Vstr2 : Character;
Copies : S_Natural) is
Left : S_Natural := Vstr1.Maximum_Length - Vstr1.Length;
begin
if Left > Copies then
Left := Copies;
end if;
Vstr1.Chars (Vstr1.Length + 1 .. Vstr1.Length + Left) :=
(others => Vstr2);
Vstr1.Length := Vstr1.Length + Copies;
end Append;
--\f
procedure Append_Resize (Vstr1 : in out Vstring;
Vstr2 : E_String;
Resize_Amount : S_Positive := 256) is
----Just line Append except that Vstr1 is resized upwards if necessary to
-- hold all of Vstr1&Vstr2.
Ns : S_Natural;
Length : S_Natural := Vstr2'Length;
begin
Ns := Vstr1.Length + Length;
if Vstr1.Maximum_Length < Ns then
Ns := Ns + Resize_Amount - 1;
Ns := Ns - Ns rem Resize_Amount;
Resize_Vstring (Vstr1, Ns);
end if;
Vstr1.Chars (Vstr1.Length + 1 .. Vstr1.Length + Length) :=
Vstr2 (Vstr2'First .. Vstr2'Last);
Vstr1.Length := Vstr1.Length + Length;
end Append_Resize;
--\f
procedure Append_Resize (Vstr1 : in out Vstring;
Vstr2 : Character;
Resize_Amount : S_Positive := 256) is
----Just line Append except that Vstr1 is resized upwards if necessary to
-- hold all of Vstr1&Vstr2.
Ns : S_Natural;
begin
Ns := Vstr1.Length + 1;
if Vstr1.Maximum_Length < Ns then
Ns := Ns + Resize_Amount - 1;
Ns := Ns - Ns rem Resize_Amount;
Resize_Vstring (Vstr1, Ns);
end if;
Vstr1.Chars (Vstr1.Length + 1) := Vstr2;
Vstr1.Length := Vstr1.Length + 1;
end Append_Resize;
--\f
procedure Append_Resize (Vstr1 : in out Vstring;
Vstr2 : Character;
Copies : S_Natural;
Resize_Amount : S_Positive := 256) is
----Just line Append except that Vstr1 is resized upwards if necessary to
-- hold all of Vstr1&Vstr2.
Ns : S_Natural;
begin
Ns := Vstr1.Length + Copies;
if Vstr1.Maximum_Length < Ns then
Ns := Ns + Resize_Amount - 1;
Ns := Ns - Ns rem Resize_Amount;
Resize_Vstring (Vstr1, Ns);
end if;
Vstr1.Chars (Vstr1.Length + 1 .. Vstr1.Length + Copies) :=
(others => Vstr2);
Vstr1.Length := Vstr1.Length + Copies;
end Append_Resize;
--\f
procedure Append_Resize (Vstr1 : in out Vstring;
Vstr2 : Vstring_Data;
Resize_Amount : S_Positive := 256) is
----Just line Append except that Vstr1 is resized upwards if necessary to
-- hold all of Vstr1&Vstr2.
Ns : S_Natural;
begin
Ns := Vstr1.Length + Vstr2.Length;
if Vstr1.Maximum_Length < Ns then
Ns := Ns + Resize_Amount - 1;
Ns := Ns - Ns rem Resize_Amount;
Resize_Vstring (Vstr1, Ns);
end if;
Vstr1.Chars (Vstr1.Length + 1 .. Vstr1.Length + Vstr2.Length) :=
Vstr2.Chars (1 .. Vstr2.Length);
Vstr1.Length := Vstr1.Length + Vstr2.Length;
end Append_Resize;
--\f
procedure Append_Resize (Vstr1 : in out Vstring;
Vstr2 : Vstring;
Resize_Amount : S_Positive := 256) is
----Just line Append except that Vstr1 is resized upwards if necessary to
-- hold all of Vstr1&Vstr2.
Ns : S_Natural;
begin
Ns := Vstr1.Length + Vstr2.Length;
if Vstr1.Maximum_Length < Ns then
Ns := Ns + Resize_Amount - 1;
Ns := Ns - Ns rem Resize_Amount;
Resize_Vstring (Vstr1, Ns);
end if;
Vstr1.Chars (Vstr1.Length + 1 .. Vstr1.Length + Vstr2.Length) :=
Vstr2.Chars (1 .. Vstr2.Length);
Vstr1.Length := Vstr1.Length + Vstr2.Length;
end Append_Resize;
--\f
procedure Prepend (Vstr1 : in out Vstring_Data;
Vstr2 : Vstring_Data) is
Left : S_Natural := Vstr1.Maximum_Length - Vstr1.Length;
Right : S_Natural;
begin
if Left >= Vstr2.Length then
----Come here if 1&2 will both fit in 1.
Vstr1.Chars (Vstr2.Length + 1 .. Vstr2.Length + Vstr1.Length) :=
Vstr1.Chars (1 .. Vstr1.Length);
Vstr1.Chars (1 .. Vstr2.Length) := Vstr2.Chars (1 .. Vstr2.Length);
Vstr1.Length := Vstr1.Length + Vstr2.Length;
elsif Vstr2.Length > Vstr1.Maximum_Length then
----Come here if 2 is longer than 1 can hold.
Vstr1.Chars := Vstr2.Chars (1 .. Vstr1.Maximum_Length);
Vstr1.Length := Vstr1.Maximum_Length;
else
----Come here if 1 must be truncated in order to fit in 2.
Vstr1.Chars (Vstr2.Length + 1 .. Vstr1.Maximum_Length) :=
Vstr1.Chars (1 .. Vstr1.Maximum_Length - Right);
Vstr1.Chars (1 .. Vstr2.Length) := Vstr2.Chars (1 .. Vstr2.Length);
Vstr1.Length := Vstr1.Maximum_Length;
end if;
end Prepend;
--\f
procedure Prepend (Vstr1 : in out Vstring_Data;
Vstr2 : Vstring) is
Left : S_Natural := Vstr1.Maximum_Length - Vstr1.Length;
Right : S_Natural;
begin
if Left >= Vstr2.Length then
----Come here if 1&2 will both fit in 1.
Vstr1.Chars (Vstr2.Length + 1 .. Vstr2.Length + Vstr1.Length) :=
Vstr1.Chars (1 .. Vstr1.Length);
Vstr1.Chars (1 .. Vstr2.Length) := Vstr2.Chars (1 .. Vstr2.Length);
Vstr1.Length := Vstr1.Length + Vstr2.Length;
elsif Vstr2.Length > Vstr1.Maximum_Length then
----Come here if 2 is longer than 1 can hold.
Vstr1.Chars := Vstr2.Chars (1 .. Vstr1.Maximum_Length);
Vstr1.Length := Vstr1.Maximum_Length;
else
----Come here if 1 must be truncated in order to fit in 2.
Vstr1.Chars (Vstr2.Length + 1 .. Vstr1.Maximum_Length) :=
Vstr1.Chars (1 .. Vstr1.Maximum_Length - Right);
Vstr1.Chars (1 .. Vstr2.Length) := Vstr2.Chars (1 .. Vstr2.Length);
Vstr1.Length := Vstr1.Maximum_Length;
end if;
end Prepend;
--\f
procedure Prepend (Vstr1 : in out Vstring_Data;
Vstr2 : E_String) is
Left : S_Natural := Vstr1.Maximum_Length - Vstr1.Length;
Right : S_Natural;
Vstr2_Length : S_Natural := Vstr2'Length;
begin
if Left >= Vstr2_Length then
----Come here if 1&2 will both fit in 1.
Vstr1.Chars (Vstr2_Length + 1 .. Vstr2_Length + Vstr1.Length) :=
Vstr1.Chars (1 .. Vstr1.Length);
Vstr1.Chars (1 .. Vstr2_Length) := Vstr2 (1 .. Vstr2_Length);
Vstr1.Length := Vstr1.Length + Vstr2_Length;
elsif Vstr2_Length > Vstr1.Maximum_Length then
----Come here if 2 is longer than 1 can hold.
Vstr1.Chars :=
Vstr2 (Vstr2'First .. Vstr2'First + Vstr1.Maximum_Length - 1);
Vstr1.Length := Vstr1.Maximum_Length;
else
----Come here if 1 must be truncated in order to fit in 2.
Vstr1.Chars (Vstr2_Length + 1 .. Vstr1.Maximum_Length) :=
Vstr1.Chars (1 .. Vstr1.Maximum_Length - Right);
Vstr1.Chars (1 .. Vstr2_Length) := Vstr2;
Vstr1.Length := Vstr1.Maximum_Length;
end if;
end Prepend;
--\f
procedure Prepend (Vstr1 : in out Vstring_Data;
Vstr2 : Character) is
Left : S_Natural := Vstr1.Maximum_Length - Vstr1.Length;
Right : S_Natural;
begin
if Left >= 1 then
----Come here if 1&2 will both fit in 1.
Vstr1.Chars (1 + 1 .. 1 + Vstr1.Length) :=
Vstr1.Chars (1 .. Vstr1.Length);
Vstr1.Chars (1) := Vstr2;
Vstr1.Length := Vstr1.Length + 1;
elsif 1 > Vstr1.Maximum_Length then
----Come here if 2 is longer than 1 can hold.
null;
else
----Come here if 1 must be truncated in order to fit in 2.
Vstr1.Chars (1 + 1 .. Vstr1.Maximum_Length) :=
Vstr1.Chars (1 .. Vstr1.Maximum_Length - 1);
Vstr1.Chars (1) := Vstr2;
end if;
end Prepend;
--\f
procedure Prepend (Vstr1 : in out Vstring_Data;
Vstr2 : Character;
Copies : S_Natural) is
Left : S_Natural := Vstr1.Maximum_Length - Vstr1.Length;
Right : S_Natural;
begin
if Left >= Copies then
----Come here if 1&2 will both fit in 1.
Vstr1.Chars (Copies + 1 .. Copies + Vstr1.Length) :=
Vstr1.Chars (1 .. Vstr1.Length);
Vstr1.Chars (1 .. Copies) := (others => Vstr2);
Vstr1.Length := Vstr1.Length + Copies;
elsif Copies > Vstr1.Maximum_Length then
----Come here if 2 is longer than 1 can hold.
Vstr1.Chars := (others => Vstr2);
Vstr1.Length := Vstr1.Maximum_Length;
else
----Come here if 1 must be truncated in order to fit in 2.
Vstr1.Chars (Copies + 1 .. Vstr1.Maximum_Length) :=
Vstr1.Chars (1 .. Vstr1.Maximum_Length - Right);
Vstr1.Chars (1 .. Copies) := (others => Vstr2);
Vstr1.Length := Vstr1.Maximum_Length;
end if;
end Prepend;
--\f
procedure Prepend (Vstr1 : Vstring;
Vstr2 : Vstring_Data) is
Left : S_Natural := Vstr1.Maximum_Length - Vstr1.Length;
Right : S_Natural;
begin
if Left >= Vstr2.Length then
----Come here if 1&2 will both fit in 1.
Vstr1.Chars (Vstr2.Length + 1 .. Vstr2.Length + Vstr1.Length) :=
Vstr1.Chars (1 .. Vstr1.Length);
Vstr1.Chars (1 .. Vstr2.Length) := Vstr2.Chars (1 .. Vstr2.Length);
Vstr1.Length := Vstr1.Length + Vstr2.Length;
elsif Vstr2.Length > Vstr1.Maximum_Length then
----Come here if 2 is longer than 1 can hold.
Vstr1.Chars := Vstr2.Chars (1 .. Vstr1.Maximum_Length);
Vstr1.Length := Vstr1.Maximum_Length;
else
----Come here if 1 must be truncated in order to fit in 2.
Vstr1.Chars (Vstr2.Length + 1 .. Vstr1.Maximum_Length) :=
Vstr1.Chars (1 .. Vstr1.Maximum_Length - Right);
Vstr1.Chars (1 .. Vstr2.Length) := Vstr2.Chars (1 .. Vstr2.Length);
Vstr1.Length := Vstr1.Maximum_Length;
end if;
end Prepend;
--\f
procedure Prepend (Vstr1 : Vstring;
Vstr2 : Vstring) is
Left : S_Natural := Vstr1.Maximum_Length - Vstr1.Length;
Right : S_Natural;
begin
if Left >= Vstr2.Length then
----Come here if 1&2 will both fit in 1.
Vstr1.Chars (Vstr2.Length + 1 .. Vstr2.Length + Vstr1.Length) :=
Vstr1.Chars (1 .. Vstr1.Length);
Vstr1.Chars (1 .. Vstr2.Length) := Vstr2.Chars (1 .. Vstr2.Length);
Vstr1.Length := Vstr1.Length + Vstr2.Length;
elsif Vstr2.Length > Vstr1.Maximum_Length then
----Come here if 2 is longer than 1 can hold.
Vstr1.Chars := Vstr2.Chars (1 .. Vstr1.Maximum_Length);
Vstr1.Length := Vstr1.Maximum_Length;
else
----Come here if 1 must be truncated in order to fit in 2.
Vstr1.Chars (Vstr2.Length + 1 .. Vstr1.Maximum_Length) :=
Vstr1.Chars (1 .. Vstr1.Maximum_Length - Right);
Vstr1.Chars (1 .. Vstr2.Length) := Vstr2.Chars (1 .. Vstr2.Length);
Vstr1.Length := Vstr1.Maximum_Length;
end if;
end Prepend;
--\f
procedure Prepend (Vstr1 : Vstring;
Vstr2 : E_String) is
Left : S_Natural := Vstr1.Maximum_Length - Vstr1.Length;
Right : S_Natural;
Vstr2_Length : S_Natural := Vstr2'Length;
begin
if Left >= Vstr2_Length then
----Come here if 1&2 will both fit in 1.
Vstr1.Chars (Vstr2_Length + 1 .. Vstr2_Length + Vstr1.Length) :=
Vstr1.Chars (1 .. Vstr1.Length);
Vstr1.Chars (1 .. Vstr2_Length) := Vstr2;
Vstr1.Length := Vstr1.Length + Vstr2_Length;
elsif Vstr2_Length > Vstr1.Maximum_Length then
----Come here if 2 is longer than 1 can hold.
Vstr1.Chars :=
Vstr2 (Vstr2'First .. Vstr2'First + Vstr1.Maximum_Length - 1);
Vstr1.Length := Vstr1.Maximum_Length;
else
----Come here if 1 must be truncated in order to fit in 2.
Vstr1.Chars (Vstr2_Length + 1 .. Vstr1.Maximum_Length) :=
Vstr1.Chars (1 .. Vstr1.Maximum_Length - Right);
Vstr1.Chars (1 .. Vstr2_Length) := Vstr2;
Vstr1.Length := Vstr1.Maximum_Length;
end if;
end Prepend;
--\f
procedure Prepend (Vstr1 : Vstring;
Vstr2 : Character) is
Left : S_Natural := Vstr1.Maximum_Length - Vstr1.Length;
Right : S_Natural;
begin
if Left >= 1 then
----Come here if 1&2 will both fit in 1.
Vstr1.Chars (1 + 1 .. 1 + Vstr1.Length) :=
Vstr1.Chars (1 .. Vstr1.Length);
Vstr1.Chars (1) := Vstr2;
Vstr1.Length := Vstr1.Length + 1;
elsif 1 > Vstr1.Maximum_Length then
----Come here if 2 is longer than 1 can hold.
null;
else
----Come here if 1 must be truncated in order to fit in 2.
Vstr1.Chars (1 + 1 .. Vstr1.Maximum_Length) :=
Vstr1.Chars (1 .. Vstr1.Maximum_Length - 1);
Vstr1.Chars (1) := Vstr2;
end if;
end Prepend;
--\f
procedure Prepend (Vstr1 : Vstring;
Vstr2 : Character;
Copies : S_Natural) is
Left : S_Natural := Vstr1.Maximum_Length - Vstr1.Length;
Right : S_Natural;
begin
if Left >= Copies then
----Come here if 1&2 will both fit in 1.
Vstr1.Chars (Copies + 1 .. Copies + Vstr1.Length) :=
Vstr1.Chars (1 .. Vstr1.Length);
Vstr1.Chars (1 .. Copies) := (others => Vstr2);
Vstr1.Length := Vstr1.Length + Copies;
elsif Copies > Vstr1.Maximum_Length then
----Come here if 2 is longer than 1 can hold.
Vstr1.Chars := (others => Vstr2);
Vstr1.Length := Vstr1.Maximum_Length;
else
----Come here if 1 must be truncated in order to fit in 2.
Vstr1.Chars (Copies + 1 .. Vstr1.Maximum_Length) :=
Vstr1.Chars (1 .. Vstr1.Maximum_Length - Right);
Vstr1.Chars (1 .. Copies) := (others => Vstr2);
Vstr1.Length := Vstr1.Maximum_Length;
end if;
end Prepend;
--\f
end Vstring_Assign;