DataMuseum.dk

Presents historical artifacts from the history of:

Rational R1000/400

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

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - download

⟦5336fe0c8⟧ Ada Source

    Length: 5120 (0x1400)
    Types: Ada Source
    Notes: 03_class, FILE, R1k_Segment, e3_tag, package body Utils, seg_0520fd

Derivation

└─⟦8527c1e9b⟧ Bits:30000544 8mm tape, Rational 1000, Arrival backup of disks in PAM's R1000
    └─ ⟦cfc2e13cd⟧ »Space Info Vol 2« 
        └─⟦this⟧ 

E3 Source Code



with Text_Io;
package body Utils is


    function ">=" (L, R : Byte_Defs.Byte) return Boolean renames Byte_Defs.">=";


    function Get_Test_Level_From_User return Test_Level is

        package Level_Io is new Text_Io.Enumeration_Io (Test_Level);
        Confidence_Level : Test_Level;
    begin

        loop
            begin
                Text_Io.Put_Line ("Enter desired test_level:)");
                Text_Io.Put ("Valid values are: ");

                for Level in Test_Level loop
                    Text_Io.Put (Test_Level'Image (Level) & " ");
                end loop;

                Text_Io.Put (": ");

                Level_Io.Get (Confidence_Level);

                if Positive (Text_Io.Col) /= 1 then
                    Text_Io.Skip_Line;
                end if;

                Text_Io.New_Line;

                return Confidence_Level;

            exception
                when Constraint_Error =>
                    if Positive (Text_Io.Col) /= 1 then
                        Text_Io.Skip_Line;
                    end if;

                    Text_Io.New_Line;
                    Text_Io.Put_Line ("Invalid input, try again");
            end;
        end loop;
    end Get_Test_Level_From_User;



    function To_Unsigned_Byte (B : Byte_Defs.Byte) return Unsigned_Byte is
    begin
        if B >= 0 then
            return Unsigned_Byte (B);
        else
            return Unsigned_Byte (B) + 256;
        end if;
    end To_Unsigned_Byte;

    function To_Signed_Byte (B : Unsigned_Byte) return Byte_Defs.Byte is
    begin
        if B < 128 then
            return Byte_Defs.Byte (B);
        else
            return Byte_Defs.Byte (B - 256);
        end if;
    end To_Signed_Byte;

    function Byte_String_To_Integer
                (Bs : Byte_Defs.Byte_String) return Integer is
        Normalized : constant Byte_Defs.Byte_String (1 .. Bs'Length) := Bs;
        Result : Integer := 0;
        Shifter : Integer := 0;
    begin
        for I in reverse Normalized'Range loop
            Result := Result + Integer (To_Unsigned_Byte (Normalized (I))) *
                                  (2 ** Shifter);
            Shifter := Shifter + 8;
        end loop;
        return Result;
    end Byte_String_To_Integer;

    function Byte_String_To_String (Bs : Byte_Defs.Byte_String) return String is
        S : String (1 .. Bs'Length);
        Bs_Zero : constant Integer := Bs'First - 1;
        function "mod" (L, R : Byte_Defs.Byte) return Byte_Defs.Byte
            renames Byte_Defs."mod";
    begin
        for I in S'Range loop
            S (I) := Character'Val
                        (To_Unsigned_Byte (Bs (Bs_Zero + I)) mod 128);
        end loop;
        return S;
    end Byte_String_To_String;

    function String_To_Byte_String (S : String) return Byte_Defs.Byte_String is
        Bs : Byte_Defs.Byte_String (S'First .. S'Last);
    begin
        for I in S'Range loop
            Bs (I) := To_Signed_Byte (Character'Pos (S (I)));
        end loop;
        return Bs;
    end String_To_Byte_String;
end Utils;

E3 Meta Data

    nblk1=4
    nid=0
    hdr6=8
        [0x00] rec0=26 rec1=00 rec2=01 rec3=018
        [0x01] rec0=20 rec1=00 rec2=02 rec3=08c
        [0x02] rec0=1a rec1=00 rec2=03 rec3=040
        [0x03] rec0=08 rec1=00 rec2=04 rec3=000
    tail 0x21759957487a05cc52f48 0x42a00088462060003