?? RIGHT := 110 ??
?? NEWTITLE := 'NOS/VE Deadstart : Display Deadstart Messages' ??
MODULE sym$display_deadstart_message;

{ PURPOSE:
{   This module contains procedures which display deadstart emssages to the system console.

?? NEWTITLE := 'Global Declarations Referenced by This Module', EJECT ??
*copyc clp$convert_integer_to_string
*copyc dpp$put_next_line
*copyc osp$system_error
*copyc osp$unpack_status_condition
?? EJECT ??
*copyc dpv$system_core_display
*copyc dsv$display_deadstart_messages
?? OLDTITLE ??
?? NEWTITLE := 'syp$display_deadstart_message', EJECT ??

{ PURPOSE:
{   This procedure displays a message on the console.  This procedure is used for messages that are considered
{   vital to describing the deadstart process.  The message sent to this procedure always will be displayed.
{   A format has been set up for these messages to provide uniformity to the deadstart display.  All messages
{   should start with a capital letter, with no preceding blanks, and end with three periods.  The messages
{   should be grammatically correct and have no spelling errors.  They should describe the deadstart process
{   at that point and should not be there for debugging purposes.
{     Example: SYP$DISPLAY_DEADSTART_MESSAGE ('System core initialization in progress ...');

  PROCEDURE [XDCL, #GATE] syp$display_deadstart_message
    (    message: string ( * ));

    VAR
      ignore_status: ost$status;

    dpp$put_next_line (dpv$system_core_display, message, ignore_status);

  PROCEND syp$display_deadstart_message;
?? OLDTITLE ??
?? NEWTITLE := 'syp$process_deadstart_status', EJECT ??

{ PURPOSE:
{   This procedure displays a status message to the console.  A boolean was created to display a fatal
{   message and halt the system in the case of a fatal status.

  PROCEDURE [XDCL, #GATE] syp$process_deadstart_status
    (    message: string ( * );
         fatal_status: boolean;
         status: ost$status);

    VAR
      display_string: string (280),
      identifier: ost$status_identifier,
      ignore_status: ost$status,
      integer_string: ost$string,
      number: ost$status_condition_number,
      size: 0 .. 0ffff(16),
      status_size: 0 .. 0ffff(16);

    IF fatal_status THEN
      syp$display_deadstart_message ('A fatal NOS/VE error has occurred');
    ELSE
      syp$display_deadstart_message ('A NOS/VE error has occurred');
    IFEND;
    syp$display_deadstart_message (message);

    IF NOT status.normal THEN
      osp$unpack_status_condition (status.condition, identifier, number);
      display_string := identifier;
      size := #SIZE (identifier) + 1;
      clp$convert_integer_to_string (number, 10, FALSE, integer_string, ignore_status);
      display_string (size, integer_string.size) := integer_string.value;
      size := size + integer_string.size + 1;
      IF status.text.size > (280 - size) THEN
        status_size := 280 - size;
      ELSEIF status.text.size > 0 THEN
        status_size := status.text.size;
      ELSE
        status_size := 1;
      IFEND;
      display_string (size, * ) := status.text.value (1, status_size);
      size := size + status_size;
      syp$display_deadstart_message (display_string (1, size));
    IFEND;

    IF fatal_status THEN
      syp$display_deadstart_message ('A NOS/VE Deadstart is required');
      osp$system_error (' ', ^status);
    IFEND;

  PROCEND syp$process_deadstart_status;
?? OLDTITLE ??
?? NEWTITLE := 'syp$trace_deadstart_message', EJECT ??

{ PURPOSE:
{   This procedure is used to display all the other deadstart messages that are really displayed for debug
{   purposes.  A boolean (dsv$display_deadstart_messages) has been created through a SETSA.  When this boolean
{   is FALSE, all of these debug messages are not displayed.  This allows a user to depress all the debug
{   messages and display only a neat set of messages describing the flow of deadstart.

  PROCEDURE [XDCL, #GATE] syp$trace_deadstart_message
    (    message: string ( * ));

    VAR
      display_message: string (256),
      ignore_status: ost$status,
      index: 1 .. 80,
      message_size: integer,
      non_blank_found: boolean,
      work_message: string (256);

    IF NOT dsv$display_deadstart_messages THEN
      RETURN;
    IFEND;

    { Convert all characters to lower case.

    work_message := message;
    non_blank_found := FALSE;
    FOR index := 1 TO #SIZE (message) DO
      IF (work_message (index) >= 'A') AND (work_message (index) <= 'Z') THEN
        work_message (index) := $CHAR ($INTEGER (work_message (index)) + 32);
      IFEND;
    FOREND;

   /skip_preceding_blanks/
    FOR index := 1 TO #SIZE (message) DO
      IF work_message (index) <> ' ' THEN
        non_blank_found := TRUE;
        EXIT /skip_preceding_blanks/;
      IFEND;
    FOREND /skip_preceding_blanks/;
    IF NOT non_blank_found THEN
      RETURN;
    IFEND;

    message_size := #SIZE (message) - (index - 1);
    display_message (1, *) := ' ';
    display_message (3, *) := work_message (index, *);
    dpp$put_next_line (dpv$system_core_display, display_message (1, message_size+2), ignore_status);

  PROCEND syp$trace_deadstart_message;
MODEND sym$display_deadstart_message;
