|
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 - download
Length: 20480 (0x5000) Types: Ada Source Notes: 03_class, FILE, R1k_Segment, e3_tag, package body Pen_Class, seg_038842, seg_038a95, seg_038a9f
└─⟦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⟧
with Arguments; with Bounded_String; with Easy_X; with Message; with Msg_Report; with Object; with Scanner; with String_Class; with String_Utilities; package body Pen_Class is function Is_Equal_String (Str1 : String; Str2 : String; Ignore_Case : Boolean := True) return Boolean renames String_Utilities.Equal; function Bs_Image (Source : Scanner.B_String) return String renames Bounded_String.Image; procedure Bs_Copy (Target : in out Scanner.B_String; Source : String) renames Bounded_String.Copy; Max_Pen : constant Integer := 100; Pen_Table : array (1 .. Max_Pen) of Pen_Ref; -- initialisation de la table d'instance des stylos -- ================================================ procedure Init_Instance_Table is begin for Ref in Pen_Table'Range loop if Pen_Table (Ref).Indicator = Used then Pen_Table (Ref).Font := Small_Font; Pen_Table (Ref).X := 0; Pen_Table (Ref).Y := 0; end if; end loop; end Init_Instance_Table; -- creation d'un objet stylo -- ========================= function Create return Object.Reference is use Object; Found : Boolean := False; Value : Integer; begin for Ref in Pen_Table'Range loop if Pen_Table (Ref).Indicator = Unused then Found := True; Pen_Table (Ref).Indicator := Used; Value := Ref; exit; end if; end loop; if Found then return Object.Create (C_Pen, Value); else Msg_Report.Interpret_Error ("Pen instance table full, creation of a new object impossible"); raise Instance_Table_Full; end if; end Create; function Unary_Msg_X (The_Object : Object.Reference) return Object.Reference is use Object; Ref : Integer; begin Ref := Object.Identificator (The_Object); return Object.Create (C_Integer, Integer (Pen_Table (Ref).X)); end Unary_Msg_X; function Unary_Msg_Y (The_Object : Object.Reference) return Object.Reference is use Object; Ref : Integer; begin Ref := Object.Identificator (The_Object); return Object.Create (C_Integer, Integer (Pen_Table (Ref).Y)); end Unary_Msg_Y; function Unary_Msg_Font (The_Object : Object.Reference) return Object.Reference is Ref : Integer; Font_Value : Scanner.B_String; begin Ref := Object.Identificator (The_Object); case Pen_Table (Ref).Font is when Small_Font => Bs_Copy (Font_Value, "PetitePlume"); when Medium_Font => Bs_Copy (Font_Value, "MoyennePlume"); when Large_Font => Bs_Copy (Font_Value, "LargePlume"); end case; return String_Class.Create (Bs_Image (Font_Value)); end Unary_Msg_Font; function Unary_Msg_Small_Font (The_Object : Object.Reference) return Object.Reference is Ref : Integer; begin Ref := Object.Identificator (The_Object); Pen_Table (Ref).Font := Small_Font; Easy_X.Set_Font (Pen_Table (Ref).Font); return Object.Void_Reference; end Unary_Msg_Small_Font; function Unary_Msg_Medium_Font (The_Object : Object.Reference) return Object.Reference is Ref : Integer; begin Ref := Object.Identificator (The_Object); Pen_Table (Ref).Font := Medium_Font; Easy_X.Set_Font (Pen_Table (Ref).Font); return Object.Void_Reference; end Unary_Msg_Medium_Font; function Unary_Msg_Large_Font (The_Object : Object.Reference) return Object.Reference is Ref : Integer; begin Ref := Object.Identificator (The_Object); Pen_Table (Ref).Font := Large_Font; Easy_X.Set_Font (Pen_Table (Ref).Font); return Object.Void_Reference; end Unary_Msg_Large_Font; function Unary_Msg_Go_Home (The_Object : Object.Reference) return Object.Reference is Ref : Integer; begin Ref := Object.Identificator (The_Object); Pen_Table (Ref).X := 0; Pen_Table (Ref).Y := 0; Easy_X.Move_To (0, 0); return Object.Void_Reference; end Unary_Msg_Go_Home; function Unary_Msg_Copy (The_Object : Object.Reference) return Object.Reference is Ref, New_Ref : Integer; New_Object : Object.Reference; begin Ref := Object.Identificator (The_Object); New_Object := Create; New_Ref := Object.Identificator (New_Object); Pen_Table (New_Ref) := Pen_Table (Ref); return New_Object; end Unary_Msg_Copy; function Keyword_Msg_X (The_Object : Object.Reference; Arg_Value : Integer) return Object.Reference is Ref : Integer; begin Ref := Object.Identificator (The_Object); Pen_Table (Ref).X := Easy_X.Coordinate (Arg_Value); Easy_X.Move_To (Pen_Table (Ref).X, Pen_Table (Ref).Y); return Object.Void_Reference; end Keyword_Msg_X; function Keyword_Msg_Y (The_Object : Object.Reference; Arg_Value : Integer) return Object.Reference is Ref : Integer; begin Ref := Object.Identificator (The_Object); Pen_Table (Ref).Y := Easy_X.Coordinate (Arg_Value); Easy_X.Move_To (Pen_Table (Ref).X, Pen_Table (Ref).Y); return Object.Void_Reference; end Keyword_Msg_Y; function Keyword_Msg_Write (Arg_Object : Object.Reference) return Object.Reference is Write_Str : Scanner.B_String; begin Bs_Copy (Write_Str, String_Class.In_Text (Arg_Object)); Easy_X.Draw_String (Bs_Image (Write_Str)); return Object.Void_Reference; end Keyword_Msg_Write; function Keyword_Msg_Goto_X_Y (The_Object : Object.Reference; First_Arg_Value, Second_Arg_Value : Integer) return Object.Reference is Ref : Integer; New_X, New_Y : Easy_X.Coordinate; begin Ref := Object.Identificator (The_Object); New_X := Easy_X.Coordinate (First_Arg_Value); New_Y := Easy_X.Coordinate (Second_Arg_Value); Pen_Table (Ref).X := New_X; Pen_Table (Ref).Y := New_Y; Easy_X.Move_To (Pen_Table (Ref).X, Pen_Table (Ref).Y); return Object.Void_Reference; end Keyword_Msg_Goto_X_Y; -- envoi d'un message a un objet stylo -- =================================== function Send (To_Object : Object.Reference; The_Message : Message.Selector; With_Arguments : Arguments.List := Arguments.Void_Arguments) return Object.Reference is Nb_Argument : Natural; Msg_List, Msg : Message.Selector := Message.Void_Selector; Arg_Object, Result : Object.Reference; Arg_Value, Second_Arg_Value : Integer; Arg_List : Arguments.List; begin Nb_Argument := Arguments.How_Many (With_Arguments); if Nb_Argument = 0 then -- reception d'un message unaire if Is_Equal_String (Message.Image (The_Message), "TonX") then Msg_Report.Information ("Pen object: unary message -> TonX"); Result := Unary_Msg_X (To_Object); elsif Is_Equal_String (Message.Image (The_Message), "TonY") then Msg_Report.Information ("Pen object: unary message -> TonY"); Result := Unary_Msg_Y (To_Object); elsif Is_Equal_String (Message.Image (The_Message), "TaPlume") then Msg_Report.Information ("Pen object: unary message -> TaPlume"); Result := Unary_Msg_Font (To_Object); elsif Is_Equal_String (Message.Image (The_Message), "PetitePlume") then Msg_Report.Information ("Pen object: unary message -> PetitePlume"); Result := Unary_Msg_Small_Font (To_Object); elsif Is_Equal_String (Message.Image (The_Message), "MoyennePlume") then Msg_Report.Information ("Pen object: unary message -> MoyennePlume"); Result := Unary_Msg_Medium_Font (To_Object); elsif Is_Equal_String (Message.Image (The_Message), "LargePlume") then Msg_Report.Information ("Pen object: unary message -> LargePlume"); Result := Unary_Msg_Large_Font (To_Object); elsif Is_Equal_String (Message.Image (The_Message), "RentreChezToi") then Msg_Report.Information ("Pen object: unary message -> RentreChezToi"); Result := Unary_Msg_Go_Home (To_Object); elsif Is_Equal_String (Message.Image (The_Message), "CopieToi") then Msg_Report.Information ("Pen object: unary message -> CopieToi"); Result := Unary_Msg_Copy (To_Object); else Msg_Report.Interpret_Error ("Incorrect unary method " & Message.Image (The_Message) & " for Pen object"); raise Incorrect_Method; end if; elsif Message.Is_Keyword (The_Message) then -- reception d'un message a mots cles Message.Cat (Msg_List, The_Message); Arg_List := With_Arguments; Arguments.First (Arg_List); while (Nb_Argument /= 0) loop Arguments.Read (Arg_List, Arg_Object); Arg_Value := Object.Identificator (Arg_Object); Nb_Argument := Nb_Argument - 1; Message.Extract_Keyword (Msg_List, Msg); if Is_Equal_String (Message.Image (Msg), "TonX") then Msg_Report.Information ("Pen object: keyword message -> TonX:"); Result := Keyword_Msg_X (To_Object, Arg_Value); elsif Is_Equal_String (Message.Image (Msg), "TonY") then Msg_Report.Information ("Pen object: keyword message -> TonY:"); Result := Keyword_Msg_Y (To_Object, Arg_Value); elsif Is_Equal_String (Message.Image (Msg), "Ecrire") then Msg_Report.Information ("Pen object: keyword message -> Ecrire:"); Result := Keyword_Msg_Write (Arg_Object); elsif Is_Equal_String (Message.Image (Msg), "VaEnX") then Msg_Report.Information ("Pen object: keyword message -> VaEnX:"); -- recherche de la 2eme partie du message if (Nb_Argument /= 0) then Message.Extract_Keyword (Msg_List, Msg); if (Message.Image (Msg) = "y" or Message.Image (Msg) = "Y") then Arguments.Read (Arg_List, Arg_Object); Second_Arg_Value := Object.Identificator (Arg_Object); Nb_Argument := Nb_Argument - 1; Msg_Report.Information ("Pen object: keyword message -> Y:"); Result := Keyword_Msg_Goto_X_Y (To_Object, Arg_Value, Second_Arg_Value); else -- 2eme partie du message incorrecte Msg_Report.Interpret_Error ("Incorrect keyword method VaEnX " & Message.Image (Msg) & " for Pen object"); raise Incorrect_Method; end if; else -- 2eme partie du message manquante Msg_Report.Interpret_Error ("Incorrect keyword method VaEnX" & " for Pen object"); raise Incorrect_Method; end if; else -- message inexistant Msg_Report.Interpret_Error ("Incorrect keyword method " & Message.Image (Msg) & " for Pen object"); raise Incorrect_Method; end if; end loop; else -- erreur sur reception d'un message binaire Msg_Report.Interpret_Error ("No binary method allowed " & Message.Image (The_Message) & " for Pen object"); raise Incorrect_Method; end if; return Result; end Send; -- affichage du contenu de la table d'instance des stylos -- ====================================================== procedure Image_Table is Pen : Pen_Ref; begin Msg_Report.Information ("Pen Table contents"); for Ref in Pen_Table'Range loop Pen := Pen_Table (Ref); Msg_Report.Continue (Enum_Indicator'Image (Pen.Indicator) & ", Font: " & Easy_X.Fonts'Image (Pen.Font) & ", X: " & Easy_X.Coordinate'Image (Pen.X) & ", Y: " & Easy_X.Coordinate'Image (Pen.Y)); end loop; end Image_Table; end Pen_Class;
nblk1=13 nid=7 hdr6=20 [0x00] rec0=25 rec1=00 rec2=01 rec3=042 [0x01] rec0=27 rec1=00 rec2=0f rec3=01e [0x02] rec0=22 rec1=00 rec2=11 rec3=052 [0x03] rec0=22 rec1=00 rec2=12 rec3=024 [0x04] rec0=0c rec1=00 rec2=0c rec3=034 [0x05] rec0=26 rec1=00 rec2=09 rec3=020 [0x06] rec0=13 rec1=00 rec2=04 rec3=06c [0x07] rec0=20 rec1=00 rec2=0e rec3=004 [0x08] rec0=21 rec1=00 rec2=02 rec3=01c [0x09] rec0=18 rec1=00 rec2=08 rec3=016 [0x0a] rec0=1a rec1=00 rec2=0d rec3=010 [0x0b] rec0=1d rec1=00 rec2=0a rec3=046 [0x0c] rec0=19 rec1=00 rec2=13 rec3=02e [0x0d] rec0=14 rec1=00 rec2=10 rec3=066 [0x0e] rec0=24 rec1=00 rec2=03 rec3=06e [0x0f] rec0=17 rec1=00 rec2=06 rec3=000 [0x10] rec0=0b rec1=00 rec2=10 rec3=000 [0x11] rec0=00 rec1=00 rec2=00 rec3=000 [0x12] rec0=00 rec1=00 rec2=00 rec3=000 tail 0x21531a11084e77513a9f8 0x42a00088462060003 Free Block Chain: 0x7: 0000 00 05 03 67 80 03 69 6f 6e 03 00 20 20 20 20 20 ┆ g ion ┆ 0x5: 0000 00 0b 03 fc 80 05 73 74 72 6f 79 05 00 4a 20 20 ┆ stroy J ┆ 0xb: 0000 00 00 00 04 00 01 20 01 5f 4d 73 67 27 56 61 6c ┆ _Msg'Val┆