?? RIGHT := 110 ??
?? NEWTITLE := 'CREATE_SUBPRODUCT_CORRECTION subutility: RAP$VALIDATE_INSTALLATION_PATH procedure.' ??
MODULE ram$validate_installation_paths;

{ PURPOSE:
{   This module contains the procedure to validate two installation paths.
{
{ DESIGN:
{   The compiled module resides in RAF$LIBRARY.
{
{ NOTES:
{

?? NEWTITLE := 'Global Declarations Referenced by This Module', EJECT ??
?? PUSH (LISTEXT := ON) ??
*copyc ost$status
*copyc rae$package_software_cc
*copyc rat$subproduct_info_types
?? POP ??
*copyc osp$append_status_parameter
*copyc osp$generate_error_message
*copyc osp$set_status_abnormal
*copyc rap$convert_path_to_str

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

{ PURPOSE:
{   This procedure compares the two installation paths.
{
{ DESIGN:
{   The installation paths are entered and compared.  If the paths are
{   cycle based, they must be equal.  If the paths are version based,
{   they must be different.
{
{ NOTES:
{

  PROCEDURE [XDCL] rap$validate_installation_paths
    (    base_attributes: rat$subproduct_attributes;
         base_path_container: rat$path_container;
         current_attributes: rat$subproduct_attributes;
         current_path_container: rat$path_container;
         installation_scheme: rat$installation_scheme;
         set_status_to_error: boolean;
     VAR status: ost$status);

    VAR
      base_installation_path_str: rat$path,
      base_path_p: ^pft$path,
      current_installation_path_str: rat$path,
      current_path_p: ^pft$path,
      i: rat$path_container_index,
      ignore_status: ost$status,
      local_status: ost$status,
      message_status: ost$status;

    status.normal := TRUE;

    PUSH base_path_p: [1 .. base_attributes.installation_path.path_length];
    FOR i := 1 TO base_attributes.installation_path.path_length DO
      base_path_p^ [i] := base_path_container [i + base_attributes.installation_path.path_container_index -
            1];
    FOREND;

    PUSH current_path_p: [1 .. current_attributes.installation_path.path_length];
    FOR i := 1 TO current_attributes.installation_path.path_length DO
      current_path_p^ [i] := current_path_container [i + current_attributes.installation_path.
            path_container_index - 1];
    FOREND;

    rap$convert_path_to_str (base_path_p^, base_installation_path_str);
    rap$convert_path_to_str (current_path_p^, current_installation_path_str);

    IF installation_scheme = rac$cycle_based THEN
      IF base_installation_path_str.path (1, base_installation_path_str.size) <>
            current_installation_path_str.path (1, current_installation_path_str.size) THEN
        osp$set_status_abnormal ('RA', rae$unmatched_attribute, 'Installation Path', status);
        osp$append_status_parameter (osc$status_parameter_delimiter, base_attributes.pacs_catalog_path.
              path (1, base_attributes.pacs_catalog_path.size), status);
        osp$append_status_parameter (osc$status_parameter_delimiter, base_installation_path_str.
              path (1, base_installation_path_str.size), status);
        osp$append_status_parameter (osc$status_parameter_delimiter,
              current_attributes.pacs_catalog_path.path (1, current_attributes.pacs_catalog_path.size),
              status);
        osp$append_status_parameter (osc$status_parameter_delimiter, current_installation_path_str.
              path (1, current_installation_path_str.size), status);

      IFEND;

    ELSE {installation_scheme = rac$version_based}

      IF base_installation_path_str.path (1, base_installation_path_str.size) =
            current_installation_path_str.path (1, current_installation_path_str.size) THEN

        IF set_status_to_error THEN
          osp$set_status_abnormal ('RA', rae$matched_version_path_error, '', status);
        ELSE
          osp$set_status_abnormal ('RA', rae$matched_version_path_warn, '', local_status);
          osp$generate_error_message (local_status, ignore_status);
        IFEND;

      IFEND;

    IFEND;

  PROCEND rap$validate_installation_paths;

MODEND ram$validate_installation_paths;
