?? RIGHT := 110 ??
?? NEWTITLE := 'INSTALL_SOFTWARE UTILITY: EXECUTE_INSTALLER_PROCEDURE Subutility Command.' ??
MODULE ram$execute_installer_procs_cmd;

{ PURPOSE:
{   This module contains the command interface to the
{   EXECUTE_INSTALLER_PROCEDURE subutility of INSTALL_SOFTWARE.
{ DESIGN:
{   Since the EXECUTE_INSTALLER_PROCEDURE utility must be accessible from
{   SCL (this interface) and during the installation process from CYBIL,
{   this module only contains the command interface portion of the utility.
{   The actual utility can be found in RAM$EXECUTE_INSTALLER_PROCS_UTL.
{ NOTES:
{   In the future, this command should have parameters to allow
{   specification of the installation environment to use.  This will allow
{   better simulation of the environment which exists when the
{   EXECUTE_INSTALLER_PROCEDURE utility is invoked from cybil.  Likely
{   parameters are:  PACKING_LIST, SUBPRODUCT_NAME, INSTALLATION_COMMAND
{   (PRODUCT or CORRECTION), SAVE_PREVIOUS_CYCLES.

?? NEWTITLE := 'Global Declarations Referenced by This Module', EJECT ??
?? PUSH (LISTEXT := ON) ??
*copyc rat$installation_control_record
*copyc rat$installation_defaults
*copyc rae$install_software_cc
*copyc rat$processing_types
?? POP ??
*copyc clp$evaluate_parameters
*copyc clp$trimmed_string_size
*copyc mmp$create_scratch_segment
*copyc mmp$delete_scratch_segment
*copyc osp$append_status_parameter
*copyc osp$disestablish_cond_handler
*copyc osp$establish_block_exit_hndlr
*copyc osp$set_status_abnormal
*copyc rap$execute_installer_procs_utl
*copyc rav$installation_defaults
?? OLDTITLE ??
?? NEWTITLE := 'Global Declarations Declared by This Module', EJECT ??
?? OLDTITLE ??
?? NEWTITLE := '[XDCL] rap$execute_installer_procs_cmd', EJECT ??
{ PURPOSE:
{   Contains the actual command interface to the EXECUTE_INSTALLER_PROCEDURE
{   subutility of INSTALL_SOFTWARE.
{ DESIGN:
{   Uses standard SCL command interface design.  Creates data structures to
{   pass to the EXECUTE_INSTALLER_PROCEDURE utility.  All data is dummy
{   except for the instalation defaults which are correct.  Since the
{   EXECUTE_INSTALLER_PROCEDURE utility expects to be passed a pointer to a
{   scratch sequence, one is created here.
{ NOTES:
{   The dummy data passed in is expected by the EXECUTE_INSTALLER_PROCEDURES
{   utility.  Any changes in the data initialization must be cross checked
{   with the code in the utility.

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

{ PROCEDURE exeip_pdt (
{   status)

?? PUSH (LISTEXT := ON) ??

    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,
        recend,
      recend := [[1, [88, 6, 21, 8, 32, 21, 105], clc$command, 1, 1, 0, 0, 0, 0, 1, 'EXEIP_PDT'],
            [['STATUS                         ', clc$nominal_entry, 1]], [
{ PARAMETER 1
      [1, 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$status_type]]];

?? POP ??

    CONST
      p$status = 1;

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

    VAR
      installation_control_record: rat$installation_control_record,
      local_status: ost$status,
      empty_subp_processing_record: rat$subp_processing_record,
      scratch_segment_pointer: amt$segment_pointer;

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

{ PURPOSE:
{   This procedure cleans up when an abort situation occurs within the
{   block structure.
{
{ DESIGN:
{   The function of this condition handler is to return the scratch
{   segment when an abort condition arises.

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

      VAR
        ignore_status: ost$status;

      IF scratch_segment_pointer.sequence_pointer <> NIL THEN
        mmp$delete_scratch_segment (scratch_segment_pointer, ignore_status);
        scratch_segment_pointer.sequence_pointer := NIL;
      IFEND;

    PROCEND abort_handler;
?? OLDTITLE, EJECT ??

    status.normal := TRUE;

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

    scratch_segment_pointer.kind := amc$sequence_pointer;
    scratch_segment_pointer.sequence_pointer := NIL;

    osp$establish_block_exit_hndlr (^abort_handler);

  /main/
    BEGIN

      mmp$create_scratch_segment (amc$sequence_pointer, mmc$as_random, scratch_segment_pointer, status);
      IF NOT status.normal THEN
        EXIT /main/;
      IFEND;

      installation_control_record.scratch_seq_p := scratch_segment_pointer.sequence_pointer;
      RESET installation_control_record.scratch_seq_p;

      PUSH installation_control_record.processing_header_p;
      installation_control_record.processing_header_p^.installation_identifier := osc$null_name;
      installation_control_record.processing_header_p^.packing_list_name := osc$null_name;
      installation_control_record.processing_header_p^.installation_defaults := rav$installation_defaults;
      installation_control_record.processing_header_p^.medium_processing_rec_rel_p := NIL;
      installation_control_record.processing_header_p^.subproduct_processing_rec_rel_p := NIL;
      installation_control_record.processing_header_p^.step_set :=
            $rat$step_selections [rac$delete_previous_cycles_step];

      rap$execute_installer_procs_utl (empty_subp_processing_record,
            FALSE {subproduct_data_available}, installation_control_record, status);
      IF NOT status.normal THEN
        EXIT /main/;
      IFEND;

    END /main/;

    osp$disestablish_cond_handler;

    IF scratch_segment_pointer.sequence_pointer <> NIL THEN
      mmp$delete_scratch_segment (scratch_segment_pointer, local_status);
      scratch_segment_pointer.sequence_pointer := NIL;
      IF status.normal AND (NOT local_status.normal) THEN
        status := local_status;
      IFEND;
    IFEND;

  PROCEND rap$execute_installer_procs_cmd;
?? OLDTITLE ??
MODEND ram$execute_installer_procs_cmd;
