home *** CD-ROM | disk | FTP | other *** search
/ Programmer's ROM - The Computer Language Library / programmersrom.iso / ada / misc / msgio.ada < prev    next >
Encoding:
Text File  |  1988-05-03  |  24.5 KB  |  613 lines

  1. -------- SIMTEL20 Ada Software Repository Prologue ------------
  2. --                                                           -*
  3. -- Unit name    :  MESSAGE_IO
  4. -- Version      :  1.0
  5. -- Author       :  Patrick Kopson 
  6. --              : Texas Instruments  
  7. --              :  
  8. --              :  
  9. -- DDN Address  :  WOODY%TI-EG@CSNET-RELAY
  10. -- Copyright    :  (c) 1985
  11. -- Date created :  01 APR 85
  12. -- Release date :  03 DEC 85
  13. -- Last update  :  03 DEC 85
  14. -- Machine/System Compiled/Run on :  VAX 11/785  VMS 4.1
  15. --                                   DEC Ada
  16. --                                                           -*
  17. ---------------------------------------------------------------
  18. --                                                           -*
  19. -- Keywords     : Text_Messages  
  20. ----------------:
  21. --
  22. -- Abstract     :  
  23. --   This package is used for sending messages to the defaut
  24. --   output file.  See the visible part for the details of the
  25. --   structure of the messages.  Minor changes to this package
  26. --   (including making the length of certain fields generic 
  27. --   parameters) would make this package much more versatile.
  28. ----------------:  
  29. --                                                           -*
  30. ------------------ Revision history ---------------------------
  31. --                                                           -*
  32. -- DATE         VERSION    AUTHOR                  HISTORY
  33. -- 12/3/85      1.0         Patrick Kopson          Initial Release
  34. --                                                           -*
  35. ------------------ Distribution and Copyright -----------------
  36. --                                                           -*
  37. -- This prologue must be included in all copies of this software.
  38. --
  39. -- This software is copyright by the author.
  40. --
  41. -- This software is released to the Ada community.
  42. -- This software is released to the Public Domain (note:
  43. --   software released to the Public Domain is not subject
  44. --   to copyright protection).
  45. -- Restrictions on use or distribution:  NONE
  46. --                                                           -*
  47. ------------------ Disclaimer ---------------------------------
  48. --                                                           -*
  49. -- This software and its documentation are provided "AS IS" and
  50. -- without any expressed or implied warranties whatsoever.
  51. -- No warranties as to performance, merchantability, or fitness
  52. -- for a particular purpose exist.
  53. --
  54. -- Because of the diversity of conditions and hardware under
  55. -- which this software may be used, no warranty of fitness for
  56. -- a particular purpose is offered.  The user is advised to
  57. -- test the software thoroughly before relying on it.  The user
  58. -- must assume the entire risk and liability of using this
  59. -- software.
  60. --
  61. -- In no event shall any person or organization of people be
  62. -- held responsible for any direct, indirect, consequential
  63. -- or inconsequential damages or lost profits.
  64. --                                                           -*
  65. -------------------END-PROLOGUE--------------------------------
  66.  
  67. package MESSAGE_IO is 
  68. -------------------------------------------------------------------------------
  69. ----                                                                       ----
  70. --                          VISIBLE TYPE DECLARATIONS                        --
  71. ----                                                                       ----
  72. -------------------------------------------------------------------------------
  73.  
  74.               -- Type Declarations for module name abbreviations:
  75.  
  76. type Character_Type is ( 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H',
  77.                          'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P',
  78.                          'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X',
  79.                          'Y', 'Z', '_' );
  80.      --| Allowable characters for module names and message id's
  81.  
  82. Name_Length : constant := 6;
  83.      --| Largest number of characters per module name abbreviation
  84.  
  85. type Name_Range_Type is range  1 .. Name_Length;
  86.      --| Type for length of module name abbreviations
  87.  
  88. type Name_Array_Type is array ( Name_Range_Type ) of Character_Type;
  89.      --| Type for module name abbreviations 
  90.  
  91.  
  92.               -- Type Declarations for message id's:
  93.  
  94. Max_Message_Id : constant := 8;
  95.      --| Largest number of characters per message id
  96.  
  97. type Message_Id_Range_Type is range 1 .. Max_Message_Id;
  98.      --| Type for lengths of message id's
  99.  
  100. type Message_Id_Array_Type is 
  101.          array ( Message_Id_Range_Type ) of Character_Type;
  102.      --| Type for message id's
  103.  
  104.  
  105.               -- Type Declarations for priority kinds:
  106.  
  107. type Priority_Kind_Type is ( Alevel, Slevel, Tell_All );
  108.      --| Each message must have one of these priority kinds associated with it
  109.  
  110. subtype Priority_Kind_Constrained_Type is 
  111.          Priority_Kind_Type range Alevel ..  Slevel;
  112.      --| Constrained type of priority kinds for defining priority levels
  113.  
  114.  
  115.               -- Type Declarations for text line extensions:
  116.  
  117. Text_Array_Length : constant := 32767;
  118.      --| Largest number of text lines allowed
  119.  
  120. Text_Line_Length : constant := 72;
  121.      --| Largest number of characters per line of text
  122.  
  123. subtype Text_Line_Type is string ( 1 .. Text_Line_Length );
  124.      --| Type for text lines
  125.  
  126. type Text_Array_Length_Type is range  0 .. Text_Array_Length;
  127.      --| Type for length of text array
  128.  
  129. type Text_Array_Type 
  130.      is array ( Text_Array_Length_Type range <> ) of Text_Line_Type;
  131.      --| Type for text line extensions 
  132.  
  133. Null_Text_Array : constant Text_Array_Type ( 1 .. 0 ) := 
  134.                            ( 1 .. 0 => ( 1 .. Text_Line_Length => ' ' ) );
  135.      --| Constant for null text lines
  136.  
  137.  
  138.               -- Type Declarations for progress report headline 
  139.               --                       and message structure line:
  140.  
  141. Required_Text_Line_Length : constant := 40;
  142.      --| Maximum length for required text line
  143.  
  144. subtype Required_Text_Line_Type is string ( 1 .. Required_Text_Line_Length );
  145.      --| Type for required text line
  146.  
  147.  
  148. type Severity_Level is ( Note, Warning, Error, Failure );
  149.  
  150.  
  151. -------------------------------------------------------------------------------
  152. ----                                                                       ----
  153. --                          PACKAGE ENTRY POINTS                             --
  154. ----                                                                       ----
  155. -------------------------------------------------------------------------------
  156.  
  157.  
  158. procedure DISPLAY_PROGRESS ( Report_Title : in Required_Text_Line_Type;
  159.                              Report_Text  : in Text_Array_Type 
  160.                                                := Null_Text_Array;
  161.                              Priority     : in Severity_Level := Failure );
  162.  
  163.    --|    OVERVIEW
  164.    --|       When the priority of the progress message, given by Priority, is
  165.    --|       higher than or equal to the lowest priority defined for the Slevel
  166.    --|       priority kind, this procedure outputs to the message file the 
  167.    --|       progress report headline given by Report_Title, the wall clock date
  168.    --|       and time, and if specified, the optional extension text given by 
  169.    --|       Report_Text.
  170.    --|    REQUIRES
  171.    --|       The message file must be open.
  172.    --|    EFFECTS
  173.    --|       The report title, wall clock date and time is written to the 
  174.    --|       message file.  The report text is selected for output, when
  175.    --|       specified, when the priority is higher than or equal to the
  176.    --|       lowest priority defined for the Slevel priority kind.  The
  177.    --|       format of the report output is the following:
  178.    --|             
  179.    --|       CONTROL:             <report_title>       hh:mm:ss dd-MMM-yyyy
  180.    --|
  181.    --|    o    [                         .                              ]
  182.    --|    p    [                         .                              ]
  183.    --|    t    [                         .                              ]
  184.    --|    i    [             . . . <report_text> . . .                  ]
  185.    --|    o    [                         .                              ] 
  186.    --|    n    [                         .                              ]
  187.    --|    a    [                         .                              ]
  188.    --|    l    [                         .                              ]
  189.    --|
  190.    --|    RAISES
  191.    --|       MSIO_MESSAGE_FILE_DISASTER
  192.    --|    ERRORS
  193.    --|       If the message file has not been opened, or if the capacity 
  194.    --|       of the message file has been exceeded, or if the output 
  195.    --|       operation could not be completed because of a malfunction 
  196.    --|       of  the  underlying  system,  then  the  exception 
  197.    --|       MSIO_MESSAGE_FILE_DISASTER will be raised.  
  198.    --|    NA
  199.    --|       MODIFIES
  200.  
  201.  
  202. procedure DISPLAY_MSG
  203.        ( Module_Abbr             : in Name_Array_Type;
  204.          Message_Id              : in Message_Id_Array_Type;
  205.          Message_Text_Standard   : in Required_Text_Line_Type;
  206.          Message_Text_Addition   : in Text_Array_Type    := Null_Text_Array;
  207.          Priority_Kind           : in Priority_Kind_Type := Tell_All;
  208.          Priority                : in Severity_Level     := Note );
  209.                                                                
  210.    --|    OVERVIEW
  211.    --|       When the priority of the message given by Priority, is higher than
  212.    --|       or equal to the lowest priority defined for the priority kind given
  213.    --|       by Priority_Kind, this procedure outputs to the message file the 
  214.    --|       module abbreviation given by Module_Abbr, the message 
  215.    --|       identification given by Message_Id, the structure line, which 
  216.    --|       contains the required portion of the message, given by 
  217.    --|       Message_Text_Standard, and if specified, the optional extension
  218.    --|       text given by Message_Text_Addition.
  219.    --|    REQUIRES
  220.    --|       The message file must be open.  
  221.    --|    EFFECTS
  222.    --|       The module abbreviation, the message identification, the
  223.    --|       priority, and the standard message text are output to the
  224.    --|       message file.  Messages with priority higher than or equal 
  225.    --|       to the lowest priority level defined for a particilar 
  226.    --|       priority kind are selected for output to the output file.  
  227.    --|       If the lowest priority is not defined, then all messages 
  228.    --|       will be output.  If the priority kind, given by Priority_Kind, 
  229.    --|       is Tell_All, then the given message is output regardless of 
  230.    --|       priority.  The format of the message output looks like the 
  231.    --|       following:
  232.    --|             
  233.    --|       <module_abbr> - <priority> - <message_id>  <message_text_standard>
  234.    --|
  235.    --|    o    [                         .                                ]
  236.    --|    p    [                         .                                ]
  237.    --|    t    [                         .                                ]
  238.    --|    i    [         . . . <message_text_addition> . . .              ]
  239.    --|    o    [                         .                                ] 
  240.    --|    n    [                         .                                ]
  241.    --|    a    [                         .                                ]
  242.    --|    l    [                         .                                ]
  243.    --|
  244.    --|    RAISES
  245.    --|       MSIO_MESSAGE_FILE_DISASTER
  246.    --|    ERRORS
  247.    --|       If the message file has not been opened, or if the capacity 
  248.    --|       of the message file has been exceeded, or if the output 
  249.    --|       operation could not be completed because of a malfunction 
  250.    --|       of  the  underlying  system,  then  the  exception 
  251.    --|       MSIO_MESSAGE_FILE_DISASTER will be raised.  
  252.    --|    NA
  253.    --|       MODIFIES
  254.  
  255.  
  256. procedure DEFINE_LOWEST_PRIORITY 
  257.                       ( Priority_Kind  : in Priority_Kind_Constrained_Type;
  258.                         Priority_Level : in Severity_Level );
  259.  
  260.    --|    OVERVIEW
  261.    --|       This procedure allows the lowest reportable message priority,
  262.    --|       given by Priority_Level, to be defined for a priority kind,
  263.    --|       given by Priority_Kind.
  264.    --|    EFFECTS
  265.    --|       The lowest priority for a priority kind is defined.
  266.    --|    NA
  267.    --|       REQUIRES, RAISES, ERRORS
  268.  
  269.  
  270. procedure CLOSE_MESSAGE_FILE;
  271.  
  272.    --|    OVERVIEW
  273.    --|       This procedure closes the message file.
  274.    --|    REQUIRES
  275.    --|       The message file must be open.
  276.    --|    EFFECTS
  277.    --|       A message indicating that the message file is closed 
  278.    --|       is written to the message file, then the message file 
  279.    --|       is closed.
  280.    --|    RAISES
  281.    --|       MSIO_MESSAGE_FILE_DISASTER
  282.    --|    ERRORS
  283.    --|       If the message file is not open, then the exception 
  284.    --|       MSIO_MESSAGE_FILE_DISASTER will be raised.
  285.    --|    NA
  286.    --|       MODIFIES
  287.  
  288.  
  289.  
  290. -- Exceptions raised by Message file I/O package
  291.  
  292. MSIO_MESSAGE_FILE_DISASTER : exception;
  293.  
  294. end MESSAGE_IO;
  295.  
  296.  
  297. -------------------------------------------------------------------------------
  298. ----                                                                       ----
  299. --                         MESSAGE I/O PACKAGE BODY                          --
  300. ----                                                                       ----
  301. -------------------------------------------------------------------------------
  302.  
  303. with TEXT_IO;
  304. with CALENDAR;
  305.  
  306. package body MESSAGE_IO is 
  307. -------------------------------------------------------------------------------
  308. ----                                                                       ----
  309. --                       INTERNAL TYPES AND OBJECTS                          --
  310. ----                                                                       ----
  311. -------------------------------------------------------------------------------
  312. subtype Date_And_Time_Type is STRING (1 .. 22);
  313.  
  314. type Priority_Array_Type is 
  315.      array (Priority_Kind_Constrained_Type) of Severity_Level;
  316.  
  317. Lowest_Priority_Array :  Priority_Array_Type 
  318.                       := (Severity_Level'First, Severity_Level'First);
  319.  
  320. File_Is_Closed : BOOLEAN := false;
  321.  
  322. -------------------------------------------------------------------------------
  323. ----                                                                       ----
  324. --                           INTERNAL PROCEDURES                             --
  325. ----                                                                       ----
  326. -------------------------------------------------------------------------------
  327. function Character_Equivalent_Of 
  328.          (Char : in     Character_Type) return Character is
  329.  
  330.    --| OVERVIEW
  331.    --|   This function returns the character equivalent of an item of
  332.    --|   type Character_Type.
  333.    --|
  334.    --| ALGORITHM
  335.    --|   Use Char as an index to an array of characters to select the result.
  336.  
  337.    type Character_Array_Type is array (Character_Type) of Character;
  338.  
  339.    Character_Array : Character_Array_Type := ('A', 'B', 'C', 'D', 'E', 'F', 'G',
  340.                                               'H', 'I', 'J', 'K', 'L', 'M', 'N',
  341.                                               'O', 'P', 'Q', 'R', 'S', 'T', 'U',
  342.                                               'V', 'W', 'X', 'Y', 'Z', '_');
  343.    begin
  344.      return Character_Array (Char);
  345.    end Character_Equivalent_Of;
  346.  
  347.  
  348. function Date_And_Time return Date_And_Time_Type is
  349.  
  350.    --| OVERVIEW
  351.    --|   This function returns the date and time from the wall clock
  352.    --|   as a STRING so that TEXT_IO can write it to the message file.
  353.    --|
  354.    --| EFFECTS
  355.    --|   The date and time are returned as a string with the following format:
  356.    --|   " hh:mm:ss  dd-MMM-yyy".
  357.    --|
  358.    --| NA
  359.    --|  REQUIRES, ERRORS, RAISES, MODIFIES
  360.    --|
  361.    --| ALGORITHM
  362.    --|   After getting the Year, Month, Day and Seconds from CALENDAR
  363.    --|   subprograms, derive Hour, Minute and Sec from Seconds.
  364.    --|   Then insert the images of these values into the result string.
  365.  
  366.    Result : STRING(1 .. 22) := " hh:mm:ss  dd-MMM-yyyy";
  367.  
  368.    Seconds_Per_Minute : constant := 60;
  369.    Seconds_Per_Hour   : constant := 3600;
  370.  
  371.    subtype Hour_Number   is INTEGER range 0 .. 23;
  372.    subtype Minute_Number is INTEGER range 0 .. 59;
  373.    subtype Sec_Number    is INTEGER range 0 .. 59;
  374.  
  375.    Date : CALENDAR.Time;
  376.  
  377.    Year    : CALENDAR.Year_Number;
  378.    Month   : CALENDAR.Month_Number;
  379.    Day     : CALENDAR.Day_Number;
  380.    Seconds : CALENDAR.Day_Duration;
  381.  
  382.    Hour   : Hour_Number;
  383.    Minute : Minute_Number;
  384.    Sec    : Sec_Number;
  385.  
  386.    begin
  387.       Date := CALENDAR.Clock;
  388.       CALENDAR.Split (Date,
  389.                       Year,
  390.                       Month,
  391.                       Day,
  392.                       Seconds);
  393.       Hour    := INTEGER(Seconds) / Seconds_Per_Hour;
  394.       Seconds := CALENDAR.Day_Duration (INTEGER(Seconds) rem Seconds_Per_Hour);
  395.       Minute  := INTEGER(Seconds) / Seconds_Per_Minute;
  396.       Sec     := INTEGER(Seconds) rem Seconds_Per_Minute;
  397.  
  398.       Result(18 .. 22) := CALENDAR.Year_Number'IMAGE (Year);
  399.       Result(18) := '-';
  400.  
  401.       case Month is
  402.          when 1 => Result(15 .. 17) := "JAN";
  403.          when 2 => Result(15 .. 17) := "FEB";
  404.          when 3 => Result(15 .. 17) := "MAR";
  405.          when 4 => Result(15 .. 17) := "APR";
  406.          when 5 => Result(15 .. 17) := "MAY";
  407.          when 6 => Result(15 .. 17) := "JUN";
  408.          when 7 => Result(15 .. 17) := "JUL";
  409.          when 8 => Result(15 .. 17) := "AUG";
  410.          when 9 => Result(15 .. 17) := "SEP";
  411.          when 10 => Result(15 .. 17) := "OCT";
  412.          when 11 => Result(15 .. 17) := "NOV";
  413.          when 12 => Result(15 .. 17) := "DEC";
  414.       end case;
  415.  
  416.       if  (Day < 10)  then
  417.          Result(12 .. 13) := CALENDAR.Day_Number'IMAGE (Day);
  418.          Result(12) := '0';
  419.       else
  420.          Result(11 .. 13) := CALENDAR.Day_Number'IMAGE (Day);
  421.       end if;
  422.        
  423.       if  (Sec < 10)  then
  424.          Result(8 .. 9) := Sec_Number'IMAGE (Sec);
  425.          Result(8) := '0';
  426.       else
  427.          Result(7 .. 9) := Sec_Number'IMAGE (Sec);
  428.          Result(7) := ':';
  429.       end if;
  430.        
  431.       if  (Minute < 10)  then
  432.          Result(5 .. 6) := Minute_Number'IMAGE (Minute);
  433.          Result(5) := '0';
  434.       else
  435.          Result(4 .. 6) := Minute_Number'IMAGE (Minute);
  436.          Result(4) := ':';
  437.       end if;
  438.        
  439.       if  (Hour < 10)  then
  440.          Result(2 .. 3) := Hour_Number'IMAGE (Hour);
  441.          Result(2) := '0';
  442.       else
  443.          Result(1 .. 3) := Hour_Number'IMAGE (Hour);
  444.       end if;
  445.        
  446.       return Result;
  447.    end Date_And_Time;
  448.   
  449.  
  450. -------------------------------------------------------------------------------
  451. ----                                                                       ----
  452. --                          PACKAGE ENTRY POINTS                             --
  453. ----                                                                       ----
  454. -------------------------------------------------------------------------------
  455. procedure DISPLAY_PROGRESS 
  456.           ( Report_Title : in Required_Text_Line_Type;
  457.             Report_Text  : in Text_Array_Type := Null_Text_Array;
  458.             Priority     : in Severity_Level := Failure ) is
  459.  
  460.    --| OVERVIEW
  461.    --|   If the priority (Priority) is higher than or equal to the lowest
  462.    --|   priority defined for the Slevel priority kind, this procedure
  463.    --|   outputs the progress report headline (Report_Title) and the wall
  464.    --|   clock date and time to the message file on one line with the 
  465.    --|   optional extension text (Report_Text), if specified, on following
  466.    --|   lines.
  467.    --|
  468.    --| ALGORITM
  469.    --|   . . . 
  470.  
  471.    begin
  472.      if File_Is_Closed then
  473.         TEXT_IO.PUT 
  474.                 ("***** MESSAGE_IO.Display_Progress called with file closed.");
  475.         raise MSIO_MESSAGE_FILE_DISASTER;
  476.      end if;
  477.    
  478.      if  ( Priority >= Lowest_Priority_Array(Slevel) )  then
  479.         TEXT_IO.PUT ("CONTROL:   ");
  480.         TEXT_IO.PUT (Report_Title);
  481.         TEXT_IO.PUT ("     ");
  482.         TEXT_IO.PUT (Date_And_Time);
  483.         TEXT_IO.NEW_LINE;
  484.  
  485.         for Line in  Report_Text'RANGE(1)  loop
  486.            TEXT_IO.PUT ("   ");
  487.            TEXT_IO.PUT ( Report_Text(Line) ); 
  488.            TEXT_IO.NEW_LINE;
  489.         end loop;
  490.      end if;
  491.  
  492.    exception
  493.      when others => raise MSIO_MESSAGE_FILE_DISASTER;
  494.  
  495.    end DISPLAY_PROGRESS;  
  496.  
  497.  
  498. procedure DISPLAY_MSG
  499.           ( Module_Abbr             : in Name_Array_Type;
  500.             Message_Id              : in Message_Id_Array_Type;
  501.             Message_Text_Standard   : in Required_Text_Line_Type;
  502.             Message_Text_Addition   : in Text_Array_Type    := Null_Text_Array;
  503.             Priority_Kind           : in Priority_Kind_Type := Tell_All;
  504.             Priority                : in Severity_Level     := Note ) is
  505.                                                                
  506.    --| OVERVIEW
  507.    --|   If the priority (Priority) is higher than or equal to the lowest
  508.    --|   priority defined for the priority kind (Priority_Kind), this
  509.    --|   procedure outputs the module abbreviation (Module_Abbr), the
  510.    --|   priority (Priority), the message identification (Message_Id), and
  511.    --|   the structure line which contains the required portion of the 
  512.    --|   message (Message_Text_Standard) to the message file on one line,
  513.    --|   with the optional extension text (Message_Text_Addition), if 
  514.    --|   specified, on following lines.
  515.    --|
  516.    --| NOTES
  517.    --|   The Lowest_Priority for each priority kind is initialized
  518.    --|   to the lowest possible value; so there is no need to check
  519.    --|   whether it is undefined (indicating that we should write the 
  520.    --|   message regardless of the priority).
  521.    --|
  522.    --| ALGORITHM
  523.    --|   After writing the Module_Abbr, Priority, Message_ID and 
  524.    --|   Message_Text_Standard, we check the Priority and Priority_Kind
  525.    --|   to determine whether we must write the Message_Text_Addition.
  526.  
  527.    begin
  528.      if File_Is_Closed then
  529.         TEXT_IO.PUT ("***** MESSAGE_IO.Display_Msg called with file closed.");
  530.         raise MSIO_MESSAGE_FILE_DISASTER;
  531.      end if;
  532.  
  533.      if  ( Priority_Kind =  Tell_All ) or else 
  534.          ( Priority >= Lowest_Priority_Array(Priority_Kind) )  then
  535.         for Char in Module_Abbr'RANGE loop
  536.            TEXT_IO.PUT ( Character_Equivalent_Of(Module_Abbr(Char)) );
  537.         end loop;
  538.         TEXT_IO.PUT (" - ");
  539.         case Priority is
  540.            when Note    => TEXT_IO.PUT ( "NOTE" );
  541.            when Warning => TEXT_IO.PUT ( "WARNING" );
  542.            when Error   => TEXT_IO.PUT ( "ERROR" );
  543.            when Failure => TEXT_IO.PUT ( "FAILURE" );
  544.            when others  => TEXT_IO.PUT ( "OTHER" );
  545.         end case;
  546.         TEXT_IO.PUT (" - ");
  547.         for Char in Message_ID'RANGE loop
  548.            TEXT_IO.PUT ( Character_Equivalent_Of(Message_ID(Char)) );
  549.         end loop;
  550.         TEXT_IO.PUT (" - ");
  551.         TEXT_IO.PUT (Message_Text_Standard);
  552.         TEXT_IO.NEW_LINE;
  553.  
  554.         for Line in  Message_Text_Addition'RANGE(1)  loop
  555.            TEXT_IO.PUT ("   ");
  556.            TEXT_IO.PUT ( Message_Text_Addition(Line) ); 
  557.            TEXT_IO.NEW_LINE;
  558.         end loop;
  559.      end if;
  560.  
  561.    exception
  562.      when others => raise MSIO_MESSAGE_FILE_DISASTER;
  563.  
  564.    end DISPLAY_MSG;
  565.  
  566.  
  567. procedure DEFINE_LOWEST_PRIORITY 
  568.           ( Priority_Kind  : in Priority_Kind_Constrained_Type;
  569.             Priority_Level : in Severity_Level ) is
  570.  
  571.    --| OVERVIEW
  572.    --|   This procedure allows the lowest reportable message priority,
  573.    --|   given by Priority_Level, to be defined for a priority kind,
  574.    --|   given by Priority_Kind.
  575.    --| 
  576.    --| ALGORITHM
  577.    --|   Set the specified lowest_priprity to Priority_Level
  578.  
  579.    begin
  580.      Lowest_Priority_Array (Priority_Kind) := Priority_Level;
  581.    exception
  582.      when others => raise MSIO_MESSAGE_FILE_DISASTER;
  583.    end DEFINE_LOWEST_PRIORITY;
  584.  
  585.  
  586. procedure CLOSE_MESSAGE_FILE is
  587.  
  588.    --| OVERVIEW
  589.    --|   This procedure closes the message file.
  590.    --|
  591.    --| NOTES   
  592.    --|   The standard output file can not be closed!
  593.    --|   Therefore, this procedure will write a closing message
  594.    --|   (including the wall clock date and time) to the message file 
  595.    --|   and then quit.
  596.    --|
  597.    --| ALGORITHM
  598.    --|   Write a closing message to the file.
  599.    --|   Close the default output file if possible.
  600.  
  601.    Close_File : TEXT_IO.File_Type;
  602.  
  603.    begin
  604.      TEXT_IO.PUT ("Mesage File closed at    ");
  605.      TEXT_IO.PUT (Date_And_Time);
  606.      TEXT_IO.NEW_LINE;
  607.      File_Is_Closed := true;
  608.    exception
  609.      when others => raise MSIO_MESSAGE_FILE_DISASTER;
  610.    end CLOSE_MESSAGE_FILE;
  611.  
  612. end MESSAGE_IO;
  613.