?? RIGHT := 110 ??
?? NEWTITLE := 'NOS/VE SCL Interpreter : Display_Message Command' ??
MODULE clm$comment_command;

{
{ PURPOSE:
{   This module contains the processor for the display_message command
{   (once upon a time called the comment command).

?? NEWTITLE := 'Global Declarations', EJECT ??
*copyc clp$evaluate_parameters
*copyc clp$log_comment
?? TITLE := 'clp$_display_message', EJECT ??

  PROCEDURE [XDCL] clp$_display_message
    (    parameter_list: clt$parameter_list;
     VAR status: ost$status);

{ PROCEDURE (osm$dism) display_message, dism (
{   message, m: list of string = $required
{   to, t: list of key
{       (account_log, al, account, a)
{       all
{       (display_message, dm, job_message, jm)
{       (engineering_log, engineering, el, e)
{       (job_log, job, jl, j)
{       (job_statistic_log, job_statistic, jsl, js)
{       (statistic_log, sl, statistic, s)
{       (system_log, system)
{       (history_log, hl, history, h)
{     keyend = job_log
{   status)

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

  VAR
    pdt: [STATIC, READ, cls$declaration_section] record
      header: clt$pdt_header,
      names: array [1 .. 5] of clt$pdt_parameter_name,
      parameters: array [1 .. 3] of clt$pdt_parameter,
      type1: record
        header: clt$type_specification_header,
        qualifier: clt$list_type_qualifier_v2,
        element_type_spec: record
          header: clt$type_specification_header,
          qualifier: clt$string_type_qualifier,
        recend,
      recend,
      type2: record
        header: clt$type_specification_header,
        qualifier: clt$list_type_qualifier_v2,
        element_type_spec: record
          header: clt$type_specification_header,
          qualifier: clt$keyword_type_qualifier,
          keyword_specs: array [1 .. 31] of clt$keyword_specification,
        recend,
        default_value: string (7),
      recend,
      type3: record
        header: clt$type_specification_header,
      recend,
    recend := [
    [1,
    [101, 4, 26, 12, 36, 36, 751],
    clc$command, 5, 3, 1, 0, 0, 0, 3, 'OSM$DISM'], [
    ['M                              ',clc$abbreviation_entry, 1],
    ['MESSAGE                        ',clc$nominal_entry, 1],
    ['STATUS                         ',clc$nominal_entry, 3],
    ['T                              ',clc$abbreviation_entry, 2],
    ['TO                             ',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, 24, clc$required_parameter,
  0, 0],
{ PARAMETER 2
    [5, 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, 1170,
  clc$optional_default_parameter, 0, 7],
{ PARAMETER 3
    [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$list_type], [8, 1, clc$max_list_size, 0, FALSE, FALSE],
      [[1, 0, clc$string_type], [0, clc$max_string_size, FALSE]]
    ],
{ PARAMETER 2
    [[1, 0, clc$list_type], [1154, 1, clc$max_list_size, 0, FALSE, FALSE],
      [[1, 0, clc$keyword_type], [31], [
      ['A                              ', clc$abbreviation_entry, clc$normal_usage_entry, 1],
      ['ACCOUNT                        ', clc$alias_entry, clc$normal_usage_entry, 1],
      ['ACCOUNT_LOG                    ', clc$nominal_entry, clc$normal_usage_entry, 1],
      ['AL                             ', clc$alias_entry, clc$normal_usage_entry, 1],
      ['ALL                            ', clc$nominal_entry, clc$normal_usage_entry, 2],
      ['DISPLAY_MESSAGE                ', clc$nominal_entry, clc$normal_usage_entry, 3],
      ['DM                             ', clc$alias_entry, clc$normal_usage_entry, 3],
      ['E                              ', clc$abbreviation_entry, clc$normal_usage_entry, 4],
      ['EL                             ', clc$alias_entry, clc$normal_usage_entry, 4],
      ['ENGINEERING                    ', clc$alias_entry, clc$normal_usage_entry, 4],
      ['ENGINEERING_LOG                ', clc$nominal_entry, clc$normal_usage_entry, 4],
      ['H                              ', clc$abbreviation_entry, clc$normal_usage_entry, 9],
      ['HISTORY                        ', clc$alias_entry, clc$normal_usage_entry, 9],
      ['HISTORY_LOG                    ', clc$nominal_entry, clc$normal_usage_entry, 9],
      ['HL                             ', clc$alias_entry, clc$normal_usage_entry, 9],
      ['J                              ', clc$abbreviation_entry, clc$normal_usage_entry, 5],
      ['JL                             ', clc$alias_entry, clc$normal_usage_entry, 5],
      ['JM                             ', clc$abbreviation_entry, clc$normal_usage_entry, 3],
      ['JOB                            ', clc$alias_entry, clc$normal_usage_entry, 5],
      ['JOB_LOG                        ', clc$nominal_entry, clc$normal_usage_entry, 5],
      ['JOB_MESSAGE                    ', clc$alias_entry, clc$normal_usage_entry, 3],
      ['JOB_STATISTIC                  ', clc$alias_entry, clc$normal_usage_entry, 6],
      ['JOB_STATISTIC_LOG              ', clc$nominal_entry, clc$normal_usage_entry, 6],
      ['JS                             ', clc$abbreviation_entry, clc$normal_usage_entry, 6],
      ['JSL                            ', clc$alias_entry, clc$normal_usage_entry, 6],
      ['S                              ', clc$abbreviation_entry, clc$normal_usage_entry, 7],
      ['SL                             ', clc$alias_entry, clc$normal_usage_entry, 7],
      ['STATISTIC                      ', clc$alias_entry, clc$normal_usage_entry, 7],
      ['STATISTIC_LOG                  ', clc$nominal_entry, clc$normal_usage_entry, 7],
      ['SYSTEM                         ', clc$abbreviation_entry, clc$normal_usage_entry, 8],
      ['SYSTEM_LOG                     ', clc$nominal_entry, clc$normal_usage_entry, 8]]
      ]
    ,
    'job_log'],
{ PARAMETER 3
    [[1, 0, clc$status_type]]];

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

    CONST
      p$message = 1,
      p$to = 2,
      p$status = 3;

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

    CONST
      a_log = 0,
      e_log = 1,
      j_log = 2,
      j_message = 3,
      js_log = 4,
      st_log = 5,
      sy_log = 6,
      h_log = 7;

    TYPE
      logs = a_log .. h_log;

    VAR
      current_to: ^clt$data_value,
      log: logs,
      log_name_selections: array [logs] of ost$name,
      message: ^clt$data_value;

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

    FOR log := LOWERVALUE (logs) TO UPPERVALUE (logs) DO
      log_name_selections [log] := osc$null_name;
    FOREND;

    current_to := pvt [p$to].value;
    WHILE current_to <> NIL DO
      IF current_to^.element_value^.keyword_value = 'ACCOUNT_LOG' THEN
        log_name_selections [a_log] := 'ACCOUNT';
      ELSEIF current_to^.element_value^.keyword_value = 'ALL' THEN
        log_name_selections [a_log] := 'ACCOUNT';
        log_name_selections [e_log] := 'ENGINEERING';
        log_name_selections [j_log] := 'JOB';
        log_name_selections [j_message] := 'JOB_MESSAGE';
        log_name_selections [js_log] := 'JOB_STATISTIC';
        log_name_selections [st_log] := 'STATISTIC';
        log_name_selections [sy_log] := 'SYSTEM';
        log_name_selections [h_log] := 'HISTORY';
      ELSEIF current_to^.element_value^.keyword_value = 'ENGINEERING_LOG' THEN
        log_name_selections [e_log] := 'ENGINEERING';
      ELSEIF current_to^.element_value^.keyword_value = 'JOB_LOG' THEN
        log_name_selections [j_log] := 'JOB';
      ELSEIF current_to^.element_value^.keyword_value = 'DISPLAY_MESSAGE' THEN
        log_name_selections [j_message] := 'JOB_MESSAGE';
      ELSEIF current_to^.element_value^.keyword_value = 'JOB_STATISTIC_LOG' THEN
        log_name_selections [js_log] := 'JOB_STATISTIC';
      ELSEIF current_to^.element_value^.keyword_value = 'STATISTIC_LOG' THEN
        log_name_selections [st_log] := 'STATISTIC';
      ELSEIF current_to^.element_value^.keyword_value = 'SYSTEM_LOG' THEN
        log_name_selections [sy_log] := 'SYSTEM';
      ELSEIF current_to^.element_value^.keyword_value = 'HISTORY_LOG' THEN
        log_name_selections [h_log] := 'HISTORY';
      IFEND;
      current_to := current_to^.link;
    WHILEND;

    message := pvt [p$message].value;
    WHILE message <> NIL DO
      clp$log_comment (message^.element_value^.string_value^ (1,
            STRLENGTH (message^.element_value^.string_value^)), log_name_selections, status);
      message := message^.link;
    WHILEND;

  PROCEND clp$_display_message;
?? OLDTITLE ??
MODEND clm$comment_command;
