?? RIGHT := 110 ??
?? TITLE := 'NOS/VE SCL Interpreter : Screen Style Parameter Dialog Manager' ??
MODULE clm$scl_parameter_dialog;

{
{ PURPOSE:
{   This module contains the standard screen style dialog manager for
{   obtaining parameters for commands and functions from an interactive user.
{

?? LIBRARY := 'TUF$LIBRARY' ??
?? LIBRARY := 'TUF$TERMINAL_DEFINITIONS' ??

*copyc clh$parameter_dialog_manager
?? TITLE := 'Global Declarations', EJECT ??
?? PUSH (LISTEXT := ON) ??
*copyc cle$bad_pdt
*copyc cle$command_cancelled
*copyc cle$function_cancelled
*copyc cle$unable_to_enter_screen_mode
*copyc clt$parameter_dialog_support
*copyc clt$unbundled_pdt
*copyc ost$status
*copyc osv$upper_to_lower
?? POP ??
*copyc avp$ring_min
*copyc clp$convert_data_to_string
*copyc clp$data_representation_text
*copyc clp$include_command
*copyc clp$include_line
*copyc clp$pop_interactive_input
*copyc clp$push_interactive_input
*copyc clp$right_justify_string
*copyc clp$trimmed_string_size
*copyc csp$allocate_field
*copyc csp$change_cursor_position
*copyc csp$change_device_dimensions
*copyc csp$change_io_position
*copyc csp$change_field_attributes
*copyc csp$change_line_width
*copyc csp$change_page_attributes
*copyc csp$change_partial_screen
*copyc csp$clear_field
*copyc csp$clear_screen
*copyc csp$delete_field
*copyc csp$delete_graphic
*copyc csp$disable_menu_item
*copyc csp$disable_page
*copyc csp$display_menu
*copyc csp$enable_menu_item
*copyc csp$enable_page
*copyc csp$flush_events
*copyc csp$get_device_attributes
*copyc csp$get_event_name
*copyc csp$get_event
*copyc csp$get_field_attributes
*copyc csp$get_io_position
*copyc csp$get_page_attributes
*copyc csp$get_text
*copyc csp$mark_menu_item
*copyc csp$poly_hv_line
*copyc csp$poly_intersect
*copyc csp$pop_page
*copyc csp$push_page
*copyc csp$put_text
*copyc csp$set_standard_menu
*copyc csp$unmark_menu_item
*copyc csp$update_device
*copyc eup$get_file_selection
*copyc eup$get_item_selections
*copyc fsp$close_file
*copyc fsp$open_file
*copyc ifp$fetch_context
*copyc ifp$get_terminal_attributes
*copyc osp$disestablish_cond_handler
*copyc osp$establish_condition_handler
*copyc osp$find_application_menu
*copyc osp$find_help_module
*copyc osp$find_parameter_prompt
*copyc osp$find_param_assist_prompt
*copyc osp$format_help_message
*copyc osp$format_message
*copyc osp$get_interaction_information
*copyc osp$get_status_condition_name
*copyc osp$set_status_condition
*copyc osp$status_message_text
*copyc pmp$continue_to_cause
?? EJECT ??

  TYPE

    clt$dialog_display_info = record
      command_field: cst$field_number,
      command_text: ^string ( * ),
      parameter_count: clt$parameter_count,
      parameters_displayed: 0 .. csc$max_line_number,
      top_parameter: clt$parameter_count,
      screen_height: 0 .. csc$max_line_number,
      screen_width: cst$visible_character_position,
      message_field: cst$field_number,
      current_window: clt$window_kind,
      reserved_rows: cst$lines_used,
      help_module: ^ost$help_module,
      help_window_displayed: boolean,
      message_window_displayed: boolean,
      zoom_window_displayed: boolean,
      line_number_field: cst$field_number,
      mouse_available: boolean,
      buttons: clt$dialog_buttons,
    recend,

    clt$dialog_buttons = record
      first: ^clt$dialog_button,
      page_up_button: clt$dialog_button,
      page_down_button: clt$dialog_button,
    recend,

    clt$dialog_button = record
      link: ^clt$dialog_button,
      name: ost$name,
      name_size: 0 .. osc$max_name_size,
      strong_action: integer,
      weak_action: integer,
      active: boolean,
      field: cst$field_number,
    recend,

    clt$output_window = record
      parent_window: clt$window_kind,
      top: integer,
      line_count: integer,
      lines_displayed: 0 .. csc$max_line_number,
      contents: ^array [1 .. * ] of ^string ( * ),
      text_field: cst$field_number,
      box_id: cst$graphic_identifier,
      background_field: cst$field_number,
      prompt_field: cst$field_number,
      cursor_character_position: 0 .. csc$max_x_position,
      cursor_field_number: cst$field_number,
      cursor_line_number: cst$line_number,
      line_number_field: cst$field_number,
      buttons: clt$dialog_buttons,
    recend,

    clt$input_window = record
      parent_window: clt$window_kind,
      top: integer,
      line_count: integer,
      lines_displayed: integer,
      contents: ^array [1 .. * ] of ^string ( * ),
      text_field: cst$field_number,
      box_id: cst$graphic_identifier,
      background_field: cst$field_number,
      prompt_field: cst$field_number,
      title_field: cst$field_number,
      cursor_character_position: 0 .. csc$max_x_position,
      cursor_field_number: cst$field_number,
      cursor_line_number: cst$line_number,
      line_number_field: cst$field_number,
      buttons: clt$dialog_buttons,
      changeable: boolean,
      case parameter_value: boolean of
      = TRUE =
        parameter_number: integer,
      = FALSE =
        ,
      casend,
    recend,

    clt$parameter_line_information = record
      name: string (clc$prompt_object_width),
      prompt: string (clc$prompt_object_width),
      case advanced_indicator: boolean of
      = TRUE =
        ,
      = FALSE =
        pdt_number: clt$parameter_count,
        evaluation_required: boolean,
        required: boolean,
        secure: boolean,
        too_big_to_edit: boolean,
        case initialized: boolean of
        = FALSE =
          ,
        = TRUE =
          overflow: boolean,
          value: ^string ( * ),
        casend,
      casend,
    recend,

    clt$parameter_display_info = record
      prompt_field_number: cst$field_number,
      value_field_number: cst$field_number,
    recend,

    clt$window_kind = (clc$help_window, clc$message_window, clc$zoom_window, clc$no_window);

{
{ The following constant defines the "seed" name for the help module
{ containing text to be displayed on the screen.
{

  CONST
    clc$spdm_messages_module = 'CLM$SPDM_MESSAGES              ';

{
{ The following constants define the names of messages within the help module.
{

  CONST
    clc$advanced_label = 'CLC$ADVANCED_LABEL             ',
    clc$backward_key_label = 'CLC$BACKWARD_KEY_LABEL         ',
    clc$cancel_key_label = 'CLC$CANCEL_KEY_LABEL           ',
    clc$clear_label = 'CLC$CLEAR_LABEL                ',
    clc$clear_eol_label = 'CLC$CLEAR_EOL_LABEL            ',
    clc$cleared_parameter_ignored = 'CLC$CLEARED_PARAMETER_IGNORED  ',
    clc$command_label = 'CLC$COMMAND_LABEL              ',
    clc$delete_char_label = 'CLC$DELETE_CHAR_LABEL          ',
    clc$down_key_label = 'CLC$DOWN_KEY_LABEL             ',
    clc$enter_command = 'CLC$ENTER_COMMAND              ',
    clc$enter_command_title = 'CLC$ENTER_COMMAND_TITLE        ',
    clc$enter_parameter_value = 'CLC$ENTER_PARAMETER_VALUE      ',
    clc$enter_values = 'CLC$ENTER_VALUES               ',
    clc$error_can_be_ignored = 'CLC$ERROR_CAN_BE_IGNORED       ',
    clc$evaluate_key_label = 'CLC$EVALUATE_KEY_LABEL         ',
    clc$first_key_label = 'CLC$FIRST_KEY_LABEL            ',
    clc$forward_key_label = 'CLC$FORWARD_KEY_LABEL          ',
    clc$function_key_help = 'CLC$FUNCTION_KEY_HELP          ',
    clc$function_label = 'CLC$FUNCTION_LABEL             ',
    clc$help_key_label = 'CLC$HELP_KEY_LABEL             ',
    clc$home_label = 'CLC$HOME_LABEL                 ',
    clc$info_key_label = 'CLC$INFO_KEY_LABEL             ',
    clc$info_display = 'CLC$INFO_DISPLAY               ',
    clc$info_display_with_one_name = 'CLC$INFO_DISPLAY_WITH_ONE_NAME ',
    clc$insert_char_label = 'CLC$INSERT_CHAR_LABEL          ',
    clc$last_key_label = 'CLC$LAST_KEY_LABEL             ',
    clc$lines_l_through_m_size_n = 'CLC$LINES_L_THROUGH_M_SIZE_N   ',
    clc$no_more_help_available = 'CLC$NO_MORE_HELP_AVAILABLE     ',
    clc$no_more_input_space = 'CLC$NO_MORE_INPUT_SPACE        ',
    clc$no_parameters_label = 'CLC$NO_PARAMETERS_LABEL        ',
    clc$ok_key_label = 'CLC$OK_KEY_LABEL               ',
    clc$press_next = 'CLC$PRESS_NEXT                 ',
    clc$press_next_from_pageable = 'CLC$PRESS_NEXT_FROM_PAGEABLE   ',
    clc$press_ok = 'CLC$PRESS_OK                   ',
    clc$press_down = 'CLC$PRESS_DOWN                 ',
    clc$press_up = 'CLC$PRESS_UP                   ',
    clc$reset_key_label = 'CLC$RESET_KEY_LABEL            ',
    clc$spdm_main_menu = 'CLC$SPDM_MAIN_MENU             ',
    clc$too_big_to_edit = 'CLC$TOO_BIG_TO_EDIT            ',
    clc$unable_to_zoom_secure_param = 'CLC$UNABLE_TO_ZOOM_SECURE_PARAM',
    clc$undefined_function_key = 'CLC$UNDEFINED_FUNCTION_KEY     ',
    clc$up_key_label = 'CLC$UP_KEY_LABEL               ',
    clc$zoom_key_label = 'CLC$ZOOM_KEY_LABEL             ';

  CONST
    carriage_return = 0,
    forward_event = 1,
    backward_event = 2,
    help_event = 3,
    ok_event = 4,
    cancel_event = 5,
    evaluate_event = 6,
    reset_event = 7,
    zoom_event = 8,
    edit_zoom_event = 9,
    info_event = 10,
    home_event = 11,
    clear_eol_event = 12,
    insert_char_event = 13,
    delete_char_event = 14,
    clear_event = 15,
    last_event = 16,
    first_event = 17,
    up_event = 18,
    down_event = 19,
    mouse_click_weak = 20,
    mouse_click_strong = 21;

  CONST
    menu_event_bias = 100,
    help_event_from_menu = help_event + menu_event_bias,
    ok_event_from_menu = ok_event + menu_event_bias,
    cancel_event_from_menu = cancel_event + menu_event_bias,
    evaluate_event_from_menu = evaluate_event + menu_event_bias,
    reset_event_from_menu = reset_event + menu_event_bias,
    zoom_event_from_menu = zoom_event + menu_event_bias,
    edit_zoom_event_from_menu = edit_zoom_event + menu_event_bias,
    info_event_from_menu = info_event + menu_event_bias;

  CONST
    x_position_attribute = 1,
    y_position_attribute = 2,
    visible_characters_attribute = 3,
    visible_lines_attribute = 4,
    characters_attribute = 5,
    lines_attribute = 6,
    input_attribute = 7,
    highlighting_attribute = 8,
    logical_highlighting_attribute = 9;

  TYPE
    clt$field_attributes = array [1 .. logical_highlighting_attribute] of cst$field_attribute;

  VAR
    clv$default_field_attributes: clt$field_attributes :=
          [[csc$fld_x_position, 1], [csc$fld_y_position, 1], [csc$fld_visible_characters, 1],
          [csc$fld_visible_lines, 1], [csc$fld_characters, 1], [csc$fld_lines, 1], [csc$fld_input, FALSE],
          [csc$fld_highlighting, csc$logical_highlighting], [csc$fld_logical_highlighting,
          csc$logical_normal]];

  CONST
    clc$advanced_label_line_number = 2,
    clc$blank_lines_after_header = 1,
    clc$dialog_box_inset = 5,
    clc$estimated_overhead_lines = 6,
    clc$left_margin = 3,
    clc$lines_for_advanced = 3,
    clc$lines_for_one_menu_row = 2,
    clc$lines_for_two_menu_rows = 5,
    clc$lines_used_by_title = 1,
    clc$middle_margin = 1,
    clc$minimum_parameter_rows = 4,
    clc$maximum_zoom_lines = 12,
    clc$overflow_indicator = '..',
    clc$prompt_object_width = 32,
    clc$right_margin = 1,
    clc$title_line_number_inset = 2;

?? TITLE := 'clp$scl_parameter_dialog_mgr', EJECT ??

  PROCEDURE [XDCL, #GATE] clp$scl_parameter_dialog_mgr
    (    support: clt$parameter_dialog_support;
         command_or_function_name: clt$command_name;
         ignore_online_manual_name: ost$online_manual_name;
         pdt: clt$unbundled_pdt;
     VAR cancel: boolean;
     VAR status: ost$status);

    VAR
      action_number: integer,
      called_from_screen_mode: boolean,
      cleared_parameters: ^array [1 .. * ] of ^ost$message_parameter,
      command_line_number: 0 .. csc$max_line_number,
      current_file_selection: fst$path,
      cursor_character_position: 0 .. csc$max_x_position,
      cursor_field_number: cst$field_number,
      cursor_line_number: 0 .. csc$max_line_number,
      dialog_box_max_lines: 0 .. csc$max_line_number,
      dialog_box_top: 0 .. csc$max_line_number,
      display: clt$dialog_display_info,
      editing_parameter_list: boolean,
      end_of_line: boolean,
      end_of_parameter_lines: 0 .. csc$max_line_number,
      entered_screen_mode: boolean,
      event: cst$event_identifier,
      event_on_parameter_line: boolean,
      file_identifier: amt$file_identifier,
      help_window: clt$output_window,
      ignore_following_csc$next_event: boolean,
      ignore_tab_caused_by_next: boolean,
      initial_status: ost$status,
      input_file_opened: boolean,
      lines_used_by_trailer: 0 .. csc$max_line_number,
      menu_classes: cst$menu_class,
      menu_classes_copy: cst$menu_class,
      menu_list: cst$menu_list,
      menu_list_copy: cst$menu_list,
      message_displayed: boolean,
      message_field_width: 0 .. csc$max_x_position,
      message_line_number: 0 .. csc$max_line_number,
      message_read: boolean,
      message_window: clt$output_window,
      mouse_event: boolean,
      need_to_clear_command_field: boolean,
      next_event: boolean,
      old_interaction_style: cst$interaction_style,
      parameter_display_info: ^array [1 .. * ] of clt$parameter_display_info,
      parameter_information: ^array [1 .. * ] of clt$parameter_line_information,
      parameter_line: integer,
      parameter_number: integer,
      parameter_selected: boolean,
      parameter_value_column_number: 0 .. csc$max_x_position,
      parameter_value_field_width: 0 .. csc$max_x_position,
      processing_complete: boolean,
      screen_event: boolean,
      start_of_parameter_lines: 0 .. csc$max_line_number,
      status_condition_name: ost$status_condition_name,
      title_box_top: 0 .. csc$max_line_number,
      update_parameters: boolean,
      zoom_window: clt$input_window;

?? NEWTITLE := 'center_parameter_on_screen', EJECT ??

    PROCEDURE center_parameter_on_screen;

      IF (parameter_number < display.top_parameter) OR (parameter_number >
            (display.top_parameter + display.parameters_displayed - 1)) THEN
        IF (parameter_number + (display.parameters_displayed DIV 2) - 1) > display.parameter_count THEN
          display.top_parameter := display.parameter_count - display.parameters_displayed + 1;
        ELSEIF parameter_number < ((display.parameters_displayed DIV 2) - 1) THEN
          display.top_parameter := 1;
        ELSE
          display.top_parameter := parameter_number - (display.parameters_displayed DIV 2) + 1;
        IFEND;
        update_parameters := TRUE;
      IFEND;

      cursor_field_number := parameter_display_info^ [parameter_number - display.top_parameter +
            1].value_field_number;
      cursor_line_number := 1;
      cursor_character_position := 1;

    PROCEND center_parameter_on_screen;
?? TITLE := 'change_menu_items', EJECT ??

    PROCEDURE change_menu_items
      (    old_window: clt$window_kind;
           new_window: clt$window_kind);


      CASE new_window OF
      = clc$zoom_window =
        CASE old_window OF
        = clc$zoom_window =
          ;
        = clc$message_window, clc$help_window =
          csp$enable_menu_item (cancel_event, status);
          IF NOT status.normal THEN
            EXIT clp$scl_parameter_dialog_mgr;
          IFEND;
          csp$enable_menu_item (ok_event, status);
          IF NOT status.normal THEN
            EXIT clp$scl_parameter_dialog_mgr;
          IFEND;
        ELSE {clc$no_window
          csp$disable_menu_item (down_event, status);
          IF NOT status.normal THEN
            EXIT clp$scl_parameter_dialog_mgr;
          IFEND;
          csp$disable_menu_item (evaluate_event, status);
          IF NOT status.normal THEN
            EXIT clp$scl_parameter_dialog_mgr;
          IFEND;
          csp$disable_menu_item (info_event, status);
          IF NOT status.normal THEN
            EXIT clp$scl_parameter_dialog_mgr;
          IFEND;
          csp$disable_menu_item (reset_event, status);
          IF NOT status.normal THEN
            EXIT clp$scl_parameter_dialog_mgr;
          IFEND;
          csp$disable_menu_item (up_event, status);
          IF NOT status.normal THEN
            EXIT clp$scl_parameter_dialog_mgr;
          IFEND;
          csp$disable_menu_item (zoom_event, status);
          IF NOT status.normal THEN
            EXIT clp$scl_parameter_dialog_mgr;
          IFEND;
          csp$disable_menu_item (edit_zoom_event, status);
          IF NOT status.normal THEN
            EXIT clp$scl_parameter_dialog_mgr;
          IFEND;
        CASEND;
      = clc$message_window, clc$help_window =
        CASE old_window OF
        = clc$zoom_window =
          csp$disable_menu_item (cancel_event, status);
          IF NOT status.normal THEN
            EXIT clp$scl_parameter_dialog_mgr;
          IFEND;
          csp$disable_menu_item (ok_event, status);
          IF NOT status.normal THEN
            EXIT clp$scl_parameter_dialog_mgr;
          IFEND;
        = clc$message_window, clc$help_window =
          ;
        ELSE {clc$no_window
          csp$disable_menu_item (down_event, status);
          IF NOT status.normal THEN
            EXIT clp$scl_parameter_dialog_mgr;
          IFEND;
          csp$disable_menu_item (evaluate_event, status);
          IF NOT status.normal THEN
            EXIT clp$scl_parameter_dialog_mgr;
          IFEND;
          csp$disable_menu_item (info_event, status);
          IF NOT status.normal THEN
            EXIT clp$scl_parameter_dialog_mgr;
          IFEND;
          csp$disable_menu_item (reset_event, status);
          IF NOT status.normal THEN
            EXIT clp$scl_parameter_dialog_mgr;
          IFEND;
          csp$disable_menu_item (up_event, status);
          IF NOT status.normal THEN
            EXIT clp$scl_parameter_dialog_mgr;
          IFEND;
          csp$disable_menu_item (zoom_event, status);
          IF NOT status.normal THEN
            EXIT clp$scl_parameter_dialog_mgr;
          IFEND;
          csp$disable_menu_item (edit_zoom_event, status);
          IF NOT status.normal THEN
            EXIT clp$scl_parameter_dialog_mgr;
          IFEND;
          csp$disable_menu_item (cancel_event, status);
          IF NOT status.normal THEN
            EXIT clp$scl_parameter_dialog_mgr;
          IFEND;
          csp$disable_menu_item (ok_event, status);
          IF NOT status.normal THEN
            EXIT clp$scl_parameter_dialog_mgr;
          IFEND;
        CASEND;
      ELSE {clc$no_window
        csp$enable_menu_item (down_event, status);
        IF NOT status.normal THEN
          EXIT clp$scl_parameter_dialog_mgr;
        IFEND;
        csp$enable_menu_item (evaluate_event, status);
        IF NOT status.normal THEN
          EXIT clp$scl_parameter_dialog_mgr;
        IFEND;
        IF support.nested_dialog_title = NIL THEN
          csp$enable_menu_item (info_event, status);
          IF NOT status.normal THEN
            EXIT clp$scl_parameter_dialog_mgr;
          IFEND;
        IFEND;
        csp$enable_menu_item (reset_event, status);
        IF NOT status.normal THEN
          EXIT clp$scl_parameter_dialog_mgr;
        IFEND;
        csp$enable_menu_item (up_event, status);
        IF NOT status.normal THEN
          EXIT clp$scl_parameter_dialog_mgr;
        IFEND;
        csp$enable_menu_item (zoom_event, status);
        IF NOT status.normal THEN
          EXIT clp$scl_parameter_dialog_mgr;
        IFEND;
        csp$enable_menu_item (edit_zoom_event, status);
        IF NOT status.normal THEN
          EXIT clp$scl_parameter_dialog_mgr;
        IFEND;
        CASE old_window OF
        = clc$message_window, clc$help_window =
          csp$enable_menu_item (cancel_event, status);
          IF NOT status.normal THEN
            EXIT clp$scl_parameter_dialog_mgr;
          IFEND;
          csp$enable_menu_item (ok_event, status);
          IF NOT status.normal THEN
            EXIT clp$scl_parameter_dialog_mgr;
          IFEND;
        ELSE
        CASEND;
      CASEND;

    PROCEND change_menu_items;
?? TITLE := 'clear_command_field', EJECT ??

    PROCEDURE clear_command_field;


      csp$clear_field (display.command_field, status);
      IF NOT status.normal THEN
        EXIT clp$scl_parameter_dialog_mgr;
      IFEND;
      IF display.command_text <> NIL THEN
        FREE display.command_text;
      IFEND;
      need_to_clear_command_field := FALSE;

    PROCEND clear_command_field;
?? TITLE := 'close_window', EJECT ??

    PROCEDURE close_window
      (    window_kind: clt$window_kind);

      VAR
        button: ^clt$dialog_button,
        window_buttons: ^clt$dialog_buttons;


      CASE window_kind OF

      = clc$help_window =
        csp$delete_field (help_window.background_field, status);
        IF NOT status.normal THEN
          EXIT clp$scl_parameter_dialog_mgr;
        IFEND;
        csp$delete_graphic (help_window.box_id, status);
        IF NOT status.normal THEN
          EXIT clp$scl_parameter_dialog_mgr;
        IFEND;
        csp$delete_field (help_window.prompt_field, status);
        IF NOT status.normal THEN
          EXIT clp$scl_parameter_dialog_mgr;
        IFEND;
        csp$delete_field (help_window.text_field, status);
        IF NOT status.normal THEN
          EXIT clp$scl_parameter_dialog_mgr;
        IFEND;
        csp$delete_field (help_window.line_number_field, status);
        IF NOT status.normal THEN
          EXIT clp$scl_parameter_dialog_mgr;
        IFEND;
        free_window_contents (help_window.contents);
        cursor_field_number := help_window.cursor_field_number;
        cursor_character_position := help_window.cursor_character_position;
        cursor_line_number := help_window.cursor_line_number;
        display.help_window_displayed := FALSE;
        display.current_window := help_window.parent_window;
        window_buttons := ^help_window.buttons;

      = clc$message_window =
        csp$delete_field (message_window.background_field, status);
        IF NOT status.normal THEN
          EXIT clp$scl_parameter_dialog_mgr;
        IFEND;
        csp$delete_graphic (message_window.box_id, status);
        IF NOT status.normal THEN
          EXIT clp$scl_parameter_dialog_mgr;
        IFEND;
        csp$delete_field (message_window.prompt_field, status);
        IF NOT status.normal THEN
          EXIT clp$scl_parameter_dialog_mgr;
        IFEND;
        csp$delete_field (message_window.text_field, status);
        IF NOT status.normal THEN
          EXIT clp$scl_parameter_dialog_mgr;
        IFEND;
        csp$delete_field (message_window.line_number_field, status);
        IF NOT status.normal THEN
          EXIT clp$scl_parameter_dialog_mgr;
        IFEND;
        free_window_contents (message_window.contents);
        cursor_field_number := message_window.cursor_field_number;
        cursor_character_position := message_window.cursor_character_position;
        cursor_line_number := message_window.cursor_line_number;
        display.message_window_displayed := FALSE;
        display.current_window := message_window.parent_window;
        status_condition_name := '';
        window_buttons := ^message_window.buttons;

      = clc$zoom_window =
        csp$delete_field (zoom_window.background_field, status);
        IF NOT status.normal THEN
          EXIT clp$scl_parameter_dialog_mgr;
        IFEND;
        csp$delete_graphic (zoom_window.box_id, status);
        IF NOT status.normal THEN
          EXIT clp$scl_parameter_dialog_mgr;
        IFEND;
        csp$delete_field (zoom_window.prompt_field, status);
        IF NOT status.normal THEN
          EXIT clp$scl_parameter_dialog_mgr;
        IFEND;
        csp$delete_field (zoom_window.text_field, status);
        IF NOT status.normal THEN
          EXIT clp$scl_parameter_dialog_mgr;
        IFEND;
        csp$delete_field (zoom_window.title_field, status);
        IF NOT status.normal THEN
          EXIT clp$scl_parameter_dialog_mgr;
        IFEND;
        csp$delete_field (zoom_window.line_number_field, status);
        IF NOT status.normal THEN
          EXIT clp$scl_parameter_dialog_mgr;
        IFEND;
        free_window_contents (zoom_window.contents);
        cursor_field_number := zoom_window.cursor_field_number;
        cursor_character_position := zoom_window.cursor_character_position;
        cursor_line_number := zoom_window.cursor_line_number;
        display.zoom_window_displayed := FALSE;
        display.current_window := zoom_window.parent_window;
        window_buttons := ^zoom_window.buttons;

      ELSE
        window_buttons := NIL;
      CASEND;

      IF window_buttons <> NIL THEN
        button := window_buttons^.first;
        WHILE button <> NIL DO
          IF button^.field <> 0 THEN
            csp$delete_field (button^.field, status);
            IF NOT status.normal THEN
              EXIT clp$scl_parameter_dialog_mgr;
            IFEND;
            button^.field := 0;
          IFEND;
          button := button^.link;
        WHILEND;
      IFEND;

    PROCEND close_window;
?? TITLE := 'condition_handler', EJECT ??

{
{ PURPOSE:
{   This procedure handles block exit and interactive conditions.
{
{   For a block exit condition it "shuts down" the screen interaction and
{   exits as if cancelled by the user.
{
{   For an ifc$terminate_break condition it EXITs from its establisher, which
{   results in this handler being called again for a "block exit" condition.
{

    PROCEDURE condition_handler
      (    condition: pmt$condition;
           ignore_info: ^pmt$condition_information;
           ignore_save_area: ^ost$stack_frame_save_area;
       VAR handler_status: ost$status);

      VAR
        local_status: ^ost$status;


      CASE condition.selector OF

      = pmc$block_exit_processing =
        cancel := TRUE;
        PUSH local_status;
        local_status^ := status;
        status.normal := TRUE;
        shut_down ({ignore_errors=} TRUE);
        status := local_status^;
        RETURN;

      = ifc$interactive_condition =
        CASE condition.interactive_condition OF

        = ifc$terminate_break =
          EXIT clp$scl_parameter_dialog_mgr;

        ELSE
          ;
        CASEND;

      ELSE
        ;
      CASEND;

      pmp$continue_to_cause (pmc$execute_standard_procedure, handler_status);

    PROCEND condition_handler;
?? TITLE := 'construct_parameter_information', EJECT ??

    PROCEDURE construct_parameter_information;

      VAR
        current_parameter: integer,
        first_advanced_parameter: integer,
        i: integer,
        message_text: string (csc$max_x_position),
        text_length: 0 .. csc$max_x_position;


      current_parameter := 0;
      first_advanced_parameter := 0;
      display.parameter_count := pdt.header^.number_of_parameters - pdt.header^.number_of_hidden_parameters +
            (clc$lines_for_advanced * $INTEGER (pdt.header^.number_of_advanced_parameters > 0)) -
            $INTEGER (pdt.header^.status_parameter_number > 0);
      IF display.parameter_count < 1 THEN
        RETURN;
      IFEND;
      ALLOCATE parameter_information: [1 .. display.parameter_count];

      FOR i := 1 TO pdt.header^.number_of_parameters DO
        CASE pdt.parameters^ [i].availability OF

        = clc$normal_usage_entry =
          IF i <> pdt.header^.status_parameter_number THEN
            IF current_parameter < display.parameter_count THEN
              current_parameter := current_parameter + 1;
            ELSE
              osp$set_status_condition (cle$bad_pdt, status);
              EXIT clp$scl_parameter_dialog_mgr;
            IFEND;
            parameter_information^ [current_parameter].advanced_indicator := FALSE;
            parameter_information^ [current_parameter].pdt_number := i;
            parameter_information^ [current_parameter].evaluation_required := FALSE;
            parameter_information^ [current_parameter].required :=
                  pdt.parameters^ [i].requirement = clc$required_parameter;
            parameter_information^ [current_parameter].secure :=
                  pdt.parameters^ [i].security = clc$secure_parameter;
            parameter_information^ [current_parameter].initialized := FALSE;
            parameter_information^ [current_parameter].too_big_to_edit := FALSE;
          IFEND;

        = clc$advanced_usage_entry =

{ Display all advanced usage parameters following normal usage parameters.

          IF first_advanced_parameter = 0 THEN
            first_advanced_parameter := i;
          IFEND;

        ELSE {clc$hidden_usage_entry}

{ Do not display hidden usage parameters.

          ;
        CASEND;

      FOREND;

      IF first_advanced_parameter > 0 THEN
        FOR i := 1 TO clc$lines_for_advanced DO
          IF current_parameter < display.parameter_count THEN
            current_parameter := current_parameter + 1;
          ELSE
            osp$set_status_condition (cle$bad_pdt, status);
            EXIT clp$scl_parameter_dialog_mgr;
          IFEND;
          parameter_information^ [current_parameter].advanced_indicator := TRUE;
          IF i = clc$advanced_label_line_number THEN
            get_message_text (clc$advanced_label, NIL, message_text, text_length);
            parameter_information^ [current_parameter].prompt := message_text (1, text_length);
          ELSE
            parameter_information^ [current_parameter].prompt := ' ';
          IFEND;
        FOREND;

        FOR i := first_advanced_parameter TO pdt.header^.number_of_parameters DO
          CASE pdt.parameters^ [i].availability OF
          = clc$normal_usage_entry =
            ;
          = clc$advanced_usage_entry =
            IF current_parameter < display.parameter_count THEN
              current_parameter := current_parameter + 1;
            ELSE
              osp$set_status_condition (cle$bad_pdt, status);
              EXIT clp$scl_parameter_dialog_mgr;
            IFEND;
            parameter_information^ [current_parameter].advanced_indicator := FALSE;
            parameter_information^ [current_parameter].pdt_number := i;
            parameter_information^ [current_parameter].evaluation_required := FALSE;
            parameter_information^ [current_parameter].required :=
                  pdt.parameters^ [i].requirement = clc$required_parameter;
            parameter_information^ [current_parameter].secure :=
                  pdt.parameters^ [i].security = clc$secure_parameter;
            parameter_information^ [current_parameter].initialized := FALSE;
            parameter_information^ [current_parameter].too_big_to_edit := FALSE;
          ELSE {clc$hidden_usage_entry}
            ;
          CASEND;
        FOREND;
      IFEND;

      IF current_parameter <> display.parameter_count THEN
        osp$set_status_condition (cle$bad_pdt, status);
        EXIT clp$scl_parameter_dialog_mgr;
      IFEND;

    PROCEND construct_parameter_information;
?? TITLE := 'construct_window_prompt', EJECT ??

    PROCEDURE construct_window_prompt
      (    message_name: clt$parameter_name;
           message_parameters: ^array [1 .. * ] of ^ost$message_parameter;
       VAR message_text: string ( * <= csc$max_x_position);
       VAR text_length: 0 .. csc$max_x_position);


      VAR
        message: ost$status_message,
        message_area: ^ost$status_message,
        message_line: ^ost$status_message_line,
        message_line_count: ^ost$status_message_line_count,
        message_line_size: ^ost$status_message_line_size,
        message_template: ^ost$message_template;

      find_help_module;
      osp$find_param_assist_prompt (display.help_module, message_name, message_template, status);
      IF NOT status.normal THEN
        EXIT clp$scl_parameter_dialog_mgr;
      IFEND;
      osp$format_help_message (message_template, message_parameters, message_field_width, message, status);
      IF NOT status.normal THEN
        EXIT clp$scl_parameter_dialog_mgr;
      IFEND;

      message_area := ^message;
      RESET message_area;
      NEXT message_line_count IN message_area;
      IF message_line_count^ = 1 THEN
        NEXT message_line_size IN message_area;
        NEXT message_line: [message_line_size^] IN message_area;
        text_length := message_line_size^;
        message_text := message_line^;
      ELSE
        text_length := 0;
        message_text := '';
      IFEND;

    PROCEND construct_window_prompt;
?? TITLE := 'convert_name_to_message_param', EJECT ??

    PROCEDURE convert_name_to_message_param
      (VAR name {input, output} : ost$name);

      VAR
        i: 1 .. osc$max_name_size,
        new_word: boolean;


      new_word := TRUE;
      FOR i := 1 TO osc$max_name_size DO
        IF name (i) = ' ' THEN
          RETURN;
        ELSEIF name (i) = '_' THEN
          name (i) := ' ';
          new_word := TRUE;
        ELSEIF new_word THEN
          new_word := FALSE;
        ELSE
          name (i) := osv$upper_to_lower ($INTEGER (name (i)) + 1);
        IFEND;
      FOREND;

    PROCEND convert_name_to_message_param;
?? TITLE := 'create_prompt_and_value_fields', EJECT ??

    PROCEDURE create_prompt_and_value_fields;

      VAR
        i: 0 .. csc$max_line_number,
        prompt_field: clt$field_attributes,
        parameter_value_field: clt$field_attributes;


      prompt_field := clv$default_field_attributes;
      prompt_field [x_position_attribute].x_position := clc$left_margin;
      prompt_field [visible_characters_attribute].characters := clc$prompt_object_width;
      prompt_field [visible_lines_attribute].lines := 1;
      prompt_field [characters_attribute].characters := clc$prompt_object_width;
      prompt_field [lines_attribute].lines := 1;

      parameter_value_field := clv$default_field_attributes;
      parameter_value_column_number := clc$left_margin + clc$prompt_object_width + clc$middle_margin + 1;
      parameter_value_field_width := display.screen_width - parameter_value_column_number - clc$right_margin;
      parameter_value_field [x_position_attribute].x_position := parameter_value_column_number;
      parameter_value_field [visible_characters_attribute].characters := parameter_value_field_width;
      parameter_value_field [visible_lines_attribute].lines := 1;
      parameter_value_field [characters_attribute].characters := parameter_value_field_width;
      parameter_value_field [lines_attribute].lines := 1;
      parameter_value_field [input_attribute].input := TRUE;
      parameter_value_field [logical_highlighting_attribute].logical_highlighting := csc$input;

      FOR i := 1 TO display.parameters_displayed DO
        prompt_field [y_position_attribute].y_position := start_of_parameter_lines + i - 1;
        csp$allocate_field (prompt_field, parameter_display_info^ [i].prompt_field_number, status);
        IF NOT status.normal THEN
          EXIT clp$scl_parameter_dialog_mgr;
        IFEND;
        parameter_value_field [y_position_attribute].y_position := start_of_parameter_lines + i - 1;
        csp$allocate_field (parameter_value_field, parameter_display_info^ [i].value_field_number, status);
        IF NOT status.normal THEN
          EXIT clp$scl_parameter_dialog_mgr;
        IFEND;
      FOREND;

    PROCEND create_prompt_and_value_fields;
?? TITLE := 'create_window', EJECT ??

    PROCEDURE create_window
      (    window_kind: clt$window_kind;
           x_position: 0 .. csc$max_x_position;
           y_position: 0 .. csc$max_line_number;
           width: 0 .. csc$max_x_position;
           height: 0 .. csc$max_line_number;
           box_prompt: string ( * <= 256);
           box_title: string ( * <= 256);
           force_protection: boolean);

      VAR
        background_field_number: cst$field_number,
        box_coordinates: array [1 .. 5] of cst$xy_coordinate,
        box_graphic_id: cst$graphic_identifier,
        box_prompt_field: clt$field_attributes,
        box_prompt_field_number: cst$field_number,
        box_prompt_width: 0 .. csc$max_x_position,
        box_title_field: clt$field_attributes,
        box_title_width: 0 .. csc$max_x_position,
        corner_coordinates: array [1 .. 4] of cst$xy_coordinate,
        end_of_text: boolean,
        intersection_types: array [1 .. 4] of cst$intersection_type,
        line_number_field: clt$field_attributes,
        line_number_field_number: cst$field_number,
        text_field: clt$field_attributes,
        text_field_number: cst$field_number,
        window_buttons: ^clt$dialog_buttons;


      csp$change_line_width (csc$fine, status);
      IF NOT status.normal THEN
        EXIT clp$scl_parameter_dialog_mgr;
      IFEND;
      initialize_background_field (x_position, y_position, width, height, background_field_number);
      box_coordinates [1].x := x_position;
      box_coordinates [1].y := y_position;
      box_coordinates [2].x := x_position + width - 1;
      box_coordinates [2].y := box_coordinates [1].y;
      box_coordinates [3].x := box_coordinates [2].x;
      box_coordinates [3].y := box_coordinates [1].y + height - 1;
      box_coordinates [4].x := box_coordinates [1].x;
      box_coordinates [4].y := box_coordinates [3].y;
      box_coordinates [5] := box_coordinates [1];
      csp$poly_hv_line (box_coordinates, box_graphic_id, status);
      IF NOT status.normal THEN
        EXIT clp$scl_parameter_dialog_mgr;
      IFEND;

      intersection_types [1] := csc$upper_left;
      intersection_types [2] := csc$upper_right;
      intersection_types [3] := csc$lower_right;
      intersection_types [4] := csc$lower_left;
      corner_coordinates [1].x := box_coordinates [1].x;
      corner_coordinates [1].y := box_coordinates [1].y;
      corner_coordinates [2].x := box_coordinates [2].x;
      corner_coordinates [2].y := box_coordinates [2].y;
      corner_coordinates [3].x := box_coordinates [3].x;
      corner_coordinates [3].y := box_coordinates [3].y;
      corner_coordinates [4].x := box_coordinates [4].x;
      corner_coordinates [4].y := box_coordinates [4].y;
      csp$poly_intersect (box_graphic_id, corner_coordinates, intersection_types, status);
      IF NOT status.normal THEN
        EXIT clp$scl_parameter_dialog_mgr;
      IFEND;

      box_prompt_width := STRLENGTH (box_prompt);
      box_prompt_field := clv$default_field_attributes;
      box_prompt_field [x_position_attribute].x_position := ((width - box_prompt_width) DIV 2) + 1;
      box_prompt_field [y_position_attribute].y_position := box_coordinates [3].y;
      box_prompt_field [visible_characters_attribute].visible_characters := box_prompt_width;
      box_prompt_field [characters_attribute].characters := box_prompt_field [3].visible_characters;
      box_prompt_field [logical_highlighting_attribute].logical_highlighting := csc$italic;
      csp$allocate_field (box_prompt_field, box_prompt_field_number, status);
      IF NOT status.normal THEN
        EXIT clp$scl_parameter_dialog_mgr;
      IFEND;
      csp$change_io_position (box_prompt_field_number, 1, status);
      IF NOT status.normal THEN
        EXIT clp$scl_parameter_dialog_mgr;
      IFEND;
      end_of_text := FALSE;
      csp$put_text (^box_prompt, TRUE, end_of_text, status);
      IF NOT status.normal THEN
        EXIT clp$scl_parameter_dialog_mgr;
      IFEND;

      text_field := clv$default_field_attributes;
      text_field [x_position_attribute].x_position := clc$left_margin;
      text_field [y_position_attribute].y_position := y_position + 1;
      text_field [visible_characters_attribute].visible_characters := message_field_width;
      text_field [visible_lines_attribute].visible_lines := height - 2;
      text_field [characters_attribute].characters := text_field [visible_characters_attribute].
            visible_characters;
      text_field [lines_attribute].lines := text_field [visible_lines_attribute].visible_lines;

      IF (window_kind = clc$zoom_window) AND (NOT force_protection) THEN
        text_field [input_attribute].input := TRUE;
        text_field [logical_highlighting_attribute].logical_highlighting := csc$input;
      IFEND;

      csp$allocate_field (text_field, text_field_number, status);
      IF NOT status.normal THEN
        EXIT clp$scl_parameter_dialog_mgr;
      IFEND;

      line_number_field := clv$default_field_attributes;
      line_number_field [x_position_attribute].x_position := width - clc$title_line_number_inset;
      line_number_field [y_position_attribute].y_position := y_position;
      line_number_field [visible_characters_attribute].visible_characters := 1;
      line_number_field [characters_attribute].characters := display.screen_width;

      csp$allocate_field (line_number_field, line_number_field_number, status);
      IF NOT status.normal THEN
        EXIT clp$scl_parameter_dialog_mgr;
      IFEND;

      CASE window_kind OF
      = clc$help_window =
        display.help_window_displayed := TRUE;
        help_window.parent_window := display.current_window;
        display.current_window := clc$help_window;
        help_window.prompt_field := box_prompt_field_number;
        help_window.text_field := text_field_number;
        help_window.background_field := background_field_number;
        help_window.top := 1;
        help_window.lines_displayed := height - 2;
        help_window.box_id := box_graphic_id;
        help_window.contents := NIL;
        help_window.line_number_field := line_number_field_number;
        help_window.cursor_field_number := cursor_field_number;
        help_window.cursor_character_position := cursor_character_position;
        help_window.cursor_line_number := cursor_line_number;
        window_buttons := ^help_window.buttons;

      = clc$message_window =
        display.message_window_displayed := TRUE;
        message_window.parent_window := display.current_window;
        display.current_window := clc$message_window;
        message_window.prompt_field := box_prompt_field_number;
        message_window.text_field := text_field_number;
        message_window.background_field := background_field_number;
        message_window.top := 1;
        message_window.lines_displayed := height - 2;
        message_window.box_id := box_graphic_id;
        message_window.contents := NIL;
        message_window.line_number_field := line_number_field_number;
        message_window.cursor_field_number := cursor_field_number;
        message_window.cursor_character_position := cursor_character_position;
        message_window.cursor_line_number := cursor_line_number;
        window_buttons := ^message_window.buttons;

      = clc$zoom_window =
        box_title_width := STRLENGTH (box_title);
        box_title_field := clv$default_field_attributes;
        box_title_field [x_position_attribute].x_position :=
              box_coordinates [1].x + clc$title_line_number_inset;
        box_title_field [y_position_attribute].y_position := box_coordinates [1].y;
        box_title_field [visible_characters_attribute].visible_characters := box_title_width;
        box_title_field [visible_lines_attribute].visible_lines := 1;
        box_title_field [characters_attribute].characters :=
              box_title_field [visible_characters_attribute].visible_characters;
        box_title_field [lines_attribute].lines := 1;
        box_title_field [logical_highlighting_attribute].logical_highlighting := csc$logical_normal;
        csp$allocate_field (box_title_field, zoom_window.title_field, status);
        IF NOT status.normal THEN
          EXIT clp$scl_parameter_dialog_mgr;
        IFEND;
        csp$change_io_position (zoom_window.title_field, 1, status);
        IF NOT status.normal THEN
          EXIT clp$scl_parameter_dialog_mgr;
        IFEND;
        end_of_text := FALSE;
        csp$put_text (^box_title, TRUE, end_of_text, status);
        IF NOT status.normal THEN
          EXIT clp$scl_parameter_dialog_mgr;
        IFEND;
        display.zoom_window_displayed := TRUE;
        zoom_window.parent_window := display.current_window;
        display.current_window := clc$zoom_window;
        zoom_window.prompt_field := box_prompt_field_number;
        zoom_window.text_field := text_field_number;
        zoom_window.background_field := background_field_number;
        zoom_window.top := 1;
        zoom_window.lines_displayed := height - 2;
        zoom_window.box_id := box_graphic_id;
        zoom_window.parameter_value := FALSE;
        zoom_window.line_count := text_field [lines_attribute].lines;
        zoom_window.line_number_field := line_number_field_number;
        window_buttons := ^zoom_window.buttons;
        zoom_window.contents := NIL;
        zoom_window.changeable := TRUE;

      ELSE
        window_buttons := NIL;
      CASEND;

      IF window_buttons <> NIL THEN
        initialize_buttons (window_buttons^);
      IFEND;

      cursor_field_number := text_field_number;
      cursor_line_number := 1;
      cursor_character_position := 1;

    PROCEND create_window;
?? TITLE := 'display_help_window', EJECT ??

    PROCEDURE display_help_window
      (    representation: ^clt$data_representation;
       VAR message_area: ^ost$status_message);

      VAR
        events: ^array [1 .. * ] of carriage_return .. down_event,
        i: 0 .. csc$max_line_number,
        message_line: ^ost$status_message_line,
        message_line_count: ^ost$status_message_line_count,
        message_lines: ost$status_message_line_count,
        message_line_size: ^ost$status_message_line_size,
        message_text: string (csc$max_x_position),
        number_of_lines_for_box: 0 .. csc$max_line_number,
        representation_area: ^clt$data_representation,
        representation_line: ^clt$string_value,
        representation_line_count: ^clt$data_representation_count,
        representation_line_size: ^clt$string_size,
        separation_lines: 0 .. csc$max_line_number,
        text_length: 0 .. csc$max_x_position;

      IF display.help_window_displayed THEN
        close_window (clc$help_window);
      IFEND;
      change_menu_items (display.current_window, clc$help_window);
      IF message_area <> NIL THEN
        RESET message_area;
        NEXT message_line_count IN message_area;
        message_lines := message_line_count^;
      ELSE
        message_lines := 0;
      IFEND;
      help_window.line_count := message_lines;

      IF representation <> NIL THEN
        PUSH representation_area: [[REP #SIZE (representation^) OF cell]];
        representation_area^ := representation^;
        RESET representation_area;
        NEXT representation_line_count IN representation_area;
        help_window.line_count := help_window.line_count + representation_line_count^;
      IFEND;

      IF (message_area <> NIL) AND (representation <> NIL) THEN
        separation_lines := 1;
      ELSE
        separation_lines := 0;
      IFEND;
      help_window.line_count := help_window.line_count + separation_lines;

      IF help_window.line_count > dialog_box_max_lines - 2 THEN
        PUSH events: [1 .. 3];
        events^ [1] := carriage_return;
        events^ [2] := forward_event;
        events^ [3] := backward_event;
        get_function_key_message (clc$press_next_from_pageable, events, message_text, text_length);
        number_of_lines_for_box := dialog_box_max_lines;
      ELSE
        PUSH events: [1 .. 1];
        events^ [1] := carriage_return;
        get_function_key_message (clc$press_next, events, message_text, text_length);
        number_of_lines_for_box := help_window.line_count + 2;
      IFEND;
      create_window (clc$help_window, 1, dialog_box_top, display.screen_width, number_of_lines_for_box,
            message_text (1, text_length), '', FALSE);
      update_lines_l_thru_m_of_n (help_window.top, help_window.lines_displayed, help_window.line_count,
            help_window.line_number_field, help_window.buttons);
      ALLOCATE help_window.contents: [1 .. help_window.line_count];

      FOR i := 1 TO message_lines DO
        NEXT message_line_size IN message_area;
        NEXT message_line: [message_line_size^] IN message_area;
        IF message_line_size^ > 1 THEN
          ALLOCATE help_window.contents^ [i]: [message_line_size^ -1];
          help_window.contents^ [i]^ := message_line^ (2, * );
        ELSE
          help_window.contents^ [i] := NIL;
        IFEND;
      FOREND;

      FOR i := message_lines + 1 TO message_lines + separation_lines DO
        help_window.contents^ [i] := NIL;
      FOREND;

      FOR i := message_lines + 1 + separation_lines TO help_window.line_count DO
        NEXT representation_line_size IN representation_area;
        NEXT representation_line: [representation_line_size^] IN representation_area;
        IF representation_line_size^ > 0 THEN
          ALLOCATE help_window.contents^ [i]: [representation_line_size^];
          help_window.contents^ [i]^ := representation_line^;
        ELSE
          help_window.contents^ [i] := NIL;
        IFEND;
      FOREND;

      update_window_display (clc$help_window);

    PROCEND display_help_window;
?? TITLE := 'display_message', EJECT ??

    PROCEDURE display_message
      (    message_text: string ( * ));

      VAR
        end_of_text: boolean,
        message_text_length: 0 .. csc$max_x_position;


      csp$change_io_position (display.message_field, 1, status);
      IF NOT status.normal THEN
        EXIT clp$scl_parameter_dialog_mgr;
      IFEND;

      message_text_length := clp$trimmed_string_size (message_text);
      IF message_text_length > message_field_width THEN
{ Truncate long messages.
        message_text_length := message_field_width;
      IFEND;
      csp$put_text (^message_text (1, message_text_length), TRUE, end_of_text, status);
      IF NOT status.normal THEN
        EXIT clp$scl_parameter_dialog_mgr;
      IFEND;
      message_displayed := TRUE;
      message_read := FALSE;

    PROCEND display_message;
?? TITLE := 'display_message_and_status', EJECT ??

    PROCEDURE display_message_and_status
      (    message_status: ost$status);

      VAR
        i: integer,
        message: ost$status_message,
        message_area: ^ost$status_message,
        message_line: ^ost$status_message_line,
        message_line_count: ^ost$status_message_line_count,
        message_line_size: ^ost$status_message_line_size,
        message_parameters: ^array [1 .. * ] of ^ost$message_parameter,
        status_message: ost$status_message;


{ Save status condition name for future HELP processing.

      osp$get_status_condition_name (message_status.condition, status_condition_name, status);
      IF NOT status.normal THEN
        EXIT clp$scl_parameter_dialog_mgr;
      IFEND;

      osp$format_message (message_status, osc$current_message_level, osc$max_status_message_line,
            status_message, status);
      IF NOT status.normal THEN
        EXIT clp$scl_parameter_dialog_mgr;
      IFEND;

      message_area := ^status_message;
      RESET message_area;
      NEXT message_line_count IN message_area;
      PUSH message_parameters: [1 .. message_line_count^ +1];
      message_parameters^ [1] := ^parameter_information^ [parameter_number].name;
      FOR i := 2 TO message_line_count^ +1 DO
        NEXT message_line_size IN message_area;
        NEXT message_line: [message_line_size^] IN message_area;
        message_parameters^ [i] := message_line;
      FOREND;
      get_message (clc$error_can_be_ignored, message_parameters, message);
      display_status_message (message, clc$message_window);

    PROCEND display_message_and_status;
?? TITLE := 'display_message_box', EJECT ??

    PROCEDURE display_message_box
      (    message: ost$status_message;
           line_count: 0 .. csc$max_line_number;
           window_kind: clt$window_kind);

      VAR
        events: ^array [1 .. * ] of carriage_return .. down_event,
        message_text: string (csc$max_x_position),
        number_of_lines_for_box: 0 .. csc$max_line_number,
        text_length: 0 .. csc$max_x_position;

?? NEWTITLE := 'display_status_in_box', EJECT ??

      PROCEDURE display_status_in_box
        (    message: ost$status_message;
             line_count: 0 .. csc$max_line_number;
         VAR window: clt$output_window);

        VAR
          end_of_text: boolean,
          i: 0 .. csc$max_line_number,
          message_area: ^ost$status_message,
          message_line: ^ost$status_message_line,
          message_line_count: ^ost$status_message_line_count,
          message_line_size: ^ost$status_message_line_size;


        message_area := ^message;
        RESET message_area;
        NEXT message_line_count IN message_area;
        window.line_count := message_line_count^;
        ALLOCATE window.contents: [1 .. window.line_count];
        FOR i := 1 TO window.line_count DO
          NEXT message_line_size IN message_area;
          NEXT message_line: [message_line_size^] IN message_area;
          IF message_line_size^ > 1 THEN
            ALLOCATE window.contents^ [i]: [message_line_size^ -1];
            window.contents^ [i]^ := message_line^ (2, * );
          ELSE
            window.contents^ [i] := NIL;
          IFEND;
          IF (i <= line_count) AND (window.contents^ [i] <> NIL) THEN
            csp$change_io_position (window.text_field, i, status);
            IF NOT status.normal THEN
              EXIT clp$scl_parameter_dialog_mgr;
            IFEND;
            csp$put_text (window.contents^ [i], TRUE, end_of_text, status);
            IF NOT status.normal THEN
              EXIT clp$scl_parameter_dialog_mgr;
            IFEND;
          IFEND;
        FOREND;

        update_lines_l_thru_m_of_n (window.top, window.lines_displayed, window.line_count,
              window.line_number_field, window.buttons);

      PROCEND display_status_in_box;
?? OLDTITLE, EJECT ??

      CASE window_kind OF
      = clc$help_window =
        IF display.help_window_displayed THEN
          close_window (clc$help_window);
        IFEND;
      = clc$message_window =
        IF display.message_window_displayed THEN
          close_window (clc$message_window);
        IFEND;
      ELSE
      CASEND;
      IF line_count > (dialog_box_max_lines - 2) THEN
        PUSH events: [1 .. 3];
        events^ [1] := carriage_return;
        events^ [2] := forward_event;
        events^ [3] := backward_event;
        get_function_key_message (clc$press_next_from_pageable, events, message_text, text_length);
        number_of_lines_for_box := dialog_box_max_lines;
      ELSE
        PUSH events: [1 .. 1];
        events^ [1] := carriage_return;
        get_function_key_message (clc$press_next, events, message_text, text_length);
        number_of_lines_for_box := line_count + 2;
      IFEND;
      change_menu_items (display.current_window, window_kind);
      create_window (window_kind, 1, dialog_box_top, display.screen_width, number_of_lines_for_box,
            message_text (1, text_length), '', FALSE);
      CASE window_kind OF
      = clc$help_window =
        display_status_in_box (message, number_of_lines_for_box - 2, help_window);
      = clc$message_window =
        display_status_in_box (message, number_of_lines_for_box - 2, message_window);
        message_read := FALSE;
      ELSE
      CASEND;

    PROCEND display_message_box;
?? TITLE := 'display_prompt_and_value', EJECT ??

    PROCEDURE display_prompt_and_value;

      VAR
        end_of_text: boolean,
        prompt_field_attributes: array [1 .. 2] of cst$field_attribute,
        text: ^string ( * ),
        text_length: 0 .. csc$max_character_position,
        value_field_attributes: array [1 .. 3] of cst$field_attribute;


      csp$change_io_position (parameter_display_info^ [parameter_number - display.top_parameter +
            1].prompt_field_number, 1, status);
      IF NOT status.normal THEN
        EXIT clp$scl_parameter_dialog_mgr;
      IFEND;
      prompt_field_attributes [1].key := csc$fld_highlighting;
      prompt_field_attributes [1].highlighting_style := csc$logical_highlighting;
      prompt_field_attributes [2].key := csc$fld_logical_highlighting;
      IF (NOT parameter_information^ [parameter_number].advanced_indicator) AND
            (parameter_information^ [parameter_number].required) THEN
        prompt_field_attributes [2].logical_highlighting := csc$error;
      ELSE
        prompt_field_attributes [2].logical_highlighting := csc$logical_normal;
      IFEND;
      csp$change_field_attributes (parameter_display_info^ [parameter_number - display.top_parameter +
            1].prompt_field_number, prompt_field_attributes, status);
      IF NOT status.normal THEN
        EXIT clp$scl_parameter_dialog_mgr;
      IFEND;
      csp$put_text (^parameter_information^ [parameter_number].prompt, TRUE, end_of_text, status);
      IF NOT status.normal THEN
        EXIT clp$scl_parameter_dialog_mgr;
      IFEND;

      csp$change_io_position (parameter_display_info^ [parameter_number - display.top_parameter +
            1].value_field_number, 1, status);
      IF NOT status.normal THEN
        EXIT clp$scl_parameter_dialog_mgr;
      IFEND;
      IF parameter_information^ [parameter_number].advanced_indicator OR
            parameter_information^ [parameter_number].secure THEN
        PUSH text: [0];
        parameter_information^ [parameter_number].overflow := FALSE;
      ELSE
        text_length := clp$trimmed_string_size (parameter_information^ [parameter_number].value^);
        IF text_length > parameter_value_field_width THEN
          text_length := parameter_value_field_width;
          PUSH text: [text_length];
          text^ := parameter_information^ [parameter_number].value^ (1, text_length);
          text^ (text_length - 1, 2) := clc$overflow_indicator;
          parameter_information^ [parameter_number].overflow := TRUE;
        ELSE
          PUSH text: [text_length];
          text^ := parameter_information^ [parameter_number].value^;
          parameter_information^ [parameter_number].overflow := FALSE;
        IFEND;
      IFEND;
      IF parameter_information^ [parameter_number].advanced_indicator THEN
        value_field_attributes [1].key := csc$fld_visible;
        value_field_attributes [1].visible := FALSE;
        value_field_attributes [2].key := csc$fld_logical_highlighting;
        value_field_attributes [2].logical_highlighting := csc$logical_normal;
        value_field_attributes [3].key := csc$fld_input;
        value_field_attributes [3].input := FALSE;
      ELSE
        value_field_attributes [1].key := csc$fld_visible;
        value_field_attributes [1].visible := NOT parameter_information^ [parameter_number].secure;
        value_field_attributes [2].key := csc$fld_logical_highlighting;
        value_field_attributes [3].key := csc$fld_input;
        IF parameter_information^ [parameter_number].too_big_to_edit OR
              parameter_information^ [parameter_number].overflow THEN
          value_field_attributes [2].logical_highlighting := csc$logical_normal;
          value_field_attributes [3].input := FALSE;
        ELSE
          value_field_attributes [2].logical_highlighting := csc$input;
          value_field_attributes [3].input := TRUE;
        IFEND;
      IFEND;
      csp$change_field_attributes (parameter_display_info^ [parameter_number - display.top_parameter +
            1].value_field_number, value_field_attributes, status);
      IF NOT status.normal THEN
        EXIT clp$scl_parameter_dialog_mgr;
      IFEND;
      csp$put_text (text, TRUE, end_of_text, status);
      IF NOT status.normal THEN
        EXIT clp$scl_parameter_dialog_mgr;
      IFEND;

    PROCEND display_prompt_and_value;
?? TITLE := 'display_status', EJECT ??

    PROCEDURE display_status
      (    message_status: ost$status);

      VAR
        message: ost$status_message,
        message_area: ^ost$status_message,
        message_line: ^ost$status_message_line,
        message_line_count: ^ost$status_message_line_count,
        message_line_size: ^ost$status_message_line_size,
        message_text: ^string ( * );


{ Save status condition name for future HELP processing.

      osp$get_status_condition_name (message_status.condition, status_condition_name, status);
      IF NOT status.normal THEN
        EXIT clp$scl_parameter_dialog_mgr;
      IFEND;

      osp$format_message (message_status, osc$current_message_level, message_field_width + 1, message,
            status);
      IF NOT status.normal THEN
        EXIT clp$scl_parameter_dialog_mgr;
      IFEND;

      message_area := ^message;
      RESET message_area;
      NEXT message_line_count IN message_area;
      IF message_line_count^ = 1 THEN
        PUSH message_text: [message_field_width];
        NEXT message_line_size IN message_area;
        NEXT message_line: [message_line_size^] IN message_area;
        message_text^ := message_line^ (2, * );
        display_message (message_text^);
      ELSE
        display_message_box (message, message_line_count^, clc$message_window);
      IFEND;

    PROCEND display_status;
?? TITLE := 'display_status_message', EJECT ??

    PROCEDURE display_status_message
      (    status_message: ost$status_message;
           window_kind: clt$window_kind);

      VAR
        message_area: ^ost$status_message,
        message_line: ^ost$status_message_line,
        message_line_count: ^ost$status_message_line_count,
        message_line_size: ^ost$status_message_line_size,
        message_text: ^string ( * );


      message_area := ^status_message;
      RESET message_area;
      NEXT message_line_count IN message_area;
      IF (message_line_count^ = 1) AND (window_kind = clc$message_window) THEN
        PUSH message_text: [message_field_width];
        NEXT message_line_size IN message_area;
        NEXT message_line: [message_line_size^] IN message_area;
        message_text^ := message_line^ (2, * );
        display_message (message_text^);
      ELSE
        display_message_box (status_message, message_line_count^, window_kind);
      IFEND;

    PROCEND display_status_message;
?? TITLE := 'display_text_in_window', EJECT ??

    PROCEDURE display_text_in_window
      (    window_kind: clt$window_kind;
           text: ^string ( * ));

      VAR
        i: integer,
        line_numbers: integer,
        text_length: 0 .. csc$max_character_position;


      CASE window_kind OF
      = clc$help_window =
        text_length := clp$trimmed_string_size (text^);
        line_numbers := (text_length DIV message_field_width) +
              $INTEGER ((text_length MOD message_field_width) <> 0);
        IF help_window.contents <> NIL THEN
          free_window_contents (help_window.contents);
        IFEND;
        ALLOCATE help_window.contents: [1 .. line_numbers];
        help_window.line_count := line_numbers;
        FOR i := 1 TO line_numbers DO
          ALLOCATE help_window.contents^ [i]: [message_field_width];
          IF (i = line_numbers) AND ((text_length MOD message_field_width) > 0) THEN
            help_window.contents^ [i]^ := text^ (((i - 1) * message_field_width + 1),
                  (text_length MOD message_field_width));
          ELSE
            help_window.contents^ [i]^ := text^ (((i - 1) * message_field_width + 1), message_field_width);
          IFEND;
        FOREND;
        update_window_display (clc$help_window);
      = clc$zoom_window =
        IF (text <> NIL) AND (text^ <> '') THEN
          text_length := clp$trimmed_string_size (text^);
          line_numbers := (text_length DIV message_field_width) +
                $INTEGER ((text_length MOD message_field_width) <> 0);
        ELSE
          line_numbers := 0;
        IFEND;
        IF zoom_window.contents <> NIL THEN
          IF line_numbers > zoom_window.line_count THEN
            free_window_contents (zoom_window.contents);
            ALLOCATE zoom_window.contents: [1 .. line_numbers];
          IFEND;
        ELSEIF line_numbers > zoom_window.lines_displayed THEN
          ALLOCATE zoom_window.contents: [1 .. line_numbers];
          zoom_window.line_count := line_numbers;
        ELSE
          ALLOCATE zoom_window.contents: [1 .. zoom_window.lines_displayed];
          zoom_window.line_count := zoom_window.lines_displayed;
        IFEND;
        FOR i := 1 TO line_numbers DO
          ALLOCATE zoom_window.contents^ [i]: [message_field_width];
          IF (i = line_numbers) AND ((text_length MOD message_field_width) > 0) THEN
            zoom_window.contents^ [i]^ := text^ (((i - 1) * message_field_width + 1),
                  (text_length MOD message_field_width));
          ELSE
            zoom_window.contents^ [i]^ := text^ (((i - 1) * message_field_width + 1), message_field_width);
          IFEND;
        FOREND;
        FOR i := line_numbers + 1 TO zoom_window.line_count DO
          zoom_window.contents^ [i] := NIL;
        FOREND;
        update_window_display (clc$zoom_window);
      ELSE
      CASEND;

    PROCEND display_text_in_window;
?? TITLE := 'find_help_module', EJECT ??

    PROCEDURE [INLINE] find_help_module;

      VAR
        ignore_natural_language: ost$natural_language,
        ignore_online_manual_name: ost$online_manual_name;

      IF display.help_module = NIL THEN
        osp$find_help_module (clc$spdm_messages_module, display.help_module, ignore_online_manual_name,
              ignore_natural_language, status);
        IF NOT status.normal THEN
          EXIT clp$scl_parameter_dialog_mgr;
        IFEND;
      IFEND;

    PROCEND find_help_module;
?? TITLE := 'free_window_contents', EJECT ??

    PROCEDURE free_window_contents
      (VAR window_contents: ^array [1 .. * ] of ^string ( * ));

      VAR
        i: integer;


      IF window_contents <> NIL THEN
        FOR i := 1 TO UPPERBOUND (window_contents^) DO
          IF window_contents^ [i] <> NIL THEN
            FREE window_contents^ [i];
          IFEND;
        FOREND;
        FREE window_contents;
      IFEND;

    PROCEND free_window_contents;
?? TITLE := 'get_action', EJECT ??

    PROCEDURE get_action
      (VAR got_an_action {input, output} : boolean;
       VAR action: integer);

?? NEWTITLE := 'condition_handler', EJECT ??

{
{ PURPOSE:
{   This procedure handles ifc$job_reconnect conditions during a screen
{   manager "input" request (csp$get_event).
{   It first "continues" the condition to allow the default behavior to occur.
{   It then EXITs from its establisher in order to exit from any outstanding
{   screen manager call.
{   The caller of this handler's establisher is expected to repaint the screen
{   by calling csp$clear_screen, then recall this handler's establisher.
{

    PROCEDURE condition_handler
      (    condition: pmt$condition;
           ignore_info: ^pmt$condition_information;
           ignore_save_area: ^ost$stack_frame_save_area;
       VAR handler_status: ost$status);


      pmp$continue_to_cause (pmc$execute_standard_procedure, handler_status);

      IF handler_status.normal AND (condition.selector = ifc$interactive_condition) AND
            (condition.interactive_condition = ifc$job_reconnect) THEN
        EXIT get_action;
      IFEND;

    PROCEND condition_handler;
?? TITLE := 'get_mouse_action', EJECT ??

      PROCEDURE get_mouse_action;

        VAR
          button: ^clt$dialog_button,
          ignore_next_event: cst$event_identifier,
          page_attributes: array [1 .. 1] of cst$page_attribute;


{ ignore the "next" event which always follows a mouse event }

        csp$get_event (ignore_next_event, status);
        IF NOT status.normal THEN
          EXIT clp$scl_parameter_dialog_mgr;
        IFEND;

        CASE event.field_event.mouse_event OF
        = 1 =
          action := mouse_click_strong;
        = 2 =
          action := mouse_click_weak;
        = help_event_from_menu, ok_event_from_menu, cancel_event_from_menu, evaluate_event_from_menu,
              reset_event_from_menu, zoom_event_from_menu, edit_zoom_event_from_menu,
              info_event_from_menu =
          action := event.field_event.mouse_event - menu_event_bias;
          RETURN;
        ELSE
          action := 0;
          RETURN;
        CASEND;

        CASE display.current_window OF
        = clc$help_window =
          button := help_window.buttons.first;
        = clc$message_window =
          button := message_window.buttons.first;
        = clc$zoom_window =
          button := zoom_window.buttons.first;
        ELSE {clc$no_window
          button := display.buttons.first;
        CASEND;

        WHILE button <> NIL DO
          IF button^.field = event.field_event_field_number THEN

            IF action = mouse_click_strong THEN
              action := button^.strong_action;
            ELSE
              action := button^.weak_action;
            IFEND;

            page_attributes [1].key := csc$mouse_reclick_request;
            page_attributes [1].mouse_reclick_request := TRUE;
            csp$change_page_attributes (page_attributes, status);
            IF NOT status.normal THEN
              EXIT clp$scl_parameter_dialog_mgr;
            IFEND;
            RETURN;

          IFEND;
          button := button^.link;
        WHILEND;

        IF action = mouse_click_strong THEN
          CASE display.current_window OF
          = clc$help_window, clc$message_window =
            action := 0;
            next_event := TRUE;
          = clc$zoom_window =
            action := mouse_click_weak {just resolves cursor} ;
          ELSE {clc$no_window
            action := zoom_event;
          CASEND;
        IFEND;

        cursor_field_number := event.field_event_field_number;
        cursor_character_position := event.field_event_character_position;
        cursor_line_number := event.field_event_line_number;

      PROCEND get_mouse_action;
?? OLDTITLE, EJECT ??

      screen_event := FALSE;
      mouse_event := FALSE;
      got_an_action := FALSE;
      action := 0;

      osp$establish_condition_handler (^condition_handler, FALSE);

    /get_event_loop/
      WHILE TRUE DO

        next_event := FALSE;
        csp$get_event (event, status);
        IF NOT status.normal THEN
          EXIT clp$scl_parameter_dialog_mgr;
        IFEND;

        CASE event.event_type OF
        = csc$page_event =
          CASE event.page_event.event_type OF
          = csc$page_screen =
            screen_event := TRUE;
          = csc$page_menu_event =
            action := event.page_event.menu_item;
            ignore_following_csc$next_event := TRUE;
          = csc$page_mouse_event =
            mouse_event := TRUE;
            ignore_following_csc$next_event := TRUE;
          = csc$page_standard_function =
            IF event.page_event.standard_function = csc$next THEN
              next_event := TRUE;
              IF ignore_following_csc$next_event THEN
                ignore_following_csc$next_event := FALSE;
                CYCLE /get_event_loop/;
              IFEND;
              ignore_following_csc$next_event := FALSE;
            ELSE
              ignore_following_csc$next_event := TRUE;
            IFEND;
          ELSE
            ignore_following_csc$next_event := TRUE;
          CASEND;

        = csc$field_event =
          IF event.field_event.event_type <> csc$field_mouse_event THEN
            cursor_field_number := event.field_event_field_number;
            cursor_character_position := event.field_event_character_position;
            cursor_line_number := event.field_event_line_number;
          IFEND;

          CASE event.field_event.event_type OF
          = csc$field_screen =
            screen_event := TRUE;
          = csc$field_menu_event =
            action := event.field_event.menu_item;
            ignore_following_csc$next_event := TRUE;
          = csc$field_mouse_event =
            get_mouse_action;
            mouse_event := TRUE;
            ignore_following_csc$next_event := FALSE;
          = csc$field_standard_function =
            IF event.field_event.standard_function = csc$next THEN
              next_event := TRUE;
              IF ignore_following_csc$next_event THEN
                ignore_following_csc$next_event := FALSE;
                CYCLE /get_event_loop/;
              IFEND;
              ignore_following_csc$next_event := FALSE;
            ELSE
              ignore_following_csc$next_event := TRUE;
            IFEND;
          ELSE
            ignore_following_csc$next_event := TRUE;
          CASEND;

        ELSE
        CASEND;

        got_an_action := TRUE;
        RETURN;

      WHILEND /get_event_loop/;

    PROCEND get_action;
?? TITLE := 'get_cursor_input_field', EJECT ??

    PROCEDURE get_cursor_input_field
      (VAR input_field: boolean;
       VAR command_field: boolean;
       VAR parameter_value: boolean;
       VAR line_number: 0 .. csc$max_line_number);

      input_field := FALSE;
      command_field := FALSE;
      parameter_value := FALSE;
      IF cursor_field_number = display.command_field THEN
        command_field := TRUE;
        input_field := TRUE;
      ELSE
        CASE display.current_window OF
        = clc$zoom_window =
          IF cursor_field_number = zoom_window.text_field THEN
            parameter_value := TRUE;
            line_number := cursor_line_number;
            input_field := zoom_window.changeable;
          IFEND;
        = clc$no_window =
          FOR parameter_line := 1 TO display.parameters_displayed DO
            IF event.field_event_field_number = parameter_display_info^ [parameter_line].
                  value_field_number THEN
              parameter_number := display.top_parameter + parameter_line - 1;
              parameter_value := TRUE;
              input_field := NOT parameter_information^ [parameter_number].too_big_to_edit;
              RETURN;
            IFEND;
          FOREND;
        ELSE
        CASEND;
      IFEND;

    PROCEND get_cursor_input_field;
?? TITLE := 'get_event_parameter', EJECT ??

    PROCEDURE get_event_parameter;


      CASE event.event_type OF
      = csc$page_event =
        parameter_line := event.page_event_y_position - start_of_parameter_lines + 1;
        IF (parameter_line > 0) AND (parameter_line <= display.parameters_displayed) THEN
          parameter_number := display.top_parameter + parameter_line - 1;
          event_on_parameter_line := TRUE;
          parameter_selected := NOT parameter_information^ [parameter_number].advanced_indicator;
          RETURN;
        IFEND;

      = csc$field_event =
        FOR parameter_line := 1 TO display.parameters_displayed DO
          IF (event.field_event_field_number = parameter_display_info^ [parameter_line].
                prompt_field_number) OR (event.field_event_field_number =
                parameter_display_info^ [parameter_line].value_field_number) THEN
            parameter_number := display.top_parameter + parameter_line - 1;
            event_on_parameter_line := TRUE;
            parameter_selected := NOT parameter_information^ [parameter_number].advanced_indicator;
            RETURN;
          IFEND;
        FOREND;

      ELSE
      CASEND;

      event_on_parameter_line := FALSE;
      parameter_selected := FALSE;

    PROCEND get_event_parameter;
?? TITLE := 'get_function_key_message', EJECT ??

    PROCEDURE get_function_key_message
      (    message_name: clt$parameter_name;
           events: ^array [1 .. * ] of carriage_return .. down_event;
       VAR message_text: string ( * <= csc$max_x_position);
       VAR text_length: 0 .. csc$max_x_position);

?? NEWTITLE := 'create_message_parameter', EJECT ??

      PROCEDURE [INLINE] create_message_parameter
        (    event: carriage_return .. down_event);

        VAR
          event_name_identifier: cst$event_name_identifier;

        IF event = carriage_return THEN
          event_name_identifier.event_type := csc$field_event;
          event_name_identifier.field_event.event_type := csc$field_standard_function;
          event_name_identifier.field_event.standard_function := csc$next;
        ELSE
          event_name_identifier.event_type := csc$page_event;
          CASE menu_list_copy^ [event].menu_type OF
          = csc$application_function =
            event_name_identifier.page_event.event_type := csc$page_application_function;
            event_name_identifier.page_event.application_function :=
                  menu_list_copy^ [event].application_function;
          = csc$standard_function =
            event_name_identifier.page_event.event_type := csc$page_standard_function;
            event_name_identifier.page_event.standard_function := menu_list_copy^ [event].standard_function;
          ELSE
          CASEND;
        IFEND;
        csp$get_event_name (event_name_identifier, name, name_length, status);
        IF NOT status.normal THEN
          EXIT clp$scl_parameter_dialog_mgr;
        IFEND;

      PROCEND create_message_parameter;
?? OLDTITLE, EJECT ??

      VAR
        i: integer,
        message: ost$status_message,
        message_area: ^ost$status_message,
        message_line: ^ost$status_message_line,
        message_line_count: ^ost$status_message_line_count,
        message_line_size: ^ost$status_message_line_size,
        message_parameters: ^array [1 .. * ] of ^ost$message_parameter,
        message_template: ^ost$message_template,
        name: ost$name,
        name_length: 0 .. osc$max_name_size;


      find_help_module;
      osp$find_param_assist_prompt (display.help_module, message_name, message_template, status);
      IF NOT status.normal THEN
        EXIT clp$scl_parameter_dialog_mgr;
      IFEND;
      IF events <> NIL THEN
        PUSH message_parameters: [1 .. #SIZE (events^)];
        FOR i := 1 TO #SIZE (events^) DO
          create_message_parameter (events^ [i]);
          PUSH message_parameters^ [i]: [name_length];
          message_parameters^ [i]^ := name (1, name_length);
        FOREND;
      ELSE
        message_parameters := NIL;
      IFEND;

      osp$format_help_message (message_template, message_parameters, message_field_width, message, status);
      IF NOT status.normal THEN
        EXIT clp$scl_parameter_dialog_mgr;
      IFEND;

      message_area := ^message;
      RESET message_area;
      NEXT message_line_count IN message_area;
      IF message_line_count^ = 1 THEN
        NEXT message_line_size IN message_area;
        NEXT message_line: [message_line_size^] IN message_area;
        text_length := message_line_size^;
        message_text := message_line^;
      ELSE
        text_length := 0;
        message_text := '';
      IFEND;

    PROCEND get_function_key_message;
?? TITLE := 'get_function_key_label', EJECT ??

    PROCEDURE [INLINE] get_function_key_label
      (    message_name: clt$parameter_name;
       VAR key_label: string (6));

      VAR
        message_template: ^ost$message_template;

      find_help_module;
      osp$find_param_assist_prompt (display.help_module, message_name, message_template, status);
      IF message_template <> NIL THEN
        key_label := message_template^ (1, clp$trimmed_string_size (message_template^));
      ELSE
        key_label := '';
      IFEND;

    PROCEND get_function_key_label;
?? TITLE := 'get_message', EJECT ??

    PROCEDURE get_message
      (    message_name: clt$parameter_name;
           message_parameters: ^array [1 .. * ] of ^ost$message_parameter;
       VAR message: ost$status_message);

      VAR
        message_template: ^ost$message_template;

      find_help_module;
      osp$find_param_assist_prompt (display.help_module, message_name, message_template, status);
      IF NOT status.normal THEN
        EXIT clp$scl_parameter_dialog_mgr;
      IFEND;
      osp$format_help_message (message_template, message_parameters, message_field_width, message, status);
      IF NOT status.normal THEN
        EXIT clp$scl_parameter_dialog_mgr;
      IFEND;

    PROCEND get_message;
?? TITLE := 'get_message_text', EJECT ??

    PROCEDURE get_message_text
      (    message_name: clt$parameter_name;
           message_parameters: ^array [1 .. * ] of ^ost$message_parameter;
       VAR message_text: string ( * <= csc$max_x_position);
       VAR text_length: 0 .. csc$max_x_position);


      VAR
        max_line: 0 .. csc$max_y_position,
        message: ost$status_message,
        message_area: ^ost$status_message,
        message_line: ^ost$status_message_line,
        message_line_count: ^ost$status_message_line_count,
        message_line_size: ^ost$status_message_line_size,
        message_template: ^ost$message_template;

      find_help_module;
      osp$find_param_assist_prompt (display.help_module, message_name, message_template, status);
      IF NOT status.normal THEN
        EXIT clp$scl_parameter_dialog_mgr;
      IFEND;
      IF message_field_width <> 0 THEN
        max_line := message_field_width;
      ELSE
        max_line := clc$prompt_object_width;
      IFEND;
      osp$format_help_message (message_template, message_parameters, max_line, message, status);
      IF NOT status.normal THEN
        EXIT clp$scl_parameter_dialog_mgr;
      IFEND;

      message_area := ^message;
      RESET message_area;
      NEXT message_line_count IN message_area;
      IF message_line_count^ = 1 THEN
        NEXT message_line_size IN message_area;
        NEXT message_line: [message_line_size^] IN message_area;
        text_length := message_line_size^;
        message_text := message_line^;
      ELSE
        text_length := 0;
        message_text := '';
      IFEND;

    PROCEND get_message_text;
?? TITLE := 'get_screen_parameter_value', EJECT ??

    PROCEDURE get_screen_parameter_value
      (    field_number: cst$field_number);

      VAR
        end_of_line: boolean,
        end_of_text: boolean,
        found: boolean,
        i: clt$parameter_count,
        text: string (csc$max_x_position),
        text_length: cst$data_string_length;


      found := FALSE;

    /get_parameter_number/
      FOR i := 1 TO display.parameters_displayed DO
        IF field_number = parameter_display_info^ [i].value_field_number THEN
          parameter_number := display.top_parameter + i - 1;
          found := TRUE;
          EXIT /get_parameter_number/;
        IFEND;
      FOREND /get_parameter_number/;
      IF found THEN
        IF parameter_information^ [parameter_number].secure THEN
          update_parameters := TRUE;
        IFEND;
        csp$get_text (text, text_length, end_of_line, end_of_text, status);
        IF NOT status.normal THEN
          EXIT clp$scl_parameter_dialog_mgr;
        IFEND;
        IF NOT end_of_text THEN
          IF parameter_information^ [parameter_number].value^ <> text (1, text_length) THEN
            IF text (1, text_length) = '' THEN
              update_parameters := TRUE;
              ignore_cleared_parameter (parameter_information^ [parameter_number].name);
              RETURN;
            ELSE
              parameter_information^ [parameter_number].evaluation_required := TRUE;
            IFEND;
          IFEND;
          IF (NOT parameter_information^ [parameter_number].overflow) OR
                (text_length < parameter_value_field_width) OR (text
                (text_length - 1, STRLENGTH (clc$overflow_indicator)) <> clc$overflow_indicator) THEN
            FREE parameter_information^ [parameter_number].value;
            ALLOCATE parameter_information^ [parameter_number].value: [text_length];
            parameter_information^ [parameter_number].value^ := text (1, text_length);
            parameter_information^ [parameter_number].overflow := FALSE;
          ELSE
            parameter_information^ [parameter_number].value^ (1, text_length -
                  STRLENGTH (clc$overflow_indicator)) := text (1, text_length -
                  STRLENGTH (clc$overflow_indicator));
          IFEND;
        IFEND;
      IFEND;

    PROCEND get_screen_parameter_value;
?? TITLE := 'get_screen_values', EJECT ??

    PROCEDURE get_screen_values
      (    defer_command_line_processing: boolean);

      VAR
        end_of_line: boolean,
        end_of_text: boolean,
        field_number: cst$field_number,
        line_number: cst$line_number,
        text: string (csc$max_x_position),
        text_length: cst$data_string_length;


      end_of_text := FALSE;
      WHILE NOT end_of_text DO
        csp$get_io_position (field_number, line_number, end_of_text, status);
        IF NOT status.normal THEN
          EXIT clp$scl_parameter_dialog_mgr;
        IFEND;
        IF NOT end_of_text THEN
          IF field_number = display.command_field THEN
            process_command_line (defer_command_line_processing);
          ELSEIF display.zoom_window_displayed THEN
            IF field_number = zoom_window.text_field THEN
              process_zoom_input (line_number + zoom_window.top - 1);
            ELSE

{ Ignore text in 'inactive' fields.

              csp$get_text (text, text_length, end_of_line, end_of_text, status);
              IF NOT status.normal THEN
                EXIT clp$scl_parameter_dialog_mgr;
              IFEND;
              update_parameters := TRUE;
            IFEND;
          ELSEIF display.help_window_displayed OR display.message_window_displayed THEN

{ Ignore text in 'inactive' fields.

            csp$get_text (text, text_length, end_of_line, end_of_text, status);
            IF NOT status.normal THEN
              EXIT clp$scl_parameter_dialog_mgr;
            IFEND;
            update_parameters := TRUE;
          ELSE
            get_screen_parameter_value (field_number);
          IFEND;
        IFEND;
      WHILEND;

    PROCEND get_screen_values;
?? TITLE := 'ignore_cleared_parameter', EJECT ??

    PROCEDURE ignore_cleared_parameter
      (    parameter_name: string (clc$prompt_object_width));

      VAR
        hold_parameter_names: ^array [1 .. * ] of ^ost$message_parameter,
        i: clt$parameter_count,
        old_count: clt$parameter_count;


      IF cleared_parameters = NIL THEN
        ALLOCATE cleared_parameters: [1 .. 1];
        ALLOCATE cleared_parameters^ [1]: [clp$trimmed_string_size (parameter_name)];
        cleared_parameters^ [1]^ := parameter_name;
      ELSE
        old_count := UPPERBOUND (cleared_parameters^);
        PUSH hold_parameter_names: [1 .. old_count];
        FOR i := 1 TO old_count DO
          hold_parameter_names^ [i] := cleared_parameters^ [i];
        FOREND;
        FREE cleared_parameters;
        ALLOCATE cleared_parameters: [1 .. old_count + 1];
        FOR i := 1 TO old_count DO
          cleared_parameters^ [i] := hold_parameter_names^ [i];
        FOREND;
        ALLOCATE cleared_parameters^ [old_count + 1]: [clp$trimmed_string_size (parameter_name)];
        cleared_parameters^ [old_count + 1]^ := parameter_name;
      IFEND;

    PROCEND ignore_cleared_parameter;
?? TITLE := 'initialize_buttons', EJECT ??

    PROCEDURE [INLINE] initialize_buttons
      (VAR buttons: clt$dialog_buttons);

      VAR
        event_name_identifier: cst$event_name_identifier;


      buttons.first := ^buttons.page_up_button;
      event_name_identifier.event_type := csc$field_event;
      event_name_identifier.field_event.event_type := csc$field_standard_function;
      event_name_identifier.field_event.standard_function := csc$backward;

      buttons.page_up_button.link := ^buttons.page_down_button;
      csp$get_event_name (event_name_identifier, buttons.page_up_button.name,
            buttons.page_up_button.name_size, status);
      IF NOT status.normal THEN
        EXIT clp$scl_parameter_dialog_mgr;
      IFEND;
      buttons.page_up_button.strong_action := backward_event;
      buttons.page_up_button.weak_action := down_event;
      buttons.page_up_button.active := FALSE;
      buttons.page_up_button.field := 0;

      event_name_identifier.field_event.standard_function := csc$forward;
      buttons.page_down_button.link := NIL;
      csp$get_event_name (event_name_identifier, buttons.page_down_button.name,
            buttons.page_down_button.name_size, status);
      IF NOT status.normal THEN
        EXIT clp$scl_parameter_dialog_mgr;
      IFEND;
      buttons.page_down_button.strong_action := forward_event;
      buttons.page_down_button.weak_action := up_event;
      buttons.page_down_button.active := FALSE;
      buttons.page_down_button.field := 0;

    PROCEND initialize_buttons;
?? TITLE := 'initialize_background_field', EJECT ??

    PROCEDURE initialize_background_field
      (    x_position: 0 .. csc$max_x_position;
           y_position: 0 .. csc$max_line_number;
           width: 0 .. csc$max_x_position;
           height: 0 .. csc$max_line_number;
       VAR field_number: cst$field_number);

      VAR
        background_field: clt$field_attributes;


      background_field := clv$default_field_attributes;
      background_field [x_position_attribute].x_position := x_position;
      background_field [y_position_attribute].y_position := y_position;
      background_field [visible_characters_attribute].visible_characters := width;
      background_field [visible_lines_attribute].visible_lines := height;
      background_field [characters_attribute].characters :=
            background_field [visible_characters_attribute].visible_characters;
      background_field [lines_attribute].lines := background_field [visible_lines_attribute].visible_lines;
      csp$allocate_field (background_field, field_number, status);
      IF NOT status.normal THEN
        EXIT clp$scl_parameter_dialog_mgr;
      IFEND;

    PROCEND initialize_background_field;
?? TITLE := 'initialize_command_field', EJECT ??

    PROCEDURE initialize_command_field;

      VAR
        background_field_number: cst$field_number,
        command_field: clt$field_attributes,
        command_field_background: clt$field_attributes;


      command_field := clv$default_field_attributes;
      command_field [x_position_attribute].x_position := 1;
      command_field [y_position_attribute].y_position := command_line_number;
      command_field [visible_characters_attribute].visible_characters := display.screen_width - 1;
      command_field [characters_attribute].characters := command_field [visible_characters_attribute].
            visible_characters;
      command_field [input_attribute].input := TRUE;
      command_field [logical_highlighting_attribute].logical_highlighting := csc$logical_normal;
      csp$allocate_field (command_field, display.command_field, status);
      IF NOT status.normal THEN
        EXIT clp$scl_parameter_dialog_mgr;
      IFEND;

      command_field_background := clv$default_field_attributes;
      command_field_background [x_position_attribute].x_position := display.screen_width;
      command_field_background [y_position_attribute].y_position := command_line_number;
      command_field_background [visible_characters_attribute].visible_characters := 1;
      command_field_background [characters_attribute].characters :=
            command_field_background [visible_characters_attribute].visible_characters;
      command_field_background [input_attribute].input := FALSE;
      command_field_background [logical_highlighting_attribute].logical_highlighting := csc$logical_normal;
      csp$allocate_field (command_field_background, background_field_number, status);
      IF NOT status.normal THEN
        EXIT clp$scl_parameter_dialog_mgr;
      IFEND;

    PROCEND initialize_command_field;
?? TITLE := 'initialize_function_key_menu', EJECT ??

    PROCEDURE initialize_function_key_menu
      (    rows_for_menu: cst$number_of_menu_rows);

      VAR
        i: integer;


      find_help_module;
      osp$find_application_menu (display.help_module, clc$spdm_main_menu, menu_classes, menu_list, status);
      IF NOT status.normal THEN
        EXIT clp$scl_parameter_dialog_mgr;
      IFEND;
      IF (menu_classes = NIL) OR (menu_list = NIL) THEN

{ This should only happen if the help module CLM$SPDM_MESSAGES$US_ENGLISH was not installed.

        cancel := TRUE;
        EXIT clp$scl_parameter_dialog_mgr;
      IFEND;

      ALLOCATE menu_classes_copy: [1 .. UPPERBOUND (menu_classes^)];
      FOR i := 1 TO UPPERBOUND (menu_classes^) DO
        menu_classes_copy^ [i] := menu_classes^ [i];
      FOREND;
      ALLOCATE menu_list_copy: [1 .. UPPERBOUND (menu_list^)];
      FOR i := 1 TO UPPERBOUND (menu_list^) DO
        menu_list_copy^ [i] := menu_list^ [i];
        CASE i OF
        = reset_event, zoom_event, edit_zoom_event =
          menu_list_copy^ [i].item_assigned := TRUE;
        ELSE
          menu_list_copy^ [i].item_assigned := FALSE;
        CASEND;
      FOREND;
      csp$set_standard_menu (menu_classes_copy, menu_list_copy, status);
      IF NOT status.normal THEN
        EXIT clp$scl_parameter_dialog_mgr;
      IFEND;

      IF support.nested_dialog_title <> NIL THEN
        csp$disable_menu_item (info_event, status);
        IF NOT status.normal THEN
          EXIT clp$scl_parameter_dialog_mgr;
        IFEND;
      IFEND;

      csp$display_menu (rows_for_menu, 0, display.reserved_rows, status);
      IF NOT status.normal THEN
        EXIT clp$scl_parameter_dialog_mgr;
      IFEND;

    PROCEND initialize_function_key_menu;
?? TITLE := 'initialize_message_field', EJECT ??

    PROCEDURE initialize_message_field;

      VAR
        background_field_number: cst$field_number,
        message_field: clt$field_attributes,
        message_field_background: clt$field_attributes;


      message_field_background := clv$default_field_attributes;
      message_field_background [x_position_attribute].x_position := 1;
      message_field_background [y_position_attribute].y_position := message_line_number;
      message_field_background [visible_characters_attribute].visible_characters := display.screen_width;
      message_field_background [characters_attribute].characters :=
            message_field_background [visible_characters_attribute].visible_characters;
      message_field_background [logical_highlighting_attribute].logical_highlighting := csc$message;
      csp$allocate_field (message_field_background, background_field_number, status);
      IF NOT status.normal THEN
        EXIT clp$scl_parameter_dialog_mgr;
      IFEND;

      message_field := clv$default_field_attributes;
      message_field [x_position_attribute].x_position := 2;
      message_field [y_position_attribute].y_position := message_line_number;
      message_field [visible_characters_attribute].visible_characters := message_field_width;
      message_field [characters_attribute].characters := message_field [visible_characters_attribute].
            visible_characters;
      message_field [logical_highlighting_attribute].logical_highlighting := csc$message;
      csp$allocate_field (message_field, display.message_field, status);
      IF NOT status.normal THEN
        EXIT clp$scl_parameter_dialog_mgr;
      IFEND;

    PROCEND initialize_message_field;
?? TITLE := 'initialize_prompt_and_value', EJECT ??

    PROCEDURE initialize_prompt_and_value
      (    pdt_number: clt$parameter_count);

      VAR
        message: ^ost$status_message,
        parameter_value: clt$parameter_value,
        representation: ^clt$data_representation,
        representation_count: ^clt$data_representation_count,
        text: ^string ( * ),
        text_length: cst$data_string_length;


      support.get_parameter_prompt^ (pdt_number, osc$max_status_message_line, message, status);
      IF NOT status.normal THEN
        EXIT clp$scl_parameter_dialog_mgr;
      IFEND;
      text := osp$status_message_text (message);
      parameter_information^ [parameter_number].name := text^;
      IF STRLENGTH (text^) > clc$prompt_object_width THEN
        parameter_information^ [parameter_number].prompt := parameter_information^ [parameter_number].
              name (1, clc$prompt_object_width);
      ELSE
        parameter_information^ [parameter_number].prompt := parameter_information^ [parameter_number].name;
        clp$right_justify_string (parameter_information^ [parameter_number].prompt);
      IFEND;

      support.get_parameter_value^ (pdt_number, parameter_value, status);
      IF NOT status.normal THEN
        EXIT clp$scl_parameter_dialog_mgr;
      IFEND;
      IF parameter_value.specified THEN
        support.get_parameter_value_source^ (pdt_number, clc$max_string_size, representation, status);
        IF NOT status.normal THEN
          EXIT clp$scl_parameter_dialog_mgr;
        IFEND;
        parameter_information^ [parameter_number].initialized := TRUE;
        parameter_information^ [parameter_number].evaluation_required := FALSE;
        RESET representation;
        NEXT representation_count IN representation;
        text := clp$data_representation_text (representation);
        text_length := clp$trimmed_string_size (text^);
        ALLOCATE parameter_information^ [parameter_number].value: [text_length];
        parameter_information^ [parameter_number].value^ := text^ (1, text_length);
        parameter_information^ [parameter_number].too_big_to_edit := (representation_count^ > 1);
      ELSE
        CASE pdt.parameters^ [pdt_number].requirement OF
        = clc$optional_default_parameter, clc$confirm_default_parameter =
          support.get_parameter_default^ (pdt_number, text, status);
          IF NOT status.normal THEN
            EXIT clp$scl_parameter_dialog_mgr;
          IFEND;
        ELSE {clc$required_parameter, clc$optional_parameter}
          PUSH text: [0];
        CASEND;
        parameter_information^ [parameter_number].initialized := TRUE;
        parameter_information^ [parameter_number].evaluation_required := FALSE;
        parameter_information^ [parameter_number].too_big_to_edit := FALSE;
        text_length := clp$trimmed_string_size (text^);
        ALLOCATE parameter_information^ [parameter_number].value: [text_length];
        parameter_information^ [parameter_number].value^ := text^ (1, text_length);
      IFEND;
      parameter_information^ [parameter_number].overflow := FALSE;

    PROCEND initialize_prompt_and_value;
?? TITLE := 'initialize_title_box', EJECT ??

    PROCEDURE initialize_title_box;

      VAR
        box_coordinates: array [1 .. 5] of cst$xy_coordinate,
        box_graphic_id: cst$graphic_identifier,
        box_prompt_field: clt$field_attributes,
        box_prompt_field_number: cst$field_number,
        corner_coordinates: array [1 .. 4] of cst$xy_coordinate,
        end_of_text: boolean,
        graphic_identifier: cst$graphic_identifier,
        intersection_types: array [1 .. 4] of cst$intersection_type,
        line_coordinates: array [1 .. 2] of cst$xy_coordinate,
        line_number_field: clt$field_attributes,
        message_parameters: array [1 .. 1] of ^ost$message_parameter,
        message_text: string (csc$max_x_position),
        name: clt$command_name,
        names: ^array [1 .. * ] of clt$command_name,
        text_length: 0 .. csc$max_x_position,
        title_field: clt$field_attributes,
        title_field_number: cst$field_number;


      csp$change_line_width (csc$fine, status);
      IF NOT status.normal THEN
        EXIT clp$scl_parameter_dialog_mgr;
      IFEND;
      IF NOT called_from_screen_mode THEN
        { Draw line at top of display.
        line_coordinates [1].x := 1;
        line_coordinates [1].y := title_box_top;
        line_coordinates [2].x := display.screen_width;
        line_coordinates [2].y := title_box_top;
        csp$poly_hv_line (line_coordinates, graphic_identifier, status);
        IF NOT status.normal THEN
          EXIT clp$scl_parameter_dialog_mgr;
        IFEND;
      ELSE
        IF display.parameter_count > 0 THEN
          get_function_key_message (clc$enter_values, NIL, message_text, text_length);
        ELSE
          get_function_key_message (clc$press_ok, NIL, message_text, text_length);
        IFEND;
        box_coordinates [1].x := 1;
        box_coordinates [1].y := title_box_top;
        box_coordinates [2].x := display.screen_width;
        box_coordinates [2].y := box_coordinates [1].y;
        box_coordinates [3].x := box_coordinates [2].x;
        box_coordinates [3].y := box_coordinates [1].y + display.screen_height - title_box_top + 1;
        box_coordinates [4].x := box_coordinates [1].x;
        box_coordinates [4].y := box_coordinates [3].y;
        box_coordinates [5] := box_coordinates [1];
        csp$poly_hv_line (box_coordinates, box_graphic_id, status);
        IF NOT status.normal THEN
          EXIT clp$scl_parameter_dialog_mgr;
        IFEND;

        intersection_types [1] := csc$upper_left;
        intersection_types [2] := csc$upper_right;
        intersection_types [3] := csc$lower_right;
        intersection_types [4] := csc$lower_left;
        corner_coordinates [1].x := box_coordinates [1].x;
        corner_coordinates [1].y := box_coordinates [1].y;
        corner_coordinates [2].x := box_coordinates [2].x;
        corner_coordinates [2].y := box_coordinates [2].y;
        corner_coordinates [3].x := box_coordinates [3].x;
        corner_coordinates [3].y := box_coordinates [3].y;
        corner_coordinates [4].x := box_coordinates [4].x;
        corner_coordinates [4].y := box_coordinates [4].y;
        csp$poly_intersect (box_graphic_id, corner_coordinates, intersection_types, status);
        IF NOT status.normal THEN
          EXIT clp$scl_parameter_dialog_mgr;
        IFEND;
        box_prompt_field := clv$default_field_attributes;
        box_prompt_field [x_position_attribute].x_position :=
              ((display.screen_width - text_length) DIV 2) + 1;
        box_prompt_field [y_position_attribute].y_position := box_coordinates [3].y;
        box_prompt_field [visible_characters_attribute].visible_characters := text_length;
        box_prompt_field [characters_attribute].characters := box_prompt_field [3].visible_characters;
        box_prompt_field [logical_highlighting_attribute].logical_highlighting := csc$italic;
        csp$allocate_field (box_prompt_field, box_prompt_field_number, status);
        IF NOT status.normal THEN
          EXIT clp$scl_parameter_dialog_mgr;
        IFEND;
        csp$change_io_position (box_prompt_field_number, 1, status);
        IF NOT status.normal THEN
          EXIT clp$scl_parameter_dialog_mgr;
        IFEND;
        end_of_text := FALSE;
        csp$put_text (^message_text (1, text_length), TRUE, end_of_text, status);
        IF NOT status.normal THEN
          EXIT clp$scl_parameter_dialog_mgr;
        IFEND;
      IFEND;

      IF support.nested_dialog_title <> NIL THEN
        message_text (1) := ' ';
        message_text (2, * ) := support.nested_dialog_title^;
        text_length := clp$trimmed_string_size (support.nested_dialog_title^) + 2;
        IF text_length > STRLENGTH (message_text) THEN
          text_length := STRLENGTH (message_text);
        IFEND;
      ELSE
        support.get_all_names^ (names, status);
        IF NOT status.normal THEN
          EXIT clp$scl_parameter_dialog_mgr;
        IFEND;
        name := names^ [1];
        convert_name_to_message_param (name);
        message_parameters [1] := ^name;
        IF pdt.header^.command_or_function = clc$function THEN
          get_message_text (clc$function_label, ^message_parameters, message_text, text_length);
        ELSE
          get_message_text (clc$command_label, ^message_parameters, message_text, text_length);
        IFEND;
      IFEND;

      title_field := clv$default_field_attributes;
      title_field [x_position_attribute].x_position := clc$title_line_number_inset + 1;
      title_field [y_position_attribute].y_position := title_box_top;
      title_field [visible_characters_attribute].visible_characters := text_length;
      title_field [characters_attribute].characters := title_field [visible_characters_attribute].
            visible_characters;
      csp$allocate_field (title_field, title_field_number, status);
      IF NOT status.normal THEN
        EXIT clp$scl_parameter_dialog_mgr;
      IFEND;

      csp$change_io_position (title_field_number, 1, status);
      IF NOT status.normal THEN
        EXIT clp$scl_parameter_dialog_mgr;
      IFEND;
      end_of_text := FALSE;
      csp$put_text (^message_text (1, text_length), TRUE, end_of_text, status);
      IF NOT status.normal THEN
        EXIT clp$scl_parameter_dialog_mgr;
      IFEND;

      line_number_field := clv$default_field_attributes;
      line_number_field [x_position_attribute].x_position :=
            display.screen_width - clc$title_line_number_inset;
      line_number_field [y_position_attribute].y_position := title_box_top;
      line_number_field [visible_characters_attribute].visible_characters := 1;
      line_number_field [characters_attribute].characters := display.screen_width;
      csp$allocate_field (line_number_field, display.line_number_field, status);
      IF NOT status.normal THEN
        EXIT clp$scl_parameter_dialog_mgr;
      IFEND;

      initialize_buttons (display.buttons);

    PROCEND initialize_title_box;
?? TITLE := 'process_backward_event', EJECT ??

    PROCEDURE process_backward_event;

      VAR
        new_top: clt$parameter_count;


      CASE display.current_window OF
      = clc$help_window =
        IF help_window.lines_displayed <> 0 THEN
          IF help_window.top - help_window.lines_displayed < 1 THEN
            new_top := 1;
          ELSE
            new_top := help_window.top - help_window.lines_displayed + 1;
          IFEND;
          cursor_field_number := help_window.text_field;
          cursor_line_number := (help_window.lines_displayed + 1) DIV 2;
          IF new_top <> help_window.top THEN
            help_window.top := new_top;
            update_window_display (clc$help_window);
          IFEND;
        IFEND;
      = clc$message_window =
        IF message_window.lines_displayed <> 0 THEN
          IF message_window.top - message_window.lines_displayed < 1 THEN
            new_top := 1;
          ELSE
            new_top := message_window.top - message_window.lines_displayed + 1;
          IFEND;
          cursor_field_number := message_window.text_field;
          cursor_line_number := (message_window.lines_displayed + 1) DIV 2;
          IF new_top <> message_window.top THEN
            message_window.top := new_top;
            update_window_display (clc$message_window);
          IFEND;
        IFEND;
      = clc$zoom_window =
        IF zoom_window.lines_displayed <> 0 THEN
          IF zoom_window.top <= zoom_window.lines_displayed THEN
            new_top := 1;
          ELSE
            new_top := zoom_window.top - zoom_window.lines_displayed + 1;
          IFEND;
          cursor_field_number := zoom_window.text_field;
          cursor_line_number := (zoom_window.lines_displayed + 1) DIV 2;
          zoom_window.top := new_top;
          update_window_display (clc$zoom_window);
        IFEND;
      ELSE {clc$no_window
        IF display.parameters_displayed <> 0 THEN
          IF display.top_parameter <= display.parameters_displayed THEN
            new_top := 1;
          ELSE
            new_top := display.top_parameter - display.parameters_displayed + 1;
          IFEND;
          cursor_field_number := parameter_display_info^ [(display.parameters_displayed + 1) DIV
                2].value_field_number;
          cursor_line_number := 1;
          IF new_top <> display.top_parameter THEN
            display.top_parameter := new_top;
            update_parameters := TRUE;
          IFEND;
        IFEND;
      CASEND;

    PROCEND process_backward_event;
?? TITLE := 'process_cancel_event', EJECT ??

    PROCEDURE process_cancel_event;

      CASE display.current_window OF
      = clc$help_window, clc$message_window =
        { The CANCEL event is undefined for help and message windows.
      = clc$zoom_window =
        change_menu_items (clc$zoom_window, zoom_window.parent_window);
        close_window (clc$zoom_window);
      ELSE {clc$no_window
        processing_complete := TRUE;
        cancel := TRUE;
      CASEND;

    PROCEND process_cancel_event;
?? TITLE := 'process_clear_eol_event', EJECT ??

    PROCEDURE process_clear_eol_event;

      VAR
        command_field: boolean,
        ignore_parameter_value: boolean,
        input_field: boolean,
        line_number: 0 .. csc$max_line_number;

?? NEWTITLE := 'clear_eol', EJECT ??

      PROCEDURE clear_eol
        (VAR field_text: ^string ( * ));

        VAR
          text: ^string ( * ),
          text_length: 0 .. csc$max_character_position;


        text_length := clp$trimmed_string_size (field_text^);
        IF display.current_window = clc$zoom_window THEN
          parameter_number := zoom_window.parameter_number;
        IFEND;
        IF (text_length > 0) AND (cursor_character_position <= text_length) THEN
          text_length := cursor_character_position - 1;
          PUSH text: [text_length];
          IF cursor_character_position > 1 THEN
            text^ := field_text^ (1, text_length);
          IFEND;
          IF text^ <> '' THEN
            FREE field_text;
            ALLOCATE field_text: [text_length];
            field_text^ := text^;
            parameter_information^ [parameter_number].evaluation_required := TRUE;
            update_parameters := TRUE;
          ELSE
            update_parameters := TRUE;
            ignore_cleared_parameter (parameter_information^ [parameter_number].name);
          IFEND;
        IFEND;

      PROCEND clear_eol;
?? OLDTITLE, EJECT ??

      get_cursor_input_field (input_field, command_field, ignore_parameter_value, line_number);
      IF input_field THEN
        IF command_field THEN
          IF display.command_text <> NIL THEN
            clear_eol (display.command_text);
          IFEND;
        ELSE
          CASE display.current_window OF
          = clc$zoom_window =
            IF zoom_window.contents^ [line_number + zoom_window.top - 1] <> NIL THEN
              clear_eol (zoom_window.contents^ [line_number + zoom_window.top - 1]);
              update_window_display (clc$zoom_window);
            IFEND;
          = clc$no_window =
            IF (parameter_information^ [parameter_number].value <> NIL) AND
                  (NOT (parameter_information^ [parameter_number].
                  too_big_to_edit OR parameter_information^ [parameter_number].overflow)) THEN
              clear_eol (parameter_information^ [parameter_number].value);
            IFEND;
          ELSE
          CASEND;
        IFEND;
      IFEND;

    PROCEND process_clear_eol_event;
?? TITLE := 'process_clear_event', EJECT ??

    PROCEDURE process_clear_event;


      csp$clear_screen (status);
      IF NOT status.normal THEN
        EXIT clp$scl_parameter_dialog_mgr;
      IFEND;

    PROCEND process_clear_event;
?? TITLE := 'process_command', EJECT ??

    PROCEDURE process_command
      (    command_text: string ( * ));

      VAR
        include_status: ost$status;


      IF #RING (^include_status) < avp$ring_min () THEN
        osp$set_status_condition (cle$param_dialog_not_privileged, include_status);
        display_status (include_status);
        RETURN;
      IFEND;

      clp$push_interactive_input (status);
      IF NOT status.normal THEN
        EXIT clp$scl_parameter_dialog_mgr;
      IFEND;
      IF called_from_screen_mode THEN
        csp$disable_page (status);
        IF NOT status.normal THEN
          EXIT clp$scl_parameter_dialog_mgr;
        IFEND;
      IFEND;

      clp$include_command (command_text, {enable_echoing=} TRUE, include_status);
      IF called_from_screen_mode THEN
        csp$enable_page (status);
        IF NOT status.normal THEN
          EXIT clp$scl_parameter_dialog_mgr;
        IFEND;
      IFEND;

      clp$pop_interactive_input (status);
      IF NOT status.normal THEN
        EXIT clp$scl_parameter_dialog_mgr;
      IFEND;
      ignore_tab_caused_by_next := TRUE;
      IF NOT include_status.normal THEN
        display_status (include_status);
      ELSE
        clear_command_field;
      IFEND;

    PROCEND process_command;
?? TITLE := 'process_command_line', EJECT ??

    PROCEDURE process_command_line
      (    defer_command_line_processing: boolean);

      VAR
        command_text: string (csc$max_x_position),
        command_text_length: cst$data_string_length,
        end_of_text: boolean;


      need_to_clear_command_field := FALSE;
      csp$get_text (command_text, command_text_length, end_of_line, end_of_text, status);
      IF NOT status.normal THEN
        EXIT clp$scl_parameter_dialog_mgr;
      IFEND;

      IF (command_text_length > 0) AND (command_text (1, command_text_length) <> ' ') THEN
        IF display.command_text <> NIL THEN
          FREE display.command_text;
        IFEND;
        ALLOCATE display.command_text: [command_text_length];
        display.command_text^ := command_text;
        IF NOT defer_command_line_processing THEN
          IF (command_text_length >= 2) AND (command_text (command_text_length - 1,
                STRLENGTH (clc$overflow_indicator)) = clc$overflow_indicator) THEN
            zoom_command_line;
            display_text_in_window (clc$zoom_window, ^command_text (1, command_text_length));
            RETURN;
          IFEND;
          process_command (command_text (1, command_text_length));
        IFEND;
      IFEND;

    PROCEND process_command_line;
?? TITLE := 'process_delete_char_event', EJECT ??

    PROCEDURE process_delete_char_event;

      VAR
        command_field: boolean,
        ignore_parameter_value: boolean,
        input_field: boolean,
        line_number: 0 .. csc$max_line_number;

?? NEWTITLE := 'delete_char', EJECT ??

      PROCEDURE delete_char
        (VAR field_text: ^string ( * ));

        VAR
          text: ^string ( * ),
          text_length: 0 .. csc$max_character_position;


        text_length := clp$trimmed_string_size (field_text^);
        IF (text_length > 0) AND (cursor_character_position <= text_length) THEN
          text_length := text_length - 1;
          PUSH text: [text_length];
          IF text_length > 0 THEN
            text^ := field_text^ (1, cursor_character_position - 1);
            IF text_length >= cursor_character_position THEN
              text^ (cursor_character_position, text_length - cursor_character_position + 1) :=
                    field_text^ (cursor_character_position + 1, text_length - cursor_character_position + 1);
            IFEND;
          IFEND;
          IF text^ <> '' THEN
            FREE field_text;
            ALLOCATE field_text: [text_length];
            field_text^ := text^;
            parameter_information^ [parameter_number].evaluation_required := TRUE;
          ELSE
            ignore_cleared_parameter (parameter_information^ [parameter_number].name);
          IFEND;
          update_parameters := TRUE;
        IFEND;

      PROCEND delete_char;
?? OLDTITLE, EJECT ??

      get_cursor_input_field (input_field, command_field, ignore_parameter_value, line_number);
      IF input_field THEN
        IF command_field THEN
          IF display.command_text <> NIL THEN
            delete_char (display.command_text);
          IFEND;
        ELSE
          CASE display.current_window OF
          = clc$zoom_window =
            IF zoom_window.contents^ [line_number + zoom_window.top - 1] <> NIL THEN
              delete_char (zoom_window.contents^ [line_number + zoom_window.top - 1]);
              update_window_display (clc$zoom_window);
            IFEND;
          = clc$no_window =
            IF (parameter_information^ [parameter_number].value <> NIL) AND
                  (NOT (parameter_information^ [parameter_number].
                  too_big_to_edit OR parameter_information^ [parameter_number].overflow)) THEN
              delete_char (parameter_information^ [parameter_number].value);
            IFEND;
          ELSE
          CASEND;
        IFEND;
      IFEND;

    PROCEND process_delete_char_event;
?? TITLE := 'process_down_event', EJECT ??

    PROCEDURE process_down_event;

      VAR
        message_text: string (csc$max_x_position),
        new_top_parameter: clt$parameter_count,
        text_length: 0 .. csc$max_x_position;


      get_event_parameter;
      IF NOT event_on_parameter_line THEN
        get_message_text (clc$press_down, NIL, message_text, text_length);
        display_message (message_text (1, text_length));
        RETURN;
      IFEND;

      IF parameter_number < display.parameters_displayed THEN
        new_top_parameter := 1;
      ELSE
        new_top_parameter := parameter_number - display.parameters_displayed + 1;
      IFEND;

      cursor_field_number := parameter_display_info^ [(display.parameters_displayed + 1) DIV
            2].value_field_number;
      cursor_line_number := 1;
      cursor_character_position := 1;
      IF new_top_parameter <> display.top_parameter THEN
        display.top_parameter := new_top_parameter;
        update_parameters := TRUE;
      IFEND;

    PROCEND process_down_event;
?? TITLE := 'process_evaluate_event', EJECT ??

    PROCEDURE process_evaluate_event;

      VAR
        evaluate_status: ost$status;

?? NEWTITLE := 'evaluate_parameter', EJECT ??

      PROCEDURE evaluate_parameter;

        VAR
          parameter_value: clt$parameter_value,
          pdt_number: clt$parameter_count,
          representation: ^clt$data_representation,
          representation_count: ^clt$data_representation_count,
          text: ^string ( * ),
          text_length: clt$string_size;


        IF NOT parameter_information^ [parameter_number].initialized THEN
          initialize_prompt_and_value (parameter_information^ [parameter_number].pdt_number);
        IFEND;
        pdt_number := parameter_information^ [parameter_number].pdt_number;
        IF (parameter_information^ [parameter_number].value = NIL) OR
              (parameter_information^ [parameter_number].value^ = '') THEN
          evaluate_status.normal := TRUE;
          RETURN;
        IFEND;
        support.get_parameter_value^ (pdt_number, parameter_value, status);
        IF NOT status.normal THEN
          EXIT clp$scl_parameter_dialog_mgr;
        IFEND;
        IF parameter_value.specified AND (NOT (parameter_information^ [parameter_number].
              evaluation_required OR editing_parameter_list)) THEN
          evaluate_status.normal := TRUE;
          RETURN;
        IFEND;
        support.evaluate_parameter^ (pdt_number, parameter_information^ [parameter_number].value^,
              evaluate_status);
        IF NOT evaluate_status.normal THEN
          center_parameter_on_screen;
          IF NOT editing_parameter_list THEN
            display_status (evaluate_status);
            RETURN;
          ELSE
            display_message_and_status (evaluate_status);
          IFEND;
        IFEND;
        support.get_parameter_value_source^ (pdt_number, clc$max_string_size, representation, status);
        IF NOT status.normal THEN
          EXIT clp$scl_parameter_dialog_mgr;
        IFEND;
        RESET representation;
        NEXT representation_count IN representation;
        text := clp$data_representation_text (representation);
        text_length := clp$trimmed_string_size (text^);
        ALLOCATE parameter_information^ [parameter_number].value: [text_length];
        parameter_information^ [parameter_number].value^ := text^ (1, text_length);
        parameter_information^ [parameter_number].too_big_to_edit := (representation_count^ > 1);
        parameter_information^ [parameter_number].evaluation_required := FALSE;

      PROCEND evaluate_parameter;
?? OLDTITLE, EJECT ??

      get_event_parameter;
      update_parameters := TRUE;
      IF parameter_selected AND NOT parameter_information^ [parameter_number].advanced_indicator THEN
        IF NOT parameter_information^ [parameter_number].too_big_to_edit THEN
          evaluate_parameter;
        IFEND;
      ELSEIF display.parameter_count > 0 THEN
        FOR parameter_number := 1 TO display.parameter_count DO
          IF NOT parameter_information^ [parameter_number].advanced_indicator AND
                (NOT parameter_information^ [parameter_number].too_big_to_edit) THEN
            evaluate_parameter;
            IF NOT evaluate_status.normal THEN
              RETURN;
            IFEND;
          IFEND;
        FOREND;
      IFEND;

    PROCEND process_evaluate_event;
?? TITLE := 'process_first_event', EJECT ??

    PROCEDURE process_first_event;


      CASE display.current_window OF
      = clc$help_window =
        IF help_window.lines_displayed <> 0 THEN
          cursor_field_number := help_window.text_field;
          cursor_line_number := 1;
          IF help_window.top <> 1 THEN
            help_window.top := 1;
            update_window_display (clc$help_window);
          IFEND;
        IFEND;
      = clc$message_window =
        IF message_window.lines_displayed <> 0 THEN
          cursor_field_number := message_window.text_field;
          cursor_line_number := 1;
          IF message_window.top <> 1 THEN
            message_window.top := 1;
            update_window_display (clc$message_window);
          IFEND;
        IFEND;
      = clc$zoom_window =
        IF zoom_window.lines_displayed <> 0 THEN
          cursor_field_number := zoom_window.text_field;
          cursor_line_number := 1;
          IF zoom_window.top <> 1 THEN
            zoom_window.top := 1;
            update_window_display (clc$zoom_window);
          IFEND;
        IFEND;
      ELSE {clc$no_window
        IF display.parameter_count <> 0 THEN
          cursor_field_number := parameter_display_info^ [1].value_field_number;
          cursor_line_number := 1;
          cursor_character_position := 1;
          IF display.top_parameter <> 1 THEN
            display.top_parameter := 1;
            update_parameters := TRUE;
          IFEND;
        IFEND;
      CASEND;

    PROCEND process_first_event;
?? TITLE := 'process_forward_event', EJECT ??

    PROCEDURE process_forward_event;

      VAR
        hold_contents: ^array [1 .. * ] of ^string ( * ),
        i: 0 .. csc$max_line_number,
        message_text: string (csc$max_x_position),
        new_top: 0 .. csc$max_line_number,
        text_length: 0 .. csc$max_x_position;


      CASE display.current_window OF
      = clc$help_window =
        IF help_window.lines_displayed <> 0 THEN
          IF help_window.top + (2 * help_window.lines_displayed) > help_window.line_count THEN
            new_top := help_window.line_count - help_window.lines_displayed + 1;
          ELSE
            new_top := help_window.top + help_window.lines_displayed - 1;
          IFEND;
          cursor_field_number := help_window.text_field;
          cursor_line_number := (help_window.lines_displayed + 1) DIV 2;
          IF new_top <> help_window.top THEN
            help_window.top := new_top;
            update_window_display (clc$help_window);
          IFEND;
        IFEND;
      = clc$message_window =
        IF message_window.lines_displayed <> 0 THEN
          IF message_window.top + (2 * message_window.lines_displayed) > message_window.line_count THEN
            new_top := message_window.line_count - message_window.lines_displayed + 1;
          ELSE
            new_top := message_window.top + message_window.lines_displayed - 1;
          IFEND;
          cursor_field_number := message_window.text_field;
          cursor_line_number := (message_window.lines_displayed + 1) DIV 2;
          IF new_top <> message_window.top THEN
            message_window.top := new_top;
            update_window_display (clc$message_window);
          IFEND;
        IFEND;
      = clc$zoom_window =
        IF zoom_window.lines_displayed <> 0 THEN
          IF zoom_window.top + zoom_window.lines_displayed - 1 + zoom_window.lines_displayed - 1 >
                zoom_window.line_count THEN
            IF zoom_window.top + zoom_window.lines_displayed - 1 + zoom_window.lines_displayed - 1 <=
                  csc$max_line_number THEN
              new_top := zoom_window.top + zoom_window.lines_displayed - 1;
              PUSH hold_contents: [1 .. zoom_window.line_count];
              hold_contents^ := zoom_window.contents^;
              FREE zoom_window.contents;
              ALLOCATE zoom_window.contents: [1 .. new_top + zoom_window.lines_displayed - 1];
              FOR i := 1 TO zoom_window.line_count DO
                zoom_window.contents^ [i] := hold_contents^ [i];
              FOREND;
              FOR i := zoom_window.line_count + 1 TO new_top + zoom_window.lines_displayed - 1 DO
                zoom_window.contents^ [i] := NIL;
              FOREND;
              zoom_window.line_count := new_top + zoom_window.lines_displayed - 1;
            ELSE
              get_message_text (clc$no_more_input_space, NIL, message_text, text_length);
              display_message (message_text (1, text_length));
              RETURN;
            IFEND;
          ELSE
            new_top := zoom_window.top + zoom_window.lines_displayed - 1;
          IFEND;
          cursor_field_number := zoom_window.text_field;
          cursor_line_number := (zoom_window.lines_displayed + 1) DIV 2;
          zoom_window.top := new_top;
          update_window_display (clc$zoom_window);
        IFEND;
      ELSE {clc$no_window
        IF display.parameters_displayed <> 0 THEN
          IF display.top_parameter + (2 * display.parameters_displayed) > display.parameter_count THEN
            new_top := display.parameter_count - display.parameters_displayed + 1;
          ELSE
            new_top := display.top_parameter + display.parameters_displayed - 1;
          IFEND;

          cursor_field_number := parameter_display_info^ [(display.parameters_displayed + 1) DIV
                2].value_field_number;
          cursor_line_number := 1;
          IF new_top <> display.top_parameter THEN
            display.top_parameter := new_top;
            update_parameters := TRUE;
          IFEND;
        IFEND;
      CASEND;

    PROCEND process_forward_event;
?? TITLE := 'process_help_event', EJECT ??

    PROCEDURE process_help_event;

      VAR
        explain_command: string (csc$max_x_position),
        explain_command_size: integer,
        explanation_available: boolean,
        include_status: ost$status,
        message: ^ost$status_message,
        message_area: ^ost$status_message,
        message_text: string (csc$max_x_position),
        representation: ^clt$data_representation,
        text_length: 0 .. csc$max_x_position;


      IF display.current_window = clc$help_window THEN
        support.explain^ (explanation_available, status);
        IF NOT status.normal THEN
          EXIT clp$scl_parameter_dialog_mgr;
        IFEND;
        IF NOT explanation_available THEN
          get_message_text (clc$no_more_help_available, NIL, message_text, text_length);
          display_message (message_text (1, text_length));
        ELSE
          change_menu_items (clc$help_window, help_window.parent_window);
          close_window (clc$help_window);
        IFEND;
      ELSEIF status_condition_name <> '' THEN
        STRINGREP (explain_command, explain_command_size, 'EXPLAIN SUBJECT=''', status_condition_name,
              ''' MANUAL=MESSAGES');
        clp$include_line (explain_command (1, explain_command_size), FALSE, osc$null_name, include_status);
        IF NOT include_status.normal THEN
          display_status (include_status);
        IFEND;
      ELSE
        IF display.current_window = clc$zoom_window THEN
          parameter_selected := zoom_window.parameter_value;
          parameter_number := zoom_window.parameter_number;
        ELSE
          get_event_parameter;
        IFEND;
        IF parameter_selected THEN
          support.get_parameter_help^ (parameter_information^ [parameter_number].pdt_number,
                message_field_width + 1, message, status);
          IF NOT status.normal THEN
            EXIT clp$scl_parameter_dialog_mgr;
          IFEND;
          IF message <> NIL THEN
            PUSH message_area;
            message_area^ := message^;
          ELSE
            message_area := NIL;
          IFEND;
          support.get_parameter_spec^ (parameter_information^ [parameter_number].pdt_number, TRUE,
                message_field_width, representation, status);
          IF NOT status.normal THEN
            EXIT clp$scl_parameter_dialog_mgr;
          IFEND;
          display_help_window (representation, message_area);
          help_window.cursor_field_number := parameter_display_info^
                [parameter_number - display.top_parameter + 1].value_field_number;
        ELSE
          support.get_full_help^ (message_field_width + 1, message, status);
          IF NOT status.normal THEN
            EXIT clp$scl_parameter_dialog_mgr;
          IFEND;
          IF message = NIL THEN
            support.get_brief_help^ (message_field_width + 1, message, status);
            IF NOT status.normal THEN
              EXIT clp$scl_parameter_dialog_mgr;
            IFEND;
          IFEND;
          IF message <> NIL THEN
            PUSH message_area;
            message_area^ := message^;
          ELSE
            message_area := NIL;
          IFEND;
          support.get_all_parameter_specs^ (TRUE, message_field_width, representation, status);
          IF NOT status.normal THEN
            EXIT clp$scl_parameter_dialog_mgr;
          IFEND;
          display_help_window (representation, message_area);
          help_window.cursor_field_number := display.command_field;
        IFEND;
        help_window.cursor_character_position := 1;
        help_window.cursor_line_number := 1;
      IFEND;

    PROCEND process_help_event;
?? TITLE := 'process_home_event', EJECT ??

    PROCEDURE process_home_event;


      cursor_field_number := display.command_field;
      cursor_character_position := 1;
      cursor_line_number := 1;

    PROCEND process_home_event;
?? TITLE := 'process_info_event', EJECT ??

    PROCEDURE process_info_event;

      VAR
        i: clt$parameter_name_count,
        message: ost$status_message,
        message_parameters: ^array [1 .. * ] of ^ost$message_parameter,
        names: ^array [1 .. * ] of clt$command_name,
        source_string: fst$path,
        source_string_size: fst$path_size;


      IF support.nested_dialog_title <> NIL THEN
        RETURN;
      IFEND;

      support.get_all_names^ (names, status);
      IF NOT status.normal THEN
        EXIT clp$scl_parameter_dialog_mgr;
      IFEND;
      PUSH message_parameters: [1 .. UPPERBOUND (names^) + 1];
      FOR i := 1 TO UPPERBOUND (names^) DO
        PUSH message_parameters^ [i + 1]: [clp$trimmed_string_size (names^ [i])];
        #TRANSLATE (osv$upper_to_lower, names^ [i], message_parameters^ [i + 1]^);
      FOREND;
      support.get_source^ (source_string, source_string_size, status);
      IF NOT status.normal THEN
        EXIT clp$scl_parameter_dialog_mgr;
      IFEND;
      PUSH message_parameters^ [1]: [source_string_size];
      #TRANSLATE (osv$upper_to_lower, source_string (1, source_string_size), message_parameters^ [1]^);
      IF UPPERBOUND (message_parameters^) = 2 THEN
        get_message (clc$info_display_with_one_name, message_parameters, message);
      ELSE
        get_message (clc$info_display, message_parameters, message);
      IFEND;
      display_status_message (message, clc$message_window);

    PROCEND process_info_event;
?? TITLE := 'process_insert_char_event', EJECT ??

    PROCEDURE process_insert_char_event;

      VAR
        command_field: boolean,
        ignore_parameter_value: boolean,
        input_field: boolean,
        line_number: 0 .. csc$max_line_number;

?? NEWTITLE := 'insert_char', EJECT ??

      PROCEDURE insert_char
        (VAR field_text: ^string ( * ));

        VAR
          text: ^string ( * ),
          text_length: 0 .. csc$max_character_position;


        text_length := clp$trimmed_string_size (field_text^);
        IF (text_length > 0) AND (cursor_character_position <= text_length) THEN
          text_length := text_length + 1;
          PUSH text: [text_length];
          IF cursor_character_position > 1 THEN
            text^ := field_text^ (1, cursor_character_position - 1);
          IFEND;
          text^ (cursor_character_position, 1) := ' ';
          text^ (cursor_character_position + 1, text_length - cursor_character_position) :=
                field_text^ (cursor_character_position, text_length - cursor_character_position);
          FREE field_text;
          ALLOCATE field_text: [text_length];
          field_text^ := text^;
        IFEND;

      PROCEND insert_char;
?? OLDTITLE, EJECT ??

      get_cursor_input_field (input_field, command_field, ignore_parameter_value, line_number);
      IF input_field THEN
        IF command_field THEN
          IF display.command_text <> NIL THEN
            insert_char (display.command_text);
          IFEND;
        ELSE
          CASE display.current_window OF
          = clc$zoom_window =
            IF zoom_window.contents^ [line_number + zoom_window.top - 1] <> NIL THEN
              insert_char (zoom_window.contents^ [line_number + zoom_window.top - 1]);
              update_window_display (clc$zoom_window);
            IFEND;
          = clc$no_window =
            IF (parameter_information^ [parameter_number].value <> NIL) AND
                  (NOT (parameter_information^ [parameter_number].
                  too_big_to_edit OR parameter_information^ [parameter_number].overflow)) THEN
              insert_char (parameter_information^ [parameter_number].value);
              parameter_information^ [parameter_number].evaluation_required := TRUE;
              update_parameters := TRUE;
            IFEND;
          ELSE
          CASEND;
        IFEND;
      IFEND;

    PROCEND process_insert_char_event;
?? TITLE := 'process_keyboard', EJECT ??

    PROCEDURE process_keyboard;

      VAR
        action: integer,
        defer_command_line_processing: boolean,
        got_an_action: boolean,
        i: integer,
        message: ost$status_message;


      action_number := 0;
      processing_complete := FALSE;
      ignore_following_csc$next_event := FALSE;
      need_to_clear_command_field := FALSE;

      csp$flush_events (status);
      IF NOT status.normal THEN
        EXIT clp$scl_parameter_dialog_mgr;
      IFEND;

      IF NOT initial_status.normal THEN
        display_status (initial_status);
      IFEND;

      WHILE NOT processing_complete DO

        csp$change_cursor_position (cursor_field_number, cursor_character_position, cursor_line_number,
              status);
        status.normal := TRUE;

      /get_action_loop/
        WHILE TRUE DO
          get_action (got_an_action, action);
          IF got_an_action THEN
            EXIT /get_action_loop/;
          IFEND;

{ If control is returned without getting an action, a "job reconnect"
{ condition must have occurred, so repaint the screen and retry the get.

          csp$clear_screen (status);
          IF NOT status.normal THEN
            EXIT clp$scl_parameter_dialog_mgr;
          IFEND;
        WHILEND /get_action_loop/;

        message_read := TRUE;
        defer_command_line_processing := (action = zoom_event) OR (action = clear_eol_event) OR
              (action = delete_char_event) OR (action = insert_char_event) OR
              (action = edit_zoom_event);
        get_screen_values (defer_command_line_processing);

        IF need_to_clear_command_field THEN
          clear_command_field;
        IFEND;

        IF action <> 0 THEN
          csp$mark_menu_item (action, status);
          csp$update_device (status);
          status.normal := TRUE;

          CASE action OF
          = backward_event =
            process_backward_event;
          = cancel_event =
            process_cancel_event;
          = clear_event =
            process_clear_event;
          = clear_eol_event =
            process_clear_eol_event;
          = delete_char_event =
            process_delete_char_event;
          = down_event =
            process_down_event;
          = evaluate_event =
            process_evaluate_event;
          = first_event =
            process_first_event;
          = forward_event =
            process_forward_event;
          = help_event =
            process_help_event;
          = home_event =
            process_home_event;
          = info_event =
            process_info_event;
          = insert_char_event =
            process_insert_char_event;
          = last_event =
            process_last_event;
          = mouse_click_strong =
            { turned into appropriate event by get_mouse_action } ;
          = mouse_click_weak =
            { just "resolves" terminal cursor to mouse cursor position} ;
          = ok_event =
            process_ok_event;
          = reset_event =
            process_reset_event;
          = up_event =
            process_up_event;
          = zoom_event =
            process_zoom_event;
          = edit_zoom_event =
            action_number := edit_zoom_event;
            process_zoom_event;
            action_number := 0;
          ELSE
            ;
          CASEND;
          csp$unmark_menu_item (action, status);
          status.normal := TRUE;
        ELSEIF next_event THEN
          process_next_event;
        ELSEIF NOT (mouse_event OR screen_event) THEN
          process_undefined_event;
        IFEND;

        IF update_parameters THEN
          update_parameters := FALSE;
          update_parameter_display;
        IFEND;

        IF (NOT message_displayed) AND (display.current_window <> clc$message_window) AND
              (cleared_parameters <> NIL) THEN
          get_message (clc$cleared_parameter_ignored, cleared_parameters, message);
          display_status_message (message, clc$message_window);
          FOR i := 1 TO UPPERBOUND (cleared_parameters^) DO
            IF cleared_parameters^ [i] <> NIL THEN
              FREE cleared_parameters^ [i];
            IFEND;
          FOREND;
          FREE cleared_parameters;
        IFEND;

        IF message_displayed AND message_read AND NOT screen_event THEN
          csp$clear_field (display.message_field, status);
          IF NOT status.normal THEN
            EXIT clp$scl_parameter_dialog_mgr;
          IFEND;
          status_condition_name := '';
          message_displayed := FALSE;
          message_read := FALSE;
          clear_command_field;
        IFEND;

        IF defer_command_line_processing AND (action <> zoom_event) AND
              (action <> edit_zoom_event) AND (display.command_text <> NIL) THEN
          process_command (display.command_text^);
        IFEND;

      WHILEND;

    PROCEND process_keyboard;
?? TITLE := 'process_last_event', EJECT ??

    PROCEDURE process_last_event;

      VAR
        new_top: clt$parameter_count;


      CASE display.current_window OF
      = clc$help_window =
        IF help_window.lines_displayed <> 0 THEN
          cursor_field_number := help_window.text_field;
          cursor_line_number := help_window.lines_displayed;
          new_top := help_window.line_count - help_window.lines_displayed + 1;
          IF new_top <> help_window.top THEN
            help_window.top := new_top;
            update_window_display (clc$help_window);
          IFEND;
        IFEND;
      = clc$message_window =
        IF message_window.lines_displayed <> 0 THEN
          cursor_field_number := message_window.text_field;
          cursor_line_number := message_window.lines_displayed;
          new_top := message_window.line_count - message_window.lines_displayed + 1;
          IF new_top <> message_window.top THEN
            message_window.top := new_top;
            update_window_display (clc$message_window);
          IFEND;
        IFEND;
      = clc$zoom_window =
        IF zoom_window.lines_displayed <> 0 THEN
          cursor_field_number := zoom_window.text_field;
          cursor_line_number := zoom_window.lines_displayed;
          new_top := zoom_window.line_count - zoom_window.lines_displayed + 1;
          IF new_top <> zoom_window.top THEN
            zoom_window.top := new_top;
            update_window_display (clc$zoom_window);
          IFEND;
        IFEND;
      ELSE {clc$no_window
        IF display.parameters_displayed <> 0 THEN
          new_top := display.parameter_count - display.parameters_displayed + 1;
          cursor_field_number := parameter_display_info^ [display.parameters_displayed].value_field_number;
          cursor_line_number := 1;
          cursor_character_position := 1;
          IF display.top_parameter <> new_top THEN
            display.top_parameter := new_top;
            update_parameters := TRUE;
          IFEND;
        IFEND;
      CASEND;

    PROCEND process_last_event;
?? TITLE := 'process_next_event', EJECT ??

    PROCEDURE process_next_event;

      VAR
        command_field: boolean,
        input_field: boolean,
        line_number: 0 .. csc$max_line_number,
        new_parameter_line: 0 .. csc$max_line_number,
        parameter_value: boolean;


      CASE display.current_window OF
      = clc$help_window =
        change_menu_items (clc$help_window, help_window.parent_window);
        close_window (clc$help_window);
      = clc$message_window =
        IF message_read THEN
          change_menu_items (clc$message_window, message_window.parent_window);
          close_window (clc$message_window);
          status_condition_name := '';
          need_to_clear_command_field := TRUE;
          message_read := FALSE;
        ELSE
          message_read := TRUE;
        IFEND;
      = clc$zoom_window, clc$no_window =

{ Treat NEXT as a forward tab.

        get_cursor_input_field (input_field, command_field, parameter_value, line_number);
        cursor_character_position := 1;
        cursor_line_number := 1;
        IF command_field THEN
          IF ignore_tab_caused_by_next THEN
            ignore_tab_caused_by_next := FALSE;
            RETURN;
          IFEND;
          CASE display.current_window OF
          = clc$zoom_window =
            IF zoom_window.lines_displayed > 0 THEN
              cursor_field_number := zoom_window.text_field;
            IFEND;
          = clc$no_window =
            IF display.parameters_displayed = 0 THEN
              RETURN;
            IFEND;
            new_parameter_line := 1;

            WHILE parameter_information^ [display.top_parameter + new_parameter_line - 1].
                  advanced_indicator DO
              IF new_parameter_line = display.parameters_displayed THEN
                cursor_field_number := display.command_field;
                RETURN;
              IFEND;
              new_parameter_line := new_parameter_line + 1;
            WHILEND;

            cursor_field_number := parameter_display_info^ [new_parameter_line].value_field_number;
          ELSE
          CASEND;
        ELSEIF parameter_value THEN
          CASE display.current_window OF
          = clc$zoom_window =
            IF line_number = zoom_window.lines_displayed THEN
              scroll_window;
            ELSE
              cursor_line_number := line_number + 1;
            IFEND;
          = clc$no_window =
            IF parameter_number = display.parameter_count THEN
              cursor_field_number := display.command_field;
              RETURN;
            ELSEIF parameter_number = display.top_parameter + display.parameters_displayed - 1 THEN
              scroll_window;
              RETURN;
            ELSE
              new_parameter_line := parameter_line + 1;
            IFEND;

            WHILE parameter_information^ [display.top_parameter + new_parameter_line - 1].
                  advanced_indicator DO
              IF new_parameter_line = display.parameters_displayed THEN
                cursor_field_number := display.command_field;
                RETURN;
              IFEND;
              new_parameter_line := new_parameter_line + 1;
            WHILEND;

            cursor_field_number := parameter_display_info^ [new_parameter_line].value_field_number;
          ELSE
            RETURN;
          CASEND;
        ELSE
          cursor_field_number := display.command_field;
        IFEND;
      ELSE
      CASEND;

    PROCEND process_next_event;
?? TITLE := 'process_ok_event', EJECT ??

    PROCEDURE process_ok_event;

      VAR
        evaluation_status: ost$status,
        pdt_number: clt$parameter_count,
        representation: ^clt$data_representation,
        text: string (csc$max_x_position),
        text_length: cst$data_string_length,
        which_parameter: clt$which_parameter;


      CASE display.current_window OF
      = clc$help_window, clc$message_window =
        { The OK event is undefined for help and message windows.
      = clc$zoom_window =
        IF zoom_window.parameter_value THEN
          process_zoomed_parameter;
          change_menu_items (clc$zoom_window, zoom_window.parent_window);
          close_window (clc$zoom_window);
        ELSE
          process_zoomed_command;
        IFEND;
      ELSE {clc$no_window
        IF cleared_parameters <> NIL THEN
          RETURN;
        IFEND;
        FOR parameter_number := 1 TO display.parameter_count DO
          IF (NOT parameter_information^ [parameter_number].advanced_indicator) AND
                parameter_information^ [parameter_number].evaluation_required THEN
            pdt_number := parameter_information^ [parameter_number].pdt_number;
            IF editing_parameter_list THEN
              support.change_expression_save^ (TRUE, status);
              IF NOT status.normal THEN
                EXIT clp$scl_parameter_dialog_mgr;
              IFEND;
            IFEND;
            support.evaluate_parameter^ (pdt_number, parameter_information^ [parameter_number].value^,
                  evaluation_status);
            IF editing_parameter_list THEN
              support.change_expression_save^ (FALSE, status);
              IF NOT status.normal THEN
                EXIT clp$scl_parameter_dialog_mgr;
              IFEND;
            IFEND;
            IF NOT evaluation_status.normal THEN
              center_parameter_on_screen;
              IF NOT editing_parameter_list THEN
                display_status (evaluation_status);
                update_parameters := TRUE;
                RETURN;
              ELSE
                display_message_and_status (evaluation_status);
                parameter_information^ [parameter_number].evaluation_required := FALSE;
                update_parameters := TRUE;
                RETURN;
              IFEND;
            IFEND;
            support.get_parameter_value_source^ (pdt_number, clc$max_string_size, representation, status);
            IF NOT status.normal THEN
              EXIT clp$scl_parameter_dialog_mgr;
            IFEND;
            text := clp$data_representation_text (representation) ^;
            text_length := clp$trimmed_string_size (text);
            ALLOCATE parameter_information^ [parameter_number].value: [text_length];
            parameter_information^ [parameter_number].value^ := text (1, text_length);
          IFEND;
        FOREND;

        support.verify_all_parameters^ (which_parameter, evaluation_status);
        IF NOT evaluation_status.normal THEN
          IF which_parameter.specific THEN

          /get_field_number/
            FOR parameter_number := 1 TO display.parameter_count DO
              IF (NOT parameter_information^ [parameter_number].advanced_indicator) AND
                    (which_parameter.number = parameter_information^ [parameter_number].pdt_number) THEN
                center_parameter_on_screen;
                EXIT /get_field_number/;
              IFEND;
            FOREND /get_field_number/;
          IFEND;
          update_parameters := TRUE;
          display_status (evaluation_status);
        ELSE
          processing_complete := TRUE;
        IFEND;
      CASEND;

    PROCEND process_ok_event;
?? TITLE := 'process_reset_event', EJECT ??

    PROCEDURE process_reset_event;

?? NEWTITLE := 'restore_parameter_default', EJECT ??

      PROCEDURE restore_parameter_default;

        VAR
          pdt_number: clt$parameter_count,
          restore_default_status: ost$status,
          text: ^string ( * ),
          text_length: clt$string_size;

        pdt_number := parameter_information^ [parameter_number].pdt_number;
        support.restore_parameter_default^ (pdt_number, restore_default_status);
        IF NOT restore_default_status.normal THEN
          display_status (restore_default_status);
          RETURN;
        IFEND;

        CASE pdt.parameters^ [pdt_number].requirement OF
        = clc$optional_default_parameter, clc$confirm_default_parameter =
          support.get_parameter_default^ (pdt_number, text, status);
          IF NOT status.normal THEN
            EXIT clp$scl_parameter_dialog_mgr;
          IFEND;
        ELSE {clc$required_parameter, clc$optional_parameter}
          PUSH text: [0];
        CASEND;
        parameter_information^ [parameter_number].initialized := TRUE;
        parameter_information^ [parameter_number].evaluation_required := FALSE;
        parameter_information^ [parameter_number].too_big_to_edit := FALSE;
        text_length := clp$trimmed_string_size (text^);
        ALLOCATE parameter_information^ [parameter_number].value: [text_length];
        parameter_information^ [parameter_number].value^ := text^ (1, text_length);

        IF (parameter_number >= display.top_parameter) AND (parameter_number <
              display.top_parameter + display.parameters_displayed) THEN
          update_parameters := TRUE;
        IFEND;
        parameter_information^ [parameter_number].too_big_to_edit := FALSE;

      PROCEND restore_parameter_default;
?? OLDTITLE, EJECT ??

      get_event_parameter;
      IF parameter_selected THEN
        restore_parameter_default;
        cursor_field_number := parameter_display_info^ [parameter_line].value_field_number;
        cursor_line_number := 1;
        cursor_character_position := 1;
      ELSE
        FOR parameter_number := 1 TO display.parameter_count DO
          IF (NOT parameter_information^ [parameter_number].advanced_indicator) AND
                parameter_information^ [parameter_number].initialized THEN
            restore_parameter_default;
          IFEND;
        FOREND;
      IFEND;

    PROCEND process_reset_event;
?? TITLE := 'process_undefined_event', EJECT ??

    PROCEDURE process_undefined_event;

      VAR
        event_name_identifier: cst$event_name_identifier,
        message: ost$status_message,
        message_area: ^ost$status_message,
        message_parameters: array [1 .. 1] of ^ost$message_parameter,
        name: ost$name,
        name_length: 0 .. osc$max_name_size;


      IF display.help_window_displayed THEN
        get_message (clc$function_key_help, NIL, message);
        PUSH message_area;
        message_area^ := message;
        display_help_window (NIL, message_area);
      ELSE
        event_name_identifier.event_type := event.event_type;
        CASE event_name_identifier.event_type OF
        = csc$page_event =
          event_name_identifier.page_event := event.page_event;
        = csc$field_event =
          event_name_identifier.field_event := event.field_event;
        = csc$timeout_event =
          ;
        = csc$end_of_transaction =
          ;
        CASEND;

        csp$get_event_name (event_name_identifier, name, name_length, status);
        IF NOT status.normal THEN
          EXIT clp$scl_parameter_dialog_mgr;
        IFEND;
        name := name (1, name_length);
        convert_name_to_message_param (name);
        message_parameters [1] := ^name;
        get_message (clc$undefined_function_key, ^message_parameters, message);
        display_status_message (message, clc$message_window);
      IFEND;

    PROCEND process_undefined_event;
?? TITLE := 'process_up_event', EJECT ??

    PROCEDURE process_up_event;

      VAR
        message_text: string (csc$max_x_position),
        new_top_parameter: clt$parameter_count,
        text_length: 0 .. csc$max_x_position;


      get_event_parameter;
      IF NOT event_on_parameter_line THEN
        get_message_text (clc$press_up, NIL, message_text, text_length);
        display_message (message_text (1, text_length));
        RETURN;
      IFEND;

      new_top_parameter := parameter_number;
      IF (display.parameter_count - new_top_parameter + 1) < display.parameters_displayed THEN
        new_top_parameter := display.parameter_count - display.parameters_displayed + 1;
      IFEND;

      cursor_field_number := parameter_display_info^ [(display.parameters_displayed + 1) DIV
            2].value_field_number;
      cursor_line_number := 1;
      cursor_character_position := 1;
      IF new_top_parameter <> display.top_parameter THEN
        display.top_parameter := new_top_parameter;
        update_parameters := TRUE;
      IFEND;

    PROCEND process_up_event;
?? TITLE := 'process_zoom_event', EJECT ??

{ PURPOSE:
{   This procedure generates a ZOOM window for the command line or a parameter
{   value field, in response to the ZOOM event entered by the terminal user.
{ DESIGN:
{   The ZOOM window is generated for the command line if the ZOOM event is not
{   associated with a specific parameter.
{ NOTES:
{   Secure parameters are not ZOOMable so that the contents are not displayed.

    PROCEDURE process_zoom_event;

      VAR
        message_parameter: array [1 .. 1] of ^ost$message_parameter,
        message_text: string (csc$max_x_position),
        text_length: 0 .. csc$max_x_position;


      IF cursor_field_number = display.command_field THEN
        zoom_window.cursor_field_number := display.command_field;
        zoom_window.cursor_character_position := 1;
        zoom_window.cursor_line_number := 1;
        zoom_command_line;

      ELSE
        get_event_parameter;
        IF parameter_selected THEN
          IF parameter_information^ [parameter_number].secure THEN

{ Decline to ZOOM secure parameters, so that secure information is not displayed.

            message_parameter [1] := ^parameter_information^ [parameter_number].name;
            get_message_text (clc$unable_to_zoom_secure_param, ^message_parameter, message_text, text_length);
            display_message (message_text (1, text_length));
          ELSE
            zoom_window.cursor_field_number := cursor_field_number;
            zoom_window.cursor_character_position := cursor_character_position;
            zoom_window.cursor_line_number := cursor_line_number;
            zoom_parameter;
          IFEND;
        IFEND;
      IFEND;

    PROCEND process_zoom_event;
?? TITLE := 'process_zoom_input', EJECT ??

    PROCEDURE process_zoom_input
      (    line_number: integer);

      VAR
        end_of_line: boolean,
        end_of_text: boolean,
        text: string (csc$max_x_position),
        text_length: cst$data_string_length;


      csp$get_text (text, text_length, end_of_line, end_of_text, status);
      IF NOT status.normal THEN
        EXIT clp$scl_parameter_dialog_mgr;
      IFEND;
      IF NOT end_of_text THEN
        IF zoom_window.contents^ [line_number] <> NIL THEN
          FREE zoom_window.contents^ [line_number];
        IFEND;
        ALLOCATE zoom_window.contents^ [line_number]: [text_length];
        zoom_window.contents^ [line_number]^ := text (1, text_length);
      IFEND;

    PROCEND process_zoom_input;
?? TITLE := 'process_zoomed_command', EJECT ??

    PROCEDURE process_zoomed_command;

      VAR
        command_text: ^string ( * ),
        command_text_length: 0 .. csc$max_character_position,
        include_status: ost$status,
        line_number: integer;


      PUSH command_text: [zoom_window.line_count * message_field_width];
      command_text_length := 0;
      FOR line_number := 1 TO zoom_window.line_count DO
        IF zoom_window.contents^ [line_number] <> NIL THEN
          command_text^ (command_text_length + 1, message_field_width) :=
                zoom_window.contents^ [line_number]^;
          command_text_length := command_text_length + message_field_width;
        IFEND;
      FOREND;

      include_status.normal := TRUE;
      IF command_text^ (1, command_text_length) <> ' ' THEN
        clp$push_interactive_input (status);
        IF NOT status.normal THEN
          EXIT clp$scl_parameter_dialog_mgr;
        IFEND;
        IF called_from_screen_mode THEN
          csp$disable_page (status);
          IF NOT status.normal THEN
            EXIT clp$scl_parameter_dialog_mgr;
          IFEND;
        IFEND;

        clp$include_command (command_text^ (1, command_text_length), FALSE, include_status);
        IF called_from_screen_mode THEN
          csp$enable_page (status);
          IF NOT status.normal THEN
            EXIT clp$scl_parameter_dialog_mgr;
          IFEND;
        IFEND;

        clp$pop_interactive_input (status);
        IF NOT status.normal THEN
          EXIT clp$scl_parameter_dialog_mgr;
        IFEND;
      IFEND;

      IF NOT include_status.normal THEN
        display_status (include_status);
      ELSE
        change_menu_items (clc$zoom_window, zoom_window.parent_window);
        close_window (clc$zoom_window);
        IF display.command_text <> NIL THEN
          FREE display.command_text;
        IFEND;
      IFEND;

    PROCEND process_zoomed_command;
?? TITLE := 'process_zoomed_parameter', EJECT ??

    PROCEDURE process_zoomed_parameter;

      VAR
        line_number: integer,
        message_text: string (csc$max_x_position),
        text: ^string (clc$max_string_size),
        text_size: clt$string_size,
        text_length: 0 .. csc$max_x_position;


      PUSH text;
      text_size := 0;
      FOR line_number := 1 TO zoom_window.line_count DO
        IF zoom_window.contents^ [line_number] <> NIL THEN
          IF text_size + message_field_width <= csc$max_character_position THEN
            text^ (text_size + 1, message_field_width) := zoom_window.contents^ [line_number]^;
            text_size := text_size + message_field_width;
          ELSE
            get_message_text (clc$too_big_to_edit, NIL, message_text, text_length);
            display_message (message_text (1, text_length));
            RETURN;
          IFEND;
        IFEND;
      FOREND;

      IF parameter_information^ [zoom_window.parameter_number].value^ = text^ (1, text_size) THEN
        RETURN;
      IFEND;

      IF text^ (1, text_size) = '' THEN
        ignore_cleared_parameter (parameter_information^ [zoom_window.parameter_number].name);
        RETURN;
      IFEND;

      FREE parameter_information^ [zoom_window.parameter_number].value;
      ALLOCATE parameter_information^ [zoom_window.parameter_number].value: [text_size];
      parameter_information^ [zoom_window.parameter_number].value^ := text^ (1, text_size);
      parameter_information^ [zoom_window.parameter_number].evaluation_required := TRUE;

      update_parameters := TRUE;

    PROCEND process_zoomed_parameter;
?? TITLE := 'put_representation', EJECT ??

    PROCEDURE put_representation
      (    representation: ^clt$data_representation);


      VAR
        end_of_text: boolean,
        events: ^array [1 .. * ] of carriage_return .. down_event,
        i: clt$data_representation_count,
        message_text: string (csc$max_x_position),
        number_of_lines_for_box: 0 .. csc$max_line_number,
        representation_area: ^clt$data_representation,
        representation_line: ^clt$string_value,
        representation_line_count: ^clt$data_representation_count,
        representation_line_size: ^clt$string_size,
        text_length: 0 .. csc$max_x_position;


      IF display.message_window_displayed THEN
        close_window (clc$message_window);
        status_condition_name := '';
      IFEND;
      change_menu_items (display.current_window, clc$help_window);
      PUSH representation_area: [[REP #SIZE (representation^) OF cell]];
      representation_area^ := representation^;
      RESET representation_area;
      NEXT representation_line_count IN representation_area;
      help_window.line_count := representation_line_count^;
      IF help_window.line_count > dialog_box_max_lines - 2 THEN
        PUSH events: [1 .. 3];
        events^ [1] := carriage_return;
        events^ [2] := forward_event;
        events^ [3] := backward_event;
        get_function_key_message (clc$press_next_from_pageable, events, message_text, text_length);
        number_of_lines_for_box := dialog_box_max_lines;
      ELSE
        PUSH events: [1 .. 1];
        events^ [1] := carriage_return;
        get_function_key_message (clc$press_next, events, message_text, text_length);
        number_of_lines_for_box := help_window.line_count + 2;
      IFEND;
      create_window (clc$help_window, 1, dialog_box_top, display.screen_width, number_of_lines_for_box,
            message_text (1, text_length), '', FALSE);
      update_lines_l_thru_m_of_n (help_window.top, help_window.lines_displayed, help_window.line_count,
            help_window.line_number_field, help_window.buttons);
      ALLOCATE help_window.contents: [1 .. help_window.line_count];
      FOR i := 1 TO help_window.line_count DO
        NEXT representation_line_size IN representation_area;
        NEXT representation_line: [representation_line_size^] IN representation_area;
        ALLOCATE help_window.contents^ [i]: [representation_line_size^];
        help_window.contents^ [i]^ := representation_line^;
        IF i <= number_of_lines_for_box - 2 THEN
          csp$change_io_position (help_window.text_field, i, status);
          IF NOT status.normal THEN
            EXIT clp$scl_parameter_dialog_mgr;
          IFEND;
          csp$put_text (representation_line, TRUE, end_of_text, status);
          IF NOT status.normal THEN
            EXIT clp$scl_parameter_dialog_mgr;
          IFEND;
        IFEND;
      FOREND;

    PROCEND put_representation;
?? TITLE := 'scroll_window', EJECT ??

    PROCEDURE scroll_window;

      VAR
        hold_contents: ^array [1 .. * ] of ^string ( * ),
        i: 0 .. csc$max_line_number,
        message_text: string (csc$max_x_position),
        new_top: 0 .. csc$max_line_number,
        scroll_increment: 0 .. csc$max_line_number,
        text_length: 0 .. csc$max_x_position;


      CASE display.current_window OF
      = clc$help_window, clc$message_window =

{ Scrolling is not available for HELP or MESSAGE windows.

      = clc$zoom_window =
        IF zoom_window.lines_displayed <> 0 THEN
          scroll_increment := zoom_window.lines_displayed DIV 2;
          IF zoom_window.top + zoom_window.lines_displayed - 1 + scroll_increment >
                zoom_window.line_count THEN

{ Expand window contents to scroll beyond end of current value.

            IF zoom_window.top + zoom_window.lines_displayed - 1 + scroll_increment <=
                  csc$max_line_number THEN
              new_top := zoom_window.top + scroll_increment;
              PUSH hold_contents: [1 .. zoom_window.line_count];
              hold_contents^ := zoom_window.contents^;
              FREE zoom_window.contents;
              ALLOCATE zoom_window.contents: [1 .. new_top + zoom_window.lines_displayed - 1];
              FOR i := 1 TO zoom_window.line_count DO
                zoom_window.contents^ [i] := hold_contents^ [i];
              FOREND;
              FOR i := zoom_window.line_count + 1 TO new_top + zoom_window.lines_displayed - 1 DO
                zoom_window.contents^ [i] := NIL;
              FOREND;
              zoom_window.line_count := new_top + zoom_window.lines_displayed - 1;
            ELSE
              get_message_text (clc$no_more_input_space, NIL, message_text, text_length);
              display_message (message_text (1, text_length));
              RETURN;
            IFEND;
          ELSE
            new_top := zoom_window.top + scroll_increment;
          IFEND;
          cursor_field_number := zoom_window.text_field;
          cursor_line_number := ((zoom_window.lines_displayed + 1) DIV 2) + 1;
          zoom_window.top := new_top;
          update_window_display (clc$zoom_window);
        IFEND;
      ELSE {clc$no_window
        IF display.parameters_displayed <> 0 THEN
          scroll_increment := display.parameters_displayed DIV 2;
          IF display.top_parameter + (display.parameters_displayed - 1) + scroll_increment >
                display.parameter_count THEN

{ Do not scroll beyond last parameter.

            new_top := display.parameter_count - display.parameters_displayed + 1;
          ELSE
            new_top := display.top_parameter + scroll_increment;
          IFEND;

          cursor_field_number := parameter_display_info^ [((display.parameters_displayed + 1) DIV
                2) + 1].value_field_number;
          cursor_line_number := 1;
          IF new_top <> display.top_parameter THEN
            display.top_parameter := new_top;
            update_parameters := TRUE;
          IFEND;
        IFEND;
      CASEND;

    PROCEND scroll_window;
?? TITLE := 'set_screen_dimensions', EJECT ??

    PROCEDURE set_screen_dimensions;

      VAR
        ignore_dimensions_accepted: boolean,
        terminal_attributes: array [1 .. 2] of ift$terminal_attribute;


      terminal_attributes [1].key := ifc$page_width;
      terminal_attributes [2].key := ifc$page_length;
      ifp$get_terminal_attributes (':$LOCAL.OUTPUT.1', terminal_attributes, status);
      IF NOT status.normal THEN
        EXIT clp$scl_parameter_dialog_mgr;
      IFEND;
      IF (1 <= terminal_attributes [1].page_width) AND (terminal_attributes [1].page_width <=
            csc$max_x_position) THEN
        display.screen_width := terminal_attributes [1].page_width;
        IF (1 <= terminal_attributes [2].page_length) AND (terminal_attributes [2].page_length <=
              csc$max_line_number) THEN
          display.screen_height := terminal_attributes [2].page_length;
        ELSE
          display.screen_height := 1;
        IFEND;
        csp$change_device_dimensions (display.screen_width, display.screen_height, ignore_dimensions_accepted,
              status);
        IF NOT status.normal THEN
          EXIT clp$scl_parameter_dialog_mgr;
        IFEND;
      IFEND;

    PROCEND set_screen_dimensions;
?? TITLE := 'setup_display', EJECT ??

    PROCEDURE setup_display;

      VAR
        attachment_options: ^fst$attachment_options,
        background_field_number: cst$field_number,
        context_attributes: array [1 .. 1] of ift$fetch_context_attribute,
        device_attributes: array [1 .. 2] of cst$device_attribute,
        get_page_attributes: array [1 .. 1] of cst$page_attribute,
        interaction_info: array [1 .. 1] of ost$interaction_info_item,
        lines_for_menu: clc$lines_for_one_menu_row .. clc$lines_for_two_menu_rows,
        lines_used_by_header: 0 .. csc$max_line_number,
        number_of_parameter_lines: 0 .. csc$max_line_number,
        page_attributes: array [1 .. 4] of cst$page_attribute,
        rows_for_menu: cst$number_of_menu_rows,
        rows_to_use: 0 .. csc$max_y_position;

?? NEWTITLE := 'determine_mouse_available', EJECT ??

      PROCEDURE [INLINE] determine_mouse_available;

        VAR
          event_name_identifier: cst$event_name_identifier,
          name: ost$name,
          name_length: 0 .. osc$max_name_size;


        event_name_identifier.event_type := csc$field_event;
        event_name_identifier.field_event.event_type := csc$pick;
        csp$get_event_name (event_name_identifier, name, name_length, status);
        IF NOT status.normal THEN
          EXIT clp$scl_parameter_dialog_mgr;
        IFEND;
        display.mouse_available := name (1, name_length) = 'PC_SHELL';

      PROCEND determine_mouse_available;
?? OLDTITLE, EJECT ??

      context_attributes [1].key := ifc$previous_mode;
      ifp$fetch_context (context_attributes, status);
      IF NOT status.normal THEN
        EXIT clp$scl_parameter_dialog_mgr;
      IFEND;

      IF context_attributes [1].previous_mode = ifc$screen THEN
        called_from_screen_mode := TRUE;
        IF display.parameter_count > (csc$max_y_position - clc$estimated_overhead_lines) THEN
          rows_to_use := csc$max_y_position - clc$estimated_overhead_lines;
        ELSEIF display.parameter_count < clc$minimum_parameter_rows THEN
          rows_to_use := clc$minimum_parameter_rows + clc$estimated_overhead_lines;
        ELSE
          rows_to_use := display.parameter_count + clc$estimated_overhead_lines;
        IFEND;
        rows_to_use := rows_to_use + 1; {For surrounding box.
        get_page_attributes [1].key := csc$menu_rows_displayed;
        csp$get_page_attributes (get_page_attributes, status);
        IF NOT status.normal THEN

{ The following check is needed to get around the situation where the underlying
{ screen application has its own instance of screen manager.  In that case there's
{ no way to find out how many menu rows that application is using.  Assume its 1.

          IF status.condition <> cse$illegal_command THEN
            EXIT clp$scl_parameter_dialog_mgr;
          IFEND;
          status.normal := TRUE;
          get_page_attributes [1].menu_rows_displayed := 1;
        IFEND;
        rows_for_menu := get_page_attributes [1].menu_rows_displayed;
      ELSE
        called_from_screen_mode := FALSE;
        rows_to_use := 0; {Use all of the screen.
        interaction_info [1].key := osc$menu_rows;
        osp$get_interaction_information (interaction_info, status);
        IF NOT status.normal THEN
          EXIT clp$scl_parameter_dialog_mgr;
        IFEND;
        rows_for_menu := interaction_info [1].menu_rows;
      IFEND;

      IF rows_for_menu = 0 THEN
        rows_for_menu := 1;
      IFEND;
      IF rows_for_menu = 2 THEN
        lines_for_menu := clc$lines_for_two_menu_rows;
      ELSE
        lines_for_menu := clc$lines_for_one_menu_row;
      IFEND;

      PUSH attachment_options: [1 .. 2];
      attachment_options^ [1].selector := fsc$access_and_share_modes;
      attachment_options^ [1].access_modes.selector := fsc$specific_access_modes;
      attachment_options^ [1].access_modes.value := $fst$file_access_options [fsc$read];
      attachment_options^ [1].share_modes.selector := fsc$determine_from_access_modes;
      attachment_options^ [2].selector := fsc$wait_for_attachment;
      attachment_options^ [2].wait_for_attachment.wait := osc$nowait;

      fsp$open_file (':$LOCAL.INPUT.1', amc$record, attachment_options, NIL, NIL, NIL, NIL, file_identifier,
            status);
      IF NOT status.normal THEN
        EXIT clp$scl_parameter_dialog_mgr;
      IFEND;
      input_file_opened := TRUE;

      csp$change_partial_screen (file_identifier, csc$screen_level, rows_to_use, old_interaction_style,
            display.reserved_rows, status);
      IF NOT status.normal THEN
        osp$set_status_condition (cle$unable_to_enter_screen_mode, status);
        EXIT clp$scl_parameter_dialog_mgr;
      IFEND;
      entered_screen_mode := TRUE;

      display.reserved_rows := display.reserved_rows + 1;
      IF NOT called_from_screen_mode THEN
        set_screen_dimensions;
      IFEND;
      device_attributes [1].key := csc$da_number_of_characters;
      device_attributes [2].key := csc$da_number_of_lines;
      csp$get_device_attributes (device_attributes, status);
      IF NOT status.normal THEN
        EXIT clp$scl_parameter_dialog_mgr;
      IFEND;

      display.screen_width := device_attributes [1].number_of_characters;
      IF display.reserved_rows >= (lines_for_menu + 1) THEN
        display.screen_height := device_attributes [2].number_of_lines - display.reserved_rows;
        lines_used_by_trailer := display.reserved_rows;
      ELSE
        display.screen_height := device_attributes [2].number_of_lines - (lines_for_menu + 1);
        lines_used_by_trailer := lines_for_menu + 1;
      IFEND;
      dialog_box_max_lines := device_attributes [2].number_of_lines - (lines_for_menu + 1);
      message_field_width := display.screen_width - (clc$left_margin + clc$right_margin);

      determine_mouse_available;

      page_attributes [1].key := csc$page_changed_text_mode;
      page_attributes [1].changed_text_mode := TRUE;
      page_attributes [2].key := csc$left_mouse_button;
      page_attributes [2].left_button := 1;
      page_attributes [3].key := csc$right_mouse_button;
      page_attributes [3].right_button := 1;
      page_attributes [4].key := csc$menubar_file;
      IF display.mouse_available THEN
        page_attributes [4].menubar_enabled := TRUE;
        page_attributes [4].menubar_file := ':$LOCAL.CLF$PD_MENUBAR';
        command_line_number := 2;

        clp$include_line ('CLP$PD_BUILD_MENUBAR', FALSE, osc$null_name, status);
        status.normal := TRUE {ignore bad status} ;

      ELSE
        page_attributes [4].menubar_enabled := FALSE;
        command_line_number := 1;
      IFEND;

      csp$change_page_attributes (page_attributes, status);
      IF NOT status.normal THEN
        EXIT clp$scl_parameter_dialog_mgr;
      IFEND;

      message_line_number := command_line_number + 1;
      IF support.nested_dialog_title <> NIL THEN
        title_box_top := message_line_number + 3;
      ELSEIF called_from_screen_mode THEN
        title_box_top := message_line_number + 2;
      ELSE
        title_box_top := message_line_number + 1;
      IFEND;
      lines_used_by_header := title_box_top + clc$lines_used_by_title - 1;
      dialog_box_top := title_box_top + 1;

      initialize_background_field (1, dialog_box_top, display.screen_width,
            display.screen_height - dialog_box_top + 1, background_field_number);
      initialize_function_key_menu (rows_for_menu);
      initialize_title_box;

      number_of_parameter_lines := display.screen_height - lines_used_by_header;
      IF called_from_screen_mode THEN
        number_of_parameter_lines := number_of_parameter_lines - 1;
      IFEND;
      IF display.parameter_count < number_of_parameter_lines THEN
        display.parameters_displayed := display.parameter_count;
      ELSE
        display.parameters_displayed := number_of_parameter_lines;
      IFEND;
      start_of_parameter_lines := lines_used_by_header + clc$blank_lines_after_header + 1;
      end_of_parameter_lines := start_of_parameter_lines + display.parameters_displayed - 1;
      dialog_box_max_lines := dialog_box_max_lines - lines_used_by_header;

      IF display.parameters_displayed > 0 THEN
        ALLOCATE parameter_display_info: [1 .. display.parameters_displayed];
      IFEND;

      initialize_command_field;
      initialize_message_field;
      IF display.parameter_count > 0 THEN
        create_prompt_and_value_fields;
        display.top_parameter := 1;
        update_parameter_display;
        cursor_field_number := parameter_display_info^ [1].value_field_number;
      ELSE
        cursor_field_number := display.command_field;
        update_lines_l_thru_m_of_n (0, 0, 0, display.line_number_field, display.buttons);
      IFEND;
      cursor_character_position := 1;
      cursor_line_number := 1;

    PROCEND setup_display;
?? TITLE := 'shut_down', EJECT ??

    PROCEDURE shut_down
      (    ignore_errors: boolean);

      VAR
        i: integer,
        ignore_rows: cst$lines_used;


      IF entered_screen_mode THEN
        csp$flush_events (status);
        IF NOT (status.normal OR ignore_errors) THEN
          EXIT clp$scl_parameter_dialog_mgr;
        ELSE
          status.normal := TRUE;
        IFEND;
        csp$change_partial_screen (file_identifier, csc$line_level, display.reserved_rows,
              old_interaction_style, ignore_rows, status);
        IF NOT (status.normal OR ignore_errors) THEN
          EXIT clp$scl_parameter_dialog_mgr;
        ELSE
          status.normal := TRUE;
        IFEND;
        entered_screen_mode := FALSE;
      IFEND;

      IF input_file_opened THEN
        fsp$close_file (file_identifier, status);
        IF NOT (status.normal OR ignore_errors) THEN
          EXIT clp$scl_parameter_dialog_mgr;
        ELSE
          status.normal := TRUE;
        IFEND;
        input_file_opened := FALSE;
      IFEND;

      IF display.help_window_displayed AND (help_window.contents <> NIL) THEN
        free_window_contents (help_window.contents);
      IFEND;

      IF display.message_window_displayed AND (message_window.contents <> NIL) THEN
        free_window_contents (message_window.contents);
      IFEND;

      IF display.zoom_window_displayed AND (zoom_window.contents <> NIL) THEN
        free_window_contents (zoom_window.contents);
      IFEND;

      IF parameter_display_info <> NIL THEN
        FREE parameter_display_info;
      IFEND;

      IF parameter_information <> NIL THEN
        FOR i := 1 TO display.parameter_count DO
          IF (NOT parameter_information^ [i].advanced_indicator) AND parameter_information^ [i].
                initialized AND (parameter_information^ [i].value <> NIL) THEN
            FREE parameter_information^ [i].value;
          IFEND;
        FOREND;
        FREE parameter_information;
      IFEND;

      IF display.command_text <> NIL THEN
        FREE display.command_text;
      IFEND;

      IF cleared_parameters <> NIL THEN
        FOR i := 1 TO UPPERBOUND (cleared_parameters^) DO
          IF cleared_parameters^ [i] <> NIL THEN
            FREE cleared_parameters^ [i];
          IFEND;
        FOREND;
        FREE cleared_parameters;
      IFEND;

      IF menu_list_copy <> NIL THEN
        FREE menu_list_copy;
      IFEND;

      IF menu_classes_copy <> NIL THEN
        FREE menu_classes_copy;
      IFEND;

    PROCEND shut_down;
?? TITLE := 'update_lines_l_thru_m_of_n', EJECT ??

    PROCEDURE update_lines_l_thru_m_of_n
      (    line_number: integer;
           lines_per_page: 0 .. csc$max_line_number;
           total_lines: integer;
           field_number: cst$field_number;
       VAR buttons: clt$dialog_buttons);

      VAR
        button: ^clt$dialog_button,
        button_field: clt$field_attributes,
        button_x_position: cst$x_position,
        end_of_text: boolean,
        field_attributes: array [1 .. 2] of cst$field_attribute,
        l_text: string (csc$max_x_position),
        l_text_length: integer,
        m_text: string (csc$max_x_position),
        m_text_length: integer,
        message_parameters: array [1 .. 3] of ^ost$message_parameter,
        message_text: string (csc$max_x_position),
        n_text: string (csc$max_x_position),
        n_text_length: integer,
        text_length: 0 .. csc$max_x_position;


      IF line_number <> 0 THEN
        STRINGREP (l_text, l_text_length, line_number);
        STRINGREP (m_text, m_text_length, (line_number + lines_per_page - 1));
        STRINGREP (n_text, n_text_length, total_lines);
        message_parameters [1] := ^l_text (1, l_text_length);
        message_parameters [2] := ^m_text (1, m_text_length);
        message_parameters [3] := ^n_text (1, n_text_length);
        get_message_text (clc$lines_l_through_m_size_n, ^message_parameters, message_text, text_length);
      ELSE
        get_message_text (clc$no_parameters_label, NIL, message_text, text_length);
      IFEND;
      field_attributes [1].key := csc$fld_visible_characters;
      field_attributes [1].visible_characters := text_length;
      field_attributes [2].key := csc$fld_x_position;
      field_attributes [2].x_position := display.screen_width - (clc$title_line_number_inset + text_length) +
            1;
      csp$change_field_attributes (field_number, field_attributes, status);
      IF NOT status.normal THEN
        EXIT clp$scl_parameter_dialog_mgr;
      IFEND;

      csp$change_io_position (field_number, 1, status);
      IF NOT status.normal THEN
        EXIT clp$scl_parameter_dialog_mgr;
      IFEND;
      end_of_text := FALSE;
      csp$put_text (^message_text (1, text_length), TRUE, end_of_text, status);
      IF NOT status.normal THEN
        EXIT clp$scl_parameter_dialog_mgr;
      IFEND;

      IF NOT display.mouse_available THEN
        RETURN;
      IFEND;

      button_x_position := field_attributes [2].x_position;
      button_field := clv$default_field_attributes;
      field_attributes [2].key := csc$fld_y_position;
      csp$get_field_attributes (field_number, field_attributes, status);
      IF NOT status.normal THEN
        EXIT clp$scl_parameter_dialog_mgr;
      IFEND;
      button_field [y_position_attribute].y_position := field_attributes [2].y_position;

      buttons.page_up_button.active := line_number > 1;
      buttons.page_down_button.active := (line_number + lines_per_page - 1) < total_lines;
      button := buttons.first;
      WHILE button <> NIL DO
        button_x_position := button_x_position - 1 - button^.name_size;
        IF button^.field <> 0 THEN
          csp$delete_field (button^.field, status);
          IF NOT status.normal THEN
            EXIT clp$scl_parameter_dialog_mgr;
          IFEND;
          button^.field := 0;
        IFEND;
        IF button^.active THEN
          button_field [x_position_attribute].x_position := button_x_position;
          button_field [visible_characters_attribute].visible_characters := button^.name_size;
          button_field [characters_attribute].characters := button_field [3].visible_characters;
          csp$allocate_field (button_field, button^.field, status);
          IF NOT status.normal THEN
            EXIT clp$scl_parameter_dialog_mgr;
          IFEND;
          csp$change_io_position (button^.field, 1, status);
          IF NOT status.normal THEN
            EXIT clp$scl_parameter_dialog_mgr;
          IFEND;
          end_of_text := FALSE;
          csp$put_text (^button^.name (1, button^.name_size), TRUE, end_of_text, status);
          IF NOT status.normal THEN
            EXIT clp$scl_parameter_dialog_mgr;
          IFEND;
        IFEND;
        button := button^.link;
      WHILEND;

    PROCEND update_lines_l_thru_m_of_n;
?? TITLE := 'update_parameter_display', EJECT ??

    PROCEDURE update_parameter_display;


      IF display.parameter_count > 0 THEN
        parameter_number := display.top_parameter;
        WHILE (parameter_number <= display.parameter_count) AND
              ((parameter_number - display.top_parameter) < display.parameters_displayed) DO
          IF (NOT parameter_information^ [parameter_number].advanced_indicator) AND
                (NOT parameter_information^ [parameter_number].initialized) THEN
            initialize_prompt_and_value (parameter_information^ [parameter_number].pdt_number);
          IFEND;
          display_prompt_and_value;
          parameter_number := parameter_number + 1;
        WHILEND;

        update_lines_l_thru_m_of_n (display.top_parameter, display.parameters_displayed,
              display.parameter_count, display.line_number_field, display.buttons);
      IFEND;

    PROCEND update_parameter_display;
?? TITLE := 'update_window_display', EJECT ??

    PROCEDURE update_window_display
      (    window_kind: clt$window_kind);

      VAR
        end_of_text: boolean,
        i: 0 .. csc$max_line_number,
        text: ^string ( * );


      CASE window_kind OF
      = clc$help_window =
        FOR i := 1 TO help_window.lines_displayed DO
          csp$change_io_position (help_window.text_field, i, status);
          IF NOT status.normal THEN
            EXIT clp$scl_parameter_dialog_mgr;
          IFEND;
          IF help_window.contents^ [i + help_window.top - 1] <> NIL THEN
            text := help_window.contents^ [i + help_window.top - 1];
          ELSE
            PUSH text: [0];
          IFEND;
          csp$put_text (text, TRUE, end_of_text, status);
          IF NOT status.normal THEN
            EXIT clp$scl_parameter_dialog_mgr;
          IFEND;
        FOREND;
        update_lines_l_thru_m_of_n (help_window.top, help_window.lines_displayed, help_window.line_count,
              help_window.line_number_field, help_window.buttons);
      = clc$message_window =
        FOR i := 1 TO message_window.lines_displayed DO
          csp$change_io_position (message_window.text_field, i, status);
          IF NOT status.normal THEN
            EXIT clp$scl_parameter_dialog_mgr;
          IFEND;
          csp$put_text (message_window.contents^ [i + message_window.top - 1], TRUE, end_of_text, status);
          IF NOT status.normal THEN
            EXIT clp$scl_parameter_dialog_mgr;
          IFEND;
        FOREND;
        update_lines_l_thru_m_of_n (message_window.top, message_window.lines_displayed,
              message_window.line_count, message_window.line_number_field, message_window.buttons);
      = clc$zoom_window =
        FOR i := 1 TO zoom_window.lines_displayed DO
          csp$change_io_position (zoom_window.text_field, i, status);
          IF NOT status.normal THEN
            EXIT clp$scl_parameter_dialog_mgr;
          IFEND;
          IF zoom_window.contents^ [i + zoom_window.top - 1] <> NIL THEN
            text := zoom_window.contents^ [i + zoom_window.top - 1];
          ELSE
            PUSH text: [0];
          IFEND;
          csp$put_text (text, TRUE, end_of_text, status);
          IF NOT status.normal THEN
            EXIT clp$scl_parameter_dialog_mgr;
          IFEND;
        FOREND;
        update_lines_l_thru_m_of_n (zoom_window.top, zoom_window.lines_displayed, zoom_window.line_count,
              zoom_window.line_number_field, zoom_window.buttons);
      ELSE
      CASEND;

    PROCEND update_window_display;
?? TITLE := 'zoom_command_line', EJECT ??

    PROCEDURE zoom_command_line;

      VAR
        box_lines: 0 .. csc$max_line_number,
        message_text: string (csc$max_x_position),
        text_length: 0 .. csc$max_x_position,
        title_text: string (csc$max_x_position),
        title_text_length: 0 .. csc$max_x_position;


      IF dialog_box_max_lines < clc$maximum_zoom_lines THEN
        box_lines := dialog_box_max_lines;
      ELSE
        box_lines := clc$maximum_zoom_lines;
      IFEND;

      change_menu_items (display.current_window, clc$zoom_window);
      get_function_key_message (clc$enter_command, NIL, message_text, text_length);
      get_message_text (clc$enter_command_title, NIL, title_text, title_text_length);
      create_window (clc$zoom_window, 1, dialog_box_top, display.screen_width, box_lines,
            message_text (1, text_length), title_text (1, title_text_length), FALSE);
      display_text_in_window (clc$zoom_window, display.command_text);
      update_lines_l_thru_m_of_n (zoom_window.top, zoom_window.lines_displayed, zoom_window.line_count,
            zoom_window.line_number_field, zoom_window.buttons);
      clear_command_field;

    PROCEND zoom_command_line;
?? TITLE := 'zoom_parameter', EJECT ??

    PROCEDURE zoom_parameter;

      VAR
        box_lines: 0 .. csc$max_line_number,
        i: cst$visible_character_position,
        message_text: string (csc$max_x_position),
        pdt_number: clt$parameter_number,
        text_length: 0 .. csc$max_x_position,
        title_text: string (csc$max_x_position),
        title_length: 0 .. csc$max_x_position;

?? NEWTITLE := 'zoom_boolean_parameter', EJECT ??

      PROCEDURE zoom_boolean_parameter;

        VAR
          boolean_items: array [1 .. 4] of clt$data_value,
          evaluate_the_parameter: boolean,
          ignore_selected_action: ^clt$data_value,
          ignore_selected_item_index: ^clt$data_value,
          items: ^clt$data_value,
          item_representation: ^clt$data_representation,
          item_representation_count: ^clt$data_representation_count,
          item_text: ^clt$string_value,
          parameter_value: clt$parameter_value,
          preselected_item: ^clt$data_value,
          reset_the_parameter: boolean,
          selected_item: ^clt$data_value,
          work_area: ^clt$work_area;


{ Create a clc$list clt$data_value to represent the booleans.

        boolean_items [1].kind := clc$list;
        boolean_items [1].element_value := ^boolean_items [2];
        boolean_items [1].link := ^boolean_items [3];
        boolean_items [1].generated_via_list_rest := FALSE;
        boolean_items [2].kind := clc$boolean;
        boolean_items [2].boolean_value.value := TRUE;
        boolean_items [2].boolean_value.kind := clc$yes_no_boolean;
        boolean_items [3].kind := clc$list;
        boolean_items [3].element_value := ^boolean_items [4];
        boolean_items [3].link := NIL;
        boolean_items [3].generated_via_list_rest := FALSE;
        boolean_items [4].kind := clc$boolean;
        boolean_items [4].boolean_value.value := FALSE;
        boolean_items [4].boolean_value.kind := clc$yes_no_boolean;

        items := ^boolean_items [1];
        preselected_item := NIL;

{ In order to obtain the a the item (boolean) to be preselected it may
{ be necessary to evaluate the parameter.  If so, there are two cases:
{ the user entered a value which has not yet been evaluated, or the
{ parameter's default must be evaluated.  In the latter case it is
{ necessary to restore the parameter's default after completing the
{ call to eup$get_item_selections.

      /get_preselected_item/
        BEGIN
          support.get_parameter_value^ (pdt_number, parameter_value, status);
          IF NOT status.normal THEN
            EXIT clp$scl_parameter_dialog_mgr;
          ELSEIF parameter_information^ [parameter_number].evaluation_required THEN
            evaluate_the_parameter := TRUE;
            reset_the_parameter := FALSE;
          ELSEIF parameter_value.specified THEN
            evaluate_the_parameter := FALSE;
            reset_the_parameter := FALSE;
          ELSEIF parameter_information^ [parameter_number].value^ <> '' THEN
            evaluate_the_parameter := TRUE;
            reset_the_parameter := TRUE;
          ELSE
            EXIT /get_preselected_item/;
          IFEND;
          IF evaluate_the_parameter THEN
            support.evaluate_parameter^ (pdt_number, parameter_information^ [parameter_number].value^,
                  status);
            IF NOT status.normal THEN
              status.normal := TRUE;
              EXIT /get_preselected_item/;
            IFEND;
            support.get_parameter_value^ (pdt_number, parameter_value, status);
            IF NOT status.normal THEN
              EXIT clp$scl_parameter_dialog_mgr;
            IFEND;
          IFEND;
          IF parameter_value.value <> NIL THEN
            PUSH preselected_item;
            preselected_item^.kind := clc$list;
            preselected_item^.element_value := parameter_value.value;
            preselected_item^.link := NIL;
            preselected_item^.generated_via_list_rest := FALSE;
          IFEND;
        END /get_preselected_item/;

{ Create a work_area large enough to hold a clc$list clt$data_value containing
{ an item (boolean), the source representation of that boolean, and
{ a clc$list clt$data_value containing the index of the selected item.

        PUSH work_area: [[REP 2 * 2 OF clt$data_value, clt$data_representation_count,
              clt$string_size, REP osc$max_name_size OF char]];
        RESET work_area;

        eup$get_item_selections (items, preselected_item, FALSE, NIL,
              ^parameter_information^ [parameter_number].name, clc$dialog_box_inset,
              dialog_box_top + 1, osc$max_name_size, NIL, work_area, ignore_selected_action,
              selected_item, ignore_selected_item_index, status);
        IF NOT status.normal THEN
          IF status.condition = cle$command_cancelled THEN
            status.normal := TRUE;
            IF reset_the_parameter THEN
              support.restore_parameter_default^ (pdt_number, status);
              IF NOT status.normal THEN
                EXIT clp$scl_parameter_dialog_mgr;
              IFEND;
            IFEND;
            RETURN;
          IFEND;
          EXIT clp$scl_parameter_dialog_mgr;
        IFEND;

        IF reset_the_parameter THEN
          support.restore_parameter_default^ (pdt_number, status);
          IF NOT status.normal THEN
            EXIT clp$scl_parameter_dialog_mgr;
          IFEND;
        IFEND;

        IF (selected_item = NIL) OR (selected_item^.element_value = NIL) THEN
          RETURN;
        IFEND;
        selected_item := selected_item^.element_value;

{ clc$labelled_elem_representation is used rather than clc$data_source_representation
{ so that the boolean will be displayed in lower case

        clp$convert_data_to_string (selected_item, clc$labeled_elem_representation, clc$max_string_size,
              work_area, item_representation, status);
        IF NOT status.normal THEN
          EXIT clp$scl_parameter_dialog_mgr;
        IFEND;
        item_text := clp$data_representation_text (item_representation);

        IF parameter_information^ [parameter_number].value^ = item_text^ THEN
          RETURN;
        IFEND;

        FREE parameter_information^ [parameter_number].value;
        ALLOCATE parameter_information^ [parameter_number].value: [STRLENGTH (item_text^)];
        parameter_information^ [parameter_number].value^ := item_text^;
        parameter_information^ [parameter_number].evaluation_required := TRUE;
        parameter_information^ [parameter_number].too_big_to_edit := FALSE;

        update_parameters := TRUE;

      PROCEND zoom_boolean_parameter;
?? TITLE := 'zoom_file_parameter', EJECT ??

      PROCEDURE zoom_file_parameter;

        VAR
          ignore_selected_action: ^clt$data_value,
          initial_file_reference: ^fst$file_reference,
          selected_file: ^fst$file_reference,
          selected_file_container: string (fsc$max_path_size);


        IF parameter_information^ [parameter_number].value^ <> '' THEN
          initial_file_reference := parameter_information^ [parameter_number].value;
        ELSE
          initial_file_reference := ^current_file_selection;
        IFEND;

        eup$get_file_selection (initial_file_reference^, ^parameter_information^ [parameter_number].name,
              clc$dialog_box_inset, dialog_box_top + 1, NIL, NIL, selected_file_container, selected_file,
              ignore_selected_action, status);
        IF NOT status.normal THEN
          IF status.condition = cle$command_cancelled THEN
            status.normal := TRUE;
            RETURN;
          IFEND;
          EXIT clp$scl_parameter_dialog_mgr;
        IFEND;

        IF parameter_information^ [parameter_number].value^ = selected_file^ THEN
          RETURN;
        IFEND;

        current_file_selection := selected_file^;

        FREE parameter_information^ [parameter_number].value;
        ALLOCATE parameter_information^ [parameter_number].value: [STRLENGTH (selected_file^)];
        #TRANSLATE (osv$upper_to_lower, selected_file^, parameter_information^ [parameter_number].value^);
        parameter_information^ [parameter_number].evaluation_required := TRUE;
        parameter_information^ [parameter_number].too_big_to_edit := FALSE;

        update_parameters := TRUE;

      PROCEND zoom_file_parameter;
?? TITLE := 'zoom_keyword_parameter', EJECT ??

      PROCEDURE zoom_keyword_parameter
        (    multiple_selections: boolean;
             keywords: ^clt$keyword_specifications);

        CONST
          advanced_keyword_separator = '-------------------------------';

        VAR
          current_keyword: 0 .. clc$max_keywords,
          evaluate_the_parameter: boolean,
          first_advanced_keyword: 0 .. clc$max_keywords,
          i: 1 .. clc$max_keywords,
          ignore_selected_action: ^clt$data_value,
          ignore_selected_item_indices: ^clt$data_value,
          items: ^clt$data_value,
          item_count: 0 .. clc$max_keywords,
          item_node: ^^clt$data_value,
          items_representation: ^clt$data_representation,
          items_representation_count: ^clt$data_representation_count,
          items_text: ^clt$string_value,
          keyword_items: ^array [1 .. * ] of clt$data_value,
          parameter_value: clt$parameter_value,
          preselected_items: ^clt$data_value,
          reset_the_parameter: boolean,
          selected_items: ^clt$data_value,
          work_area: ^clt$work_area;


{ Count the number of items (keywords) to be presented .

        first_advanced_keyword := 0;
        item_count := 0;

        FOR i := 1 TO UPPERBOUND (keywords^) DO
          IF keywords^ [i].class = clc$nominal_entry THEN
            CASE keywords^ [i].availability OF
            = clc$normal_usage_entry =
              item_count := item_count + 1;
            = clc$advanced_usage_entry =

{ Present all advanced usage keywords following normal usage keywords
{ preceeded by a separating line.

              IF first_advanced_keyword = 0 THEN
                first_advanced_keyword := i;
                item_count := item_count + 1;
              IFEND;
              item_count := item_count + 1;
            ELSE {clc$hidden_usage_entry}

{ Do not present hidden usage keywords.

            CASEND;
          IFEND;
        FOREND;

{ Create a clc$list clt$data_value to represent the keywords to be presented.

        PUSH keyword_items: [1 .. item_count * 2];
        current_keyword := 0;

        FOR i := 1 TO UPPERBOUND (keywords^) DO
          IF (keywords^ [i].class = clc$nominal_entry) AND
                (keywords^ [i].availability = clc$normal_usage_entry) THEN
            current_keyword := current_keyword + 1;
            keyword_items^ [current_keyword].kind := clc$keyword;
            keyword_items^ [current_keyword].keyword_value := keywords^ [i].keyword;
          IFEND;
        FOREND;

        IF first_advanced_keyword > 0 THEN
          current_keyword := current_keyword + 1;
          keyword_items^ [current_keyword].kind := clc$keyword;
          keyword_items^ [current_keyword].keyword_value := advanced_keyword_separator;
          FOR i := first_advanced_keyword TO UPPERBOUND (keywords^) DO
            IF (keywords^ [i].class = clc$nominal_entry) AND
                  (keywords^ [i].availability = clc$advanced_usage_entry) THEN
              current_keyword := current_keyword + 1;
              keyword_items^ [current_keyword].kind := clc$keyword;
              keyword_items^ [current_keyword].keyword_value := keywords^ [i].keyword;
            IFEND;
          FOREND;
        IFEND;

        FOR i := item_count + 1 TO item_count * 2 DO
          keyword_items^ [i].kind := clc$list;
          keyword_items^ [i].element_value := ^keyword_items^ [i - item_count];
          IF i < (item_count * 2) THEN
            keyword_items^ [i].link := ^keyword_items^ [i + 1];
          ELSE
            keyword_items^ [i].link := NIL;
          IFEND;
          keyword_items^ [i].generated_via_list_rest := FALSE;
        FOREND;

        items := ^keyword_items^ [item_count + 1];
        preselected_items := NIL;

{ In order to obtain the a list if the items (keywords) to be preselected
{ it may be necessary to evaluate the parameter.  If so, there are two
{ cases: the user entered a value which has not yet been evaluated, or
{ the parameter's default must be evaluated.  In the latter case it is
{ necessary to restore the parameter's default after completing the
{ call to eup$get_item_selections.

      /get_preselected_items/
        BEGIN
          support.get_parameter_value^ (pdt_number, parameter_value, status);
          IF NOT status.normal THEN
            EXIT clp$scl_parameter_dialog_mgr;
          ELSEIF parameter_information^ [parameter_number].evaluation_required THEN
            evaluate_the_parameter := TRUE;
            reset_the_parameter := FALSE;
          ELSEIF parameter_value.specified THEN
            evaluate_the_parameter := FALSE;
            reset_the_parameter := FALSE;
          ELSEIF parameter_information^ [parameter_number].value^ <> '' THEN
            evaluate_the_parameter := TRUE;
            reset_the_parameter := TRUE;
          ELSE
            EXIT /get_preselected_items/;
          IFEND;
          IF evaluate_the_parameter THEN
            support.evaluate_parameter^ (pdt_number, parameter_information^ [parameter_number].value^,
                  status);
            IF NOT status.normal THEN
              status.normal := TRUE;
              EXIT /get_preselected_items/;
            IFEND;
            support.get_parameter_value^ (pdt_number, parameter_value, status);
            IF NOT status.normal THEN
              EXIT clp$scl_parameter_dialog_mgr;
            IFEND;
          IFEND;
          IF parameter_value.value <> NIL THEN
            IF multiple_selections THEN
              preselected_items := parameter_value.value;
            ELSE
              PUSH preselected_items;
              preselected_items^.kind := clc$list;
              preselected_items^.element_value := parameter_value.value;
              preselected_items^.link := NIL;
              preselected_items^.generated_via_list_rest := FALSE;
            IFEND;
          IFEND;
        END /get_preselected_items/;

{ Create a work_area large enough to hold a clc$list clt$data_value containing
{ all presented items (keywords), the source representation of that list, and
{ a clc$list clt$data_value containing indices for all presented items.

        PUSH work_area: [[REP item_count * 2 * 2 OF clt$data_value, clt$data_representation_count,
              clt$string_size, REP item_count * (osc$max_name_size + 2) OF char]];
        RESET work_area;

        eup$get_item_selections (items, preselected_items, multiple_selections, NIL,
              ^parameter_information^ [parameter_number].name, clc$dialog_box_inset,
              dialog_box_top + 1, osc$max_name_size, NIL, work_area, ignore_selected_action,
              selected_items, ignore_selected_item_indices, status);
        IF NOT status.normal THEN
          IF status.condition = cle$command_cancelled THEN
            status.normal := TRUE;
            IF reset_the_parameter THEN
              support.restore_parameter_default^ (pdt_number, status);
              IF NOT status.normal THEN
                EXIT clp$scl_parameter_dialog_mgr;
              IFEND;
            IFEND;
            RETURN;
          IFEND;
          EXIT clp$scl_parameter_dialog_mgr;
        IFEND;

        IF reset_the_parameter THEN
          support.restore_parameter_default^ (pdt_number, status);
          IF NOT status.normal THEN
            EXIT clp$scl_parameter_dialog_mgr;
          IFEND;
        IFEND;

        IF first_advanced_keyword > 0 THEN
          item_node := ^selected_items;

{ Ensure that the separator between "normal" and "advanced" keywords is not
{ present in the result list.

        /remove_separator/
          WHILE item_node^ <> NIL DO
            IF item_node^^.element_value^.keyword_value = advanced_keyword_separator THEN
              item_node^ := item_node^^.link;
              EXIT /remove_separator/;
            IFEND;
            item_node := ^item_node^^.link;
          WHILEND /remove_separator/;
        IFEND;

        IF (selected_items = NIL) OR (selected_items^.element_value = NIL) THEN
          RETURN;
        ELSEIF NOT multiple_selections THEN
          selected_items := selected_items^.element_value;
        IFEND;

{ clc$labelled_elem_representation is used rather than clc$data_source_representation
{ so that the keywords will be displayed in lower case

        clp$convert_data_to_string (selected_items, clc$labeled_elem_representation, clc$max_string_size,
              work_area, items_representation, status);
        IF NOT status.normal THEN
          EXIT clp$scl_parameter_dialog_mgr;
        IFEND;
        items_text := clp$data_representation_text (items_representation);

        IF parameter_information^ [parameter_number].value^ = items_text^ THEN
          RETURN;
        IFEND;

        FREE parameter_information^ [parameter_number].value;
        ALLOCATE parameter_information^ [parameter_number].value: [STRLENGTH (items_text^)];
        parameter_information^ [parameter_number].value^ := items_text^;
        parameter_information^ [parameter_number].evaluation_required := TRUE;

        RESET items_representation;
        NEXT items_representation_count IN items_representation;
        parameter_information^ [parameter_number].too_big_to_edit := (items_representation_count^ > 1);

        update_parameters := TRUE;

      PROCEND zoom_keyword_parameter;
?? TITLE := 'zoom_record_parameter', EJECT ??

      PROCEDURE zoom_record_parameter;

        VAR
          evaluate_the_parameter: boolean,
          expression_text: ^clt$expression_text,
          parameter_value: clt$parameter_value,
          reset_the_parameter: boolean,
          value_representation: ^clt$data_representation,
          value_representation_count: ^clt$data_representation_count,
          value_representation_text: ^clt$string_value;


{ In order to obtain the current field values it may be necessary to evaluate
{ the parameter.  If so, there are two cases: the user entered a value which
{ has not yet been evaluated, or the parameter's default must be evaluated.
{ In the latter case it is necessary to restore the parameter's default after
{ completing the call to support.nested_dialog.

      /establish_current_values/
        BEGIN
          support.get_parameter_value^ (pdt_number, parameter_value, status);
          IF NOT status.normal THEN
            EXIT clp$scl_parameter_dialog_mgr;
          ELSEIF parameter_information^ [parameter_number].evaluation_required THEN
            evaluate_the_parameter := TRUE;
            reset_the_parameter := FALSE;
          ELSEIF parameter_value.specified THEN
            evaluate_the_parameter := FALSE;
            reset_the_parameter := FALSE;
          ELSEIF parameter_information^ [parameter_number].value^ <> '' THEN
            evaluate_the_parameter := TRUE;
            reset_the_parameter := TRUE;
          ELSE
            EXIT /establish_current_values/;
          IFEND;
          IF evaluate_the_parameter THEN
            support.evaluate_parameter^ (pdt_number, parameter_information^ [parameter_number].value^,
                  status);
            IF NOT status.normal THEN
              status.normal := TRUE;
            IFEND;
          IFEND;
        END /establish_current_values/;

        support.get_parameter_value_source^ (pdt_number, clc$max_string_size, value_representation, status);
        IF status.normal THEN
          value_representation_text := clp$data_representation_text (value_representation);
          PUSH expression_text: [STRLENGTH (value_representation_text^)];
          expression_text^ := value_representation_text^;
        ELSE
          PUSH expression_text: [0];
        IFEND;

        support.nested_dialog^ (expression_text^, pdt.type_descriptions^ [pdt_number].fields_pdt^,
              parameter_information^ [parameter_number].name, clc$max_string_size, value_representation,
              status);
        IF NOT status.normal THEN
          IF (status.condition = cle$command_cancelled) OR (status.condition = cle$function_cancelled) THEN
            status.normal := TRUE;
            IF reset_the_parameter THEN
              support.restore_parameter_default^ (pdt_number, status);
              IF NOT status.normal THEN
                EXIT clp$scl_parameter_dialog_mgr;
              IFEND;
            IFEND;
            RETURN;
          IFEND;
          EXIT clp$scl_parameter_dialog_mgr;
        IFEND;

        value_representation_text := clp$data_representation_text (value_representation);

        IF parameter_information^ [parameter_number].value^ = value_representation_text^ THEN
          IF reset_the_parameter THEN
            support.restore_parameter_default^ (pdt_number, status);
            IF NOT status.normal THEN
              EXIT clp$scl_parameter_dialog_mgr;
            IFEND;
          IFEND;
          RETURN;
        IFEND;

        FREE parameter_information^ [parameter_number].value;
        ALLOCATE parameter_information^ [parameter_number].value: [STRLENGTH (value_representation_text^)];
        parameter_information^ [parameter_number].value^ := value_representation_text^;
        parameter_information^ [parameter_number].evaluation_required := TRUE;

        RESET value_representation;
        NEXT value_representation_count IN value_representation;
        parameter_information^ [parameter_number].too_big_to_edit := (value_representation_count^ > 1);

        update_parameters := TRUE;

        IF reset_the_parameter THEN
          support.restore_parameter_default^ (pdt_number, status);
          IF NOT status.normal THEN
            EXIT clp$scl_parameter_dialog_mgr;
          IFEND;
        IFEND;

      PROCEND zoom_record_parameter;
?? OLDTITLE, EJECT ??

      pdt_number := parameter_information^ [parameter_number].pdt_number;

      IF (pdt.parameters^ [pdt_number].passing_method = clc$pass_by_value) AND
         (action_number <> edit_zoom_event) THEN
        CASE pdt.type_descriptions^ [pdt_number].kind OF
        = clc$boolean_type =
          zoom_boolean_parameter;
          RETURN;
        = clc$file_type =
          zoom_file_parameter;
          RETURN;
        = clc$keyword_type =
          zoom_keyword_parameter (FALSE, pdt.type_descriptions^ [pdt_number].keyword_specifications);
          RETURN;
        = clc$list_type =
          IF (pdt.type_descriptions^ [pdt_number].list_element_type_description <> NIL) AND
                (pdt.type_descriptions^ [pdt_number].list_element_type_description^.kind =
                clc$keyword_type) THEN
            zoom_keyword_parameter (TRUE, pdt.type_descriptions^ [pdt_number].
                  list_element_type_description^.keyword_specifications);
            RETURN;
          IFEND;
        = clc$record_type =
          zoom_record_parameter;
          RETURN;
        ELSE
          ;
        CASEND;
      IFEND;

      IF dialog_box_max_lines < clc$maximum_zoom_lines THEN
        box_lines := dialog_box_max_lines;
      ELSE
        box_lines := clc$maximum_zoom_lines;
      IFEND;
      title_length := STRLENGTH (parameter_information^ [parameter_number].prompt);

      change_menu_items (display.current_window, clc$zoom_window);

    /left_justify_title/
      FOR i := 1 TO STRLENGTH (parameter_information^ [parameter_number].prompt) DO
        IF parameter_information^ [parameter_number].prompt (i) <> ' ' THEN
          EXIT /left_justify_title/;
        IFEND;
        title_length := title_length - 1;
      FOREND /left_justify_title/;
      get_function_key_message (clc$enter_parameter_value, NIL, message_text, text_length);
      title_text := ' ';
      title_text (2, title_length) := parameter_information^ [parameter_number].prompt (i, title_length);
      IF title_length <> 0 THEN
        create_window (clc$zoom_window, 1, dialog_box_top, display.screen_width, box_lines,
              message_text (1, text_length), title_text (1, title_length + 2),
              parameter_information^ [parameter_number].too_big_to_edit);
      ELSE
        create_window (clc$zoom_window, 1, dialog_box_top, display.screen_width, box_lines,
              message_text (1, text_length), ' ', FALSE);
      IFEND;
      display_text_in_window (clc$zoom_window, parameter_information^ [parameter_number].value);
      update_lines_l_thru_m_of_n (zoom_window.top, zoom_window.lines_displayed, zoom_window.line_count,
            zoom_window.line_number_field, zoom_window.buttons);
      zoom_window.parameter_value := TRUE;
      zoom_window.parameter_number := parameter_number;
      zoom_window.changeable := NOT parameter_information^ [parameter_number].too_big_to_edit;
      IF parameter_information^ [parameter_number].too_big_to_edit THEN
        get_message_text (clc$too_big_to_edit, NIL, message_text, text_length);
        display_message (message_text (1, text_length));
      IFEND;

    PROCEND zoom_parameter;
?? OLDTITLE, EJECT ??

    initial_status := status;
    status.normal := TRUE;
    cancel := FALSE;
    cleared_parameters := NIL;
    current_file_selection := ':$WORKING_CATALOG';
    display.command_text := NIL;
    display.help_window_displayed := FALSE;
    display.message_window_displayed := FALSE;
    display.zoom_window_displayed := FALSE;
    display.current_window := clc$no_window;
    display.screen_width := 1;
    display.screen_height := 1;
    display.help_module := NIL;
    entered_screen_mode := FALSE;
    ignore_tab_caused_by_next := FALSE;
    input_file_opened := FALSE;
    menu_classes := NIL;
    menu_classes_copy := NIL;
    menu_list := NIL;
    menu_list_copy := NIL;
    message_displayed := FALSE;
    message_field_width := 0;
    message_read := FALSE;
    parameter_display_info := NIL;
    parameter_information := NIL;
    status_condition_name := '';
    update_parameters := FALSE;

    osp$establish_condition_handler (^condition_handler, TRUE);

    editing_parameter_list := support.change_expression_save <> NIL;
    construct_parameter_information;
    setup_display;
    process_keyboard;
    shut_down ({ignore_errors =} FALSE);
    osp$disestablish_cond_handler;

  PROCEND clp$scl_parameter_dialog_mgr;

MODEND clm$scl_parameter_dialog;
