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

⟦44fce5c2a⟧ Ada Source

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

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



package body Banque is
    Courant : array (Code_Clef range 1 .. Code_Clef'Last) of Argent :=
       (others => 0);
    Disponible : array (Code_Clef range 1 .. Code_Clef'Last) of Boolean :=
       (others => True);
    procedure Ouvrir_Compte (Compte : in out Clef; Somme : Argent) is
    begin
        if Compte.Code = 0 then
            for I in Disponible'Range loop
                if Disponible (I) then
                    Disponible (I) := False;
                    Courant (I) := Somme;
                    Compte.Code := I;
                end if;
            end loop;
        end if;
    end Ouvrir_Compte;

    procedure Valide (Compte : in Clef) is
    begin
        if not Valable (Compte) then
            raise Alarme;
        end if;
    end Valide;

    procedure Cloturer_Compte (Compte : in out Clef; Somme : out Argent) is
    begin
        Valide (Compte);
        Somme := Courant (Compte.Code);
        Disponible (Compte.Code) := True;
        Compte.Code := 0;
    end Cloturer_Compte;

    procedure Deposer (Compte : in Clef; Somme : in Argent) is
    begin
        Valide (Compte);
        Courant (Compte.Code) := Courant (Compte.Code) + Somme;
    end Deposer;

    procedure Retirer (Compte : in out Clef; Somme : in out Argent) is
    begin
        Valide (Compte);
        if Courant (Compte.Code) >= Somme then
            Courant (Compte.Code) := Courant (Compte.Code) - Somme;
        else
            Somme := Courant (Compte.Code);
            Disponible (Compte.Code) := True;
            Compte.Code := 0;
        end if;
    end Retirer;

    function Releve (Compte : Clef) return Argent is
    begin
        Valide (Compte);
        return Courant (Compte.Code);
    end Releve;

    function Valable (Compte : Clef) return Boolean is
    begin
        return Compte.Code /= 0;
    end Valable;
end Banque;

E3 Meta Data

    nblk1=4
    nid=2
    hdr6=4
        [0x00] rec0=1f rec1=00 rec2=01 rec3=046
        [0x01] rec0=21 rec1=00 rec2=04 rec3=000
        [0x02] rec0=02 rec1=00 rec2=02 rec3=000
        [0x03] rec0=02 rec1=00 rec2=03 rec3=000
    tail 0x2172176fe83ab770b0418 0x42a00088462060003
Free Block Chain:
  0x2: 0000  00 03 00 07 80 01 3b 01 00 00 00 10 20 20 20 20  ┆      ;         ┆
  0x3: 0000  00 00 00 1e 80 0a 64 20 56 61 6c 61 62 6c 65 3b  ┆      d Valable;┆