?? RIGHT := 110 ??
?? NEWTITLE := 'INSTALL_SOFTWARE Utility: RAP$ESTABLISH_ICR_SUBP_PTRS Interface.' ??
MODULE ram$establish_icr_subp_ptrs;

{ PURPOSE:
{   This module contains the interface that establishes the installation
{   control record's subproduct pointers.
{
{ DESIGN:
{   The compiled module resides in RAF$LIBRARY.
{
{ NOTES:
{

?? NEWTITLE := 'Global Declarations Referenced by This Module', EJECT ??
?? PUSH (LISTEXT := ON) ??
*copyc rae$install_software_cc
*copyc rac$control_job_identifier
*copyc rac$packing_list_level
*copyc rac$pacs_processor_version
*copyc rat$installation_control_record
*copyc rat$packing_list_sequence
*copyc rat$sequence_descriptor_types
?? POP ??
*copyc osp$append_status_file
*copyc osp$set_status_abnormal
?? OLDTITLE ??
?? NEWTITLE := '[XDCL] rap$establish_icr_subp_ptrs', EJECT ??

{ PURPOSE:
{   This interface establishes the pointers to the major data structures of
{   each subproduct info sequence within the packing list.  The pointers are
{   registered in the installation control record.
{
{ DESIGN:
{   The installation control record contains an array of subproduct
{   processing records.  Each subproduct processing record contains a record
{   for real pointers to that subproduct's major information data structures
{   within the packing list.  The subproduct information inside the packing
{   list must be established as its own sequence since all the relative
{   pointers found in the subproduct information data structures are
{   relative to the subproduct information as a sequence.
{
{   The pointer to the subproduct's installation catalog is estabished from
{   the relative pointer stored in the installation control record.  In some
{   instances the installation catalog has not yet been assigned, but the
{   relative pointer has been initialized to NIL.  This means the real
{   pointer is NIL as well.
{
{ NOTES:
{

  PROCEDURE [XDCL] rap$establish_icr_subp_ptrs
    (VAR installation_control_record {input, output} : rat$installation_control_record;
     VAR status: ost$status);


    VAR
      i: rat$subproduct_count,
      installation_database: rat$path,
      packing_list_seq_p: ^rat$packing_list_sequence,
      subproduct_pointers: rat$subproduct_info_pointers,
      subproduct_seq_length: amt$file_length,
      subproduct_seq_p: ^cell;


    status.normal := TRUE;
    installation_database := installation_control_record.processing_header_p^.installation_defaults.
          installation_database;
    packing_list_seq_p := installation_control_record.packing_list_pointers.sequence_p;

    FOR i := 1 TO UPPERBOUND (installation_control_record.subproduct_processing_records_p^) DO

      IF (installation_control_record.job_identifier = rac$control_job_identifier) OR
            (installation_control_record.job_identifier = installation_control_record.
            subproduct_processing_records_p^ [i].job_identifier) THEN

        { Locate the start of the subproduct info within the packing list.

        IF installation_control_record.packing_list_pointers.order_medium = rac$tape THEN
          subproduct_seq_length := installation_control_record.packing_list_pointers.
                tape_subproduct_indexer_p^ [i].subproduct_seq_length;
          subproduct_seq_p := #PTR (installation_control_record.packing_list_pointers.
                tape_subproduct_indexer_p^ [i].subproduct_seq_p, packing_list_seq_p^);
        ELSE {order medium = rac$disk}
          subproduct_seq_length := installation_control_record.packing_list_pointers.
                disk_subproduct_indexer_p^ [i].subproduct_seq_length;
          subproduct_seq_p := #PTR (installation_control_record.packing_list_pointers.
                disk_subproduct_indexer_p^ [i].subproduct_seq_p, packing_list_seq_p^);
        IFEND;

        RESET packing_list_seq_p TO subproduct_seq_p;

        { Establish the subproduct info as an accessable sequence.

        NEXT subproduct_pointers.subproduct_info_seq_p: [[REP subproduct_seq_length OF cell]] IN
              packing_list_seq_p;
        IF subproduct_pointers.subproduct_info_seq_p = NIL THEN
          osp$set_status_abnormal ('RA', rae$unexpected_eof_packing_list,
                installation_control_record.processing_header_p^.packing_list_name, status);
          osp$append_status_file (osc$status_parameter_delimiter, installation_database.
                path (1, installation_database.size), status);
          RETURN;
        IFEND;

        RESET packing_list_seq_p TO subproduct_seq_p;

        { Establish pointers to the major components in the subproduct info sequence.
        { (See notes section above for maintenance tip.)

        NEXT subproduct_pointers.sequence_descriptor_p IN packing_list_seq_p;
        IF subproduct_pointers.sequence_descriptor_p = NIL THEN
          osp$set_status_abnormal ('RA', rae$unexpected_eof_packing_list,
                installation_control_record.processing_header_p^.packing_list_name, status);
          osp$append_status_file (osc$status_parameter_delimiter, installation_database.
                path (1, installation_database.size), status);
          RETURN;
        IFEND;

        NEXT subproduct_pointers.info_header_p IN packing_list_seq_p;
        IF subproduct_pointers.info_header_p = NIL THEN
          osp$set_status_abnormal ('RA', rae$unexpected_eof_packing_list,
                installation_control_record.processing_header_p^.packing_list_name, status);
          osp$append_status_file (osc$status_parameter_delimiter, installation_database.
                path (1, installation_database.size), status);
          RETURN;
        IFEND;

        subproduct_pointers.attributes_p := #PTR (subproduct_pointers.info_header_p^.attributes_p,
              subproduct_pointers.subproduct_info_seq_p^);

        subproduct_pointers.element_list_p := #PTR (subproduct_pointers.info_header_p^.element_list_p,
              subproduct_pointers.subproduct_info_seq_p^);

        subproduct_pointers.path_container_p := #PTR (subproduct_pointers.info_header_p^.path_container_p,
              subproduct_pointers.subproduct_info_seq_p^);

        subproduct_pointers.psrs_answered_p := #PTR (subproduct_pointers.info_header_p^.psrs_answered_p,
              subproduct_pointers.subproduct_info_seq_p^);

        { Assign the values for the subproduct info pointers just created to the installation control record.

        installation_control_record.subproduct_processing_records_p^ [i].subproduct_info_pointers :=
              subproduct_pointers;

        { Establish the pointer to the subproduct's installation catalog.

        installation_control_record.subproduct_processing_records_p^ [i].
              installation_catalog_p := #PTR (installation_control_record.
              subproduct_processing_records_p^ [i].installation_catalog_rel_p,
              installation_control_record.processing_seq_p^);

      IFEND;
    FOREND;

  PROCEND rap$establish_icr_subp_ptrs;

MODEND ram$establish_icr_subp_ptrs;
