?? RIGHT := 110 ??
?? NEWTITLE := 'CREATE_SUBPRODUCT_CORRECTION subutility: CHANGE_CORRECTION_ATTRIBUTE command.' ??
MODULE ram$change_correction_attrib;

{ PURPOSE:
{   This module contains the procedures to change certain subproduct
{   attributes of the subproduct correction and to add a list of PSRs.
{
{ DESIGN:
{   The compiled module resides in RAF$LIBRARY.
{
{ NOTES:
{


?? NEWTITLE := 'Global Declarations Referenced by This Module', EJECT ??
?? PUSH (LISTEXT := ON) ??
*copyc rae$package_software_cc
*copyc rat$subproduct_info_types
?? POP ??
*copyc clp$evaluate_parameters
*copyc osp$set_status_abnormal
*copyc rap$process_psrs_entered
*copyc rap$validate_installation_paths
*copyc rav$correction_process_record

?? OLDTITLE ??
?? NEWTITLE := 'Global Declarations Declared by This Module', EJECT ??

?? OLDTITLE ??
?? NEWTITLE := '[XDCL] rap$change_correction_attrib', EJECT ??

{ PURPOSE:
{   This procedure changes certain attributes of the subproduct
{   correction and/or adds a list of PSRs to the subproduct info
{   sequence in memory.
{
{ DESIGN:
{   This procedure changes the values of the specified attributes in the
{   subproduct information file.  The values replace the values set by the
{   DEFINE_CORRECTION command.  If the installation scheme of the base level
{   is cycle based, it may not be changed to version based.  This procedure
{   is also used to process a list of PSRS answered and add all new PSRs (no
{   duplicates) to the correction definition.  The DEFINE_CORRECTION command
{   must be called before this command.
{
{ NOTES:
{   All PSR names are expected to begin with a letter.  The name may only have
{   letters and numerals.

  PROCEDURE [XDCL] rap$change_correction_attrib
    (    parameter_list: clt$parameter_list;
     VAR status: ost$status);

{ PROCEDURE chaca_pdt (
{   auto_install, ai: boolean = $optional
{   description, d: string 1..50 = $optional
{   development_group, dg: string 1..31 = $optional
{   hidden, h: boolean = $optional
{   installation_scheme, is: key
{       cycle_based, version_based
{     keyend = $optional
{   psrs_answered, pa: any of
{                        list of name rac$psr_name_length..rac$psr_name_length
{                        file
{                      anyend = $optional
{   status)

?? PUSH (LISTEXT := ON) ??

    VAR
      pdt: [STATIC, READ, cls$declaration_section] record
        header: clt$pdt_header,
        names: array [1 .. 13] of clt$pdt_parameter_name,
        parameters: array [1 .. 7] of clt$pdt_parameter,
        type1: record
          header: clt$type_specification_header,
        recend,
        type2: record
          header: clt$type_specification_header,
          qualifier: clt$string_type_qualifier,
        recend,
        type3: record
          header: clt$type_specification_header,
          qualifier: clt$string_type_qualifier,
        recend,
        type4: record
          header: clt$type_specification_header,
        recend,
        type5: record
          header: clt$type_specification_header,
          qualifier: clt$keyword_type_qualifier,
          keyword_specs: array [1 .. 2] of clt$keyword_specification,
        recend,
        type6: 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$list_type_qualifier,
            element_type_spec: record
              header: clt$type_specification_header,
              qualifier: clt$name_type_qualifier,
            recend,
          recend,
          type_size_2: clt$type_specification_size,
          element_type_spec_2: record
            header: clt$type_specification_header,
          recend,
        recend,
        type7: record
          header: clt$type_specification_header,
        recend,
      recend := [[1, [88, 10, 4, 21, 49, 39, 504], clc$command, 13, 7, 0, 0, 0, 0, 7, 'CHACA_PDT'],
            [['AI                             ', clc$abbreviation_entry, 1],
            ['AUTO_INSTALL                   ', clc$nominal_entry, 1],
            ['D                              ', clc$abbreviation_entry, 2],
            ['DESCRIPTION                    ', clc$nominal_entry, 2],
            ['DEVELOPMENT_GROUP              ', clc$nominal_entry, 3],
            ['DG                             ', clc$abbreviation_entry, 3],
            ['H                              ', clc$abbreviation_entry, 4],
            ['HIDDEN                         ', clc$nominal_entry, 4],
            ['INSTALLATION_SCHEME            ', clc$nominal_entry, 5],
            ['IS                             ', clc$abbreviation_entry, 5],
            ['PA                             ', clc$abbreviation_entry, 6],
            ['PSRS_ANSWERED                  ', clc$nominal_entry, 6],
            ['STATUS                         ', clc$nominal_entry, 7]], [
{ 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
      [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, 8, clc$optional_parameter, 0, 0],
{ PARAMETER 3
      [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, 8, clc$optional_parameter, 0, 0],
{ 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_parameter, 0, 0],
{ PARAMETER 5
      [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, 81, clc$optional_parameter, 0, 0],
{ PARAMETER 6
      [12, 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, 44, clc$optional_parameter, 0, 0],
{ PARAMETER 7
      [13, 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$boolean_type]],
{ PARAMETER 2
      [[1, 0, clc$string_type], [1, 50, FALSE]],
{ PARAMETER 3
      [[1, 0, clc$string_type], [1, 31, FALSE]],
{ PARAMETER 4
      [[1, 0, clc$boolean_type]],
{ PARAMETER 5
      [[1, 0, clc$keyword_type], [2], [['CYCLE_BASED                    ', clc$nominal_entry,
            clc$normal_usage_entry, 1], ['VERSION_BASED                  ', clc$nominal_entry,
            clc$normal_usage_entry, 2]]],
{ PARAMETER 6
      [[1, 0, clc$union_type], [[clc$file_type, clc$list_type], FALSE, 2], 21,
            [[1, 0, clc$list_type], [5, 1, clc$max_list_size, FALSE],
            [[1, 0, clc$name_type], [rac$psr_name_length, rac$psr_name_length]]], 3, [[1, 0, clc$file_type]]],
{ PARAMETER 7
      [[1, 0, clc$status_type]]];

?? POP ??

    CONST
      p$auto_install = 1,
      p$description = 2,
      p$development_group = 3,
      p$hidden = 4,
      p$installation_scheme = 5,
      p$psrs_answered = 6,
      p$status = 7;

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

    VAR
      old_psr_list_p: ^rat$psrs_answered,
      attributes: rat$subproduct_attributes;

    status.normal := TRUE;

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

    IF NOT rav$correction_process_record.correction_in_progress THEN
      osp$set_status_abnormal ('RA', rae$defc_command_not_called, 'CHANGE_CORRECTION_ATTRIBUTES', status);
      RETURN;
    IFEND;

    attributes := rav$correction_process_record.new_subproduct_info_pointers.attributes_p^;

    IF rav$correction_process_record.previous_correction_sif.file_opened THEN
      old_psr_list_p := rav$correction_process_record.previous_correction_sif.subproduct_info_pointers.
            psrs_answered_p;
    ELSE
      old_psr_list_p := NIL;
    IFEND;

    IF pvt [p$auto_install].specified THEN
      attributes.auto_install := pvt [p$auto_install].value^.boolean_value.value;
    IFEND;

    IF pvt [p$description].specified THEN
      attributes.description := pvt [p$description].value^.string_value^;
    IFEND;

    IF pvt [p$development_group].specified THEN
      attributes.development_group := pvt [p$development_group].value^.string_value^;
    IFEND;

    IF pvt [p$hidden].specified THEN
      attributes.hidden := pvt [p$hidden].value^.boolean_value.value;
    IFEND;

    IF pvt [p$installation_scheme].specified THEN

      IF pvt [p$installation_scheme].value^.keyword_value = 'VERSION_BASED' THEN

        IF (rav$correction_process_record.base_level_sif.subproduct_info_pointers.attributes_p^.
              installation_scheme = rac$cycle_based) THEN
          osp$set_status_abnormal ('RA', rae$incorrect_inst_scheme, '', status);
          RETURN;
        ELSE
          attributes.installation_scheme := rac$version_based;
        IFEND;

      ELSE {pvt [p$installation_scheme].value^.keyword_value = CYCLE_BASED}

        rap$validate_installation_paths (rav$correction_process_record.base_level_sif.
              subproduct_info_pointers.attributes_p^, rav$correction_process_record.base_level_sif.
              subproduct_info_pointers.path_container_p^, rav$correction_process_record.current_level_sif.
              subproduct_info_pointers.attributes_p^, rav$correction_process_record.current_level_sif.
              subproduct_info_pointers.path_container_p^, rac$cycle_based, TRUE {set_status_to_error},
              status);

        IF NOT status.normal THEN
          RETURN;
        IFEND;

        attributes.installation_scheme := rac$cycle_based;

      IFEND;

    IFEND;

    IF pvt [p$auto_install].specified THEN
      attributes.auto_install := pvt [p$auto_install].value^.boolean_value.value;
    IFEND;

    IF pvt [p$psrs_answered].specified THEN
      rap$process_psrs_entered (pvt [p$psrs_answered].value^,
            rav$correction_process_record.new_subproduct_info_pointers,
            rav$correction_process_record.previous_correction_sif, status);
    IFEND;

    IF status.normal THEN
      rav$correction_process_record.new_subproduct_info_pointers.attributes_p^ := attributes;
    IFEND;

  PROCEND rap$change_correction_attrib;

MODEND ram$change_correction_attrib;

