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

⟦73d4ccda5⟧ Ada Source

    Length: 7168 (0x1c00)
    Types: Ada Source
    Notes: 03_class, FILE, R1k_Segment, e3_tag, package body Plage, seg_04ccaa, seg_04cd8d

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;
package body Plage is

    function Set (Le_Num : Num_Plage;
                  Sous_Zone_1 : Sous_Zone;
                  Sous_Zone_2 : Sous_Zone;
                  Sous_Zone_3 : Sous_Zone) return Object is
    begin
        return Object'(Numero_Plage => Le_Num,
                       Sous_Zone_1 => Sous_Zone_1,
                       Sous_Zone_2 => Sous_Zone_2,
                       Sous_Zone_3 => Sous_Zone_3);
    end Set;


    function Set (Debut_1 : Date.Horaire;
                  Fin_1 : Date.Horaire;
                  Debut_2 : Date.Horaire;
                  Fin_2 : Date.Horaire;
                  Jours : Semaine) return Sous_Zone is
        Tmp : Jours_Plage := 0;
    begin

        if (Jours (1) = 'L') then
            Tmp := Tmp + 16#40#;
        end if;

        if (Jours (2) = 'M') then
            Tmp := Tmp + 16#20#;
        end if;

        if (Jours (3) = 'M') then
            Tmp := Tmp + 16#10#;
        end if;

        if (Jours (4) = 'J') then
            Tmp := Tmp + 16#8#;
        end if;

        if (Jours (5) = 'V') then
            Tmp := Tmp + 16#4#;
        end if;

        if (Jours (6) = 'S') then
            Tmp := Tmp + 16#2#;
        end if;

        if (Jours (7) = 'D') then
            Tmp := Tmp + 16#1#;
        end if;
        return Sous_Zone'(Debut_1 => Debut_1,
                          Fin_1 => Fin_1,
                          Debut_2 => Debut_2,
                          Fin_2 => Fin_2,
                          Jours => Tmp);
    end Set;


    function Image (La_Plage : in Object) return String is
    begin
        return String'(Num_Plage'Image (La_Plage.Numero_Plage) & Ascii.Ht &
                       Image (La_Plage.Sous_Zone_1) & Ascii.Lf & Ascii.Ht &
                       Image (La_Plage.Sous_Zone_2) & Ascii.Lf &
                       Ascii.Ht & Image (La_Plage.Sous_Zone_3));
    end Image;


    function Image (La_Sous_Zone : in Sous_Zone) return String is
    begin
        return String'(Date.Image (La_Sous_Zone.Debut_1) & "-" &
                       Date.Image (La_Sous_Zone.Fin_1) & " " &
                       Date.Image (La_Sous_Zone.Debut_2) &
                       "-" & Date.Image (La_Sous_Zone.Fin_2) &
                       " " & Image (La_Sous_Zone.Jours));
    end Image;

    function Image (Les_Jours : in Jours_Plage) return String is
        Jours_Semaine : Jours_Plage := Les_Jours;
        Chaine_Semaine : Semaine := "-------";
        Jour_Maj : Semaine := "LMMJVSD";
    begin
        for I in 1 .. Chaine_Semaine'Length loop
            if (Jours_Semaine mod 2) /= 0 then
                Chaine_Semaine (Semaine'Length + 1 - I) :=
                   Jour_Maj (Chaine_Semaine'Length + 1 - I);
            end if;  
            Jours_Semaine := Jours_Semaine / 2;
        end loop;
        return Chaine_Semaine;
    end Image;

    function Image (La_Sous_Zone : in Sous_Zone) return Mt.Byte_String is
        use Mt;
    begin
        return Mt.Byte_String'
                  (Date.Image (La_Sous_Zone.Debut_1) &
                   Date.Image (La_Sous_Zone.Fin_1) &
                   Date.Image (La_Sous_Zone.Debut_2) &
                   Date.Image (La_Sous_Zone.Fin_2) & La_Sous_Zone.Jours);
    end Image;

    function Image (Le_Num : in Num_Plage) return Mt.Bs_Access is
    begin
        return new Mt.Byte_String'(1 => Le_Num);
    end Image;

    function Image (La_Plage : in Object) return Mt.Bs_Access is
        use Mt;
    begin
        return new Mt.Byte_String'(La_Plage.Numero_Plage &
                                   Image (La_Plage.Sous_Zone_1) &
                                   Image (La_Plage.Sous_Zone_2) &
                                   Image (La_Plage.Sous_Zone_3));
    end Image;

    function Value (The_Byte_String : in Mt.Byte_String) return Sous_Zone is
        Ss_Zone : Sous_Zone;
        Data_Bs : Mt.Byte_String (1 .. 2);
    begin
        Ss_Zone.Debut_1 := Date.Value (The_Byte_String (1 .. 2));
        Data_Bs (1 .. 2) := The_Byte_String (3 .. 4);
        Ss_Zone.Fin_1 := Date.Value (Data_Bs);
        Data_Bs (1 .. 2) := The_Byte_String (5 .. 6);
        Ss_Zone.Debut_2 := Date.Value (Data_Bs);
        Data_Bs (1 .. 2) := The_Byte_String (7 .. 8);
        Ss_Zone.Fin_2 := Date.Value (Data_Bs);
        Ss_Zone.Jours := The_Byte_String (9);
        return Ss_Zone;

    exception
        when Constraint_Error =>
            return Zero;

    end Value;

    function Value (The_Byte_String : in Mt.Byte_String) return Object is
        Une_Plage : Object;
        Data_Bs : Mt.Byte_String (1 .. 9);
    begin
        Une_Plage.Numero_Plage := The_Byte_String (1);
        Data_Bs (1 .. 9) := The_Byte_String (2 .. 10);
        Une_Plage.Sous_Zone_1 := Value (Data_Bs);
        Data_Bs (1 .. 9) := The_Byte_String (11 .. 19);
        Une_Plage.Sous_Zone_2 := Value (Data_Bs);
        Data_Bs (1 .. 9) := The_Byte_String (20 .. 28);
        Une_Plage.Sous_Zone_3 := Value (Data_Bs);
        return Une_Plage;

    exception
        when Constraint_Error =>
            return Zero;

    end Value;

    function Zero return Sous_Zone is
    begin
        return Sous_Zone'(Debut_1 => Date.Zero,
                          Fin_1 => Date.Zero,
                          Debut_2 => Date.Zero,
                          Fin_2 => Date.Zero,
                          Jours => 0);
    end Zero;

    function Zero return Object is
    begin
        return Object'(Numero_Plage => 0,
                       Sous_Zone_1 => Zero,
                       Sous_Zone_2 => Zero,
                       Sous_Zone_3 => Zero);
    end Zero;



end Plage;

E3 Meta Data

    nblk1=6
    nid=0
    hdr6=c
        [0x00] rec0=22 rec1=00 rec2=01 rec3=03c
        [0x01] rec0=21 rec1=00 rec2=02 rec3=000
        [0x02] rec0=1a rec1=00 rec2=03 rec3=004
        [0x03] rec0=19 rec1=00 rec2=04 rec3=006
        [0x04] rec0=1a rec1=00 rec2=05 rec3=050
        [0x05] rec0=20 rec1=00 rec2=06 rec3=000
    tail 0x217540cf6874f6e73e600 0x42a00088462060003