|
|
DataMuseum.dkPresents historical artifacts from the history of: Rational R1000/400 |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about Rational R1000/400 Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - download
Length: 10363 (0x287b)
Types: TextFile
Notes: R1k Text-file segment
└─⟦8527c1e9b⟧ Bits:30000544 8mm tape, Rational 1000, Arrival backup of disks in PAM's R1000
└─⟦cfc2e13cd⟧ »Space Info Vol 2«
└─⟦aae25d2a3⟧
└─⟦this⟧
with Feuille;
-- 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;
A_Bool : Boolean;
N_Nbr : Natural;
A_str : String_Table.I_String;
begin
case Tree.Kind is
when egal =>
success := false;
consulte(Tree.Left,Iteratt,ok);
if not ok then
raise Illegal_Test;
else
Attrib := Struct_Component.Liste_Attribut.CellValue(Iteratt);
Consulte(Tree.Right,Iterstruc,ok);
if ok then
Struc := Struct_Component.Liste_Structure.CellValue(Itersrtuc);
if Bounded_String.Image(Struct_Component.Get_Value(Attrib))=
Bounded_String.Image(Struc.Name) then Success = true;
else
success = False;
end if;
else
Consulte(Tree.Right,A_Bool,ok);
if ok then
if Struct_Component.Get_Value(Attrib) = A_Bool then
Success := True;
else
Success := False;
end if;
else
Consulte(Tree.Right,A_Nbr,ok);
if ok then
if Struct_Component.Get_Value(Attrib) = A_Nbr then
Success := True;
else
Success := False;
end if;
else
Consulte(Tree.Right,A_Str,ok);
if ok then
if Bounded_String.Image(Struct_Component.Get_Value(Attrib))=
Bounded_String.Image(A_Str) then Success = true;
else
success = False;
end if;
else
raise illegal_Test;
end if;
end if;
end if;
end if;
end if;
when Et => evalue(Tree.left,ok);
if ok then
evalue(Tree.Left,ok);
if ok then
success := true;
else
success := false;
end if;
else
success := False;
end if;
when verbe => null;
when vaut => Affecte(Tree,Success);
when alors => Evalue(Tree.Left,ok);
if ok then
Execute(Tree.Right);
Success := True;
else
Success := False;
end if;
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;
Struc : Struct_Component.Structure;
ok : boolean;
A_Bool : Boolean;
N_Nbr : Natural;
A_str : String_Table.I_String;
begin
Consulte(Tree.Left,iteratt,ok);
if ok then
Attrib := Struct_Component.Get_Value(Iteratt);
Consulte(Tree.Right,iteratt2,ok);
if ok then
Struct_Component.Liste_Attribut.Modify(iteratt,Struct_Component.Get_Value(Iteratt2));
Success := true;
else
Consulte(Tree.Right,Iterstruc,ok);
if ok then
Struct_Component.Set_Value(Attrib,Struct_Component.Get_Name(Iterstruc));
Struct_Component.Modify(Iteratt,Attrib);
Success := True;
else
Consulte(Tree.Right,A_Bool,ok);
if ok then
Struct_Component.Set_Value(Attrib,A_Bool);
Struct_Component.Modify(Iteratt,Attrib);
Success := True;
else
Consulte(Tree.Right,A_Nbr,ok);
if ok then
Struct_Component.Set_Value(Attrib,A_Nbr);
Struct_Component.Modify(Iteratt,Attrib);
Success := True;
else
Consulte(Tree.Right,A_Str,ok);
if ok then
if Tree.Right.Kind = Enum then
if String_Table.Int_List.Isinside(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
Consulte(Tree.Right,oper,nbr,ok);
if ok then
Success := True;
case oper is
when plus =>
Struct_Component.Set_Value(attrib,Struct_Component.Get_Value(Attrib)+nbr);
when moins =>
Struct_Component.Set_Value(attrib,Struct_Component.Get_Value(Attrib)-nbr);
when mult =>
Struct_Component.Set_Value(attrib,Struct_Component.Get_Value(Attrib)*nbr);
when div =>
Struct_Component.Set_Value(attrib,Struct_Component.Get_Value(Attrib)/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;
end if;
end if;
end if;
end if;
end if;
else
Consulte(Tree.Left,Iterstruc,ok);
if ok then
if Tree.Left.Kind = Piece_Courante then
Consulte(Tree.Left,IterStruc2,ok);
if ok then
Struct_Component.Is_inside(Bounded_String.Image(Struct_Component.Get_Name(IterStruct2),Pieces.Liste,Piece.Piece_Courante,ok);
if ok then
Success := True;
else
raise Illegal_Assignement;
end if;
else
Consulte(Tree.Left,IterAtt,ok);
if ok then
Struct_Component.Is_inside(Bounded_String.Image(Struct_Component.Get_Value(IterAtt),Pieces.Liste,Piece.Piece_Courante,ok);
if ok then
success := true;
else
raise illegal_Assignement;
end if;
else
raise Illegal_Assignement;
end if;
end if;
else
raise Illegal_Assignement;
end if;
else
raise illegal_Assignement;
end if;
end if;
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);
Tmp_String : String_Table.I_String;
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.Liste_Attribut.CellValue(Pieces.Piece_Courante).Attribut),iterAttrib,Success);
when Hero =>
Struct_Component.Is_Inside(Bounded_String.Image(Tmp_String),
Struct_Component.Liste_Attribut.CellValue(Pnjs.Hero).Attribut),iterAttrib,Success);
when Objet =>
Struct_Component.Is_Inside(Bounded_String.Image(Tmp_String),
Struct_Component.Liste_Attribut.CellValue(Objets.Objet_Courant).Attribut),iterAttrib,Success);
when Pnj =>
Struct_Component.Is_Inside(Bounded_String.Image(Tmp_String),
Struct_Component.Liste_Attribut.CellValue(Pnjs.Pnj_Courant).Attribut),iterAttrib,Success);
when others => success := false;
end case;
when others => 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
begin
success := True;
if tree.kind := Iter_s then
IterStruc := Tree.AIter_s;
else
case Tree.kind is
when Piece_Courante => iterstruc := Pieces.Piece_Courante;
when hero => iterStruc := Pnjs.Hero;
when Pnj => iterStruc := Pnjs.Pnjs_Courant;
when Objet => iterStruc := Objets.Objet_Courant;
when Direction => IterStruc := Directions.Direction_Courante;
when others => Success := False;
end case;
end if
end consulte;
--- retourne un booleen
Procedure Consulte(Tree : Pcell; A_Bool : in out Boolean; Success : In out Boolean) is
begin
if tree.Kind = Bool then
A_Bool := Tree.Booleen;
Success := true;
else
Success := False;
end if;
end Consulte;
--- retourne un entier
Procedure Consulte(Tree : Pcell; A_Nbr : in out Natural; Success : In out Boolean) is
begin
if tree.Kind = Number 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
begin
if ((tree.Kind = chaine) or (Tree.Kind = enum ))then
A_Str := Tree.IdAttrib;
Success := true;
else
Success := False;
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
begin
case tree.Kind is
when plus,moins,div,mult =>
Consulte(Tree.Right,Nbr,success);
if Success then
op := tree.Kind;
end if;
when others => success := False;
end case;
end consulte