?? RIGHT := 110 ??
?? NEWTITLE := 'NOS/VE: Object Library Analyzer' ??
MODULE ocm$analyze_object_library;

{ PURPOSE:
{   This module contains the command handlers for ANALYZE_OBJECT_LIBRARY.


?? NEWTITLE := 'Global Declarations Referenced by This Module', EJECT ??
?? PUSH (LISTEXT := ON) ??
*copyc clc$standard_file_names
*copyc cle$ecc_miscellaneous
*copyc oct$anaol_types
*copyc oct$interrupt_types
?? POP ??
*copyc amp$fetch
*copyc amp$get_segment_pointer
*copyc clp$begin_utility
*copyc clp$convert_string_to_file
*copyc clp$end_include
*copyc clp$end_utility
*copyc clp$evaluate_parameters
*copyc clp$include_file
*copyc clp$make_integer_value
*copyc fsp$close_file
*copyc fsp$open_file
*copyc ocp$abort_if_abnormal_status
*copyc ocp$abort_if_segment_overflow
*copyc ocp$create_transient_segment
*copyc ocp$display_library_analysis
*copyc ocp$display_module_analysis
*copyc ocp$display_performance_anal
*copyc ocp$display_section_usage
*copyc ocp$get_binding_section_refs
*copyc ocp$initialize_object_library
*copyc ocp$internal_error
*copyc osp$set_status_abnormal
*copyc osp$set_status_condition
*copyc pmp$establish_condition_handler
?? OLDTITLE ??
?? NEWTITLE := 'Global Declarations Declared by This Module', EJECT ??

  CONST
    utility_name = 'ANALYZE_OBJECT_LIBRARY         ';

  VAR
    command_file: amt$local_file_name := clc$current_command_input,
    utility_attributes: array [1 .. 3] of clt$utility_attribute :=
          [[clc$utility_command_table, * ], [clc$utility_function_proc_table, * ], [clc$utility_prompt, [3,
          'AOL']]],
    occ$all_access_attributes: [XDCL, READ] llt$section_access_attributes := [],

    ocv$object_library: [XDCL] ^oct$object_library := NIL,

    ocv$command_sequence: [XDCL] ^SEQ ( * ) := NIL,
    ocv$library_sequence: [XDCL] ^SEQ ( * ) := NIL;

?? OLDTITLE ??
?? NEWTITLE := 'reset_environment', EJECT ??

  PROCEDURE reset_environment;


    VAR
      abort_status: ost$status,
      transient_segment: amt$segment_pointer;


    IF (ocv$command_sequence = NIL) THEN
      ocp$create_transient_segment (amc$sequence_pointer, transient_segment, abort_status);
      ocp$abort_if_abnormal_status (abort_status);
      ocv$command_sequence := transient_segment.sequence_pointer;
    IFEND;

    IF (ocv$library_sequence = NIL) THEN
      ocp$create_transient_segment (amc$sequence_pointer, transient_segment, abort_status);
      ocp$abort_if_abnormal_status (abort_status);
      ocv$library_sequence := transient_segment.sequence_pointer;
    IFEND;


    close_current_object_library;

    RESET ocv$command_sequence;
    RESET ocv$library_sequence;


  PROCEND reset_environment;
?? OLDTITLE ??
?? NEWTITLE := 'open_object_library', EJECT ??

  PROCEDURE open_object_library
    (    file: clt$file;
     VAR status: ost$status);

    VAR
      fetch_attributes: [STATIC] array [1 .. 1] of amt$fetch_item := [
            {} [ * , amc$file_structure, * ]];

    VAR
      attachment_options: ^fst$attachment_options,
      attribute_validation: ^fst$file_cycle_attributes,
      file_identifier: amt$file_identifier,
      segment_pointer: amt$segment_pointer,
      object_library: ^oct$object_library;

    PUSH attachment_options: [1 .. 3];
    attachment_options^ [1].selector := fsc$access_and_share_modes;
    attachment_options^ [1].access_modes.selector := fsc$specific_access_modes;
    attachment_options^ [1].access_modes.value := $fst$file_access_options [fsc$read];
    attachment_options^ [1].share_modes.selector := fsc$determine_from_access_modes;
    attachment_options^ [2].selector := fsc$create_file;
    attachment_options^ [2].create_file := FALSE;
    attachment_options^ [3].selector := fsc$open_position;
    attachment_options^ [3].open_position := amc$open_at_boi;

    PUSH attribute_validation: [1 .. 2];
    attribute_validation^ [1].selector := fsc$file_contents_and_processor;
    attribute_validation^ [1].file_contents := fsc$object_data;
    attribute_validation^ [1].file_processor := fsc$unknown_processor;
    attribute_validation^ [2].selector := fsc$file_contents_and_processor;
    attribute_validation^ [2].file_contents := fsc$object_library;
    attribute_validation^ [2].file_processor := fsc$unknown_processor;

    fsp$open_file (file.local_file_name, amc$segment, attachment_options, NIL, NIL, attribute_validation, NIL,
          file_identifier, status);
    IF NOT status.normal THEN
      RETURN;
    IFEND;

    amp$get_segment_pointer (file_identifier, amc$sequence_pointer, segment_pointer, status);
    ocp$abort_if_abnormal_status (status);

    reset_environment;

    NEXT object_library IN ocv$library_sequence;
    ocp$abort_if_segment_overflow (^object_library);

    object_library^.file := file;
    object_library^.file_identifier := file_identifier;
    object_library^.sequence := segment_pointer.sequence_pointer;

    amp$fetch (object_library^.file_identifier, fetch_attributes, status);
    IF NOT status.normal THEN
      RETURN;
    IFEND;


    ocp$initialize_object_library ((fetch_attributes [1].file_structure = amc$library), object_library);

    ocv$object_library := object_library;


  PROCEND open_object_library;
?? OLDTITLE ??
?? NEWTITLE := 'close_current_object_library', EJECT ??

  PROCEDURE close_current_object_library;


    VAR
      local_file_identifier: amt$file_identifier,
      abort_status: ost$status;


    IF (ocv$object_library <> NIL) THEN
      local_file_identifier := ocv$object_library^.file_identifier;
      ocv$object_library := NIL;

      fsp$close_file (local_file_identifier, abort_status);
      ocp$abort_if_abnormal_status (abort_status);
    IFEND;


  PROCEND close_current_object_library;
?? OLDTITLE ??
?? NEWTITLE := 'add_module_subrange', EJECT ??

  PROCEDURE add_module_subrange
    (    first_module: pmt$program_name;
         last_module: pmt$program_name;
         module_list: ^oct$module_list;
     VAR end_of_list: ^oct$module_item;
     VAR status: ost$status);

    VAR
      i: integer;

    i := 1;
    WHILE (i <= UPPERBOUND (module_list^)) AND (module_list^ [i].name <> first_module) DO
      i := i + 1;
    WHILEND;

    IF (i > UPPERBOUND (module_list^)) THEN
      osp$set_status_abnormal ('OC', oce$unknown_module, first_module, status);
      RETURN;
    IFEND;

    end_of_list^.link := ^module_list^ [i];
    end_of_list := end_of_list^.link;

    IF (first_module <> last_module) THEN
      i := i + 1;
      WHILE (i <= UPPERBOUND (module_list^)) AND (module_list^ [i].name <> last_module) DO
        end_of_list^.link := ^module_list^ [i];
        end_of_list := end_of_list^.link;
        i := i + 1;
      WHILEND;

      IF (i > UPPERBOUND (module_list^)) THEN
        osp$set_status_abnormal ('OC', oce$unknown_module, last_module, status);
        RETURN;
      IFEND;

      end_of_list^.link := ^module_list^ [i];
      end_of_list := end_of_list^.link;
    IFEND;

    end_of_list^.link := NIL;


  PROCEND add_module_subrange;
?? OLDTITLE ??
?? NEWTITLE := 'use_library_command', EJECT ??

  PROCEDURE use_library_command
    (    parameter_list: clt$parameter_list;
     VAR status: ost$status);

{ PROCEDURE (ocm$anaol_usel) use_library, usel (
{   library, l: file = $required
{   status)

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

  VAR
    pdt: [STATIC, READ, cls$declaration_section] record
      header: clt$pdt_header,
      names: array [1 .. 3] of clt$pdt_parameter_name,
      parameters: array [1 .. 2] of clt$pdt_parameter,
      type1: record
        header: clt$type_specification_header,
      recend,
      type2: record
        header: clt$type_specification_header,
      recend,
    recend := [
    [1,
    [89, 8, 18, 18, 14, 37, 256],
    clc$command, 3, 2, 1, 0, 0, 0, 2, 'OCM$ANAOL_USEL'], [
    ['L                              ',clc$abbreviation_entry, 1],
    ['LIBRARY                        ',clc$nominal_entry, 1],
    ['STATUS                         ',clc$nominal_entry, 2]],
    [
{ 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
    [3, 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$file_type]],
{ PARAMETER 2
    [[1, 0, clc$status_type]]];

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

    CONST
      p$library = 1,
      p$status = 2;

    VAR
      pvt: array [1 .. 2] of clt$parameter_value;

    VAR
      file: clt$file;

    status.normal := TRUE;

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

    clp$convert_string_to_file (pvt [p$library].value^.file_value^, file, status);
    IF NOT status.normal THEN
      RETURN;
    IFEND;

    open_object_library (file, status);

  PROCEND use_library_command;
?? OLDTITLE ??
?? NEWTITLE := 'display_library_command', EJECT ??

  PROCEDURE display_library_command
    (    parameter_list: clt$parameter_list;
     VAR status: ost$status);

{ PROCEDURE (ocm$anaol_disla) display_library_analysis, disla (
{   display_options, display_option, do: any of
{       key
{         all
{       keyend
{       list of key
{         (number_of_modules, nom)
{         (record_analysis, ra)
{       keyend
{     anyend = all
{   output, o: file = $output
{   status)

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

  VAR
    pdt: [STATIC, READ, cls$declaration_section] record
      header: clt$pdt_header,
      names: array [1 .. 6] of clt$pdt_parameter_name,
      parameters: array [1 .. 3] of clt$pdt_parameter,
      type1: record
        header: clt$type_specification_header,
        qualifier: clt$union_type_qualifier,
        type_size_1: clt$type_specification_size,
        element_type_spec_1: record
          header: clt$type_specification_header,
          qualifier: clt$keyword_type_qualifier,
          keyword_specs: array [1 .. 1] of clt$keyword_specification,
        recend,
        type_size_2: clt$type_specification_size,
        element_type_spec_2: 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 .. 4] of clt$keyword_specification,
          recend,
        recend,
        default_value: string (3),
      recend,
      type2: record
        header: clt$type_specification_header,
        default_value: string (7),
      recend,
      type3: record
        header: clt$type_specification_header,
      recend,
    recend := [
    [1,
    [89, 8, 16, 17, 32, 51, 792],
    clc$command, 6, 3, 0, 0, 0, 0, 3, 'OCM$ANAOL_DISLA'], [
    ['DISPLAY_OPTION                 ',clc$alias_entry, 1],
    ['DISPLAY_OPTIONS                ',clc$nominal_entry, 1],
    ['DO                             ',clc$abbreviation_entry, 1],
    ['O                              ',clc$abbreviation_entry, 2],
    ['OUTPUT                         ',clc$nominal_entry, 2],
    ['STATUS                         ',clc$nominal_entry, 3]],
    [
{ 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, 235, clc$optional_default_parameter, 0, 3],
{ PARAMETER 2
    [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$optional_default_parameter, 0, 7],
{ PARAMETER 3
    [6, 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$union_type], [[clc$keyword_type,
    clc$list_type],
    FALSE, 2],
    44, [[1, 0, clc$keyword_type], [1], [
      ['ALL                            ', clc$nominal_entry,
  clc$normal_usage_entry, 1]]
      ],
    171, [[1, 0, clc$list_type], [155, 1, clc$max_list_size, FALSE],
        [[1, 0, clc$keyword_type], [4], [
        ['NOM                            ', clc$abbreviation_entry,
  clc$normal_usage_entry, 1],
        ['NUMBER_OF_MODULES              ', clc$nominal_entry,
  clc$normal_usage_entry, 1],
        ['RA                             ', clc$abbreviation_entry,
  clc$normal_usage_entry, 2],
        ['RECORD_ANALYSIS                ', clc$nominal_entry,
  clc$normal_usage_entry, 2]]
        ]
      ]
    ,
    'all'],
{ PARAMETER 2
    [[1, 0, clc$file_type],
    '$output'],
{ PARAMETER 3
    [[1, 0, clc$status_type]]];

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

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

    VAR
      pvt: array [1 .. 3] of clt$parameter_value;

    VAR
      display_options: oct$anaol_display_options,
      node: ^clt$data_value,
      output_file: clt$file;

    status.normal := TRUE;

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

    IF (ocv$object_library = NIL) THEN
      osp$set_status_condition (oce$object_library_not_analyzed, status);
      RETURN;
    IFEND;

    IF (pvt [p$display_options].value^.kind = clc$keyword) THEN
      display_options := -$oct$anaol_display_options [];
    ELSE
      display_options := $oct$anaol_display_options [];
      node := pvt [p$display_options].value;
      WHILE node <> NIL DO
        CASE node^.element_value^.keyword_value (1) OF
        = 'N' =
          display_options := display_options + $oct$anaol_display_options [occ$display_number_of_modules];
        = 'R' =
          display_options := display_options + $oct$anaol_display_options [occ$display_record_analysis];
        ELSE
          ;
        CASEND;
        node := node^.link;
      WHILEND;
    IFEND;

    clp$convert_string_to_file (pvt [p$output].value^.file_value^, output_file, status);
    IF NOT status.normal THEN
      RETURN;
    IFEND;

    ocp$display_library_analysis (ocv$object_library, display_options, output_file, status);

  PROCEND display_library_command;
?? OLDTITLE ??
?? NEWTITLE := 'display_module_command', EJECT ??

  PROCEDURE display_module_command
    (    parameter_list: clt$parameter_list;
     VAR status: ost$status);

{ PROCEDURE (ocm$anaol_disma) display_module_analysis, disma (
{   modules, module, m: any of
{       key
{         all
{       keyend
{       list of program_name
{       list of range of program_name
{     anyend = all
{   display_options, display_option, do: any of
{       key
{         all
{       keyend
{       list of key
{         (record_analysis, ra)
{         (section_analysis, sa)
{       keyend
{     anyend = all
{   output, o: file = $output
{   status)

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

  VAR
    pdt: [STATIC, READ, cls$declaration_section] record
      header: clt$pdt_header,
      names: array [1 .. 9] of clt$pdt_parameter_name,
      parameters: array [1 .. 4] of clt$pdt_parameter,
      type1: record
        header: clt$type_specification_header,
        qualifier: clt$union_type_qualifier,
        type_size_1: clt$type_specification_size,
        element_type_spec_1: record
          header: clt$type_specification_header,
          qualifier: clt$keyword_type_qualifier,
          keyword_specs: array [1 .. 1] of clt$keyword_specification,
        recend,
        type_size_2: clt$type_specification_size,
        element_type_spec_2: record
          header: clt$type_specification_header,
          qualifier: clt$list_type_qualifier,
          element_type_spec: record
            header: clt$type_specification_header,
          recend,
        recend,
        type_size_3: clt$type_specification_size,
        element_type_spec_3: record
          header: clt$type_specification_header,
          qualifier: clt$list_type_qualifier,
          element_type_spec: record
            header: clt$type_specification_header,
            qualifier: clt$range_type_qualifier,
            element_type_spec: record
              header: clt$type_specification_header,
            recend,
          recend,
        recend,
        default_value: string (3),
      recend,
      type2: record
        header: clt$type_specification_header,
        qualifier: clt$union_type_qualifier,
        type_size_1: clt$type_specification_size,
        element_type_spec_1: record
          header: clt$type_specification_header,
          qualifier: clt$keyword_type_qualifier,
          keyword_specs: array [1 .. 1] of clt$keyword_specification,
        recend,
        type_size_2: clt$type_specification_size,
        element_type_spec_2: 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 .. 4] of clt$keyword_specification,
          recend,
        recend,
        default_value: string (3),
      recend,
      type3: record
        header: clt$type_specification_header,
        default_value: string (7),
      recend,
      type4: record
        header: clt$type_specification_header,
      recend,
    recend := [
    [1,
    [89, 8, 16, 17, 46, 46, 728],
    clc$command, 9, 4, 0, 0, 0, 0, 4, 'OCM$ANAOL_DISMA'], [
    ['DISPLAY_OPTION                 ',clc$alias_entry, 2],
    ['DISPLAY_OPTIONS                ',clc$nominal_entry, 2],
    ['DO                             ',clc$abbreviation_entry, 2],
    ['M                              ',clc$abbreviation_entry, 1],
    ['MODULE                         ',clc$alias_entry, 1],
    ['MODULES                        ',clc$nominal_entry, 1],
    ['O                              ',clc$abbreviation_entry, 3],
    ['OUTPUT                         ',clc$nominal_entry, 3],
    ['STATUS                         ',clc$nominal_entry, 4]],
    [
{ PARAMETER 1
    [6, 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, 113, clc$optional_default_parameter, 0, 3],
{ PARAMETER 2
    [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, 235, clc$optional_default_parameter, 0, 3],
{ PARAMETER 3
    [8, 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 4
    [9, 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$union_type], [[clc$keyword_type,
    clc$list_type],
    FALSE, 3],
    44, [[1, 0, clc$keyword_type], [1], [
      ['ALL                            ', clc$nominal_entry,
  clc$normal_usage_entry, 1]]
      ],
    19, [[1, 0, clc$list_type], [3, 1, clc$max_list_size, FALSE],
        [[1, 0, clc$program_name_type]]
      ],
    26, [[1, 0, clc$list_type], [10, 1, clc$max_list_size, FALSE],
        [[1, 0, clc$range_type], [3],
          [[1, 0, clc$program_name_type]]
        ]
      ]
    ,
    'all'],
{ PARAMETER 2
    [[1, 0, clc$union_type], [[clc$keyword_type,
    clc$list_type],
    FALSE, 2],
    44, [[1, 0, clc$keyword_type], [1], [
      ['ALL                            ', clc$nominal_entry,
  clc$normal_usage_entry, 1]]
      ],
    171, [[1, 0, clc$list_type], [155, 1, clc$max_list_size, FALSE],
        [[1, 0, clc$keyword_type], [4], [
        ['RA                             ', clc$abbreviation_entry,
  clc$normal_usage_entry, 1],
        ['RECORD_ANALYSIS                ', clc$nominal_entry,
  clc$normal_usage_entry, 1],
        ['SA                             ', clc$abbreviation_entry,
  clc$normal_usage_entry, 2],
        ['SECTION_ANALYSIS               ', clc$nominal_entry,
  clc$normal_usage_entry, 2]]
        ]
      ]
    ,
    'all'],
{ PARAMETER 3
    [[1, 0, clc$file_type],
    '$output'],
{ PARAMETER 4
    [[1, 0, clc$status_type]]];

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

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

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

    VAR
      display_options: oct$anaol_display_options,
      end_of_list: ^oct$module_item,
      first_module: pmt$program_name,
      last_module: pmt$program_name,
      module_index: clt$list_size,
      node: ^clt$data_value,
      output_file: clt$file;

    status.normal := TRUE;

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

    IF (ocv$object_library = NIL) THEN
      osp$set_status_condition (oce$object_library_not_analyzed, status);
      RETURN;
    IFEND;
    end_of_list := ^ocv$object_library^.module_list^ [occ$head_of_list];
    end_of_list^.link := NIL;

    IF (pvt [p$modules].value^.kind = clc$keyword) THEN

{ The only keyword is 'ALL'. Add all modules.

      FOR module_index := 1 TO UPPERBOUND (ocv$object_library^.module_list^) DO
        end_of_list^.link := ^ocv$object_library^.module_list^ [module_index];
        end_of_list := end_of_list^.link;
      FOREND;
      end_of_list^.link := NIL;
    ELSE
      node := pvt [p$modules].value;
      WHILE (node <> NIL) AND (node^.element_value <> NIL) DO
        IF node^.element_value^.kind = clc$range THEN
          first_module := node^.element_value^.low_value^.program_name_value;
          last_module := node^.element_value^.high_value^.program_name_value;
        ELSE
          first_module := node^.element_value^.program_name_value;
          last_module := first_module;
        IFEND;
        add_module_subrange (first_module, last_module, ocv$object_library^.module_list, end_of_list, status);
        IF NOT status.normal THEN
          RETURN;
        IFEND;
        node := node^.link;
      WHILEND;
    IFEND;

    IF (pvt [p$display_options].value^.kind = clc$keyword) THEN
      display_options := -$oct$anaol_display_options [];
    ELSE
      display_options := $oct$anaol_display_options [];
      node := pvt [p$display_options].value;
      WHILE node <> NIL DO
        CASE node^.element_value^.keyword_value (1) OF
        = 'S' =
          display_options := display_options + $oct$anaol_display_options [occ$display_section_analysis];
        = 'R' =
          display_options := display_options + $oct$anaol_display_options [occ$display_record_analysis];
        ELSE
          ;
        CASEND;
        node := node^.link;
      WHILEND;
    IFEND;

    clp$convert_string_to_file (pvt [p$output].value^.file_value^, output_file, status);
    IF NOT status.normal THEN
      RETURN;
    IFEND;

    ocp$display_module_analysis (ocv$object_library, display_options, output_file, status);

  PROCEND display_module_command;
?? OLDTITLE ??
?? NEWTITLE := 'display_performance_command', EJECT ??

  PROCEDURE display_performance_command
    (    parameter_list: clt$parameter_list;
     VAR status: ost$status);


{ PROCEDURE (ocm$anaol_dispd) display_performance_data, dispd (
{   modules, module, m: any of
{       key
{         all
{       keyend
{       list of program_name
{       list of range of program_name
{     anyend = all
{   performance_data, pd: any of
{       key
{         all
{       keyend
{       list of key
{         (bound_modules, bm)
{         (line_tables, lt)
{         (load_modules, lm)
{         (multiple_entry_points, mep)
{         (object_modules, om)
{         (opt_debug, od)
{         (opt_low, ol)
{         (parameter_checking, pc)
{         (runtime_checking, rc)
{         (runtime_libraries, rl)
{         (runtime_library_calls, rlc)
{         (symbol_tables, st)
{         (unreferenced_sections, us)
{       keyend
{     anyend = all
{   display_option, display_options, do: any of
{       key
{         all, none
{       keyend
{       list of key
{         (description, d)
{         (module_names, mn)
{       keyend
{     anyend = description
{   output, o: file = $output
{   status)

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

  VAR
    pdt: [STATIC, READ, cls$declaration_section] record
      header: clt$pdt_header,
      names: array [1 .. 11] of clt$pdt_parameter_name,
      parameters: array [1 .. 5] of clt$pdt_parameter,
      type1: record
        header: clt$type_specification_header,
        qualifier: clt$union_type_qualifier,
        type_size_1: clt$type_specification_size,
        element_type_spec_1: record
          header: clt$type_specification_header,
          qualifier: clt$keyword_type_qualifier,
          keyword_specs: array [1 .. 1] of clt$keyword_specification,
        recend,
        type_size_2: clt$type_specification_size,
        element_type_spec_2: record
          header: clt$type_specification_header,
          qualifier: clt$list_type_qualifier,
          element_type_spec: record
            header: clt$type_specification_header,
          recend,
        recend,
        type_size_3: clt$type_specification_size,
        element_type_spec_3: record
          header: clt$type_specification_header,
          qualifier: clt$list_type_qualifier,
          element_type_spec: record
            header: clt$type_specification_header,
            qualifier: clt$range_type_qualifier,
            element_type_spec: record
              header: clt$type_specification_header,
            recend,
          recend,
        recend,
        default_value: string (3),
      recend,
      type2: record
        header: clt$type_specification_header,
        qualifier: clt$union_type_qualifier,
        type_size_1: clt$type_specification_size,
        element_type_spec_1: record
          header: clt$type_specification_header,
          qualifier: clt$keyword_type_qualifier,
          keyword_specs: array [1 .. 1] of clt$keyword_specification,
        recend,
        type_size_2: clt$type_specification_size,
        element_type_spec_2: 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 .. 26] of clt$keyword_specification,
          recend,
        recend,
        default_value: string (3),
      recend,
      type3: record
        header: clt$type_specification_header,
        qualifier: clt$union_type_qualifier,
        type_size_1: clt$type_specification_size,
        element_type_spec_1: record
          header: clt$type_specification_header,
          qualifier: clt$keyword_type_qualifier,
          keyword_specs: array [1 .. 2] of clt$keyword_specification,
        recend,
        type_size_2: clt$type_specification_size,
        element_type_spec_2: 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 .. 4] of clt$keyword_specification,
          recend,
        recend,
        default_value: string (11),
      recend,
      type4: record
        header: clt$type_specification_header,
        default_value: string (7),
      recend,
      type5: record
        header: clt$type_specification_header,
      recend,
    recend := [
    [1,
    [89, 8, 16, 22, 7, 42, 200],
    clc$command, 11, 5, 0, 0, 0, 0, 5, 'OCM$ANAOL_DISPD'], [
    ['DISPLAY_OPTION                 ',clc$nominal_entry, 3],
    ['DISPLAY_OPTIONS                ',clc$alias_entry, 3],
    ['DO                             ',clc$abbreviation_entry, 3],
    ['M                              ',clc$abbreviation_entry, 1],
    ['MODULE                         ',clc$alias_entry, 1],
    ['MODULES                        ',clc$nominal_entry, 1],
    ['O                              ',clc$abbreviation_entry, 4],
    ['OUTPUT                         ',clc$nominal_entry, 4],
    ['PD                             ',clc$abbreviation_entry, 2],
    ['PERFORMANCE_DATA               ',clc$nominal_entry, 2],
    ['STATUS                         ',clc$nominal_entry, 5]],
    [
{ PARAMETER 1
    [6, 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, 113, clc$optional_default_parameter, 0, 3],
{ PARAMETER 2
    [10, 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, 1049, clc$optional_default_parameter, 0, 3],
{ PARAMETER 3
    [1, 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, 272, clc$optional_default_parameter, 0, 11],
{ PARAMETER 4
    [8, 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 5
    [11, 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$union_type], [[clc$keyword_type,
    clc$list_type],
    FALSE, 3],
    44, [[1, 0, clc$keyword_type], [1], [
      ['ALL                            ', clc$nominal_entry,
  clc$normal_usage_entry, 1]]
      ],
    19, [[1, 0, clc$list_type], [3, 1, clc$max_list_size, FALSE],
        [[1, 0, clc$program_name_type]]
      ],
    26, [[1, 0, clc$list_type], [10, 1, clc$max_list_size, FALSE],
        [[1, 0, clc$range_type], [3],
          [[1, 0, clc$program_name_type]]
        ]
      ]
    ,
    'all'],
{ PARAMETER 2
    [[1, 0, clc$union_type], [[clc$keyword_type,
    clc$list_type],
    FALSE, 2],
    44, [[1, 0, clc$keyword_type], [1], [
      ['ALL                            ', clc$nominal_entry,
  clc$normal_usage_entry, 1]]
      ],
    985, [[1, 0, clc$list_type], [969, 1, clc$max_list_size, FALSE],
        [[1, 0, clc$keyword_type], [26], [
        ['BM                             ', clc$abbreviation_entry,
  clc$normal_usage_entry, 1],
        ['BOUND_MODULES                  ', clc$nominal_entry,
  clc$normal_usage_entry, 1],
        ['LINE_TABLES                    ', clc$nominal_entry,
  clc$normal_usage_entry, 2],
        ['LM                             ', clc$abbreviation_entry,
  clc$normal_usage_entry, 3],
        ['LOAD_MODULES                   ', clc$nominal_entry,
  clc$normal_usage_entry, 3],
        ['LT                             ', clc$abbreviation_entry,
  clc$normal_usage_entry, 2],
        ['MEP                            ', clc$abbreviation_entry,
  clc$normal_usage_entry, 4],
        ['MULTIPLE_ENTRY_POINTS          ', clc$nominal_entry,
  clc$normal_usage_entry, 4],
        ['OBJECT_MODULES                 ', clc$nominal_entry,
  clc$normal_usage_entry, 5],
        ['OD                             ', clc$abbreviation_entry,
  clc$normal_usage_entry, 6],
        ['OL                             ', clc$abbreviation_entry,
  clc$normal_usage_entry, 7],
        ['OM                             ', clc$abbreviation_entry,
  clc$normal_usage_entry, 5],
        ['OPT_DEBUG                      ', clc$nominal_entry,
  clc$normal_usage_entry, 6],
        ['OPT_LOW                        ', clc$nominal_entry,
  clc$normal_usage_entry, 7],
        ['PARAMETER_CHECKING             ', clc$nominal_entry,
  clc$normal_usage_entry, 8],
        ['PC                             ', clc$abbreviation_entry,
  clc$normal_usage_entry, 8],
        ['RC                             ', clc$abbreviation_entry,
  clc$normal_usage_entry, 9],
        ['RL                             ', clc$abbreviation_entry,
  clc$normal_usage_entry, 10],
        ['RLC                            ', clc$abbreviation_entry,
  clc$normal_usage_entry, 11],
        ['RUNTIME_CHECKING               ', clc$nominal_entry,
  clc$normal_usage_entry, 9],
        ['RUNTIME_LIBRARIES              ', clc$nominal_entry,
  clc$normal_usage_entry, 10],
        ['RUNTIME_LIBRARY_CALLS          ', clc$nominal_entry,
  clc$normal_usage_entry, 11],
        ['ST                             ', clc$abbreviation_entry,
  clc$normal_usage_entry, 12],
        ['SYMBOL_TABLES                  ', clc$nominal_entry,
  clc$normal_usage_entry, 12],
        ['UNREFERENCED_SECTIONS          ', clc$nominal_entry,
  clc$normal_usage_entry, 13],
        ['US                             ', clc$abbreviation_entry,
  clc$normal_usage_entry, 13]]
        ]
      ]
    ,
    'all'],
{ PARAMETER 3
    [[1, 0, clc$union_type], [[clc$keyword_type,
    clc$list_type],
    FALSE, 2],
    81, [[1, 0, clc$keyword_type], [2], [
      ['ALL                            ', clc$nominal_entry,
  clc$normal_usage_entry, 1],
      ['NONE                           ', clc$nominal_entry,
  clc$normal_usage_entry, 2]]
      ],
    171, [[1, 0, clc$list_type], [155, 1, clc$max_list_size, FALSE],
        [[1, 0, clc$keyword_type], [4], [
        ['D                              ', clc$abbreviation_entry,
  clc$normal_usage_entry, 1],
        ['DESCRIPTION                    ', clc$nominal_entry,
  clc$normal_usage_entry, 1],
        ['MN                             ', clc$abbreviation_entry,
  clc$normal_usage_entry, 2],
        ['MODULE_NAMES                   ', clc$nominal_entry,
  clc$normal_usage_entry, 2]]
        ]
      ]
    ,
    'description'],
{ PARAMETER 4
    [[1, 0, clc$file_type],
    '$output'],
{ PARAMETER 5
    [[1, 0, clc$status_type]]];

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

    CONST
      p$modules = 1,
      p$performance_data = 2,
      p$display_option = 3,
      p$output = 4,
      p$status = 5;

    VAR
      pvt: array [1 .. 5] of clt$parameter_value;

    VAR
      display_options: oct$anaol_performance_options,
      end_of_list: ^oct$module_item,
      first_module: pmt$program_name,
      last_module: pmt$program_name,
      module_index: clt$list_size,
      node: ^clt$data_value,
      performance_problems: oct$anaol_performance_problems,
      output_file: clt$file;


    status.normal := TRUE;

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

    IF (ocv$object_library = NIL) THEN
      osp$set_status_condition (oce$object_library_not_analyzed, status);
      RETURN;
    IFEND;

    end_of_list := ^ocv$object_library^.module_list^ [occ$head_of_list];
    end_of_list^.link := NIL;

    IF (pvt [p$modules].value^.kind = clc$keyword) THEN

{ The only keyword is 'ALL'. Add all modules.

      FOR module_index := 1 TO UPPERBOUND (ocv$object_library^.module_list^) DO
        end_of_list^.link := ^ocv$object_library^.module_list^ [module_index];
        end_of_list := end_of_list^.link;
      FOREND;
      end_of_list^.link := NIL;
    ELSE
      node := pvt [p$modules].value;
      WHILE (node <> NIL) AND (node^.element_value <> NIL) DO
        IF node^.element_value^.kind = clc$range THEN
          first_module := node^.element_value^.low_value^.program_name_value;
          last_module := node^.element_value^.high_value^.program_name_value;
        ELSE
          first_module := node^.element_value^.program_name_value;
          last_module := first_module;
        IFEND;
        add_module_subrange (first_module, last_module, ocv$object_library^.module_list, end_of_list, status);
        IF NOT status.normal THEN
          RETURN;
        IFEND;
        node := node^.link;
      WHILEND;
    IFEND;

    IF (pvt [p$performance_data].value^.kind = clc$keyword) THEN
      performance_problems := -$oct$anaol_performance_problems [];
    ELSE
      performance_problems := $oct$anaol_performance_problems [];
      node := pvt [p$performance_data].value;
      WHILE node <> NIL DO
        IF (node^.element_value^.keyword_value = 'BOUND_MODULES') THEN
          performance_problems := performance_problems + $oct$anaol_performance_problems [occ$bound_module];
        ELSEIF (node^.element_value^.keyword_value = 'LINE_TABLES') THEN
          performance_problems := performance_problems + $oct$anaol_performance_problems [occ$line_tables];
        ELSEIF (node^.element_value^.keyword_value = 'LOAD_MODULES') THEN
          performance_problems := performance_problems + $oct$anaol_performance_problems [occ$load_module];
        ELSEIF (node^.element_value^.keyword_value = 'MULTIPLE_ENTRY_POINTS') THEN
          performance_problems := performance_problems + $oct$anaol_performance_problems
                [occ$multiple_entry_points];
        ELSEIF (node^.element_value^.keyword_value = 'OBJECT_MODULES') THEN
          performance_problems := performance_problems + $oct$anaol_performance_problems [occ$object_module];
        ELSEIF (node^.element_value^.keyword_value = 'OPT_DEBUG') THEN
          performance_problems := performance_problems + $oct$anaol_performance_problems [occ$opt_debug];
        ELSEIF (node^.element_value^.keyword_value = 'OPT_LOW') THEN
          performance_problems := performance_problems + $oct$anaol_performance_problems [occ$opt_low];
        ELSEIF (node^.element_value^.keyword_value = 'PARAMETER_CHECKING') THEN
          performance_problems := performance_problems + $oct$anaol_performance_problems
                [occ$parameter_checking];
        ELSEIF (node^.element_value^.keyword_value = 'RUNTIME_CHECKING') THEN
          performance_problems := performance_problems + $oct$anaol_performance_problems
                [occ$runtime_checking];
        ELSEIF (node^.element_value^.keyword_value = 'RUNTIME_LIBRARIES') THEN
          performance_problems := performance_problems + $oct$anaol_performance_problems
                [occ$runtime_libraries];
        ELSEIF (node^.element_value^.keyword_value = 'RUNTIME_LIBRARY_CALLS') THEN
          performance_problems := performance_problems + $oct$anaol_performance_problems
                [occ$runtime_library_calls];
        ELSEIF (node^.element_value^.keyword_value = 'SYMBOL_TABLES') THEN
          performance_problems := performance_problems + $oct$anaol_performance_problems [occ$symbol_tables];
        ELSE { node^.element_value^.keyword_value = 'UNREFERENCED_SECTIONS'
          performance_problems := performance_problems + $oct$anaol_performance_problems
                [occ$unreferenced_sections];
        IFEND;
        node := node^.link;
      WHILEND;
    IFEND;

    IF (pvt [p$display_option].value^.kind = clc$keyword) THEN
      IF (pvt [p$display_option].value^.keyword_value = 'ALL') THEN
        display_options := -$oct$anaol_performance_options [];
      ELSE { NONE
        display_options := $oct$anaol_performance_options [];
      IFEND;
    ELSE
      display_options := $oct$anaol_performance_options [];
      node := pvt [p$display_option].value;
      WHILE node <> NIL DO
        CASE node^.element_value^.keyword_value (1) OF
        = 'D' =
          display_options := display_options + $oct$anaol_performance_options [occ$display_description];
        = 'M' =
          display_options := display_options + $oct$anaol_performance_options [occ$display_module_names];
        ELSE
          ;
        CASEND;
        node := node^.link;
      WHILEND;
    IFEND;

    clp$convert_string_to_file (pvt [p$output].value^.file_value^, output_file, status);
    IF NOT status.normal THEN
      RETURN;
    IFEND;

    ocp$display_performance_anal (ocv$object_library, performance_problems, display_options, output_file,
          status);

  PROCEND display_performance_command;
?? OLDTITLE ??
?? NEWTITLE := 'display_section_usage_command', EJECT ??

  PROCEDURE display_section_usage_command
    (    parameter_list: clt$parameter_list;
     VAR status: ost$status);


{ PROCEDURE (ocm$anaol_dissa) display_section_analysis, dissa (
{   modules, module, m: any of
{       key
{         all
{       keyend
{       list of program_name
{       list of range of program_name
{     anyend = all
{   section_kinds, sk: any of
{       key
{         all
{       keyend
{       list of key
{         (code, c)
{         (binding, b)
{         (working_storage, ws)
{         (extensible_working_storage, ews)
{         (common_block, cb)
{         (extensible_common_block, ecb)
{       keyend
{     anyend = all
{   section_access_attributes, saa: any of
{       key
{         all
{       keyend
{       list of key
{         (read, r)
{         (write, w)
{         (execute, e)
{         (binding, b)
{       keyend
{     anyend = all
{   section_name, sn: name = $optional
{   output, o: file = $output
{   status)

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

  VAR
    pdt: [STATIC, READ, cls$declaration_section] record
      header: clt$pdt_header,
      names: array [1 .. 12] of clt$pdt_parameter_name,
      parameters: array [1 .. 6] of clt$pdt_parameter,
      type1: record
        header: clt$type_specification_header,
        qualifier: clt$union_type_qualifier,
        type_size_1: clt$type_specification_size,
        element_type_spec_1: record
          header: clt$type_specification_header,
          qualifier: clt$keyword_type_qualifier,
          keyword_specs: array [1 .. 1] of clt$keyword_specification,
        recend,
        type_size_2: clt$type_specification_size,
        element_type_spec_2: record
          header: clt$type_specification_header,
          qualifier: clt$list_type_qualifier,
          element_type_spec: record
            header: clt$type_specification_header,
          recend,
        recend,
        type_size_3: clt$type_specification_size,
        element_type_spec_3: record
          header: clt$type_specification_header,
          qualifier: clt$list_type_qualifier,
          element_type_spec: record
            header: clt$type_specification_header,
            qualifier: clt$range_type_qualifier,
            element_type_spec: record
              header: clt$type_specification_header,
            recend,
          recend,
        recend,
        default_value: string (3),
      recend,
      type2: record
        header: clt$type_specification_header,
        qualifier: clt$union_type_qualifier,
        type_size_1: clt$type_specification_size,
        element_type_spec_1: record
          header: clt$type_specification_header,
          qualifier: clt$keyword_type_qualifier,
          keyword_specs: array [1 .. 1] of clt$keyword_specification,
        recend,
        type_size_2: clt$type_specification_size,
        element_type_spec_2: 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 .. 12] of clt$keyword_specification,
          recend,
        recend,
        default_value: string (3),
      recend,
      type3: record
        header: clt$type_specification_header,
        qualifier: clt$union_type_qualifier,
        type_size_1: clt$type_specification_size,
        element_type_spec_1: record
          header: clt$type_specification_header,
          qualifier: clt$keyword_type_qualifier,
          keyword_specs: array [1 .. 1] of clt$keyword_specification,
        recend,
        type_size_2: clt$type_specification_size,
        element_type_spec_2: 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 .. 8] of clt$keyword_specification,
          recend,
        recend,
        default_value: string (3),
      recend,
      type4: record
        header: clt$type_specification_header,
        qualifier: clt$name_type_qualifier,
      recend,
      type5: record
        header: clt$type_specification_header,
        default_value: string (7),
      recend,
      type6: record
        header: clt$type_specification_header,
      recend,
    recend := [
    [1,
    [89, 8, 16, 23, 9, 19, 316],
    clc$command, 12, 6, 0, 0, 0, 0, 6, 'OCM$ANAOL_DISSA'], [
    ['M                              ',clc$abbreviation_entry, 1],
    ['MODULE                         ',clc$alias_entry, 1],
    ['MODULES                        ',clc$nominal_entry, 1],
    ['O                              ',clc$abbreviation_entry, 5],
    ['OUTPUT                         ',clc$nominal_entry, 5],
    ['SAA                            ',clc$abbreviation_entry, 3],
    ['SECTION_ACCESS_ATTRIBUTES      ',clc$nominal_entry, 3],
    ['SECTION_KINDS                  ',clc$nominal_entry, 2],
    ['SECTION_NAME                   ',clc$nominal_entry, 4],
    ['SK                             ',clc$abbreviation_entry, 2],
    ['SN                             ',clc$abbreviation_entry, 4],
    ['STATUS                         ',clc$nominal_entry, 6]],
    [
{ PARAMETER 1
    [3, 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, 113, clc$optional_default_parameter, 0, 3],
{ PARAMETER 2
    [8, 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, 531, clc$optional_default_parameter, 0, 3],
{ PARAMETER 3
    [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, 383, clc$optional_default_parameter, 0, 3],
{ PARAMETER 4
    [9, 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, 5, clc$optional_parameter, 0, 0],
{ PARAMETER 5
    [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$optional_default_parameter, 0, 7],
{ PARAMETER 6
    [12, 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$union_type], [[clc$keyword_type,
    clc$list_type],
    FALSE, 3],
    44, [[1, 0, clc$keyword_type], [1], [
      ['ALL                            ', clc$nominal_entry,
  clc$normal_usage_entry, 1]]
      ],
    19, [[1, 0, clc$list_type], [3, 1, clc$max_list_size, FALSE],
        [[1, 0, clc$program_name_type]]
      ],
    26, [[1, 0, clc$list_type], [10, 1, clc$max_list_size, FALSE],
        [[1, 0, clc$range_type], [3],
          [[1, 0, clc$program_name_type]]
        ]
      ]
    ,
    'all'],
{ PARAMETER 2
    [[1, 0, clc$union_type], [[clc$keyword_type,
    clc$list_type],
    FALSE, 2],
    44, [[1, 0, clc$keyword_type], [1], [
      ['ALL                            ', clc$nominal_entry,
  clc$normal_usage_entry, 1]]
      ],
    467, [[1, 0, clc$list_type], [451, 1, clc$max_list_size, FALSE],
        [[1, 0, clc$keyword_type], [12], [
        ['B                              ', clc$abbreviation_entry,
  clc$normal_usage_entry, 2],
        ['BINDING                        ', clc$nominal_entry,
  clc$normal_usage_entry, 2],
        ['C                              ', clc$abbreviation_entry,
  clc$normal_usage_entry, 1],
        ['CB                             ', clc$abbreviation_entry,
  clc$normal_usage_entry, 5],
        ['CODE                           ', clc$nominal_entry,
  clc$normal_usage_entry, 1],
        ['COMMON_BLOCK                   ', clc$nominal_entry,
  clc$normal_usage_entry, 5],
        ['ECB                            ', clc$abbreviation_entry,
  clc$normal_usage_entry, 6],
        ['EWS                            ', clc$abbreviation_entry,
  clc$normal_usage_entry, 4],
        ['EXTENSIBLE_COMMON_BLOCK        ', clc$nominal_entry,
  clc$normal_usage_entry, 6],
        ['EXTENSIBLE_WORKING_STORAGE     ', clc$nominal_entry,
  clc$normal_usage_entry, 4],
        ['WORKING_STORAGE                ', clc$nominal_entry,
  clc$normal_usage_entry, 3],
        ['WS                             ', clc$abbreviation_entry,
  clc$normal_usage_entry, 3]]
        ]
      ]
    ,
    'all'],
{ PARAMETER 3
    [[1, 0, clc$union_type], [[clc$keyword_type,
    clc$list_type],
    FALSE, 2],
    44, [[1, 0, clc$keyword_type], [1], [
      ['ALL                            ', clc$nominal_entry,
  clc$normal_usage_entry, 1]]
      ],
    319, [[1, 0, clc$list_type], [303, 1, clc$max_list_size, FALSE],
        [[1, 0, clc$keyword_type], [8], [
        ['B                              ', clc$abbreviation_entry,
  clc$normal_usage_entry, 4],
        ['BINDING                        ', clc$nominal_entry,
  clc$normal_usage_entry, 4],
        ['E                              ', clc$abbreviation_entry,
  clc$normal_usage_entry, 3],
        ['EXECUTE                        ', clc$nominal_entry,
  clc$normal_usage_entry, 3],
        ['R                              ', clc$abbreviation_entry,
  clc$normal_usage_entry, 1],
        ['READ                           ', clc$nominal_entry,
  clc$normal_usage_entry, 1],
        ['W                              ', clc$abbreviation_entry,
  clc$normal_usage_entry, 2],
        ['WRITE                          ', clc$nominal_entry,
  clc$normal_usage_entry, 2]]
        ]
      ]
    ,
    'all'],
{ PARAMETER 4
    [[1, 0, clc$name_type], [1, osc$max_name_size]],
{ PARAMETER 5
    [[1, 0, clc$file_type],
    '$output'],
{ PARAMETER 6
    [[1, 0, clc$status_type]]];

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

    CONST
      p$modules = 1,
      p$section_kinds = 2,
      p$section_access_attributes = 3,
      p$section_name = 4,
      p$output = 5,
      p$status = 6;

    VAR
      pvt: array [1 .. 6] of clt$parameter_value;

    VAR
      access_attributes: llt$section_access_attributes,
      end_of_list: ^oct$module_item,
      first_module: pmt$program_name,
      index: clt$list_size,
      last_module: pmt$program_name,
      node: ^clt$data_value,
      output_file: clt$file,
      section_name: pmt$program_name,
      section_kinds: oct$section_kinds;


    status.normal := TRUE;

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

    IF (ocv$object_library = NIL) THEN
      osp$set_status_condition (oce$object_library_not_analyzed, status);
      RETURN;
    IFEND;

    end_of_list := ^ocv$object_library^.module_list^ [occ$head_of_list];
    end_of_list^.link := NIL;

    IF (pvt [p$modules].value^.kind = clc$keyword) THEN

{ The only keyword is 'ALL'. Add all modules.

      FOR index := 1 TO UPPERBOUND (ocv$object_library^.module_list^) DO
        end_of_list^.link := ^ocv$object_library^.module_list^ [index];
        end_of_list := end_of_list^.link;
      FOREND;
      end_of_list^.link := NIL;
    ELSE
      node := pvt [p$modules].value;
      WHILE (node <> NIL) AND (node^.element_value <> NIL) DO
        IF node^.element_value^.kind = clc$range THEN
          first_module := node^.element_value^.low_value^.program_name_value;
          last_module := node^.element_value^.high_value^.program_name_value;
        ELSE
          first_module := node^.element_value^.program_name_value;
          last_module := first_module;
        IFEND;
        add_module_subrange (first_module, last_module, ocv$object_library^.module_list, end_of_list, status);
        IF NOT status.normal THEN
          RETURN;
        IFEND;
        node := node^.link;
      WHILEND;
    IFEND;

    IF pvt [p$section_kinds].value^.kind = clc$keyword THEN
      section_kinds := -$oct$section_kinds [];
    ELSE
      section_kinds := $oct$section_kinds [];
      node := pvt [p$section_kinds].value;
      WHILE node <> NIL DO
        IF (node^.element_value^.keyword_value = 'CODE') THEN
          section_kinds := section_kinds + $oct$section_kinds [llc$code_section];
        ELSEIF (node^.element_value^.keyword_value = 'BINDING') THEN
          section_kinds := section_kinds + $oct$section_kinds [llc$binding_section];
        ELSEIF (node^.element_value^.keyword_value = 'WORKING_STORAGE') THEN
          section_kinds := section_kinds + $oct$section_kinds [llc$working_storage_section];
        ELSEIF (node^.element_value^.keyword_value = 'EXTENSIBLE_WORKING_STORAGE') THEN
          section_kinds := section_kinds + $oct$section_kinds [llc$extensible_working_storage];
        ELSEIF (node^.element_value^.keyword_value = 'COMMON_BLOCK') THEN
          section_kinds := section_kinds + $oct$section_kinds [llc$common_block];
        ELSE { node^.element_value^.keyword_value = 'EXTENSIBLE_COMMON_BLOCK'
          section_kinds := section_kinds + $oct$section_kinds [llc$extensible_common_block];
        IFEND;
        node := node^.link;
      WHILEND;
    IFEND;

    IF pvt [p$section_access_attributes].value^.kind = clc$keyword THEN
      access_attributes := occ$all_access_attributes;
    ELSE
      access_attributes := $llt$section_access_attributes [];
      node := pvt [p$section_access_attributes].value;
      WHILE node <> NIL DO
        CASE node^.element_value^.keyword_value (1) OF
        = 'R' =
          access_attributes := access_attributes + $llt$section_access_attributes [llc$read];
        = 'W' =
          access_attributes := access_attributes + $llt$section_access_attributes [llc$write];
        = 'E' =
          access_attributes := access_attributes + $llt$section_access_attributes [llc$execute];
        = 'B' =
          access_attributes := access_attributes + $llt$section_access_attributes [llc$binding];
        ELSE
          ;
        CASEND;
        node := node^.link;
      WHILEND;
    IFEND;

    IF pvt [p$section_name].specified THEN
      section_name := pvt [p$section_name].value^.name_value;
    ELSE
      section_name := occ$any_section_name;
    IFEND;

    clp$convert_string_to_file (pvt [p$output].value^.file_value^, output_file, status);
    IF NOT status.normal THEN
      RETURN;
    IFEND;

    ocp$display_section_usage (ocv$object_library, section_kinds, access_attributes, section_name,
          output_file, status);

  PROCEND display_section_usage_command;
?? OLDTITLE ??
?? NEWTITLE := 'quit_command', EJECT ??

  PROCEDURE quit_command
    (    parameter_list: clt$parameter_list;
     VAR status: ost$status);


{ PROCEDURE (ocm$anaol_qui) quit, qui

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

  VAR
    pdt: [STATIC, READ, cls$declaration_section] record
      header: clt$pdt_header,
    recend := [
    [1,
    [89, 8, 16, 23, 39, 15, 258],
    clc$command, 0, 0, 0, 0, 0, 0, 0, 'OCM$ANAOL_QUI']];

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

    status.normal := TRUE;

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

    close_current_object_library;
    clp$end_include (utility_name, status);

  PROCEND quit_command;
?? OLDTITLE ??
?? NEWTITLE := 'binding_section_references', EJECT ??

  PROCEDURE binding_section_references
    (    parameter_list: clt$parameter_list;
     VAR work_area: ^clt$work_area;
     VAR result: ^clt$data_value;
     VAR status: ost$status);

{ FUNCTION (ocm$anaol_$binsr) $binding_section_references, $binsr (
{   module: any of
{       key
{         all
{       keyend
{       list of program_name
{       list of range of program_name
{     anyend = all
{   )

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

  VAR
    pdt: [STATIC, READ, cls$declaration_section] record
      header: clt$pdt_header,
      names: array [1 .. 1] of clt$pdt_parameter_name,
      parameters: array [1 .. 1] of clt$pdt_parameter,
      type1: record
        header: clt$type_specification_header,
        qualifier: clt$union_type_qualifier,
        type_size_1: clt$type_specification_size,
        element_type_spec_1: record
          header: clt$type_specification_header,
          qualifier: clt$keyword_type_qualifier,
          keyword_specs: array [1 .. 1] of clt$keyword_specification,
        recend,
        type_size_2: clt$type_specification_size,
        element_type_spec_2: record
          header: clt$type_specification_header,
          qualifier: clt$list_type_qualifier_v2,
          element_type_spec: record
            header: clt$type_specification_header,
          recend,
        recend,
        type_size_3: clt$type_specification_size,
        element_type_spec_3: record
          header: clt$type_specification_header,
          qualifier: clt$list_type_qualifier_v2,
          element_type_spec: record
            header: clt$type_specification_header,
            qualifier: clt$range_type_qualifier,
            element_type_spec: record
              header: clt$type_specification_header,
            recend,
          recend,
        recend,
        default_value: string (3),
      recend,
    recend := [
    [1,
    [92, 1, 24, 19, 50, 48, 661],
    clc$function, 1, 1, 0, 0, 0, 0, 0, 'OCM$ANAOL_$BINSR'], [
    ['MODULE                         ',clc$nominal_entry, 1]],
    [
{ PARAMETER 1
    [1, clc$normal_usage_entry, clc$non_secure_parameter,
    $clt$parameter_spec_methods[clc$specify_positionally],
    clc$pass_by_value, clc$immediate_evaluation, clc$standard_parameter_checking, 113,
  clc$optional_default_parameter, 0, 3]],
{ PARAMETER 1
    [[1, 0, clc$union_type], [[clc$keyword_type, clc$list_type],
    FALSE, 3],
    44, [[1, 0, clc$keyword_type], [1], [
      ['ALL                            ', clc$nominal_entry, clc$normal_usage_entry, 1]]
      ],
    19, [[1, 0, clc$list_type], [3, 1, clc$max_list_size, 0, FALSE, FALSE],
        [[1, 0, clc$program_name_type]]
      ],
    26, [[1, 0, clc$list_type], [10, 1, clc$max_list_size, 0, FALSE, FALSE],
        [[1, 0, clc$range_type], [3],
          [[1, 0, clc$program_name_type]]
        ]
      ]
    ,
    'all']];

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

    CONST
      p$module = 1;

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

    VAR
      count: 0 .. llc$max_binding_items,
      end_of_list: ^oct$module_item,
      first_module: pmt$program_name,
      index: clt$list_size,
      last_module: pmt$program_name,
      node: ^clt$data_value;


    status.normal := TRUE;

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

    IF ocv$object_library = NIL THEN
      osp$set_status_condition (oce$usel_not_executed, status);
      RETURN;
    IFEND;

    end_of_list := ^ocv$object_library^.module_list^ [occ$head_of_list];
    end_of_list^.link := NIL;

    IF pvt [p$module].value^.kind = clc$keyword THEN

{ The only keyword is "ALL".  Add all modules.

      FOR index := 1 TO UPPERBOUND (ocv$object_library^.module_list^) DO
        end_of_list^.link := ^ocv$object_library^.module_list^ [index];
        end_of_list := end_of_list^.link;
      FOREND;
      end_of_list^.link := NIL;

    ELSE
      node := pvt [p$module].value;
      WHILE (node <> NIL) AND (node^.element_value <> NIL) DO
        IF node^.element_value^.kind = clc$range THEN
          first_module := node^.element_value^.low_value^.program_name_value;
          last_module := node^.element_value^.high_value^.program_name_value;
        ELSE
          first_module := node^.element_value^.program_name_value;
          last_module := first_module;
        IFEND;
        add_module_subrange (first_module, last_module, ocv$object_library^.module_list, end_of_list, status);
        IF NOT status.normal THEN
          RETURN;
        IFEND;
        node := node^.link;
      WHILEND;
    IFEND;

    ocp$get_binding_section_refs (ocv$object_library, count);

    clp$make_integer_value (count, 10, FALSE, work_area, result);

  PROCEND binding_section_references;
?? OLDTITLE ??
?? NEWTITLE := '[XDCL, #GATE] ocp$_analyze_object_library', EJECT ??

  PROCEDURE [XDCL, #GATE] ocp$_analyze_object_library
    (    parameter_list: clt$parameter_list;
     VAR status: ost$status);

{ PROCEDURE (ocm$anaol) analyze_object_library, anaol (
{   library, l: file = $optional
{   status)

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

  VAR
    pdt: [STATIC, READ, cls$declaration_section] record
      header: clt$pdt_header,
      names: array [1 .. 3] of clt$pdt_parameter_name,
      parameters: array [1 .. 2] of clt$pdt_parameter,
      type1: record
        header: clt$type_specification_header,
      recend,
      type2: record
        header: clt$type_specification_header,
      recend,
    recend := [
    [1,
    [89, 8, 16, 17, 8, 9, 454],
    clc$command, 3, 2, 0, 0, 0, 0, 2, 'OCM$ANAOL'], [
    ['L                              ',clc$abbreviation_entry, 1],
    ['LIBRARY                        ',clc$nominal_entry, 1],
    ['STATUS                         ',clc$nominal_entry, 2]],
    [
{ 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$optional_parameter, 0, 0],
{ PARAMETER 2
    [3, 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$file_type]],
{ PARAMETER 2
    [[1, 0, clc$status_type]]];

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

    CONST
      p$library = 1,
      p$status = 2;

    VAR
      pvt: array [1 .. 2] of clt$parameter_value;

{ table command_table type=command scope=local
{ command (use_library,                       usel) use_library_command ..
{   cm=local
{ command (display_library_analysis,          disla) ..
{   display_library_command cm=local
{ command (display_module_analysis,           disma) ..
{   display_module_command cm=local
{ command (display_performance_data,          dispd) ..
{   display_performance_command cm=local
{ command (display_section_analysis,          dissa) ..
{   display_section_usage_command cm=local
{ command (quit,                              qui) quit_command cm=local
{ command (display_section_usage,             dissu) ..
{   display_section_usage_command cm=local a=hidden
{ command (analyze_object_library,            anaol) use_library_command ..
{   cm=local a=hidden
{ tablend

?? PUSH (LISTEXT := ON) ??

    VAR
      command_table: [STATIC, READ] ^clt$command_table := ^command_table_entries,

      command_table_entries: [STATIC, READ] array [1 .. 16] of clt$command_table_entry := [
            {} ['ANALYZE_OBJECT_LIBRARY         ', clc$nominal_entry, clc$hidden_entry, 8,
            clc$automatically_log, clc$linked_call, ^use_library_command],
            {} ['ANAOL                          ', clc$abbreviation_entry, clc$hidden_entry, 8,
            clc$automatically_log, clc$linked_call, ^use_library_command],
            {} ['DISLA                          ', clc$abbreviation_entry, clc$normal_usage_entry, 2,
            clc$automatically_log, clc$linked_call, ^display_library_command],
            {} ['DISMA                          ', clc$abbreviation_entry, clc$normal_usage_entry, 3,
            clc$automatically_log, clc$linked_call, ^display_module_command],
            {} ['DISPD                          ', clc$abbreviation_entry, clc$normal_usage_entry, 4,
            clc$automatically_log, clc$linked_call, ^display_performance_command],
            {} ['DISPLAY_LIBRARY_ANALYSIS       ', clc$nominal_entry, clc$normal_usage_entry, 2,
            clc$automatically_log, clc$linked_call, ^display_library_command],
            {} ['DISPLAY_MODULE_ANALYSIS        ', clc$nominal_entry, clc$normal_usage_entry, 3,
            clc$automatically_log, clc$linked_call, ^display_module_command],
            {} ['DISPLAY_PERFORMANCE_DATA       ', clc$nominal_entry, clc$normal_usage_entry, 4,
            clc$automatically_log, clc$linked_call, ^display_performance_command],
            {} ['DISPLAY_SECTION_ANALYSIS       ', clc$nominal_entry, clc$normal_usage_entry, 5,
            clc$automatically_log, clc$linked_call, ^display_section_usage_command],
            {} ['DISPLAY_SECTION_USAGE          ', clc$nominal_entry, clc$hidden_entry, 7,
            clc$automatically_log, clc$linked_call, ^display_section_usage_command],
            {} ['DISSA                          ', clc$abbreviation_entry, clc$normal_usage_entry, 5,
            clc$automatically_log, clc$linked_call, ^display_section_usage_command],
            {} ['DISSU                          ', clc$abbreviation_entry, clc$hidden_entry, 7,
            clc$automatically_log, clc$linked_call, ^display_section_usage_command],
            {} ['QUI                            ', clc$abbreviation_entry, clc$normal_usage_entry, 6,
            clc$automatically_log, clc$linked_call, ^quit_command],
            {} ['QUIT                           ', clc$nominal_entry, clc$normal_usage_entry, 6,
            clc$automatically_log, clc$linked_call, ^quit_command],
            {} ['USEL                           ', clc$abbreviation_entry, clc$normal_usage_entry, 1,
            clc$automatically_log, clc$linked_call, ^use_library_command],
            {} ['USE_LIBRARY                    ', clc$nominal_entry, clc$normal_usage_entry, 1,
            clc$automatically_log, clc$linked_call, ^use_library_command]];

?? POP ??

{ table function_table t=f s=local
{ function ($binding_section_references, $binsr) binding_section_references ..
{   cm=local
{ tablend

?? PUSH (LISTEXT := ON) ??

VAR
  function_table: [STATIC, READ] ^clt$function_processor_table :=
      ^function_table_entries,

  function_table_entries: [STATIC, READ] array [1 .. 2] of
      clt$function_proc_table_entry := [
  {} ['$BINDING_SECTION_REFERENCES    ', clc$nominal_entry,
        clc$normal_usage_entry, 1, clc$linked_call,
        ^binding_section_references],
  {} ['$BINSR                         ', clc$abbreviation_entry,
        clc$normal_usage_entry, 1, clc$linked_call,
        ^binding_section_references]];

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

    VAR
      abort_condition: [STATIC, READ] pmt$condition := [pmc$user_defined_condition, occ$abort_condition],
      abort_descriptor: pmt$established_handler;




    PROCEDURE abort_handler
      (    condition: pmt$condition;
           condition_descriptor: ^pmt$condition_information;
           save_area: ^ost$stack_frame_save_area;
       VAR condition_status: ost$status);


      VAR
        abort_status: ^ost$status;


      abort_status := condition_descriptor;
      status := abort_status^;

      EXIT ocp$_analyze_object_library;


    PROCEND abort_handler;
?? OLDTITLE ??
?? EJECT ??

    VAR
      file: clt$file,
      ignore_status: ost$status;

    status.normal := TRUE;

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

    utility_attributes [1].command_table := command_table;
    utility_attributes [2].function_processor_table := function_table;
    pmp$establish_condition_handler (abort_condition, ^abort_handler, ^abort_descriptor, status);
    IF NOT status.normal THEN
      RETURN;
    IFEND;

    IF (pvt [p$library].specified) THEN
      clp$convert_string_to_file (pvt [p$library].value^.file_value^, file, status);
      IF NOT status.normal THEN
        RETURN;
      IFEND;

      open_object_library (file, status);
      IF NOT status.normal THEN
        RETURN;
      IFEND;
    IFEND;


    clp$begin_utility (utility_name, utility_attributes, status);
    ocp$abort_if_abnormal_status (status);

    clp$include_file (command_file, '', utility_name, status);
    IF NOT status.normal THEN
      RETURN;
    IFEND;

    clp$end_utility (utility_name, ignore_status);

  PROCEND ocp$_analyze_object_library;
?? OLDTITLE ??

MODEND ocm$analyze_object_library;
