DataMuseum.dk

Presents historical artifacts from the history of:

Rational R1000/400 Tapes

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 Tapes

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - download
Index: ┃ B T

⟦17fc6a00f⟧ TextFile

    Length: 3954 (0xf72)
    Types: TextFile
    Names: »B«

Derivation

└─⟦a7d1ea751⟧ Bits:30000550 8mm tape, Rational 1000, !users!projects 94_04_11
    └─ ⟦129cab021⟧ »DATA« 
        └─⟦this⟧ 
└─⟦2f6cfab89⟧ Bits:30000547 8mm tape, Rational 1000, !projects 94-01-04
    └─ ⟦d65440be7⟧ »DATA« 
        └─⟦this⟧ 

TextFile

WITH Messages;
WITH Mailboxes;
WITH Destinations;

WITH Io;
WITH Lines;
WITH Message;
WITH Time_Utilities;
WITH String_Utilities;
WITH Symbolic_Display;

PACKAGE BODY Command_Utilities IS

   PACKAGE Su RENAMES String_Utilities;
   PACKAGE Tu RENAMES Time_Utilities;

   Unknown_Command : CONSTANT Command := (Unknown, 0);

   FUNCTION Get_Natural_Argument
               (Kind : Command_Kind; Command : String) RETURN Natural;

   PROCEDURE New_Line;

   PROCEDURE Display IS NEW Symbolic_Display (Io.Put, New_Line);

   PROCEDURE New_Line IS
   BEGIN
      Io.New_Line;
   END New_Line;

   FUNCTION Get_Natural_Argument
               (Kind : Command_Kind; Command : String) RETURN Natural IS
      Start_Of_Argument : Natural := Su.Reverse_Locate (" ", Command);
      Number            : Natural;
      Was_A_Number      : Boolean;
   BEGIN
      Su.String_To_Number (Command (Start_Of_Argument .. Command'Last),
                           Number, Was_A_Number);
      IF NOT Was_A_Number THEN
         RAISE Constraint_Error;
      END IF;
      RETURN Number;
   END Get_Natural_Argument;

   FUNCTION Get_Command RETURN Command IS
      -- Syntax: <command name> [" " <natural number>]
   BEGIN
      Io.Put ("MM> ");
      DECLARE
         Command : CONSTANT String := Su.Strip (Io.Get_Line);
      BEGIN

         FOR I IN Command_Kind'First .. Command_Kind'Last LOOP
            BEGIN
               IF Su.Equal (Command_Kind'Image (I),
                            Command (Command'First ..
                                        Command'First +
                                           Command_Kind'Image (I)'Length - 1),
                            Ignore_Case => True) THEN
                  CASE I IS
                     WHEN Headers | Send | Quit | Unknown =>
                        RETURN (I, 0);
                     WHEN Read | Delete =>
                        RETURN (I, Get_Natural_Argument (I, Command));
                  END CASE;
               END IF;
            EXCEPTION
               WHEN Constraint_Error =>
                  NULL;
            END;
         END LOOP;
         RETURN Unknown_Command;
      END;
   EXCEPTION
      WHEN Constraint_Error =>
         RETURN Unknown_Command;
   END Get_Command;

   FUNCTION Get_Message RETURN Messages.Message IS
      Temp : Messages.Message := Messages.Make;
      Text : Lines.Lines_Type := Lines.Make;
   BEGIN
      Io.Put ("To: ");
      Messages.Set_To (Destinations.Lookup (Io.Get_Line), Temp);
      Messages.Set_Date (Tu.Get_Time, Temp);
      Io.Put ("Subject: ");
      Messages.Set_Subject (Io.Get_Line, Temp);
      Io.Put_Line ("Text: ");
      DECLARE
         Input_File : Io.File_Type := Io.Current_Input;
      BEGIN
         LOOP
            Lines.Add (Io.Get_Line, Text);
         END LOOP;
      EXCEPTION
         WHEN Io.End_Error =>
            Messages.Set_Text (Text, Temp);
            Io.Reset (Input_File);
            Io.New_Line;
            RETURN Temp;
      END;
   END Get_Message;


   PROCEDURE Display_Message (Message : Messages.Message) IS
   BEGIN
      Display (Message);
   END Display_Message;

   PROCEDURE Display_Headers (Mailbox : Mailboxes.Mailbox) IS
   BEGIN
      FOR I IN 1 .. Mailboxes.Last_Message (Mailbox) LOOP
         Io.Put (Natural'Image (I) & " ");
         IF Mailboxes.Get_Read_Flag (I, Mailbox) THEN
            Io.Put ("R ");
         END IF;
         Io.Put (Destinations.Image (Messages.Get_From
                                        (Mailboxes.Get_Message (I, Mailbox))));
         Io.New_Line;
      END LOOP;
   END Display_Headers;

   PROCEDURE Notify_Of_Receipt (Sending_User   : Destinations.User;
                                Receiving_User : Destinations.User) IS
   BEGIN
      Message.Send (Destinations.Image (Receiving_User),
                    "message received from " &
                       Destinations.Image (Sending_User));
   END Notify_Of_Receipt;

END Command_Utilities;