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

⟦121d88d7e⟧ TextFile

    Length: 2819 (0xb03)
    Types: TextFile
    Names: »B«

Derivation

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

TextFile

package body Vstring_Type is
------------------------------------------------------------------------------
-- VString - Variable length, fixed maximum length, strings.
------------------------------------------------------------------------------
-- 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 To_String (Estr : E_String) return String is
------------------------------------------------------------------------------
-- Changes the E_String into a normal Ada string.  Truncates the E_String,
-- if necessary, in order to create a maximally sized Ada String.  (This is
-- in the case where Integer'Size is 16 bits.)
------------------------------------------------------------------------------
        Len : S_Natural := Estr'Length;
    begin

----Don't let the limitations on the size of String cause us to raise an
--  exception.

        if Len > S_Natural (Positive'Last) then
            Len := S_Natural (Positive'Last);
        end if;

----Create a string of the correct length.  Then copy the characters in one
--  at a time.  If we simply did a type cast, eg. String(Estr(....)) then
--  the String() would raise Constraint error if either index value was not
--  in Positive'Range.  This is silly and stupid but it is Ada'a way.  A
--  type cast should be able to "slide" index values just like any other kind
--  of array-to-array assignment.  A type cast is an implicit assignment to
--  a compiler generated temporary value.

        declare
            Str : String (1 .. Natural (Len));
        begin
            for I in Str'Range loop
                Str (I) := Estr (Estr'First + S_Natural (I) - 1);
            end loop;
            return Str;
        end;

    end To_String;

--\f

end Vstring_Type;