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

⟦e5b13a746⟧ Ada Source

    Length: 52224 (0xcc00)
    Types: Ada Source
    Notes: 03_class, FILE, R1k_Segment, e3_tag, package body Motor, seg_048b95

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 Text_Io, Bounded_String, Pieces, Actions, Objets, Token_Pkg,
     Directions, Int_Lib, Pnjs, Struct_Component, String_Table;
package body Motor is

    procedure Go is
        Ok : Boolean;
    begin  
        Ok := False;
        --Text_Io.Put_Line
        --   ("**************************** Execution des instructions GLOBALES");
        Execute_Liste (Liste_Globale, Mode_All, Ok);
        --Text_Io.Put_Line ("**************************** Globales Executees");
        --Text_Io.Put_Line
        --   ("**************************** Execution des instructions LOCALES");
        Execute_Liste (Liste_Locale, Mode_All, Ok);
        --Text_Io.Put_Line ("**************************** Locales Executees");
        if not Ok then
            --Text_Io.Put_Line
            --   ("**************************** Execution des instructions PSEUDO-GLOBALES");
            Execute_Liste (Liste_Pseudo_Globale, Mode_First, Ok);
            --Text_Io.Put_Line
            --   ("**************************** Pseudo-Globales Executees");
        end if;
    end Go;

    procedure Execute_Liste (Liste : Feuille.Liste_Instr.List;
                             M : Mode;
                             Ok : in out Boolean) is
        Iter : Feuille.Liste_Instr.Listiter;
        Executed : Boolean := False;
    begin
        Ok := False;
        Iter := Feuille.Liste_Instr.Makelistiter (Liste);
        while ((Feuille.Liste_Instr.More (Iter)) and (not (Executed))) loop
            Executed := Execute_Instr (Feuille.Liste_Instr.Cellvalue (Iter));
            if Executed then
                Ok := True;
            end if;
            if M = Mode_All then
                Executed := False;
            end if;
            Feuille.Liste_Instr.Forward (Iter);
        end loop;
    end Execute_Liste;

    procedure Execute_Liste (Liste : Feuille.Liste_Instr_Locale.List;
                             M : Mode;
                             Ok : in out Boolean) is
        Iter : Feuille.Liste_Instr_Locale.Listiter;
        Instr : Feuille.Instr_Locale;
        Executed : Boolean := False;  
        Success : Boolean := False;
    begin  
        Ok := False;
        Iter := Feuille.Liste_Instr_Locale.Makelistiter (Liste);
        while (Feuille.Liste_Instr_Locale.More (Iter) and not Executed) loop
            Instr := Feuille.Liste_Instr_Locale.Cellvalue (Iter);
            if Bounded_String.Image (Instr.Piece) =
               Bounded_String.Image (Struct_Component.Liste_Structure.Cellvalue
                                        (Pieces.Piece_Courante).Name) then
                Execute_Liste (Instr.Liste, Mode_All, Ok);
                Executed := True;
            else
                Feuille.Liste_Instr_Locale.Forward (Iter);
            end if;  
        end loop;
    end Execute_Liste;

    function Execute_Instr (Atree : Feuille.Pcell) return Boolean is
        Success : Boolean;
    begin
        Evalue (Atree, Success);
        return Success;
    end Execute_Instr;


-- evalue une instruction
    procedure Evalue (Tree : in Pcell; Success : in out Boolean) is
        Iteratt : Struct_Component.Liste_Attribut.Listiter;
        Attrib : Struct_Component.Attribut;
        Iterstruc : Struct_Component.Liste_Structure.Listiter;
        Struc : Struct_Component.Structure;
        Ok : Boolean := True;
        A_Bool : Boolean := True;
        A_Nbr : Natural := 0;
        A_Str, Tmp_String : String_Table.I_String;
        use Feuille;
        use Int_Lib;
        use Token_Pkg;
    begin
        Bounded_String.Copy (A_Str, "");
        Iterstruc := Pieces.Piece_Courante;
        Iteratt :=
           Struct_Component.Liste_Attribut.Makelistiter
              (Struct_Component.Liste_Structure.Cellvalue (Iterstruc).Attribut);
        case Tree.Kind is
            when Egal =>
                --Text_Io.Put_Line (">>>> J'evalue un egal ...");
                Success := False;
                Consulte (Tree.Left, Iteratt, Ok);
                if not Ok then
                    raise Illegal_Test;
                else
                    Attrib := Struct_Component.Liste_Attribut.Cellvalue
                                 (Iteratt);
                    --Text_Io.Put (" --Attribut teste : " &
                    --             Bounded_String.Image (Attrib.Name));
                    --Text_Io.Put (" avec un  : " &
                    --             Tcell'Image (Tree.Right.Kind));
                    case Tree.Right.Kind is
                        when Iter_S | Pnj | Hero | Piece_Courante | Objet =>
                            --Text_Io.Put
                            --   (" - j'essaye avec une  struc/Piece/objet/... : ");
                            Consulte (Tree.Right, Iterstruc, Ok);
                            if Ok then
                                Struc := Struct_Component.
                                            Liste_Structure.Cellvalue
                                            (Iterstruc);
                                --Text_Io.Put_Line
                                --   (Bounded_String.Image (Struc.Name));
                                if Bounded_String.Image
                                      (Struct_Component.Get_Value (Iteratt)) =
                                   Bounded_String.Image (Struc.Name) then
                                    Success := True;  
                                else
                                    Success := False;  
                                end if;
                            else
                                Success := False;
                            end if;
                        when Booleen =>
                            --Text_Io.Put (" - j'essaye un booleen : ");
                            Consulte (Tree.Right, A_Bool, Ok);
                            --Text_Io.Put_Line ("Boolean'Image(ok));");
                            if Ok then
                                if Struct_Component.Get_Value (Iteratt) =
                                   A_Bool then
                                    Success := True;
                                else
                                    Success := False;
                                end if;
                            else
                                Success := False;
                            end if;
                        when Entier =>
                            --Text_Io.Put (" - j'essaye avec un nombre : ");
                            Consulte (Tree.Right, A_Nbr, Ok);
                            if Ok then
                                --Text_Io.Put_Line (Natural'Image (A_Nbr));
                                if Struct_Component.Get_Value (Iteratt) =
                                   A_Nbr then
                                    Success := True;
                                else
                                    Success := False;
                                end if;  
                            else
                                Success := False;
                            end if;
                        when Chaine | Enum =>
                            --Text_Io.Put (" - j'essaye avec  un enum/chaine : ");
                            Consulte (Tree.Right, A_Str, Ok);
                            if Ok then
                                --Text_Io.Put (Bounded_String.Image (A_Str) &
                                --             " qui doit etre egal a " &
                                --             Bounded_String.Image
                                --                (Struct_Component.Get_Value
                                --                    (Iteratt)));
                                if Bounded_String.Image
                                      (Struct_Component.Get_Value (Iteratt)) =
                                   Bounded_String.Image (A_Str) then
                                    Success := True;
                                else
                                    Success := False;
                                end if;  
                            else
                                Success := False;
                            end if;
                        when others =>
                            raise Illegal_Test;  
                            Success := False;
                    end case;
                end if;
            when Et =>  
                --Text_Io.Put_Line (">>>> J'evalue un et");
                Evalue (Tree.Left, Ok);
                if Ok then
                    Evalue (Tree.Right, Ok);
                    if Ok then
                        Success := True;
                        --Text_Io.Put_Line (">>>> ET est VRAI");
                    else
                        Success := False;
                        --Text_Io.Put_Line (">>>> ET est FAUX");
                    end if;
                else
                    Success := False;
                end if;

            when Verbe =>  
                if Find (Actions.Table, Tree.Idattrib) =
                   Interpretor_Result (1).Index then
                    --Text_Io.Put (">>> je teste si le verbe est : ");
                    --Text_Io.Put_Line (Bounded_String.Image (Tree.Idattrib));
                    if ((Tree.Left = null) and
                        (Interpretor_Result (2).Token = T_End)) then
                        Success := True;
                    else
                        if Tree.Left /= null then  
                            --Text_Io.Put (">>> Je teste si le(la) ");
                            if Interpretor_Result (2).Token = T_Objet then
                                case Tree.Left.Kind is
                                    when Complement =>
                                        --Text_Io.Put_Line
                                        --   ("Complement/Direction est : ");
                                        Bounded_String.Copy
                                           (Tmp_String, Tree.Left.Idattrib);
                                    when Objet =>
                                        --Text_Io.Put ("objet courant est : ");
                                        Bounded_String.Copy
                                           (Tmp_String,
                                            Struct_Component.Get_Name
                                               (Objets.Objet_Courant));
                                    when others =>
                                        raise Illegal_Test;
                                end case;
                                --Text_Io.Put_Line
                                --   (Bounded_String.Image (Tmp_String));
                                if Find (Objets.Table, Tmp_String) =
                                   Interpretor_Result (2).Index then
                                    if ((Tree.Right = null) and
                                        (Interpretor_Result (3).Token =
                                         T_End)) then
                                        Success := True;
                                    else
                                        if Tree.Right /= null then
                                            --Text_Io.Put
                                            --   (">>>> Je test si le complement est : ");
                                            --Text_Io.Put_Line
                                            --   (Bounded_String.Image
                                            --       (Tree.right.Idattrib));
                                            if Find (Objets.Table,
                                                     Tree.Right.Idattrib) =
                                               Interpretor_Result (3).Index then
                Success := True;
                                            else
                Success := False;
                                            end if;
                                        else
                                            Success := False;
                                        end if;
                                    end if;
                                else
                                    Success := False;  
                                end if;
                            else
                                if Interpretor_Result (2).Token =
                                   T_Direction then
                                    --Text_Io.Put_Line ("direction est : " &
                                    --                  Bounded_String.Image
                                    --                     (Tree.Left.Idattrib));
                                    if Find (Directions.Table,
                                             Tree.Left.Idattrib) =
                                       Interpretor_Result (2).Index then
                                        if ((Tree.Left.Left = null) and
                                            (Interpretor_Result (3).Token =
                                             T_End)) then
                                            Success := True;
                                        else
                                            Success := False;
                                        end if;
                                    else
                                        Success := False;
                                    end if;
                                else
                                    Success := False;
                                end if;
                            end if;
                        else
                            Success := False;
                        end if;
                    end if;
                else
                    Success := False;
                end if;

            when Vaut =>
                Affecte (Tree, Success);

            when Alors =>
                --Text_Io.Put (">>>> J'evalue un Si -");
                Evalue (Tree.Left, Ok);
                if Ok then
                    --Text_Io.Put_Line ("Test VRAI, J'effectue les instructions");
                    Execute_Liste (Tree.Right.Listeinst, Mode_All, Ok);
                    Success := True;
                else
                    --Text_Io.Put_Line ("Test FAUX");
                    Success := False;
                end if;
            when Feuille.Dire =>
                --Text_Io.Put_Line (">>>> J'execute un Dire");
                case Tree.Right.Kind is

                    when Feuille.Chaine =>
                        Text_Io.Put_Line (Bounded_String.Image
                                             (Tree.Right.Phrase));
                        Success := True;
                    when Feuille.Iter | Feuille.Piece_Courante |
                         Feuille.Hero | Feuille.Pnj | Feuille.Objet =>
                        Consulte (Tree.Right, Iteratt, Ok);
                        Text_Io.Put_Line
                           (Bounded_String.Image
                               (Struct_Component.Liste_Attribut.Cellvalue
                                   (Iteratt).Data.The_String));
                        Success := True;  
                    when others =>
                        raise Dire_Error;
                end case;

            when Feuille.Termine =>
                Text_Io.Put_Line ("Le jeu est termine.");
                Success := True;
                raise Jeu_Termine;
            when others =>
                raise Illegal_Expression;
        end case;
    end Evalue;

--- affecte un vaut
    procedure Affecte (Tree : in Pcell; Success : in out Boolean) is
        Iteratt : Struct_Component.Liste_Attribut.Listiter;
        Attrib : Struct_Component.Attribut;
        Iteratt2 : Struct_Component.Liste_Attribut.Listiter;
        Attrib2 : Struct_Component.Attribut;
        Iterstruc : Struct_Component.Liste_Structure.Listiter;
        Iterstruc2 : Struct_Component.Liste_Structure.Listiter;
        Struc : Struct_Component.Structure;
        Ok : Boolean := True;
        A_Bool : Boolean := True;
        A_Nbr : Natural := 0;
        A_Str : String_Table.I_String;
        Oper : Feuille.Tcell;
        use Feuille;
    begin
        Bounded_String.Copy (A_Str, "");
        Iterstruc := Pieces.Piece_Courante;
        Iteratt :=
           Struct_Component.Liste_Attribut.Makelistiter
              (Struct_Component.Liste_Structure.Cellvalue (Iterstruc).Attribut);
        Iteratt2 :=
           Struct_Component.Liste_Attribut.Makelistiter
              (Struct_Component.Liste_Structure.Cellvalue (Iterstruc).Attribut);
        Iterstruc2 := Pieces.Piece_Courante;
        --Text_Io.Put_Line (">>>> J' effectue un vaut");
        case Tree.Left.Kind is
            when Iter =>
                Consulte (Tree.Left, Iteratt, Ok);
                Attrib := Struct_Component.Liste_Attribut.Cellvalue (Iteratt);
                --Text_Io.Put_Line ("-- attribut : " &
                --                  Bounded_String.Image (Attrib.Name) &
                --                  " va contenir : ");
                case Tree.Right.Kind is
                    when Iter =>
                        Consulte (Tree.Right, Iteratt2, Ok);
                        --Text_Io.Put_Line
                        --   (Bounded_String.Image
                        --       (Struct_Component.Get_Name (Iteratt2)));
                        if Ok then
                            Struct_Component.Liste_Attribut.Modify
                               (Iteratt, Struct_Component.
                                            Liste_Attribut.Cellvalue
                                            (Iteratt2));
                            Success := True;
                        end if;
                    when Iter_S =>
                        Consulte (Tree.Right, Iterstruc, Ok);
                        --Text_Io.Put_Line
                        --   ("la structure : " &
                        --    Bounded_String.Image
                        --       (Struct_Component.Get_Name (Iterstruc)));
                        if Ok then
                            Struct_Component.Set_Value
                               (Attrib, Struct_Component.Get_Name (Iterstruc));
                            Struct_Component.Liste_Attribut.Modify
                               (Iteratt, Attrib);
                            Success := True;
                        else
                            Success := False;
                        end if;
                    when Piece_Courante | Objet | Hero | Pnj =>
                        if Bounded_String.Image (Tree.Right.Idattrib) = "" then
                            Consulte (Tree.Right, Iterstruc, Ok);
                            Attrib := Struct_Component.Liste_Attribut.Cellvalue
                                         (Iteratt);
                            Struct_Component.Copy
                               (Attrib.Data, Struct_Component.Set_String
                                                (Attrib.Data.Name,
                                                 Struct_Component.Get_Name
                                                    (Iterstruc)));
                            Struct_Component.Liste_Attribut.Modify
                               (Iteratt, Attrib);
                            Success := True;
                        else
                            Consulte (Tree.Right, Iteratt2, Ok);
                            Struct_Component.Liste_Attribut.Modify
                               (Iteratt, Struct_Component.
                                            Liste_Attribut.Cellvalue
                                            (Iteratt2));
                            Success := True;
                        end if;
                    when Booleen =>
                        --Text_Io.Put_Line ("Je lis un Booleen");
                        Consulte (Tree.Right, A_Bool, Ok);
                        --Text_Io.Put_Line ("Lecture Ok.");
                        if Ok then
                            Struct_Component.Set_Value (Attrib, A_Bool);
                            Struct_Component.Liste_Attribut.Modify
                               (Iteratt, Attrib);
                            Success := True;
                        else
                            Success := False;
                        end if;
                    when Entier =>
                        --Text_Io.Put_Line ("---- Je lis un entier");
                        Consulte (Tree.Right, A_Nbr, Ok);
                        --Text_Io.Put_Line ("Lecture Ok.");
                        if Ok then
                            Struct_Component.Set_Value (Attrib, A_Nbr);
                            Struct_Component.Liste_Attribut.Modify
                               (Iteratt, Attrib);
                            Success := True;  
                        else
                            Success := False;
                        end if;
                    when Chaine | Enum =>
                        Consulte (Tree.Right, A_Str, Ok);
                        if Ok then
                            if Tree.Right.Kind = Enum then
                                if String_Table.Int_List.Isinlist
                                      (Attrib.Data.List_Of_Enum, A_Str) then
                                    Struct_Component.Set_Value (Attrib, A_Str);
                                    Struct_Component.Liste_Attribut.Modify
                                       (Iteratt, Attrib);
                                    Success := True;
                                else
                                    raise Illegal_Assignement;
                                end if;
                            else
                                Struct_Component.Set_Value (Attrib, A_Str);
                                Struct_Component.Liste_Attribut.Modify
                                   (Iteratt, Attrib);
                                Success := True;
                            end if;
                        else
                            Success := False;
                        end if;
                    when Plus | Moins | Div | Fois =>
                        --Text_Io.Put_Line ("--- je lis une operation ");
                        Consulte (Tree.Right, Oper, A_Nbr, Ok);
                        --Text_Io.Put_Line ("valeur : " & Tcell'Image (Oper));
                        --Text_Io.Put_Line (" avec : " & Natural'Image (A_Nbr));
                        if Ok then
                            Success := True;
                            case Oper is
                                when Plus =>
                                    Struct_Component.Set_Value
                                       (Attrib,
                                        Struct_Component.Get_Value (Iteratt) +
                                           A_Nbr);
                                when Moins =>
                                    Struct_Component.Set_Value
                                       (Attrib,
                                        Struct_Component.Get_Value (Iteratt) -
                                           A_Nbr);
                                when Fois =>
                                    Struct_Component.Set_Value
                                       (Attrib,
                                        Struct_Component.Get_Value (Iteratt) *
                                           A_Nbr);
                                when Div =>
                                    Struct_Component.Set_Value
                                       (Attrib,
                                        Struct_Component.Get_Value (Iteratt) /
                                           A_Nbr);
                                when others =>
                                    Success := False;
                            end case;
                            if Success then
                                Struct_Component.Liste_Attribut.Modify
                                   (Iteratt, Attrib);
                            else
                                raise Illegal_Operator;
                            end if;
                        else
                            raise Illegal_Assignement;
                        end if;
                    when others =>
                        Success := False;
                end case;
            when Piece_Courante | Pnj | Hero | Objet =>
                if Bounded_String.Image (Tree.Left.Idattrib) = "" then
                    Consulte (Tree.Left, Iterstruc, Ok);
                    Consulte (Tree.Right, Iterstruc2, Ok);
                    if Ok then
                        Struct_Component.Is_Inside
                           (Bounded_String.Image
                               (Struct_Component.Get_Name (Iterstruc2)),
                            Pieces.Liste, Pieces.Piece_Courante, Ok);  
                        if Ok then
                            Success := True;
                        else
                            raise Illegal_Assignement;
                        end if;
                    else
                        Consulte (Tree.Right, Iteratt, Ok);
                        if Ok then
                            Struct_Component.Is_Inside
                               (Bounded_String.Image
                                   (Struct_Component.Get_Value (Iteratt)),
                                Pieces.Liste, Pieces.Piece_Courante, Ok);  
                            if Ok then
                                Success := True;
                            else
                                raise Illegal_Assignement;
                            end if;
                        else
                            raise Illegal_Assignement;
                        end if;
                    end if;
                else
                    --Text_Io.Put_Line (" === Je consulte un attrib a gauche ");
                    Consulte (Tree.Left, Iteratt, Ok);
                    Attrib := Struct_Component.Liste_Attribut.Cellvalue
                                 (Iteratt);
                    --Text_Io.Put_Line ("-- attribut : " &
                    --                  Bounded_String.Image (Attrib.Name) &
                    --                  " va contenir : ");
                    case Tree.Right.Kind is
                        when Iter =>
                            Consulte (Tree.Right, Iteratt2, Ok);
                            --Text_Io.Put_Line
                            --   (Bounded_String.Image
                            --       (Struct_Component.Get_Name (Iteratt2)));
                            if Ok then
                                Struct_Component.Liste_Attribut.Modify
                                   (Iteratt, Struct_Component.
                                                Liste_Attribut.Cellvalue
                                                (Iteratt2));
                                Success := True;
                            end if;
                        when Iter_S =>
                            Consulte (Tree.Right, Iterstruc, Ok);
                            --Text_Io.Put_Line
                            --   ("la structure : " &
                            --    Bounded_String.Image
                            --       (Struct_Component.Get_Name (Iterstruc)));
                            if Ok then
                                Struct_Component.Set_Value
                                   (Attrib, Struct_Component.Get_Name
                                               (Iterstruc));
                                Struct_Component.Liste_Attribut.Modify
                                   (Iteratt, Attrib);
                                Success := True;
                            else
                                Success := False;
                            end if;
                        when Piece_Courante | Objet | Hero | Pnj =>
                            if Bounded_String.Image (Tree.Right.Idattrib) =
                               "" then
                                --Text_Io.Put_Line (" affectation a une struc ");
                                Consulte (Tree.Right, Iterstruc, Ok);
                                Attrib := Struct_Component.
                                             Liste_Attribut.Cellvalue (Iteratt);
                                Struct_Component.Copy
                                   (Attrib.Data, Struct_Component.Set_String
                                                    (Attrib.Data.Name,
                                                     Struct_Component.Get_Name
                                                        (Iterstruc)));
                                Struct_Component.Liste_Attribut.Modify
                                   (Iteratt, Attrib);
                                Success := True;
                            else  
                                --Text_Io.Put_Line (" affectation a un attrib ");
                                Consulte (Tree.Right, Iteratt2, Ok);
                                Struct_Component.Liste_Attribut.Modify
                                   (Iteratt, Struct_Component.
                                                Liste_Attribut.Cellvalue
                                                (Iteratt2));
                                Success := True;
                            end if;
                        when Booleen =>
                            --Text_Io.Put_Line ("Je lis un Booleen");
                            Consulte (Tree.Right, A_Bool, Ok);
                            --Text_Io.Put_Line ("Lecture Ok.");
                            if Ok then
                                Struct_Component.Set_Value (Attrib, A_Bool);
                                Struct_Component.Liste_Attribut.Modify
                                   (Iteratt, Attrib);
                                Success := True;
                            else
                                Success := False;
                            end if;
                        when Entier =>
                            --Text_Io.Put_Line ("---- Je lis un entier");
                            Consulte (Tree.Right, A_Nbr, Ok);
                            --Text_Io.Put_Line ("Lecture Ok.");
                            if Ok then
                                Struct_Component.Set_Value (Attrib, A_Nbr);
                                Struct_Component.Liste_Attribut.Modify
                                   (Iteratt, Attrib);
                                Success := True;  
                            else
                                Success := False;
                            end if;
                        when Chaine | Enum =>
                            Consulte (Tree.Right, A_Str, Ok);
                            if Ok then
                                if Tree.Right.Kind = Enum then
                                    if String_Table.Int_List.Isinlist
                                          (Attrib.Data.List_Of_Enum, A_Str) then
                                        Struct_Component.Set_Value
                                           (Attrib, A_Str);
                                        Struct_Component.Liste_Attribut.Modify
                                           (Iteratt, Attrib);
                                        Success := True;
                                    else
                                        raise Illegal_Assignement;
                                    end if;
                                else
                                    Struct_Component.Set_Value (Attrib, A_Str);
                                    Struct_Component.Liste_Attribut.Modify
                                       (Iteratt, Attrib);
                                    Success := True;
                                end if;
                            else
                                Success := False;
                            end if;
                        when Plus | Moins | Div | Fois =>
                            --Text_Io.Put_Line ("--- je lis une operation ");
                            Consulte (Tree.Right, Oper, A_Nbr, Ok);
                            --Text_Io.Put_Line ("valeur : " & Tcell'Image (Oper));
                            --Text_Io.Put_Line (" avec : " &
                            --                  Natural'Image (A_Nbr));
                            if Ok then
                                Success := True;
                                case Oper is
                                    when Plus =>
                                        Struct_Component.Set_Value
                                           (Attrib, Struct_Component.Get_Value
                                                       (Iteratt) + A_Nbr);
                                    when Moins =>
                                        Struct_Component.Set_Value
                                           (Attrib, Struct_Component.Get_Value
                                                       (Iteratt) - A_Nbr);
                                    when Fois =>
                                        Struct_Component.Set_Value
                                           (Attrib, Struct_Component.Get_Value
                                                       (Iteratt) * A_Nbr);
                                    when Div =>
                                        Struct_Component.Set_Value
                                           (Attrib, Struct_Component.Get_Value
                                                       (Iteratt) / A_Nbr);
                                    when others =>
                                        Success := False;
                                end case;
                                if Success then
                                    Struct_Component.Liste_Attribut.Modify
                                       (Iteratt, Attrib);
                                else
                                    raise Illegal_Operator;
                                end if;
                            else
                                raise Illegal_Assignement;
                            end if;
                        when others =>
                            Success := False;
                    end case;
                end if;
            when others =>
                raise Illegal_Assignement;
        end case;
    end Affecte;

--- retourne element ( iterateur sur un attribut)
    procedure Consulte
                 (Tree : in Pcell;
                  Iteratt : in out Struct_Component.Liste_Attribut.Listiter;
                  Success : in out Boolean) is
        Tmp_String : String_Table.I_String;  
        use Feuille;
    begin
        if Tree.Kind /= Iter then
            if Bounded_String.Image (Tree.Idattrib) = "" then
                Success := False;
            else
                case Tree.Kind is
                    when Objet | Hero | Pnj | Piece_Courante =>
                        Bounded_String.Copy (Tmp_String, Tree.Idattrib);
                        case Tree.Kind is
                            when Piece_Courante =>
                                Struct_Component.Is_Inside
                                   (Bounded_String.Image (Tmp_String),
                                    Struct_Component.Get_Value
                                       (Pieces.Piece_Courante),
                                    Iteratt, Success);
                            when Hero =>
                                Struct_Component.Is_Inside
                                   (Bounded_String.Image (Tmp_String),
                                    Struct_Component.Get_Value (Pnjs.Hero),
                                    Iteratt, Success);  
                            when Objet =>
                                Struct_Component.Is_Inside
                                   (Bounded_String.Image (Tmp_String),
                                    Struct_Component.Get_Value
                                       (Objets.Objet_Courant),
                                    Iteratt, Success);
                            when Pnj =>
                                Struct_Component.Is_Inside
                                   (Bounded_String.Image (Tmp_String),
                                    Struct_Component.Get_Value
                                       (Pnjs.Pnj_Courant), Iteratt, Success);
                            when others =>
                                Success := False;  
                        end case;
                    when others =>
                        --Text_Io.Put_Line (" Ce n'est pas un attrib.");
                        Iteratt := Struct_Component.Liste_Attribut.Makelistiter
                                      (Struct_Component.
                                       Liste_Structure.Cellvalue
                                          (Pieces.Piece_Courante).Attribut);
                        Success := False;
                end case;
            end if;
        else
            Iteratt := Tree.Aiter;
            Success := True;
        end if;
    end Consulte;

--- retourne element_Global ou ident
    procedure Consulte
                 (Tree : in Pcell;
                  Iterstruc : in out Struct_Component.Liste_Structure.Listiter;
                  Success : in out Boolean) is
        use Feuille;
    begin
        Success := True;
        case Tree.Kind is
            when Iter_S =>
                Iterstruc := Tree.Aiter_S;
            when Piece_Courante =>
                Iterstruc := Pieces.Piece_Courante;
            when Hero =>
                Iterstruc := Pnjs.Hero;
            when Pnj =>
                Iterstruc := Pnjs.Pnj_Courant;
            when Objet =>
                Iterstruc := Objets.Objet_Courant;
            when others =>
                Success := False;
        end case;
    end Consulte;

--- retourne un booleen
    procedure Consulte (Tree : Pcell;
                        A_Bool : in out Boolean;
                        Success : in out Boolean) is
        use Feuille;
    begin
        Success := True;
        case Tree.Kind is
            when Booleen =>
                A_Bool := Tree.Bool;
            when others =>
                Success := False;
        end case;
    end Consulte;

--- retourne un entier
    procedure Consulte (Tree : Pcell;
                        A_Nbr : in out Natural;
                        Success : in out Boolean) is
        use Feuille;
    begin
        if Tree.Kind = Entier then
            A_Nbr := Tree.Nbr;
            Success := True;
        else
            Success := False;
        end if;
    end Consulte;

--- retourne une chaine ou un enum
    procedure Consulte (Tree : Pcell;
                        A_Str : in out String_Table.I_String;
                        Success : in out Boolean) is
        use Feuille;
    begin
        if Tree.Kind = Chaine then
            A_Str := Tree.Phrase;
            Success := True;
        else
            if Tree.Kind = Enum then
                A_Str := Tree.Idattrib;
                Success := True;
            else
                Success := False;
            end if;
        end if;
    end Consulte;

--- retourne operateur plus valeur
    procedure Consulte (Tree : in Pcell;
                        Op : in out Tcell;
                        Nbr : in out Natural;
                        Success : in out Boolean) is
        use Feuille;
    begin  
        case Tree.Kind is
            when Plus | Moins | Fois | Div =>
                Consulte (Tree.Right, Nbr, Success);
                if Success then
                    Op := Tree.Kind;
                end if;
            when others =>
                Success := False;
        end case;
    end Consulte;

end Motor;

E3 Meta Data

    nblk1=32
    nid=25
    hdr6=60
        [0x00] rec0=17 rec1=00 rec2=01 rec3=020
        [0x01] rec0=1a rec1=00 rec2=0a rec3=03e
        [0x02] rec0=00 rec1=00 rec2=22 rec3=01c
        [0x03] rec0=18 rec1=00 rec2=06 rec3=012
        [0x04] rec0=1b rec1=00 rec2=12 rec3=00e
        [0x05] rec0=12 rec1=00 rec2=1e rec3=040
        [0x06] rec0=11 rec1=00 rec2=1a rec3=08e
        [0x07] rec0=14 rec1=00 rec2=19 rec3=016
        [0x08] rec0=10 rec1=00 rec2=1b rec3=062
        [0x09] rec0=17 rec1=00 rec2=2d rec3=070
        [0x0a] rec0=15 rec1=00 rec2=2c rec3=022
        [0x0b] rec0=0f rec1=00 rec2=27 rec3=06c
        [0x0c] rec0=0f rec1=00 rec2=18 rec3=040
        [0x0d] rec0=12 rec1=00 rec2=13 rec3=044
        [0x0e] rec0=14 rec1=00 rec2=21 rec3=008
        [0x0f] rec0=19 rec1=00 rec2=10 rec3=03e
        [0x10] rec0=18 rec1=00 rec2=15 rec3=042
        [0x11] rec0=16 rec1=00 rec2=1d rec3=042
        [0x12] rec0=02 rec1=00 rec2=0b rec3=020
        [0x13] rec0=12 rec1=00 rec2=23 rec3=04c
        [0x14] rec0=13 rec1=00 rec2=20 rec3=052
        [0x15] rec0=00 rec1=00 rec2=09 rec3=028
        [0x16] rec0=11 rec1=00 rec2=0c rec3=00c
        [0x17] rec0=13 rec1=00 rec2=17 rec3=068
        [0x18] rec0=00 rec1=00 rec2=02 rec3=00c
        [0x19] rec0=12 rec1=00 rec2=07 rec3=070
        [0x1a] rec0=13 rec1=00 rec2=16 rec3=042
        [0x1b] rec0=00 rec1=00 rec2=24 rec3=008
        [0x1c] rec0=12 rec1=00 rec2=2b rec3=008
        [0x1d] rec0=14 rec1=00 rec2=2a rec3=01e
        [0x1e] rec0=13 rec1=00 rec2=28 rec3=05a
        [0x1f] rec0=14 rec1=00 rec2=11 rec3=04e
        [0x20] rec0=11 rec1=00 rec2=30 rec3=072
        [0x21] rec0=11 rec1=00 rec2=2f rec3=012
        [0x22] rec0=10 rec1=00 rec2=2e rec3=028
        [0x23] rec0=11 rec1=00 rec2=1c rec3=056
        [0x24] rec0=01 rec1=00 rec2=26 rec3=004
        [0x25] rec0=11 rec1=00 rec2=1f rec3=044
        [0x26] rec0=11 rec1=00 rec2=05 rec3=030
        [0x27] rec0=00 rec1=00 rec2=31 rec3=00c
        [0x28] rec0=10 rec1=00 rec2=14 rec3=02e
        [0x29] rec0=14 rec1=00 rec2=29 rec3=020
        [0x2a] rec0=17 rec1=00 rec2=08 rec3=074
        [0x2b] rec0=11 rec1=00 rec2=0d rec3=040
        [0x2c] rec0=17 rec1=00 rec2=04 rec3=066
        [0x2d] rec0=1c rec1=00 rec2=32 rec3=016
        [0x2e] rec0=21 rec1=00 rec2=03 rec3=04e
        [0x2f] rec0=1c rec1=00 rec2=0e rec3=000
        [0x30] rec0=1c rec1=00 rec2=0e rec3=000
        [0x31] rec0=00 rec1=04 rec2=00 rec3=000
    tail 0x2174d161a865a7bdb7b12 0x42a00088462060003
Free Block Chain:
  0x25: 0000  00 0f 00 4d 80 1a 20 20 20 20 20 20 20 20 20 20  ┆   M            ┆
  0xf: 0000  00 00 00 0b 80 08 20 20 20 20 20 20 20 20 08 64  ┆               d┆