?? TITLE := 'NOS/VE Permanent Files : Status Handling' ??
MODULE pfm$report_unexpected_status;
?? RIGHT := 110 ??

?? NEWTITLE := '  Global Declarations Referenced by this module' ??
?? PUSH (LISTEXT := ON) ??
*copyc i#build_adaptable_seq_pointer
*copyc oss$job_paged_literal
*copyc fsc$max_path_elements
*copyc fsc$max_path_size
*copyc osd$integer_limits
*copyc pmd$system_log_interface
*copyc dfe$error_condition_codes
*copyc mme$condition_codes
*copyc pfe$error_condition_codes
*copyc pfe$internal_error_conditions
*copyc amt$page_width
*copyc dmt$error_condition_codes
*copyc fst$path
*copyc fst$path_element_size
*copyc fst$path_index
*copyc fst$path_size
*copyc ost$string
*copyc pft$array_index
*copyc pft$complete_path
*copyc pft$p_complete_path
*copyc pft$path
*copyc pft$variant_path
?? POP ??
*copyc clp$convert_integer_to_rjstring
*copyc dpp$put_critical_message
*copyc fsp$path_element
*copyc osp$append_status_integer
*copyc osp$append_status_parameter
*copyc osp$format_message
*copyc osp$generate_log_message
*copyc osp$get_set_name
*copyc osp$recoverable_system_error
*copyc osp$set_status_abnormal
*copyc osp$unpack_status_condition
*copyc pmp$log_ascii
*copyc fsv$evaluated_file_reference
*copyc pfv$space_character
?? EJECT ??


  VAR
    control_codes_translation: [oss$job_paged_literal, READ] string (256) := '            ' CAT
          '                     !"#$%&''()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijkl'
          CAT 'mnopqrstuvwxyz{|}~                                                                        ' CAT
          '                                                         ';

?? TITLE := '  [XDCL, #GATE] pfp$convert_cycle_path_to_strng', EJECT ??
{ PURPOSE:
{   This procedure converts a complete path and cycle number to a string.  The
{   string is a path name suitable for printing and follows the standard form,
{   i.e. it begins with :family_name, contains no blanks, and separates each
{   name with a period.
{
{ NOTE:
{   A set name is expected to be the first name in the path, but is not
{   included in the path name.

  PROCEDURE [XDCL, #GATE] pfp$convert_cycle_path_to_strng
    (    path: pft$complete_path;
         cycle_number: fst$cycle_number;
     VAR path_name: ost$string);

    VAR
      cycle_string: string (6),
      cycle_string_length: integer,
      found: boolean,
      last_name_length: ost$name_size,
      path_index: pft$array_index,
      path_name_length: integer,
      space_index: 1 .. osc$max_name_size + 1;

    path_name_length := 0;

    #SCAN (pfv$space_character, path [UPPERBOUND (path)], space_index, found);
    IF space_index = 1 THEN
      last_name_length := 2;
    ELSE
      last_name_length := space_index - 1;
    IFEND;

    STRINGREP (cycle_string, cycle_string_length, cycle_number);
    cycle_string (1) := '.';

    FOR path_index := pfc$family_path_index TO UPPERBOUND (path) DO
      IF (path [path_index] = osc$null_name) OR (path [path_index] = '') THEN
        path_name.value (path_name_length + 1, 2) := '.?';
        path_name_length := path_name_length + 2;
      ELSEIF path_index = UPPERBOUND (path) THEN
        STRINGREP (path_name.value, path_name_length, path_name.value (1, path_name_length),
              '.', path [UPPERBOUND (path)] (1, last_name_length), cycle_string (1, cycle_string_length));
      ELSE
        #SCAN (pfv$space_character, path [path_index], space_index, found);
        IF path_name_length + space_index + (2 * ((UPPERBOUND (path) - 1) - path_index)) +
              (last_name_length + 1) + cycle_string_length <= osc$max_string_size THEN
          STRINGREP (path_name.value, path_name_length, path_name.value (1, path_name_length),
                '.', path [path_index] (1, space_index - 1));
        ELSE
          {
          { The path name would be too long, so a '?' is substituted for this
          { name in the path.
          {
          path_name.value (path_name_length + 1, 2) := '.?';
          path_name_length := path_name_length + 2;
        IFEND;
      IFEND;
    FOREND;

    path_name.value (1) := ':';
    path_name.size := path_name_length;
  PROCEND pfp$convert_cycle_path_to_strng;

?? TITLE := '  [XDCL, #GATE] pfp$convert_fs_to_complete_path', EJECT ??

  PROCEDURE [XDCL, #GATE] pfp$convert_fs_to_complete_path
    (    evaluated_file_reference: fst$evaluated_file_reference;
     VAR p_complete_path: {output^} pft$p_complete_path;
     VAR status: ost$status);

    VAR
      element_index: fst$number_of_path_elements,
      family: ost$name,
      path_element_size: fst$path_element_size,
      path_index: fst$path_index;

    family := fsp$path_element (^evaluated_file_reference, pfc$family_name_index) ^;
    osp$get_set_name (family, p_complete_path^ [pfc$set_path_index], status);

    IF status.normal THEN
      path_index := 1;

      FOR element_index := 1 TO evaluated_file_reference.number_of_path_elements DO
        path_element_size := $INTEGER (evaluated_file_reference.path_structure (path_index));
        p_complete_path^ [element_index + pfc$set_path_index] :=
              evaluated_file_reference.path_structure (path_index + 1, path_element_size);
        path_index := path_index + path_element_size + 1;
      FOREND;
    IFEND;
  PROCEND pfp$convert_fs_to_complete_path;

?? TITLE := '  [XDCL, #GATE] pfp$convert_fs_to_pft$path', EJECT ??

  PROCEDURE [XDCL, #GATE] pfp$convert_fs_to_pft$path
    (    evaluated_file_reference: fst$evaluated_file_reference;
     VAR path: pft$path);

    VAR
      element_index: fst$number_of_path_elements,
      path_element_size: fst$path_element_size,
      path_index: fst$path_index;

    path_index := 1;

    FOR element_index := 1 TO evaluated_file_reference.number_of_path_elements DO
      path_element_size := $INTEGER (evaluated_file_reference.path_structure (path_index));
      path [element_index] := evaluated_file_reference.path_structure (path_index + 1, path_element_size);
      path_index := path_index + path_element_size + 1;
    FOREND;
  PROCEND pfp$convert_fs_to_pft$path;

?? TITLE := '  [XDCL, #GATE] pfp$convert_pf_to_fs_structure', EJECT ??

  PROCEDURE [XDCL, #GATE] pfp$convert_pf_to_fs_structure
    (    complete_path: pft$complete_path;
     VAR evaluated_file_reference: fst$evaluated_file_reference);

    VAR
      element_index: fst$number_of_path_elements,
      found: boolean,
      path_index: fst$path_index,
      space_index: 1 .. osc$max_name_size + 1;

    evaluated_file_reference := fsv$evaluated_file_reference;
    IF UPPERBOUND (complete_path) - pfc$set_path_index <= fsc$max_path_elements THEN
      evaluated_file_reference.number_of_path_elements := UPPERBOUND (complete_path) - pfc$set_path_index;
    ELSE
      evaluated_file_reference.number_of_path_elements := fsc$max_path_elements;
    IFEND;

    path_index := 1;

    FOR element_index := 1 TO evaluated_file_reference.number_of_path_elements DO
      #SCAN (pfv$space_character, complete_path [element_index + pfc$set_path_index], space_index, found);
      evaluated_file_reference.path_structure (path_index) := $CHAR (space_index - 1);
      evaluated_file_reference.path_structure (path_index + 1, space_index - 1) :=
            complete_path [element_index + pfc$set_path_index] (1, space_index - 1);
      path_index := path_index + space_index;
    FOREND;

    evaluated_file_reference.path_structure_size := path_index - 1;
  PROCEND pfp$convert_pf_to_fs_structure;

?? TITLE := '  [XDCL, #GATE] pfp$convert_pf_cy_path_to_strng', EJECT ??
{ PURPOSE:
{   This procedure converts a path and cycle number to a string.  The string is
{   a path name suitable for printing and follows the standard form, i.e. it
{   begins with :family_name, contains no blanks, and separates each name with
{   a period.

  PROCEDURE [XDCL, #GATE] pfp$convert_pf_cy_path_to_strng
    (    path: pft$path;
         cycle_number: fst$cycle_number;
     VAR path_name: ost$string);

    VAR
      cycle_string: string (6),
      cycle_string_length: integer,
      found: boolean,
      last_name_length: ost$name_size,
      path_index: pft$array_index,
      path_name_length: integer,
      space_index: 1 .. osc$max_name_size + 1;

    path_name_length := 0;

    #SCAN (pfv$space_character, path [UPPERBOUND (path)], space_index, found);
    IF space_index = 1 THEN
      last_name_length := 2;
    ELSE
      last_name_length := space_index - 1;
    IFEND;

    STRINGREP (cycle_string, cycle_string_length, cycle_number);
    cycle_string (1) := '.';

    FOR path_index := pfc$family_name_index TO UPPERBOUND (path) DO
      IF (path [path_index] = osc$null_name) OR (path [path_index] = '') THEN
        path_name.value (path_name_length + 1, 2) := '.?';
        path_name_length := path_name_length + 2;
      ELSEIF path_index = UPPERBOUND (path) THEN
        STRINGREP (path_name.value, path_name_length, path_name.value (1, path_name_length),
              '.', path [UPPERBOUND (path)] (1, last_name_length), cycle_string (1, cycle_string_length));
      ELSE
        #SCAN (pfv$space_character, path [path_index], space_index, found);
        IF path_name_length + space_index + (2 * ((UPPERBOUND (path) - 1) - path_index)) +
              (last_name_length + 1) + cycle_string_length <= osc$max_string_size THEN
          STRINGREP (path_name.value, path_name_length, path_name.value (1, path_name_length),
                '.', path [path_index] (1, space_index - 1));
        ELSE
          {
          { The path name would be too long, so a '?' is substituted for this
          { name in the path.
          {
          path_name.value (path_name_length + 1, 2) := '.?';
          path_name_length := path_name_length + 2;
        IFEND;
      IFEND;
    FOREND;

    path_name.value (1) := ':';
    path_name.size := path_name_length;
  PROCEND pfp$convert_pf_cy_path_to_strng;

?? TITLE := '  [XDCL, #GATE] pfp$convert_pf_path_to_fs_path', EJECT ??
{ PURPOSE:
{   This procedure converts a complete path to an fs path.  The fs path is
{   suitable for printing and follows the standard form, i.e. it begins with
{   :family_name, contains no blanks, and separates each name with a period.
{
{ NOTE:
{   A set name is expected to be the first name in the complete path, but is
{   not included in the fs path.

  PROCEDURE [XDCL, #GATE] pfp$convert_pf_path_to_fs_path
    (    pf_path: pft$complete_path;
     VAR fs_path: fst$path;
     VAR fs_path_size: fst$path_size);

    VAR
      found: boolean,
      fs_path_length: integer,
      last_name_length: ost$name_size,
      pf_path_index: pft$array_index,
      space_index: 1 .. osc$max_name_size + 1;

    fs_path_length := 0;

    #SCAN (pfv$space_character, pf_path [UPPERBOUND (pf_path)], space_index, found);
    IF space_index = 1 THEN
      last_name_length := 2;
    ELSE
      last_name_length := space_index - 1;
    IFEND;

    FOR pf_path_index := pfc$family_path_index TO UPPERBOUND (pf_path) DO
      IF (pf_path [pf_path_index] = osc$null_name) OR (pf_path [pf_path_index] = '') THEN
        fs_path (fs_path_length + 1, 2) := '.?';
        fs_path_length := fs_path_length + 2;
      ELSEIF pf_path_index = UPPERBOUND (pf_path) THEN
        STRINGREP (fs_path, fs_path_length, fs_path (1, fs_path_length), '.',
              pf_path [UPPERBOUND (pf_path)] (1, last_name_length));
      ELSE
        #SCAN (pfv$space_character, pf_path [pf_path_index], space_index, found);
        IF fs_path_length + space_index + (2 * ((UPPERBOUND (pf_path) - 1) - pf_path_index)) +
              (last_name_length + 1) <= fsc$max_path_size THEN
          STRINGREP (fs_path, fs_path_length, fs_path (1, fs_path_length), '.', pf_path [pf_path_index]
                (1, space_index - 1));
        ELSE
          {
          { The fs path would be too long, so a '?' is substituted for this
          { name in the path.
          {
          fs_path (fs_path_length + 1, 2) := '.?';
          fs_path_length := fs_path_length + 2;
        IFEND;
      IFEND;
    FOREND;

    fs_path (1) := ':';
    fs_path_size := fs_path_length;
  PROCEND pfp$convert_pf_path_to_fs_path;

?? TITLE := '  [XDCL, #GATE] pfp$convert_pft$path_to_fs_path', EJECT ??
{ PURPOSE:
{   This procedure converts a pf path to an fs path.  The fs path is suitable
{   for printing and follows the standard form, i.e. it begins with
{   :family_name, contains no blanks, and separates each name with a period.

  PROCEDURE [XDCL, #GATE] pfp$convert_pft$path_to_fs_path
    (    pf_path: pft$path;
     VAR fs_path: fst$path;
     VAR fs_path_size: fst$path_size);

    VAR
      found: boolean,
      fs_path_length: integer,
      last_name_length: ost$name_size,
      pf_path_index: pft$array_index,
      space_index: 1 .. osc$max_name_size + 1;

    fs_path_length := 0;

    #SCAN (pfv$space_character, pf_path [UPPERBOUND (pf_path)], space_index, found);
    IF space_index = 1 THEN
      last_name_length := 2;
    ELSE
      last_name_length := space_index - 1;
    IFEND;

    FOR pf_path_index := pfc$family_name_index TO UPPERBOUND (pf_path) DO
      IF (pf_path [pf_path_index] = osc$null_name) OR (pf_path [pf_path_index] = '') THEN
        fs_path (fs_path_length + 1, 2) := '.?';
        fs_path_length := fs_path_length + 2;
      ELSEIF pf_path_index = UPPERBOUND (pf_path) THEN
        STRINGREP (fs_path, fs_path_length, fs_path (1, fs_path_length), '.',
              pf_path [UPPERBOUND (pf_path)] (1, last_name_length));
      ELSE
        #SCAN (pfv$space_character, pf_path [pf_path_index], space_index, found);
        IF fs_path_length + space_index + (2 * ((UPPERBOUND (pf_path) - 1) - pf_path_index)) +
              (last_name_length + 1) <= fsc$max_path_size THEN
          STRINGREP (fs_path, fs_path_length, fs_path (1, fs_path_length), '.', pf_path [pf_path_index]
                (1, space_index - 1));
        ELSE
          {
          { The fs path would be too long, so a '?' is substituted for this
          { name in the path.
          {
          fs_path (fs_path_length + 1, 2) := '.?';
          fs_path_length := fs_path_length + 2;
        IFEND;
      IFEND;
    FOREND;

    fs_path (1) := ':';
    fs_path_size := fs_path_length;
  PROCEND pfp$convert_pft$path_to_fs_path;

?? TITLE := '  [XDCL, #GATE] pfp$convert_pft$path_to_fs_str', EJECT ??

  PROCEDURE [XDCL, #GATE] pfp$convert_pft$path_to_fs_str
    (    path: pft$path;
     VAR evaluated_file_reference: fst$evaluated_file_reference);

    VAR
      element_index: fst$number_of_path_elements,
      found: boolean,
      path_index: fst$path_index,
      space_index: 1 .. osc$max_name_size + 1;

    evaluated_file_reference := fsv$evaluated_file_reference;
    IF UPPERBOUND (path) <= fsc$max_path_elements THEN
      evaluated_file_reference.number_of_path_elements := UPPERBOUND (path);
    ELSE
      evaluated_file_reference.number_of_path_elements := fsc$max_path_elements;
    IFEND;

    path_index := 1;

    FOR element_index := 1 TO evaluated_file_reference.number_of_path_elements DO
      #SCAN (pfv$space_character, path [element_index], space_index, found);
      evaluated_file_reference.path_structure (path_index) := $CHAR (space_index - 1);
      evaluated_file_reference.path_structure (path_index + 1, space_index - 1) := path [element_index]
            (1, space_index - 1);
      path_index := path_index + space_index;
    FOREND;

    evaluated_file_reference.path_structure_size := path_index - 1;
  PROCEND pfp$convert_pft$path_to_fs_str;

?? TITLE := '  [XDCL, #GATE] pfp$convert_pft$path_to_string', EJECT ??
{ PURPOSE:
{   This procedure converts a path to a string.  The string is a path name
{   suitable for printing and follows the standard form, i.e. it begins with
{   :family_name, contains no blanks, and separates each name with a period.

  PROCEDURE [XDCL, #GATE] pfp$convert_pft$path_to_string
    (    path: pft$path;
     VAR path_name: ost$string);

    VAR
      found: boolean,
      last_name_length: ost$name_size,
      path_index: pft$array_index,
      path_name_length: integer,
      space_index: 1 .. osc$max_name_size + 1;

    path_name_length := 0;

    #SCAN (pfv$space_character, path [UPPERBOUND (path)], space_index, found);
    IF space_index = 1 THEN
      last_name_length := 2;
    ELSE
      last_name_length := space_index - 1;
    IFEND;

    FOR path_index := pfc$family_name_index TO UPPERBOUND (path) DO
      IF (path [path_index] = osc$null_name) OR (path [path_index] = '') THEN
        path_name.value (path_name_length + 1, 2) := '.?';
        path_name_length := path_name_length + 2;
      ELSEIF path_index = UPPERBOUND (path) THEN
        STRINGREP (path_name.value, path_name_length, path_name.value (1, path_name_length),
              '.', path [UPPERBOUND (path)] (1, last_name_length));
      ELSE
        #SCAN (pfv$space_character, path [path_index], space_index, found);
        IF path_name_length + space_index + (2 * ((UPPERBOUND (path) - 1) - path_index)) +
              (last_name_length + 1) <= osc$max_string_size THEN
          STRINGREP (path_name.value, path_name_length, path_name.value (1, path_name_length),
                '.', path [path_index] (1, space_index - 1));
        ELSE
          {
          { The path name would be too long, so a '?' is substituted for this
          { name in the path.
          {
          path_name.value (path_name_length + 1, 2) := '.?';
          path_name_length := path_name_length + 2;
        IFEND;
      IFEND;
    FOREND;

    path_name.value (1) := ':';
    path_name.size := path_name_length;
  PROCEND pfp$convert_pft$path_to_string;

?? TITLE := '  [XDCL, #GATE] pfp$display_memory_to_log', EJECT ??

  PROCEDURE [XDCL, #GATE] pfp$display_memory_to_log
    (    address: ^cell;
         bytes: ost$segment_length);

    CONST
      bytes_in_item = 8,
      fixed = size_of_address_parameter + spaces_before_memory_contents,
      page_width = 74,
      size_of_address_parameter = 8,
      spaces_before_memory_contents = 3,
      space_for_numeric_byte = 2,
      space_for_numeric_item = bytes_in_item * space_for_numeric_byte + 6,
      space_for_ascii_item = bytes_in_item;


    PROCEDURE [INLINE] convert_byte_to_hex_string
      (    byte: 0 .. 0ff(16);
       VAR str: string (2));

      VAR
        ptr: ^packed record
          left: 0 .. 0f(16),
          right: 0 .. 0f(16)
        recend;

      ptr := #LOC (byte);
      str (1) := hex_chars [ptr^.left];
      str (2) := hex_chars [ptr^.right];

    PROCEND convert_byte_to_hex_string;

    VAR
      ascii_tab_column: 1 .. 256,
      byte: ^0 .. 0ff(16),
      byte_count: 1 .. 2,
      bytes_displayed: integer,
      bytes_this_line: 0 .. 132,
      char_index: 0 .. 255,
      current_item: 1 .. 63,
      display_address: ost$segment_length,
      first_item: ^cell,
      first_line: boolean,
      half_words: 1 .. 2,
      half_half_words: 1 .. 2,
      hex_chars: [oss$job_paged_literal, READ] array [0 .. 0f(16)] of char := ['0', '1', '2', '3', '4', '5',
            '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'],
      item_ascii: ^string ( * ),
      items_per_line: 0 .. 100,
      line_buffer: ^string ( * ),
      line_index: 1 .. 256,
      log_string_length: integer,
      local_status: ost$status,
      p_memory: ^SEQ ( * ),
      log_string: string (osc$max_string_size);

    IF bytes = 0 THEN
      RETURN; {----->
    IFEND;

    items_per_line := (page_width - fixed) DIV (space_for_ascii_item + space_for_numeric_item);
    ascii_tab_column := fixed + (items_per_line * space_for_numeric_item) + 1;

    PUSH line_buffer: [page_width];

    STRINGREP (log_string, log_string_length, ' *  segment = ', #SEGMENT (address): #(16), '(16)',
          ' length = ', bytes: #(16), '(16)');
    pfp$log_ascii (log_string (1, log_string_length), $pmt$ascii_logset [pmc$system_log, pmc$job_log],
          pmc$msg_origin_system, {critical_message} FALSE, local_status);

    i#build_adaptable_seq_pointer (#RING (address), #SEGMENT (address), #OFFSET (address),
          bytes, 0, p_memory);

    display_address := #OFFSET (address);
    bytes_displayed := 0;
    bytes_this_line := items_per_line * space_for_ascii_item;
    first_line := TRUE;

    REPEAT

    /display_items/
      WHILE TRUE DO
        line_buffer^ := ' *  ';
        line_index := 5;
        clp$convert_integer_to_rjstring (display_address, 16, FALSE, '0',
              line_buffer^ (line_index, size_of_address_parameter), local_status);
        IF NOT local_status.normal THEN
          EXIT /display_items/; {----->
        IFEND;
        line_index := line_index + size_of_address_parameter + spaces_before_memory_contents;
        NEXT byte IN p_memory;
        first_item := byte;
        RESET p_memory TO first_item;
        bytes_this_line := 0;

      /format_numeric/
        FOR current_item := 1 TO items_per_line DO
          FOR half_words := 1 TO 2 DO
            FOR half_half_words := 1 TO 2 DO
              FOR byte_count := 1 TO 2 DO
                NEXT byte IN p_memory;
                convert_byte_to_hex_string (byte^, line_buffer^ (line_index, 2));
                line_index := line_index + 2;
                bytes_this_line := bytes_this_line + 1;
                bytes_displayed := bytes_displayed + 1;
                IF bytes_displayed >= bytes THEN
                  IF first_line THEN
                    line_index := line_index + 3;
                  ELSE
                    line_index := ascii_tab_column;
                  IFEND;
                  EXIT /format_numeric/; {----->
                IFEND;
              FOREND;
              line_index := line_index + 1;
            FOREND;
          FOREND;
          line_index := line_index + 2;
        FOREND /format_numeric/;
        RESET p_memory TO first_item;
        NEXT item_ascii: [bytes_this_line] IN p_memory;
        #TRANSLATE (control_codes_translation, item_ascii^, line_buffer^ (line_index, bytes_this_line));
        pfp$log_ascii (line_buffer^ (1, * ), $pmt$ascii_logset [pmc$system_log, pmc$job_log],
              pmc$msg_origin_system, {critical_message} FALSE, local_status);
        display_address := display_address + bytes_this_line;
        IF bytes_displayed >= bytes THEN
          EXIT /display_items/; {----->
        IFEND;
        first_line := FALSE;
      WHILEND /display_items/;
      {display_count := display_count - bytes_returned;
      {offset := offset + bytes_returned;
    UNTIL bytes_displayed >= bytes;
  PROCEND pfp$display_memory_to_log;

?? TITLE := '  [XDCL, #GATE] pfp$log_ascii', EJECT ??

  PROCEDURE [XDCL, #GATE] pfp$log_ascii
    (    text: string ( * );
         ascii_logset: pmt$ascii_logset;
         message_origin: pmt$log_msg_origin;
         critical_message: boolean;
     VAR status: ost$status);

    CONST
      critical_window_width = 71,
      log_width = 116;

    VAR
      print_line_index: ost$positive_integers,
      print_line_length: amt$page_width,
      remaining_text_index: ost$positive_integers,
      remaining_text_length: ost$non_negative_integers,
      trimmed_text_index: ost$positive_integers,
      trimmed_text_length: ost$non_negative_integers;

    trimmed_text_length := STRLENGTH (text);

    IF trimmed_text_length <> 0 THEN
      trimmed_text_index := 1;
      trim_beginning_blanks (^text, trimmed_text_index, trimmed_text_length);
    IFEND;

    IF trimmed_text_length = 0 THEN
      pmp$log_ascii (' ', ascii_logset, message_origin, status);
      IF critical_message THEN
        dpp$put_critical_message (' ', status);
      IFEND;
    ELSE
      remaining_text_index := trimmed_text_index;
      remaining_text_length := trimmed_text_length;

      REPEAT
        format_text (^text, log_width, remaining_text_index, remaining_text_length, print_line_index,
              print_line_length);
        pmp$log_ascii (text (print_line_index, print_line_length), ascii_logset, message_origin, status);
      UNTIL remaining_text_length = 0;

      IF critical_message THEN
        remaining_text_index := trimmed_text_index;
        remaining_text_length := trimmed_text_length;

        REPEAT
          format_text (^text, critical_window_width, remaining_text_index, remaining_text_length,
                print_line_index, print_line_length);
          dpp$put_critical_message (text (print_line_index, print_line_length), status);
        UNTIL remaining_text_length = 0;
      IFEND;
    IFEND;
  PROCEND pfp$log_ascii;

?? TITLE := '  [XDCL, #GATE] pfp$log_status', EJECT ??

  PROCEDURE [XDCL, #GATE] pfp$log_status
    (    ascii_logset: pmt$ascii_logset;
         log_status: ost$status);

    VAR
      ignore_status: ost$status;

    osp$generate_log_message (ascii_logset, log_status, ignore_status);

  PROCEND pfp$log_status;

?? TITLE := '  [XDCL, #GATE] pfp$log_error', EJECT ??

  PROCEDURE [XDCL, #GATE] pfp$log_error
    (    status: ost$status;
         ascii_logset: pmt$ascii_logset;
         message_origin: pmt$log_msg_origin;
         critical_message: boolean);

    VAR
      local_status: ost$status,
      message: ost$status_message,
      message_line_index: 1 .. osc$max_status_message_lines,
      p_message: ^ost$status_message,
      p_message_line: ^ost$status_message_line,
      p_message_line_count: ^ost$status_message_line_count,
      p_message_line_size: ^ost$status_message_line_size;

    osp$format_message (status, osc$full_message_level, osc$max_status_message_line, message, local_status);
    IF local_status.normal THEN
      p_message := ^message;
      RESET p_message;
      NEXT p_message_line_count IN p_message;

      FOR message_line_index := 1 TO p_message_line_count^ DO
        NEXT p_message_line_size IN p_message;
        NEXT p_message_line: [p_message_line_size^] IN p_message;
        pfp$log_ascii (p_message_line^, ascii_logset, message_origin, critical_message, local_status);
        IF NOT local_status.normal THEN
          RETURN; {----->
        IFEND;
      FOREND;
    IFEND;
  PROCEND pfp$log_error;

?? TITLE := '  [XDCL, #GATE] pfp$log_path', EJECT ??

  PROCEDURE [XDCL, #GATE] pfp$log_path
    (    variant_path: pft$variant_path;
         ascii_logset: pmt$ascii_logset;
         message_origin: pmt$log_msg_origin;
         critical_message: boolean;
     VAR status: ost$status);

    VAR
      fs_path_size: fst$path_size,
      p_fs_path: ^fst$path;

    PUSH p_fs_path;

    IF variant_path.complete_path THEN
      pfp$convert_pf_path_to_fs_path (variant_path.p_complete_path^, p_fs_path^, fs_path_size);
    ELSE
      pfp$convert_pft$path_to_fs_path (variant_path.p_path^, p_fs_path^, fs_path_size);
    IFEND;

    pfp$log_ascii (p_fs_path^ (1, fs_path_size), ascii_logset, message_origin, critical_message, status);

  PROCEND pfp$log_path;

?? TITLE := '  [XDCL, #GATE] pfp$report_system_error', EJECT ??
{ PURPOSE:
{   The purpose of this procedure is to report a system error and to map the
{   status to pfe$pf_system_error.

  PROCEDURE [XDCL, #GATE] pfp$report_system_error
    (VAR status: ost$status);

    VAR
      condition_code: ost$status_condition_number,
      condition_identifier: ost$status_identifier,
      local_status: ost$status;

    osp$recoverable_system_error ('UNEXPECTED STATUS', ^status);
    local_status := status;
    osp$set_status_abnormal (pfc$permanent_file_manager_id, pfe$pf_system_error, 'Unexpected status.',
          status);
    osp$unpack_status_condition (local_status.condition, condition_identifier, condition_code);
    osp$append_status_parameter (osc$status_parameter_delimiter, condition_identifier, status);
    osp$append_status_integer (osc$status_parameter_delimiter, condition_code, {radix} 10,
          {include_radix} FALSE, status);
    osp$append_status_parameter (osc$status_parameter_delimiter, local_status.text.
          value (1, local_status.text.size), status);
  PROCEND pfp$report_system_error;

?? TITLE := '  [XDCL, #GATE] pfp$report_unexpected_status', EJECT ??
{ NOTE:
{   An INLINE procedure has been added which replaces this procedure, but this
{   procedure must remain until all products which use it, or which use
{   pfp$process_unexpected_status, have been recompiled, post build_19226, to
{   allow the loader to satisfy the references.  This procedure and the *copyc
{   for dfe$error_condition_codes, for dmt$error_condition_codes, and for
{   mme$condition_codes should be deleted once all of the recompilations have
{   occurred.

  PROCEDURE [XDCL, #GATE] pfp$report_unexpected_status
    (VAR status: ost$status);

    VAR
      condition_code: ost$status_condition_number,
      condition_identifier: ost$status_identifier,
      local_status: ost$status;

    IF (status.condition <> dme$unable_to_alloc_all_space) AND (status.condition <> dfe$server_not_active) AND
          (status.condition <> dfe$server_has_terminated) AND
          (status.condition <> dfe$server_request_terminated) AND
          (status.condition <> dme$volume_unavailable) AND (status.condition <> mme$segment_table_is_full) AND
          (status.condition <> mme$volume_unavailable) THEN
      osp$recoverable_system_error ('UNEXPECTED STATUS', ^status);
      local_status := status;
      osp$set_status_abnormal (pfc$permanent_file_manager_id, pfe$pf_system_error, 'Unexpected status.',
            status);
      osp$unpack_status_condition (local_status.condition, condition_identifier, condition_code);
      osp$append_status_parameter (osc$status_parameter_delimiter, condition_identifier, status);
      osp$append_status_integer (osc$status_parameter_delimiter, condition_code, 10, FALSE, status);
      osp$append_status_parameter (osc$status_parameter_delimiter, local_status.text.
            value (1, local_status.text.size), status);
    IFEND;
  PROCEND pfp$report_unexpected_status;

?? TITLE := '  pfp$set_status_abnormal', EJECT ??
{ PURPOSE:
{   The purpose of this procedure is to construct a string representation of
{   a path and call osp$set_status_abnormal with the specified condition and
{   the path as the text field.

  PROCEDURE [XDCL, #GATE] pfp$set_status_abnormal
    (    variant_path: pft$variant_path;
         condition: ost$status_condition_code;
     VAR status: ost$status);

    VAR
      fs_path_size: fst$path_size,
      p_fs_path: ^fst$path;

    PUSH p_fs_path;

    IF variant_path.complete_path THEN
      pfp$convert_pf_path_to_fs_path (variant_path.p_complete_path^, p_fs_path^, fs_path_size);
    ELSE
      pfp$convert_pft$path_to_fs_path (variant_path.p_path^, p_fs_path^, fs_path_size);
    IFEND;

    osp$set_status_abnormal (pfc$permanent_file_manager_id, condition, p_fs_path^ (1, fs_path_size), status);
  PROCEND pfp$set_status_abnormal;

?? TITLE := '  [INLINE] format_text', EJECT ??

  PROCEDURE [INLINE] format_text
    (    p_text: ^string ( * );
         page_width: amt$page_width;
     VAR remaining_text_index: {i/o} ost$positive_integers;
     VAR remaining_text_length: {i/o} ost$non_negative_integers;
     VAR print_line_index: ost$positive_integers;
     VAR print_line_length: amt$page_width);

    VAR
      line_length: 0 .. amc$max_page_width;

    print_line_index := remaining_text_index;

    IF remaining_text_length <= page_width THEN
      print_line_length := remaining_text_length;
      remaining_text_length := 0;
    ELSE
      line_length := page_width;
      WHILE (line_length > 0) AND (p_text^ (remaining_text_index + line_length) <> ' ') DO
        line_length := line_length - 1;
      WHILEND;

      IF line_length = 0 THEN
        print_line_length := page_width;
        remaining_text_index := remaining_text_index + page_width;
        remaining_text_length := remaining_text_length - page_width;
      ELSE
        print_line_length := line_length;
        remaining_text_index := remaining_text_index + line_length;
        remaining_text_length := remaining_text_length - line_length;
        trim_beginning_blanks (p_text, remaining_text_index, remaining_text_length);
      IFEND;
    IFEND;
  PROCEND format_text;

?? TITLE := '  [INLINE] trim_beginning_blanks', EJECT ??

  PROCEDURE [INLINE] trim_beginning_blanks
    (    p_text: ^string ( * );
     VAR text_index: {i/o} ost$positive_integers;
     VAR text_length: {i/o} ost$non_negative_integers);

    VAR
      index: ost$positive_integers;

    index := text_index;

    WHILE (index < text_index + text_length) AND (p_text^ (index) = ' ') DO
      index := index + 1;
    WHILEND;

    text_length := text_length - index + text_index;
    text_index := index;
  PROCEND trim_beginning_blanks;

?? OLDTITLE, SKIP := 2 ??
MODEND pfm$report_unexpected_status;
