?? RIGHT := 110 ??
?? NEWTITLE := 'NOS/VE SCL Interpreter : Change Interactive Style Command' ??
MODULE osm$change_interact_style_cmnd;

{
{ PURPOSE:
{   This module contains the processor for the change_interactive_style command.
{

?? NEWTITLE := 'Global Declarations', EJECT ??
?? PUSH (LISTEXT := ON) ??
*copyc clt$data_value
*copyc clt$parameter_list
*copyc clt$work_area
*copyc ost$status
?? POP ??
*copyc clp$build_standard_title
*copyc clp$close_display
*copyc clp$convert_data_to_string
*copyc clp$convert_integer_to_string
*copyc clp$evaluate_parameters
*copyc clp$get_work_area
*copyc clp$make_boolean_value
*copyc clp$make_keyword_value
*copyc clp$make_integer_value
*copyc clp$make_record_value
*copyc clp$new_display_line
*copyc clp$open_display_reference
*copyc clp$put_data_representation
*copyc clp$put_display
*copyc clp$reset_for_next_display_page
*copyc clv$nil_display_control
*copyc ifp$fetch_context
*copyc osp$change_interaction_info
*copyc osp$disestablish_cond_handler
*copyc osp$establish_block_exit_hndlr
*copyc osp$get_interaction_information
?? TITLE := 'osp$_change_interaction_informa', EJECT ??

  PROCEDURE [XDCL] osp$_change_interaction_informa
    (    parameter_list: clt$parameter_list;
     VAR status: ost$status);

{ PROCEDURE (osm$chais) change_interaction_information, change_interaction_style, chais, chaii (
{   style, s: key
{       (line, l)
{       (screen, s)
{     keyend = $optional
{   menu_rows, menu_row, mr: (BY_NAME) integer 0 .. csc$number_of_menu_rows = $optional
{   extend_utility_interaction, eui: (BY_NAME) boolean = $optional
{   status)

?? PUSH (LISTEXT := ON) ??
?? FMT (FORMAT := OFF) ??

  VAR
    pdt: [STATIC, READ, cls$declaration_section] record
      header: clt$pdt_header,
      names: array [1 .. 8] of clt$pdt_parameter_name,
      parameters: array [1 .. 4] of clt$pdt_parameter,
      type1: record
        header: clt$type_specification_header,
        qualifier: clt$keyword_type_qualifier,
        keyword_specs: array [1 .. 4] of clt$keyword_specification,
      recend,
      type2: record
        header: clt$type_specification_header,
        qualifier: clt$integer_type_qualifier,
      recend,
      type3: record
        header: clt$type_specification_header,
      recend,
      type4: record
        header: clt$type_specification_header,
      recend,
    recend := [
    [1,
    [89, 5, 25, 14, 8, 20, 851],
    clc$command, 8, 4, 0, 0, 0, 0, 4, 'OSM$CHAIS'], [
    ['EUI                            ',clc$abbreviation_entry, 3],
    ['EXTEND_UTILITY_INTERACTION     ',clc$nominal_entry, 3],
    ['MENU_ROW                       ',clc$alias_entry, 2],
    ['MENU_ROWS                      ',clc$nominal_entry, 2],
    ['MR                             ',clc$abbreviation_entry, 2],
    ['S                              ',clc$abbreviation_entry, 1],
    ['STATUS                         ',clc$nominal_entry, 4],
    ['STYLE                          ',clc$nominal_entry, 1]],
    [
{ PARAMETER 1
    [8, clc$normal_usage_entry, clc$non_secure_parameter,
    $clt$parameter_spec_methods[clc$specify_by_name, clc$specify_positionally],
    clc$pass_by_value, clc$immediate_evaluation, clc$standard_parameter_checking, 155,
  clc$optional_parameter, 0, 0],
{ PARAMETER 2
    [4, clc$normal_usage_entry, clc$non_secure_parameter,
    $clt$parameter_spec_methods[clc$specify_by_name],
    clc$pass_by_value, clc$immediate_evaluation, clc$standard_parameter_checking, 20, clc$optional_parameter,
  0, 0],
{ PARAMETER 3
    [2, clc$normal_usage_entry, clc$non_secure_parameter,
    $clt$parameter_spec_methods[clc$specify_by_name],
    clc$pass_by_value, clc$immediate_evaluation, clc$standard_parameter_checking, 3, clc$optional_parameter, 0
  , 0],
{ PARAMETER 4
    [7, clc$normal_usage_entry, clc$non_secure_parameter,
    $clt$parameter_spec_methods[clc$specify_by_name],
    clc$pass_by_reference, clc$immediate_evaluation, clc$standard_parameter_checking, 3,
  clc$optional_parameter, 0, 0]],
{ PARAMETER 1
    [[1, 0, clc$keyword_type], [4], [
    ['L                              ', clc$abbreviation_entry, clc$normal_usage_entry, 1],
    ['LINE                           ', clc$nominal_entry, clc$normal_usage_entry, 1],
    ['S                              ', clc$abbreviation_entry, clc$normal_usage_entry, 2],
    ['SCREEN                         ', clc$nominal_entry, clc$normal_usage_entry, 2]]
    ],
{ PARAMETER 2
    [[1, 0, clc$integer_type], [0, csc$number_of_menu_rows, 10]],
{ PARAMETER 3
    [[1, 0, clc$boolean_type]],
{ PARAMETER 4
    [[1, 0, clc$status_type]]];

?? FMT (FORMAT := ON) ??
?? POP ??

    CONST
      p$style = 1,
      p$menu_rows = 2,
      p$extend_utility_interaction = 3,
      p$status = 4;

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

    VAR
      index: 0 .. p$status - 1,
      interaction_information: ^ost$interaction_information,
      parameter_count: 0 .. p$status - 1;


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

    parameter_count := 0;
    FOR index := 1 TO p$status - 1 DO
      IF pvt [index].specified THEN
        parameter_count := parameter_count + 1;
      IFEND;
    FOREND;
    IF parameter_count = 0 THEN
      RETURN;
    IFEND;

    PUSH interaction_information: [1 .. parameter_count];
    index := 0;

    IF pvt [p$style].specified THEN
      index := index + 1;
      interaction_information^ [index].key := osc$interaction_style;
      IF pvt [p$style].value^.keyword_value = 'LINE' THEN
        interaction_information^ [index].style := osc$line_interaction;
      ELSE
        interaction_information^ [index].style := osc$screen_interaction;
      IFEND;
    IFEND;

    IF pvt [p$menu_rows].specified THEN
      index := index + 1;
      interaction_information^ [index].key := osc$menu_rows;
      interaction_information^ [index].menu_rows := pvt [p$menu_rows].value^.integer_value.value;
    IFEND;

    IF pvt [p$extend_utility_interaction].specified THEN
      index := index + 1;
      interaction_information^ [index].key := osc$extend_utility_interaction;
      interaction_information^ [index].extend_utility_interaction := pvt [p$extend_utility_interaction].
            value^.boolean_value.value;
    IFEND;

    osp$change_interaction_info (interaction_information^, status);

  PROCEND osp$_change_interaction_informa;
?? TITLE := 'osp$$interaction_style', EJECT ??

  PROCEDURE [XDCL] osp$$interaction_style
    (    parameter_list: clt$parameter_list;
     VAR work_area {input, output} : ^clt$work_area;
     VAR result: ^clt$data_value;
     VAR status: ost$status);

{ FUNCTION (osm$$ints) $interaction_style (
{   option: key
{       style
{       (menu_rows, menu_row, mr)
{       (extend_utility_interaction, eui)
{       (last_operation_style, los)
{       (line, l)
{       (screen, s)
{       (desktop, dt, d)
{     keyend = style
{   )

?? PUSH (LISTEXT := ON) ??
?? FMT (FORMAT := OFF) ??

  VAR
    pdt: [STATIC, READ, cls$declaration_section] record
      header: clt$pdt_header,
      names: array [1 .. 1] of clt$pdt_parameter_name,
      parameters: array [1 .. 1] of clt$pdt_parameter,
      type1: record
        header: clt$type_specification_header,
        qualifier: clt$keyword_type_qualifier,
        keyword_specs: array [1 .. 15] of clt$keyword_specification,
        default_value: string (5),
      recend,
    recend := [
    [1,
    [90, 3, 3, 10, 25, 38, 558],
    clc$function, 1, 1, 0, 0, 0, 0, 0, 'OSM$$INTS'], [
    ['OPTION                         ',clc$nominal_entry, 1]],
    [
{ PARAMETER 1
    [1, clc$normal_usage_entry, clc$non_secure_parameter,
    $clt$parameter_spec_methods[clc$specify_positionally],
    clc$pass_by_value, clc$immediate_evaluation, clc$standard_parameter_checking, 562,
  clc$optional_default_parameter, 0, 5]],
{ PARAMETER 1
    [[1, 0, clc$keyword_type], [15], [
    ['D                              ', clc$abbreviation_entry, clc$normal_usage_entry, 7],
    ['DESKTOP                        ', clc$nominal_entry, clc$normal_usage_entry, 7],
    ['DT                             ', clc$alias_entry, clc$normal_usage_entry, 7],
    ['EUI                            ', clc$abbreviation_entry, clc$normal_usage_entry, 3],
    ['EXTEND_UTILITY_INTERACTION     ', clc$nominal_entry, clc$normal_usage_entry, 3],
    ['L                              ', clc$abbreviation_entry, clc$normal_usage_entry, 5],
    ['LAST_OPERATION_STYLE           ', clc$nominal_entry, clc$normal_usage_entry, 4],
    ['LINE                           ', clc$nominal_entry, clc$normal_usage_entry, 5],
    ['LOS                            ', clc$abbreviation_entry, clc$normal_usage_entry, 4],
    ['MENU_ROW                       ', clc$alias_entry, clc$normal_usage_entry, 2],
    ['MENU_ROWS                      ', clc$nominal_entry, clc$normal_usage_entry, 2],
    ['MR                             ', clc$abbreviation_entry, clc$normal_usage_entry, 2],
    ['S                              ', clc$abbreviation_entry, clc$normal_usage_entry, 6],
    ['SCREEN                         ', clc$nominal_entry, clc$normal_usage_entry, 6],
    ['STYLE                          ', clc$nominal_entry, clc$normal_usage_entry, 1]]
    ,
    'style']];

?? FMT (FORMAT := ON) ??
?? POP ??

    CONST
      p$option = 1;

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

    VAR
      interactive_context: array [1 .. 1] of ift$fetch_context_attribute,
      interaction_information: array [1 .. 3] of ost$interaction_info_item,
      keyword: ost$name,
      style: ost$interaction_style,
      style_boolean: boolean;


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

    interaction_information [1].key := osc$interaction_style;
    interaction_information [2].key := osc$menu_rows;
    interaction_information [3].key := osc$extend_utility_interaction;
    osp$get_interaction_information (interaction_information, status);
    IF NOT status.normal THEN
      RETURN;
    IFEND;

    IF pvt [p$option].value^.keyword_value = 'STYLE' THEN
      IF interaction_information [1].style = osc$line_interaction THEN
        keyword := 'LINE';
      ELSEIF interaction_information [1].style = osc$screen_interaction THEN
        keyword := 'SCREEN';
      ELSE
        keyword := 'DESKTOP';
      IFEND;
      clp$make_keyword_value (keyword, work_area, result);

    ELSEIF pvt [p$option].value^.keyword_value = 'MENU_ROWS' THEN
      clp$make_integer_value (interaction_information [2].menu_rows, 10, FALSE, work_area, result);

    ELSEIF pvt [p$option].value^.keyword_value = 'EXTEND_UTILITY_INTERACTION' THEN
      clp$make_boolean_value (interaction_information [3].extend_utility_interaction, clc$true_false_boolean,
            work_area, result);

    ELSEIF pvt [p$option].value^.keyword_value = 'LAST_OPERATION_STYLE' THEN
      IF interaction_information [1].style = osc$desktop_interaction THEN
        keyword := 'DESKTOP';
      ELSE
        interactive_context [1].key := ifc$previous_mode;
        ifp$fetch_context (interactive_context, status);
        IF NOT status.normal THEN
          RETURN;
        ELSEIF interactive_context [1].previous_mode = ifc$screen THEN
          keyword := 'SCREEN';
        ELSE
          keyword := 'LINE';
        IFEND;
      IFEND;
      clp$make_keyword_value (keyword, work_area, result);

    ELSE
      CASE pvt [p$option].value^.keyword_value (1) OF
      = 'L' =
        style := osc$line_interaction;
      = 'S' =
        style := osc$screen_interaction;
      = 'D' =
        style := osc$desktop_interaction;
      CASEND;
      clp$make_boolean_value (interaction_information [1].style = style, clc$true_false_boolean, work_area,
            result);
    IFEND;

  PROCEND osp$$interaction_style;
?? TITLE := 'osp$$interaction_information', EJECT ??

  PROCEDURE [XDCL] osp$$interaction_information
    (    parameter_list: clt$parameter_list;
     VAR work_area {input, output} : ^clt$work_area;
     VAR result: ^clt$data_value;
     VAR status: ost$status);

{ FUNCTION (osm$$inti) $interaction_information

?? PUSH (LISTEXT := ON) ??
?? FMT (FORMAT := OFF) ??

  VAR
    pdt: [STATIC, READ, cls$declaration_section] record
      header: clt$pdt_header,
    recend := [
    [1,
    [90, 3, 5, 19, 0, 11, 415],
    clc$function, 0, 0, 0, 0, 0, 0, 0, 'OSM$$INTI']];

?? FMT (FORMAT := ON) ??
?? POP ??


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

    make_info_record (work_area, result, status);

  PROCEND osp$$interaction_information;
?? TITLE := 'osp$_display_interaction_style', EJECT ??

  PROCEDURE [XDCL] osp$_display_interaction_inform
    (    parameter_list: clt$parameter_list;
     VAR status: ost$status);

{ PROCEDURE (osm$disis) display_interaction_information, disii (
{   output, o: file = $output
{   status)

?? PUSH (LISTEXT := ON) ??
?? FMT (FORMAT := OFF) ??

  VAR
    pdt: [STATIC, READ, cls$declaration_section] record
      header: clt$pdt_header,
      names: array [1 .. 3] of clt$pdt_parameter_name,
      parameters: array [1 .. 2] of clt$pdt_parameter,
      type1: record
        header: clt$type_specification_header,
        default_value: string (7),
      recend,
      type2: record
        header: clt$type_specification_header,
      recend,
    recend := [
    [1,
    [90, 3, 5, 13, 18, 23, 338],
    clc$command, 3, 2, 0, 0, 0, 0, 2, 'OSM$DISIS'], [
    ['O                              ',clc$abbreviation_entry, 1],
    ['OUTPUT                         ',clc$nominal_entry, 1],
    ['STATUS                         ',clc$nominal_entry, 2]],
    [
{ PARAMETER 1
    [2, clc$normal_usage_entry, clc$non_secure_parameter,
    $clt$parameter_spec_methods[clc$specify_by_name, clc$specify_positionally],
    clc$pass_by_value, clc$immediate_evaluation, clc$standard_parameter_checking, 3,
  clc$optional_default_parameter, 0, 7],
{ PARAMETER 2
    [3, clc$normal_usage_entry, clc$non_secure_parameter,
    $clt$parameter_spec_methods[clc$specify_by_name],
    clc$pass_by_reference, clc$immediate_evaluation, clc$standard_parameter_checking, 3,
  clc$optional_parameter, 0, 0]],
{ PARAMETER 1
    [[1, 0, clc$file_type],
    '$output'],
{ PARAMETER 2
    [[1, 0, clc$status_type]]];

?? FMT (FORMAT := ON) ??
?? POP ??

    CONST
      p$output = 1,
      p$status = 2;

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

*copy clv$display_variables

    VAR
      default_ring_attributes: amt$ring_attributes,
      display_control: clt$display_control,
      ignore_status: ^ost$status,
      representation: ^clt$data_representation,
      result: ^clt$data_value,
      work_area: ^^clt$work_area;

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

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

      VAR
        ignore_status: ost$status;


      clp$close_display (display_control, ignore_status);

    PROCEND abort_handler;
*copy clp$new_page_procedure
?? TITLE := 'put_subtitle', EJECT ??

    PROCEDURE [INLINE] put_subtitle
      (VAR display_control: clt$display_control;
       VAR status: ost$status);


{ The display_interaction_style command has no subtitles.
{ This is a "dummy" routine to keep this module consistent
{ with those that do produce subtitles.

    PROCEND put_subtitle;
?? OLDTITLE, EJECT ??

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

    clp$get_work_area (#RING (^work_area), work_area, status);
    IF NOT status.normal THEN
      RETURN;
    IFEND;

    make_info_record (work_area^, result, status);
    IF NOT status.normal THEN
      RETURN;
    IFEND;

    display_control := clv$nil_display_control;
    #SPOIL (display_control);
    osp$establish_block_exit_hndlr (^abort_handler);

    default_ring_attributes.r1 := #RING (^default_ring_attributes);
    default_ring_attributes.r2 := #RING (^default_ring_attributes);
    default_ring_attributes.r3 := #RING (^default_ring_attributes);
    clp$open_display_reference (pvt [p$output].value^.file_value^, ^clp$new_page_procedure, fsc$list,
          default_ring_attributes, display_control, status);
    IF NOT status.normal THEN
      osp$disestablish_cond_handler;
      RETURN
    IFEND;
    clv$titles_built := FALSE;
    clv$subtitles_built := FALSE;
    clv$command_name := 'display_interaction_style';

    IF display_control.page_width < clc$narrow_page_width THEN
      clv$page_width := clc$narrow_page_width;
    ELSEIF display_control.page_width > clc$wide_page_width THEN
      clv$page_width := clc$wide_page_width;
    ELSE
      clv$page_width := display_control.page_width;
    IFEND;

    clp$convert_data_to_string (result, clc$labeled_elem_representation, display_control.page_width,
          work_area^, representation, status);
    IF status.normal THEN
      clp$put_data_representation (display_control, representation, status);
    IFEND;

    IF status.normal THEN
      clp$close_display (display_control, status);
    ELSE
      PUSH ignore_status;
      clp$close_display (display_control, ignore_status^);
    IFEND;

    osp$disestablish_cond_handler;

  PROCEND osp$_display_interaction_inform;
?? TITLE := 'make_info_record', EJECT ??

  PROCEDURE make_info_record
    (VAR work_area {input, output} : ^clt$work_area;
     VAR result: ^clt$data_value;
     VAR status: ost$status);

    VAR
      interaction_information: array [1 .. 3] of ost$interaction_info_item,
      interactive_context: array [1 .. 1] of ift$fetch_context_attribute,
      keyword: clt$keyword;


    interaction_information [1].key := osc$interaction_style;
    interaction_information [2].key := osc$menu_rows;
    interaction_information [3].key := osc$extend_utility_interaction;
    osp$get_interaction_information (interaction_information, status);
    IF NOT status.normal THEN
      RETURN;
    IFEND;

    clp$make_record_value (4, work_area, result);

    result^.field_values^ [1].name := 'STYLE';
    IF interaction_information [1].style = osc$line_interaction THEN
      keyword := 'LINE';
    ELSEIF interaction_information [1].style = osc$screen_interaction THEN
      keyword := 'SCREEN';
    ELSE
      keyword := 'DESKTOP';
    IFEND;
    clp$make_keyword_value (keyword, work_area, result^.field_values^ [1].value);

    result^.field_values^ [2].name := 'MENU_ROWS';
    clp$make_integer_value (interaction_information [2].menu_rows, 10, FALSE, work_area,
          result^.field_values^ [2].value);

    result^.field_values^ [3].name := 'EXTEND_UTILITY_INTERACTION';
    clp$make_boolean_value (interaction_information [3].extend_utility_interaction, clc$yes_no_boolean,
          work_area, result^.field_values^ [3].value);

    result^.field_values^ [4].name := 'LAST_OPERATION_STYLE';
    IF interaction_information [1].style = osc$desktop_interaction THEN
      keyword := 'DESKTOP';
    ELSE
      interactive_context [1].key := ifc$previous_mode;
      ifp$fetch_context (interactive_context, status);
      IF NOT status.normal THEN
        RETURN;
      ELSEIF interactive_context [1].previous_mode = ifc$screen THEN
        keyword := 'SCREEN';
      ELSE
        keyword := 'LINE';
      IFEND;
    IFEND;
    clp$make_keyword_value (keyword, work_area, result^.field_values^ [4].value);

  PROCEND make_info_record;

MODEND osm$change_interact_style_cmnd;
