|
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: 17408 (0x4400) Types: Ada Source Notes: 03_class, FILE, R1k_Segment, e3_tag, package body Rooms, seg_048908
└─⟦8527c1e9b⟧ Bits:30000544 8mm tape, Rational 1000, Arrival backup of disks in PAM's R1000 └─ ⟦5a81ac88f⟧ »Space Info Vol 1« └─⟦this⟧
with Tree, List, String_Utilities, Unbounded_String; package body Rooms is package Identifier is new Unbounded_String (1); subtype State_String is Identifier.Variable_String; package States_List is new List (Element => State_String); type Communications is record Way : Identifier.Variable_String; Destination : Identifier.Variable_String; Mode : Mode_Choice; Visibility : Visibility_Choice; Comment : Identifier.Variable_String; end record; package Communications_List is new List (Element => Communications); type Room is record Name : Identifier.Variable_String; Comment : Identifier.Variable_String; States : States_List.Object; Communications : Communications_List.Object; end record; Current_Room : Room; -------------------- function Equal (S1 : State_String; S2 : String) return Boolean is begin return String_Utilities.Equal (Identifier.Image (S1), S2); end Equal; function Find_State (Somebody_States : States_List.Object; A_State : String) return Boolean is begin States_List.Go_First (Somebody_States); while not States_List.At_End (Somebody_States) loop if Equal (States_List.Get_Current_Element (Somebody_States), A_State) then return True; end if; States_List.Go_Next (Somebody_States); end loop; return False; end Find_State; function Find_Communication (Room_Communications : Communications_List.Object; A_Way : String) return Boolean is A_Communication : Communications; begin Communications_List.Go_First (Room_Communications); while not Communications_List.At_End (Room_Communications) loop A_Communication := Communications_List.Get_Current_Element (Room_Communications); if Equal (A_Communication.Way, A_Way) then return True; end if; Communications_List.Go_Next (Room_Communications); end loop; return False; end Find_Communication; -------------------- function "<" (Left, Right : Room) return Boolean is begin return String_Utilities.Less_Than (Identifier.Image (Left.Name), Identifier.Image (Right.Name)); end "<"; function ">" (Left, Right : Room) return Boolean is begin return String_Utilities.Greater_Than (Identifier.Image (Left.Name), Identifier.Image (Right.Name)); end ">"; package Rooms_Tree is new Tree (Element => Room, Nb_Preallocation_Node => 10); -------------------- procedure Create (Name : String) is A_Room : Room; begin A_Room.Name := Identifier.Value (Name); Rooms_Tree.Insert (A_Room); end Create; procedure Set_Comment (Name : String; Comment : String) is A_Room : Room; begin A_Room.Name := Identifier.Value (Name); if Rooms_Tree.Find (A_Room) then A_Room := Rooms_Tree.Get_Current_Element; A_Room.Comment := Identifier.Value (Comment); Rooms_Tree.Set_Current_Element (A_Room); end if; end Set_Comment; function Get_Comment (Name : String) return String is A_Room : Room; begin A_Room.Name := Identifier.Value (Name); if Rooms_Tree.Find (A_Room) then A_Room := Rooms_Tree.Get_Current_Element; return Identifier.Image (A_Room.Comment); end if; end Get_Comment; procedure Add_State (Name : String; State : String) is A_Room : Room; begin A_Room.Name := Identifier.Value (Name); if Rooms_Tree.Find (A_Room) then A_Room := Rooms_Tree.Get_Current_Element; if not Find_State (A_Room.States, State) then States_List.Insert (A_Room.States, Identifier.Value (State)); Rooms_Tree.Set_Current_Element (A_Room); end if; end if; end Add_State; function In_State (Name : String; State : String) return Boolean is A_Room : Room; begin A_Room.Name := Identifier.Value (Name); if Rooms_Tree.Find (A_Room) then A_Room := Rooms_Tree.Get_Current_Element; return Find_State (A_Room.States, State); end if; end In_State; procedure Remove_State (Name : String; State : String) is A_Room : Room; begin A_Room.Name := Identifier.Value (Name); if Rooms_Tree.Find (A_Room) then A_Room := Rooms_Tree.Get_Current_Element; if Find_State (A_Room.States, State) then States_List.Remove_Current_Element (A_Room.States); Rooms_Tree.Set_Current_Element (A_Room); end if; end if; end Remove_State; procedure Go_First_State is begin States_List.Go_First (Current_Room.States); end Go_First_State; procedure Go_Next_State is begin States_List.Go_Next (Current_Room.States); end Go_Next_State; function At_End_State return Boolean is begin return States_List.At_End (Current_Room.States); end At_End_State; function Get_Current_State return String is begin return Identifier.Image (States_List.Get_Current_Element (Current_Room.States)); end Get_Current_State; procedure Add_Communication (Name : String; Way : String; Destination : String) is A_Room : Room; A_Communication : Communications; begin A_Room.Name := Identifier.Value (Name); if Rooms_Tree.Find (A_Room) then A_Room := Rooms_Tree.Get_Current_Element; if not Find_Communication (A_Room.Communications, Way) then A_Communication.Way := Identifier.Value (Way); A_Communication.Destination := Identifier.Value (Destination); Communications_List.Insert (A_Room.Communications, A_Communication); Rooms_Tree.Set_Current_Element (A_Room); end if; end if; end Add_Communication; procedure Set_Communication_Mode (Name : String; Way : String; Mode : Mode_Choice) is A_Room : Room; A_Communication : Communications; begin A_Room.Name := Identifier.Value (Name); if Rooms_Tree.Find (A_Room) then A_Room := Rooms_Tree.Get_Current_Element; if Find_Communication (A_Room.Communications, Way) then A_Communication := Communications_List.Get_Current_Element (A_Room.Communications); A_Communication.Mode := Mode; Communications_List.Set_Current_Element (A_Room.Communications, A_Communication); Rooms_Tree.Set_Current_Element (A_Room); end if; end if; end Set_Communication_Mode; procedure Set_Communication_Visibility (Name : String; Way : String; Visibility : Visibility_Choice) is A_Room : Room; A_Communication : Communications; begin A_Room.Name := Identifier.Value (Name); if Rooms_Tree.Find (A_Room) then A_Room := Rooms_Tree.Get_Current_Element; if Find_Communication (A_Room.Communications, Way) then A_Communication := Communications_List.Get_Current_Element (A_Room.Communications); A_Communication.Visibility := Visibility; Communications_List.Set_Current_Element (A_Room.Communications, A_Communication); Rooms_Tree.Set_Current_Element (A_Room); end if; end if; end Set_Communication_Visibility; procedure Set_Communication_Comment (Name : String; Way : String; Comment : String) is A_Room : Room; A_Communication : Communications; begin A_Room.Name := Identifier.Value (Name); if Rooms_Tree.Find (A_Room) then A_Room := Rooms_Tree.Get_Current_Element; if Find_Communication (A_Room.Communications, Way) then A_Communication := Communications_List.Get_Current_Element (A_Room.Communications); A_Communication.Comment := Identifier.Value (Comment); Communications_List.Set_Current_Element (A_Room.Communications, A_Communication); Rooms_Tree.Set_Current_Element (A_Room); end if; end if; end Set_Communication_Comment; procedure Set_Current_Room (Name : String) is A_Room : Room; begin A_Room.Name := Identifier.Value (Name); if Rooms_Tree.Find (A_Room) then Current_Room := Rooms_Tree.Get_Current_Element; end if; end Set_Current_Room; function Get_Current_Room return String is begin return Identifier.Image (Current_Room.Name); end Get_Current_Room; procedure First_Communication is begin Communications_List.Go_First (Current_Room.Communications); end First_Communication; procedure Next_Communication is begin Communications_List.Go_Next (Current_Room.Communications); end Next_Communication; function At_End_Communication return Boolean is begin return Communications_List.At_End (Current_Room.Communications); end At_End_Communication; function Get_Communication_Way return String is A_Communication : Communications; begin A_Communication := Communications_List.Get_Current_Element (Current_Room.Communications); return Identifier.Image (A_Communication.Way); end Get_Communication_Way; function Get_Communication_Destination return String is A_Communication : Communications; begin A_Communication := Communications_List.Get_Current_Element (Current_Room.Communications); return Identifier.Image (A_Communication.Destination); end Get_Communication_Destination; function Get_Communication_Mode return Mode_Choice is A_Communication : Communications; begin A_Communication := Communications_List.Get_Current_Element (Current_Room.Communications); return A_Communication.Mode; end Get_Communication_Mode; function Get_Communication_Visibility return Visibility_Choice is A_Communication : Communications; begin A_Communication := Communications_List.Get_Current_Element (Current_Room.Communications); return A_Communication.Visibility; end Get_Communication_Visibility; function Get_Communication_Comment return String is A_Communication : Communications; begin A_Communication := Communications_List.Get_Current_Element (Current_Room.Communications); return Identifier.Image (A_Communication.Comment); end Get_Communication_Comment; end Rooms;
nblk1=10 nid=5 hdr6=1e [0x00] rec0=24 rec1=00 rec2=01 rec3=046 [0x01] rec0=00 rec1=00 rec2=0c rec3=03c [0x02] rec0=1b rec1=00 rec2=06 rec3=022 [0x03] rec0=1f rec1=00 rec2=08 rec3=040 [0x04] rec0=1f rec1=00 rec2=09 rec3=00a [0x05] rec0=1a rec1=00 rec2=07 rec3=006 [0x06] rec0=1f rec1=00 rec2=03 rec3=03e [0x07] rec0=18 rec1=00 rec2=04 rec3=050 [0x08] rec0=0e rec1=00 rec2=0e rec3=006 [0x09] rec0=16 rec1=00 rec2=0b rec3=044 [0x0a] rec0=19 rec1=00 rec2=02 rec3=010 [0x0b] rec0=1c rec1=00 rec2=0a rec3=06c [0x0c] rec0=01 rec1=00 rec2=10 rec3=00a [0x0d] rec0=17 rec1=00 rec2=0d rec3=06a [0x0e] rec0=09 rec1=00 rec2=0f rec3=001 [0x0f] rec0=00 rec1=00 rec2=00 rec3=000 tail 0x21545d8e8865a3f14fc89 0x42a00088462060003 Free Block Chain: 0x5: 0000 00 00 00 04 80 01 74 01 02 20 20 20 20 20 20 20 ┆ t ┆