MODULE fmm$get_terminal_attributes;
?? RIGHT := 110 ??
{MODULE DECK BAMGTA}
*copyc osd$default_pragmats
?? PUSH (LISTEXT := ON) ??
*copyc bak$bap_procedure_keypoints
*copyc fmp$get_cycle_description
*copyc fmp$unlock_path_table
*copyc ife$error_codes
*copyc ift$get_connection_attributes
*copyc osp$set_status_abnormal
*copyc osp$append_status_parameter
*copyc oss$task_private
*copyc pmp$get_job_mode
?? POP ??
?? SET (LIST := ON) ??

  PROCEDURE [XDCL] fmp$get_terminal_attributes
    (    file: fst$file_reference;
     VAR connection_attributes: ift$get_connection_attributes;
     VAR status: ost$status);

    VAR
      attribute_loc: ^ift$connection_attributes,
      cycle_description: ^fmt$cycle_description,
      i: integer,
      j: integer;

    status.normal := TRUE;

    { Set the attribute source of all entries to 'undefined'.

    FOR i := LOWERBOUND (connection_attributes) TO UPPERBOUND (connection_attributes) DO
      connection_attributes [i].source := ifc$undefined_attribute;
    FOREND;

    { Get the connection attributes from the path description entry for the file.

  /get_attributes/
    BEGIN

      attribute_loc := NIL;
      fmp$get_cycle_description (file, cycle_description, status);
      IF NOT status.normal THEN
        EXIT /get_attributes/; {----->
      IFEND;

    /path_table_locked/
      BEGIN

        IF (cycle_description <> NIL) AND cycle_description^.attached_file AND
              (cycle_description^.device_class = rmc$terminal_device) THEN
          { RMP$REQUEST_TERMINAL created the file.
          IF cycle_description^.terminal_request <> NIL THEN
            { Attributes were specified on the request terminal call.
            attribute_loc := cycle_description^.terminal_request;
          IFEND;
        ELSE
          osp$set_status_abnormal (ifc$interactive_facility_id, ife$file_name_not_terminal, '', status);
          osp$append_status_parameter (osc$status_parameter_delimiter, file, status);
          EXIT /path_table_locked/; {----->
        IFEND;

        { Get the BAM attributes if they are specified.

        IF attribute_loc <> NIL THEN

        /get_bam_connection_attributes/
          FOR i := 1 TO UPPERBOUND (connection_attributes) DO

            FOR j := 1 TO UPPERBOUND (attribute_loc^) DO

              IF attribute_loc^ [j].key = connection_attributes [i].key THEN

                connection_attributes [i].source := ifc$request_terminal_request;

                CASE connection_attributes [i].key OF
                = ifc$attention_character_action =
                  connection_attributes [i].attention_character_action :=
                        attribute_loc^ [j].attention_character_action;
                = ifc$break_key_action =
                  connection_attributes [i].break_key_action := attribute_loc^ [j].break_key_action;
                = ifc$end_of_information =
                  connection_attributes [i].end_of_information := attribute_loc^ [j].end_of_information;
                = ifc$input_block_size =
                  connection_attributes [i].input_block_size := attribute_loc^ [j].input_block_size;
                = ifc$input_editing_mode =
                  connection_attributes [i].input_editing_mode := attribute_loc^ [j].input_editing_mode;
                = ifc$input_timeout =
                  connection_attributes [i].input_timeout := attribute_loc^ [j].input_timeout;
                = ifc$input_timeout_length =
                  connection_attributes [i].input_timeout_length := attribute_loc^ [j].input_timeout_length;
                = ifc$input_timeout_purge =
                  connection_attributes [i].input_timeout_purge := attribute_loc^ [j].input_timeout_purge;
                = ifc$input_output_mode =
                  connection_attributes [i].input_output_mode := attribute_loc^ [j].input_output_mode;
                = ifc$partial_char_forwarding =
                  connection_attributes [i].partial_character_forwarding :=
                        attribute_loc^ [j].partial_character_forwarding;
                = ifc$prompt_file =
                  connection_attributes [i].prompt_file := attribute_loc^ [j].prompt_file;
                = ifc$prompt_file_identifier =
                  connection_attributes [i].prompt_file_identifier :=
                        attribute_loc^ [j].prompt_file_identifier;
                = ifc$prompt_string =
                  connection_attributes [i].prompt_string := attribute_loc^ [j].prompt_string;
                = ifc$store_backspace_character =
                  connection_attributes [i].store_backspace_character :=
                        attribute_loc^ [j].store_backspace_character;
                = ifc$store_nuls_dels =
                  connection_attributes [i].store_nuls_dels := attribute_loc^ [j].store_nuls_dels;
                = ifc$trans_character_mode =
                  connection_attributes [i].trans_character_mode := attribute_loc^ [j].trans_character_mode;
                = ifc$trans_forward_character =
                  connection_attributes [i].trans_forward_character :=
                        attribute_loc^ [j].trans_forward_character;
                = ifc$trans_length_mode =
                  connection_attributes [i].trans_length_mode := attribute_loc^ [j].trans_length_mode;
                = ifc$trans_timeout_mode =
                  connection_attributes [i].trans_timeout_mode := attribute_loc^ [j].trans_timeout_mode;
                = ifc$trans_message_length =
                  connection_attributes [i].trans_message_length := attribute_loc^ [j].trans_message_length;
                = ifc$trans_terminate_character =
                  connection_attributes [i].trans_terminate_character :=
                        attribute_loc^ [j].trans_terminate_character;
                = ifc$trans_protocol_mode =
                  connection_attributes [i].trans_protocol_mode := attribute_loc^ [j].trans_protocol_mode;
                ELSE
                  ;
                CASEND;

                CYCLE /get_bam_connection_attributes/; {----->

              IFEND;
            FOREND;

          FOREND /get_bam_connection_attributes/;
        IFEND; { attribute_loc <> NIL }

      END /path_table_locked/;
      fmp$unlock_path_table;

    END /get_attributes/;

  PROCEND fmp$get_terminal_attributes;
MODEND fmm$get_terminal_attributes;
