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

⟦74b865b89⟧ Ada Source

    Length: 11264 (0x2c00)
    Types: Ada Source
    Notes: 03_class, FILE, R1k_Segment, e3_tag, package body Player_Lex, seg_049c07, seg_049c16, seg_049c27

Derivation

└─⟦8527c1e9b⟧ Bits:30000544 8mm tape, Rational 1000, Arrival backup of disks in PAM's R1000
    └─ ⟦5a81ac88f⟧ »Space Info Vol 1« 
        └─⟦this⟧ 
└─⟦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, Text_Io, Moving_String, Order, Screen,
     Introduction_Instructions, Message_Array, The_Place,
     The_Hero, Order_Array, Complement_Array, The_Order,
     Cheat_Code, Cheat_Mode, Coded_Order_Array, Total_Actions;
use Moving_String;
package body Player_Lex is

    subtype Digit is Character range '0' .. '9';
    subtype Lowercase is Character range 'a' .. 'z';

    procedure Get_Command (Success : out Boolean;
                           Word_Nb : out Natural;
                           The_Words : out Word_Array) is

        Local_Success : Boolean := True;
        Local_Word_Nb : Natural := 0;
        Local_The_Words : Word_Array;

        A_String : String (1 .. 80);
        Char_Last, Char_Current : Natural;
        New_Word : Boolean := True;
    begin
        Screen.Read_Player_Window (A_String, Char_Last);
        Local_The_Words := (1 .. Max_Word => Moving_String.Null_Object);
        Char_Current := 1;
        while (Char_Current <= Char_Last) and Local_Success loop
            case A_String (Char_Current) is
                when Digit | Lowercase | '_' =>
                    if not New_Word then
                        Local_The_Words (Local_Word_Nb) :=
                           Local_The_Words (Local_Word_Nb) &  
                              A_String (Char_Current);
                        Char_Current := Char_Current + 1;
                    else
                        Local_Word_Nb := Local_Word_Nb + 1;
                        Moving_String.Free (Local_The_Words (Local_Word_Nb));
                        New_Word := False;
                    end if;
                when ' ' =>
                    while A_String (Char_Current) = ' ' loop
                        Char_Current := Char_Current + 1;
                    end loop;
                    New_Word := True;
                when others =>
                    Local_Success := False;
            end case;
        end loop;

        Success := Local_Success;
        Word_Nb := Local_Word_Nb;
        The_Words := Local_The_Words;
    end Get_Command;


    procedure Run_Order (The_Words : in Word_Array; Ok : out Boolean) is

        An_Order : Order.Object;
        Local_Ok : Boolean;

    begin  
        Order.Put_Place (An_Order, The_Place.Image);
        Order.Put_First_Complement (An_Order,
                                    Moving_String.Image (The_Words (1)));
        Order.Put_Second_Complement (An_Order,
                                     Moving_String.Image (The_Words (2)));
        Order.Put_Third_Complement (An_Order,
                                    Moving_String.Image (The_Words (3)));
        Order.Put_Fourth_Complement (An_Order,
                                     Moving_String.Image (The_Words (4)));
        The_Order.Put (An_Order);

        Order_Array.Make (An_Order);

        Order_Array.Init;
        Local_Ok := False;
        while not Order_Array.Done and not Local_Ok loop
            Coded_Order_Array.Run (Order_Array.Value, Local_Ok);
            Order_Array.Next;
        end loop;  
        Ok := Local_Ok;

    end Run_Order;

    procedure Execute_Command (The_Words : in Word_Array) is

        Ok : Boolean := True;
        Unknown_Words : Moving_String.Object;

    begin
        for I in 1 .. 4 loop
            if not (The_Words (I) = Moving_String.Null_Object) and then
               not Complement_Array.Belong
                      (Moving_String.Image (The_Words (I))) then
                Ok := False;
                Unknown_Words := Unknown_Words & The_Words (I) & " ";
            end if;
        end loop;  
        if not Ok then
            Screen.Write_Player_Window
               ("Qu'est ce que vous voulez dire par " &
                Moving_String.Image (Unknown_Words) & "?");  
        else
            for I in 1 .. 4 loop
                if Complement_Array.Is_An_Animate
                      (Moving_String.Image (The_Words (I))) or
                   Complement_Array.Is_An_Entity
                      (Moving_String.Image (The_Words (I))) then
                    if not ((Complement_Array.Place
                                (Complement_Array.Index
                                    (Moving_String.Image (The_Words (I)))) =
                             The_Place.Index) or
                            (Complement_Array.Place
                                (Complement_Array.Index
                                    (Moving_String.Image (The_Words (I)))) =
                             The_Hero.Index)) then
                        Ok := False;
                        Screen.Write_Player_Window
                           ("Je ne vois de " &
                            Moving_String.Image (The_Words (I)) &
                            " a ma portee.");
                    end if;
                end if;
            end loop;
            if Ok then
                Run_Order (The_Words, Ok);
                Total_Actions.Add_One;
                if not Ok then
                    Screen.Write_Player_Window (Message_Array.Message);
                end if;
            end if;
        end if;
    end Execute_Command;

    procedure Command_Analyser is
        Success : Boolean;
        The_Words : Word_Array;
        Word_Nb : Natural;
        Finish : Boolean := False;

    begin
        Screen.Open_Player_Window;
        Screen.Open_World_Window;
        Introduction_Instructions.Run;
        while not Finish loop
            Get_Command (Success, Word_Nb, The_Words);
            if not Success then
                Screen.Write_Player_Window
                   ("Y en a des caracteres que je connais pas !!");
            elsif Word_Nb > 4 then
                Screen.Write_Player_Window
                   ("Tu peux pas faire de phrases avec moins de mots !!");
            else
                if Moving_String.Image (The_Words (1)) = "quit" then
                    Finish := True;
                elsif Moving_String.Image (The_Words (1)) = "help" or
                      Moving_String.Image (The_Words (1)) =
                         Cheat_Code.Image then
                    Cheat_Mode.Start;
                else
                    Execute_Command (The_Words);
                end if;
            end if;  
            Finish := Finish or Coded_Order_Array.Is_At_End;
        end loop;
        delay 5.0;
        Screen.Close_Player_Window;  
        Screen.Close_World_Window;  
    end Command_Analyser;

end Player_Lex;

E3 Meta Data

    nblk1=a
    nid=7
    hdr6=10
        [0x00] rec0=1b rec1=00 rec2=01 rec3=01c
        [0x01] rec0=13 rec1=00 rec2=06 rec3=024
        [0x02] rec0=1d rec1=00 rec2=08 rec3=00a
        [0x03] rec0=1d rec1=00 rec2=04 rec3=008
        [0x04] rec0=12 rec1=00 rec2=0a rec3=010
        [0x05] rec0=01 rec1=00 rec2=03 rec3=026
        [0x06] rec0=1d rec1=00 rec2=02 rec3=074
        [0x07] rec0=14 rec1=00 rec2=09 rec3=000
        [0x08] rec0=0f rec1=00 rec2=03 rec3=000
        [0x09] rec0=0b rec1=00 rec2=03 rec3=000
    tail 0x2154739a886619e7d386e 0x42a00088462060003
Free Block Chain:
  0x7: 0000  00 05 00 04 80 01 6c 01 28 43 68 61 72 5f 43 75  ┆      l (Char_Cu┆
  0x5: 0000  00 00 00 22 80 1f 20 20 20 20 20 20 20 20 20 20  ┆   "            ┆