?? RIGHT := 110 ??
?? NEWTITLE := 'NOS/VE SCL Interpreter : Display Command or Function Info' ??
MODULE clm$display_cmnd_or_func_info;

{
{ PURPOSE:
{   This module contains the processors for the display_command_information and
{   display_function_information commands
{

?? NEWTITLE := 'Global Declarations', EJECT ??
?? PUSH (LISTEXT := ON) ??
*copyc amt$file_contents
*copyc cle$ecc_function_processing
*copyc cle$ecc_parameter_list
*copyc clt$command_name
*copyc clt$command_or_function_source
*copyc clt$parameter_help_context
*copyc clt$parameter_list
*copyc clt$unbundled_pdt
*IF $true(osv$unix)
*copyc cyt$mips_signal_handler
*IFEND
*copyc fst$path_size
*copyc ost$caller_identifier
*IF $true(osv$unix)
*copyc ost$status
*IFEND
?? POP ??
*copyc amp$put_next
*copyc clp$build_path_subtitle
*copyc clp$build_standard_title
*copyc clp$check_name_for_function
*copyc clp$close_display
*copyc clp$convert_data_to_string
*copyc clp$convert_integer_to_string
*copyc clp$convert_string_to_name
*copyc clp$data_representation_text
*copyc clp$evaluate_function
*copyc clp$evaluate_parameters
*copyc clp$find_command_entries
*copyc clp$find_command_list
*copyc clp$find_current_block
*IF NOT $true(osv$unix)
*copyc clp$get_path_name
*IFEND
*copyc clp$get_work_area
*copyc clp$horizontal_tab_display
*copyc clp$identify_lexical_units
*copyc clp$initialize_parse_state
*copyc clp$internal_convert_to_string
*copyc clp$new_display_line
*copyc clp$open_display_reference
*copyc clp$process_command
*copyc clp$put_display
*copyc clp$put_partial_display
*copyc clp$reset_for_next_display_page
*copyc clp$scan_non_space_lexical_unit
*copyc clp$set_help_mode
*copyc clp$trimmed_string_size
*IF NOT $true(osv$unix)
*copyc osp$disestablish_cond_handler
*copyc osp$enforce_exception_policies
*copyc osp$establish_block_exit_hndlr
*copyc osp$file_access_condition
*copyc osp$find_brief_help_message
*copyc osp$find_full_help_message
*copyc osp$find_help_module
*copyc osp$find_parameter_help_message
*copyc osp$format_help_message
*IFEND
*copyc osp$set_status_abnormal
*copyc clv$nil_display_control
*IF NOT $true(osv$unix)
*copyc clv$system_functions
*copyc clv$system_functions_v0
*ELSE
*copyc cle$ecc_command_processing
*IFEND
*IF NOT $true(osv$unix)
*copyc osv$initial_exception_context
*IFEND
*copyc osv$upper_to_lower

?? TITLE := 'clp$_display_command_informatio', EJECT ??

  PROCEDURE [XDCL] clp$_display_command_informatio
    (    parameter_list: clt$parameter_list;
     VAR status: ost$status);

*IF NOT $true(osv$unix)
{ PROCEDURE (osm$disci) display_command_information, disci (
{   command, c: command_reference = $required
{   output, o: file = $output
{   display_options, display_option, do: list of key
{       all
{       (all_names, all_name, an)
{       (source, s)
{       (brief_help, bh)
{       (full_help, fh)
{       (compact_parameter_descriptions, compact_parameter_description, cpd)
{       (parameter_descriptions, parameter_description, pd)
{       (parameter_help, ph)
{       (advanced_usage, au)
{     advanced_key
{       (help_module_seed, hms)
{     keyend = osd$disci_display_options, (all_names, brief_help, compact_parameter_descriptions)
{   status)

?? PUSH (LISTEXT := ON) ??

    VAR
      pdt: [STATIC, READ, cls$declaration_section] record
        header: clt$pdt_header,
        names: array [1 .. 8] of clt$pdt_parameter_name,
        parameters: array [1 .. 4] of clt$pdt_parameter,
        type1: record
          header: clt$type_specification_header,
        recend,
        type2: record
          header: clt$type_specification_header,
          default_value: string (7),
        recend,
        type3: record
          header: clt$type_specification_header,
          qualifier: clt$list_type_qualifier,
          element_type_spec: record
            header: clt$type_specification_header,
            qualifier: clt$keyword_type_qualifier,
            keyword_specs: array [1 .. 22] of clt$keyword_specification,
          recend,
          default_name: string (25),
          default_value: string (55),
        recend,
        type4: record
          header: clt$type_specification_header,
        recend,
      recend := [[1, [88, 10, 11, 17, 44, 34, 983], clc$command, 8, 4, 1, 0, 0, 0, 4, 'OSM$DISCI'],
            [['C                              ', clc$abbreviation_entry, 1],
            ['COMMAND                        ', clc$nominal_entry, 1],
            ['DISPLAY_OPTION                 ', clc$alias_entry, 3],
            ['DISPLAY_OPTIONS                ', clc$nominal_entry, 3],
            ['DO                             ', clc$abbreviation_entry, 3],
            ['O                              ', clc$abbreviation_entry, 2],
            ['OUTPUT                         ', clc$nominal_entry, 2],
            ['STATUS                         ', clc$nominal_entry, 4]], [

{ PARAMETER 1

      [2, clc$normal_usage_entry, clc$non_secure_parameter, $clt$parameter_spec_methods
            [clc$specify_by_name, clc$specify_positionally], clc$pass_by_value, clc$immediate_evaluation,
            clc$standard_parameter_checking, 3, clc$required_parameter, 0, 0],

{ PARAMETER 2

      [7, clc$normal_usage_entry, clc$non_secure_parameter, $clt$parameter_spec_methods
            [clc$specify_by_name, clc$specify_positionally], clc$pass_by_value, clc$immediate_evaluation,
            clc$standard_parameter_checking, 3, clc$optional_default_parameter, 0, 7],

{ PARAMETER 3

      [4, clc$normal_usage_entry, clc$non_secure_parameter, $clt$parameter_spec_methods
            [clc$specify_by_name, clc$specify_positionally], clc$pass_by_value, clc$immediate_evaluation,
            clc$standard_parameter_checking, 837, clc$optional_default_parameter, 25, 55],

{ PARAMETER 4

      [8, clc$normal_usage_entry, clc$non_secure_parameter, $clt$parameter_spec_methods [clc$specify_by_name],
            clc$pass_by_reference, clc$immediate_evaluation, clc$standard_parameter_checking, 3,
            clc$optional_parameter, 0, 0]],

{ PARAMETER 1

      [[1, 0, clc$command_reference_type]],

{ PARAMETER 2

      [[1, 0, clc$file_type], '$output'],

{ PARAMETER 3

      [[1, 0, clc$list_type], [821, 1, clc$max_list_size, FALSE],
            [[1, 0, clc$keyword_type], [22], [['ADVANCED_USAGE                 ', clc$nominal_entry,
            clc$normal_usage_entry, 9], ['ALL                            ', clc$nominal_entry,
            clc$normal_usage_entry, 1], ['ALL_NAME                       ', clc$alias_entry,
            clc$normal_usage_entry, 2], ['ALL_NAMES                      ', clc$nominal_entry,
            clc$normal_usage_entry, 2], ['AN                             ', clc$abbreviation_entry,
            clc$normal_usage_entry, 2], ['AU                             ', clc$abbreviation_entry,
            clc$normal_usage_entry, 9], ['BH                             ', clc$abbreviation_entry,
            clc$normal_usage_entry, 4], ['BRIEF_HELP                     ', clc$nominal_entry,
            clc$normal_usage_entry, 4], ['COMPACT_PARAMETER_DESCRIPTION  ', clc$alias_entry,
            clc$normal_usage_entry, 6], ['COMPACT_PARAMETER_DESCRIPTIONS ', clc$nominal_entry,
            clc$normal_usage_entry, 6], ['CPD                            ', clc$abbreviation_entry,
            clc$normal_usage_entry, 6], ['FH                             ', clc$abbreviation_entry,
            clc$normal_usage_entry, 5], ['FULL_HELP                      ', clc$nominal_entry,
            clc$normal_usage_entry, 5], ['HELP_MODULE_SEED               ', clc$nominal_entry,
            clc$advanced_usage_entry, 10], ['HMS                            ', clc$abbreviation_entry,
            clc$advanced_usage_entry, 10], ['PARAMETER_DESCRIPTION          ', clc$alias_entry,
            clc$normal_usage_entry, 7], ['PARAMETER_DESCRIPTIONS         ', clc$nominal_entry,
            clc$normal_usage_entry, 7], ['PARAMETER_HELP                 ', clc$nominal_entry,
            clc$normal_usage_entry, 8], ['PD                             ', clc$abbreviation_entry,
            clc$normal_usage_entry, 7], ['PH                             ', clc$abbreviation_entry,
            clc$normal_usage_entry, 8], ['S                              ', clc$abbreviation_entry,
            clc$normal_usage_entry, 3], ['SOURCE                         ', clc$nominal_entry,
            clc$normal_usage_entry, 3]]], 'OSD$DISCI_DISPLAY_OPTIONS',
            '(all_names, brief_help, compact_parameter_descriptions)'],

{ PARAMETER 4

      [[1, 0, clc$status_type]]];

?? POP ??

    CONST
      p$command = 1,
      p$output = 2,
      p$display_options = 3,
      p$status = 4;

    VAR
      pvt: array [1 .. 4] of clt$parameter_value;
*ELSE
{ PROCEDURE (osm$disci) display_command_information, disci (
{   command, c: command_reference = $required
{   output, o: file = $output
{   display_options, display_option, do: list of key
{       all
{       (all_names, all_name, an)
{       (source, s)
{       (compact_parameter_descriptions, compact_parameter_description, cpd)
{       (parameter_descriptions, parameter_description, pd)
{       (advanced_usage, au)
{       (man, m)
{     keyend = OSD_DISCI_DISPLAY_OPTIONS,
{     (all_names, compact_parameter_descriptions)
{   status)

?? PUSH (LISTEXT := ON) ??
?? FMT (FORMAT := OFF) ??

  VAR
    pdt: [STATIC, READ, cls$declaration_section] record
      header: clt$pdt_header,
      names: array [1 .. 8] of clt$pdt_parameter_name,
      parameters: array [1 .. 4] of clt$pdt_parameter,
      type1: record
        header: clt$type_specification_header,
      recend,
      type2: record
        header: clt$type_specification_header,
        default_value: ALIGNED [0 MOD 4] string (7),
      recend,
      type3: record
        header: clt$type_specification_header,
        qualifier: clt$list_type_qualifier_v2,
        element_type_spec: record
          header: clt$type_specification_header,
          qualifier: clt$keyword_type_qualifier,
          keyword_specs: array [1 .. 16] of clt$keyword_specification,
        recend,
        default_name: ALIGNED [0 MOD 4] string (25),
        default_value: ALIGNED [0 MOD 4] string (43),
      recend,
      type4: record
        header: clt$type_specification_header,
      recend,
    recend := [
    [2,
    [92, 5, 11, 11, 24, 28, 0],
    clc$command, 8, 4, 1, 0, 0, 0, 4, 'OSM$DISCI'], [
    ['C                              ',clc$abbreviation_entry, 1],
    ['COMMAND                        ',clc$nominal_entry, 1],
    ['DISPLAY_OPTION                 ',clc$alias_entry, 3],
    ['DISPLAY_OPTIONS                ',clc$nominal_entry, 3],
    ['DO                             ',clc$abbreviation_entry, 3],
    ['O                              ',clc$abbreviation_entry, 2],
    ['OUTPUT                         ',clc$nominal_entry, 2],
    ['STATUS                         ',clc$nominal_entry, 4]],
    [
{ PARAMETER 1
    [2, clc$normal_usage_entry, clc$non_secure_parameter,
    $clt$parameter_spec_methods[clc$specify_by_name, clc$specify_positionally],
    clc$pass_by_value, clc$immediate_evaluation,
  clc$standard_parameter_checking, 3, clc$required_parameter, 0, 0],
{ PARAMETER 2
    [7, clc$normal_usage_entry, clc$non_secure_parameter,
    $clt$parameter_spec_methods[clc$specify_by_name, clc$specify_positionally],
    clc$pass_by_value, clc$immediate_evaluation,
  clc$standard_parameter_checking, 3, clc$optional_default_parameter, 0, 7],
{ PARAMETER 3
    [4, clc$normal_usage_entry, clc$non_secure_parameter,
    $clt$parameter_spec_methods[clc$specify_by_name, clc$specify_positionally],
    clc$pass_by_value, clc$immediate_evaluation,
  clc$standard_parameter_checking, 676, clc$optional_default_parameter, 25, 43],
{ PARAMETER 4
    [8, clc$normal_usage_entry, clc$non_secure_parameter,
    $clt$parameter_spec_methods[clc$specify_by_name],
    clc$pass_by_reference, clc$immediate_evaluation,
  clc$standard_parameter_checking, 3, clc$optional_parameter, 0, 0]],
{ PARAMETER 1
    [[2, 0, clc$command_reference_type]],
{ PARAMETER 2
    [[2, 0, clc$file_type],
    '$output'],
{ PARAMETER 3
    [[2, 0, clc$list_type], [648, 1, clc$max_list_size, 0, FALSE, FALSE],
      [[2, 0, clc$keyword_type], [16], [
      ['ADVANCED_USAGE                 ', clc$nominal_entry,
  clc$normal_usage_entry, 6],
      ['ALL                            ', clc$nominal_entry,
  clc$normal_usage_entry, 1],
      ['ALL_NAME                       ', clc$alias_entry,
  clc$normal_usage_entry, 2],
      ['ALL_NAMES                      ', clc$nominal_entry,
  clc$normal_usage_entry, 2],
      ['AN                             ', clc$abbreviation_entry,
  clc$normal_usage_entry, 2],
      ['AU                             ', clc$abbreviation_entry,
  clc$normal_usage_entry, 6],
      ['COMPACT_PARAMETER_DESCRIPTION  ', clc$alias_entry,
  clc$normal_usage_entry, 4],
      ['COMPACT_PARAMETER_DESCRIPTIONS ', clc$nominal_entry,
  clc$normal_usage_entry, 4],
      ['CPD                            ', clc$abbreviation_entry,
  clc$normal_usage_entry, 4],
      ['M                              ', clc$abbreviation_entry,
  clc$normal_usage_entry, 7],
      ['MAN                            ', clc$nominal_entry,
  clc$normal_usage_entry, 7],
      ['PARAMETER_DESCRIPTION          ', clc$alias_entry,
  clc$normal_usage_entry, 5],
      ['PARAMETER_DESCRIPTIONS         ', clc$nominal_entry,
  clc$normal_usage_entry, 5],
      ['PD                             ', clc$abbreviation_entry,
  clc$normal_usage_entry, 5],
      ['S                              ', clc$abbreviation_entry,
  clc$normal_usage_entry, 3],
      ['SOURCE                         ', clc$nominal_entry,
  clc$normal_usage_entry, 3]]
      ]
    ,
    'OSD_DISCI_DISPLAY_OPTIONS',
    '(all_names, compact_parameter_descriptions)'],
{ PARAMETER 4
    [[2, 0, clc$status_type]]];

?? FMT (FORMAT := ON) ??
?? POP ??

    CONST
      p$command = 1,
      p$output = 2,
      p$display_options = 3,
      p$status = 4;

    VAR
      pvt: array [1 .. 4] of clt$parameter_value;
*IFEND

    VAR
      current_block: ^clt$block,
      display_option: clt$keyword,
      help_output_options: clt$parameter_help_options,
*IF $true(osv$unix)
      file_reference: fst$path,
*IFEND
      ignore_cause_condition: clt$when_condition,
      lexical_units: ^clt$lexical_units,
      options: ^clt$data_value,
      parse: clt$parse_state,
      representation: ^clt$data_representation,
      representation_text: ^clt$command_line,
      work_area: ^^clt$work_area;


    clp$evaluate_parameters (parameter_list, #SEQ (pdt), NIL, ^pvt, status);
    IF NOT status.normal THEN
      RETURN;
    IFEND;

*IF NOT $true(osv$unix)
    clp$get_work_area (#RING (^work_area), work_area, status);
*ELSE
    clp$get_work_area (osc$user_ring, work_area, status);
*IFEND
    IF NOT status.normal THEN
      RETURN;
    IFEND;

    clp$convert_data_to_string (pvt [p$command].value, clc$data_source_representation, clc$max_string_size,
          work_area^, representation, status);
    IF NOT status.normal THEN
      RETURN;
    IFEND;
    representation_text := clp$data_representation_text (representation);

    clp$identify_lexical_units (representation_text, work_area^, lexical_units, status);
    IF NOT status.normal THEN
      RETURN;
    IFEND;
    clp$initialize_parse_state (representation_text, lexical_units, parse);
    clp$scan_non_space_lexical_unit (parse);

    help_output_options := $clt$parameter_help_options [];
    options := pvt [p$display_options].value;
    WHILE options <> NIL DO
      display_option := options^.element_value^.keyword_value;
      IF display_option = 'ALL' THEN
*IF $true(osv$unix)
        help_output_options := -$clt$parameter_help_options [clc$ph_man];
*ELSE
        help_output_options := -$clt$parameter_help_options [];
*IFEND
      ELSEIF display_option = 'ALL_NAMES' THEN
        help_output_options := help_output_options + $clt$parameter_help_options [clc$ph_all_names];
      ELSEIF display_option = 'SOURCE' THEN
        help_output_options := help_output_options + $clt$parameter_help_options [clc$ph_source];
      ELSEIF display_option = 'BRIEF_HELP' THEN
        help_output_options := help_output_options + $clt$parameter_help_options [clc$ph_brief_help];
      ELSEIF display_option = 'FULL_HELP' THEN
        help_output_options := help_output_options + $clt$parameter_help_options [clc$ph_full_help];
      ELSEIF display_option = 'COMPACT_PARAMETER_DESCRIPTIONS' THEN
        help_output_options := help_output_options + $clt$parameter_help_options
              [clc$ph_compact_par_descriptions];
      ELSEIF display_option = 'PARAMETER_DESCRIPTIONS' THEN
        help_output_options := help_output_options + $clt$parameter_help_options
              [clc$ph_parameter_descriptions];
      ELSEIF display_option = 'PARAMETER_HELP' THEN
        help_output_options := help_output_options + $clt$parameter_help_options [clc$ph_parameter_help];
      ELSEIF display_option = 'ADVANCED_USAGE' THEN
        help_output_options := help_output_options + $clt$parameter_help_options [clc$ph_advanced_usage];
      ELSEIF display_option = 'HELP_MODULE_SEED' THEN
        help_output_options := help_output_options + $clt$parameter_help_options [clc$ph_help_module_name];
*IF $true(osv$unix)
      ELSEIF display_option = 'MAN' THEN
        help_output_options := help_output_options + $clt$parameter_help_options [clc$ph_man];
*IFEND
      IFEND;
      options := options^.link;
    WHILEND;

    clp$set_help_mode (pvt [p$output].value^.file_value, help_output_options);

    clp$find_current_block (current_block);

    clp$process_command (current_block, clc$help_mode, FALSE, FALSE, FALSE, FALSE, parse,
          ignore_cause_condition, status);
    IF (NOT status.normal) AND (status.condition = cle$parameters_displayed) THEN
      status.normal := TRUE;
    IFEND;

  PROCEND clp$_display_command_informatio;
?? TITLE := 'clp$_display_function_informati', EJECT ??

  PROCEDURE [XDCL] clp$_display_function_informati
    (    parameter_list: clt$parameter_list;
     VAR status: ost$status);

*IF NOT $true(osv$unix)
{ PROCEDURE (osm$disfi) display_function_information, disfi (
{   function, f: data_name = $required
{   output, o: file = $output
{   display_options, display_option, do: list of key
{       all
{       (all_names, all_name, an)
{       (source, s)
{       (brief_help, bh)
{       (full_help, fh)
{       (compact_parameter_descriptions, compact_parameter_description, cpd)
{       (parameter_descriptions, parameter_description, pd)
{       (parameter_help, ph)
{       (advanced_usage, au)
{     advanced_key
{       (help_module_seed, hms)
{     keyend = osd$disfi_display_options, (all_names, brief_help, compact_parameter_descriptions)
{   status)

?? PUSH (LISTEXT := ON) ??

    VAR
      pdt: [STATIC, READ, cls$declaration_section] record
        header: clt$pdt_header,
        names: array [1 .. 8] of clt$pdt_parameter_name,
        parameters: array [1 .. 4] of clt$pdt_parameter,
        type1: record
          header: clt$type_specification_header,
        recend,
        type2: record
          header: clt$type_specification_header,
          default_value: string (7),
        recend,
        type3: record
          header: clt$type_specification_header,
          qualifier: clt$list_type_qualifier,
          element_type_spec: record
            header: clt$type_specification_header,
            qualifier: clt$keyword_type_qualifier,
            keyword_specs: array [1 .. 22] of clt$keyword_specification,
          recend,
          default_name: string (25),
          default_value: string (55),
        recend,
        type4: record
          header: clt$type_specification_header,
        recend,
      recend := [[1, [88, 10, 11, 17, 44, 8, 796], clc$command, 8, 4, 1, 0, 0, 0, 4, 'OSM$DISFI'],
            [['DISPLAY_OPTION                 ', clc$alias_entry, 3],
            ['DISPLAY_OPTIONS                ', clc$nominal_entry, 3],
            ['DO                             ', clc$abbreviation_entry, 3],
            ['F                              ', clc$abbreviation_entry, 1],
            ['FUNCTION                       ', clc$nominal_entry, 1],
            ['O                              ', clc$abbreviation_entry, 2],
            ['OUTPUT                         ', clc$nominal_entry, 2],
            ['STATUS                         ', clc$nominal_entry, 4]], [

{ PARAMETER 1

      [5, clc$normal_usage_entry, clc$non_secure_parameter, $clt$parameter_spec_methods
            [clc$specify_by_name, clc$specify_positionally], clc$pass_by_value, clc$immediate_evaluation,
            clc$standard_parameter_checking, 3, clc$required_parameter, 0, 0],

{ PARAMETER 2

      [7, clc$normal_usage_entry, clc$non_secure_parameter, $clt$parameter_spec_methods
            [clc$specify_by_name, clc$specify_positionally], clc$pass_by_value, clc$immediate_evaluation,
            clc$standard_parameter_checking, 3, clc$optional_default_parameter, 0, 7],

{ PARAMETER 3

      [2, clc$normal_usage_entry, clc$non_secure_parameter, $clt$parameter_spec_methods
            [clc$specify_by_name, clc$specify_positionally], clc$pass_by_value, clc$immediate_evaluation,
            clc$standard_parameter_checking, 837, clc$optional_default_parameter, 25, 55],

{ PARAMETER 4

      [8, clc$normal_usage_entry, clc$non_secure_parameter, $clt$parameter_spec_methods [clc$specify_by_name],
            clc$pass_by_reference, clc$immediate_evaluation, clc$standard_parameter_checking, 3,
            clc$optional_parameter, 0, 0]],

{ PARAMETER 1

      [[1, 0, clc$data_name_type]],

{ PARAMETER 2

      [[1, 0, clc$file_type], '$output'],

{ PARAMETER 3

      [[1, 0, clc$list_type], [821, 1, clc$max_list_size, FALSE],
            [[1, 0, clc$keyword_type], [22], [['ADVANCED_USAGE                 ', clc$nominal_entry,
            clc$normal_usage_entry, 9], ['ALL                            ', clc$nominal_entry,
            clc$normal_usage_entry, 1], ['ALL_NAME                       ', clc$alias_entry,
            clc$normal_usage_entry, 2], ['ALL_NAMES                      ', clc$nominal_entry,
            clc$normal_usage_entry, 2], ['AN                             ', clc$abbreviation_entry,
            clc$normal_usage_entry, 2], ['AU                             ', clc$abbreviation_entry,
            clc$normal_usage_entry, 9], ['BH                             ', clc$abbreviation_entry,
            clc$normal_usage_entry, 4], ['BRIEF_HELP                     ', clc$nominal_entry,
            clc$normal_usage_entry, 4], ['COMPACT_PARAMETER_DESCRIPTION  ', clc$alias_entry,
            clc$normal_usage_entry, 6], ['COMPACT_PARAMETER_DESCRIPTIONS ', clc$nominal_entry,
            clc$normal_usage_entry, 6], ['CPD                            ', clc$abbreviation_entry,
            clc$normal_usage_entry, 6], ['FH                             ', clc$abbreviation_entry,
            clc$normal_usage_entry, 5], ['FULL_HELP                      ', clc$nominal_entry,
            clc$normal_usage_entry, 5], ['HELP_MODULE_SEED               ', clc$nominal_entry,
            clc$advanced_usage_entry, 10], ['HMS                            ', clc$abbreviation_entry,
            clc$advanced_usage_entry, 10], ['PARAMETER_DESCRIPTION          ', clc$alias_entry,
            clc$normal_usage_entry, 7], ['PARAMETER_DESCRIPTIONS         ', clc$nominal_entry,
            clc$normal_usage_entry, 7], ['PARAMETER_HELP                 ', clc$nominal_entry,
            clc$normal_usage_entry, 8], ['PD                             ', clc$abbreviation_entry,
            clc$normal_usage_entry, 7], ['PH                             ', clc$abbreviation_entry,
            clc$normal_usage_entry, 8], ['S                              ', clc$abbreviation_entry,
            clc$normal_usage_entry, 3], ['SOURCE                         ', clc$nominal_entry,
            clc$normal_usage_entry, 3]]], 'OSD$DISFI_DISPLAY_OPTIONS',
            '(all_names, brief_help, compact_parameter_descriptions)'],

{ PARAMETER 4

      [[1, 0, clc$status_type]]];

?? POP ??

    CONST
      p$function = 1,
      p$output = 2,
      p$display_options = 3,
      p$status = 4;

    VAR
      pvt: array [1 .. 4] of clt$parameter_value;
*ELSE
{ PROCEDURE (osm$disfi) display_function_information, disfi (
{   function, f: data_name = $required
{   output, o: file = $output
{   display_options, display_option, do: list of key
{       all
{       (all_names, all_name, an)
{       (source, s)
{       (compact_parameter_descriptions, compact_parameter_description, cpd)
{       (parameter_descriptions, parameter_description, pd)
{       (advanced_usage, au)
{     keyend = OSD_DISFI_DISPLAY_OPTIONS,
{     (all_names, compact_parameter_descriptions)
{   status)

?? PUSH (LISTEXT := ON) ??
?? FMT (FORMAT := OFF) ??

  VAR
    pdt: [STATIC, READ, cls$declaration_section] record
      header: clt$pdt_header,
      names: array [1 .. 8] of clt$pdt_parameter_name,
      parameters: array [1 .. 4] of clt$pdt_parameter,
      type1: record
        header: clt$type_specification_header,
      recend,
      type2: record
        header: clt$type_specification_header,
        default_value: ALIGNED [0 MOD 4] string (7),
      recend,
      type3: record
        header: clt$type_specification_header,
        qualifier: clt$list_type_qualifier_v2,
        element_type_spec: record
          header: clt$type_specification_header,
          qualifier: clt$keyword_type_qualifier,
          keyword_specs: array [1 .. 14] of clt$keyword_specification,
        recend,
        default_name: ALIGNED [0 MOD 4] string (25),
        default_value: ALIGNED [0 MOD 4] string (43),
      recend,
      type4: record
        header: clt$type_specification_header,
      recend,
    recend := [
    [2,
    [92, 5, 11, 11, 27, 26, 0],
    clc$command, 8, 4, 1, 0, 0, 0, 4, 'OSM$DISFI'], [
    ['DISPLAY_OPTION                 ',clc$alias_entry, 3],
    ['DISPLAY_OPTIONS                ',clc$nominal_entry, 3],
    ['DO                             ',clc$abbreviation_entry, 3],
    ['F                              ',clc$abbreviation_entry, 1],
    ['FUNCTION                       ',clc$nominal_entry, 1],
    ['O                              ',clc$abbreviation_entry, 2],
    ['OUTPUT                         ',clc$nominal_entry, 2],
    ['STATUS                         ',clc$nominal_entry, 4]],
    [
{ PARAMETER 1
    [5, clc$normal_usage_entry, clc$non_secure_parameter,
    $clt$parameter_spec_methods[clc$specify_by_name, clc$specify_positionally],
    clc$pass_by_value, clc$immediate_evaluation,
  clc$standard_parameter_checking, 3, clc$required_parameter, 0, 0],
{ PARAMETER 2
    [7, clc$normal_usage_entry, clc$non_secure_parameter,
    $clt$parameter_spec_methods[clc$specify_by_name, clc$specify_positionally],
    clc$pass_by_value, clc$immediate_evaluation,
  clc$standard_parameter_checking, 3, clc$optional_default_parameter, 0, 7],
{ PARAMETER 3
    [2, clc$normal_usage_entry, clc$non_secure_parameter,
    $clt$parameter_spec_methods[clc$specify_by_name, clc$specify_positionally],
    clc$pass_by_value, clc$immediate_evaluation,
  clc$standard_parameter_checking, 596, clc$optional_default_parameter, 25, 43],
{ PARAMETER 4
    [8, clc$normal_usage_entry, clc$non_secure_parameter,
    $clt$parameter_spec_methods[clc$specify_by_name],
    clc$pass_by_reference, clc$immediate_evaluation,
  clc$standard_parameter_checking, 3, clc$optional_parameter, 0, 0]],
{ PARAMETER 1
    [[2, 0, clc$data_name_type]],
{ PARAMETER 2
    [[2, 0, clc$file_type],
    '$output'],
{ PARAMETER 3
    [[2, 0, clc$list_type], [568, 1, clc$max_list_size, 0, FALSE, FALSE],
      [[2, 0, clc$keyword_type], [14], [
      ['ADVANCED_USAGE                 ', clc$nominal_entry,
  clc$normal_usage_entry, 6],
      ['ALL                            ', clc$nominal_entry,
  clc$normal_usage_entry, 1],
      ['ALL_NAME                       ', clc$alias_entry,
  clc$normal_usage_entry, 2],
      ['ALL_NAMES                      ', clc$nominal_entry,
  clc$normal_usage_entry, 2],
      ['AN                             ', clc$abbreviation_entry,
  clc$normal_usage_entry, 2],
      ['AU                             ', clc$abbreviation_entry,
  clc$normal_usage_entry, 6],
      ['COMPACT_PARAMETER_DESCRIPTION  ', clc$alias_entry,
  clc$normal_usage_entry, 4],
      ['COMPACT_PARAMETER_DESCRIPTIONS ', clc$nominal_entry,
  clc$normal_usage_entry, 4],
      ['CPD                            ', clc$abbreviation_entry,
  clc$normal_usage_entry, 4],
      ['PARAMETER_DESCRIPTION          ', clc$alias_entry,
  clc$normal_usage_entry, 5],
      ['PARAMETER_DESCRIPTIONS         ', clc$nominal_entry,
  clc$normal_usage_entry, 5],
      ['PD                             ', clc$abbreviation_entry,
  clc$normal_usage_entry, 5],
      ['S                              ', clc$abbreviation_entry,
  clc$normal_usage_entry, 3],
      ['SOURCE                         ', clc$nominal_entry,
  clc$normal_usage_entry, 3]]
      ]
    ,
    'OSD_DISFI_DISPLAY_OPTIONS',
    '(all_names, compact_parameter_descriptions)'],
{ PARAMETER 4
    [[2, 0, clc$status_type]]];

?? FMT (FORMAT := ON) ??
?? POP ??

    CONST
      p$function = 1,
      p$output = 2,
      p$display_options = 3,
      p$status = 4;

    VAR
      pvt: array [1 .. 4] of clt$parameter_value;
*IFEND

    VAR
      display_option: clt$keyword,
      dummy_text: ^clt$string_value,
*IF $true(osv$unix)
      file_reference: fst$path,
*IFEND
      found: boolean,
      help_output_options: clt$parameter_help_options,
      lexical_units: ^clt$lexical_units,
      lexical_work_area: ^clt$work_area,
      options: ^clt$data_value,
      parse: clt$parse_state,
      result: clt$function_result,
      work_area: ^^clt$work_area;


    clp$evaluate_parameters (parameter_list, #SEQ (pdt), NIL, ^pvt, status);
    IF NOT status.normal THEN
      RETURN;
    IFEND;

    help_output_options := $clt$parameter_help_options [];
    options := pvt [p$display_options].value;
    WHILE options <> NIL DO
      display_option := options^.element_value^.keyword_value;
      IF display_option = 'ALL' THEN
        help_output_options := -$clt$parameter_help_options [];
      ELSEIF display_option = 'ALL_NAMES' THEN
        help_output_options := help_output_options + $clt$parameter_help_options [clc$ph_all_names];
      ELSEIF display_option = 'SOURCE' THEN
        help_output_options := help_output_options + $clt$parameter_help_options [clc$ph_source];
      ELSEIF display_option = 'BRIEF_HELP' THEN
        help_output_options := help_output_options + $clt$parameter_help_options [clc$ph_brief_help];
      ELSEIF display_option = 'FULL_HELP' THEN
        help_output_options := help_output_options + $clt$parameter_help_options [clc$ph_full_help];
      ELSEIF display_option = 'COMPACT_PARAMETER_DESCRIPTIONS' THEN
        help_output_options := help_output_options + $clt$parameter_help_options
              [clc$ph_compact_par_descriptions];
      ELSEIF display_option = 'PARAMETER_DESCRIPTIONS' THEN
        help_output_options := help_output_options + $clt$parameter_help_options
              [clc$ph_parameter_descriptions];
      ELSEIF display_option = 'PARAMETER_HELP' THEN
        help_output_options := help_output_options + $clt$parameter_help_options [clc$ph_parameter_help];
      ELSEIF display_option = 'ADVANCED_USAGE' THEN
        help_output_options := help_output_options + $clt$parameter_help_options [clc$ph_advanced_usage];
      ELSEIF display_option = 'HELP_MODULE_SEED' THEN
        help_output_options := help_output_options + $clt$parameter_help_options [clc$ph_help_module_name];
      IFEND;
      options := options^.link;
    WHILEND;

    clp$set_help_mode (pvt [p$output].value^.file_value, help_output_options);

    PUSH dummy_text: [0];
    PUSH lexical_work_area: [[REP clc$lexical_units_size_pad OF clt$lexical_unit]];
    RESET lexical_work_area;
    clp$identify_lexical_units (dummy_text, lexical_work_area, lexical_units, status);
    IF NOT status.normal THEN
      RETURN;
    IFEND;
    clp$initialize_parse_state (dummy_text, lexical_units, parse);
    clp$scan_non_space_lexical_unit (parse);

*IF NOT $true(osv$unix)
    clp$get_work_area (#RING (^work_area), work_area, status);
*ELSE
    clp$get_work_area (osc$user_ring, work_area, status);
*IFEND
    IF NOT status.normal THEN
      RETURN;
    IFEND;
    clp$evaluate_function (FALSE, pvt [p$function].value^.data_name_value, NIL, parse, work_area^, result,
          found, status);
    IF status.normal AND (NOT found) THEN
      osp$set_status_abnormal ('CL', cle$unknown_function, pvt [p$function].value^.data_name_value, status);
    ELSEIF (NOT status.normal) AND (status.condition = cle$parameters_displayed) THEN
      status.normal := TRUE;
    IFEND;

  PROCEND clp$_display_function_informati;
?? TITLE := 'clp$display_cmnd_or_func_info', EJECT ??

  PROCEDURE [XDCL, #GATE] clp$display_cmnd_or_func_info
    (    default_file_contents: amt$file_contents;
         help_context: clt$parameter_help_context;
         command_or_function_source: clt$command_or_function_source;
         command_or_function_name: clt$command_name;
         pdt: clt$unbundled_pdt;
     VAR status: ost$status);

*copy clv$display_variables

    CONST
      header_length = 9;

?? NEWTITLE := 'abort_handler', EJECT ??

    PROCEDURE abort_handler
*IF $true(osv$unix)
      (    signal_no: integer;
           code: integer;
           p_sigcontext: ^cyt$mips_sigcontext);

      VAR
        ignore_status: ost$status;

      clp$close_display (display_control, ignore_status);
*ELSE
      (    condition: pmt$condition;
           condition_information: ^pmt$condition_information;
           save_area: ^ost$stack_frame_save_area;
       VAR handler_status: ost$status);


      clp$close_display (display_control, handler_status);
      handler_status.normal := TRUE;
*IFEND

    PROCEND abort_handler;
*copy clp$new_page_procedure
?? TITLE := 'put_subtitle ', EJECT ??

    PROCEDURE put_subtitle
      (VAR display_control: clt$display_control;
       VAR status: ost$status);

      VAR
        translated_command_name: ost$name;


      IF pdt.header^.command_or_function = clc$command THEN
        clp$put_partial_display (display_control, 'COMMAND ', clc$no_trim, amc$start, status);
      ELSE
        clp$put_partial_display (display_control, 'FUNCTION ', clc$no_trim, amc$start, status);
      IFEND;
      IF NOT status.normal THEN
        RETURN;
      IFEND;
      #TRANSLATE (osv$upper_to_lower, command_or_function_name, translated_command_name);
      clp$put_partial_display (display_control, translated_command_name, clc$trim, amc$terminate, status);
      IF NOT status.normal THEN
        RETURN;
      IFEND;

    PROCEND put_subtitle;
?? TITLE := 'display_all_names', EJECT ??

    PROCEDURE display_all_names
      (VAR status: ost$status);

      VAR
        index: integer,
        names: ^array [1 .. * ] of clt$command_name,
        separator: string (3),
        term_option: amt$term_option,
        translated_name: clt$command_name,
        trim_option: clt$trim_display_text_option;


      clp$get_all_cmnd_or_func_names (pdt.header^.command_or_function, command_or_function_source,
            command_or_function_name, work_area^, names, status);
      IF NOT status.normal THEN
        RETURN;
      IFEND;

      skip_line;
      put_partial_display ('Names:   ', clc$no_trim, amc$continue);

      separator := ',  ';
      trim_option := clc$trim;
      term_option := amc$continue;

      FOR index := 1 TO UPPERBOUND (names^) DO
        IF (display_control.column_number + clp$trimmed_string_size (names^ [index]) + 2) >
              display_control.page_width THEN
          clp$new_display_line (display_control, clc$next_display_line, status);
          IF NOT status.normal THEN
            RETURN;
          IFEND;
          clp$horizontal_tab_display (display_control, header_length + 1, status);
          IF NOT status.normal THEN
            RETURN;
          IFEND;
        IFEND;

        #TRANSLATE (osv$upper_to_lower, names^ [index], translated_name);
        put_partial_display (translated_name, trim_option, term_option);
        IF index = UPPERBOUND (names^) THEN
          term_option := amc$terminate;
          separator := '   ';
        IFEND;

        put_partial_display (separator, clc$no_trim, term_option);
      FOREND;

    PROCEND display_all_names;
?? TITLE := 'put_partial_display', EJECT ??

    PROCEDURE put_partial_display
      (    str: string ( * );
           trim_option: clt$trim_display_text_option;
           term_option: amt$term_option);


      clp$put_partial_display (display_control, str, trim_option, term_option, status);
      IF NOT status.normal THEN
        EXIT clp$display_cmnd_or_func_info;
      IFEND;

    PROCEND put_partial_display;
?? TITLE := 'display_source', EJECT ??

    PROCEDURE display_source
      (VAR status: ost$status);

      VAR
        chunk_count: 0 .. fsc$max_path_elements,
        display_chunks: clt$path_display_chunks,
        i: 0 .. fsc$max_path_elements,
        source_string: fst$path,
        source_string_size: fst$path_size,
        term_option: amt$term_option,
        terminate_string: string (2);


      clp$get_cmnd_or_func_source_str (command_or_function_source, source_string, source_string_size, status);
      IF NOT status.normal THEN
        RETURN;
      IFEND;

      clp$build_path_subtitle (source_string, source_string_size,
            (display_control.page_width - header_length), chunk_count, display_chunks);

      skip_line;
      put_partial_display ('Source:', clc$no_trim, amc$continue);

      terminate_string := '..';
      term_option := amc$terminate;
      FOR i := 1 TO chunk_count DO
        clp$horizontal_tab_display (display_control, header_length + 1, status);
        IF NOT status.normal THEN
          RETURN;
        IFEND;
        IF i = chunk_count THEN
          terminate_string := '  ';
          term_option := amc$terminate;
        IFEND;
        put_partial_display (source_string (display_chunks [i].position, display_chunks [i].length),
              clc$trim, amc$continue);
        put_partial_display (terminate_string, clc$trim, term_option);
      FOREND;

    PROCEND display_source;
*IF NOT $true(osv$unix)
?? TITLE := 'display_help_module_name', EJECT ??

    PROCEDURE [INLINE] display_help_module_name;


      skip_line;

      put_partial_display ('Help Module Seed:  ', clc$no_trim, amc$start);

      IF pdt.header^.help_module_name = '' THEN
        put_partial_display ('none', clc$no_trim, amc$terminate);
      ELSE
        put_partial_display (pdt.header^.help_module_name, clc$trim, amc$terminate);
      IFEND;

    PROCEND display_help_module_name;
?? TITLE := 'get_brief_help', EJECT ??

    PROCEDURE get_brief_help;


      osp$find_brief_help_message (help_module, message_template, ignore_status);
      IF message_template <> NIL THEN
        osp$format_help_message (message_template, NIL, display_control.page_width, message, ignore_status);
        IF NOT ignore_status.normal THEN
          RETURN;
        IFEND;
        put_message (message);
      IFEND;

    PROCEND get_brief_help;
?? TITLE := 'get_full_help', EJECT ??

    PROCEDURE get_full_help;


      osp$find_full_help_message (help_module, message_template, ignore_status);
      IF message_template <> NIL THEN
        osp$format_help_message (message_template, NIL, display_control.page_width, message, ignore_status);
        IF NOT ignore_status.normal THEN
          RETURN;
        IFEND;
        put_message (message);
      ELSE
        get_brief_help;
      IFEND;

    PROCEND get_full_help;
?? TITLE := 'put_message', EJECT ??

    PROCEDURE [INLINE] put_message
      (    message: ost$status_message);

      VAR
        message_line: ^ost$status_message_line,
        message_area: ^ost$status_message,
        message_line_count: ^ost$status_message_line_count,
        message_line_index: 1 .. osc$max_status_message_lines,
        message_line_size: ^ost$status_message_line_size;


      message_area := ^message;
      RESET message_area;
      NEXT message_line_count IN message_area;

      skip_line;
      FOR message_line_index := 1 TO message_line_count^ DO
        NEXT message_line_size IN message_area;
        NEXT message_line: [message_line_size^] IN message_area;
        put_line (message_line^ (2, * ));
      FOREND;

    PROCEND put_message;
*IFEND
?? TITLE := 'put_line', EJECT ??

    PROCEDURE [INLINE] put_line
      (    line: string ( * ));


      clp$put_display (display_control, line, clc$no_trim, status);
      IF NOT status.normal THEN
        EXIT clp$display_cmnd_or_func_info;
      IFEND;

    PROCEND put_line;
?? TITLE := 'skip_line', EJECT ??

    PROCEDURE [INLINE] skip_line;


      clp$new_display_line (display_control, 1, status);
      IF NOT status.normal THEN
        EXIT clp$display_cmnd_or_func_info;
      IFEND;

    PROCEND skip_line;
*IF NOT $true(osv$unix)
?? TITLE := 'display_help_information', EJECT ??

    PROCEDURE display_help_information
      (    include_advanced_items: boolean;
       VAR status: ost$status);

      VAR
        parameter: clt$parameter_number;


      skip_line;

      IF pdt.header^.number_of_parameters = 0 THEN
        put_line ('No parameters.');
        RETURN;
      IFEND;

      put_line ('Parameters:');

      request.initial_indentation := 0;
      request.continuation_indentation := 8;
      request.max_string := display_control.page_width;
      request.include_advanced_items := include_advanced_items;
      request.include_hidden_items := FALSE;
      request.kind := clc$convert_unbundled_pdt;
      request.multi_line_pdt_format := TRUE;
      request.parameter_starts_line := TRUE;
      request.individual_parameter := TRUE;
      request.include_header := FALSE;
      request.command_or_function_name := osc$null_name;
      request.aliases := NIL;
      request.availability := clc$normal_usage_entry;
      request.command_or_function_scope := clc$xdcl_command_or_function;
      request.pdt := ^pdt;
      request.pvt := NIL;
      request.symbolic_pdt_qualifiers_area := NIL;
      request.include_implementation_info := FALSE;

    /process_parameters/
      FOR parameter := 1 TO pdt.header^.number_of_parameters DO
        CASE pdt.parameters^ [parameter].availability OF
        = clc$normal_usage_entry =
          ;
        = clc$advanced_usage_entry =
          IF NOT include_advanced_items THEN
            CYCLE /process_parameters/;
          IFEND;
        ELSE { hidden
          CYCLE /process_parameters/;
        CASEND;

        parameter_name := pdt.names^ [pdt.parameters^ [parameter].name_index].name;
        osp$find_parameter_help_message (help_module, parameter_name, message_template, ignore_status);
        IF message_template <> NIL THEN
          convert_name_to_message_param (parameter_name);
          message_parameters [1] := ^parameter_name;
          osp$format_help_message (message_template, ^message_parameters, display_control.page_width, message,
                status);
          IF status.normal THEN
            put_message (message);
          ELSE
            request.individual_parameter_number := parameter;
            clp$internal_convert_to_string (request, work_area^, representation, status);
            IF NOT status.normal THEN
              RETURN;
            IFEND;
            put_representation;
          IFEND;
        ELSE
          request.individual_parameter_number := parameter;
          clp$internal_convert_to_string (request, work_area^, representation, status);
          IF NOT status.normal THEN
            RETURN;
          IFEND;
          put_representation;
        IFEND;
      FOREND /process_parameters/;

    PROCEND display_help_information;
*IFEND
?? TITLE := 'display_all_parameters', EJECT ??

    PROCEDURE display_all_parameters
      (    compact_parameter_descriptions: boolean;
           include_advanced_items: boolean;
       VAR status: ost$status);


      skip_line;

      IF pdt.header^.number_of_parameters = 0 THEN
        put_line ('No parameters.');
        RETURN;
      IFEND;

      put_line ('Parameters:');

      request.initial_indentation := 0;
      request.continuation_indentation := 8;
*IF NOT $true(osv$unix)
      request.max_string := display_control.page_width;
*ELSE
      request.max_string := 80;
*IFEND
      request.include_advanced_items := include_advanced_items;
      request.include_hidden_items := FALSE;
      request.kind := clc$convert_unbundled_pdt;
      request.multi_line_pdt_format := NOT compact_parameter_descriptions;
      request.parameter_starts_line := TRUE;
      request.individual_parameter := FALSE;
      request.individual_parameter_number := LOWERVALUE (clt$parameter_number);
      request.include_header := FALSE;
      request.command_or_function_name := osc$null_name;
      request.aliases := NIL;
      request.availability := clc$normal_usage_entry;
      request.command_or_function_scope := clc$xdcl_command_or_function;
      request.pdt := ^pdt;
      request.pvt := NIL;
      request.symbolic_pdt_qualifiers_area := NIL;
      request.include_implementation_info := FALSE;

      clp$internal_convert_to_string (request, work_area^, representation, status);
      IF NOT status.normal THEN
        RETURN;
      IFEND;

      put_representation;

    PROCEND display_all_parameters;
*IF NOT $true(osv$unix)
?? TITLE := 'convert_name_to_message_param', EJECT ??

    PROCEDURE [INLINE] convert_name_to_message_param
      (VAR name {input, output} : ost$name);

      VAR
        i: 1 .. osc$max_name_size,
        new_word: boolean;


      new_word := TRUE;
      FOR i := 1 TO osc$max_name_size DO
        IF name (i) = ' ' THEN
          RETURN;
        ELSEIF name (i) = '_' THEN
          name (i) := ' ';
          new_word := TRUE;
        ELSEIF new_word THEN
          new_word := FALSE;
        ELSE
          name (i) := osv$upper_to_lower ($INTEGER (name (i)) + 1);
        IFEND;
      FOREND;

    PROCEND convert_name_to_message_param;
*IFEND
?? TITLE := 'put_representation', EJECT ??

    PROCEDURE [INLINE] put_representation;

      VAR
        representation_line: ^clt$string_value,
        representation_line_count: ^clt$data_representation_count,
        representation_line_index: clt$data_representation_count,
        representation_line_size: ^clt$string_size;


      RESET representation;
      NEXT representation_line_count IN representation;

      skip_line;
      FOR representation_line_index := 1 TO representation_line_count^ DO
        NEXT representation_line_size IN representation;
        NEXT representation_line: [representation_line_size^] IN representation;
        put_line (representation_line^);
      FOREND;

    PROCEND put_representation;
?? OLDTITLE, EJECT ??

    VAR
      compact_parameter_descriptions: boolean,
*IF NOT $true(osv$unix)
      default_ring_attributes: amt$ring_attributes,
*IFEND
      display_control: clt$display_control,
*IF $true(osv$unix)
      handler_established: boolean,
*ELSE
      help_module: ^ost$help_module,
      ignore_natural_language: ost$natural_language,
*IFEND
      ignore_status: ost$status,
      include_advanced_items: boolean,
*IF NOT $true(osv$unix)
      message: ost$status_message,
      message_parameters: array [1 .. 1] of ^ost$message_parameter,
      message_template: ^ost$message_template,
      online_manual_name: ost$online_manual_name,
*IFEND
      parameters_displayed: boolean,
      parameter_name: clt$parameter_name,
      representation: ^clt$data_representation,
      request: clt$convert_to_string_request,
      work_area: ^^clt$work_area;


    status.normal := TRUE;
*IF NOT $true(osv$unix)
    display_control := clv$nil_display_control;
    #SPOIL (display_control);

*IF NOT $true(osv$unix)
    default_ring_attributes.r1 := help_context.help_output_ring;
    default_ring_attributes.r2 := help_context.help_output_ring;
    default_ring_attributes.r3 := help_context.help_output_ring;
*ELSE
    default_ring_attributes.r1 := osc$user_ring;
    default_ring_attributes.r2 := osc$user_ring;
    default_ring_attributes.r3 := osc$user_ring;
*IFEND

    osp$establish_block_exit_hndlr (^abort_handler);
*IFEND
*IF $true(osv$unix)
    handler_established := #establish_condition_handler (-1, ^abort_handler);
*IFEND

  /display_info/
    BEGIN
*IF NOT $true(osv$unix)
      clp$open_display_reference (help_context.help_output_file^, ^clp$new_page_procedure,
            default_file_contents, default_ring_attributes, display_control, status);
*ELSE
      clp$open_display_reference (help_context.help_output_file^, NIL,
            default_file_contents, display_control, status);
*IFEND
      IF NOT status.normal THEN
*IF NOT $true(osv$unix)
        osp$disestablish_cond_handler;
*ELSE
        IF handler_established THEN
          handler_established := NOT #disestablish_condition_handler (-1);
        IFEND;
*IFEND
        RETURN;
      IFEND;

      clv$titles_built := FALSE;
      IF pdt.header^.command_or_function = clc$command THEN
        clv$command_name := 'display_command_information';
      ELSE {clc$function}
        clv$command_name := 'display_function_information';
      IFEND;

*IF NOT $true(osv$unix)
      clp$get_work_area (#RING (^work_area), work_area, status);
*ELSE
      clp$get_work_area (osc$user_ring, work_area, status);
*IFEND
      IF NOT status.normal THEN
        EXIT /display_info/;
      IFEND;

*IF NOT $true(osv$unix)
      IF clc$ph_help_module_name IN help_context.help_output_options THEN
        display_help_module_name;
      IFEND;
*IFEND

      IF clc$ph_all_names IN help_context.help_output_options THEN
        display_all_names (status);
        IF NOT status.normal THEN
          EXIT /display_info/;
        IFEND;
      IFEND;

      IF clc$ph_source IN help_context.help_output_options THEN
        display_source (status);
        IF NOT status.normal THEN
          EXIT /display_info/;
        IFEND;
      IFEND;

      include_advanced_items := clc$ph_advanced_usage IN help_context.help_output_options;

      parameters_displayed := FALSE;
*IF NOT $true(osv$unix)
      IF ($clt$parameter_help_options [clc$ph_brief_help, clc$ph_full_help,
            clc$ph_parameter_help] * help_context.help_output_options) <> $clt$parameter_help_options [] THEN
        osp$find_help_module (pdt.header^.help_module_name, help_module, online_manual_name,
              ignore_natural_language, ignore_status);
        IF help_module <> NIL THEN
          IF clc$ph_full_help IN help_context.help_output_options THEN
            get_full_help;
          ELSEIF clc$ph_brief_help IN help_context.help_output_options THEN
            get_brief_help;
          IFEND;
          IF clc$ph_parameter_help IN help_context.help_output_options THEN
            display_help_information (include_advanced_items, status);
            IF NOT status.normal THEN
              EXIT /display_info/;
            IFEND;
            parameters_displayed := TRUE;
          IFEND;
        IFEND;
      IFEND;
*IFEND
      IF (NOT parameters_displayed) AND (($clt$parameter_help_options
            [clc$ph_parameter_help, clc$ph_parameter_descriptions, clc$ph_compact_par_descriptions,
            clc$ph_advanced_usage] * help_context.help_output_options) <> $clt$parameter_help_options []) THEN
        compact_parameter_descriptions := (clc$ph_compact_par_descriptions IN
              help_context.help_output_options) AND (($clt$parameter_help_options
              [clc$ph_parameter_help, clc$ph_parameter_descriptions] * help_context.help_output_options) =
              $clt$parameter_help_options []);
        display_all_parameters (compact_parameter_descriptions, include_advanced_items, status);
      IFEND;
    END /display_info/;

*IF $true(osv$unix)
    IF clc$ph_man IN help_context.help_output_options THEN
      osp$set_status_abnormal ('CL', cle$unknown_command, '', status);
    IFEND;

*IFEND
    IF status.normal THEN
      clp$close_display (display_control, status);
    ELSE
      clp$close_display (display_control, ignore_status);
    IFEND;

*IF NOT $true(osv$unix)
    osp$disestablish_cond_handler;
*ELSE
    IF handler_established THEN
      handler_established := NOT #disestablish_condition_handler (-1);
    IFEND;
*IFEND

  PROCEND clp$display_cmnd_or_func_info;
?? TITLE := 'clp$get_all_cmnd_or_func_names', EJECT ??

  PROCEDURE [XDCL] clp$get_all_cmnd_or_func_names
    (    command_or_function: clt$command_or_function;
         command_or_function_source: clt$command_or_function_source;
         command_or_function_name: clt$command_name;
     VAR work_area {input, output} : ^clt$work_area;
     VAR names: ^array [1 .. * ] of clt$command_name;
     VAR status: ost$status);

    VAR
      caller_id: ost$caller_identifier,
      command_list: ^clt$command_list,
      ignore_cmnd_list_in_this_task: boolean;

?? NEWTITLE := 'get_command_names', EJECT ??

    PROCEDURE get_command_names
      (    entries: ^clt$command_table);

      VAR
        abbrev_count: integer,
        abbreviation: ost$name,
        alias_count: integer,
        aliases: ^array [1 .. * ] of clt$command_name,
        index: integer,
        nominal_name: ost$name;


      alias_count := 0;
      abbrev_count := 0;

      PUSH aliases: [1 .. UPPERBOUND (entries^)];

      FOR index := 1 TO UPPERBOUND (entries^) DO
        IF (entries^ [index].ordinal = command_or_function_source.ordinal) THEN
          IF entries^ [index].class = clc$nominal_entry THEN
            nominal_name := entries^ [index].name;
          ELSEIF entries^ [index].class = clc$alias_entry THEN
            alias_count := alias_count + 1;
            aliases^ [alias_count] := entries^ [index].name;
          ELSE
            abbrev_count := abbrev_count + 1;
            abbreviation := entries^ [index].name;
          IFEND;
        IFEND;
      FOREND;

      NEXT names: [1 .. (alias_count + abbrev_count + 1)] IN work_area;
      IF names = NIL THEN
        osp$set_status_abnormal ('CL', cle$work_area_overflow, '', status);
        EXIT clp$get_all_cmnd_or_func_names;
      IFEND;

      names^ [1] := nominal_name;
      FOR index := 1 TO alias_count DO
        names^ [index + 1] := aliases^ [index];
      FOREND;
      IF abbrev_count = 1 THEN
        names^ [UPPERBOUND (names^)] := abbreviation;
      IFEND;

    PROCEND get_command_names;
?? TITLE := 'get_contemporary_func_names', EJECT ??

    PROCEDURE get_contemporary_func_names
      (    entries: ^clt$function_processor_table);

      VAR
        abbrev_count: integer,
        abbreviation: ost$name,
        alias_count: integer,
        aliases: ^array [1 .. * ] of ost$name,
        index: integer,
        nominal_name: ost$name;


      alias_count := 0;
      abbrev_count := 0;

      PUSH aliases: [1 .. UPPERBOUND (entries^)];

      FOR index := 1 TO UPPERBOUND (entries^) DO
        IF (entries^ [index].ordinal = command_or_function_source.ordinal) THEN
          IF entries^ [index].class = clc$nominal_entry THEN
            nominal_name := entries^ [index].name;
          ELSEIF entries^ [index].class = clc$alias_entry THEN
            alias_count := alias_count + 1;
            aliases^ [alias_count] := entries^ [index].name;
          ELSE
            abbrev_count := abbrev_count + 1;
            abbreviation := entries^ [index].name;
          IFEND;
        IFEND;
      FOREND;

      NEXT names: [1 .. (alias_count + abbrev_count + 1)] IN work_area;
      IF names = NIL THEN
        osp$set_status_abnormal ('CL', cle$work_area_overflow, '', status);
        EXIT clp$get_all_cmnd_or_func_names;
      IFEND;

      names^ [1] := nominal_name;
      FOR index := 1 TO alias_count DO
        names^ [index + 1] := aliases^ [index];
      FOREND;
      IF abbrev_count = 1 THEN
        names^ [UPPERBOUND (names^)] := abbreviation;
      IFEND;

    PROCEND get_contemporary_func_names;
*IF NOT $true(osv$unix)
?? TITLE := 'get_library_names', EJECT ??

    PROCEDURE get_library_names
      (    local_file_name: fst$path_handle_name;
           caller_id: ost$caller_identifier);

      VAR
        commands: ^clt$command_table,
        command_entries: ^llt$command_dictionary,
        ignore_ring_attributes: amt$ring_attributes,
        functions: ^clt$function_processor_table,
        function_entries: ^llt$function_dictionary;

?? NEWTITLE := 'convert_cmnd_dict_to_cmnds', EJECT ??

      PROCEDURE [INLINE] convert_cmnd_dict_to_cmnds
        (    dictionary_entries: llt$command_dictionary;
             ordinal_offset: integer;
         VAR command_entries: clt$command_table);

        VAR
          index: integer;


        FOR index := 1 TO UPPERBOUND (dictionary_entries) DO
          command_entries [index].name := dictionary_entries [index].name;
          command_entries [index].class := dictionary_entries [index].class;
          command_entries [index].availability := dictionary_entries [index].availability;
          command_entries [index].ordinal := dictionary_entries [index].ordinal + ordinal_offset;
        FOREND;

      PROCEND convert_cmnd_dict_to_cmnds;
?? TITLE := 'convert_func_dict_to_funcs', EJECT ??

      PROCEDURE [INLINE] convert_func_dict_to_funcs
        (    dictionary_entries: llt$function_dictionary;
             ordinal_offset: integer;
         VAR function_entries: clt$function_processor_table);

        VAR
          index: integer;


        FOR index := 1 TO UPPERBOUND (dictionary_entries) DO
          function_entries [index].name := dictionary_entries [index].name;
          function_entries [index].class := dictionary_entries [index].class;
          function_entries [index].availability := dictionary_entries [index].availability;
          function_entries [index].ordinal := dictionary_entries [index].ordinal + ordinal_offset;
        FOREND;

      PROCEND convert_func_dict_to_funcs;
?? OLDTITLE, EJECT ??
      VAR
        context: ^ost$ecp_exception_context;

      context := NIL;

      REPEAT
        clp$find_command_entries (local_file_name, work_area, ignore_ring_attributes, command_entries,
              function_entries, status);
        IF osp$file_access_condition (status) THEN
          IF context = NIL THEN
            PUSH context;
            context^ := osv$initial_exception_context;
            context^.file.selector := osc$ecp_file_reference;
            context^.file.file_reference := ^local_file_name;
          IFEND;

          context^.condition_status := status;
          osp$enforce_exception_policies (context^);
          status := context^.condition_status;
        IFEND;
      UNTIL status.normal OR (NOT osp$file_access_condition (status)) OR (NOT context^.wait);
      IF NOT status.normal THEN
        EXIT clp$get_all_cmnd_or_func_names;
      IFEND;

      IF (command_or_function = clc$command) AND (command_entries <> NIL) THEN
        PUSH commands: [1 .. UPPERBOUND (command_entries^)];
        convert_cmnd_dict_to_cmnds (command_entries^, 0, commands^);
        get_command_names (commands);
      IFEND;

      IF (command_or_function = clc$function) AND (function_entries <> NIL) THEN
        PUSH functions: [1 .. UPPERBOUND (function_entries^)];
        convert_func_dict_to_funcs (function_entries^, 0, functions^);
        get_contemporary_func_names (functions);
      IFEND;

    PROCEND get_library_names;
*IFEND
?? TITLE := 'get_original_func_names', EJECT ??

    PROCEDURE get_original_func_names
      (    entries: ^clt$function_table);

      VAR
        abbrev_count: integer,
        abbreviation: ost$name,
        alias_count: integer,
        aliases: ^array [1 .. * ] of ost$name,
        index: integer,
        nominal_name: ost$name;


      alias_count := 0;
      abbrev_count := 0;

      PUSH aliases: [1 .. UPPERBOUND (entries^)];

      FOR index := 1 TO UPPERBOUND (entries^) DO
        IF (entries^ [index].ordinal = command_or_function_source.ordinal) THEN
          IF entries^ [index].class = clc$nominal_entry THEN
            nominal_name := entries^ [index].name;
          ELSEIF entries^ [index].class = clc$alias_entry THEN
            alias_count := alias_count + 1;
            aliases^ [alias_count] := entries^ [index].name;
          ELSE
            abbrev_count := abbrev_count + 1;
            abbreviation := entries^ [index].name;
          IFEND;
        IFEND;
      FOREND;

      NEXT names: [1 .. (alias_count + abbrev_count + 1)] IN work_area;
      IF names = NIL THEN
        osp$set_status_abnormal ('CL', cle$work_area_overflow, '', status);
        EXIT clp$get_all_cmnd_or_func_names;
      IFEND;

      names^ [1] := nominal_name;
      FOR index := 1 TO alias_count DO
        names^ [index + 1] := aliases^ [index];
      FOREND;
      IF abbrev_count = 1 THEN
        names^ [UPPERBOUND (names^)] := abbreviation;
      IFEND;

    PROCEND get_original_func_names;
?? OLDTITLE, EJECT ??

    status.normal := TRUE;
    names := NIL;

    CASE command_or_function_source.kind OF

*IF NOT $true(osv$unix)
    = clc$catalog_commands =
      ;

    = clc$library_commands =
*IF NOT $true(osv$unix)
      #CALLER_ID (caller_id);
*ELSE
      caller_id.ring := osc$user_ring;
*IFEND
      get_library_names (command_or_function_source.local_file_name, caller_id);

*IFEND
    = clc$system_commands =
      IF command_or_function = clc$command THEN
        IF command_or_function_source.system_command_table <> NIL THEN
          get_command_names (command_or_function_source.system_command_table);
*IF NOT $true(osv$unix)
        ELSE
          clp$find_command_list (command_list, ignore_cmnd_list_in_this_task);
*IF NOT $true(osv$unix)
          #CALLER_ID (caller_id);
*ELSE
          caller_id.ring := osc$user_ring;
*IFEND
          get_library_names (command_list^.system_command_library_lfn, caller_id);
*IFEND
        IFEND;
*IF NOT $true(osv$unix)
      ELSEIF command_or_function_source.function_interface = clc$fi_original THEN
        get_original_func_names (clv$system_functions_v0);
      ELSE
        get_contemporary_func_names (clv$system_functions);
*IFEND
      IFEND;

    = clc$sub_commands =
      IF command_or_function = clc$command THEN
        IF command_or_function_source.auxilliary_table THEN
          get_command_names (command_or_function_source.utility_info^.dialog_info.commands);
        ELSE
          get_command_names (command_or_function_source.utility_info^.commands);
        IFEND;
*IF NOT $true(osv$unix)
      ELSEIF command_or_function_source.auxilliary_table THEN
        get_contemporary_func_names (command_or_function_source.utility_info^.dialog_info.functions);
*IFEND
      ELSEIF command_or_function_source.function_interface = clc$fi_original THEN
        get_original_func_names (command_or_function_source.utility_info^.original_functions);
      ELSE
        get_contemporary_func_names (command_or_function_source.utility_info^.contemporary_functions);
      IFEND;

    ELSE
      ;
    CASEND;

    IF names = NIL THEN
      NEXT names: [1 .. 1] IN work_area;
      IF names = NIL THEN
        osp$set_status_abnormal ('CL', cle$work_area_overflow, '', status);
        RETURN;
      IFEND;
      names^ [1] := command_or_function_name;
    IFEND;

  PROCEND clp$get_all_cmnd_or_func_names;
?? TITLE := 'clp$get_cmnd_or_func_source_str', EJECT ??

  PROCEDURE [XDCL] clp$get_cmnd_or_func_source_str
    (    command_or_function_source: clt$command_or_function_source;
     VAR source_string: fst$path;
     VAR source_string_size: fst$path_size;
     VAR status: ost$status);

    CONST
      system_indicator = '$SYSTEM',
      utility_indicator = 'Utility ';


    status.normal := TRUE;
    CASE command_or_function_source.kind OF

*IF NOT $true(osv$unix)
    = clc$catalog_commands, clc$library_commands =
      clp$get_path_name (command_or_function_source.local_file_name, osc$full_message_level, source_string);
      source_string_size := clp$trimmed_string_size (source_string);

*IFEND
    = clc$system_commands =
*IF $true(osv$unix)
      source_string := 'control_statements';
      source_string_size := 18;
*ELSE
      source_string := system_indicator;
      source_string_size := STRLENGTH (system_indicator);
*IFEND

    ELSE { clc$sub_commands }
      source_string (1, STRLENGTH (utility_indicator)) := utility_indicator;
      source_string (STRLENGTH (utility_indicator) + 1, * ) := command_or_function_source.utility_name;
      source_string_size := STRLENGTH (utility_indicator) +
            clp$trimmed_string_size (command_or_function_source.utility_name);
    CASEND;

  PROCEND clp$get_cmnd_or_func_source_str;

MODEND clm$display_cmnd_or_func_info;
