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

⟦56928b15a⟧ Ada Source

    Length: 10240 (0x2800)
    Types: Ada Source
    Notes: 03_class, FILE, R1k_Segment, e3_tag, package body Itf_Joueur, seg_0468ca

Derivation

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

E3 Source Code



with Text_Io, Unbounded_String, String_Utilities;
package body Itf_Joueur is

    package Infinite_String is new Unbounded_String (1);

    type States is (State_Start, State_In_Id, State_Found);

    Maxtaille : constant Positive := 100;

    Maxword : constant Positive := 3;
    Tab_Value : array (1 .. Maxword) of Infinite_String.Variable_String;

    Word_Number : Natural := 0;

    Current_Value : Infinite_String.Variable_String;
    Longueur_Valide : Natural := 1;

    function Get_Value (I : in Positive) return String is
    begin
        return (Infinite_String.Image (Tab_Value (I)));
    end Get_Value;

    procedure Initialize is
    begin
        for I in 1 .. Maxword loop
            Infinite_String.Free (Tab_Value (I));
        end loop;
        Word_Number := 0;
    end Initialize;

    function Isalpha (C : in Character) return Boolean is

    begin
        return ((C in 'a' .. 'z') or (C in 'A' .. 'Z') or (C = '_'));  
    end Isalpha;

    function Isdigit (C : in Character) return Boolean is

    begin
        return (C in '0' .. '9');
    end Isdigit;

    function Isseparator (C : in Character) return Boolean is

    begin
        return (C = ' ');
    end Isseparator;

    function Istiret (C : Character) return Boolean is  
    begin
        return (C = '-');
    end Istiret;

    function Get_Command return Infinite_String.Variable_String is
        Source1 : Infinite_String.Variable_String;
        Source : String (1 .. Maxtaille);
        Prompt_Character : constant Character := '>';

    begin  
        Source := (others => ' ');
        Infinite_String.Free (Source1);
        Text_Io.Put_Line ("enter votre action :");
        Text_Io.Put (Prompt_Character);
        Text_Io.Put (Prompt_Character);
        Text_Io.Get_Line (Source, Longueur_Valide);
        Source1 := Infinite_String.Value
                      (String_Utilities.Strip_Trailing (Source));

        return Source1;
    end Get_Command;

    procedure Get_Identifier (Source : in Infinite_String.Variable_String;
                              Index : in out Natural) is

        Current_State : States;
        Readed_Character : Character;


    begin
        Infinite_String.Free (Current_Value);
        Current_State := State_Start;

        while ((Current_State /= State_Found) and then
               (Index <= Infinite_String.Length (Source))) loop
            Readed_Character := Infinite_String.Char_At (Source, Index);
            case Current_State is
                when State_Start =>
                    if (not Isseparator (Readed_Character)) then  
                        Current_State := State_In_Id;
                        Infinite_String.Append
                           (Current_Value, Readed_Character);
                    end if;
                when State_In_Id =>
                    if (not Isseparator (Readed_Character)) then
                        -- Current_State := State_In_Id;
                        Infinite_String.Append
                           (Current_Value, Readed_Character);
                    else
                        Current_State := State_Found;

                        Word_Number := Word_Number + 1;
                    end if;

                when others =>
                    null;
            end case;  
            Index := Index + 1;

        end loop;
        if Index > Infinite_String.Length (Source) then
            case Current_State is
                when State_In_Id =>
                    Current_State := State_Found;  
                    Word_Number := Word_Number + 1;
                when others =>
                    null;
            end case;
        end if;

    end Get_Identifier;

    function Next_Command return Boolean is

        Index : Natural := 1;
        Source : Infinite_String.Variable_String;


    begin
        Initialize;
        Infinite_String.Free (Source);
        Source := Get_Command;

        while (Index <= Longueur_Valide) loop
            Get_Identifier (Source, Index);
            if (Word_Number > Maxword) then
                return False;
            end if;
            -- Text_Io.Put_Line (Infinite_String.Image (Current_Value));
            Infinite_String.Copy (Tab_Value (Word_Number), Current_Value);
            -- Text_Io.Put_Line (Infinite_String.Image (Tab_Value (Word_Number)));

        end loop;
        return True;
    end Next_Command;

end Itf_Joueur;

E3 Meta Data

    nblk1=9
    nid=6
    hdr6=a
        [0x00] rec0=23 rec1=00 rec2=01 rec3=08e
        [0x01] rec0=21 rec1=00 rec2=02 rec3=070
        [0x02] rec0=18 rec1=00 rec2=07 rec3=06a
        [0x03] rec0=1f rec1=00 rec2=04 rec3=006
        [0x04] rec0=1a rec1=00 rec2=05 rec3=000
        [0x05] rec0=1a rec1=00 rec2=05 rec3=000
        [0x06] rec0=22 rec1=00 rec2=06 rec3=016
        [0x07] rec0=12 rec1=00 rec2=05 rec3=000
        [0x08] rec0=10 rec1=00 rec2=05 rec3=000
    tail 0x215433d4286515cced94f 0x42a00088462060003
Free Block Chain:
  0x6: 0000  00 09 00 1f 80 0e 6e 64 20 49 6e 69 74 69 61 6c  ┆      nd Initial┆
  0x9: 0000  00 08 00 06 80 03 68 65 6e 03 65 5f 46 6f 75 6e  ┆      hen e_Foun┆
  0x8: 0000  00 03 00 4f 80 02 29 3b 02 00 21 20 20 20 20 20  ┆   O  );  !     ┆
  0x3: 0000  00 00 00 04 80 01 20 01 02 03 04 05 06 07 08 09  ┆                ┆