|
|
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: 6715 (0x1a3b)
Types: TextFile
Names: »B«
└─⟦85b835f43⟧ Bits:30000549 8mm tape, Rational 1000, Xlib rev 6.00
└─⟦0c20f784e⟧ »DATA«
└─⟦1abbe589f⟧
└─⟦059497ac5⟧
└─⟦this⟧
with Unchecked_Deallocation;
package body Xlbt_String is
------------------------------------------------------------------------------
-- X Library 8-bit character types
--
-- Xlbt_String - Full 8-bit Ascii strings (Non-Ada Strings)
------------------------------------------------------------------------------
-- Copyright 1989 - 1991 by Rational, Santa Clara, California.
-- Copyright 1985 - 1989 by the Massachusetts Institute of Technology
--
-- 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 names of MIT or Rational not be
-- used in advertising or publicity pertaining to distribution of the software
-- without specific, written prior permission.
--
-- MIT and Rational disclaim all warranties with regard to this software,
-- including all implied warranties of merchantability and fitness, in no
-- event shall MIT or 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 Heap_Free_X_String_Pointer_List is
new Unchecked_Deallocation (X_String_Pointer_Array,
X_String_Pointer_List);
--\f
------------------------------------------------------------------------------
-- X_String_Pointer
------------------------------------------------------------------------------
procedure Free_X_String_Pointer_Array
(List : in out X_String_Pointer_Array) is
Sp : X_String_Pointer;
begin
for I in List'Range loop
if List (I) /= null then
Sp := X_String_Pointer (List (I));
Free_X_String_Pointer (Sp);
List (I) := null;
end if;
end loop;
end Free_X_String_Pointer_Array;
--\f
procedure Free_X_String_Pointer_List
(List : in out X_String_Pointer_List) is
begin
if List = None_X_String_Pointer_List then
return;
end if;
Free_X_String_Pointer_Array (List.all);
Heap_Free_X_String_Pointer_List (List);
end Free_X_String_Pointer_List;
--\f
function To_X_String (Str7 : String) return X_String is
------------------------------------------------------------------------------
-- Convert a normal 7-bit Ada string into an 8-bit X String. The result
-- String is guaranteed to have array bounds 1..Str'length.
------------------------------------------------------------------------------
Str8 : X_String (1 .. S_Natural (Str7'Length));
begin
To_X_String (Str8, Str7);
return Str8;
end To_X_String;
--\f
function To_String (Str8 : X_String) return String is
------------------------------------------------------------------------------
-- Convert an 8-bit String into a normal 7-bit string. The result
-- string is guaranteed to have array bounds 1..Str'length. Chop each
-- character to 7 bits as we go.
------------------------------------------------------------------------------
Str7 : String (1 .. Natural (Str8'Length));
begin
To_String (Str7, Str8);
return Str7;
end To_String;
--\f
function To_String (Str8 : X_String;
Trans : X_Translation_Array) return String is
------------------------------------------------------------------------------
-- Convert an 8-bit String into a normal 7-bit string. The result
-- string is guaranteed to have array bounds 1..Str'length. Translates
-- each Character8 in the Str via the Trans array and returns that result.
------------------------------------------------------------------------------
Str7 : String (1 .. Natural (Str8'Length));
begin
To_String (Str7, Str8, Trans);
return Str7;
end To_String;
--\f
procedure To_X_String (Str8 : out X_String;
Str7 : String) is
------------------------------------------------------------------------------
-- Convert a normal 7-bit Ada string into an 8-bit X String. The result
-- String is guaranteed to have array bounds 1..Str'length.
------------------------------------------------------------------------------
Str_Last : Natural := Str7'Last;
begin
if Str8'Length /= Str7'Length then
raise Constraint_Error;
end if;
for I in reverse Str8'Range loop
Str8 (I) := X_Character'Val (Character'Pos (Str7 (Str_Last)));
Str_Last := Str_Last - 1;
end loop;
end To_X_String;
--\f
procedure To_String (Str7 : out String;
Str8 : X_String) is
------------------------------------------------------------------------------
-- Convert an 8-bit String into a normal 7-bit string. The result
-- string is guaranteed to have array bounds 1..Str'length. Chop each
-- character to 7 bits as we go.
------------------------------------------------------------------------------
begin
if Str8'Length /= Str7'Length then
raise Constraint_Error;
end if;
for I in S_Natural range 0 .. Str8'Length - 1 loop
Str7 (Str7'First + Natural (I)) :=
Character'Val (X_Character'Pos (Str8 (Str8'First + I)) rem 128);
end loop;
end To_String;
--\f
procedure To_String (Str7 : out String;
Str8 : X_String;
Trans : X_Translation_Array) is
------------------------------------------------------------------------------
-- Convert an 8-bit String into a normal 7-bit string. The result
-- string is guaranteed to have array bounds 1..Str'length. Translates
-- each Character8 in the Str via the Trans array and returns that result.
------------------------------------------------------------------------------
begin
if Str8'Length /= Str7'Length then
raise Constraint_Error;
end if;
for I in S_Natural range 0 .. Str8'Length - 1 loop
Str7 (Str7'First + Natural (I)) := Trans (Str8 (Str8'First + I));
end loop;
end To_String;
--\f
end Xlbt_String;