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

⟦89a6fedb7⟧ Ada Source

    Length: 16384 (0x4000)
    Types: Ada Source
    Notes: 03_class, FILE, R1k_Segment, e3_tag, package body Instructions, seg_0497d8

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 Lex, Error, Token_Pkg, Element, Exprs, Donnee, Set_Of_Token,
     Pieces, Element_Global, Element, Liste_Instructions, Enum, Feuille,
     Bounded_String, String_Table, String_Utilities, Text_Io, Struct_Component;
use Token_Pkg;
package body Instructions is
------------------------------------------------------------------------
-- <UNIT>        Instructions
------------------------------------------------------------------------
--
-- <DESCRIPTION>    This package defines an operation for parsing the
--                  grammatical expresssion : <Instructions>
--
-- <AUTHOR>         Barthe Raphael, Beck Didier, Kempe Laurent
-- <VERSION>        1.0
-- <DATE>           16-Jan-95
-- <MODIFY>         16-Jan-95
--
-- <PKG USED>       LEX, Token_Pkg, Error,
--
------------------------------------------------------------------------

    Unit_Donnee : Set_Of_Token.Object :=
       Set_Of_Token.Make ((T_Vrai, T_Faux, T_Ident, T_String, T_Integer));

    Unit_Element_Global : Set_Of_Token.Object :=
       Set_Of_Token.Make ((T_Objet, T_Pnj, T_Hero, T_Piece_Courante));

    procedure Parse (Tmptree : in out Feuille.Pcell;
                     Success : in out Boolean) is
------------------------------------------------------------------------
-- <SUBPROGRAM>
-- <UNIT>        Parse
--
-- <DESCRIPTION> Try to parse <Instructions> and return if it was a
--               success or not.
--
-- <EXCEPTIONS>  Nothing
--
------------------------------------------------------------------------
        Ok : Boolean := True;
        Found : Boolean;
        Astring : String_Table.I_String;
        Tmpident : String_Table.I_String;
        Tmptree2, Tmptree3 : Feuille.Pcell;
        Tmpiterstruct : Struct_Component.Liste_Structure.Listiter;
        Tmpinstlist : Feuille.Liste_Instr.List;
    begin
        case Lex.Gettoken is

            when T_Si =>
                Lex.Next;
                Tmptree2 := Feuille.Create (Feuille.Unk);
                Exprs.Parse (Tmptree2, Ok);
                Success := Success and Ok;
                if Lex.Currenttoken_Is (T_Alors) then
                    Tmptree := Feuille.Create (Feuille.Alors);
                    Tmptree.Left := Tmptree2;
                    Tmptree3 := Feuille.Create (Feuille.Unk);
                    Lex.Next;
                    Liste_Instructions.Parse (Tmpinstlist, Ok);
                    Success := Success and Ok;
                    Tmptree3 := Feuille.Create
                                   (Feuille.Instruction, Tmpinstlist);
                    Tmptree.Right := Tmptree3;
                    if Lex.Currenttoken_Is (T_Fin_Si) then
                        Lex.Next;
                    else
                        Success := False;
                        Error.Append (" : 'fin_si' attendu !");
                    end if;
                else
                    Success := False;
                    Error.Append (" : 'alors' attendu !");
                end if;

            when T_Jeu_Termine =>
                Tmptree := Feuille.Create (Feuille.Termine);
                Lex.Next;

            when T_Dire =>
                Tmptree := Feuille.Create (Feuille.Dire);
                Lex.Next;
                case Lex.Gettoken is
                    when T_String =>
                        Bounded_String.Copy (Astring, Lex.Image);
                        Tmptree.Right := Feuille.Create
                                            (Feuille.Chaine, Astring);
                        Lex.Next;
                    when T_Ident =>
                        Bounded_String.Copy
                           (Tmpident, String_Utilities.Upper_Case (Lex.Image));
                        --Lex.Next;
                        Element.Parse (Ok);
                        Success := Success and Ok;
                        Tmptree.Right := Element.Tmptree;
                    when others =>
                        Success := False;
                        Error.Append (" : une string ou un ident attendu !");
                end case;

            when T_Piece_Courante =>
                Tmptree2 := Feuille.Create (Feuille.Piece_Courante);
                Lex.Next;
                if Lex.Currenttoken_Is (T_Vaut) then
                    Tmptree := Feuille.Create (Feuille.Vaut);
                    Tmptree.Left := Tmptree2;  
                    Lex.Next;
                    if Lex.Currenttoken_Is (T_Ident) then
                        Bounded_String.Copy
                           (Astring, String_Utilities.Upper_Case (Lex.Image));
                        Struct_Component.Is_Inside
                           (String_Utilities.Upper_Case (Lex.Image),
                            Pieces.Liste, Tmpiterstruct, Found);
                        if not Found then
                            Error.Append (" : nom de piece inconnu !");
                            Success := False;
                        else
                            Tmptree3 := Feuille.Create
                                           (Feuille.Iter_S, Tmpiterstruct);
                            Tmptree.Right := Tmptree3;
                        end if;
                        Lex.Next;
                    else
                        Success := False;
                        Error.Append (" : un ident attendu !");
                    end if;
                else
                    Success := False;
                    Error.Append (" : 'vaut' attendu");
                end if;

            when T_Ident =>
                Element.Parse (Ok);
                Success := Success and Ok;
                case Lex.Gettoken is  
                    when T_Vaut =>
                        Tmptree := Feuille.Create (Feuille.Vaut);
                        Tmptree.Left := Element.Tmptree;
                        Lex.Next;
                        if Set_Of_Token.Is_Member
                              (Lex.Gettoken, Unit_Element_Global) then
                            Element_Global.Parse (Ok);
                            Success := Success and Ok;
                            Tmptree.Right := Element_Global.Tmptree;
                        elsif Set_Of_Token.Is_Member
                                 (Lex.Gettoken, Unit_Donnee) then
                            Donnee.Parse (Ok);
                            Success := Success and Ok;
                            Tmptree.Right := Donnee.Tmptree;
                        else
                            Success := False;
                            Error.Append
                               (" : 'vrai' ou 'faux' ou un ident ou un entier ou une chaine ou 'objet'" &
                                " ou 'hero' ou 'piece_courante' ou 'direction' attendu !");
                        end if;

                    when T_Add =>
                        Tmptree := Feuille.Create (Feuille.Vaut);
                        Tmptree.Left := Element.Tmptree;
                        Lex.Next;
                        if Lex.Currenttoken_Is (T_Integer) then
                            Tmptree2 := Feuille.Create (Feuille.Plus);
                            Tmptree2.Left := Element.Tmptree;
                            Tmptree3 := Feuille.Create
                                           (Feuille.Entier,
                                            Natural'Value (Lex.Image));
                            Tmptree2.Right := Tmptree3;
                            Tmptree.Right := Tmptree2;
                            Lex.Next;
                        else
                            Success := False;
                            Error.Append (" : un entier attendu !");
                        end if;

                    when T_Sub =>  
                        Tmptree := Feuille.Create (Feuille.Vaut);
                        Tmptree.Left := Element.Tmptree;
                        Lex.Next;
                        if Lex.Currenttoken_Is (T_Integer) then
                            Tmptree2 := Feuille.Create (Feuille.Moins);
                            Tmptree2.Left := Element.Tmptree;
                            Tmptree3 := Feuille.Create
                                           (Feuille.Entier,
                                            Natural'Value (Lex.Image));
                            Tmptree2.Right := Tmptree3;
                            Tmptree.Right := Tmptree2;
                            Lex.Next;
                        else
                            Success := False;
                            Error.Append (" : un entier attendu !");
                        end if;

                    when T_Mul =>  
                        Tmptree := Feuille.Create (Feuille.Vaut);
                        Tmptree.Left := Element.Tmptree;
                        Lex.Next;
                        if Lex.Currenttoken_Is (T_Integer) then
                            Tmptree2 := Feuille.Create (Feuille.Fois);
                            Tmptree2.Left := Element.Tmptree;
                            Tmptree3 := Feuille.Create
                                           (Feuille.Entier,
                                            Natural'Value (Lex.Image));
                            Tmptree2.Right := Tmptree3;
                            Tmptree.Right := Tmptree2;
                            Lex.Next;
                        else
                            Success := False;
                            Error.Append (" : un entier attendu !");
                        end if;

                    when T_Div =>  
                        Tmptree := Feuille.Create (Feuille.Vaut);
                        Tmptree.Left := Element.Tmptree;
                        Lex.Next;
                        if Lex.Currenttoken_Is (T_Integer) then
                            Tmptree2 := Feuille.Create (Feuille.Div);
                            Tmptree2.Left := Element.Tmptree;
                            Tmptree3 := Feuille.Create
                                           (Feuille.Entier,
                                            Natural'Value (Lex.Image));
                            Tmptree2.Right := Tmptree3;
                            Tmptree.Right := Tmptree2;
                            Lex.Next;
                        else
                            Success := False;
                            Error.Append (" : un entier attendu !");
                        end if;

                    when others =>
                        Success := False;
                        Error.Append
                           (" : '+' ou '-' ou '*' ou '/' ou 'vaut' attendu !");
                end case;

            when others =>
                Success := False;
                Error.Append
                   (" : un ident ou 'le' ou 'piece_courante' ou 'si' ou 'dire'" &
                    " ou 'jeu_termine' attendu !");
        end case;
    end Parse;

end Instructions;

E3 Meta Data

    nblk1=f
    nid=c
    hdr6=1a
        [0x00] rec0=1a rec1=00 rec2=01 rec3=006
        [0x01] rec0=1b rec1=00 rec2=0d rec3=00a
        [0x02] rec0=14 rec1=00 rec2=02 rec3=042
        [0x03] rec0=17 rec1=00 rec2=0a rec3=058
        [0x04] rec0=14 rec1=00 rec2=0e rec3=060
        [0x05] rec0=01 rec1=00 rec2=0f rec3=044
        [0x06] rec0=18 rec1=00 rec2=0b rec3=04e
        [0x07] rec0=12 rec1=00 rec2=06 rec3=072
        [0x08] rec0=14 rec1=00 rec2=09 rec3=010
        [0x09] rec0=13 rec1=00 rec2=07 rec3=062
        [0x0a] rec0=13 rec1=00 rec2=05 rec3=07a
        [0x0b] rec0=16 rec1=00 rec2=04 rec3=09c
        [0x0c] rec0=07 rec1=00 rec2=08 rec3=000
        [0x0d] rec0=07 rec1=00 rec2=08 rec3=000
        [0x0e] rec0=00 rec1=00 rec2=20 rec3=0fa
    tail 0x2174de34e865e68bb8e5e 0x42a00088462060003
Free Block Chain:
  0xc: 0000  00 03 00 04 80 01 65 01 02 03 04 05 06 07 08 09  ┆      e         ┆
  0x3: 0000  00 00 00 3a 80 08 20 61 6e 64 20 4f 6b 3b 08 00  ┆   :   and Ok;  ┆