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

⟦826840ece⟧ Ada Source

    Length: 4096 (0x1000)
    Types: Ada Source
    Notes: 03_class, FILE, R1k_Segment, e3_tag, package body Convert, seg_03baea, separate Lex

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 String_Utilities;
separate (Lex)
package body Convert is

    function From_Int_To_Natural (S : String) return Natural is
        Ok : Boolean := True;
        Target : Integer := 0;
    begin
        String_Utilities.String_To_Number (S, Target, Ok);
        if Ok then
            return Natural (Target);
        else
            return 0;
        end if;
    end From_Int_To_Natural;


    function From_Based_To_Natural (S : String) return Natural is  
        S_Base : constant String := String (S (2 .. 3));
        I_Base : Integer := 0;
        N_Base : Natural := 0;
        Source : constant String := String (S (5 .. S'Last));
        Ok : Boolean := True;
        Target : Integer := 0;
    begin  
        String_Utilities.String_To_Number (S_Base, I_Base, Ok);
        if Ok then
            N_Base := Natural (I_Base);
            String_Utilities.String_To_Number (Source, Target, Ok, N_Base);
            if Ok then
                return Natural (Target);
            else
                return 0;
            end if;
        else
            return 0;
        end if;
    end From_Based_To_Natural;


    function From_Hour_To_Natural (S : String) return Natural is
        Time : constant String := String (S);
        Source : String (1 .. 10);
        Source_Length : Natural := 0;
        Value : Natural := 0;
        Target : Natural := 0;
        Ok : Boolean := True;
        Coef : Natural := 10;
    begin
        for I in 1 .. Time'Last loop
            case Time (I) is
                when 'h' | 'H' =>
                    String_Utilities.String_To_Number
                       (Source (1 .. Source_Length), Target, Ok);
                    if Ok then
                        Value := Value + Target * 36000;
                    end if;
                    Source_Length := 0;
                when 'm' | 'M' =>
                    String_Utilities.String_To_Number
                       (Source (1 .. Source_Length), Target, Ok);
                    if Ok then
                        Value := Value + Target * 600;
                    end if;
                    Source_Length := 0;
                when 's' | 'S' =>
                    String_Utilities.String_To_Number
                       (Source (1 .. Source_Length), Target, Ok);
                    if Ok then
                        Value := Value + Target * Coef;
                    end if;
                    Source_Length := 0;
                when '.' =>
                    Coef := 1;
                when others =>
                    Source_Length := Source_Length + 1;
                    Source (Source_Length) := Time (I);
            end case;
        end loop;
        return Value;
    end From_Hour_To_Natural;
end Convert;

E3 Meta Data

    nblk1=3
    nid=0
    hdr6=6
        [0x00] rec0=20 rec1=00 rec2=01 rec3=01e
        [0x01] rec0=1e rec1=00 rec2=02 rec3=00a
        [0x02] rec0=16 rec1=00 rec2=03 rec3=000
    tail 0x217392e60853b72ae9b5a 0x42a00088462060003