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

⟦9cf9b953a⟧ TextFile

    Length: 2741 (0xab5)
    Types: TextFile
    Names: »B«

Derivation

└─⟦a7d1ea751⟧ Bits:30000550 8mm tape, Rational 1000, !users!projects 94_04_11
    └─ ⟦129cab021⟧ »DATA« 
        └─⟦this⟧ 

TextFile

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;