|
|
DataMuseum.dkPresents historical artifacts from the history of: Rational R1000/400 |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about Rational R1000/400 Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - download
Length: 6144 (0x1800)
Types: Ada Source
Notes: 03_class, FILE, R1k_Segment, e3_tag, package body Conversion, seg_05160c
└─⟦8527c1e9b⟧ Bits:30000544 8mm tape, Rational 1000, Arrival backup of disks in PAM's R1000
└─⟦5a81ac88f⟧ »Space Info Vol 1«
└─⟦this⟧
with Util_String;
package body Conversion is
package Us renames Util_String;
function Char_To_Byte (C : Character) return Gd.Byte is
begin
return Character'Pos (C);
end Char_To_Byte;
function Byte_To_Char (B : Gd.Byte) return Character is
begin
return Character'Val (B);
end Byte_To_Char;
function Nat_To_Byte (N : Natural) return Gd.Byte is
begin
if N > 255 then
raise Byte_Error;
else
return Natural'Pos (N);
end if;
end Nat_To_Byte;
function Byte_To_Nat (B : Gd.Byte) return Natural is
begin
return Natural'Val (B);
end Byte_To_Nat;
function Bs_To_String (Bs : Gd.Byte_String) return String is
S : String (Bs'First .. Bs'Last);
begin
for I in Bs'Range loop
S (I) := Byte_To_Char (Bs (I));
end loop;
return S;
end Bs_To_String;
function Byte_To_Hex (B : Gd.Byte) return String is
I : Natural;
S : String (1 .. 2);
begin
I := Gd.Byte'Pos (B) mod 16;
case I is
when 0 .. 9 =>
S (2 .. 2) := Us.Suppression_Espace_Left (Natural'Image (I));
when 10 =>
S (2) := 'A';
when 11 =>
S (2) := 'B';
when 12 =>
S (2) := 'C';
when 13 =>
S (2) := 'D';
when 14 =>
S (2) := 'E';
when 15 =>
S (2) := 'F';
when others =>
null;
end case;
I := Gd.Byte'Pos (B) / 16;
case I is
when 0 .. 9 =>
S (1 .. 1) := Us.Suppression_Espace_Left (Natural'Image (I));
when 10 =>
S (1) := 'A';
when 11 =>
S (1) := 'B';
when 12 =>
S (1) := 'C';
when 13 =>
S (1) := 'D';
when 14 =>
S (1) := 'E';
when 15 =>
S (1) := 'F';
when others =>
null;
end case;
return 'H' & S;
end Byte_To_Hex;
function String_To_Bs (S : String) return Gd.Byte_String is
Bs : Gd.Byte_String (S'First .. S'Last);
begin
for I in S'Range loop
Bs (I) := Char_To_Byte (S (I));
end loop;
return Bs;
end String_To_Bs;
function Image_Hex (B : Gd.Byte) return String is
begin
return Byte_To_Hex (B);
end Image_Hex;
function Image_Hex (Bs : Gd.Byte_String) return String is
begin
if Bs'First = Bs'Last then
return Byte_To_Hex (Bs (Bs'First));
else
return Byte_To_Hex (Bs (Bs'First)) & '|' &
Image_Hex (Bs (Bs'First + 1 .. Bs'Last));
end if;
end Image_Hex;
function Image (Bs : Gd.Byte_String) return String is
begin
if Bs'First = Bs'Last then
return Image (Bs (Bs'First));
else
return Image (Bs (Bs'First)) & '|' &
Image (Bs (Bs'First + 1 .. Bs'Last));
end if;
end Image;
function Image (B : Gd.Byte) return String is
begin
return Us.Suppression_Espace_Left (Natural'Image (Gd.Byte'Pos (B)));
end Image;
function Concat (Left, Right : Gd.Byte_String) return Gd.Byte_String is
Bs : Gd.Byte_String (1 .. Left'Length + Right'Length);
begin
Bs (1 .. Left'Length) := Left;
Bs (Left'Length + 1 .. Bs'Last) := Right;
return Bs;
end Concat;
end Conversion;
nblk1=5
nid=0
hdr6=a
[0x00] rec0=2c rec1=00 rec2=01 rec3=00e
[0x01] rec0=02 rec1=00 rec2=02 rec3=02e
[0x02] rec0=21 rec1=00 rec2=03 rec3=028
[0x03] rec0=22 rec1=00 rec2=05 rec3=064
[0x04] rec0=18 rec1=00 rec2=04 rec3=000
tail 0x2154b447e879a5b8946be 0x42a00088462060003