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

⟦418773a20⟧ Ada Source

    Length: 8192 (0x2000)
    Types: Ada Source
    Notes: 03_class, FILE, R1k_Segment, e3_tag, package body Lex_Player, seg_0464ae, seg_046513

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 Text_Io, Bounded_String;

package body Lex_Player is

    type State is (St_Normal, St_Id, St_2point, St_Command, St_Found);
    subtype Minuscule is Character range 'a' .. 'z';
    subtype Majuscule is Character range 'A' .. 'Z';
    subtype Digit is Character range '0' .. '9';

    The_Case_Offset : constant := Character'Pos ('a') - Character'Pos ('A');


    The_String : String (1 .. Max_Player_String);
    The_Length : Natural;

    The_Index : Natural;
    Current_Value : Bounded_String.Variable_String (Max_Player_String);
    Current_Token : Token;
    Lookahead : Boolean;


    procedure Make_Uppercase (The_Character : in out Character) is
    begin -- Make_Uppercase
        The_Character := Character'Val
                            (Character'Pos (The_Character) - The_Case_Offset);
    end Make_Uppercase;



    procedure Get_Player (Invite : in String := "") is
        Longueur : Natural;
    begin
        Text_Io.Put_Line (Invite);
        The_String := (others => ' ');
        Text_Io.Get_Line (The_String, The_Length);
    end Get_Player;

    procedure Init is
    begin
        The_Index := The_String'First - 1;
        Lookahead := False;

        Bounded_String.Free (Current_Value);

    end Init;


    function At_End return Boolean is
    begin
        return (The_Index >= The_Length);
    end At_End;

    function Get_Value return String is
    begin
        return (Bounded_String.Image (Current_Value));
    end Get_Value;


    function Get_Token return Token is
    begin
        return (Current_Token);
    end Get_Token;

    procedure Get_State_After_2point
                 (Astate : in out State; Achar : in Character) is
        Upchar : Character;
    begin
        if (Achar in Minuscule or Achar in Majuscule) then
            Upchar := Achar;
            if Upchar in Minuscule then
                Make_Uppercase (Upchar);
            end if;
            Bounded_String.Append (Current_Value, Upchar);
            Astate := St_Command;
        else
            Bounded_String.Append (Current_Value, Achar);
            Current_Token := Unk;
            Astate := St_Found;
        end if;
    end Get_State_After_2point;


    procedure Get_Command (Astate : in out State; Achar : in Character) is
        Upchar : Character;
    begin
        if (Achar in Minuscule or Achar in Majuscule) then
            Upchar := Achar;
            if Upchar in Minuscule then
                Make_Uppercase (Upchar);
            end if;
            Bounded_String.Append (Current_Value, Upchar);
        else
            Lookahead := True;
            Astate := St_Found;
            Current_Token := Command;
        end if;
    end Get_Command;


    procedure Get_Id (Astate : in out State; Achar : in Character) is
        Upchar : Character;
    begin

        if (Achar in Minuscule or Achar in Majuscule or
            Achar in Digit or Achar = '_') then

            Upchar := Achar;
            if Upchar in Minuscule then
                Make_Uppercase (Upchar);
            end if;
            Bounded_String.Append (Current_Value, Upchar);
        else
            Lookahead := True;
            Astate := St_Found;
            Current_Token := Id;
        end if;
    end Get_Id;


    procedure Get_State_After_Normal
                 (Astate : in out State; Achar : in Character) is
        Upchar : Character;
    begin
        Upchar := Achar;
        case Achar is
            when Ascii.Cr | Ascii.Ht | ' ' =>
                Astate := St_Normal;
            when Majuscule | Minuscule =>
                if Upchar in Minuscule then
                    Make_Uppercase (Upchar);
                end if;
                Bounded_String.Append (Current_Value, Upchar);
                Astate := St_Id;
            when ':' =>
                Astate := St_2point;
            when others =>
                Bounded_String.Append (Current_Value, Achar);
                Current_Token := Unk;
                Astate := St_Found;
        end case;
    end Get_State_After_Normal;

    procedure Next is
        Current_State : State;
        Current_Char : Character;
    begin
        if not (At_End) then
            Bounded_String.Free (Current_Value);


            Current_State := St_Normal;
            Search_Token:
                loop

                    if not (Lookahead) then
                        The_Index := The_Index + 1;
                        if (The_Index > Max_Player_String) then
                            Current_Token := Toolong;
                            exit Search_Token;
                        end if;
                    else
                        Lookahead := False;
                    end if;

                    Current_Char := The_String (The_Index);

                    case Current_State is
                        when St_Normal =>
                            Get_State_After_Normal
                               (Current_State, Current_Char);
                        when St_2point =>
                            Get_State_After_2point
                               (Current_State, Current_Char);
                        when St_Command =>
                            Get_Command (Current_State, Current_Char);
                        when St_Id =>
                            Get_Id (Current_State, Current_Char);
                        when others =>
                            Current_Token := Unk;
                            Bounded_String.Append (Current_Value, Current_Char);
                            Current_State := St_Found;
                    end case;
                    exit when Current_State = St_Found;
                end loop Search_Token;
        else
            Current_Token := Lexend;
        end if;
    end Next;




end Lex_Player;


E3 Meta Data

    nblk1=7
    nid=0
    hdr6=e
        [0x00] rec0=22 rec1=00 rec2=01 rec3=030
        [0x01] rec0=27 rec1=00 rec2=07 rec3=00e
        [0x02] rec0=02 rec1=00 rec2=02 rec3=024
        [0x03] rec0=21 rec1=00 rec2=03 rec3=028
        [0x04] rec0=1e rec1=00 rec2=04 rec3=046
        [0x05] rec0=1f rec1=00 rec2=05 rec3=052
        [0x06] rec0=1b rec1=00 rec2=06 rec3=001
    tail 0x21542ded28650453dd8f9 0x42a00088462060003