DataMuseum.dkPresents historical artifacts from the history of: Rational R1000/400 Tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about Rational R1000/400 Tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - downloadIndex: ┃ B T ┃
Length: 12778 (0x31ea) Types: TextFile Names: »B«
└─⟦a7d1ea751⟧ Bits:30000550 8mm tape, Rational 1000, !users!projects 94_04_11 └─ ⟦129cab021⟧ »DATA« └─⟦this⟧
with Text_Io; with Object; with Error_Broadcaster; with Bounded_String; with String_Utilities; with Elementary_Functions; package body Turtle_Class is type Unary_Message is (Tonx, Tony, Tonangle, Entexte, Rentrecheztoi, Clone, Baissetaplume, Levetaplume); -- iterateur de la classe turtle_class procedure Init (Iter : out Iterator; Coll : in Collection) is begin Iter := Iterator'First; end Init; procedure Next (Iter : in out Iterator) is begin Iter := Iter + 1; end Next; function Done (Iter : in Iterator) return Boolean is begin return (Iterator'Last = Iter); end Done; function Value (Iter : in Iterator) return Index is begin return Iter; end Value; function Clone (To_Object : Object.Reference) return Object.Reference is begin Next (Turtle_Collection.Iter); Turtle_Collection.Table (Turtle_Collection.Iter) := Turtle_Collection.Table (To_Object.Identity); return (Object.Tiny_Turtle, Turtle_Collection.Iter); end Clone; function Entexte (To_Object : Object.Reference) return String is begin return ("Tortue numero:" & String_Utilities.Number_To_String (To_Object.Identity, 10, 2) & " Ma Position:" & String_Utilities.Number_To_String (Turtle_Collection.Table (To_Object.Identity).X, 10, 4) & "," & String_Utilities.Number_To_String (Turtle_Collection.Table (To_Object.Identity).Y, 10, 4) & " Mon Angle:" & String_Utilities.Number_To_String (Turtle_Collection.Table (To_Object.Identity).Angle, 10, 3) & " Ma Taille:" & String_Utilities.Number_To_String (Turtle_Collection.Table (To_Object.Identity).Draw_Size, 10, 2)); end Entexte; function Send (To_Object : Object.Reference; The_Message : Object.Message) return String is Message : Unary_Message; Obj : Object.Reference; My_Turtle : Turtle; begin Message := Unary_Message'Value (Bounded_String.Image (The_Message)); Obj := To_Object; case Message is when Tonx | Tony | Tonangle | Clone | Rentrecheztoi | Baissetaplume | Levetaplume => return (""); when Entexte => return Entexte (To_Object); end case; end Send; function Send (To_Object : Object.Reference; The_Message : Object.Message) return Object.Reference is Message : Unary_Message; Obj : Object.Reference; My_Turtle : Turtle; begin Message := Unary_Message'Value (Bounded_String.Image (The_Message)); Obj := To_Object; case Message is when Tonx => Obj.Identity := Turtle_Collection.Table (To_Object.Identity).X; Obj.Class := Object.Tiny_Integer; when Tony => Obj.Identity := Turtle_Collection.Table (To_Object.Identity).Y; Obj.Class := Object.Tiny_Integer; when Tonangle => Obj.Identity := Turtle_Collection.Table (To_Object.Identity).Angle; Obj.Class := Object.Tiny_Integer; when Entexte => Obj.Identity := To_Object.Identity; Obj.Class := Object.Tiny_Turtle; when Rentrecheztoi => Turtle_Collection.Table (To_Object.Identity).X := 0; Turtle_Collection.Table (To_Object.Identity).Y := 0; Graphic_Object.Move (Turtle_Collection.Table (To_Object.Identity).X, Turtle_Collection.Table (To_Object.Identity).Y); when Baissetaplume => Turtle_Collection.Table (To_Object.Identity).Marker_Up := False; when Levetaplume => Turtle_Collection.Table (To_Object.Identity).Marker_Up := True; when Clone => Obj := Clone (To_Object); end case; return Obj; exception when Constraint_Error => raise Error_Broadcaster.Unknown_Unary_Message; end Send; function Send (To_Object : Object.Reference; The_Argument : Object.Parameters.List) return Object.Reference is Message : Object.Message; Obj : Object.Reference; My_Turtle : Turtle; Local_Argument : Object.Parameters.List := The_Argument; begin if String_Utilities.Equal (Bounded_String.Image (Object.Parameters.Selector (Local_Argument)), "vaEnX:", True) then Graphic_Object.Move (Turtle_Collection.Table (To_Object.Identity).X, Turtle_Collection.Table (To_Object.Identity).Y); Object.Parameters.Get (Local_Argument, Obj); Turtle_Collection.Table (To_Object.Identity).X := Obj.Identity; if Turtle_Collection.Table (To_Object.Identity).Marker_Up then Graphic_Object.Move (Turtle_Collection.Table (To_Object.Identity).X, Turtle_Collection.Table (To_Object.Identity).Y); else Graphic_Object.Set_Pen (Turtle_Collection.Table (To_Object.Identity).Draw_Size); Graphic_Object.Draw (Turtle_Collection.Table (To_Object.Identity).X, Turtle_Collection.Table (To_Object.Identity).Y); end if; elsif String_Utilities.Equal (Bounded_String.Image (Object.Parameters.Selector (Local_Argument)), "vaEnY:", True) then Graphic_Object.Move (Turtle_Collection.Table (To_Object.Identity).X, Turtle_Collection.Table (To_Object.Identity).Y); Object.Parameters.Get (Local_Argument, Obj); Turtle_Collection.Table (To_Object.Identity).Y := Obj.Identity; if Turtle_Collection.Table (To_Object.Identity).Marker_Up then Graphic_Object.Move (Turtle_Collection.Table (To_Object.Identity).X, Turtle_Collection.Table (To_Object.Identity).Y); else Graphic_Object.Set_Pen (Turtle_Collection.Table (To_Object.Identity).Draw_Size); Graphic_Object.Draw (Turtle_Collection.Table (To_Object.Identity).X, Turtle_Collection.Table (To_Object.Identity).Y); end if; elsif String_Utilities.Equal (Bounded_String.Image (Object.Parameters.Selector (Local_Argument)), "tonX:Y:", True) then Object.Parameters.Get (Local_Argument, Obj); Turtle_Collection.Table (To_Object.Identity).X := Obj.Identity; Object.Parameters.Get (Local_Argument, Obj); Turtle_Collection.Table (To_Object.Identity).Y := Obj.Identity; Graphic_Object.Move (Turtle_Collection.Table (To_Object.Identity).X, Turtle_Collection.Table (To_Object.Identity).Y); elsif String_Utilities.Equal (Bounded_String.Image (Object.Parameters.Selector (Local_Argument)), "vaEnX:Y:", True) then Graphic_Object.Move (Turtle_Collection.Table (To_Object.Identity).X, Turtle_Collection.Table (To_Object.Identity).Y); Object.Parameters.Get (Local_Argument, Obj); Turtle_Collection.Table (To_Object.Identity).X := Obj.Identity; Object.Parameters.Get (Local_Argument, Obj); Turtle_Collection.Table (To_Object.Identity).Y := Obj.Identity; if Turtle_Collection.Table (To_Object.Identity).Marker_Up then Graphic_Object.Move (Turtle_Collection.Table (To_Object.Identity).X, Turtle_Collection.Table (To_Object.Identity).Y); else Graphic_Object.Set_Pen (Turtle_Collection.Table (To_Object.Identity).Draw_Size); Graphic_Object.Draw (Turtle_Collection.Table (To_Object.Identity).X, Turtle_Collection.Table (To_Object.Identity).Y); end if; elsif String_Utilities.Equal (Bounded_String.Image (Object.Parameters.Selector (Local_Argument)), "aDroite:", True) then Object.Parameters.Get (Local_Argument, Obj); Turtle_Collection.Table (To_Object.Identity).Angle := (Turtle_Collection.Table (To_Object.Identity).Angle - Obj.Identity) mod 360; elsif String_Utilities.Equal (Bounded_String.Image (Object.Parameters.Selector (Local_Argument)), "aGauche:", True) then Object.Parameters.Get (Local_Argument, Obj); Turtle_Collection.Table (To_Object.Identity).Angle := (Turtle_Collection.Table (To_Object.Identity).Angle + Obj.Identity) mod 360; elsif String_Utilities.Equal (Bounded_String.Image (Object.Parameters.Selector (Local_Argument)), "avance:", True) then Graphic_Object.Move (Turtle_Collection.Table (To_Object.Identity).X, Turtle_Collection.Table (To_Object.Identity).Y); Object.Parameters.Get (Local_Argument, Obj); Turtle_Collection.Table (To_Object.Identity).X := Turtle_Collection.Table (To_Object.Identity).X + (Integer (Elementary_Functions.Cos (3.1416 / 180.0 * Float (Turtle_Collection.Table (To_Object.Identity).Angle)) * Float (Obj.Identity))); Turtle_Collection.Table (To_Object.Identity).Y := Turtle_Collection.Table (To_Object.Identity).Y + (Integer (-Elementary_Functions.Sin (3.1416 / 180.0 * Float (Turtle_Collection.Table (To_Object.Identity).Angle)) * Float (Obj.Identity))); if Turtle_Collection.Table (To_Object.Identity).Marker_Up then Graphic_Object.Move (Turtle_Collection.Table (To_Object.Identity).X, Turtle_Collection.Table (To_Object.Identity).Y); else Graphic_Object.Set_Pen (Turtle_Collection.Table (To_Object.Identity).Draw_Size); Graphic_Object.Draw (Turtle_Collection.Table (To_Object.Identity).X, Turtle_Collection.Table (To_Object.Identity).Y); end if; elsif String_Utilities.Equal (Bounded_String.Image (Object.Parameters.Selector (Local_Argument)), "tonAngle:", True) then Object.Parameters.Get (Local_Argument, Obj); Turtle_Collection.Table (To_Object.Identity).Angle := Obj.Identity mod 360; elsif String_Utilities.Equal (Bounded_String.Image (Object.Parameters.Selector (Local_Argument)), "taTaille:", True) then Object.Parameters.Get (Local_Argument, Obj); Turtle_Collection.Table (To_Object.Identity).Draw_Size := Obj.Identity; else raise Error_Broadcaster.Unknown_Keyword_Message; end if; return Obj; end Send; end Turtle_Class;