DataMuseum.dk

Presents historical artifacts from the history of:

Rational R1000/400 Tapes

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about Rational R1000/400 Tapes

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - download
Index: ┃ B T

⟦7b957ce0c⟧ TextFile

    Length: 2625 (0xa41)
    Types: TextFile
    Names: »B«

Derivation

└─⟦85b835f43⟧ Bits:30000549 8mm tape, Rational 1000, Xlib rev 6.00
    └─ ⟦0c20f784e⟧ »DATA« 
        └─⟦1abbe589f⟧ 
            └─⟦591c5b094⟧ 
                └─⟦this⟧ 

TextFile

with Unchecked_Deallocation;
with Vstring_Type;
use Vstring_Type;

package body Vstring_Heap 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

    function New_Vstring (Maximum_Length : S_Natural) return Vstring is
    begin
        return new Vstring_Data (Maximum_Length);
    end New_Vstring;

    procedure Free is new Unchecked_Deallocation (Vstring_Data, Vstring);

    procedure Free_Vstring (Vstr : in out Vstring) is
    begin
        Free (Vstr);
    end Free_Vstring;

--\f

    procedure Resize_Vstring (Vstr : in out Vstring; New_Size : S_Natural) is
----Called to change the size of a Vstring.  We return a Vstring of the
--  specified size (if different) and we copy as much of the contents of
--  the old Vstring into the new as will fit.
        Vs : Vstring;
    begin

----Make sure we want to do this.

        if Vstr.Maximum_Length = New_Size then
            return;
        end if;

----Create a new Vstring an copy the data from the old one.

        Vs := new Vstring_Data (New_Size);
        if Vstr.Length <= New_Size then
            Vs.Length                   := Vstr.Length;
            Vs.Chars (1 .. Vstr.Length) := Vstr.Chars (1 .. Vstr.Length);
        else
            Vs.Length                := New_Size;
            Vs.Chars (1 .. New_Size) := Vstr.Chars (1 .. New_Size);
        end if;

----Free up the old one and return the new one.

        Free (Vstr);
        Vstr := Vs;

    end Resize_Vstring;

--\f

end Vstring_Heap;